/* =========================================================================
   Revenue Recovery OS — feuille de style unique.

   Les jetons de design (design/tokens.css) sont intégrés en tête : un seul
   fichier est servi, donc un seul aller-retour et aucun ordre de chargement
   à respecter. Toute nouvelle valeur s'ajoute ici, dans le bloc de jetons,
   jamais en dur au milieu d'une règle.

   Concept : un poste d'aiguillage. Les idées avancent seules jusqu'à une
   barre ; la barre ne se lève que sous une main.

   RÈGLE D'OR : l'ambre (--gate) signifie « ceci attend votre décision »
   et ne sert à RIEN d'autre. Une seule tache de couleur sur la page.

   Aucune ressource extérieure n'est référencée : la politique de sécurité
   du serveur (default-src 'self') bloquerait toute police ou image d'un
   autre domaine. Polices système, pictogrammes tracés en CSS ou en SVG.
   ========================================================================= */

/* =========================================================================
   1. JETONS
   ========================================================================= */

:root {

  /* --- Surfaces (mode clair) : gris froid de plan, jamais de blanc pur -- */
  --bg:             #E8EAEE;
  --surface:        #FFFFFF;
  --surface-2:      #F2F4F7;   /* creux : en-têtes, champs au repos */
  --surface-3:      #E2E6EB;   /* creux profond : journal, blocs repliés.
                                  NE PORTE AUCUN CONTRÔLE BORDÉ */

  /* --- Texte : deux niveaux, tous deux au-dessus de la norme ----------- */
  --text:           #13161B;   /* 18,13:1 sur --surface */
  --text-muted:     #596273;   /* 6,14:1 sur --surface — AA partout */

  /* --- Traits ---------------------------------------------------------- */
  --line:           #D5DAE1;   /* séparateurs, bordures de carte */
  --line-ui:        #7B8493;   /* bordure d'un contrôle, ≥ 3:1 */

  /* --- Interaction : bleu. Liens, focus, action principale, jauges ----- */
  --accent:         #1B4FD8;
  --accent-hover:   #1740B4;
  --accent-ink:     #FFFFFF;
  --accent-soft:    #E9EFFD;

  /* --- LA PORTE : ambre de signal. Exclusif à la décision humaine. ----- */
  --gate:           #96470A;
  --gate-solid:     #A85608;
  --gate-ink:       #FFFFFF;
  --gate-surface:   #FFF6E9;
  --gate-line:      #AE7230;

  /* --- États : acquis / refusé ----------------------------------------- */
  --ok:             #06663F;
  --ok-surface:     #E6F4ED;
  --bad:            #A61B12;
  --bad-surface:    #FDECEA;
  --bad-ink:        #FFFFFF;   /* texte posé SUR --bad : suit le mode */

  /* --- Force d'une preuve : aliasée sur les états, jamais d'ambre ------ */
  --proof-weak:     var(--bad);
  --proof-moderate: var(--text-muted);
  --proof-strong:   var(--ok);

  /* --- Relief : deux niveaux. En sombre, la bordure remplace l'ombre. -- */
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-2: 0 16px 48px rgba(16, 24, 40, .18);

  /* --- Typographie : piles système, aucun téléchargement --------------- */
  --font-sans: system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI",
               Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "SF Mono", Menlo,
               Consolas, "Liberation Mono", monospace;

  /* Chiffres en chasse fixe — le geste typographique du projet. */
  --num-align: tabular-nums;

  --fs-lead:    26px;   /* LA phrase : ce que fait l'outil. Élément dominant. */
  --fs-display: 30px;   /* le grand chiffre du bandeau (36px ≥ 720px) */
  --fs-xl:      24px;   /* valeur d'un indicateur */
  --fs-h1:      20px;   /* titre de niveau 1 générique */
  --fs-h2:      17px;   /* titre de section, de bandeau, de tiroir */
  --fs-h3:      15px;   /* titre d'étape, titre de carte */
  --fs-body:    15px;
  --fs-sm:    13.5px;   /* libellés, explications, journal */
  --fs-xs:      13px;   /* métadonnées de carte */
  --fs-micro:   12px;   /* CAPITALES uniquement, avec --tracking-caps */

  --lh-tight: 1.1;
  --lh-head:  1.25;
  --lh-ui:    1.35;
  --lh-body:  1.5;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semi:    600;
  --fw-bold:    700;

  --tracking-caps:  .06em;
  --tracking-tight: -.01em;
  --measure: 68ch;

  /* --- Rythme : base 4px, aucune valeur intermédiaire ------------------ */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;

  /* --- Rayons : un par famille ----------------------------------------- */
  --r-sm:   8px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-pill: 999px;

  /* --- Cadre de page ---------------------------------------------------- */
  --page-max: 1180px;
  --gutter:     16px;
  --tap-min:    44px;

  /* --- Focus : toujours visible ---------------------------------------- */
  --focus-w:      2px;
  --focus-offset: 2px;
  --focus-color:  var(--accent);

  /* --- Mouvement : discret. Rien ne clignote, rien ne s'incrémente. ---- */
  --dur-fast: 120ms;
  --dur:      200ms;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

@media (min-width: 720px) {
  :root { --fs-display: 36px; --gutter: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur: 0ms; }
}

/* --- Mode sombre : bleu-noir d'instrument, signaux remontés ------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #0B0E13;
    --surface:      #171A21;
    --surface-2:    #1F232C;
    --surface-3:    #2A3039;

    --text:         #E7EAF0;   /* jamais #FFF : le blanc pur vibre */
    --text-muted:   #9BA5B5;

    --line:         #292E38;
    --line-ui:      #6A7383;

    --accent:       #7FA5FF;
    --accent-hover: #9DBAFF;
    --accent-ink:   #0A0F1C;
    --accent-soft:  #16203A;

    --gate:         #F5B14A;
    --gate-solid:   #F5B14A;
    --gate-ink:     #241603;
    --gate-surface: #2B1F0E;
    --gate-line:    #9C742C;

    --ok:           #56D89A;
    --ok-surface:   #0F2A1D;
    --bad:          #FF8A80;
    --bad-surface:  #2E1513;
    --bad-ink:      #1A0907;   /* le saumon clair exige une encre sombre */

    /* Une ombre noire sur fond noir n'existe pas : la bordure fait le relief. */
    --shadow-1: none;
    --shadow-2: 0 20px 60px rgba(0, 0, 0, .62);
  }
}

