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

/* ── Variables ─────────────────────────────────────── */
:root {
  /* Couleurs principales */
  --g-dark:   #0F5647;
  --g-mid:    #1a6b57;
  --g-main:   #206b52;
  --g-lime:   #71A731;
  --g-lime-l: #8dc43e;
  --g-pale:   #e8f4ec;
  --g-xpale:  #f2faf4;

  /* Header : blanc avec logo aux vraies couleurs */
  --header-bg:     #ffffff;
  --header-border: rgba(15,86,71,0.12);

  /* Bordures et ombres */
  --border:   rgba(15,86,71,0.14);
  --shadow-s: 0 2px 10px rgba(10,60,40,0.08);
  --shadow-m: 0 6px 28px rgba(10,60,40,0.13);
  --shadow-l: 0 16px 52px rgba(10,60,40,0.18);

  /* Border radius standardisé */
  --r-xs:     8px;
  --r-s:      12px;
  --r:        16px;
  --r-xl:     20px;

  /* Textes */
  --txt:      #051510;
  --txt-mid:  #1e3a2e;
  --txt-mute: #5a7d6e;

  /* Couleurs d'alerte */
  --red:      #c0392b;
  --red-bg:   #fff3f3;
  --warn:     #e67e22;
  --warn-bg:  #fff8f0;
  --orange:   #f39c12;
  --orange-h: #d35400;

  /* Espacement standardisé */
  --space-xs: 0.5rem;
  --space-s:  0.75rem;
  --space-m:  1rem;
  --space-l:  1.25rem;
  --space-xl: 1.5rem;

  /* Typographie */
  --ff-head: 'Outfit', sans-serif;
  --ff-body: 'Inter', sans-serif;
  --tr: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════════════════════
   RESET & BASE – ANTI SCROLL HORIZONTAL
══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 16px;
  scroll-behavior: smooth;
  /* Empêche tout débordement horizontal */
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  font-family: var(--ff-body);
  background: var(--g-xpale);
  color: var(--txt);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ══════════════════════════════════════════════════════
   SCROLLBAR CUSTOMISÉ
══════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--g-xpale);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--g-lime);
  border-radius: 4px;
  transition: background var(--tr);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--g-dark);
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--g-lime) var(--g-xpale);
}

/* 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: var(--r-xl);
  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: var(--space-m);
  /* 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.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--g-dark);
  font-size: 1.05rem;
  transition: var(--tr);
}
.input-wrap:focus-within .input-icon { color: var(--g-lime); }

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  /* padding-left grand pour l'icône, padding-right normal */
  padding: var(--space-s) var(--space-s) var(--space-s) 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[type="month"],
#export-date-month,
input.input-field[type="month"] {
  background: #ffffff !important;
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}
#export-date-month::-webkit-datetime-edit,
#export-date-month::-webkit-datetime-edit-month-field,
#export-date-month::-webkit-datetime-edit-year-field,
#export-date-month::-webkit-datetime-edit-text,
input.input-field[type="month"]::-webkit-datetime-edit,
input.input-field[type="month"]::-webkit-datetime-edit-month-field,
input.input-field[type="month"]::-webkit-datetime-edit-year-field,
input.input-field[type="month"]::-webkit-datetime-edit-text {
  color: #000000 !important;
  -webkit-text-fill-color: #000000 !important;
}
#export-date-month::-moz-value,
input.input-field[type="month"]::-moz-value {
  color: #000000 !important;
}
.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;
}

