/* =============================================================================
   beeMob TAD — components.css
   Composants partagés (contrat : docs/ARCHITECTURE.md §6 « components.css » + §9).

   Dépendances : tokens.css (tokens §5), base.css, motion.css (keyframes partagées
   tad-spin, tad-slide-in-right, tad-slide-out-right).
   Règle d'or : uniquement des tokens sémantiques (aucune couleur en dur).
   Mouvement : tokens --dur-* / --ease-* (§5.4) ; les boucles infinies sont coupées
   en mouvement réduit (section 39) ; tout est lisible sans JS (états finaux).

   SOMMAIRE
   00. Conventions internes (variables et keyframes préfixées)
   01. Icônes ............................ .icon .icon-sm .icon-lg .icon-xl
   02. Boutons ........................... .btn .btn-primary … .is-loading
   03. Bascule de thème .................. .theme-toggle .icon-sun .icon-moon
   04. Cartes ............................ .card … .panel
   05. Badges & pastilles de ligne ....... .badge … .line-badge
   06. Puces de filtre ................... .chip-group .chip .chip-count
   07. Contrôle segmenté ................. .segmented [data-segmented]
   08. Onglets ........................... .tabs .tab .tabs-indicator
   09. Alertes & bandeau ................. .alert .notice-banner
   10. Toasts ............................ .toast-region .toast
   11. Formulaires ....................... .field .input-group .form-* .search-field .kbd
   12. Interrupteur ...................... .switch
   13. Cartes de choix ................... .choice-grid .choice-card
   14. Compteur .......................... .counter[data-counter]
   15. Tableaux .......................... .table-wrap .table
   16. Clé / valeur ...................... .kv
   17. Stepper ........................... .stepper
   18. Itinéraire vertical ............... .journey
   19. Fil d'activité .................... .feed
   20. État vide ......................... .empty-state
   21. KPI & sparkline ................... .kpi .sparkline
   22. Progression ....................... .progress
   23. Graphiques ........................ .chart-bars .chart-hbars .donut .chart-legend
   24. Dialogues ......................... dialog.modal dialog.drawer
   25. Accordéon ......................... .accordion
   26. Menu déroulant .................... details.menu
   27. Info-bulle ........................ [data-tooltip]
   28. Avatar ............................ .avatar
   29. Chargement ........................ .skeleton .spinner .live-dot
   30. Bande de dates .................... .date-strip-wrap .date-chip
   31. Cartes d'option ................... .option-grid .option-card
   32. Départs ........................... .departure-list .departure
   33. Billet ............................ .ticket
   34. Coche de succès ................... svg.success-mark
   35. Carte d'itinéraire ................ .route-map .route-line .map-marker-*
   36. Dépôt de fichier .................. .dropzone
   37. En-têtes, filtres, séparateur ..... .page-header .section-head .filter-bar .divider
   38. Keyframes internes (cmp-*)
   39. Mouvement réduit
   40. Impression
   ============================================================================= */


/* =============================================================================
   00. CONVENTIONS INTERNES
   -----------------------------------------------------------------------------
   Variables internes (portée composant, non partagées — ne pas utiliser ailleurs) :
     --btn-*          paramètres d'un bouton (fond, texte, bord, ombre, hauteur)
     --tone / --tone-soft / --tone-text   teinte d'une alerte, d'un toast, d'un bandeau
     --kpi-tone / --kpi-soft / --kpi-text teinte d'une carte KPI
     --bar-color      couleur des graphiques en barres (défaut : var(--primary)) ;
                      posée via data-tone="…" (option « tone » de ui_bar_chart /
                      ui_hbar_chart) ou en style inline (ex. --bar-color:var(--accent))
   Classes / attributs internes émis par lib/ui.php ou core.js, stylés ici :
     .chart-empty (graphique sans donnée), [data-tone] (graphiques),
     dialog.modal.tad-confirm (TAD.confirm), [data-countdown].is-soon
     --dz-color       couleur de la bordure pointillée animée du dropzone
     --journey-i      rang d'un arrêt dans .journey (délai du tracé)
   Variables posées par le JS (contrat) :
     --seg-x / --seg-w (sur [data-segmented]), --tab-x / --tab-w (sur [data-tabs]),
     --toast-duration (sur .toast), --i (rangs), --value, --h, --w, --seg-*.
   Keyframes internes : préfixe « cmp- » (section 38), propres à ce fichier.
   ============================================================================= */


/* =============================================================================
   01. ICÔNES
   ============================================================================= */
.icon {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  vertical-align: -0.25em;
  stroke-width: 2;
}
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; stroke-width: 1.75; }


/* =============================================================================
   02. BOUTONS
   -----------------------------------------------------------------------------
   Survol : couleur + ombre (--dur-fast) ; primaire : léger soulèvement (-1px).
   Pression : scale(--scale-press) en --dur-instant (confirmation tactile).
   .is-loading : texte transparent + spinner centré, non cliquable.
   ============================================================================= */
.btn {
  --btn-h: 44px;
  --btn-px: 18px;
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  --btn-bg-hover: var(--surface-2);
  --btn-bg-active: var(--surface-3);
  --btn-fg-hover: var(--btn-fg);
  --btn-border-hover: var(--border-strong);
  --btn-shadow: var(--shadow-xs);
  --btn-shadow-hover: var(--shadow-sm);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--btn-h);
  margin: 0;
  padding: 0 var(--btn-px);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-out);
}
.btn .icon { width: 18px; height: 18px; }

.btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* --- Variantes ----------------------------------------------------------- */
.btn-secondary {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
}

.btn-primary,
.btn.primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-primary);
  --btn-border: var(--primary);
  --btn-bg-hover: var(--primary-hover);
  --btn-bg-active: var(--primary-active);
  --btn-border-hover: var(--primary-hover);
  --btn-shadow: var(--shadow-xs), inset 0 1px 0 color-mix(in srgb, var(--on-primary) 16%, transparent);
  --btn-shadow-hover: var(--shadow-primary);
}

.btn-accent {
  --btn-bg: var(--accent);
  --btn-fg: var(--on-accent);
  --btn-border: var(--accent);
  --btn-bg-hover: var(--accent-hover);
  --btn-bg-active: var(--accent-hover);
  --btn-border-hover: var(--accent-hover);
  --btn-shadow: var(--shadow-xs), inset 0 1px 0 color-mix(in srgb, var(--on-accent) 14%, transparent);
  --btn-shadow-hover: var(--shadow-md);
}

.btn-success {
  --btn-bg: var(--success);
  --btn-fg: var(--on-primary);
  --btn-border: var(--success);
  --btn-bg-hover: color-mix(in srgb, var(--success) 86%, var(--text));
  --btn-bg-active: color-mix(in srgb, var(--success) 78%, var(--text));
  --btn-border-hover: var(--btn-bg-hover);
  --btn-shadow-hover: var(--shadow-md);
}

.btn-danger,
.btn.danger {
  --btn-bg: var(--danger);
  --btn-fg: var(--on-primary);
  --btn-border: var(--danger);
  --btn-bg-hover: color-mix(in srgb, var(--danger) 86%, var(--text));
  --btn-bg-active: color-mix(in srgb, var(--danger) 78%, var(--text));
  --btn-border-hover: var(--btn-bg-hover);
  --btn-shadow-hover: var(--shadow-md);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-muted);
  --btn-border: transparent;
  --btn-bg-hover: color-mix(in srgb, var(--text) 7%, transparent);
  --btn-bg-active: color-mix(in srgb, var(--text) 11%, transparent);
  --btn-fg-hover: var(--text);
  --btn-border-hover: transparent;
  --btn-shadow: none;
  --btn-shadow-hover: none;
}

/* --- Tailles ------------------------------------------------------------- */
.btn-sm {
  --btn-h: 36px;
  --btn-px: 12px;
  gap: 6px;
  font-size: var(--fs-sm);
}
.btn-sm .icon { width: 16px; height: 16px; }

.btn-lg {
  --btn-h: 52px;
  --btn-px: 24px;
  gap: 10px;
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
}
.btn-lg .icon { width: 20px; height: 20px; }

.btn-icon {
  width: var(--btn-h);
  min-width: var(--btn-h);
  padding: 0;
  gap: 0;
}
.btn-icon .icon { width: 20px; height: 20px; }
.btn-sm.btn-icon .icon { width: 18px; height: 18px; }

.btn-block {
  display: flex;
  width: 100%;
}

/* --- États --------------------------------------------------------------- */
@media (hover: hover) {
  .btn:hover:where(:not(:disabled, [aria-disabled="true"])) {
    background: var(--btn-bg-hover);
    border-color: var(--btn-border-hover);
    color: var(--btn-fg-hover);
    box-shadow: var(--btn-shadow-hover);
  }
  .btn-primary:hover:where(:not(:disabled, [aria-disabled="true"])),
  .btn.primary:hover:where(:not(:disabled, [aria-disabled="true"])),
  .btn-accent:hover:where(:not(:disabled, [aria-disabled="true"])) {
    transform: translateY(-1px);
  }
}

/* Pression : placée après le survol pour l'emporter. */
.btn:active:where(:not(:disabled, [aria-disabled="true"])) {
  background: var(--btn-bg-active);
  transform: scale(var(--scale-press));
  box-shadow: var(--btn-shadow);
  transition-duration: var(--dur-instant);
}
.btn-primary:active:where(:not(:disabled, [aria-disabled="true"])),
.btn.primary:active:where(:not(:disabled, [aria-disabled="true"])),
.btn-accent:active:where(:not(:disabled, [aria-disabled="true"])) {
  transform: scale(var(--scale-press));
}

.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
a.btn[aria-disabled="true"] { pointer-events: none; }

.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
  cursor: progress;
}
/* <input type="submit" class="btn"> n'a pas de pseudo-élément : pas de
   spinner possible, on garde donc le libellé lisible et on l'atténue. */
input.btn.is-loading {
  color: var(--btn-fg) !important;
  opacity: 0.7;
}
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  margin: auto;
  border: 2px solid color-mix(in srgb, var(--btn-fg) 28%, transparent);
  border-top-color: var(--btn-fg);
  border-radius: 50%;
  animation: tad-spin 700ms linear infinite;
}

/* Cibles tactiles confortables : un .btn-sm reste à 44px au doigt. */
@media (pointer: coarse) {
  .btn-sm { --btn-h: 44px; }
}


/* =============================================================================
   03. BASCULE DE THÈME (§9.2)
   -----------------------------------------------------------------------------
   Thème clair : la lune est visible (passer en sombre). Thème sombre : le soleil.
   Les deux icônes sont superposées et échangées par rotation + fondu.
   Définition UNIQUE (toutes coquilles, y compris « doc ») : les feuilles de
   mise en page ne la redéfinissent pas.
   ============================================================================= */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}
.theme-toggle > .icon {
  grid-area: 1 / 1;
  transition:
    transform var(--dur-slow) var(--ease-spring),
    opacity var(--dur-base) var(--ease-out);
}
.theme-toggle .icon-moon { opacity: 1; transform: none; }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }

:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { opacity: 1; transform: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
}


/* =============================================================================
   04. CARTES
   -----------------------------------------------------------------------------
   Une .card sans en-tête/corps a son propre padding ; avec .card-header /
   .card-body / .card-footer, ce sont ces zones qui portent l'espacement.
   ============================================================================= */
.card,
.panel {
  position: relative;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-6);
  min-width: 0;
}
.card:has(> .card-header, > .card-body, > .card-footer) {
  padding: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.card-header > :first-child { min-width: 0; }

.card-body { padding: var(--sp-6); }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
}
.card-subtitle {
  margin: 2px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

/* Variantes */
.card-interactive {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-fast) var(--ease-standard);
}
@media (hover: hover) {
  .card-interactive:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
    box-shadow: var(--shadow-md);
  }
}
.card-interactive:active {
  transform: scale(var(--scale-press));
  transition-duration: var(--dur-instant);
}
.card-interactive:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.card-flat {
  box-shadow: none;
}
.card-inset {
  background: var(--surface-2);
  box-shadow: none;
}
.card-highlight {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-highlight::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  pointer-events: none;
}


/* =============================================================================
   05. BADGES & PASTILLES DE LIGNE
   ============================================================================= */
.badge {
  --tone-soft: var(--surface-3);
  --tone-text: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--tone-soft);
  color: var(--tone-text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone-text) 14%, transparent);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  letter-spacing: 0.005em;
  white-space: nowrap;
  vertical-align: middle;
}
.badge .icon { width: 14px; height: 14px; }

.badge-neutral,
.badge.gray { --tone-soft: var(--surface-3); --tone-text: var(--text-muted); }
.badge-primary { --tone-soft: var(--primary-soft); --tone-text: var(--primary-soft-text); }
.badge-accent { --tone-soft: var(--accent-soft); --tone-text: var(--accent-soft-text); }
.badge-success,
.badge.green { --tone-soft: var(--success-soft); --tone-text: var(--success-text); }
.badge-warning { --tone-soft: var(--warning-soft); --tone-text: var(--warning-text); }
.badge-danger,
.badge.red { --tone-soft: var(--danger-soft); --tone-text: var(--danger-text); }
.badge-info { --tone-soft: var(--info-soft); --tone-text: var(--info-text); }

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.badge-lg {
  min-height: 30px;
  padding: 4px 12px;
  font-size: var(--fs-sm);
}
.badge-lg .icon { width: 16px; height: 16px; }

/* Pastille de ligne (signalétique transport) : style="--line-bg:#…;--line-fg:#…" */
.line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  background: var(--line-bg, var(--primary));
  color: var(--line-fg, var(--on-primary));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 10%, transparent);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
  vertical-align: middle;
  flex: none;
}
.line-badge-sm {
  min-width: 1.75rem;
  height: 22px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: var(--fs-xs);
}
.line-badge-lg {
  min-width: 3rem;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-lg);
}


/* =============================================================================
   06. PUCES DE FILTRE
   ============================================================================= */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    transform var(--dur-instant) var(--ease-out);
}
.chip .icon { width: 16px; height: 16px; }
@media (hover: hover) {
  .chip:hover {
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow: var(--shadow-xs);
  }
}
.chip:active { transform: scale(var(--scale-press)); }
.chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.chip.is-active,
.chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  color: var(--primary-soft-text);
  font-weight: var(--fw-semibold);
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.chip.is-active .chip-count,
.chip[aria-pressed="true"] .chip-count {
  background: var(--primary);
  color: var(--on-primary);
}

@media (pointer: coarse) {
  .chip { min-height: 44px; }
}


/* =============================================================================
   07. CONTRÔLE SEGMENTÉ
   -----------------------------------------------------------------------------
   Sans JS : l'item actif porte son propre fond.
   Avec JS : core.js pose --seg-x / --seg-w sur [data-segmented] → l'indicateur
   glisse (transform + width, --dur-base --ease-out). La détection se fait sur
   l'attribut style (« --seg-w » présent) : aucun état cassé si le JS échoue.
   ============================================================================= */
.segmented {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }

.segmented-item {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}
.segmented-item .icon { width: 16px; height: 16px; }
.segmented-item input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
@media (hover: hover) {
  .segmented-item:hover { color: var(--text); }
}
.segmented-item:focus-visible,
.segmented-item:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

.segmented-item.is-active,
.segmented-item[aria-pressed="true"],
.segmented-item[aria-checked="true"],
.segmented-item[aria-selected="true"],
.segmented-item:has(input:checked) {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.segmented-indicator {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: var(--seg-w, 0px);
  border-radius: calc(var(--radius-md) - 4px);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transform: translateX(var(--seg-x, 0px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--dur-base) var(--ease-out),
    width var(--dur-base) var(--ease-out),
    opacity var(--dur-fast) var(--ease-standard);
}
/* JS actif (variables posées) : l'indicateur remplace le fond de l'item actif. */
[data-segmented][style*="--seg-w"] .segmented-indicator,
.segmented-indicator[style*="--seg-w"] {
  opacity: 1;
}
[data-segmented][style*="--seg-w"] .segmented-item {
  background: transparent;
  box-shadow: none;
}

@media (pointer: coarse) {
  .segmented-item { min-height: 40px; }
}


/* =============================================================================
   08. ONGLETS
   -----------------------------------------------------------------------------
   Sans JS : soulignement propre à l'onglet actif (::after).
   Avec JS : .tabs-indicator glisse via --tab-x / --tab-w (posées sur [data-tabs]).
   ============================================================================= */
.tabs {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease-standard), background-color var(--dur-fast) var(--ease-standard);
}
.tab .icon { width: 16px; height: 16px; }
.tab .badge,
.tab .chip-count { margin-left: 2px; }
@media (hover: hover) {
  .tab:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--text) 4%, transparent);
  }
}
.tab:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform var(--dur-base) var(--ease-out);
}
.tab.is-active,
.tab[aria-selected="true"] {
  color: var(--text);
}
.tab.is-active::after,
.tab[aria-selected="true"]::after {
  transform: scaleX(1);
}

.tabs-indicator {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: var(--tab-w, 0px);
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  transform: translateX(var(--tab-x, 0px));
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--dur-base) var(--ease-out),
    width var(--dur-base) var(--ease-out),
    opacity var(--dur-fast) var(--ease-standard);
}
[data-tabs][style*="--tab-w"] .tabs-indicator,
.tabs-indicator[style*="--tab-w"] {
  opacity: 1;
}
[data-tabs][style*="--tab-w"] .tab::after {
  display: none;
}

[data-tab-panel][hidden] { display: none !important; }
[data-tab-panel]:not([hidden]) {
  animation: cmp-fade-up var(--dur-base) var(--ease-out) both;
}
[data-tab-panel]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 4px;
  border-radius: var(--radius-sm);
}


/* =============================================================================
   09. ALERTES & BANDEAU D'INFORMATION
   ============================================================================= */
.alert {
  --tone: var(--info);
  --tone-soft: var(--info-soft);
  --tone-text: var(--info-text);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  border-radius: var(--radius-md);
  background: var(--tone-soft);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--tone);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
.alert p { margin: 0; }
.alert p + p { margin-top: var(--sp-1); }
.alert a {
  color: inherit;
  font-weight: var(--fw-semibold);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.alert-icon {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
  color: var(--tone-text);
}
.alert-icon .icon,
.alert > .icon { width: 20px; height: 20px; color: var(--tone-text); flex: none; }
.alert-title {
  display: block;
  margin: 0 0 2px;
  font-weight: var(--fw-semibold);
  color: var(--tone-text);
  line-height: var(--lh-snug);
}
.alert-body {
  flex: 1;
  min-width: 0;
  color: var(--text);
}

.alert-info,
.alert.info { --tone: var(--info); --tone-soft: var(--info-soft); --tone-text: var(--info-text); }
.alert-success,
.alert.success { --tone: var(--success); --tone-soft: var(--success-soft); --tone-text: var(--success-text); }
.alert-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-text: var(--warning-text); }
.alert-danger,
.alert.error { --tone: var(--danger); --tone-soft: var(--danger-soft); --tone-text: var(--danger-text); }

/* Bandeau d'information client (sous l'en-tête). */
.notice-banner {
  --tone: var(--info);
  --tone-soft: var(--info-soft);
  --tone-text: var(--info-text);
  position: relative;
  background: var(--tone-soft);
  color: var(--tone-text);
  border-bottom: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  animation: cmp-fade-down var(--dur-slow) var(--ease-out) both;
}
.notice-banner > .container {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-block: 10px;
}
.notice-banner .icon { width: 18px; height: 18px; flex: none; color: var(--tone-text); }
.notice-banner p { margin: 0; }
.notice-banner a { color: inherit; font-weight: var(--fw-semibold); text-decoration: underline; }

.notice-info { --tone: var(--info); --tone-soft: var(--info-soft); --tone-text: var(--info-text); }
.notice-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-text: var(--warning-text); }
.notice-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); --tone-text: var(--danger-text); }


/* =============================================================================
   10. TOASTS (§9.5)
   -----------------------------------------------------------------------------
   Desktop : pile en haut à droite. Mobile : en bas, pleine largeur.
   Entrée : tad-slide-in-right avec léger rebond (--ease-spring).
   Sortie : .is-leaving (le JS retire l'élément à animationend).
   .toast-progress : se vide en var(--toast-duration) (posée par le JS),
   en pause au survol / au focus.
   ============================================================================= */
.toast-region {
  position: fixed;
  z-index: var(--z-toast);
  top: calc(var(--sp-4) + env(safe-area-inset-top, 0px));
  right: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: min(400px, calc(100vw - 2 * var(--sp-4)));
  pointer-events: none;
}
.shell-client .toast-region {
  top: calc(var(--header-h) + var(--sp-3) + env(safe-area-inset-top, 0px));
}
/* Console : sous la topbar (64px, layout-manager.css) pour ne pas masquer
   la date d'exploitation ni la bascule de thème. */
.shell-manager .toast-region {
  top: calc(64px + var(--sp-3) + env(safe-area-inset-top, 0px));
}

.toast {
  --tone: var(--info);
  --tone-soft: var(--info-soft);
  --tone-text: var(--info-text);
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-3);
  padding: 14px 10px 16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  pointer-events: auto;
  animation: tad-slide-in-right var(--dur-slow) var(--ease-spring) both;
}
.toast::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--tone);
}
.toast.is-entering {
  animation: tad-slide-in-right var(--dur-slow) var(--ease-spring) both;
}
.toast.is-leaving {
  animation: tad-slide-out-right var(--dur-base) var(--ease-in) both;
  pointer-events: none;
}

.toast-success { --tone: var(--success); --tone-soft: var(--success-soft); --tone-text: var(--success-text); }
.toast-error { --tone: var(--danger); --tone-soft: var(--danger-soft); --tone-text: var(--danger-text); }
.toast-info { --tone: var(--info); --tone-soft: var(--info-soft); --tone-text: var(--info-text); }
.toast-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); --tone-text: var(--warning-text); }

