/* ══════════════════════════════════════════════════════
   MCA EcoCollecte – style.css
   Couleurs logo : #0F5647 (vert foncé) · #71A731 (lime)
   Typographie   : Outfit + Inter
   Responsive    : mobile-first, 0 débordement horizontal
══════════════════════════════════════════════════════ */


/* ── Variables ─────────────────────────────────────── */

:root {
  --ff-body: 'Outfit', 'Inter', Arial, sans-serif;
  --ff-head: 'Outfit', Arial, sans-serif;
  --g-dark: #0F5647;
  --g-lime: #71A731;
  --g-main: #0F5647;
  --g-xpale: #f6faf8;
  --g-pale: #e8f5ee;
  --border: #dbe9e1;
  --header-bg: #fff;
  --header-border: #e3efe8;
  --txt: #222;
  --txt-mid: #3a4a3f;
  --txt-mute: #7a8c7f;
  --red: #d9534f;
  --red-bg: #ffeaea;
  --warn: #e67e22;
  --warn-bg: #fff8e1;
  --shadow-s: 0 2px 8px rgba(15,86,71,0.06);
  --shadow-m: 0 8px 24px rgba(15,86,71,0.10);
  --shadow-l: 0 16px 40px rgba(15,86,71,0.13);
  --r-xs: 8px;
  --r-s: 12px;
  --r-m: 16px;
  --r: 20px;
  --r-xl: 28px;
  --tr: 0.18s cubic-bezier(.4,0,.2,1);
  --surface: rgba(255,255,255,0.92);
  --surface-strong: #ffffff;
  --surface-soft: rgba(246,250,248,0.86);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--ff-body);
  background:
    radial-gradient(circle at top left, rgba(113,167,49,0.10), transparent 24%),
    radial-gradient(circle at top right, rgba(15,86,71,0.08), transparent 30%),
    linear-gradient(180deg, #f6faf8 0%, #eef5f0 100%);
  color: var(--txt);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

.screen {
  width: 100%;
  min-width: 0;
}

/* Tous les éléments restent dans la largeur */
img, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

.hidden { display: none !important; }
.active { display: flex !important; }

/* ══════════════════════════════════════════════════════
   ÉCRAN LOGIN  –  centré, plein écran, carte unique
══════════════════════════════════════════════════════ */
#screen-login {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.login-bg {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  /* Fond dégradé vert MCA subtil */
  background:
    radial-gradient(ellipse at 15% 80%, rgba(15,86,71,0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(113,167,49,0.10) 0%, transparent 50%),
    linear-gradient(160deg, #f0faf4 0%, #e8f5ee 100%);
}

/* Cercles déco en fond */
.deco-circle { position: absolute; border-radius: 50%; pointer-events: none; }
.c1 { width: 340px; height: 340px; background: rgba(15,86,71,0.07); bottom: -100px; right: -80px; }
.c2 { width: 200px; height: 200px; background: rgba(113,167,49,0.08); top: -50px; left: -60px; }
.c3 { width: 120px; height: 120px; background: rgba(113,167,49,0.06); top: 55%; right: 5%; }

/* Carte de connexion – largeur fluide */
.login-card {
  position: relative;
  z-index: 2;
  background: #ffffff;
  border-radius: 20px;
  padding: clamp(1.5rem, 5vw, 2.5rem);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-l);
  border: 1px solid rgba(15,86,71,0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* Animation d'entrée */
  animation: cardIn 0.45s cubic-bezier(.4,0,.2,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Logo MCA dans la carte – aux couleurs originales (pas de filtre blanc) */
.login-logo-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 0.25rem;
}
.login-logo-img {
  width: clamp(110px, 40%, 160px);
  /* Pas de filter : le logo garde ses couleurs #0F5647 et #71A731 */
}

.login-title {
  font-family: var(--ff-head);
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 800;
  color: var(--g-dark);
  text-align: center;
}
.login-subtitle {
  font-size: 0.83rem;
  color: var(--txt-mute);
  text-align: center;
  margin-top: -0.5rem;
}
.login-version {
  font-size: 0.7rem;
  color: var(--txt-mute);
  text-align: center;
}

/* ══════════════════════════════════════════════════════
   CHAMPS DE FORMULAIRE
══════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  /* Pas de margin-bottom fixe pour éviter les débordements */
}
.form-group label {
  font-family: var(--ff-head);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--txt-mid);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--txt-mute);
  font-size: 0.88rem;
  pointer-events: none;
  transition: color var(--tr);
  z-index: 1;
}
.input-wrap:focus-within .input-icon { color: var(--g-main); }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  /* padding-left grand pour l'icône, padding-right normal */
  padding: 0.7rem 0.9rem 0.7rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  font-family: var(--ff-body);
  font-size: 0.88rem;
  color: var(--txt);
  background: white;
  transition: border-color var(--tr), box-shadow var(--tr);
  outline: none;
  /* Empêche l'input de dépasser son conteneur */
  min-width: 0;
}
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--g-main);
  box-shadow: 0 0 0 3px rgba(15,86,71,0.10);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--txt-mute);
  font-size: 0.84rem;
}
.form-group textarea {
  resize: vertical;
  min-height: 80px;
  padding-left: 2.5rem;
}

/* Champ lecture seule (heure arrivée) */
.readonly-field {
  background: var(--g-pale) !important;
  color: var(--g-dark) !important;
  font-family: var(--ff-head) !important;
  font-weight: 600;
  cursor: default;
  letter-spacing: 0.04em;
}
.field-hint {
  font-size: 0.7rem;
  color: var(--txt-mute);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Message d'erreur sous les champs */
.field-error {
  color: #dc3545;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  animation: slideDown 0.2s ease-out;
}
.field-error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  font-size: 0.6rem;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group.has-error input,
.form-group.has-error select {
  border-color: #dc3545 !important;
}


/* Champ mot de passe */
.pass-wrap input { padding-right: 2.8rem; }
.pass-wrap > button {
  position: absolute;
  right: 0.7rem;
  background: none;
  border: none;
  color: var(--txt-mute);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.25rem;
  transition: color var(--tr);
  z-index: 2;
}
.pass-wrap > button:hover { color: var(--g-main); }

/* Alerte erreur */
.alert-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(214,48,49,0.2);
  border-radius: var(--r-xs);
  padding: 0.65rem 1rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ══════════════════════════════════════════════════════
   BOUTONS
══════════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--g-lime) 0%, #5a8a26 100%);
  color: white;
  border: none;
  padding: 0.78rem 1.4rem;
  border-radius: var(--r-xs);
  font-family: var(--ff-head);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--tr);
  box-shadow: 0 4px 14px rgba(113,167,49,0.32);
  width: auto;
  white-space: nowrap;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(113,167,49,0.42);
  filter: brightness(1.05);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: none;
}
.btn-full { width: 100%; }