:root[data-theme="dark"] {
  --bg:           #0B0E13;
  --surface:      #171A21;
  --surface-2:    #1F232C;
  --surface-3:    #2A3039;

  --text:         #E7EAF0;
  --text-muted:   #9BA5B5;

  --line:         #292E38;
  --line-ui:      #6A7383;

  --accent:       #7FA5FF;
  --accent-hover: #9DBAFF;
  --accent-ink:   #0A0F1C;
  --accent-soft:  #16203A;

  --gate:         #F5B14A;
  --gate-solid:   #F5B14A;
  --gate-ink:     #241603;
  --gate-surface: #2B1F0E;
  --gate-line:    #9C742C;

  --ok:           #56D89A;
  --ok-surface:   #0F2A1D;
  --bad:          #FF8A80;
  --bad-surface:  #2E1513;
  --bad-ink:      #1A0907;

  --shadow-1: none;
  --shadow-2: 0 20px 60px rgba(0, 0, 0, .62);
}


/* =========================================================================
   2. SOCLE
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-variant-numeric: var(--num-align);   /* chiffres alignés partout */
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-head); letter-spacing: var(--tracking-tight); }
h1 { font-size: var(--fs-h1); font-weight: var(--fw-semi); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-semi); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-semi); }
h4 { font-size: var(--fs-h3); font-weight: var(--fw-semi); }
p  { margin: 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); }

.muted   { color: var(--text-muted); font-size: var(--fs-sm); }
.measure { max-width: var(--measure); }
.warn    { color: var(--bad); font-size: var(--fs-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Un tableau large défile dans sa boîte, jamais la page entière.
   La boîte reçoit le focus (tabindex=0 posé par l'interface) : sans cela,
   ce qui déborde est hors d'atteinte au clavier. */
.scroll-x { overflow-x: auto; }
.scroll-x:focus-visible, .audit:focus-visible {
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}


/* =========================================================================
   3. CONTRÔLES
   ========================================================================= */

.btn {
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: var(--lh-ui);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line-ui);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-2); }

.btn.primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: transparent; font-weight: var(--fw-semi);
}
.btn.primary:hover { background: var(--accent-hover); }

.btn.ghost { background: transparent; border-color: var(--line-ui); }
.btn.ghost:hover { background: var(--surface-2); }

