/*
 * Compte Ciblup (ciblup.com) : socle des pages. Charger /css/tokens.css PUIS /css/base.css.
 * Aucune valeur brute ici (tout vient de tokens.css) ; aucun style ni script en ligne (CSP style-src 'self').
 *
 * ============================== CONTRAT (Jerry, Tim : balisage attendu) ==============================
 *
 * GABARIT UNIQUE (run 2) : fond --bg blanc, une carte --bg (bord --line, ombre --shadow-card, rayon --r-xl) centrée, le pied légal collé dessous. Jour seulement.
 *  La classe de <body> ne change que la largeur de la carte et son en-tête.
 *  body.l-card   Déconnecté (accueil, connexion, inscription, 404…) : carte de --card-w (400).
 *      <body class="l-card">
 *        <main class="card" id="main"> … </main>
 *        <footer class="legal" aria-label="Liens légaux et contact"> … </footer>
 *  body.l-shell  Connecté (/account, /account/security, /account/link) : carte de --shell-w (560) ; en tête le logo et
 *                « Se déconnecter » (discret, à droite), puis une rangée de 3 onglets.
 *      <body class="l-shell">
 *        <a class="skip" href="#main">Aller au contenu</a>
 *        <div class="sheet sheet-shell">
 *          <header class="shell-head">
 *            <a class="brand" href="/account"><img class="logo" …></a>
 *            <nav class="nav" aria-label="Compte"><ul>
 *              <li><a class="nav-item" href="/account" aria-current="page">Mon compte</a></li>
 *              <li><a class="nav-item" href="/account/security">Double authentification</a></li>
 *              <li><a class="nav-item" href="/account/link">Relier un Mac</a></li>
 *            </ul></nav>
 *            <button class="nav-out" type="button" data-logout>Se déconnecter</button>   (site.js le branche)
 *          </header>
 *          <main class="page" id="main"> … </main>
 *        </div>
 *        <footer class="legal" aria-label="Liens légaux et contact"> … </footer>
 *      Mise en place de la double auth : ajouter hidden sur <nav class="nav">, « Se déconnecter » reste.
 *  body.l-doc    Pages légales : carte de --doc-w (720) = <div class="sheet sheet-doc"><header class="doc-head">logo</header>
 *                <main class="doc"> .doc-title (h1 + .lead), details.toc (sommaire replié en tête), .prose (h2 avec id) </main></div>.
 *
 * LOGO ET CHARLIE (jour seulement : une <img>, sans <picture> ni <source>)
 *  <img class="logo" src="/logo-clair.svg" alt="Ciblup" width="640" height="200">
 *  <p class="charlie"><img class="charlie-head" src="/img/charlie-clair.svg" alt="" width="256" height="256">
 *    <span>Une phrase d'état.</span></p>
 *
 * TITRES ET TEXTE : h1 (28), h2 (22), p ; .lead (texte secondaire --mute) ; .help (aide 13 px --faint) ; .tabular (chiffres).
 *
 * BOUTONS (hauteur 44 px, rayon 8)
 *  .btn                    discret (fond --bg, bord --line-strong)
 *  .btn.btn-primary        plein, un seul par écran
 *  .btn.btn-danger         destructif discret ; .btn.btn-danger.is-armed = second clic, plein --danger
 *  .btn-link               lien en forme de bouton (souligné, sans cadre), 44 px de haut
 *  États : :hover, :focus-visible (un anneau), :active (appui), :disabled ou [aria-disabled="true"] (inactif lisible),
 *          [aria-busy="true"] (occupé : libellé gardé + anneau qui tourne à gauche ; posé par busy() de site.js).
 *  .actions                pile de boutons de même largeur dans une carte (row à partir de 480 px avec .actions-row)
 *  .link-row               ligne sous la carte : « Pas encore de compte ? <a>Créer un compte</a> »
 *
 * CHAMPS
 *  <form class="form" novalidate>
 *    <div class="field">
 *      <div class="field-head"><label for="pw">Mot de passe</label><a class="field-link" href="/login/forgot">Mot de passe oublié ?</a></div>
 *      <div class="input-wrap"><input class="input" id="pw" type="password" aria-describedby="pw-err">
 *        <button class="input-toggle" type="button" aria-label="Afficher le mot de passe">Afficher</button></div>
 *      <p class="field-help" id="pw-help">12 caractères au moins.</p>
 *      <p class="field-error" id="pw-err"></p>      (vide = sans hauteur ; remplir + aria-invalid="true" sur l'input)
 *    </div>
 *  </form>
 *  .input.input-code : saisie d'un code (chasse fixe, majuscules). .check : case + libellé (44 px).
 *
 * LIGNES D'ÉTAT : <p class="status" role="status" id="status"></p> et, pour une erreur de page, role="alert".
 *  Le role est écrit dans le HTML, jamais changé ensuite. Écrire avec say(el, texte, 'info' | 'success' | 'error').
 *  Vide = aucune hauteur. Erreur = texte --danger sur --danger-bg + icône (ajoutée par say()).
 *
 * CARTE : .card (fond --bg, trait --line, rayon --r-xl, ombre --shadow-card ; Charlie dépasse si data-charlie, voir motion.css) ; .card-section pour un bloc séparé par un trait.
 * PASTILLE DE LICENCE : <span class="pill" data-tone="active|renew|ended|none"><span class="pill-dot"></span>Active</span>
 * ÉTAPES (nouveau client ; segments remplis en --iri, qui glissent à l'arrivée) :
 *  <div class="steps"><p class="steps-label">Étape 2 sur 4 · Confirmer l'e-mail</p>
 *    <div class="steps-bar" data-step="2" aria-hidden="true"><span></span><span></span><span></span><span></span></div></div>
 * ÉTAPES ORDONNÉES (/account/link, appli de codes) : <ol class="frame-steps"><li>…</li></ol>
 * CODES : <code class="code">ABCD-EFGH</code> ; codes de secours <ul class="codes"><li><code class="code">…</code></li></ul> ;
 *  QR : <div class="qr"><svg>…</svg></div> (fond --paper, encre --paper-ink).
 * LISTE À LIGNES FINES : <ul class="list"><li class="list-row"><div><p class="list-title">Nom</p><p class="list-meta">…</p></div>
 *  <button class="btn btn-danger">Retirer ce Mac</button></li></ul>
 * CONFIRMATION EN LIGNE (pas de confirm()) : <div class="confirm" inert><div class="confirm-inner">
 *  <p class="confirm-q">Retirer « Mac de Léa » ?</p><div class="confirm-actions"><button class="btn btn-danger is-armed">Retirer</button>
 *  <button class="btn">Annuler</button></div></div></div>  → ouvrir : ajouter .is-open et retirer inert (200 ms en hauteur).
 * PIED : <footer class="legal" aria-label="Liens légaux et contact"><ul>
 *  <li><a href="/terms">CGV</a></li><li><a href="/legal">Mentions légales</a></li><li><a href="/privacy">Confidentialité</a></li>
 *  <li><a href="mailto:hello@ciblup.com">hello@ciblup.com</a></li></ul></footer>
 * ICÔNE : <svg class="icon" viewBox="0 0 16 16" aria-hidden="true"> au trait, currentColor, 16 px.
 * ======================================================================================================
 */

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-lg);
  line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  caret-color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--act); color: var(--onact); }