.btn-ghost {
  background: transparent;
  color: var(--txt-mid);
  border: 1.5px solid var(--border);
  padding: 0.72rem 1.2rem;
  border-radius: var(--r-xs);
  font-family: var(--ff-head);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--tr);
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--g-pale); border-color: var(--g-main); color: var(--g-dark); }

.btn-validate {
  background: linear-gradient(135deg, var(--g-dark) 0%, #052e1c 100%);
  color: white;
  border: none;
  padding: 0.82rem 1.5rem;
  border-radius: var(--r-xs);
  font-family: var(--ff-head);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all var(--tr);
  box-shadow: 0 4px 16px rgba(15,86,71,0.32);
  white-space: nowrap;
}
.btn-validate:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15,86,71,0.42);
}

/* ══════════════════════════════════════════════════════
   HEADER – blanc avec logo aux vraies couleurs
══════════════════════════════════════════════════════ */
.app-header {
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid rgba(15,86,71,0.10);
  padding: 0.75rem 1rem;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 10px 24px rgba(15,86,71,0.08);
  backdrop-filter: blur(14px);
  /* Toute la largeur, pas de débordement */
  width: 100%;
  max-width: 100vw;
}

/* Logo dans le header : vraies couleurs du SVG (pas de filtre blanc) */
.header-logo {
  height: 26px;
  width: auto;
  /* Aucun filter : #0F5647 et #71A731 restent visibles sur fond blanc */
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ff-head);
  font-size: 0.72rem;
  /* Couleur texte sur fond blanc */
  color: var(--txt-mid);
  flex: 1;
  justify-content: center;
  /* Évite que le texte dépasse */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 0.5rem;
}

.pulse-dot {
  font-size: 0.5rem;
  color: var(--g-lime);
  flex-shrink: 0;
  animation: blink 2s infinite;
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
}
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.25;} }

.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--g-pale);
  border: 1.5px solid rgba(15,86,71,0.15);
  color: var(--g-dark);
  padding: 0.4rem 0.8rem;
  border-radius: var(--r-xs);
  font-family: var(--ff-head);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-logout:hover { background: var(--g-pale); border-color: var(--g-main); }
/* Masquer le texte sur très petit écran */
.btn-logout span { display: none; }
@media (min-width: 420px) { .btn-logout span { display: inline; } }

/* ══════════════════════════════════════════════════════
   DASHBOARD – mise en page fluide
══════════════════════════════════════════════════════ */
#screen-dashboard {
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.main-content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  /* Empêche le débordement */
  box-sizing: border-box;
  overflow-x: hidden;
}