.toast-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tone-soft);
  color: var(--tone-text);
  flex: none;
}
.toast-icon .icon { width: 18px; height: 18px; }

.toast-content {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-top: 6px;
}
.toast-title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text);
}
.toast-message {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.toast-content > .toast-message:first-child { color: var(--text); }

.toast-close {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.toast-close::after {
  content: "";
  position: absolute;
  inset: -6px;
}
.toast-close .icon { width: 16px; height: 16px; }
@media (hover: hover) {
  .toast-close:hover {
    background: color-mix(in srgb, var(--text) 8%, transparent);
    color: var(--text);
  }
}
.toast-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 0;
}

.toast-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: color-mix(in srgb, var(--tone) 75%, transparent);
  transform-origin: left center;
  animation: cmp-toast-progress var(--toast-duration, 5s) linear forwards;
  pointer-events: none;
}
.toast:hover .toast-progress,
.toast:focus-within .toast-progress {
  animation-play-state: paused;
}
html:not(.js) .toast-progress { display: none; }

@media (max-width: 640px) {
  .toast-region,
  .shell-client .toast-region,
  .shell-manager .toast-region {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    padding: var(--sp-3) var(--sp-3) calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
    gap: var(--sp-2);
  }
  .toast,
  .toast.is-entering {
    animation-name: cmp-toast-in-up;
  }
  .toast.is-leaving {
    animation-name: cmp-toast-out-down;
  }
}


/* =============================================================================
   11. FORMULAIRES
   -----------------------------------------------------------------------------
   Les champs de base (input, select, textarea, .input) sont stylés par base.css ;
   ici : structure (.field, groupes, grilles, sections), recherche et touches.
   ============================================================================= */
.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text);
}
.field-label .icon { width: 16px; height: 16px; color: var(--text-subtle); }
.req {
  margin-left: 2px;
  color: var(--danger-text);
  font-weight: var(--fw-bold);
  text-decoration: none;
}
.field-hint {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--danger-text);
  animation: cmp-fade-down var(--dur-base) var(--ease-out) both;
}
.field-error:empty { display: none; }
.field-error .icon { width: 14px; height: 14px; }

.field:has(.field-error:not(:empty)) :is(input, select, textarea, .input),
:is(input, select, textarea, .input)[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Groupe avec icône */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.input-group > :is(input, select, textarea, .input) {
  flex: 1;
  width: 100%;
  min-width: 0;
}
.input-group > .input-icon {
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
.input-group > .input-icon ~ :is(input, select, .input) {
  padding-left: 42px;
}
.input-group:focus-within > .input-icon { color: var(--primary); }

/* Grilles de formulaire */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-5);
  align-items: start;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4) var(--sp-5);
  align-items: start;
}
.form-grid > :is(.form-actions, .alert, .choice-grid, .form-section, .divider),
.form-grid-3 > :is(.form-actions, .alert, .choice-grid, .form-section, .divider) {
  grid-column: 1 / -1;
}
@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid,
  .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
}

/* Sections numérotées */
.form-section {
  display: grid;
  gap: var(--sp-5);
  padding-block: var(--sp-6);
}
.form-section:first-child { padding-top: 0; }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.form-section-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-soft) 45%, transparent);
}
.form-section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
}
.form-section-desc {
  margin: 2px 0 0;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: var(--lh-snug);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .form-actions > .btn { width: 100%; }
}

/* Champ de recherche (icône + raccourci clavier) */
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.search-field > .input-icon {
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
  transition: color var(--dur-fast) var(--ease-standard);
}
.search-field > input {
  width: 100%;
  min-width: 0;
  padding-left: 42px;
  padding-right: 44px;
}
.search-field > .kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}
.search-field:focus-within > .input-icon { color: var(--primary); }
.search-field:focus-within > .kbd { opacity: 0; }
@media (pointer: coarse) {
  .search-field > .kbd { display: none; }
  .search-field > input { padding-right: 14px; }
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
}


/* =============================================================================
   12. INTERRUPTEUR
   -----------------------------------------------------------------------------
   Éteint : piste claire cerclée, petit pouce neutre. Allumé : piste primaire,
   pouce --on-primary qui glisse et grossit (--ease-spring).
   ============================================================================= */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 44px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.switch > input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--border-strong);
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard);
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-subtle);
  box-shadow: var(--shadow-xs);
  transform: scale(0.8);
  transition:
    transform var(--dur-base) var(--ease-spring),
    background-color var(--dur-fast) var(--ease-standard);
}
@media (hover: hover) {
  .switch:hover .switch-track { box-shadow: inset 0 0 0 2px var(--text-subtle); }
}
.switch > input:checked + .switch-track {
  background: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.switch > input:checked + .switch-track .switch-thumb {
  background: var(--on-primary);
  transform: translateX(18px);
}
.switch:active .switch-thumb { transform: scale(0.72); }
.switch:active > input:checked + .switch-track .switch-thumb { transform: translateX(18px) scale(0.9); }
.switch > input:focus-visible + .switch-track {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.switch > input:disabled + .switch-track { opacity: 0.5; }
.switch:has(> input:disabled) { cursor: not-allowed; }
.switch-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--text);
}


/* =============================================================================
   13. CARTES DE CHOIX
   -----------------------------------------------------------------------------
   <label class="choice-card"><input type="checkbox|radio" …> icône / titre / méta
   État coché : :has(input:checked) ou .is-checked (posé par core.js en repli).
   L'input est visuellement caché mais reste focusable (anneau sur la carte).
   ============================================================================= */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: var(--sp-3);
}

.choice-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  align-items: center;
  column-gap: var(--sp-3);
  row-gap: 2px;
  min-height: 64px;
  padding: var(--sp-4) 46px var(--sp-4) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    transform var(--dur-instant) var(--ease-out);
}
.choice-card:has(> .choice-card-icon) {
  grid-template-columns: auto minmax(0, 1fr);
}
.choice-card > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* Indicateur : cercle vide → disque primaire + coche qui « pop ». */
.choice-card::before {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard);
}
.choice-card::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 21px;
  box-sizing: border-box;
  width: 6px;
  height: 10px;
  border: solid var(--on-primary);
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) scale(0);
  transition:
    transform var(--dur-base) var(--ease-spring),
    opacity var(--dur-fast) var(--ease-standard);
}

@media (hover: hover) {
  .choice-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
  }
}
.choice-card:active { transform: scale(var(--scale-press)); }

.choice-card:has(input:checked),
.choice-card.is-checked {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice-card:has(input:checked)::before,
.choice-card.is-checked::before {
  border-color: var(--primary);
  background: var(--primary);
  --bump-scale: 1.25;
  animation: cmp-bump var(--dur-base) var(--ease-spring);
}
.choice-card:has(input:checked)::after,
.choice-card.is-checked::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

/* Anneau de focus : :focus-within (repli) puis :has(:focus-visible) si dispo. */
.choice-card:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
@supports selector(:has(*)) {
  .choice-card:focus-within { outline: none; }
  .choice-card:has(input:focus-visible) {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }
}

.choice-card:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.choice-card-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--primary-soft-text);
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.choice-card-icon .icon { width: 20px; height: 20px; }
.choice-card:has(input:checked) .choice-card-icon,
.choice-card.is-checked .choice-card-icon {
  background: var(--primary);
  color: var(--on-primary);
}
.choice-card-title {
  grid-column: -2 / -1;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text);
}
.choice-card-meta {
  grid-column: -2 / -1;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}


/* =============================================================================
   14. COMPTEUR
   -----------------------------------------------------------------------------
   .counter[data-counter] > button[data-counter-dec] + input + button[data-counter-inc]
   .is-bumped (posé par le JS sur l'input) = petit « pop » de confirmation.
   ============================================================================= */
.counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease-standard);
}
.counter:focus-within { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }

.counter > button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    transform var(--dur-instant) var(--ease-out);
}
.counter > button .icon { width: 18px; height: 18px; }
@media (hover: hover) {
  .counter > button:hover:not(:disabled) {
    background: var(--primary-soft);
    color: var(--primary-soft-text);
  }
}
.counter > button:active:not(:disabled) { transform: scale(0.9); }
.counter > button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.counter > button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.counter > input {
  width: 3.25rem;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  box-shadow: none;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.counter > input::-webkit-outer-spin-button,
.counter > input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.counter > input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}
.counter > input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 0;
}
.counter > input.is-bumped {
  --bump-scale: 1.2;
  animation: cmp-bump var(--dur-base) var(--ease-spring);
}

@media (pointer: coarse) {
  .counter > button { width: 44px; height: 44px; }
}


/* =============================================================================
   15. TABLEAUX
   -----------------------------------------------------------------------------
   .table-wrap : défilement horizontal, bord arrondi, ombres de défilement
   (dégradés « local / scroll ») qui signalent le contenu masqué à gauche/droite.
   En-têtes collants (effectifs quand .table-wrap a une hauteur maximale).
   ============================================================================= */
.table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, var(--surface) 30%, transparent),
    linear-gradient(to left, var(--surface) 30%, transparent),
    radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--text) 14%, transparent), transparent),
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--text) 14%, transparent), transparent);
  background-position: left center, right center, left center, right center;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.table-wrap:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-block: 10px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
}
.table tbody tr:last-child > td,
.table tbody tr:last-child > th { border-bottom: 0; }
.table tbody th { font-weight: var(--fw-semibold); }
.table td { transition: background-color var(--dur-fast) var(--ease-standard); }
@media (hover: hover) {
  .table tbody tr:hover > td,
  .table tbody tr:hover > th {
    background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  }
}
.table a:not(.btn):not(.badge) {
  color: var(--text);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}
.table a:not(.btn):not(.badge):hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.table tr.is-muted > td,
.table tr.is-muted > th {
  color: var(--text-subtle);
}
.table tr.is-muted > td > :is(.badge, .line-badge, .avatar) { opacity: 0.6; }

.table-compact th,
.table-compact td { padding: 8px 12px; }
.table-compact thead th { padding-block: 8px; }

.table-actions {
  text-align: right;
  white-space: nowrap;
}
:is(th, td).table-actions { width: 1%; }
td.table-actions > * + * { margin-left: 6px; }
:is(div, span).table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}


/* =============================================================================
   16. CLÉ / VALEUR
   ============================================================================= */
.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: var(--sp-3);
  margin: 0;
}
.kv-item {
  display: grid;
  align-content: start;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.kv-label {
  margin: 0;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
}
.kv-value {
  margin: 0;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow-wrap: anywhere;
}


/* =============================================================================
   17. STEPPER (§9.6)
   -----------------------------------------------------------------------------
   Pastilles numérotées + lignes <li class="stepper-line"> qui se remplissent
   (scaleX). Étape courante : halo pulsé discret (coupé en mouvement réduit).
   Sous 640px : seuls les libellés de l'étape courante restent visibles.
   ============================================================================= */
.stepper {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.stepper-step {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}
.stepper-step.is-current { flex-shrink: 0; }
.stepper-dot {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition:
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
}
.stepper-dot .icon { width: 16px; height: 16px; stroke-width: 2.75; }
.stepper-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-base) var(--ease-standard);
}