/* Le seul aplat ambre de l'outil : le geste que l'outil attend. */
.btn.gate-ok {
  background: var(--gate-solid); color: var(--gate-ink);
  border-color: transparent; font-weight: var(--fw-semi);
}
.btn.gate-ok:hover { filter: brightness(1.06); }

/* Refuser reste une décision, pas une action ordinaire : contour rouge. */
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); font-weight: var(--fw-semi); }
.btn.danger:hover { background: var(--bad-surface); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Croix et petites commandes : 44 × 44 réels, glyphe discret. */
.btn-icon {
  font: inherit; font-size: 20px; line-height: 1;
  width: var(--tap-min); height: var(--tap-min);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  flex: none;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
/* Variante serrée : 44 × 44 garantis, la surface tactile déborde sur les
   marges négatives sans pousser la ligne. */
.btn-icon.inline {
  width: auto; height: auto;
  min-width: var(--tap-min); min-height: var(--tap-min);
  padding: var(--sp-3); margin: calc(var(--sp-3) * -1);
}

input, textarea, select {
  font: inherit; font-size: var(--fs-body);
  font-variant-numeric: var(--num-align);
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line-ui);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; min-height: 72px; line-height: var(--lh-body); }

label {
  display: flex; flex-direction: column; gap: var(--sp-1);
  font-size: var(--fs-sm); color: var(--text-muted);
  margin-bottom: var(--sp-4);
}
label > input, label > textarea, label > select { color: var(--text); }
.hint { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-regular); }

.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); }
.btns { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }

/* Chevron partagé par tous les blocs dépliables. */
.disclose > summary { list-style: none; cursor: pointer; }
.disclose > summary::-webkit-details-marker { display: none; }
.caret {
  flex: none; width: 8px; height: 8px; margin-left: var(--sp-1);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--dur-fast) var(--ease);
}
.disclose[open] > summary .caret { transform: translateY(2px) rotate(-135deg); }


/* =========================================================================
   4. EN-TÊTE
   ========================================================================= */

.top { padding: var(--sp-6) 0 var(--sp-2); }
.top-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4) var(--sp-6); flex-wrap: wrap;
}
.brand { display: flex; gap: var(--sp-3); align-items: flex-start; min-width: 0; }
.brand-text { min-width: 0; }
.logo { flex: none; color: var(--text); margin-top: var(--sp-1); }   /* jamais en ambre */

/* Le nom du produit ne dit rien à personne : il reste une mention d'identité,
   en petit et en gris. Ce n'est pas lui qu'on doit lire en premier. */
.brand-name {
  font-size: var(--fs-micro); font-weight: var(--fw-semi);
  line-height: var(--lh-ui); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
}

/* La phrase la plus importante de la page : c'est elle qui domine l'écran. */
.tagline {
  margin-top: var(--sp-2);
  font-size: var(--fs-lead); font-weight: var(--fw-semi);
  line-height: var(--lh-head); letter-spacing: var(--tracking-tight);
  color: var(--text);
  max-width: var(--measure);
}
.tagline-short { display: none; }

.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --- Panneau « Comment ça marche » ------------------------------------- */
.how { margin-top: var(--sp-4); }
.how > summary {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--tap-min); padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line-ui); border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.how > summary:hover { background: var(--surface-2); }
.how-body {
  margin-top: var(--sp-3);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}