.app-shell {
  position: relative;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.dashboard-side {
  display: flex !important;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-actions {
  display: flex !important;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

/* Hero card */
.hero-card {
  background: linear-gradient(135deg, #0d5a49 0%, #073729 62%, #06261c 100%);
  border-radius: 24px;
  padding: clamp(1.2rem, 2.8vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.1rem;
  flex-wrap: wrap;
  box-shadow: 0 20px 44px rgba(7, 45, 33, 0.18);
  position: relative;
  overflow: hidden;
  /* Largeur max dans le contenu */
  width: 100%;
}
.hero-text {
  min-width: 0;
  max-width: 560px;
}
.hero-card::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(113,167,49,0.18) 0%, transparent 70%);
  top: -50px; right: -50px;
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(113,167,49,0.2);
  color: #a8d96a;
  border: 1px solid rgba(113,167,49,0.3);
  padding: 0.22rem 0.7rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.hero-text h1 {
  font-family: var(--ff-head);
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  font-weight: 800;
  color: white;
  margin: 0;
}
.hero-text p {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.58);
}

/* Bouton Nouveau passage */
.btn-new-passage {
  background: var(--g-main); /* Fond vert foncé MCA */
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 0.95rem 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 12px 28px rgba(15, 86, 71, 0.25);
  flex-shrink: 0;
  /* S'adapte à la largeur disponible */
  min-width: 0;
  max-width: 100%;
}
.btn-new-passage:hover { 
  transform: translateY(-3px) scale(1.01); 
  box-shadow: 0 15px 35px rgba(15, 86, 71, 0.35);
  background: #146957; /* Légèrement plus clair au survol */
}

.btn-new-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: white; /* Icône sur fond blanc pour détacher */
  color: var(--g-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.btn-new-text { display: flex; flex-direction: column; text-align: left; min-width: 0; }
.btn-new-text strong {
  font-family: var(--ff-head);
  font-size: 0.88rem;
  color: white; /* Texte en blanc pour un contraste maximal */
}
.btn-new-text span {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85); /* Texte secondaire légèrement transparent */
  font-weight: 500;

  font-weight: 700;
  color: var(--g-dark);
  white-space: nowrap;
}
.btn-new-text small { font-size: 0.7rem; color: var(--txt-mute); white-space: nowrap; }

/* Sur très petit écran : colonne empilée */
@media (max-width: 400px) {
  .hero-card { flex-direction: column; align-items: flex-start; }
  .btn-new-passage { width: 100%; }
}

.sync-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--txt-mid);
  font-family: var(--ff-head);
  font-size: 0.76rem;
  font-weight: 700;
  box-shadow: var(--shadow-s);
}

.sync-pill.online,
.sync-pill.success {
  background: #eef8e8;
  border-color: rgba(113,167,49,0.32);
  color: var(--g-dark);
}

.sync-pill.offline {
  background: #fff3f3;
  border-color: rgba(214,48,49,0.24);
  color: var(--red);
}

.sync-pill.pending {
  background: #fff8e8;
  border-color: rgba(230,126,34,0.24);
  color: #9b5f13;
}

.sync-pill.idle {
  background: #f6faf8;
}

/* Statistiques */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  width: 100%;
}
.stat-card {
  background: var(--surface);
  border: 1px solid rgba(15,86,71,0.08);
  border-radius: 22px;
  padding: 1rem 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  box-shadow: 0 10px 24px rgba(15,86,71,0.08);
  transition: transform var(--tr), box-shadow var(--tr);
  min-width: 0; /* important pour éviter débordement en grid */
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.green { background: #e6f5ec; color: var(--g-dark); }
.stat-icon.lime  { background: #f0f8e4; color: var(--g-lime); }

.stat-info { flex: 1; min-width: 0; overflow: hidden; }
.stat-num {
  display: block;
  font-family: var(--ff-head);
  font-size: clamp(1.4rem, 4vw, 1.75rem);
  font-weight: 800;
  color: var(--g-dark);
  line-height: 1;
  white-space: nowrap;
}
.stat-label {
  display: block;
  font-size: clamp(0.65rem, 1.8vw, 0.72rem);
  color: var(--txt-mute);
  margin-top: 0.15rem;
  /* Retour à la ligne si nécessaire */
  word-break: break-word;
}
.stat-arrow { color: var(--g-lime); font-size: 0.85rem; flex-shrink: 0; }

/* Liste d'actions */
.action-list { display: flex; flex-direction: column; gap: 0.55rem; width: 100%; }
.action-row {
  background: var(--surface);
  border: 1px solid rgba(15,86,71,0.08);
  border-radius: 22px;
  padding: 1rem 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 10px 24px rgba(15,86,71,0.08);
  text-align: left;
  width: 100%;
  min-width: 0;
}
.action-row:hover { background: var(--g-xpale); border-color: var(--g-main); transform: translateX(3px); }

.action-row-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: #e6f5ec;
  color: var(--g-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.action-row-icon.lime { background: #f0f8e4; color: var(--g-lime); }
.action-row-text { flex: 1; min-width: 0; }
.action-row-text strong {
  display: block;
  font-family: var(--ff-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-row-text span { font-size: 0.72rem; color: var(--txt-mute); }

.badge-sync {
  background: var(--red, #d9534f);
  color: white;
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 800;
  margin: 0 8px;
  box-shadow: 0 2px 8px rgba(217,83,79,0.3);
}

.badge-sync.hidden { display: none !important; }

.action-row > .bi-chevron-right { color: var(--txt-mute); font-size: 0.82rem; flex-shrink: 0; }

/* Correction responsive dashboard */
@media (max-width: 768px) {
  .dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .dashboard-side {
    width: 100%;
  }

  .action-row {
    padding: 0.85rem;
    border-radius: 18px;
  }

  .action-row-text strong {
    font-size: 0.82rem;
  }
}

/* Ajout pour garantir que le bouton et ses parents sont visibles */
.dashboard-side, .dashboard-actions, #btn-open-history {
  display: flex !important;
}

#btn-open-history.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════════════════
   MODAL OVERLAY + PANEL
   Centré horizontalement et verticalement sur tous les écrans
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 20, 12, 0.65); /* Fond assombri plus prononcé */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000; /* Priorité maximale */
  display: flex;
  align-items: center; /* Centrage vertical */
  justify-content: center; /* Centrage horizontal */
  animation: fadeIn 0.25s ease;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden; /* Empêche le scroll du body en arrière-plan */
  padding: 1rem; /* Marge de sécurité mobile */
}

@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

.modal-panel {
  background: #ffffff;
  width: 100%;
  max-width: 640px;
  /* Hauteur max pour éviter de sortir de l'écran */
  max-height: 90vh;
  max-height: 90dvh;
  border-radius: 20px; /* Coins arrondis sur mobile aussi */
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 30px 70px rgba(7, 45, 33, 0.25);
  animation: panelPop 0.3s cubic-bezier(.34, 1.56, .64, 1);
  box-sizing: border-box;
  position: relative;
}

@keyframes panelPop {
  from { opacity:0; transform: scale(0.95) translateY(10px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

.modal-panel.wide { max-width: 1100px; }
.modal-panel.wizard {
  max-width: 800px;
  background: #ffffff;
}

/* Header du modal - Style Moderne MCA */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--g-main); /* Vert MCA Moderne */
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ff-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: white; /* Titre en blanc */
  white-space: nowrap;
  flex-shrink: 0;
}
.modal-title-wrap .bi { color: var(--g-lime); }

/* Stepper Modernisé */
.stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 0.35rem 0.55rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
}
.stepper-step { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.6rem; border-radius: 50px; }
.stepper-step.active { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

.s-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-family: var(--ff-head);
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-step.active .s-dot { background: var(--g-main); color: white; }
.s-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}
.stepper-step.active .s-lbl { color: var(--g-main); }

.btn-close-modal {
  background: rgba(255,255,255,0.1);
  border: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--tr);
  flex-shrink: 0;
}
.btn-close-modal:hover { background: rgba(255,255,255,0.2); transform: rotate(90deg); }

/* Contenu du wizard */
.wizard-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-sizing: border-box;
  background: #f8faf9;
}

/* Contenu de chaque étape */
.step-content {
  padding: 1.25rem;
  flex-direction: column;
  gap: 1.25rem;
  display: none;
  width: 100%;
  box-sizing: border-box;
  background: white;
  min-height: auto;
  border: 1px solid rgba(15,86,71,0.08);
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(15,86,71,0.05);
}
.step-content.active { display: flex; }

/* Intro de l'étape */
.step-intro {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--g-pale); 
  border-radius: 14px;
  border: 1px solid rgba(15,86,71,0.1);
  border-left: 4px solid var(--g-main);
  margin-bottom: 0.4rem;
}
.step-intro-icon {
  width: 36px; 
  height: 36px;
  border-radius: 10px;
  background: var(--g-main);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(15,86,71,0.2);
}
.step-intro-icon.green { background: linear-gradient(135deg, var(--g-lime), #5a8a26); }
.step-intro h2 {
  font-family: var(--ff-head);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--g-dark);
  margin: 0;
  line-height: 1.2;
}
.step-intro p { display: none; }

/* Grilles de formulaire – responsive */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  width: 100%;
  padding-top: 0.6rem;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Sur mobile : tout en 1 colonne */
@media (max-width: 500px) {
  .form-grid,
  .form-grid.cols-3 { grid-template-columns: 1fr; }
}
/* Sur tablette : cols-3 passe à 2 colonnes */
@media (min-width: 501px) and (max-width: 640px) {
  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

/* Blocs de section */
.section-block {
  border: 1px solid rgba(15,86,71,0.08);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.96);
  width: 100%;
  box-shadow: 0 10px 24px rgba(15,86,71,0.06);
}
.section-title {
  background: var(--g-xpale);
  padding: 0.6rem 0.9rem;
  font-family: var(--ff-head);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--g-dark);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.section-block .form-grid { padding: 0.85rem; }

.tri-audit-panel {
  padding: 1rem;
  background:
    radial-gradient(circle at top left, rgba(113,167,49,0.12), transparent 34%),
    linear-gradient(180deg, #f7fbf8 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border);
}

.tri-question-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid #dbe9e1;
  border-radius: 18px;
  background: white;
  box-shadow: 0 16px 34px rgba(9, 44, 31, 0.06);
}

.tri-question-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.tri-question-kicker {
  font-family: var(--ff-head);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--g-lime);
}

.tri-question-copy h3 {
  font-family: var(--ff-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--g-dark);
  line-height: 1.3;
}

.tri-question-copy p {
  font-size: 0.78rem;
  color: var(--txt-mute);
  line-height: 1.5;
}

/* Badge "choix multiple" */
.badge-multi {
  background: rgba(113,167,49,0.14);
  color: var(--g-lime);
  padding: 0.12rem 0.5rem;
  border-radius: 50px;
  font-size: 0.65rem;
  font-weight: 600;
  border: 1px solid rgba(113,167,49,0.22);
  white-space: nowrap;
}

/* Chips multi-sélection */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem;
}
.chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: white;
  color: var(--txt-mid);
  font-family: var(--ff-head);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--tr);
  user-select: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--g-lime); background: rgba(113,167,49,0.05); }