.stepper-line {
  position: relative;
  flex: 1 1 24px;
  min-width: 16px;
  height: 2px;
  margin: 0 12px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  list-style: none;
}
.stepper-line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-slow) var(--ease-out);
}
.stepper-line.is-done::after { transform: scaleX(1); }
/* La ligne qui mène à l'étape courante se remplit à l'arrivée sur la page. */
html.js .stepper-line.is-done:has(+ .stepper-step.is-current)::after {
  animation: cmp-grow-x var(--dur-slower) var(--ease-out) 120ms both;
}

.stepper-step.is-done .stepper-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}
.stepper-step.is-done .stepper-label { color: var(--text); }

.stepper-step.is-current .stepper-dot {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
.stepper-step.is-current .stepper-dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  pointer-events: none;
  --ring-scale: 1.6;
  animation: cmp-ring 2.4s var(--ease-out) infinite;
}
.stepper-step.is-current .stepper-label {
  color: var(--text);
  font-weight: var(--fw-bold);
}

@media (max-width: 640px) {
  .stepper-step:not(.is-current) .stepper-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  .stepper-step { gap: 8px; }
  .stepper-dot { width: 28px; height: 28px; font-size: var(--fs-xs); }
  .stepper-line { margin: 0 6px; min-width: 12px; }
}


/* =============================================================================
   18. ITINÉRAIRE VERTICAL
   -----------------------------------------------------------------------------
   .journey > .journey-stop(.is-origin|.is-destination) >
     .journey-time .journey-dot .journey-name .journey-meta
   Ligne verticale reliant les points ; origine pleine verte, destination
   cible rouge. Avec [data-reveal] : la ligne se trace d'arrêt en arrêt.
   ============================================================================= */
.journey {
  --journey-time-w: 3.5rem;
  --journey-dot-col: 20px;
  position: relative;
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.journey-stop {
  position: relative;
  display: grid;
  grid-template-columns: var(--journey-time-w) var(--journey-dot-col) minmax(0, 1fr);
  column-gap: var(--sp-3);
  row-gap: 2px;
  align-items: start;
  padding-bottom: var(--sp-5);
}
.journey-stop:last-child { padding-bottom: 0; }

.journey-stop:nth-child(2) { --journey-i: 1; }
.journey-stop:nth-child(3) { --journey-i: 2; }
.journey-stop:nth-child(4) { --journey-i: 3; }
.journey-stop:nth-child(5) { --journey-i: 4; }
.journey-stop:nth-child(6) { --journey-i: 5; }
.journey-stop:nth-child(n+7) { --journey-i: 6; }

/* Segment de ligne : du centre de ce point au centre du suivant. */
.journey-stop:not(:last-child)::before {
  content: "";
  position: absolute;
  left: calc(var(--journey-time-w) + var(--sp-3) + var(--journey-dot-col) / 2 - 1.5px);
  top: 12px;
  bottom: -12px;
  width: 3px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--primary) 55%, var(--border));
  transform-origin: top center;
}
.journey-stop.is-origin:not(:last-child)::before {
  background: linear-gradient(to bottom, var(--accent), color-mix(in srgb, var(--primary) 55%, var(--border)));
}

.journey-time {
  grid-column: 1;
  grid-row: 1;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: 24px;
  text-align: right;
  color: var(--text);
}
.journey-dot {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--border-strong);
}
.journey-name {
  grid-column: 3;
  grid-row: 1;
  min-width: 0;
  font-weight: var(--fw-semibold);
  line-height: 24px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.journey-meta {
  grid-column: 3;
  grid-row: 2;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

.journey-stop.is-origin .journey-dot {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.journey-stop.is-destination .journey-dot {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  background: radial-gradient(circle, var(--danger) 0 3px, var(--surface) 3.5px);
  box-shadow: inset 0 0 0 3px var(--danger), 0 0 0 4px var(--danger-soft);
}
.journey-stop:is(.is-origin, .is-destination) .journey-name { font-weight: var(--fw-bold); }

/* Tracé progressif sous [data-reveal] (JS) : points puis segments, d'arrêt en
   arrêt. Animations (et non transitions) : elles se rejouent quand .is-visible
   arrive, même après le filet de sécurité de 2,5 s qui rend tout visible si
   core.js n'a pas tourné (même principe que motion.css §4). */
html.js .journey[data-reveal]:not(.is-visible) .journey-stop::before {
  transform: scaleY(0);
  animation: cmp-unhide 0s 2.5s forwards;
}
html.js .journey[data-reveal]:not(.is-visible) .journey-dot {
  transform: scale(0);
  animation: cmp-unhide 0s 2.5s forwards;
}
html.js .journey[data-reveal].is-visible .journey-stop::before {
  animation: tad-grow-y var(--dur-base) var(--ease-standard) backwards;
  animation-delay: calc(var(--journey-i, 0) * var(--dur-base) + var(--dur-fast));
}
html.js .journey[data-reveal].is-visible .journey-dot {
  animation: cmp-dot-in var(--dur-base) var(--ease-spring) backwards;
  animation-delay: calc(var(--journey-i, 0) * var(--dur-base));
}


/* =============================================================================
   19. FIL D'ACTIVITÉ
   ============================================================================= */
.feed {
  position: relative;
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  column-gap: var(--sp-3);
  align-items: start;
  padding: 10px 0;
}
.feed-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 46px;
  bottom: -6px;
  width: 2px;
  border-radius: 2px;
  background: var(--border);
}
.feed-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
}
.feed-icon .icon { width: 16px; height: 16px; }
.feed-body {
  min-width: 0;
  padding-top: 6px;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text);
  overflow-wrap: anywhere;
}
.feed-body p { margin: 0; }
.feed-body p + p { margin-top: 2px; color: var(--text-muted); }
.feed-body strong { font-weight: var(--fw-semibold); }
.feed-time {
  padding-top: 7px;
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
  white-space: nowrap;
}


/* =============================================================================
   20. ÉTAT VIDE
   ============================================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--sp-4);
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--primary-soft) 50%, transparent),
    0 0 0 16px color-mix(in srgb, var(--primary-soft) 22%, transparent);
  animation: cmp-pop-in var(--dur-slow) var(--ease-spring) both;
}
.empty-icon .icon { width: 28px; height: 28px; stroke-width: 1.75; }
.empty-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
}
.empty-text {
  margin: 0;
  max-width: 46ch;
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text-muted);
}
.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}


/* =============================================================================
   21. KPI & SPARKLINE (§9.6)
   -----------------------------------------------------------------------------
   .kpi(.kpi-primary|accent|success|warning|danger|info) > .kpi-top (icône +
   libellé) / .kpi-value / .kpi-foot (delta + indice) / svg.sparkline.kpi-spark
   (pleine largeur en bas de carte).
   ============================================================================= */
.kpi {
  --kpi-tone: var(--primary);
  --kpi-soft: var(--primary-soft);
  --kpi-text: var(--primary-soft-text);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
}
.kpi::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -45%;
  right: -25%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--kpi-tone) 11%, transparent), transparent);
  pointer-events: none;
}
.kpi-primary { --kpi-tone: var(--primary); --kpi-soft: var(--primary-soft); --kpi-text: var(--primary-soft-text); }
.kpi-accent { --kpi-tone: var(--accent); --kpi-soft: var(--accent-soft); --kpi-text: var(--accent-soft-text); }
.kpi-success { --kpi-tone: var(--success); --kpi-soft: var(--success-soft); --kpi-text: var(--success-text); }
.kpi-warning { --kpi-tone: var(--warning); --kpi-soft: var(--warning-soft); --kpi-text: var(--warning-text); }
.kpi-danger { --kpi-tone: var(--danger); --kpi-soft: var(--danger-soft); --kpi-text: var(--danger-text); }
.kpi-info { --kpi-tone: var(--info); --kpi-soft: var(--info-soft); --kpi-text: var(--info-text); }

a.kpi {
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-fast) var(--ease-standard);
}
@media (hover: hover) {
  a.kpi:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--kpi-tone) 35%, var(--border));
    box-shadow: var(--shadow-md);
  }
}
a.kpi:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.kpi-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--kpi-soft);
  color: var(--kpi-text);
}
.kpi-icon .icon { width: 18px; height: 18px; }
.kpi-label {
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.kpi-value {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
  white-space: nowrap;
}
.kpi-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: var(--fs-xs);
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}
.kpi-delta .icon { width: 14px; height: 14px; }
.kpi-delta.is-up { background: var(--success-soft); color: var(--success-text); }
.kpi-delta.is-down { background: var(--danger-soft); color: var(--danger-text); }
.kpi-hint { color: var(--text-subtle); }

/* Spécificité .kpi .kpi-spark : doit l'emporter sur .sparkline (défini plus bas). */
.kpi .kpi-spark {
  width: calc(100% + 2 * var(--sp-5));
  height: 44px;
  margin: auto calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5));
  color: var(--kpi-tone);
}

/* Sparkline : la ligne garde une épaisseur constante (non-scaling-stroke) ;
   l'apparition se fait par révélation gauche → droite (clip-path sur le SVG),
   déclenchée quand la polyligne [data-draw] (ou le SVG) reçoit .is-visible. */
.sparkline {
  display: block;
  width: 100%;
  height: 36px;
  overflow: visible;
  color: var(--primary);
}
.sparkline-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
/* Neutralise le tracé générique [data-draw] de motion.css (spécificité 0,4,1 > 0,3,1) :
   ici la révélation passe par le clip-path du SVG. */
.sparkline .sparkline-line[data-draw],
html.js .sparkline .sparkline-line[data-draw]:not(.is-visible),
html.js .sparkline .sparkline-line[data-draw].is-visible {
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  animation: none;
  transition: none;
}
.sparkline-area {
  fill: currentColor;
  stroke: none;
  opacity: 0.12;
}
/* core.js observe aussi le SVG .sparkline et lui pose .is-visible. Filet de
   sécurité : sans JS fonctionnel, la courbe apparaît après 2,5 s. */
html.js .sparkline:has(> [data-draw]):not(.is-visible) {
  clip-path: inset(-6px 100% -6px -6px);
  animation: cmp-clip-fallback 0s 2.5s forwards;
}
html.js .sparkline.is-visible:has(> [data-draw]) {
  animation: cmp-clip-reveal var(--dur-slower) var(--ease-in-out) backwards;
}


/* =============================================================================
   22. PROGRESSION — .progress(.progress-sm) > .progress-bar (style="--value:64%")
   ============================================================================= */
.progress {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress-sm { height: 4px; }
.progress-bar {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--accent)));
  transition: width var(--dur-slow) var(--ease-out);
}
/* Dans un bloc [data-reveal] : la barre se remplit à l'apparition
   (filet de sécurité : valeur finale après 2,5 s si core.js n'a pas tourné). */