/* 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: var(--space-s) var(--space-m);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* ══════════════════════════════════════════════════════
   BOUTONS
══════════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--g-lime) 0%, #5a8a26 100%);
  color: white;
  border: none;
  padding: var(--space-s) var(--space-l);
  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: var(--space-xs);
  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-full { width: 100%; }

/* Enhanced Administrateur button */
.btn-admin-access {
  background: linear-gradient(135deg, var(--g-dark), var(--g-lime));
  color: white;
  border: none;
  padding: var(--space-s) var(--space-l);
  border-radius: var(--r-xs);
  font-family: var(--ff-head);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  transition: all var(--tr);
  box-shadow: 0 4px 14px rgba(15,86,71,0.25);
}
.btn-admin-access:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15,86,71,0.35);
  filter: brightness(1.07);
}
.btn-admin-access:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--txt-mid);
  border: 1.5px solid var(--border);
  padding: var(--space-s) var(--space-m);
  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: var(--space-xs);
  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: var(--space-s) var(--space-l);
  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: var(--space-xs);
  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: var(--header-bg);
  border-bottom: 1.5px solid var(--header-border);
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(15,86,71,0.08);
  /* 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.4rem;
  color: var(--g-lime);
  flex-shrink: 0;
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.25;} }

.btn-logout {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: var(--g-pale);
  border: 1.5px solid rgba(15,86,71,0.15);
  color: var(--g-dark);
  padding: var(--space-xs) var(--space-s);
  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: 860px;
  margin: 0 auto;
  padding: var(--space-l) var(--space-m) 4rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
  /* Empêche le débordement */
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Hero card */
.hero-card {
  background: linear-gradient(135deg, var(--g-dark) 0%, #062e1e 100%);
  border-radius: var(--r);
  padding: clamp(1.25rem, 4vw, 1.75rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  flex-wrap: wrap;
  box-shadow: var(--shadow-m);
  position: relative;
  overflow: hidden;
  /* Largeur max dans le contenu */
  width: 100%;
}
.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: var(--space-xs);
  background: rgba(113,167,49,0.2);
  color: #a8d96a;
  border: 1px solid rgba(113,167,49,0.3);
  padding: var(--space-xs) var(--space-s);
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.hero-text h1 {
  font-family: var(--ff-head);
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  font-weight: 800;
  color: white;
  margin-bottom: 0.2rem;
}
.hero-text p { font-size: 0.8rem; color: rgba(255,255,255,0.58); }

/* Bouton Nouveau passage */
.btn-new-passage {
  background: white;
  border: none;
  border-radius: var(--r-s);
  padding: var(--space-s) var(--space-m);
  display: flex;
  align-items: center;
  gap: var(--space-s);
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
  flex-shrink: 0;
  /* S'adapte à la largeur disponible */
  min-width: 0;
  max-width: 100%;
}
.btn-new-passage:hover { transform: scale(1.02); box-shadow: 0 6px 22px rgba(0,0,0,0.2); }

.btn-new-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-xs);
  background: linear-gradient(135deg, var(--g-lime), #5a8a26);
  color: white;
  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;
  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%; }
}

/* Statistiques */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  width: 100%;
}
.stat-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: var(--space-m);
  display: flex;
  align-items: center;
  gap: var(--space-s);
  box-shadow: var(--shadow-s);
  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: var(--r-xs);
  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: var(--space-xs);
  /* 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: var(--space-s); width: 100%; }
.action-row {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: var(--space-s) var(--space-m);
  display: flex;
  align-items: center;
  gap: var(--space-s);
  cursor: pointer;
  transition: all var(--tr);
  box-shadow: var(--shadow-s);
  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: var(--r-xs);
  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); }
.action-row > .bi-chevron-right { color: var(--txt-mute); font-size: 0.82rem; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   MODAL OVERLAY + PANEL
   Responsive : du bas sur mobile, centré sur desktop
══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4,20,12,0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  /* Par défaut : panel au bas de l'écran (mobile) */
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
  /* Largeur = viewport exact */
  width: 100vw;
  max-width: 100vw;
}
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

/* Sur tablette/desktop : panel centré */
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}

.modal-panel {
  background: white;
  width: 100%;
  max-width: 640px;
  /* Hauteur max = 92% de l'écran visible */
  max-height: 92vh;
  max-height: 92dvh;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-l);
  animation: panelUp 0.3s cubic-bezier(.4,0,.2,1);
  /* Empêche tout débordement */
  box-sizing: border-box;
}
@media (min-width: 640px) {
  .modal-panel {
    border-radius: var(--r);
    max-height: 90vh;
    max-height: 90dvh;
  }
}
.modal-panel.wide { max-width: 860px; }

@keyframes panelUp {
  from { opacity:0; transform: translateY(36px); }
  to   { opacity:1; transform: translateY(0); }
}

/* Header du modal */
.modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  border-bottom: 1px solid var(--border);
  padding: var(--space-s) var(--space-m);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: nowrap;
  width: 100%;
  box-sizing: border-box;
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-family: var(--ff-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--g-dark);
  white-space: nowrap;
  flex-shrink: 0;
}
.modal-title-wrap .bi { color: var(--g-lime); }

/* ── Hero Actions & Export Small ── */
.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  margin-top: var(--space-m);
}

.btn-export-small {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 12px;
  color: white;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
}

.btn-export-small:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

.btn-export-small i {
  font-size: 1.25rem;
  color: #71A731;
}

/* ── Today Passages Table ── */
.today-passages-section {
  margin-top: var(--space-xl);
  padding: 0 var(--space-m);
}