h1, h2, h3, p, ul, ol, figure { margin: 0; }
h1 {
  font-family: var(--font-display);
  font-size: var(--text-title);
  font-weight: var(--w-display);
  letter-spacing: var(--tracking-title);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--w-display);
  letter-spacing: var(--tracking-title);
  line-height: var(--lh-tight);
  text-wrap: balance;
}
h3 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--w-display); line-height: var(--lh-tight); }
p { text-wrap: pretty; }
strong, b { font-weight: var(--w-strong); }
img, svg { display: block; max-width: 100%; }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  border-radius: var(--r-xs);
}
a:hover { text-decoration-thickness: 2px; }

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

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Lien d'évitement (« Aller au contenu ») : 1er arrêt Tab des pages l-shell et l-doc, hors flux (ne décale
   pas la carte), caché tant qu'il n'a pas le focus. Même allure qu'un bouton discret. */
.skip {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  padding: 0 var(--sp-4);
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  font-size: var(--text-md);
  font-weight: var(--w-strong);
  text-decoration: none;
}
.skip:not(:focus) {
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* Cible du lien d'évitement : reçoit le focus sans montrer d'anneau (ce n'est pas une commande). */
main[tabindex="-1"]:focus-visible { outline: none; }

.lead { color: var(--mute); }
.help { font-size: var(--text-sm); color: var(--faint); }
.tabular, time { font-variant-numeric: tabular-nums; }

.icon {
  flex: none;
  width: var(--icon);
  height: var(--icon);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Logo et Charlie */
.logo { height: var(--sp-8); width: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  border-radius: var(--r-control);
}

.charlie {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--ink);
}
/* Tête de 28 px ; le dessin a une marge dans son cadre : on la reprend pour aligner le chat sur le texte. */
.charlie-head { width: calc(var(--sp-6) + var(--sp-1)); height: calc(var(--sp-6) + var(--sp-1)); flex: none; margin-left: calc(var(--sp-1) * -1); }
.charlie span { min-width: 0; }

/* ---------- Mouvement : une seule arrivée, au chargement ---------- */

/* Part d'un état déjà lisible : si l'animation ne tourne pas (onglet en arrière-plan), le contenu reste visible. */
@keyframes arrive {
  from { opacity: 0.6; transform: translateY(var(--sp-1)); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Gabarit unique : une carte centrée sur --side ---------- */

/* Les trois gabarits partagent la mise en page : la carte et le pied légal collé dessous forment un bloc centré
   dans la hauteur et la largeur de la fenêtre ; une carte plus haute que l'écran part du haut (marge --sp-12).
   Seule la largeur de la carte change. */
.l-card, .l-shell, .l-doc {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-4) var(--sp-6);
}

.card, .sheet {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-card);
  padding: var(--sp-10);
}
.l-card > .card, .sheet {
  margin-top: auto;
  animation: arrive var(--dur) var(--ease) both;
}
.l-card > .card { max-width: var(--card-w); }
.sheet-shell { max-width: var(--shell-w); }
.sheet-doc { max-width: var(--doc-w); }
/* Le pied reste collé sous la carte. */
.l-card > .legal, .l-shell > .legal, .l-doc > .legal { margin-bottom: auto; }

/* Rythme vertical dans une carte ou une page : plus d'air au-dessus d'un titre qu'en dessous. */
.card > * + *,
.page > * + *,
.card-section > * + * { margin-top: var(--sp-4); }
.card > .logo, .card > .brand { margin-bottom: var(--sp-4); }
.card > h1 + *, .page > h1 + * { margin-top: var(--sp-3); }
.card > * + h2, .page > * + h2, .page > * + section, .card > * + .card-section { margin-top: var(--sp-8); }
.card > * + .actions, .card > * + .form, .page > * + .actions { margin-top: var(--sp-6); }

.card-section {
  border-top: 1px solid var(--line);
  padding-top: var(--sp-6);
}

.link-row {
  font-size: var(--text-md);
  color: var(--mute);
  text-align: center;
}
.card > .link-row {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line);
}

/* ---------- Pages connectées : en-tête de la carte (logo, Se déconnecter, 3 onglets) ---------- */

.shell-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-4) var(--sp-3);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.shell-head .brand { justify-self: start; }
.nav { grid-column: 1 / -1; grid-row: 2; }
.nav-out { grid-column: 2; grid-row: 1; }