html.js [data-reveal]:not(.is-visible) .progress-bar {
  width: 0;
  animation: cmp-progress-fallback 0s 2.5s forwards;
}


/* =============================================================================
   23. GRAPHIQUES (§9.6)
   -----------------------------------------------------------------------------
   Sans html.js : état final. Sous html.js : état initial « vide » puis
   croissance quand le conteneur reçoit .is-visible (core.js), décalée de
   calc(var(--i) * var(--stagger-step)).
   Croissance en ANIMATIONS (tad-grow-y / tad-grow-x / cmp-donut-grow), pas en
   transitions : comme [data-reveal], un filet de sécurité (2,5 s) affiche
   l'état final si core.js n'a pas tourné, et la croissance est quand même
   jouée si .is-visible arrive plus tard (graphique sous la ligne de flottaison).
   Teinte : data-tone="primary|accent|success|warning|danger|info|neutral"
   (posé par ui_bar_chart / ui_hbar_chart) ou style="--bar-color:…".
   ============================================================================= */

/* Teintes (option « tone » des helpers PHP). */
:is(.chart-bars, .chart-hbars)[data-tone="primary"] { --bar-color: var(--primary); }
:is(.chart-bars, .chart-hbars)[data-tone="accent"] { --bar-color: var(--accent); }
:is(.chart-bars, .chart-hbars)[data-tone="success"] { --bar-color: var(--success); }
:is(.chart-bars, .chart-hbars)[data-tone="warning"] { --bar-color: var(--warning); }
:is(.chart-bars, .chart-hbars)[data-tone="danger"] { --bar-color: var(--danger); }
:is(.chart-bars, .chart-hbars)[data-tone="info"] { --bar-color: var(--info); }
:is(.chart-bars, .chart-hbars)[data-tone="neutral"] { --bar-color: var(--chart-6); }

/* Message « aucune donnée » (classe interne de lib/ui.php, _ui_chart_empty). */
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0;
  padding: var(--sp-6) var(--sp-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  text-align: center;
}

/* --- Barres verticales ---------------------------------------------------- */
.chart-bars {
  --bar-color: var(--primary);
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: clamp(3px, 1.2%, 12px);
  height: var(--chart-h, 180px);
  margin: var(--sp-6) 0 calc(var(--sp-6) + 4px);
  padding: 0 2px;
  border-bottom: 1px solid var(--border-strong);
  background-image: linear-gradient(to top, color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px);
  background-size: 100% 25%;
  background-position: left bottom;
}
.chart-bar {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.chart-bar-fill {
  display: block;
  width: 100%;
  max-width: 44px;
  height: var(--h, 0%);
  min-height: 2px;
  border-radius: var(--radius-xs) var(--radius-xs) 2px 2px;
  background: color-mix(in srgb, var(--bar-color) 34%, var(--surface));
  transform-origin: bottom center;
  transition: background-color var(--dur-fast) var(--ease-standard);
}
.chart-bar-value {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h, 0%) + 6px);
  transform: translateX(-50%);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text-muted);
  white-space: nowrap;
}
.chart-bar-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  font-size: var(--fs-xs);
  line-height: 1;
  color: var(--text-subtle);
  white-space: nowrap;
}
@media (hover: hover) {
  .chart-bar:hover .chart-bar-fill { background: color-mix(in srgb, var(--bar-color) 62%, var(--surface)); }
  .chart-bar:hover .chart-bar-value { color: var(--text); }
}
.chart-bar.is-highlight .chart-bar-fill { background: var(--bar-color); }
.chart-bar.is-highlight .chart-bar-value { color: var(--text); font-weight: var(--fw-bold); }
.chart-bar.is-highlight .chart-bar-label { color: var(--text); font-weight: var(--fw-semibold); }

html.js .chart-bars:not(.is-visible) .chart-bar-fill {
  transform: scaleY(0);
  animation: cmp-unhide 0s 2.5s forwards;
}
html.js .chart-bars:not(.is-visible) .chart-bar-value {
  opacity: 0;
  animation: tad-reveal-fallback 0s 2.5s forwards;
}
html.js .chart-bars.is-visible .chart-bar-fill {
  animation: tad-grow-y var(--dur-slower) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step));
}
/* La valeur monte de 4px une fois sa barre poussée ; « translate » se compose
   avec le transform de centrage (translateX(-50%)). */
html.js .chart-bars.is-visible .chart-bar-value {
  animation: cmp-value-in var(--dur-base) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step) + var(--dur-base));
}

/* Beaucoup de barres sur petit écran : un libellé sur deux, valeurs au survol. */
@media (max-width: 640px) {
  .chart-bars:has(> .chart-bar:nth-child(13)) > .chart-bar:nth-child(even) .chart-bar-label { visibility: hidden; }
  .chart-bars:has(> .chart-bar:nth-child(13)) > .chart-bar:not(.is-highlight):not(:hover) .chart-bar-value { visibility: hidden; }
}

/* --- Barres horizontales -------------------------------------------------- */
.chart-hbars {
  --bar-color: var(--primary);
  display: grid;
  gap: var(--sp-3);
}
.hbar {
  display: grid;
  grid-template-columns: minmax(72px, 32%) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.hbar-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--fw-medium);
  color: var(--text);
}
.hbar-track {
  position: relative;
  display: block;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.hbar-fill {
  display: block;
  width: var(--w, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--bar-color) 60%, var(--surface)), var(--bar-color));
  transform-origin: left center;
}
.hbar-value {
  min-width: 3ch;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}
html.js .chart-hbars:not(.is-visible) .hbar-fill {
  transform: scaleX(0);
  animation: cmp-unhide 0s 2.5s forwards;
}
html.js .chart-hbars.is-visible .hbar-fill {
  animation: tad-grow-x var(--dur-slower) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step));
}
@media (max-width: 480px) {
  .hbar {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
  }
  .hbar-label { grid-column: 1 / -1; }
}

/* --- Donut ---------------------------------------------------------------- */
.donut-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-6);
}
.donut-figure {
  position: relative;
  flex: none;
  width: var(--donut-size, 160px);
  height: var(--donut-size, 160px);
}
.donut {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}
.donut-track,
.donut-seg {
  fill: none;
  stroke-width: calc(var(--donut-thickness, 14) * 1px);
}
.donut-track { stroke: var(--surface-3); }
.donut-seg {
  stroke: var(--seg-color, var(--primary));
  stroke-dasharray: var(--seg-len, 0) 100;
  stroke-dashoffset: calc(var(--seg-start, 0) * -1);
  stroke-linecap: butt;
  transition: opacity var(--dur-fast) var(--ease-standard);
}
/* Segments « vides » sous html.js jusqu'à .is-visible (posé par core.js sur
   svg.donut), puis remplissage segment après segment. */
html.js .donut:not(.is-visible) .donut-seg {
  stroke-dasharray: 0 100;
  animation: cmp-donut-fallback 0s 2.5s forwards;
}
html.js .donut.is-visible .donut-seg {
  animation: cmp-donut-grow var(--dur-slower) var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * var(--stagger-step) * 2);
}
@media (hover: hover) {
  .donut:hover .donut-seg { opacity: 0.5; }
  .donut .donut-seg:hover { opacity: 1; }
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18%;
  text-align: center;
  pointer-events: none;
}
.donut-center-value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
}
.donut-center-label {
  margin-top: 2px;
  font-size: var(--fs-xs);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}

/* --- Légende -------------------------------------------------------------- */
.chart-legend {
  display: grid;
  gap: var(--sp-2);
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.legend-item strong {
  margin-left: auto;
  padding-left: var(--sp-3);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.legend-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--swatch, var(--primary));
}


/* =============================================================================
   24. DIALOGUES NATIFS
   -----------------------------------------------------------------------------
   dialog.modal : centré, scale .96 → 1 + fondu (--dur-slow --ease-out) ;
                  sous 640px : feuille ancrée en bas (glisse vers le haut).
   dialog.drawer : tiroir droit pleine hauteur, translateX(100%) → 0.
   ::backdrop : var(--overlay) + léger flou, en fondu.
   .is-closing : animation inverse (core.js attend animationend puis close()).
   ============================================================================= */
dialog.modal,
dialog.drawer {
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
dialog.modal[open],
dialog.drawer[open] {
  display: flex;
  flex-direction: column;
}
html:has(dialog:modal) { overflow: hidden; }

dialog.modal {
  width: min(560px, calc(100vw - 2 * var(--sp-4)));
  max-width: calc(100vw - 2 * var(--sp-4));
  max-height: min(86vh, 760px);
  max-height: min(86dvh, 760px);
  margin: auto;
  border-radius: var(--radius-xl);
}
dialog.modal[open] {
  animation: cmp-modal-in var(--dur-slow) var(--ease-out) both;
}
dialog.modal.is-closing {
  animation: cmp-modal-out var(--dur-base) var(--ease-in) both;
}
/* Dialogue de confirmation construit par TAD.confirm() (classe interne de core.js). */
dialog.modal.tad-confirm {
  width: min(440px, calc(100vw - 2 * var(--sp-4)));
}
dialog.modal.tad-confirm .modal-body {
  color: var(--text-muted);
  line-height: var(--lh-normal);
}
dialog.modal.tad-confirm .modal-body p + p { margin-top: var(--sp-2); }

dialog.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(560px, 100vw);
  max-width: 100vw;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}
dialog.drawer[open] {
  animation: cmp-drawer-in var(--dur-slow) var(--ease-out) both;
}
dialog.drawer.is-closing {
  animation: cmp-drawer-out var(--dur-base) var(--ease-in) both;
}

dialog.modal::backdrop,
dialog.drawer::backdrop {
  background: var(--overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: cmp-fade-in var(--dur-slow) var(--ease-out) both;
}
dialog.modal.is-closing::backdrop,
dialog.drawer.is-closing::backdrop {
  animation: cmp-fade-out var(--dur-base) var(--ease-in) both;
}

.modal-header,
.drawer-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.modal-title,
.drawer-title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
}
.modal-body,
.drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--sp-6);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-footer,
.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  flex: none;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.drawer-footer { padding-bottom: calc(var(--sp-4) + env(safe-area-inset-bottom, 0px)); }

.dialog-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 0;
  margin: -6px -8px -6px auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.dialog-close .icon { width: 20px; height: 20px; }
@media (hover: hover) {
  .dialog-close:hover {
    background: color-mix(in srgb, var(--text) 8%, transparent);
    color: var(--text);
  }
}
.dialog-close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 0;
}