.chip.active {
  background: linear-gradient(135deg, var(--g-lime), #5a8a26);
  color: white;
  border-color: var(--g-lime);
  box-shadow: 0 2px 8px rgba(113,167,49,0.28);
}

/* Cartes de contrôle sécurité */
.control-card {
  margin: 0 0.85rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  overflow: hidden;
  transition: border-color var(--tr);
}
.control-card:first-of-type { margin-top: 0.7rem; }
.control-card.mt { margin-top: 0; }

.control-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  flex-wrap: wrap;
}
.control-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.control-icon.warn { background: var(--warn-bg); color: var(--warn); }
.control-icon.red  { background: var(--red-bg);  color: var(--red); }

.control-info { flex: 1; min-width: 100px; }
.control-info strong {
  display: block;
  font-family: var(--ff-head);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--txt);
}
.control-info span { font-size: 0.7rem; color: var(--txt-mute); }

/* Pills Oui / Non */
.pill-group { display: flex; gap: 0.3rem; flex-shrink: 0; }
.pill-group-audit { gap: 0.55rem; }
.pill {
  padding: 0.32rem 0.8rem;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: white;
  font-family: var(--ff-head);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--txt-mute);
  cursor: pointer;
  transition: all var(--tr);
  white-space: nowrap;
}
.pill.active { background: var(--g-pale); color: var(--g-dark); border-color: rgba(15,86,71,0.28); }
.pill.red.active { background: var(--red-bg); color: var(--red); border-color: rgba(214,48,49,0.28); }

.pill-choice {
  min-width: 106px;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
}

.pill-choice.active {
  background: linear-gradient(135deg, #eaf6ef, #dff1e5);
  color: var(--g-dark);
  border-color: rgba(15,86,71,0.22);
  box-shadow: 0 10px 20px rgba(15,86,71,0.08);
}

.pill-choice.red.active {
  background: linear-gradient(135deg, #fff1f1, #ffe1e1);
  color: var(--red);
  border-color: rgba(214,48,49,0.26);
  box-shadow: 0 10px 20px rgba(214,48,49,0.08);
}

.tri-non-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  background: linear-gradient(180deg, #fcfefd 0%, #f6faf8 100%);
}

.alert-success {
  margin: 0 1rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(113,167,49,0.22);
  background: linear-gradient(135deg, #eef8e8, #f7fcf4);
  color: var(--g-dark);
  box-shadow: 0 16px 26px rgba(113,167,49,0.10);
  animation: triSuccessIn 0.24s ease;
}

.alert-success .bi {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g-lime), #5a8a26);
  color: white;
  font-size: 1rem;
  box-shadow: 0 10px 18px rgba(113,167,49,0.22);
}

@keyframes triSuccessIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.tri-selection-card {
  background: white;
  border: 1px solid #dfe9e4;
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow-s);
}

.photo-actions {
  display: flex;
}

.photo-upload-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid #d7e4dc;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fcfa 0%, #eef7f2 100%);
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 10px 24px rgba(9, 44, 31, 0.05);
}

.photo-upload-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(113,167,49,0.42);
  box-shadow: 0 14px 28px rgba(9, 44, 31, 0.08);
}

.photo-upload-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--g-dark), #0b6b53);
  color: white;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.photo-upload-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.photo-upload-copy strong {
  font-family: var(--ff-head);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--g-dark);
  line-height: 1.25;
}