/* Trois onglets sur une ligne, même hauteur ; largeur selon le libellé, l'espace restant partagé. */
.nav ul { list-style: none; padding: 0; display: flex; gap: var(--sp-1); }
.nav li { flex: 1 1 auto; display: flex; }
.nav-item,
.nav-out {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-md);
  line-height: var(--lh-tight);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}
.nav-item { position: relative; width: 100%; white-space: nowrap; }
.nav-item:hover, .nav-out:hover { background: var(--hover); }
.nav-item[aria-current="page"] { background: var(--side); font-weight: var(--w-strong); }
/* Onglet courant : un trait irisé court sous le libellé (le spectre reste une touche). */
.nav-item[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: var(--sp-1);
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--iri);
}
.nav-out { color: var(--mute); }
.nav-out:hover { color: var(--ink); }
.nav-out[aria-busy="true"] { cursor: progress; }

.page { width: 100%; }
.shell-head + .page { margin-top: var(--sp-6); }

/* ---------- Pages légales : texte dans une carte de 720 px, sommaire replié en tête ---------- */

.doc-head { padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.doc-head .brand { justify-self: start; }
.doc { width: 100%; margin-top: var(--sp-6); }
.doc-title > * + * { margin-top: var(--sp-2); }
.prose { max-width: 70ch; margin-top: var(--sp-8); }
.prose > * + * { margin-top: var(--sp-4); }
.prose > * + h2 { margin-top: var(--sp-10); }
.prose h2 { font-size: var(--text-xl); scroll-margin-top: var(--sp-6); }
.prose ul, .prose ol { padding-left: var(--sp-6); }
.prose li + li { margin-top: var(--sp-2); }
.prose .todo { background: var(--danger-bg); color: var(--danger); border-radius: var(--r-xs); padding: 0 var(--sp-1); }

.toc { margin-top: var(--sp-6); padding-top: var(--sp-1); border: 1px solid var(--line); border-radius: var(--r-control); }
.toc > summary {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--hit);
  padding: 0 var(--sp-3);
  font-size: var(--text-md);
  font-weight: var(--w-strong);
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-control);
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary .icon { transition: transform var(--dur-fast) var(--ease); }
.toc[open] > summary .icon { transform: rotate(90deg); }
.toc ol { list-style: none; padding: 0 0 var(--sp-2); counter-reset: none; }
.toc a {
  display: flex;
  align-items: center;
  min-height: var(--hit);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-md);
  line-height: var(--lh-tight);
  color: var(--mute);
  text-decoration: none;
}
.toc a:hover { color: var(--ink); background: var(--hover); }