.how-body > p { max-width: var(--measure); font-size: var(--fs-body); }
.how-body > p + p { margin-top: var(--sp-3); }
.how-body h3 { margin: var(--sp-6) 0 var(--sp-3); }
.how-steps { margin: 0; display: grid; gap: var(--sp-2); }
.how-steps > div { display: grid; grid-template-columns: 152px 1fr; gap: var(--sp-1) var(--sp-4); }
.how-steps dt { font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.how-steps dd { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
@media (max-width: 560px) {
  .how-steps > div { grid-template-columns: 1fr; }
}


/* =========================================================================
   5. INDICATEURS
   ========================================================================= */

/* minmax(min(…), 1fr) : la piste se laisse rétrécir sous 152px plutôt que
   de pousser la page en largeur sur un petit téléphone. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(152px, 100%), 1fr)); gap: var(--sp-3); }
.kpi, .kpi > summary { min-width: 0; }

.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.kpi > summary {
  list-style: none; cursor: pointer; position: relative;
  min-height: var(--tap-min); padding: var(--sp-3) var(--sp-6) var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
}
.kpi > summary::-webkit-details-marker { display: none; }
.kpi > summary:hover .kpi-q { color: var(--text); }
.kpi-v { display: block; font-size: var(--fs-xl); font-weight: var(--fw-bold); line-height: 1.15; letter-spacing: var(--tracking-tight); }
.kpi.range .kpi-v { font-size: var(--fs-h2); line-height: var(--lh-head); }
.kpi-l { display: block; margin-top: var(--sp-1); font-size: var(--fs-sm); color: var(--text-muted); }
.kpi-sub { display: block; margin-top: var(--sp-1); font-size: var(--fs-xs); color: var(--text-muted); }
.kpi-q {
  position: absolute; top: var(--sp-3); right: var(--sp-3);
  font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--text-muted);
}
.kpi-why {
  margin: 0; padding: 0 var(--sp-4) var(--sp-4);
  font-size: var(--fs-sm); color: var(--text-muted); max-width: var(--measure);
}

/* Aucun indicateur ne porte l'ambre : le compte de ce qui attend une décision
   est écrit une seule fois, dans le bandeau. Deux fois, il ne compte plus. */

.note { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); max-width: var(--measure); }


/* =========================================================================
   6. LE BANDEAU DE DÉCISION
   Seule zone colorée de la page, isolée par --sp-6 au-dessus et en dessous.
   ========================================================================= */

.gate-banner {
  margin: var(--sp-6) 0;
  background: var(--gate-surface);
  border: 1px solid var(--gate-line);
  border-left-width: 4px;
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-1);
}
.gate-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); }
.gate-title {
  font-size: var(--fs-h2); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  color: var(--gate);
}
.gate-count {
  font-size: var(--fs-display); font-weight: var(--fw-bold);
  line-height: var(--lh-tight); letter-spacing: var(--tracking-tight);
  color: var(--gate);
}
.gate-lead { margin-top: var(--sp-3); max-width: var(--measure); }
.gate-lead b { font-weight: var(--fw-semi); }
/* minmax(0, 1fr) : sans cela, une carte au contenu insécable élargit la piste
   et c'est la page entière qui se met à défiler de côté. */
.gate-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); margin-top: var(--sp-4); }

/* Rien ne vous attend : même place, même taille, MÊME bordure ambre et même
   titre en ambre. On doit reconnaître ce lieu avant d'en avoir besoin ; un
   bandeau qui change de couleur à zéro n'apprend rien. Seuls le fond et le
   texte d'accompagnement s'apaisent. */
.gate-banner.calm { background: var(--surface); }
.gate-banner.calm .gate-count { color: var(--text-muted); }


/* =========================================================================
   7. SECTIONS ET CARTES
   ========================================================================= */

.sec { margin-top: var(--sp-6); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.sec-count { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; }
.sec-sub { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); max-width: var(--measure); }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); margin-top: var(--sp-4); }

.card {
  display: block; width: 100%; min-width: 0; text-align: left;
  font: inherit; font-variant-numeric: var(--num-align);
  color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.card:hover { border-color: var(--line-ui); }

/* La carte d'exemple, quand il n'y a encore rien : elle montre la forme d'une
   piste sans jamais se faire passer pour une. Elle ne s'ouvre pas. */
.card.example {
  cursor: default; box-shadow: none;
  background: var(--surface-2);
  border-style: dashed; border-color: var(--line-ui);
}
.card.example:hover { border-color: var(--line-ui); }
.example-flag {
  display: block; margin-bottom: var(--sp-2);
  font-size: var(--fs-micro); font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  color: var(--text-muted);
}

/* Au téléphone, la pastille d'étape passe à la ligne plutôt que d'élargir la carte. */
.card-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-2) var(--sp-3); }
.card-t { flex: 1 1 auto; min-width: 0; font-size: var(--fs-h3); font-weight: var(--fw-semi); }
.card-m {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-2); min-width: 0; font-size: var(--fs-xs); color: var(--text-muted);
}
.card-m .val { font-weight: var(--fw-semi); color: var(--text); }
.card-tags { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-top: var(--sp-2); }

.pill {
  flex: none; display: inline-block; white-space: nowrap;
  font-size: var(--fs-micro); font-weight: var(--fw-bold); line-height: var(--lh-ui);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-muted);
}
.pill.gate { background: var(--gate-surface); color: var(--gate); box-shadow: inset 0 0 0 1px var(--gate-line); }
.pill.ok   { background: var(--ok-surface);   color: var(--ok); }
.pill.bad  { background: var(--bad-surface);  color: var(--bad); }