@media (max-width: 640px) {
  dialog.modal {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }
  dialog.modal::before {
    content: "";
    flex: none;
    align-self: center;
    width: 40px;
    height: 4px;
    margin-top: var(--sp-2);
    border-radius: var(--radius-pill);
    background: var(--border-strong);
  }
  dialog.modal[open] { animation-name: cmp-sheet-in; }
  dialog.modal.is-closing { animation-name: cmp-sheet-out; }
  .modal-header,
  .drawer-header { padding: var(--sp-4) var(--sp-5); }
  .modal-body,
  .drawer-body { padding: var(--sp-5); }
  .modal-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + env(safe-area-inset-bottom, 0px));
  }
  .modal-footer > .btn { width: 100%; }
  .drawer-footer { padding-inline: var(--sp-5); }
}
@media (max-width: 560px) {
  dialog.drawer {
    border-width: 0;
    border-radius: 0;
  }
}


/* =============================================================================
   25. ACCORDÉON
   -----------------------------------------------------------------------------
   Le chevron est dessiné en CSS (::after du summary) et pivote à l'ouverture ;
   core.js anime la hauteur, le contenu apparaît en fondu.
   ============================================================================= */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.accordion-item + .accordion-item { border-top: 1px solid var(--border); }

.accordion-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-4) var(--sp-5);
  list-style: none;
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease-standard);
}
.accordion-trigger::-webkit-details-marker { display: none; }
.accordion-trigger::marker { content: ""; }
.accordion-trigger .icon { color: var(--primary); }
.accordion-trigger::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  margin-right: 4px;
  border: solid var(--text-subtle);
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
  transition:
    transform var(--dur-base) var(--ease-out),
    border-color var(--dur-fast) var(--ease-standard);
}
details[open] > .accordion-trigger::after {
  border-color: var(--primary);
  transform: translateY(2px) rotate(-135deg);
}
@media (hover: hover) {
  .accordion-trigger:hover { background: var(--surface-2); }
}
.accordion-trigger:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.accordion-panel {
  padding: 0 var(--sp-5) var(--sp-5);
  line-height: var(--lh-normal);
  color: var(--text-muted);
}
.accordion-panel > :first-child { margin-top: 0; }
.accordion-panel > :last-child { margin-bottom: 0; }
details.accordion-item[open] > .accordion-panel {
  animation: cmp-fade-in var(--dur-base) var(--ease-out) both;
}


/* =============================================================================
   26. MENU DÉROULANT — details.menu > summary.menu-trigger + .menu-list
   ============================================================================= */
details.menu {
  position: relative;
  display: inline-block;
}
.menu-trigger {
  list-style: none;
  cursor: pointer;
}
.menu-trigger::-webkit-details-marker { display: none; }
.menu-trigger::marker { content: ""; }
.menu-trigger:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.menu-list {
  position: absolute;
  z-index: calc(var(--z-header) + 5);
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 2 * var(--sp-4)));
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
}
details.menu[open] > .menu-list {
  animation: cmp-menu-in var(--dur-base) var(--ease-out) both;
}
.menu-list > li { display: block; }
.menu-list form { margin: 0; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}
.menu-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-ring); }
.menu-item.is-danger { color: var(--danger-text); }
.menu-item.is-danger .icon { color: currentColor; }
.menu-item.is-danger:hover,
.menu-item.is-danger:focus-visible { background: var(--danger-soft); }
.menu-sep {
  display: block;
  height: 1px;
  margin: 6px -6px;
  border: 0;
  background: var(--border);
}


/* =============================================================================
   27. INFO-BULLE — [data-tooltip="Texte"] (CSS seul, via ::after)
   -----------------------------------------------------------------------------
   Au-dessus de l'élément, apparition --dur-fast (léger délai d'intention).
   Utilise ::after uniquement (::before reste libre pour les composants).
   ============================================================================= */
[data-tooltip] { position: relative; }
[data-tooltip]:not(.is-loading)::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: var(--z-tooltip);
  left: 50%;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: 240px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-inverse);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1.35;
  letter-spacing: normal;
  text-align: center;
  text-transform: none;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, var(--move-1)) scale(0.96);
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    visibility 0s linear var(--dur-fast);
}
@media (hover: hover) {
  [data-tooltip]:not(.is-loading):hover::after {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
    transition-delay: 120ms, 120ms, 120ms;
  }
}
[data-tooltip]:not(.is-loading):focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
  transition-delay: 0s;
}

/* Sidebar (exploitation) : masquage hors mode replié et placement à droite
   sont gérés par layout-manager.css (.sidebar [data-tooltip]). */


/* =============================================================================
   28. AVATAR — .avatar(.avatar-sm|.avatar-lg) style="--avatar-hue:142"
   -----------------------------------------------------------------------------
   Teinte dérivée de --avatar-hue mélangée aux tokens de surface et de texte :
   s'adapte seule aux thèmes clair et sombre.
   ============================================================================= */
.avatar {
  --avatar-hue: 190;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in oklab, hsl(var(--avatar-hue) 65% 50%) 20%, var(--surface));
  color: color-mix(in oklab, hsl(var(--avatar-hue) 70% 45%) 50%, var(--text));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, hsl(var(--avatar-hue) 60% 50%) 22%, transparent);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.6875rem;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: var(--fs-md);
}


/* =============================================================================
   29. CHARGEMENT — .skeleton(.skeleton-text|.skeleton-block) .spinner .live-dot
   ============================================================================= */
.skeleton,
.skeleton-text,
.skeleton-block {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: transparent;
  user-select: none;
}
.skeleton::after,
.skeleton-text::after,
.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent);
  animation: cmp-shimmer 1.4s var(--ease-in-out) infinite;
}
.skeleton-text {
  height: 0.875em;
  margin: 0.45em 0;
  border-radius: var(--radius-xs);
}
.skeleton-text:last-child:not(:first-child) { width: 62%; }
.skeleton-block {
  height: 120px;
  border-radius: var(--radius-md);
}

.spinner {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid color-mix(in srgb, currentColor 22%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  color: var(--primary);
  vertical-align: middle;
  animation: tad-spin 700ms linear infinite;
}

.live-dot {
  --ring-scale: 2.6;
  position: relative;
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  color: var(--success);
  vertical-align: middle;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  animation: cmp-ring 1.8s var(--ease-out) infinite;
}


/* =============================================================================
   30. BANDE DE DATES
   -----------------------------------------------------------------------------
   .date-strip-wrap > .date-strip-nav + .date-strip > .date-chip
   Défilement horizontal aimanté (scroll-snap), bords en fondu (masque alpha),
   puce sélectionnée pleine (--primary) avec petit « pop » ; aujourd'hui = point.
   La puce peut être un <a>, un <button> ou un <label> contenant un radio.
   ============================================================================= */
.date-strip-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.date-strip-nav {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    opacity var(--dur-fast) var(--ease-standard),
    transform var(--dur-instant) var(--ease-out);
}
.date-strip-nav .icon { width: 18px; height: 18px; }
@media (hover: hover) {
  .date-strip-nav:hover:not(:disabled) {
    background: var(--surface-2);
    border-color: var(--border-strong);
  }
}
.date-strip-nav:active:not(:disabled) { transform: scale(0.92); }
.date-strip-nav:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.date-strip-nav:disabled,
.date-strip-nav[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}
@media (pointer: coarse) and (max-width: 640px) {
  .date-strip-nav { display: none; }
}

.date-strip {
  display: flex;
  gap: var(--sp-2);
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 6px var(--sp-6) 10px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--sp-6);
  scroll-behavior: smooth;
  scrollbar-width: none;
  /* Masque alpha (le noir n'est pas une couleur affichée : il définit l'opacité). */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, black var(--sp-6), black calc(100% - var(--sp-6)), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, black var(--sp-6), black calc(100% - var(--sp-6)), transparent 100%);
}
.date-strip::-webkit-scrollbar { display: none; }
.date-strip > li {
  display: flex;
  flex: none;
}

.date-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  width: 72px;
  min-height: 88px;
  margin: 0;
  padding: 10px 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: center;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.date-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.date-chip-dow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--text-muted);
}
.date-chip-day {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
  color: var(--text);
}
.date-chip-month {
  font-size: var(--fs-xs);
  line-height: 1.2;
  color: var(--text-muted);
}
.date-chip-meta {
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}
.date-chip-meta:empty { display: none; }

@media (hover: hover) {
  .date-chip:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
  }
}
.date-chip:active { transform: scale(var(--scale-press)); transition-duration: var(--dur-instant); }
.date-chip:focus-visible,
.date-chip:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.date-chip.is-selected,
.date-chip[aria-current="date"],
.date-chip[aria-pressed="true"],
.date-chip:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-primary);
  animation: cmp-bump var(--dur-base) var(--ease-spring);
}
.date-chip.is-selected :is(.date-chip-dow, .date-chip-month),
.date-chip[aria-current="date"] :is(.date-chip-dow, .date-chip-month),
.date-chip[aria-pressed="true"] :is(.date-chip-dow, .date-chip-month),
.date-chip:has(input:checked) :is(.date-chip-dow, .date-chip-month) {
  color: color-mix(in srgb, var(--on-primary) 82%, transparent);
}
.date-chip.is-selected .date-chip-day,
.date-chip[aria-current="date"] .date-chip-day,
.date-chip[aria-pressed="true"] .date-chip-day,
.date-chip:has(input:checked) .date-chip-day {
  color: var(--on-primary);
}
.date-chip.is-selected .date-chip-meta,
.date-chip[aria-current="date"] .date-chip-meta,
.date-chip[aria-pressed="true"] .date-chip-meta,
.date-chip:has(input:checked) .date-chip-meta {
  background: color-mix(in srgb, var(--on-primary) 20%, transparent);
  color: var(--on-primary);
}

.date-chip.is-today::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}
.date-chip.is-today.is-selected::after,
.date-chip.is-today[aria-current="date"]::after,
.date-chip.is-today:has(input:checked)::after {
  background: var(--on-primary);
  box-shadow: none;
}

.date-chip.is-disabled,
.date-chip.is-closed,
.date-chip[aria-disabled="true"] {
  border-color: var(--border);
  background-color: var(--surface-2);
  box-shadow: none;
  color: var(--text-subtle);
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  animation: none;
}
.date-chip.is-disabled :is(.date-chip-dow, .date-chip-day, .date-chip-month),
.date-chip.is-closed :is(.date-chip-dow, .date-chip-day, .date-chip-month),
.date-chip[aria-disabled="true"] :is(.date-chip-dow, .date-chip-day, .date-chip-month) {
  color: var(--text-subtle);
}
.date-chip.is-disabled { opacity: 0.6; }
.date-chip.is-closed {
  border-style: dashed;
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--border-strong) 30%, transparent) 6px 7px);
}
.date-chip.is-closed .date-chip-day {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}
.date-chip.is-closed .date-chip-meta,
.date-chip.is-disabled .date-chip-meta {
  background: var(--surface-3);
  color: var(--text-muted);
}


/* =============================================================================
   31. CARTES D'OPTION — .option-grid > .option-card (lien, bouton ou label)
   -----------------------------------------------------------------------------
   Survol : la carte se soulève, l'icône passe en primaire, la flèche glisse
   vers la droite (oriente vers l'action).
   ============================================================================= */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.option-grid > li { display: flex; }
.option-grid > li > .option-card { flex: 1; }