/* ---------- Boutons ---------- */

.btn,
.btn-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--hit);
  font: inherit;
  font-size: var(--text-lg);
  line-height: var(--lh-tight);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn {
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--bg);
  color: var(--ink);
  font-weight: var(--w-strong);
}
.btn:hover { background: var(--hover); }
.btn:active { background: var(--sel); transform: scale(0.98); }

.btn-primary { background: var(--act); border-color: var(--act); color: var(--onact); }
.btn-primary:hover { background: var(--act-hover); border-color: var(--act-hover); }
.btn-primary:active { background: var(--act); border-color: var(--act); }

.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger.is-armed { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.btn-danger.is-armed:hover, .btn-danger.is-armed:active { background: var(--danger); }

.btn-link {
  padding: var(--sp-2) 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: var(--w-regular);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  border-radius: var(--r-control);
}
.btn-link:hover { text-decoration-thickness: 2px; }

.btn:disabled,
.btn[aria-disabled="true"],
.btn-link:disabled,
.btn-link[aria-disabled="true"] {
  background: var(--side);
  border-color: var(--line);
  color: var(--faint);
  cursor: not-allowed;
  transform: none;
}
.btn-link:disabled, .btn-link[aria-disabled="true"] { background: none; text-decoration: none; }

/* Occupé : le bouton garde son apparence et son libellé ; un petit anneau tourne à gauche. */
.btn[aria-busy="true"],
.btn[aria-busy="true"]:disabled {
  cursor: progress;
  transform: none;
}
.btn-primary[aria-busy="true"]:disabled { background: var(--act); border-color: var(--act); color: var(--onact); }
.btn:not(.btn-primary)[aria-busy="true"]:disabled { background: var(--bg); border-color: var(--line-strong); color: var(--ink); }
.btn[aria-busy="true"]::before,
.nav-out[aria-busy="true"]::before {
  content: "";
  flex: none;
  width: var(--sp-4);
  height: var(--sp-4);
  border: var(--ring-w) solid currentColor;
  border-right-color: transparent;
  border-radius: var(--r-pill);
  margin-right: var(--sp-1);
  animation: spin calc(var(--dur) * 4) linear infinite;
}

.actions { display: grid; gap: var(--sp-3); }
.actions > .btn { width: 100%; }
@media (min-width: 480px) {
  .actions-row { display: flex; flex-wrap: wrap; }
  .actions-row > .btn { width: auto; }
}

/* ---------- Champs ---------- */

.form { display: grid; gap: var(--sp-5); }
.form > .btn-primary { width: 100%; }
.field { display: grid; gap: var(--sp-2); }
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}
.field label,
.field-label {
  font-size: var(--text-md);
  font-weight: var(--w-medium);
  line-height: var(--lh-body);
}
.field-link {
  font-size: var(--text-md);
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  margin: calc((var(--hit) - var(--text-md) * var(--lh-body)) / -2) 0;
}
.field-help { font-size: var(--text-sm); color: var(--faint); }
.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--text-md);
  color: var(--danger);
}
.field-error:empty, .field-help:empty { display: none; }
.field-error .icon { margin-top: calc((var(--text-md) * var(--lh-body) - var(--icon)) / 2); }