.tag {
  font-size: var(--fs-xs); font-weight: var(--fw-regular);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-muted);
}

/* Jauge de confiance : le chiffre est toujours écrit à côté. */
.conf { display: inline-block; width: 48px; height: 6px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; vertical-align: middle; }
.conf > i { display: block; height: 100%; background: var(--accent); }

/* Section « Clôturées », repliée par défaut. */
.arch { margin-top: var(--sp-6); }
.arch > summary {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--tap-min); padding: var(--sp-2) 0;
  font-size: var(--fs-h2); font-weight: var(--fw-semi); color: var(--text-muted);
}
.arch > summary:hover { color: var(--text); }

/* --- États vides -------------------------------------------------------- */
.empty {
  border: 1px dashed var(--line-ui); border-radius: var(--r-md);
  padding: var(--sp-5); font-size: var(--fs-sm); color: var(--text-muted);
  max-width: var(--measure);
}
.empty p + p { margin-top: var(--sp-3); }
.empty .btns { margin-top: var(--sp-4); }
.empty-lead { color: var(--text); font-size: var(--fs-body); }

/* Le pied de page porte la phrase de garantie ET les gestes rares : sauvegarde
   et déconnexion. En haut, ils faisaient concurrence à la seule action utile. */
.foot {
  margin-top: var(--sp-8); padding: var(--sp-5) 0 var(--sp-8);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm); color: var(--text-muted);
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--sp-4);
}
.foot-line { flex: 1 1 320px; max-width: var(--measure); }
.foot-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }


/* =========================================================================
   8. TIROIR DE DÉTAIL
   ========================================================================= */