.photo-upload-copy small {
  margin-top: 0.18rem;
  font-size: 0.73rem;
  color: var(--txt-mute);
  line-height: 1.4;
}

.tri-selection-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.tri-selection-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--ff-head);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--g-dark);
}

.tri-selection-head p {
  margin-top: 0.28rem;
  font-size: 0.75rem;
  color: var(--txt-mute);
  line-height: 1.5;
}

.tri-selection-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.95rem;
}

.tri-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: start;
}

.tri-inline-problems-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5eee8;
}

.tri-choice-card,
.tri-problem-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.9rem;
  border: 1px solid #dfe7e2;
  border-radius: 16px;
  background: #fbfdfc;
  cursor: pointer;
  transition: all var(--tr);
  min-width: 0;
}

.tri-choice-card input,
.tri-problem-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tri-choice-card:hover,
.tri-problem-card:hover {
  transform: translateY(-1px);
  border-color: rgba(113,167,49,0.42);
  box-shadow: 0 12px 24px rgba(9, 44, 31, 0.06);
}

.tri-choice-card.selected,
.tri-problem-card.selected {
  border-color: rgba(113,167,49,0.55);
  background: linear-gradient(135deg, #f3f9ef, #edf7f2);
  box-shadow: 0 12px 24px rgba(113,167,49,0.12);
}

.tri-choice-card.locked {
  cursor: not-allowed;
  opacity: 0.72;
}

.tri-choice-card.locked:hover {
  transform: none;
  border-color: rgba(113,167,49,0.55);
  box-shadow: 0 12px 24px rgba(113,167,49,0.12);
}

.tri-choice-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #edf6ef;
  color: var(--g-dark);
  font-size: 1rem;
  flex-shrink: 0;
}

.tri-choice-text {
  font-family: var(--ff-head);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--txt);
}

.tri-choice-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.tri-choice-copy small {
  font-size: 0.72rem;
  color: var(--txt-mute);
  line-height: 1.4;
}

.tri-problem-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  padding: 0.85rem 1rem 1rem;
}

.tri-problem-field {
  margin: 0;
}

.tri-field-label {
  display: block;
  margin-bottom: 0.55rem;
  font-family: var(--ff-head);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--g-dark);
}

.tri-checkbox-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.tri-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d8e4dc;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: all var(--tr);
}

.tri-checkbox-item:hover {
  border-color: rgba(113,167,49,0.42);
  background: #f9fcfa;
}

.tri-checkbox-item input[type="checkbox"] {
  appearance: auto;
  -webkit-appearance: checkbox;
  width: 18px;
  height: 18px;
  margin-top: 0.05rem;
  flex-shrink: 0;
  opacity: 1;
  position: static;
  pointer-events: auto;
  accent-color: var(--g-lime);
}

.tri-checkbox-item span {
  font-size: 0.79rem;
  color: var(--txt);
  line-height: 1.45;
}

.tri-checkbox-item.selected {
  border-color: rgba(113,167,49,0.55);
  background: linear-gradient(135deg, #f3f9ef, #edf7f2);
  box-shadow: 0 8px 18px rgba(113,167,49,0.10);
}

.tri-checkbox-item.selected span {
  color: var(--g-dark);
  font-weight: 600;
}

.tri-quantity-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 180px);
  gap: 0.75rem;
}

.tri-compact-input input,
.tri-compact-input select {
  background: #fff;
}

.tri-comment-field {
  margin-top: 0.1rem;
}

.tri-choice-card {
  font: inherit;
  text-align: left;
}

.tri-problem-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.tri-problem-button {
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 1px solid #d8e4dc;
  border-radius: 12px;
  background: white;
  color: var(--txt);
  font-family: var(--ff-body);
  font-size: 0.8rem;
  line-height: 1.45;
  cursor: pointer;
  transition: all var(--tr);
}

.tri-problem-button:hover {
  border-color: rgba(113,167,49,0.42);
  background: #f9fcfa;
}

.tri-problem-button.selected {
  border-color: rgba(113,167,49,0.55);
  background: linear-gradient(135deg, #f3f9ef, #edf7f2);
  color: var(--g-dark);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(113,167,49,0.10);
}

.tri-problem-groups {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 90px;
  margin-top: 0.85rem;
}

.tri-choice-card {
  flex-wrap: wrap;
  align-self: start;
}

.tri-choice-inline-problems {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid #dfe8e2;
}

.tri-choice-inline-meta {
  margin-bottom: 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--txt-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


.tri-problem-group {
  border: 1px solid #e1ebe4;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdfc 0%, #f5faf7 100%);
  box-shadow: 0 8px 18px rgba(9, 44, 31, 0.05);
  overflow: hidden;
}

.tri-problem-group-header {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  background: linear-gradient(180deg, #f9fcfa 0%, #f2f8f4 100%);
}

.tri-problem-group-head-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.tri-problem-group-summary-title {
  font-size: 0.73rem;
  color: var(--txt-mute);
  font-weight: 600;
}

.tri-problem-group-title {
  font-family: var(--ff-head);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--g-dark);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tri-problem-group-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.tri-problem-group-check {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--g-lime), #5a8a26);
  color: white;
  box-shadow: 0 8px 16px rgba(113,167,49,0.22);
  flex-shrink: 0;
}

.tri-problem-group-check .bi {
  font-size: 0.85rem;
}

.tri-problem-remove {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid rgba(214,48,49,0.18);
  background: #fff5f5;
  color: var(--red);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-family: var(--ff-head);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--tr);
}

.tri-problem-remove:hover {
  background: #ffeaea;
  border-color: rgba(214,48,49,0.3);
}

.tri-empty-state {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px dashed #cfe0d5;
  border-radius: 16px;
  background: #f9fcfa;
  color: var(--txt-mute);
  font-size: 0.78rem;
}

.tri-empty-state .bi {
  color: var(--g-lime);
  font-size: 1rem;
}

.tri-problem-card {
  align-items: flex-start;
  padding-right: 1rem;
}

.tri-problem-card span {
  font-size: 0.78rem;
  color: var(--txt);
  line-height: 1.5;
}

.tri-problem-card.selected span {
  color: var(--g-dark);
  font-weight: 600;
}


.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 70px));
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.photo-thumb {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dfe7e2;
  background: #f4f8f6;
  box-shadow: 0 6px 16px rgba(9, 44, 31, 0.06);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.photo-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(8, 24, 17, 0.78);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.photo-lightbox.active {
  display: flex !important;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 9, 0.78);
  backdrop-filter: blur(4px);
}