.input {
  width: 100%;
  min-height: var(--hit);
  padding: 0 var(--sp-3);
  font: inherit;
  font-size: var(--text-lg);
  color: var(--ink);
  background: var(--side);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--faint); opacity: 1; }
.input:hover { border-color: var(--ink); }
.input:focus-visible {
  border-color: var(--focus);
  background: var(--bg);
  /* Un seul anneau encre net collé au bord (pas d'espace blanc entre deux traits) : 3 px d'encre au total, contraste 18:1. */
  outline: 2px solid var(--focus);
  outline-offset: 0;
}
.input[aria-invalid="true"] { border-color: var(--danger); background: var(--bg); }
.input:disabled { background: var(--side); color: var(--faint); border-color: var(--line); cursor: not-allowed; opacity: 0.7; }
.input-code {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-code);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}

.input-wrap { position: relative; }
.input-wrap > .input { padding-right: calc(var(--sp-12) * 2); }
.input-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-height: var(--hit);
  min-width: var(--hit);
  padding: 0 var(--sp-3);
  border: 0;
  background: none;
  color: var(--mute);
  font: inherit;
  font-size: var(--text-md);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  border-radius: var(--r-control);
  cursor: pointer;
}
.input-toggle:hover { color: var(--ink); }

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-height: var(--hit);
  padding: var(--sp-2) 0;
  font-size: var(--text-md);
  color: var(--ink);
  cursor: pointer;
}
.check input {
  flex: none;
  width: var(--sp-5);
  height: var(--sp-5);
  margin: 0;
  accent-color: var(--act);
}

/* ---------- Ligne d'état ---------- */

.status {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--text-md);
  color: var(--ink);
}
.status:empty { display: none; }
.status[data-kind="error"], .status.error {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--r-control);
  padding: var(--sp-2) var(--sp-3);
}
.status .icon { margin-top: calc((var(--text-md) * var(--lh-body) - var(--icon)) / 2); }

/* ---------- Pastille de licence ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--text-md);
  color: var(--ink);
  background: var(--tn-idle-bg);
}
.pill-dot {
  width: var(--sp-2);
  height: var(--sp-2);
  border-radius: var(--r-pill);
  border: 1px solid var(--line-strong);
  background: var(--tn-idle);
}
.pill[data-tone="active"] { background: var(--tn-reply-bg); }
.pill[data-tone="active"] .pill-dot { background: var(--tn-reply); }
.pill[data-tone="renew"] { background: var(--tn-attention-bg); }
.pill[data-tone="renew"] .pill-dot { background: var(--tn-attention); }
.pill[data-tone="ended"] { background: var(--tn-stop-bg); }
.pill[data-tone="ended"] .pill-dot { background: var(--tn-stop); }

/* ---------- Étapes ---------- */

.steps { display: grid; gap: var(--sp-2); }
.steps-label { font-size: var(--text-md); color: var(--mute); }
.steps-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-1); }
.steps-bar > span {
  position: relative;
  height: var(--sp-1);
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--line-2);
}
/* Segment rempli : le spectre irisé entre depuis la gauche, un segment après l'autre. */
.steps-bar > span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--iri);
  transform: scaleX(0);
  transform-origin: left center;
}
.steps-bar[data-step="1"] > span:nth-child(-n+1)::after,
.steps-bar[data-step="2"] > span:nth-child(-n+2)::after,
.steps-bar[data-step="3"] > span:nth-child(-n+3)::after,
.steps-bar[data-step="4"] > span:nth-child(-n+4)::after {
  transform: scaleX(1);
  animation: steps-fill calc(var(--dur) * 2) var(--ease) both;
}
.steps-bar[data-step] > span:nth-child(2)::after { animation-delay: calc(var(--dur) * 0.6); }
.steps-bar[data-step] > span:nth-child(3)::after { animation-delay: calc(var(--dur) * 1.2); }
.steps-bar[data-step] > span:nth-child(4)::after { animation-delay: calc(var(--dur) * 1.8); }
@keyframes steps-fill {
  from { transform: scaleX(0); }
}