.backdrop { position: fixed; inset: 0; background: rgba(9, 12, 17, .48); z-index: 9; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(680px, 100vw);
  background: var(--bg); color: var(--text);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  z-index: 10; display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.drawer-head-text { min-width: 0; }
.drawer-head h2 { margin-top: var(--sp-2); }
/* L'explication de l'étape, écrite : un survol n'existe ni au doigt ni au clavier. */
.drawer-head .d-stage-help { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); max-width: var(--measure); }
.drawer-head .d-meta { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.drawer-body { overflow: auto; padding: var(--sp-4) var(--sp-5) var(--sp-8); }

.step {
  background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.step > h4 { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.step > h4 .muted { font-weight: var(--fw-regular); }
.step.done    { border-left-color: var(--ok); }
.step.current { border-left-color: var(--accent); }
/* Une étape pas encore atteinte se distingue par son fond et son trait, jamais
   en diluant le texte : ce qui est écrit là doit rester lisible. */
.step.locked  { border-left-color: var(--line); background: var(--surface-2); }
.step.locked > h4 { color: var(--text-muted); }
/* La porte, dans le tiroir : même ambre, même exclusivité. */
.step.gate-box { background: var(--gate-surface); border-color: var(--gate-line); border-left-color: var(--gate); }
.step.gate-box > h4 { color: var(--gate); }
.step.closed-box { background: var(--bad-surface); border-color: var(--bad); border-left-color: var(--bad); }
.step.closed-box > h4 { color: var(--bad); }

.step p + p, .step p + .btns, .step p + form, .step dl + p, .step ul + p, .step p + ul { margin-top: var(--sp-3); }
.step > details { margin-top: var(--sp-3); }
.step > details > summary {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: var(--tap-min); padding: var(--sp-2) var(--sp-3);
  margin-left: calc(var(--sp-3) * -1);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--accent);
  border-radius: var(--r-sm); cursor: pointer; list-style: none;
}
.step > details > summary::-webkit-details-marker { display: none; }
.step > details > summary:hover { background: var(--surface-2); }
.step > details[open] > summary { margin-bottom: var(--sp-2); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-1) var(--sp-4); font-size: var(--fs-sm); margin: var(--sp-2) 0 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }

table.sc { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); margin-top: var(--sp-3); }
table.sc th, table.sc td { text-align: right; padding: var(--sp-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.sc th { color: var(--text-muted); font-weight: var(--fw-medium); }
table.sc th:first-child, table.sc td:first-child { text-align: left; }

ul.ev, ol.plain, ul.plain { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); }
ol.plain, ul.plain { padding-left: var(--sp-5); }
ul.ev { list-style: none; padding-left: 0; }
ul.ev li { display: flex; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
ul.ev li:last-child { border-bottom: 0; }
ul.ev .ev-txt { flex: 1 1 auto; min-width: 0; }
ol.plain li, ul.plain li { margin-bottom: var(--sp-1); }
.strength { font-size: var(--fs-micro); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.s-weak     { color: var(--proof-weak); }
.s-moderate { color: var(--proof-moderate); }
.s-strong   { color: var(--proof-strong); }

/* Le journal : un creux de lecture, aucun contrôle bordé dedans. */
.audit { background: var(--surface-3); border-radius: var(--r-sm); padding: var(--sp-3); margin-top: var(--sp-2); max-height: 260px; overflow: auto; }
.audit ul { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.audit li { padding: var(--sp-1) 0; }
.audit b { color: var(--text); font-weight: var(--fw-semi); }

.assist { font-size: var(--fs-sm); background: var(--surface-2); border-radius: var(--r-sm); padding: var(--sp-3); margin-top: var(--sp-3); white-space: pre-wrap; }
.assist-note { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-muted); }


/* =========================================================================
   9. BOÎTES DE DIALOGUE, MESSAGE PASSAGER
   ========================================================================= */

dialog {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: var(--sp-5); width: min(600px, calc(100vw - 2 * var(--gutter)));
  background: var(--surface); color: var(--text);
  font-family: var(--font-sans); font-size: var(--fs-body);
}
dialog::backdrop { background: rgba(9, 12, 17, .5); }
dialog h3 { margin-bottom: var(--sp-2); font-size: var(--fs-h2); }
dialog .lead { margin-bottom: var(--sp-4); max-width: var(--measure); font-size: var(--fs-sm); color: var(--text-muted); }
/* <menu> n'accepte que des <li> ; display:contents remet les boutons dans la
   rangée sans ajouter de puce ni de niveau visuel. */
menu { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: 0; margin: var(--sp-4) 0 0; list-style: none; }
menu > li { display: contents; }

.cand { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-3); margin-top: var(--sp-3); font-size: var(--fs-sm); }
.cand b { display: block; margin-bottom: var(--sp-1); font-size: var(--fs-h3); }

.toast {
  position: fixed; left: 50%; bottom: var(--sp-5); transform: translateX(-50%);
  max-width: calc(100vw - 2 * var(--gutter));
  background: var(--text); color: var(--bg);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  font-size: var(--fs-sm); z-index: 20; box-shadow: var(--shadow-2);
}
/* En sombre, --bad est un saumon clair : du blanc dessus serait illisible.
   L'encre suit donc le mode, elle n'est jamais écrite en dur. */
.toast.err { background: var(--bad); color: var(--bad-ink); }


/* =========================================================================
   10. PAGE DE CONNEXION
   Première impression : même identité, même phrase, même logo.
   ========================================================================= */

body.login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: var(--sp-6) var(--gutter); }
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  padding: var(--sp-6); width: min(420px, 100%);
}
.login-card .brand { align-items: center; }
.login-card .logo { color: var(--accent); margin-top: 0; }
/* Ici aussi, la phrase passe devant le nom : elle se lit en --text, au-dessus
   de la taille du corps. Le nom reste la petite mention grise de .brand-name. */
.login-card .tagline {
  margin-top: var(--sp-4);
  font-size: var(--fs-h2); font-weight: var(--fw-semi);
  line-height: var(--lh-head); color: var(--text);
}
.login-card form { margin-top: var(--sp-6); }
.login-card .btns button { width: 100%; }
.login-card .msg { margin-top: var(--sp-4); font-size: var(--fs-sm); }
/* La phrase de garantie se lit à la taille du corps : c'est la mention la plus
   importante de l'écran, elle n'a rien à faire en petits caractères. */
.login-card .note { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-body); color: var(--text-muted); }


/* =========================================================================
   11. TÉLÉPHONE
   À 380 px : tout reste lisible, rien ne déborde, aucun geste horizontal.
   ========================================================================= */

/* Les téléphones courants font 390, 412, 414 ou 430 px de large : un seuil à
   400 px laissait la phrase longue s'étaler sur cinq ou six lignes et manger
   l'écran. Sous 560 px, c'est la version courte qui s'affiche. */
@media (max-width: 560px) {
  .tagline-long  { display: none; }
  .tagline-short { display: inline; }
}

@media (max-width: 640px) {
  .drawer { width: 100vw; border-left: 0; }
  .drawer-head, .drawer-body { padding-left: var(--gutter); padding-right: var(--gutter); }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 140px; }
  .gate-banner { padding: var(--sp-4); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}