.section-header-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-m);
}

.section-header-inline h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--g-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.btn-ghost-small {
  background: none;
  border: 1px solid #ddd;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-xs);
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.2s;
}

.btn-ghost-small:hover {
  background: #f8f9fa;
  color: var(--g-dark);
  border-color: var(--g-dark);
}

.table-container {
  background: white;
  border-radius: var(--r-s);
  overflow: hidden;
  border: 1px solid var(--border);
  width: 100%;
  box-shadow: var(--shadow-s);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-modern th {
  background: linear-gradient(135deg, var(--g-dark) 0%, var(--g-mid) 100%);
  color: white;
  padding: var(--space-m) var(--space-l);
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
}

.table-modern th:first-child {
  border-radius: var(--r-s) 0 0 0;
  width: 60px;
  text-align: center;
}

.table-modern th:last-child {
  border-radius: 0 var(--r-s) 0 0;
}

.table-modern td {
  padding: var(--space-s) var(--space-l);
  border-bottom: 1px solid var(--g-xpale);
  color: var(--txt-mid);
  vertical-align: middle;
  font-size: 0.95rem;
}

.table-modern td:first-child {
  text-align: center;
  font-weight: 700;
  color: var(--g-lime);
  font-size: 1rem;
}

.table-modern tr:last-child td {
  border-bottom: none;
}

.table-modern tr:hover td {
  background: var(--g-xpale);
}

.actions-cell {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
  flex-wrap: nowrap;
}

.connection-badge {
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-s);
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.3s ease;
}

.connection-badge.online {
  background: var(--g-lime);
  color: white;
}

.connection-badge.offline {
  background: #ef4444;
  color: white;
}

.connection-badge i {
  font-size: 0.8rem;
}

.btn-view-table {
  background: var(--g-pale);
  color: var(--g-dark);
  border: none;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.2s ease;
}

.btn-view-table:hover {
  background: var(--g-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15,86,71,0.2);
}

.btn-edit-table {
  background: #e8f4ec;
  color: var(--g-dark);
  border: none;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.2s ease;
}

.btn-edit-table:hover {
  background: var(--g-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(15,86,71,0.2);
}

.btn-delete-table {
  background: var(--red-bg);
  color: var(--red);
  border: none;
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-xs);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.2s ease;
}

.btn-delete-table:hover {
  background: var(--red);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(192,57,43,0.2);
}

.badge-immat {
  background: var(--g-pale);
  color: var(--g-dark);
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--r-xs);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
}

.loading-state {
  text-align: center;
  padding: var(--space-xl) !important;
  color: var(--txt-mute);
}

.no-data-state {
  text-align: center;
  padding: var(--space-xl) !important;
  color: var(--txt-mute);
  font-style: italic;
}

@media (max-width: 768px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-export-small {
    flex-direction: row;
    font-size: 0.85rem;
    padding: 10px;
  }
  
  .table-modern th, .table-modern td {
    padding: 10px 12px;
  }
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
.stepper-step { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); }
.s-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #edf2f0;
  color: var(--txt-mute);
  font-family: var(--ff-head);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--tr);
}
.s-lbl {
  font-size: 0.58rem;
  color: var(--txt-mute);
  white-space: nowrap;
  transition: color var(--tr);
}
.stepper-step.active .s-dot { background: var(--g-lime); color: white; }
.stepper-step.active .s-lbl { color: var(--g-lime); }
.stepper-step.done .s-dot { background: var(--g-pale); color: var(--g-dark); }
.stepper-line {
  flex: 1;
  height: 2px;
  background: #e0ebe5;
  max-width: 24px;
  flex-shrink: 1;
}

.btn-close-modal {
  background: none;
  border: none;
  width: 30px; height: 30px;
  border-radius: var(--r-xs);
  color: var(--txt-mute);
  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: var(--g-pale); color: var(--g-dark); }

/* Contenu de chaque étape */
.step-content {
  padding: var(--space-m);
  flex-direction: column;
  gap: var(--space-m);
  display: none;
  width: 100%;
  box-sizing: border-box;
}
.step-content.active { display: flex; }

/* Intro de l'étape */
.step-intro {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-m);
  background: var(--g-xpale);
  border-radius: var(--r-s);
  border: 1px solid var(--border);
}
.step-intro-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-xs);
  background: linear-gradient(135deg, var(--g-dark), #062e1e);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.step-intro-icon.green { background: linear-gradient(135deg, var(--g-lime), #5a8a26); }
.step-intro h2 {
  font-family: var(--ff-head);
  font-size: clamp(0.88rem, 2.5vw, 1rem);
  font-weight: 700;
  color: var(--g-dark);
}
.step-intro p { font-size: 0.74rem; color: var(--txt-mute); }

/* Grilles de formulaire – responsive */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-s);
  width: 100%;
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

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