.frame-steps {
  list-style: decimal;
  padding: var(--sp-4) var(--sp-5) var(--sp-4) calc(var(--sp-5) + var(--sp-5));
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  display: grid;
  gap: var(--sp-3);
}
.frame-steps li::marker { color: var(--mute); font-variant-numeric: tabular-nums; }

/* ---------- Codes ---------- */

.code {
  display: inline-block;
  padding: var(--sp-1) var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  letter-spacing: var(--tracking-code);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--side);
  border-radius: var(--r-control);
  overflow-wrap: anywhere;
}
.codes {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}
.codes .code { display: block; text-align: center; padding: var(--sp-2); }
.qr {
  width: fit-content;
  padding: var(--sp-2);
  background: var(--paper);
  border-radius: var(--r-control);
}
.qr svg { width: calc(var(--sp-12) * 4); height: auto; }
.qr path, .qr rect { fill: var(--paper-ink); }
.qr svg > rect:first-child { fill: var(--paper); }

/* ---------- Liste à lignes fines ---------- */

.list { list-style: none; padding: 0; border-top: 1px solid var(--line); }
.list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--line);
}
.list-row > :first-child { min-width: 0; flex: 1 1 12rem; }
.list-title { font-size: var(--text-lg); overflow-wrap: anywhere; }
.list-meta { font-size: var(--text-md); color: var(--mute); font-variant-numeric: tabular-nums; }
.list-row > .confirm { flex-basis: 100%; }

/* ---------- Confirmation en ligne ---------- */

.confirm {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur) var(--ease);
}
.confirm.is-open { grid-template-rows: 1fr; }
.confirm-inner { min-height: 0; overflow: hidden; }
.confirm.is-open .confirm-inner { padding-top: var(--sp-3); }
.confirm-q { font-size: var(--text-md); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }

/* ---------- Pied légal ---------- */

.legal { width: 100%; display: flex; justify-content: center; }
.legal ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* Chaque lien porte sa marge (--sp-2 de chaque côté, cible ≥ 44 px de large même pour « CGV ») ; la liste la
     reprend sur ses bords pour que le premier mot reste aligné sur la colonne. Écart visible entre deux mots : --sp-4. */
  margin-inline: calc(var(--sp-2) * -1);
}
.legal a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--hit);
  min-height: var(--hit);
  padding: 0 var(--sp-2);
  font-size: var(--text-sm);
  color: var(--mute);
}
.legal a:hover { color: var(--ink); }

/* ---------- 390 ---------- */

@media (max-width: 479px) {
  .l-card, .l-shell, .l-doc { padding: var(--sp-6) var(--sp-4) var(--sp-4); justify-content: flex-start; }
  .l-card > .card, .sheet { margin-top: 0; }
  .card, .sheet { padding: var(--sp-6); border-radius: var(--r-card); }
  /* Les trois onglets tiennent dans 310 px : texte --text-sm, « Double authentification » passe sur deux lignes,
     les trois gardent la même hauteur. */
  .nav-item { font-size: var(--text-sm); padding-inline: var(--sp-2); }
  .nav li:nth-child(2) { flex-shrink: 1; }
  .nav li:nth-child(2) .nav-item { white-space: normal; }
  .nav li:not(:nth-child(2)) { flex-shrink: 0; }
}

/* ---------- Mouvement réduit : rien ne bouge, l'anneau d'attente reste visible et fixe ---------- */

@media (prefers-reduced-motion: reduce) {
  .card, .sheet { animation: none; }
  .steps-bar > span::after { animation: none; }
  .btn[aria-busy="true"]::before, .nav-out[aria-busy="true"]::before { animation: none; }
  .btn:active { transform: none; }
}