.photo-lightbox-content {
  position: relative;
  z-index: 5001;
  max-width: min(92vw, 860px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox-content img {
  max-width: 100%;
  max-height: 88vh;
  display: block;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.photo-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: white;
  color: var(--g-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.photo-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--g-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.photo-lightbox-nav.prev { left: -60px; }
.photo-lightbox-nav.next { right: -60px; }

.photo-lightbox-count {
  position: absolute;
  left: 50%;
  bottom: -44px;
  transform: translateX(-50%);
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--g-dark);
  font-family: var(--ff-head);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

@media (max-width: 640px) {
  .photo-lightbox-nav.prev { left: 8px; }
  .photo-lightbox-nav.next { right: 8px; }

  .tri-question-card {
    flex-direction: column;
    align-items: stretch;
  }

  .pill-group-audit {
    width: 100%;
  }

  .pill-choice {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .tri-choice-grid {
    grid-template-columns: 1fr;
  }

  .tri-quantity-row {
    grid-template-columns: 1fr;
  }
}

/* Zone remarque */
.control-remarque {
  border-top: 1px solid var(--border);
  background: var(--g-xpale);
  padding: 0.7rem 0.85rem;
  animation: slideDown 0.2s ease;
}
@keyframes slideDown {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

.remarque-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  padding: 0.7rem;
  transition: border-color var(--tr);
  width: 100%;
  box-sizing: border-box;
}
.remarque-box:focus-within { border-color: var(--g-main); box-shadow: 0 0 0 3px rgba(15,86,71,0.08); }
.remarque-box .bi { color: var(--g-lime); margin-top: 0.1rem; flex-shrink: 0; font-size: 0.9rem; }
.remarque-box textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--ff-body);
  font-size: 0.84rem;
  color: var(--txt);
  background: transparent;
  line-height: 1.5;
  min-width: 0;
  width: 100%;
}
.remarque-box textarea::placeholder { color: var(--txt-mute); }
.remarque-box.standalone {
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  padding: 0.7rem;
  background: white;
  margin: 0.85rem;
  width: calc(100% - 1.7rem);
  box-sizing: border-box;
}

/* Taux de remplissage */
.taux-card { padding: 0.85rem; }
.taux-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}
.taux-label-left, .taux-label-right {
  font-size: 0.7rem;
  color: var(--txt-mute);
}
.taux-badge-large {
  background: linear-gradient(135deg, var(--g-dark), #062e1e);
  color: white;
  font-family: var(--ff-head);
  font-size: 1rem;
  font-weight: 800;
  padding: 0.28rem 0.9rem;
  border-radius: 50px;
  min-width: 60px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(15,86,71,0.22);
  transition: background 0.3s;
}
.taux-slider-wrap { margin-bottom: 0.35rem; }
.taux-slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--g-lime);
  height: 6px;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  display: block;
}
.taux-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.63rem;
  color: var(--txt-mute);
}

/* Actions de l'étape */
.step-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
@media (max-width: 380px) {
  .step-actions { flex-direction: column-reverse; }
  .step-actions > button { width: 100%; justify-content: center; }
}

/* ══════════════════════════════════════════════════════
   RÉCAPITULATIF
══════════════════════════════════════════════════════ */
.recap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  width: 100%;
}
@media (max-width: 440px) { .recap-grid { grid-template-columns: 1fr; } }

.recap-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  overflow: hidden;
  min-width: 0;
}
.recap-card.full { grid-column: 1 / -1; }
.recap-card-head {
  background: var(--g-xpale);
  padding: 0.5rem 0.8rem;
  font-family: var(--ff-head);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--g-main);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.recap-card-body { padding: 0.55rem 0.8rem; }
.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.2rem 0;
  gap: 0.4rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.recap-row > span:first-child { color: var(--txt-mute); font-size: 0.73rem; }
.recap-row > span:last-child { font-weight: 600; color: var(--txt); text-align: right; word-break: break-word; }
.badge-ok      { background: #e8f5ec; color: var(--g-dark); padding: 0.1rem 0.5rem; border-radius: 50px; font-size: 0.7rem; font-weight: 700; }
.badge-danger  { background: var(--red-bg); color: var(--red); padding: 0.1rem 0.5rem; border-radius: 50px; font-size: 0.7rem; font-weight: 700; }

/* ══════════════════════════════════════════════════════
   MODAL HISTORIQUE
══════════════════════════════════════════════════════ */
.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
}
.history-shell {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: linear-gradient(180deg, rgba(246,250,248,0.92) 0%, rgba(255,255,255,0.96) 100%);
}
.history-filters-card,
.history-table-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(15,86,71,0.08);
  border-radius: 22px;
  box-shadow: 0 18px 36px rgba(15,86,71,0.08);
}
.history-filters-card {
  padding: 1rem;
}
.history-field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: min(100%, 220px);
  flex: 1 1 220px;
}
.history-field label {
  font-family: var(--ff-head);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--g-dark);
  letter-spacing: 0.02em;
}
.history-input-wrap,
.history-search-wrap,
.history-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.history-input-wrap i,
.history-search-wrap i,
.history-select-wrap i {
  position: absolute;
  left: 0.95rem;
  color: var(--txt-mute);
  font-size: 0.95rem;
  pointer-events: none;
}
.history-input-wrap input,
.history-search-wrap input,
.history-select-wrap select {
  width: 100%;
  min-height: 46px;
  padding: 0.78rem 0.95rem 0.78rem 2.6rem;
  border: 1px solid rgba(15,86,71,0.12);
  border-radius: 14px;
  background: #fff;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--txt);
  transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}