/* Blocs de section */
.section-block {
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  overflow: hidden;
  background: white;
  width: 100%;
}
.section-title {
  background: var(--g-xpale);
  padding: var(--space-xs) var(--space-s);
  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: var(--space-xs);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.section-block .form-grid { padding: var(--space-s); }

/* 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: var(--space-xs);
  padding: var(--space-s);
}
.chip {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  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 var(--space-s) var(--space-s);
  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: var(--space-s); }
.control-card.mt { margin-top: 0; }

.control-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: var(--space-s) var(--space-m);
  flex-wrap: wrap;
}
.control-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-xs);
  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: var(--space-xs); flex-shrink: 0; }
.pill {
  padding: var(--space-xs) var(--space-s);
  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); }

/* Zone remarque */
.control-remarque {
  border-top: 1px solid var(--border);
  background: var(--g-xpale);
  padding: var(--space-s) var(--space-m);
  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: var(--space-xs);
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  padding: var(--space-s);
  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: var(--space-s);
  background: white;
  margin: var(--space-s);
  width: calc(100% - 1.7rem);
  box-sizing: border-box;
}

/* Taux de remplissage */
.taux-card { padding: var(--space-s); }
.taux-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}
.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: var(--space-xs) var(--space-s);
  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: var(--space-xs); }
.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: var(--space-xs);
  justify-content: flex-end;
  padding-top: var(--space-s);
  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: var(--space-xs);
  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: var(--space-xs) var(--space-s);
  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: var(--space-xs) var(--space-s); }
.recap-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-xs) 0;
  gap: var(--space-xs);
  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: var(--g-pale); color: var(--g-dark); padding: var(--space-xs) var(--space-s); border-radius: 50px; font-size: 0.7rem; font-weight: 700; }
.badge-danger  { background: var(--red-bg); color: var(--red); padding: var(--space-xs) var(--space-s); border-radius: 50px; font-size: 0.7rem; font-weight: 700; }

/* ══════════════════════════════════════════════════════
   MODAL HISTORIQUE
══════════════════════════════════════════════════════ */
.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: flex-end;
  padding: var(--space-s) var(--space-m);
  border-bottom: 1px solid var(--border);
  background: var(--g-xpale);
  width: 100%;
  box-sizing: border-box;
}
.history-filters .form-group { margin-bottom: 0; }
.history-filters input { padding-left: var(--space-s); }

.table-wrap {
  overflow-x: auto;
  padding: var(--space-s) var(--space-m);
  width: 100%;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
thead th {
  background: var(--g-xpale);
  color: var(--g-dark);
  font-family: var(--ff-head);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--space-xs) var(--space-s);
  border-bottom: 2px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid rgba(15,86,71,0.06); transition: background var(--tr); }
tbody tr:hover { background: var(--g-xpale); }
tbody td { padding: var(--space-xs) var(--space-s); color: var(--txt-mid); white-space: nowrap; }
.no-data {
  text-align: center;
  color: var(--txt-mute);
  padding: var(--space-xl) var(--space-m) !important;
  font-size: 0.84rem;
  white-space: normal !important;
}
.link-detail {
  color: var(--g-lime);
  background: none;
  border: none;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: var(--space-l);
  left: 50%;
  transform: translateX(-50%);
  background: var(--g-dark);
  color: white;
  padding: var(--space-s) var(--space-l);
  border-radius: 50px;
  font-family: var(--ff-head);
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-m);
  z-index: 999;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  animation: toastIn 0.25s cubic-bezier(.4,0,.2,1);
}
@keyframes toastIn {
  from { opacity:0; transform: translateX(-50%) translateY(10px); }
  to   { opacity:1; transform: translateX(-50%) translateY(0); }
}
.toast.success { background: var(--g-lime); }
.toast.error   { background: var(--red); }

/* ══════════════════════════════════════════════════════
   UTILITAIRES RESPONSIVE FINAUX
══════════════════════════════════════════════════════ */
/* Tablette 640–860px */
@media (min-width: 640px) and (max-width: 860px) {
  .main-content { padding: var(--space-xl) var(--space-xl) 4rem; }
  .hero-card { padding: var(--space-xl); }
}

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