.option-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-4);
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.option-card:not(:has(> .option-card-icon)) {
  grid-template-columns: minmax(0, 1fr) auto;
}
.option-card > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.option-card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary-soft-text);
  transition:
    background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard),
    transform var(--dur-base) var(--ease-spring);
}
.option-card-icon .icon { width: 22px; height: 22px; }
.option-card-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.option-card-title {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.option-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.option-card-meta .icon { width: 14px; height: 14px; }
.option-card-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-subtle);
  transition:
    transform var(--dur-base) var(--ease-out),
    background-color var(--dur-fast) var(--ease-standard),
    color var(--dur-fast) var(--ease-standard);
}
.option-card-arrow .icon { width: 18px; height: 18px; }

@media (hover: hover) {
  .option-card:hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
  .option-card:hover .option-card-icon {
    background: var(--primary);
    color: var(--on-primary);
  }
  .option-card:hover .option-card-arrow {
    background: var(--primary-soft);
    color: var(--primary-soft-text);
    transform: translateX(4px);
  }
}
.option-card:active {
  transform: scale(var(--scale-press));
  transition-duration: var(--dur-instant);
}
.option-card:focus-visible,
.option-card:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.option-card[aria-current="true"],
.option-card[aria-pressed="true"],
.option-card:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}


/* =============================================================================
   32. DÉPARTS
   -----------------------------------------------------------------------------
   .departure : grille heure | ligne | trajet (from → to) | statut | action.
   Mobile : « heure ligne statut » / « trajet … action ».
   .is-full (teinte danger) et .is-blocked (neutre, pointillé) : non cliquables.
   ============================================================================= */
.departure-list {
  display: grid;
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}
.departure-list > li { display: block; }

.departure {
  position: relative;
  display: grid;
  grid-template-columns: 5.25rem auto minmax(0, 1fr) auto auto;
  grid-template-areas: "time line route status cta";
  align-items: center;
  column-gap: var(--sp-4);
  row-gap: var(--sp-2);
  width: 100%;
  min-height: 76px;
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font: inherit;
  text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
:is(a, button).departure { cursor: pointer; }

.departure-time {
  grid-area: time;
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
  white-space: nowrap;
}
.departure-line {
  grid-area: line;
  display: flex;
  align-items: center;
  gap: 6px;
}
.departure-route {
  grid-area: route;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.departure-from {
  min-width: 0;
  font-weight: var(--fw-semibold);
  color: var(--text);
  overflow-wrap: anywhere;
}
.departure-to {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.departure-to::before {
  content: "→";
  content: "→" / "";
  flex: none;
  font-weight: var(--fw-semibold);
  color: var(--text-subtle);
}
.departure-status {
  grid-area: status;
  justify-self: end;
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.departure-cta {
  grid-area: cta;
  justify-self: end;
}
.departure-cta:not(.btn) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.departure-cta .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--dur-base) var(--ease-out);
}
/* Lien « étiré » : toute la carte devient cliquable via le lien d'action. */
.departure:not(a) > a.departure-cta:not(.btn)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

@media (hover: hover) {
  .departure:not(.is-full):not(.is-blocked):is(a, button, :has(a.departure-cta, button.departure-cta)):hover {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  .departure:not(.is-full):not(.is-blocked):hover .departure-cta .icon {
    transform: translateX(4px);
  }
}
:is(a, button).departure:active:not(.is-full):not(.is-blocked) {
  transform: scale(var(--scale-press));
  transition-duration: var(--dur-instant);
}
:is(a, button).departure:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.departure.is-full {
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface));
  box-shadow: none;
  cursor: not-allowed;
}
.departure.is-full .departure-time {
  color: var(--danger-text);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in srgb, var(--danger) 55%, transparent);
}
.departure.is-blocked {
  border-style: dashed;
  background: var(--surface-2);
  box-shadow: none;
  cursor: not-allowed;
}
.departure.is-blocked :is(.departure-time, .departure-from, .departure-to) { color: var(--text-subtle); }
.departure.is-blocked .line-badge {
  filter: grayscale(1);
  opacity: 0.6;
}
a.departure:is(.is-full, .is-blocked) { pointer-events: none; }
.departure:is(.is-full, .is-blocked) .departure-cta {
  opacity: 0.4;
  pointer-events: none;
}

@media (max-width: 640px) {
  .departure {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "time line status"
      "route route cta";
    column-gap: var(--sp-3);
    min-height: 0;
    padding: var(--sp-4);
  }
  .departure-time { font-size: var(--fs-xl); }
  .departure-line { justify-self: start; }
  .departure-cta:not(.btn) { min-height: 32px; }
}


/* =============================================================================
   33. BILLET — .ticket > .ticket-header + .ticket-body + .ticket-perforation
                          + .ticket-stub (.ticket-ref)
   -----------------------------------------------------------------------------
   Le conteneur est transparent : chaque partie porte la surface, ce qui laisse
   les encoches de la perforation (radial-gradient) laisser voir le fond.
   ============================================================================= */
.ticket {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  border-radius: var(--radius-xl);
  background: transparent;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.ticket > :first-child {
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
}
.ticket > :last-child {
  border-bottom-left-radius: var(--radius-xl);
  border-bottom-right-radius: var(--radius-xl);
}

.ticket-header {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  background: linear-gradient(135deg, var(--primary-active) 0%, var(--primary) 55%, color-mix(in srgb, var(--primary) 62%, var(--accent)) 100%);
  color: var(--on-primary);
}
.ticket-header::after {
  content: "";
  position: absolute;
  top: -90px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--on-primary) 18%, transparent), transparent);
  pointer-events: none;
}
.ticket-header > * {
  position: relative;
  z-index: 1;
}
.ticket-header :is(h1, h2, h3, p, strong, small) {
  margin: 0;
  color: inherit;
}
.ticket-header .badge {
  --tone-soft: color-mix(in srgb, var(--on-primary) 18%, transparent);
  --tone-text: var(--on-primary);
}

.ticket-body {
  padding: var(--sp-6);
  background: var(--surface);
}

.ticket-perforation {
  position: relative;
  flex: none;
  height: 28px;
  background:
    radial-gradient(circle at 0 50%, transparent 13px, var(--surface) 13.5px) left center / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 13px, var(--surface) 13.5px) right center / 51% 100% no-repeat;
}
.ticket-perforation::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 50%;
  border-top: 2px dashed var(--border-strong);
  transform: translateY(-1px);
}

.ticket-stub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  background: var(--surface);
}
.ticket-ref {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  line-height: 1.1;
  color: var(--text);
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  .ticket-header,
  .ticket-body { padding-inline: var(--sp-5); }
  .ticket-stub { padding-inline: var(--sp-5); }
  .ticket-ref { font-size: var(--fs-xl); }
}


/* =============================================================================
   34. COCHE DE SUCCÈS — svg.success-mark
   -----------------------------------------------------------------------------
   Markup conseillé :
   <svg class="success-mark" viewBox="0 0 52 52" aria-hidden="true">
     <circle class="success-mark-circle" cx="26" cy="26" r="24" pathLength="1"/>
     <path class="success-mark-check" d="M15 27l7 7 15-15" pathLength="1"/>
   </svg>
   Séquence : cercle tracé (--dur-slower) → coche tracée (--dur-slow) → anneau
   qui pulse une fois (--dur-epic).
   ============================================================================= */
svg.success-mark {
  display: block;
  width: 88px;
  height: 88px;
  margin-inline: auto;
  overflow: visible;
  border-radius: 50%;
  color: var(--success);
  animation: cmp-success-ring var(--dur-epic) var(--ease-out) calc(var(--dur-slower) + var(--dur-slow)) both;
}
.success-mark-circle {
  fill: color-mix(in srgb, var(--success) 10%, transparent);
  stroke: currentColor;
  stroke-width: 3;
  stroke-dasharray: 1.02 1.5;
  stroke-dashoffset: 0;
  transform: rotate(-90deg);
  transform-box: fill-box;
  transform-origin: center;
  animation:
    cmp-draw var(--dur-slower) var(--ease-out) both,
    cmp-fill-in var(--dur-slow) var(--ease-out) var(--dur-slow) both;
}
.success-mark-check {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1.02 1.5;
  stroke-dashoffset: 0;
  animation: cmp-draw var(--dur-slow) var(--ease-out) var(--dur-slower) both;
}


/* =============================================================================
   35. CARTE D'ITINÉRAIRE — .route-map / .route-line[data-draw] / .map-marker-*
   -----------------------------------------------------------------------------
   Répartition des rôles (pas de doublon) :
   - motion.css §6 : chorégraphie du tracé ([data-draw] → tad-draw, --dur-draw)
     et « pop » des marqueurs (départ d'abord, arrivée en fin de tracé) ;
   - documents.css : apparence (tuiles, couleurs des marqueurs, crédit, impression).
   Ici : uniquement le contexte de positionnement du conteneur.
   ============================================================================= */
.route-map { position: relative; }


/* =============================================================================
   36. DÉPÔT DE FICHIER — .dropzone(.is-dragover|.has-file)
   -----------------------------------------------------------------------------
   Bordure pointillée dessinée en dégradés (4 côtés) pour pouvoir l'animer
   (« fourmis » qui tournent) au survol et pendant le glisser-déposer.
   L'input[type=file] recouvre la zone (clic + dépôt natifs, focus clavier).
   ============================================================================= */
.dropzone {
  --dz-color: var(--border-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 200px;
  padding: var(--sp-10) var(--sp-6);
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
  background-image:
    linear-gradient(90deg, var(--dz-color) 50%, transparent 0),
    linear-gradient(90deg, var(--dz-color) 50%, transparent 0),
    linear-gradient(0deg, var(--dz-color) 50%, transparent 0),
    linear-gradient(0deg, var(--dz-color) 50%, transparent 0);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-size: 14px 2px, 14px 2px, 2px 14px, 2px 14px;
  background-position: 0 0, 0 100%, 0 0, 100% 0;
  text-align: center;
  cursor: pointer;
  transition:
    background-color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
@media (hover: hover) {
  .dropzone:hover {
    --dz-color: color-mix(in srgb, var(--primary) 70%, var(--border-strong));
    background-color: color-mix(in srgb, var(--primary-soft) 45%, var(--surface-2));
    animation: cmp-march 700ms linear infinite;
  }
  .dropzone:hover .dropzone-icon { transform: translateY(calc(-1 * var(--move-1))); }
}
.dropzone:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}
.dropzone.is-dragover {
  --dz-color: var(--primary);
  background-color: var(--primary-soft);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
  transform: scale(1.01);
  animation: cmp-march 500ms linear infinite;
}
.dropzone.has-file {
  --dz-color: var(--success);
  background-color: var(--success-soft);
}

.dropzone-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--sp-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  transition:
    color var(--dur-fast) var(--ease-standard),
    transform var(--dur-base) var(--ease-out);
}
.dropzone-icon .icon { width: 26px; height: 26px; }
.dropzone.is-dragover .dropzone-icon {
  animation: cmp-bounce 900ms var(--ease-in-out) infinite;
}
.dropzone.has-file .dropzone-icon { color: var(--success-text); }
.dropzone-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
}
.dropzone-hint {
  margin: 0;
  max-width: 48ch;
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  color: var(--text-muted);
}
.dropzone-file {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
  margin-top: var(--sp-3);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  overflow-wrap: anywhere;
  animation: cmp-pop-in var(--dur-base) var(--ease-spring) both;
}
.dropzone-file:empty { display: none; }
.dropzone-file .icon { width: 16px; height: 16px; color: var(--success-text); }