.history-input-wrap input:focus,
.history-search-wrap input:focus,
.history-select-wrap select:focus {
  border-color: rgba(15,86,71,0.28);
  box-shadow: 0 0 0 4px rgba(15,86,71,0.08);
  outline: none;
}
.history-search-wrap input::placeholder {
  color: #7f9186;
}
.btn-history-filter {
  min-height: 46px;
  padding: 0.78rem 1.15rem;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(113,167,49,0.22);
}
.history-table-card {
  overflow: hidden;
  border-radius: 24px;
}
.history-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid rgba(15,86,71,0.08);
  background: rgba(255,255,255,0.96);
  position: sticky;
  top: 0;
  z-index: 4;
}
.history-search-wrap {
  flex: 1 1 320px;
}
.history-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.history-select-wrap {
  min-width: 200px;
  flex: 1 1 200px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(62vh, 640px);
  padding: 0 1rem 1rem;
  width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable both-edges;
  scrollbar-width: thin;
  scrollbar-color: rgba(15,86,71,0.34) rgba(15,86,71,0.06);
}
.history-scrollbar-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin: 0 1rem;
  border-bottom: 1px solid rgba(15,86,71,0.08);
  scrollbar-width: thin;
  scrollbar-color: rgba(15,86,71,0.3) transparent;
  background: linear-gradient(180deg, rgba(246,250,248,0.92) 0%, rgba(255,255,255,0.6) 100%);
  position: sticky;
  top: 73px;
  z-index: 3;
}
.history-scrollbar-top::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
.history-scrollbar-top::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(15,86,71,0.22);
  border-radius: 999px;
}
.history-scrollbar-top::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(15,86,71,0.64) 0%, rgba(113,167,49,0.72) 100%);
  border: 2px solid rgba(255,255,255,0.92);
  box-shadow: inset 0 0 0 1px rgba(15,86,71,0.08);
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(15,86,71,0.78) 0%, rgba(113,167,49,0.86) 100%);
}
.table-wrap::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(15,86,71,0.04) 0%, rgba(15,86,71,0.09) 100%);
  border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-corner {
  background: transparent;
}
.history-scrollbar-track {
  height: 1px;
}
table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
  font-family: 'Inter', Arial, sans-serif;
}
thead th {
  background: rgba(255,255,255,0.98);
  color: var(--g-dark);
  font-family: var(--ff-head);
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.95rem 1rem;
  border-bottom: 1px solid rgba(15,86,71,0.10);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}
thead th:first-child { border-top-left-radius: 16px; }
thead th:last-child { border-top-right-radius: 16px; }
tbody tr {
  transition: background var(--tr), transform var(--tr), box-shadow var(--tr);
}
tbody tr:hover {
  background: rgba(246,250,248,0.92);
  box-shadow: inset 0 0 0 999px rgba(246,250,248,0.55);
}
tbody td {
  padding: 1rem;
  color: var(--txt-mid);
  border-bottom: 1px solid rgba(15,86,71,0.07);
  vertical-align: middle;
  background: rgba(255,255,255,0.92);
}
.history-col-client {
  min-width: 180px;
}
.history-primary-text {
  display: block;
  font-weight: 700;
  color: #18352b;
}
.history-secondary-text {
  display: block;
  margin-top: 0.18rem;
  color: var(--txt-mute);
  font-size: 0.78rem;
}
.history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 74px;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
}
.history-badge.yes {
  background: rgba(113,167,49,0.14);
  color: #3b6912;
}
.history-badge.no {
  background: rgba(123,137,128,0.16);
  color: #536158;
}
.history-badge.neutral {
  background: rgba(15,86,71,0.08);
  color: var(--g-dark);
}
.history-multiline {
  white-space: normal;
  min-width: 170px;
}
.history-inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.history-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(15,86,71,0.07);
  color: var(--g-dark);
  font-size: 0.75rem;
  font-weight: 600;
}
.history-note {
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  color: var(--txt-mid);
}
.no-data {
  text-align: center;
  color: var(--txt-mute);
  padding: 2.5rem 1rem !important;
  font-size: 0.84rem;
  white-space: normal !important;
}
.history-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: flex-end;
}
.history-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(15,86,71,0.12);
  background: #fff;
  color: var(--g-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--tr), border-color var(--tr), background var(--tr), color var(--tr), box-shadow var(--tr);
}
.history-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(15,86,71,0.24);
  background: rgba(15,86,71,0.06);
  box-shadow: 0 10px 18px rgba(15,86,71,0.08);
}
.history-action-btn.delete {
  color: var(--red);
  border-color: rgba(217,83,79,0.18);
}
.history-action-btn.delete:hover {
  background: rgba(217,83,79,0.08);
  border-color: rgba(217,83,79,0.32);
}

@media (max-width: 860px) {
  .history-shell {
    padding: 0.65rem;
  }

  .history-table-toolbar,
  .history-filters-card {
    padding: 0.85rem;
  }

  .history-table-card {
    border-radius: 20px;
  }

  .history-table-toolbar {
    position: static;
  }

  .history-scrollbar-top {
    top: 0;
    margin: 0 0.85rem;
  }

  .table-wrap {
    max-height: min(56vh, 560px);
    padding: 0 0.85rem 0.85rem;
  }

  .history-toolbar-filters {
    width: 100%;
  }

  .history-select-wrap {
    min-width: 0;
    flex: 1 1 100%;
  }

  .btn-history-filter {
    width: 100%;
    justify-content: center;
  }

  table {
    min-width: 980px;
  }

  thead th,
  tbody td {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }
}

@media (max-width: 600px) {
  .history-filters {
    gap: 0.75rem;
  }

  .history-field,
  .history-search-wrap,
  .history-select-wrap {
    flex: 1 1 100%;
  }

  .history-input-wrap input,
  .history-search-wrap input,
  .history-select-wrap select {
    min-height: 44px;
    font-size: 0.86rem;
  }

  .history-scrollbar-top {
    height: 12px;
  }

  table {
    min-width: 920px;
    font-size: 0.8rem;
  }
}

/* Modal détail */
.detail-body {
  padding: 1rem 1.1rem 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.detail-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-s);
  overflow: hidden;
}
.detail-card-head {
  padding: 0.75rem 1rem;
  background: #f6faf8;
  border-bottom: 1px solid var(--border);
}
.detail-card-title {
  font-family: var(--ff-head);
  font-weight: 700;
  color: var(--g-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-card-title .bi { color: var(--g-lime); }
.detail-card-grid {
  padding: 0.75rem 1rem 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.detail-card-grid.tri-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.detail-span-all { grid-column: 1 / -1; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--txt-mute);
  margin-bottom: 0.25rem;
}
.detail-value {
  background: #f6faf8;
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  padding: 0.75rem 0.85rem;
  font-weight: 700;
  color: var(--g-dark);
  min-height: 42px;
  display: flex;
  align-items: center;
}
.detail-photos .photo-grid {
  margin-top: 0.4rem;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}
.detail-photos .photo-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.detail-list-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: var(--g-dark);
}
.detail-list-item .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--g-lime);
  flex-shrink: 0;
}
.detail-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.1rem 0;
  min-height: 42px;
  align-items: flex-start;
}
.detail-box-item {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: #f6faf8;
  color: var(--g-dark);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.78rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.badge-value {
  display: inline-flex;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-weight: 700;
  color: white;
  border: 1px solid transparent;
  min-height: auto;
  align-self: flex-start;
}
.badge-value.ok { background: #3ba55a; }
.badge-value.no { background: #d9534f; }
.detail-note {
  padding: 0.85rem 1rem;
  border-radius: var(--r-s);
  border: 1px solid var(--border);
  background: #fdfdfc;
  color: var(--g-dark);
  min-height: 64px;
  line-height: 1.5;
  font-size: 0.9rem;
}
.detail-photos-grid {
  padding: 0.85rem 1rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}

/* ══════════════════════════════════════════════════════
   TOAST - Version Haute Visibilité
══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #212529; /* Gris très foncé presque noir */
  color: #ffffff;
  padding: 1.25rem 2rem; /* Plus généreux */
  border-radius: 12px;
  font-family: var(--ff-head);
  font-size: 1rem;
  font-weight: 700;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  z-index: 999999 !important; /* Supérieur à tout le reste, vraiment */
  text-align: center;
  width: max-content;
  min-width: 280px;
  max-width: 85vw;
  border: 2px solid rgba(255,255,255,0.25);
  display: none; /* Contrôlé par JS */
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  pointer-events: auto;
  opacity: 1; /* S'assure qu'il n'est pas transparent */
}

.toast.success { background: #198754 !important; border-color: #2fb375; }
.toast.error   { background: #dc3545 !important; border-color: #ff5e6e; }

@keyframes toastIn {
  0%   { opacity: 0; transform: translate(-50%, -40px) scale(0.9); }
  100% { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes toastOut {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -20px) scale(0.95); }
}

/* ══════════════════════════════════════════════════════
   UTILITAIRES RESPONSIVE FINAUX
══════════════════════════════════════════════════════ */
/* Tablette 640–860px */
@media (min-width: 640px) and (max-width: 860px) {
  .main-content { padding: 1.35rem 1.35rem 4rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .hero-card { padding: 1.3rem; }
}

/* Desktop */
@media (min-width: 860px) {
  .main-content { padding: 1.7rem 1.5rem 4rem; }
  .hero-card { flex-wrap: nowrap; }
}

@media (max-width: 768px) {
  .app-header {
    padding: 0.8rem 0.9rem;
  }

  .header-center {
    justify-content: center !important;
    text-align: center !important;
    font-size: 0.7rem;
    padding: 0 0.25rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .stat-card,
  .action-row,
  .section-block,
  .history-filters-card,
  .history-table-card,
  .detail-card {
    border-radius: 20px;
  }

  .modal-panel,
  .modal-panel.wide,
  .modal-panel.wizard {
    max-width: 100%;
  }

  .stepper {
    min-width: 0;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }
}

@media (max-width: 560px) {
  .main-content {
    padding: 0.9rem 0.8rem 3rem;
    gap: 0.9rem;
  }
  .app-header {
    min-height: 58px;
    padding: 0.7rem 0.8rem;
  }

  .header-logo {
    height: 22px;
  }

  .btn-logout {
    padding: 0.42rem 0.65rem;
  }

  .hero-card {
    padding: 1rem;
    gap: 0.85rem;
  }

  .hero-text h1 {
    font-size: 1.15rem;
  }

  .btn-new-passage,
  .action-row,
  .stat-card {
    width: 100%;
  }

  .btn-primary,
  .btn-ghost,
  .btn-validate {
    min-height: 46px;
    padding-top: 0.82rem;
    padding-bottom: 0.82rem;
  }

  .form-group input,
  .form-group textarea,
  .form-group select,
  .history-input-wrap input,
  .history-search-wrap input,
  .history-select-wrap select {
    min-height: 46px;
    font-size: 16px;
  }

  .form-group label,
  .action-row-text span,
  .step-intro p,
  .tri-selection-head p,
  .history-field label {
    line-height: 1.45;
  }

  .table-wrap {
    max-width: 100%;
  }

  .modal-panel {
    width: min(100%, 100vw);
  }

  .modal-header {
    gap: 0.5rem;
    padding: 0.85rem 0.85rem;
  }

  .modal-title-wrap {
    white-space: normal;
    min-width: 0;
  }

  .step-intro {
    flex-direction: row;
    align-items: center;
    gap: 0.85rem;
  }

  .tri-question-card {
    flex-direction: column;
    align-items: stretch;
    gap: 1.1rem;
    padding: 1rem 0.9rem;
  }

  .tri-question-card,
  .tri-selection-card {
    padding: 0.95rem;
  }

  .step-actions {
    flex-direction: column-reverse;
  }

  .step-actions > button {
    width: 100%;
    justify-content: center;
  }
}