/* =============================================================================
   37. EN-TÊTES DE PAGE / SECTION, BARRE DE FILTRES, SÉPARATEUR
   ============================================================================= */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-6);
  margin-bottom: var(--sp-8);
}
.page-heading {
  flex: 1 1 320px;
  min-width: 0;
}
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--primary-soft-text);
}
.page-eyebrow .icon { width: 14px; height: 14px; }
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(var(--fs-xl), 1.6vw + 1rem, var(--fs-3xl));
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
  text-wrap: balance;
}
.page-subtitle {
  margin: var(--sp-2) 0 0;
  max-width: 68ch;
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text-muted);
}
.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}
@media (max-width: 640px) {
  .page-header { margin-bottom: var(--sp-6); }
  .page-actions { width: 100%; }
  .page-actions > .btn { flex: 1 1 auto; }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-5);
}
.section-head > :first-child { min-width: 0; }
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  font-weight: var(--fw-black);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
  color: var(--text);
  text-wrap: balance;
}
.section-subtitle {
  margin: var(--sp-1) 0 0;
  max-width: 64ch;
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--text-muted);
}
.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.filter-bar > .field { flex: 1 1 170px; min-width: 0; }
.filter-bar > .search-field { flex: 2 1 260px; }
.filter-bar > :is(.chip-group, .segmented) { align-self: center; }
.filter-bar > .btn { flex: none; }
@media (max-width: 640px) {
  .filter-bar > :is(.field, .search-field, .btn) { flex: 1 1 100%; }
}

.divider {
  display: block;
  height: 1px;
  margin: var(--sp-6) 0;
  border: 0;
  background: var(--border);
}
.divider:not(:empty) {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: auto;
  background: none;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.divider:not(:empty)::before,
.divider:not(:empty)::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Compte à rebours ([data-countdown], texte géré par core.js) : départ dans
   moins d'une heure → .is-soon (teinte d'avertissement, aucun mouvement). */
[data-countdown] {
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-fast) var(--ease-standard);
}
[data-countdown].is-soon {
  color: var(--warning-text);
  font-weight: var(--fw-semibold);
}
.badge[data-countdown].is-soon {
  --tone-soft: var(--warning-soft);
  --tone-text: var(--warning-text);
  background: var(--tone-soft);
  color: var(--tone-text);
}


/* =============================================================================
   38. KEYFRAMES INTERNES (préfixe cmp-, propres à components.css)
   -----------------------------------------------------------------------------
   Les distances utilisent --move-* (ramenées à 0 en mouvement réduit) ;
   les échelles d'accent utilisent --bump-scale / --ring-scale (internes).
   ============================================================================= */
@keyframes cmp-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes cmp-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes cmp-fade-up {
  from { opacity: 0; transform: translateY(var(--move-2)); }
  to { opacity: 1; transform: none; }
}
@keyframes cmp-fade-down {
  from { opacity: 0; transform: translateY(calc(-1 * var(--move-2))); }
  to { opacity: 1; transform: none; }
}
@keyframes cmp-pop-in {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}
/* Petit « pop » de confirmation (sélection, valeur modifiée). */
@keyframes cmp-bump {
  0% { transform: scale(1); }
  45% { transform: scale(var(--bump-scale, var(--scale-pop))); }
  100% { transform: scale(1); }
}
/* Anneau qui s'étend et s'efface (halo d'étape, point « en direct »). */
@keyframes cmp-ring {
  0% { transform: scale(1); opacity: 0.55; }
  80%, 100% { transform: scale(var(--ring-scale, 2)); opacity: 0; }
}
@keyframes cmp-grow-x {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
/* Filets de sécurité (0s, délai 2,5 s, forwards) des états « cachés en
   attendant core.js » : graphiques, itinéraire, sparkline, progression. */
@keyframes cmp-unhide {
  to { transform: none; }
}
@keyframes cmp-donut-fallback {
  to { stroke-dasharray: var(--seg-len, 0) 100; }
}
@keyframes cmp-clip-fallback {
  to { clip-path: inset(-6px -6px -6px -6px); }
}
@keyframes cmp-progress-fallback {
  to { width: var(--value, 0%); }
}
/* Entrées des graphiques (état d'arrivée = état normal de l'élément). */
@keyframes cmp-donut-grow {
  from { stroke-dasharray: 0 100; }
}
@keyframes cmp-clip-reveal {
  from { clip-path: inset(-6px 100% -6px -6px); }
  to { clip-path: inset(-6px -6px -6px -6px); }
}
@keyframes cmp-value-in {
  from { opacity: 0; translate: 0 var(--move-1); }
}
@keyframes cmp-dot-in {
  from { scale: 0; }
}
@keyframes cmp-toast-progress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
@keyframes cmp-toast-in-up {
  from { opacity: 0; transform: translateY(var(--move-3)) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes cmp-toast-out-down {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(var(--move-3)) scale(0.98); }
}
@keyframes cmp-modal-in {
  from { opacity: 0; transform: translateY(var(--move-2)) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes cmp-modal-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(var(--move-1)) scale(0.96); }
}
@keyframes cmp-sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}
@keyframes cmp-sheet-out {
  from { transform: none; }
  to { transform: translateY(100%); }
}
@keyframes cmp-drawer-in {
  from { transform: translateX(100%); }
  to { transform: none; }
}
@keyframes cmp-drawer-out {
  from { transform: none; }
  to { transform: translateX(100%); }
}
@keyframes cmp-menu-in {
  from { opacity: 0; transform: translateY(calc(-1 * var(--move-1))) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes cmp-shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
/* Tracé d'un chemin pathLength="1" : dasharray « 1.02 1.5 » (le tiret couvre tout le
   chemin, sans jointure visible) et départ à 1.05 (aucun point résiduel). */
@keyframes cmp-draw {
  from { stroke-dashoffset: 1.05; }
  to { stroke-dashoffset: 0; }
}
@keyframes cmp-fill-in {
  from { fill-opacity: 0; }
  to { fill-opacity: 1; }
}
@keyframes cmp-success-ring {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 40%, transparent); }
  100% { box-shadow: 0 0 0 22px color-mix(in srgb, var(--success) 0%, transparent); }
}
/* Bordure pointillée qui tourne (dropzone). */
@keyframes cmp-march {
  to { background-position: 14px 0, -14px 100%, 0 -14px, 100% 14px; }
}
@keyframes cmp-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(calc(-1 * var(--move-2))); }
}


/* =============================================================================
   39. MOUVEMENT RÉDUIT
   -----------------------------------------------------------------------------
   Les tokens --dur-* passent à 1ms (tokens.css) : les animations ponctuelles
   deviennent instantanées (et animationend reste émis pour le JS).
   Ici : arrêt des boucles infinies à durée fixe (halo, point en direct,
   shimmer, fourmis, rebond) et défilement non animé. Les spinners restent
   (retour d'état indispensable) mais tournent plus lentement.
   data-motion="full" force le mouvement complet malgré la préférence système.
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .stepper-step.is-current .stepper-dot::after,
  :root:not([data-motion="full"]) .live-dot::after,
  :root:not([data-motion="full"]) .skeleton::after,
  :root:not([data-motion="full"]) .skeleton-text::after,
  :root:not([data-motion="full"]) .skeleton-block::after,
  :root:not([data-motion="full"]) .dropzone,
  :root:not([data-motion="full"]) .dropzone .dropzone-icon,
  :root:not([data-motion="full"]) svg.success-mark {
    animation: none;
  }
  :root:not([data-motion="full"]) .skeleton::after,
  :root:not([data-motion="full"]) .skeleton-text::after,
  :root:not([data-motion="full"]) .skeleton-block::after,
  :root:not([data-motion="full"]) .stepper-step.is-current .stepper-dot::after {
    display: none;
  }
  :root:not([data-motion="full"]) .date-strip { scroll-behavior: auto; }
  :root:not([data-motion="full"]) .spinner,
  :root:not([data-motion="full"]) .btn.is-loading::after {
    animation-duration: 1.6s;
  }
}

:root[data-motion="reduced"] .stepper-step.is-current .stepper-dot::after,
:root[data-motion="reduced"] .live-dot::after,
:root[data-motion="reduced"] .skeleton::after,
:root[data-motion="reduced"] .skeleton-text::after,
:root[data-motion="reduced"] .skeleton-block::after,
:root[data-motion="reduced"] .dropzone,
:root[data-motion="reduced"] .dropzone .dropzone-icon,
:root[data-motion="reduced"] svg.success-mark {
  animation: none;
}
:root[data-motion="reduced"] .skeleton::after,
:root[data-motion="reduced"] .skeleton-text::after,
:root[data-motion="reduced"] .skeleton-block::after,
:root[data-motion="reduced"] .stepper-step.is-current .stepper-dot::after {
  display: none;
}
:root[data-motion="reduced"] .date-strip { scroll-behavior: auto; }
:root[data-motion="reduced"] .spinner,
:root[data-motion="reduced"] .btn.is-loading::after {
  animation-duration: 1.6s;
}


/* =============================================================================
   40. IMPRESSION — états finaux, sans ombre ni animation
   ============================================================================= */
@media print {
  html.js .chart-bars .chart-bar-fill,
  html.js .chart-hbars .hbar-fill {
    transform: none !important;
    transition: none !important;
  }
  html.js .chart-bars .chart-bar-value {
    opacity: 1 !important;
    transform: translateX(-50%) !important;
  }
  html.js .donut .donut-seg {
    stroke-dasharray: var(--seg-len, 0) 100 !important;
    transition: none !important;
  }
  html.js .sparkline { clip-path: none !important; }
  .journey-stop::before,
  .journey-dot {
    transform: none !important;
    transition: none !important;
  }
  html.js [data-reveal] .progress-bar { width: var(--value, 0%) !important; }
  .stepper-step.is-current .stepper-dot::after,
  .live-dot::after,
  .skeleton::after,
  .skeleton-text::after,
  .skeleton-block::after { display: none !important; }
  [data-tooltip]::after { display: none !important; }
  .toast-region,
  .date-strip-nav,
  .theme-toggle { display: none !important; }
  .card,
  .panel,
  .kpi,
  .table-wrap,
  .option-card,
  .departure,
  .ticket {
    box-shadow: none !important;
    break-inside: avoid;
  }
  .table-wrap {
    overflow: visible;
    background-image: none;
  }
  .table thead th { position: static; }
  .ticket-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
