/* ══════════════════════════════════════════════════════════════
   NESTONE — back-office

   Charte Nestone (version 11) : calcaire, granit, lapis ; Archivo
   Expanded pour les titres et les chiffres, Instrument Sans pour ce qui
   se lit, JetBrains Mono pour les étiquettes et les références.

   Règles suivies partout :
   1. lapis porte l'action et ce qui est en cours, rien d'autre ;
      les couleurs d'état vont toujours avec un mot.
   2. On sépare par des filets et des fonds, pas par des ombres
      (l'ombre est pour ce qui flotte : menus, fenêtres, notifications).
   3. Sept états pour tout ce qui se clique ; on n'anime que
      transform et opacity ; prefers-reduced-motion coupe les déplacements.
   ══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: "Archivo Expanded"; font-style: normal; font-weight: 100 900;
  font-display: swap; src: url("/static/fonts/ArchivoExpanded-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans"; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url("/static/fonts/InstrumentSans-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800;
  font-display: swap; src: url("/static/fonts/JetBrainsMono-Variable.woff2") format("woff2");
}

/* ── Tokens ──────────────────────────────────────────────────── */

:root {
  --calcaire: #f1f2f4; --surface: #ffffff; --pierre: #e4e7ec; --joint: #d2d6dd;
  --joint-fort: #7f8693; --granit: #161a21; --schiste: #535a66;
  --lapis: #2638c8; --lapis-profond: #1b289c; --lapis-voile: #e3e6fb; --sur-lapis: #ffffff;
  --pyrite: #c9a23a;
  --succes: #17663f; --succes-voile: #ddf2e6;
  --alerte: #8a5a00; --alerte-voile: #f8ecd2;
  --erreur: #b0232b; --erreur-voile: #fbe3e4;
  --anneau-focus: #2638c8;
  --voile-fond: rgba(22, 26, 33, 0.42);
  --ombre-pose: 0 1px 2px #161a2114, 0 1px 1px #161a210a;
  --ombre-flottante: 0 8px 24px #161a211f, 0 2px 6px #161a2114;
  --ombre-modale: 0 24px 64px #161a2133, 0 6px 16px #161a211a, 0 0 0 1px #161a210d;
  --reflet: rgba(255, 255, 255, 0.65);
  /* Icons on the granit toasts (inverted surface). */
  --toast-succes: #5fd39a; --toast-erreur: #ff8d92; --toast-info: #b1b9ff; --toast-alerte: #f0c25e;

  --font-titre: "Archivo Expanded", Archivo, "Helvetica Neue", Arial, sans-serif;
  --font-texte: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-16: 64px;
  --radius-xs: 2px; --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;

  --duree-instant: 70ms; --duree-rapide: 140ms; --duree-base: 220ms; --duree-moyenne: 340ms;
  --courbe-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --courbe-entree: cubic-bezier(0.16, 1, 0.3, 1);
  --courbe-sortie: cubic-bezier(0.4, 0, 1, 1);
  --courbe-rebond: cubic-bezier(0.34, 1.56, 0.64, 1);

  --barre: 256px;
  /* Shell rhythm: one side margin per screen size, the content capped at
     1 200 px (charte), the mobile bars' heights for what sticks or floats. */
  --marge: var(--space-8);
  --contenu-max: 1200px;
  --tete-h: 0px;
  --onglets-h: 0px;
  --sure-bas: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (max-width: 900px) { :root { --marge: var(--space-6); --tete-h: 56px; --onglets-h: 64px; } }
@media (max-width: 640px) { :root { --marge: var(--space-4); } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --calcaire: #111419; --surface: #191d24; --pierre: #222731; --joint: #2e3440;
    --joint-fort: #6f7785; --granit: #eceef2; --schiste: #a5acb8;
    --lapis: #8d99ff; --lapis-profond: #b1b9ff; --lapis-voile: #1c2252; --sur-lapis: #0d1029;
    --pyrite: #d9b657;
    --succes: #5fd39a; --succes-voile: #0f2b1d;
    --alerte: #f0c25e; --alerte-voile: #2e2108;
    --erreur: #ff8d92; --erreur-voile: #341215;
    --anneau-focus: #b1b9ff;
    --voile-fond: rgba(0, 0, 0, 0.6);
    --ombre-pose: 0 1px 2px #00000099;
    --ombre-flottante: 0 8px 28px #000000b3, 0 2px 6px #00000080;
    --ombre-modale: 0 28px 72px #000000cc, 0 6px 18px #00000099;
    --reflet: rgba(255, 255, 255, 0.06);
    --toast-succes: #17663f; --toast-erreur: #b0232b; --toast-info: #2638c8; --toast-alerte: #8a5a00;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --calcaire: #111419; --surface: #191d24; --pierre: #222731; --joint: #2e3440;
  --joint-fort: #6f7785; --granit: #eceef2; --schiste: #a5acb8;
  --lapis: #8d99ff; --lapis-profond: #b1b9ff; --lapis-voile: #1c2252; --sur-lapis: #0d1029;
  --pyrite: #d9b657;
  --succes: #5fd39a; --succes-voile: #0f2b1d;
  --alerte: #f0c25e; --alerte-voile: #2e2108;
  --erreur: #ff8d92; --erreur-voile: #341215;
  --anneau-focus: #b1b9ff;
  --voile-fond: rgba(0, 0, 0, 0.6);
  --ombre-pose: 0 1px 2px #00000099;
  --ombre-flottante: 0 8px 28px #000000b3, 0 2px 6px #00000080;
  --ombre-modale: 0 28px 72px #000000cc, 0 6px 18px #00000099;
  --reflet: rgba(255, 255, 255, 0.06);
  --toast-succes: #17663f; --toast-erreur: #b0232b; --toast-info: #2638c8; --toast-alerte: #8a5a00;
  color-scheme: dark;
}

/* ── Base ────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--calcaire); color: var(--granit);
  font-family: var(--font-texte); font-size: 15px; line-height: 24px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2 { font-family: var(--font-titre); font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 30px; line-height: 36px; }
h2 { font-size: 21px; line-height: 28px; font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: 16px; line-height: 24px; font-weight: 600; }
a { color: var(--lapis); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--lapis-profond); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--anneau-focus); outline-offset: 2px;
}
::selection { background: var(--lapis-voile); color: var(--granit); }
code, kbd, .mono { font-family: var(--font-mono); }
code { font-size: 13px; background: var(--pierre); padding: 1px 5px; border-radius: var(--radius-xs); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 5px; font-size: 11px; line-height: 1; font-weight: 600; color: var(--schiste);
  background: var(--surface); border: 1px solid var(--joint-fort); border-bottom-width: 2px;
  border-radius: var(--radius-xs);
}
.num { font-variant-numeric: tabular-nums; }
.etiquette {
  font-family: var(--font-mono); font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--schiste);
}
.muet { color: var(--schiste); }
.petit { font-size: 14px; line-height: 22px; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
.ico-16 { width: 16px; height: 16px; }
[hidden] { display: none !important; }

.saut {
  position: fixed; left: var(--space-4); top: var(--space-4); z-index: 100; padding: 10px 14px;
  background: var(--lapis); color: var(--sur-lapis); border-radius: var(--radius-sm);
  transform: translateY(-200%); transition: transform var(--duree-base) var(--courbe-entree);
}
.saut:focus { transform: none; }

/* ── Frame: sidebar + content ────────────────────────────────── */

.cadre { display: grid; grid-template-columns: var(--barre) minmax(0, 1fr); min-height: 100vh; }
.barre {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-6);
  padding: var(--space-6) var(--space-4) var(--space-4); background: var(--surface);
  border-right: 1px solid var(--joint); overflow-y: auto; z-index: 30;
}
.barre-tete { display: flex; flex-direction: column; gap: var(--space-3); padding: 0 var(--space-2); }
.logo { display: block; height: 20px; width: auto; overflow: visible; }
.logo .ns-pierre { fill: var(--granit); }
.logo .ns-cle { fill: var(--lapis); transform-box: fill-box; }
.logo-pose .ns-cle { animation: ns-pose var(--duree-base) var(--courbe-rebond) 160ms both; }
@keyframes ns-pose { from { transform: translateY(-35%); opacity: 0; } to { transform: none; opacity: 1; } }
.barre-mode { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

.nav { display: flex; flex-direction: column; gap: var(--space-5); }
.nav-groupe { display: flex; flex-direction: column; gap: 2px; }
.nav-groupe > .etiquette { padding: 0 var(--space-3) var(--space-2); }
.nav a {
  position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 40px;
  padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--granit);
  text-decoration: none; font-weight: 500; cursor: pointer;
  transition: background-color var(--duree-rapide) var(--courbe-standard),
    color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond);
}
.nav a .ico { color: var(--schiste); transition: color var(--duree-rapide) var(--courbe-standard); }
.nav a:hover { background: var(--pierre); color: var(--granit); text-decoration: none; }
.nav a:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.nav a[aria-current="page"] { background: var(--lapis-voile); color: var(--lapis); font-weight: 600; }
.nav a[aria-current="page"] .ico { color: var(--lapis); }
/* The active page's mark: one element, moved from link to link, so a page
   change can slide it (View Transitions). */
.nav-indic { position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; background: var(--lapis);
  border-radius: 0 2px 2px 0; pointer-events: none; }
.nav-groupe:has(a[aria-current="page"]) > .etiquette { color: var(--granit); }
.nav-compte {
  margin-left: auto; min-width: 24px; height: 22px; padding: 0 6px; display: inline-flex;
  align-items: center; justify-content: center; border-radius: var(--radius-xs);
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  background: var(--alerte-voile); color: var(--alerte);
}
.nav-compte:empty { display: none; }
.nav-compte.pop { animation: compte-pop 360ms var(--courbe-rebond); }
@keyframes compte-pop { from { transform: scale(0.55); opacity: 0.4; } to { transform: none; opacity: 1; } }
.nav-compte.erreur { background: var(--erreur-voile); color: var(--erreur); }

.barre-pied { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2);
  padding-top: var(--space-4); border-top: 1px solid var(--joint); }
.moteur-etat { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2);
  font-size: 14px; color: var(--schiste); }

.barre-fond { display: none; }
/* The drawer's close button exists only in the mobile drawer (.btn would show it). */
.barre .barre-fermer { display: none; }
.zone { min-width: 0; display: flex; flex-direction: column; }
.tete-mobile { display: none; }
main { flex: 1; width: 100%; max-width: calc(var(--contenu-max) + 2 * var(--marge)); margin: 0 auto;
  padding: var(--space-8) var(--marge) calc(var(--space-16) + var(--onglets-h) + var(--sure-bas)); }
main:focus { outline: none; }

/* ── Mobile bars: the page's name on top, four destinations below ── */

.tete-logo { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px;
  margin-left: -10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.tete-logo:hover { background: var(--pierre); }
.tete-logo:active { transform: scale(0.95); transition-duration: var(--duree-instant); }
.logo-symbole { height: 24px; width: auto; }
.tete-titre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 16px; line-height: 22px; font-weight: 600; color: var(--granit); }
.tete-recherche { margin-right: -10px; color: var(--granit); }
.tete-recherche:hover { color: var(--granit); background: var(--pierre); }

.onglets { display: none; }
.onglet-compte:empty { display: none; }

/* ── Banners ─────────────────────────────────────────────────── */

#bandeaux:empty { display: none; }
.bandeau {
  display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--marge);
  border-bottom: 1px solid var(--joint); font-size: 14px; line-height: 22px;
}
.bandeau .ico { margin-top: 1px; }
.bandeau-texte { flex: 1; min-width: 0; }
.bandeau-texte b { font-weight: 600; }
.bandeau.alerte { background: var(--alerte-voile); color: var(--alerte); }
.bandeau.erreur { background: var(--erreur-voile); color: var(--erreur); }
.bandeau.info { background: var(--lapis-voile); color: var(--lapis); }
.bandeau code { background: var(--surface); color: var(--granit); word-break: break-all; }
.bandeau .btn { flex: none; }

/* ── Page head ───────────────────────────────────────────────── */

.page { display: none; }
.page.active { display: block; }
.page.active.entre { animation: page-entre var(--duree-moyenne) var(--courbe-entree); }
@keyframes page-entre { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* One page head for every page: label, title, standfirst on the left; the
   actions on the right, secondary ones first and the single primary one
   last. On a phone the actions drop under the text, the primary one on its
   own full-width row. */
.page-tete { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end;
  gap: var(--space-4) var(--space-8); margin-bottom: var(--space-8); padding-bottom: var(--space-6); border-bottom: 1px solid var(--joint); }
.page-tete > div:first-child { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; max-width: 760px; }
.page-tete > div:first-child > .etiquette { display: inline-flex; align-items: center; gap: var(--space-2); }
/* Before the page's label, a short joint, as in a printed running head. */
.page-tete > div:first-child > .etiquette::before { content: ""; width: 16px; height: 2px; flex: none; background: var(--granit); }
.page-tete h1 { font-size: 34px; line-height: 40px; letter-spacing: -0.025em; text-wrap: balance; }
.page-tete p.chapo { color: var(--schiste); font-size: 16px; line-height: 26px; max-width: 62ch; text-wrap: pretty; margin-top: 2px; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.page-tete > .page-actions { justify-content: flex-end; align-items: center; padding-bottom: 2px; }
.page-tete > .page-actions:empty { display: none; }
.page-tete > .page-actions > .btn-primaire { order: 1; }
.page-tete > .page-actions > .btn-sm { min-height: 40px; padding: 0 var(--space-4); font-size: 15px; }
.section { margin-top: var(--space-12); }
.section:first-child { margin-top: 0; }
.section-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }
.section-tete h2 { font-size: 21px; }
.section-tete p { color: var(--schiste); font-size: 14px; }

/* ── Buttons: seven states ───────────────────────────────────── */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-texte); font-size: 15px; font-weight: 600; line-height: 1; cursor: pointer;
  white-space: nowrap; text-decoration: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard),
    border-color var(--duree-rapide) var(--courbe-standard), box-shadow var(--duree-rapide) var(--courbe-standard),
    transform 180ms var(--courbe-rebond);
}
.btn:hover { text-decoration: none; }
.btn-lg { min-height: 48px; padding: 0 var(--space-6); font-size: 16px; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: 14px; }
.btn-icone { padding: 0; width: 40px; }
.btn-sm.btn-icone { width: 32px; }
.btn-primaire { background: var(--lapis); color: var(--sur-lapis); }
.btn-primaire:hover { background: var(--lapis-profond); color: var(--sur-lapis); }
.btn-secondaire { background: var(--surface); color: var(--granit); border-color: var(--joint-fort); }
.btn-secondaire:hover { border-color: var(--granit); background: var(--pierre); color: var(--granit); }
.btn-discret { background: transparent; color: var(--lapis); padding: 0 var(--space-3); }
.btn-discret:hover { background: var(--lapis-voile); color: var(--lapis); }
.btn-danger { background: var(--surface); color: var(--erreur); border-color: var(--erreur); }
.btn-danger:hover { background: var(--erreur-voile); color: var(--erreur); }
.btn-danger-plein { background: var(--erreur); color: var(--surface); }
.btn-danger-plein:hover { background: color-mix(in srgb, var(--erreur) 86%, var(--granit)); color: var(--surface); }
.btn:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: 2px; }
.btn:active { transform: scale(0.97); transition-duration: var(--duree-instant); }
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn[aria-disabled="true"]:active, .btn:disabled:active { transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"].attente-longue .btn-libelle { visibility: hidden; }
.btn .spinner { display: none; }
.btn[aria-busy="true"].attente-longue .spinner { display: block; }
.spinner { position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor;
  border-right-color: transparent; animation: tour 700ms linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
.btn kbd { margin-left: var(--space-1); background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 55%, transparent); }
.btn-primaire kbd { border-color: color-mix(in srgb, var(--sur-lapis) 60%, transparent); }

/* ── Badges ──────────────────────────────────────────────────── */

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px var(--space-2); border-radius: var(--radius-xs);
  font-size: 13px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.badge-point { width: 6px; height: 6px; background: currentColor; flex: none; }
.badge-neutre { background: var(--pierre); color: var(--granit); }
.badge-lapis { background: var(--lapis-voile); color: var(--lapis); }
.badge-succes { background: var(--succes-voile); color: var(--succes); }
.badge-alerte { background: var(--alerte-voile); color: var(--alerte); }
.badge-erreur { background: var(--erreur-voile); color: var(--erreur); }
.badge-contour { background: transparent; color: var(--schiste); border: 1px solid var(--joint-fort); padding: 1px 7px; }

/* ── Cards, stones, fields ───────────────────────────────────── */

.carte { background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); padding: var(--space-6); }
.carte + .carte { margin-top: var(--space-4); }
.carte-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4); }
.carte-tete h2, .carte-tete h3 { font-family: var(--font-texte); font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: 0; }
.carte p + p { margin-top: var(--space-2); }

/* The brand motif: stones laid with a 4px joint. */
.appareil { display: grid; gap: var(--space-1); background: var(--joint); border-radius: var(--radius-md); overflow: hidden; }
.appareil > * { background: var(--surface); min-width: 0; }

.chiffres { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.chiffre { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5) var(--space-5) var(--space-4); text-decoration: none; color: var(--granit); }
a.chiffre { cursor: pointer; transition: background-color var(--duree-rapide) var(--courbe-standard); }
a.chiffre:hover { background: var(--pierre); color: var(--granit); text-decoration: none; }
.chiffre-valeur { font-family: var(--font-titre); font-size: 36px; line-height: 40px; font-weight: 800; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.chiffre-valeur small { display: inline-block; font-family: var(--font-texte); font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--schiste); margin-left: 4px; }
.chiffre-valeur.lapis { color: var(--lapis); }
.chiffre-aide { font-size: 14px; line-height: 20px; color: var(--schiste); }

/* Compact indicators (every page but the Bureau, whose counters are its own):
   a short label in plain words, the figure, then its context in small type.
   The first tile leads; the others are one step smaller. Figures are
   tabular so a row of them lines up and does not jump when it changes. */
.indicateurs { grid-template-columns: repeat(auto-fit, minmax(min(176px, 100%), 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--joint); }
/* Tiles separated by joints (filets): an incomplete last row leaves plain paper, not a grey hole. */
.indicateurs > .chiffre { gap: var(--space-1); padding: var(--space-4) var(--space-5) var(--space-4); min-width: 0;
  margin: -1px 0 0 -1px; border-top: 1px solid var(--joint); border-left: 1px solid var(--joint); }
.indicateurs .chiffre > .etiquette { font-family: var(--font-texte); font-size: 13px; line-height: 18px; font-weight: 600;
  letter-spacing: 0; text-transform: none; color: var(--schiste); }
.indicateurs .chiffre-valeur { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; font-size: 24px; line-height: 32px;
  font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.indicateurs > .chiffre:first-child .chiffre-valeur { font-size: 30px; line-height: 36px; font-weight: 800; }
.indicateurs .chiffre-valeur small { font-size: 14px; margin-left: 0; white-space: normal; }
.indicateurs .chiffre-aide { font-size: 13px; line-height: 18px; }
.indicateurs .meter { height: 6px; margin: var(--space-1) 0; }
.indicateurs .chiffre-aide .badge { font-size: 12px; line-height: 18px; padding: 0 6px; }
.indicateurs + .section, .indicateurs + .encart { margin-top: var(--space-8); }
/* On a phone the tiles become a list: label on the left, figure on the right. */
@media (max-width: 640px) {
  .indicateurs { grid-template-columns: minmax(0, 1fr); }
  .indicateurs .chiffre-valeur { justify-content: flex-end; }
  .indicateurs .chiffre-valeur small { flex-basis: 100%; text-align: right; font-size: 13px; line-height: 18px; }
  .indicateurs > .chiffre { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px var(--space-3);
    padding: var(--space-3) var(--space-4); }
  .indicateurs > .chiffre > .etiquette { grid-column: 1; grid-row: 1; font-size: 14px; line-height: 20px; color: var(--granit); }
  .indicateurs .chiffre-valeur, .indicateurs > .chiffre:first-child .chiffre-valeur { grid-column: 2; grid-row: 1; font-size: 22px; line-height: 28px; text-align: right; }
  .indicateurs > .chiffre:first-child .chiffre-valeur { font-size: 26px; line-height: 32px; }
  .indicateurs .chiffre-aide, .indicateurs .meter { grid-column: 1 / -1; }
  .indicateurs > .chiffre > .chiffre-valeur:first-child { grid-column: 2; }
  .indicateurs > .chiffre > .chiffre-valeur:first-child + .chiffre-aide { grid-column: 1; grid-row: 1; font-size: 14px; line-height: 20px; color: var(--granit); }
}

.champ { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.champ-libelle { font-size: 14px; line-height: 20px; font-weight: 600; color: var(--granit); }
.champ-aide { font-size: 13px; line-height: 20px; color: var(--schiste); }
.champ-message { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 14px; line-height: 20px; color: var(--erreur); font-weight: 500; }
.champ-message:empty { display: none; }
.input, select.input, textarea.input {
  font: inherit; font-size: 15px; line-height: 22px; color: var(--granit); background: var(--surface);
  min-height: 40px; width: 100%; padding: 8px var(--space-3); border: 1px solid var(--joint-fort); border-radius: var(--radius-sm);
  transition: border-color var(--duree-rapide) var(--courbe-standard), box-shadow var(--duree-rapide) var(--courbe-standard);
}
.input::placeholder { color: var(--schiste); opacity: 1; }
.input:hover { border-color: var(--granit); }
.input:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: 2px; border-color: var(--lapis); }
.input[aria-invalid="true"] { border-color: var(--erreur); }
select.input { cursor: pointer; appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--schiste) 50%), linear-gradient(135deg, var(--schiste) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { min-height: 120px; resize: vertical; line-height: 24px; }
.input-mono { font-family: var(--font-mono); font-size: 14px; }
.grille-champs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4) var(--space-6); }
.grille-champs .large { grid-column: span 2; }
.coche { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 36px; cursor: pointer; font-size: 15px; }
.coche input { width: 18px; height: 18px; margin: 0; accent-color: var(--lapis); cursor: pointer; }

/* Segmented control (theme, filters). */
/* Segmented control (filters, views): each segment says how many it holds.
   The chosen one is a laid sheet with a lapis joint under it (lapis marks
   what is active); no shadow. */
.segments { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; max-width: 100%; background: var(--pierre); border-radius: var(--radius-sm); }
.segments button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 var(--space-3); border: 0; border-radius: 3px;
  background: transparent; color: var(--schiste); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard),
    box-shadow var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond);
}
.segments button:hover { color: var(--granit); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.segments button:active { transform: scale(0.97); transition-duration: var(--duree-instant); }
.segments button:focus-visible { outline-offset: 0; }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--granit); box-shadow: inset 0 -2px 0 var(--lapis); }
.segments button .num { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 5px;
  border-radius: var(--radius-xs); background: color-mix(in srgb, var(--granit) 9%, transparent); color: var(--granit);
  font-family: var(--font-mono); font-size: 12px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.segments button[aria-pressed="true"] .num { background: var(--lapis-voile); color: var(--lapis); }
.segments button[aria-disabled="true"], .segments button:disabled { opacity: 0.45; cursor: not-allowed; }
.segments-defile { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.segments-defile::-webkit-scrollbar { display: none; }
.segments-defile button { flex: none; }

/* Chips (a list of codes you can remove). */
.puces { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.puce { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; padding: 0 2px 0 var(--space-3); border-radius: var(--radius-xs);
  background: var(--pierre); color: var(--granit); font-size: 14px; }
.puce .mono { font-size: 13px; font-weight: 600; margin-right: 4px; }
.puce button { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent;
  color: var(--schiste); border-radius: var(--radius-xs); cursor: pointer; transition: background-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard); }
.puce button:hover { background: var(--erreur-voile); color: var(--erreur); }
.puce-vide { color: var(--schiste); font-size: 14px; padding: 4px 0; }

/* ── Tables ──────────────────────────────────────────────────── */

.tableau { width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 20px; }
/* The head sits on the calcaire, a step back from the rows. */
th { text-align: left; font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--schiste); padding: 10px var(--space-4); border-bottom: 1px solid var(--joint);
  background: color-mix(in srgb, var(--calcaire) 60%, var(--surface)); white-space: nowrap; }
td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--joint); vertical-align: top; }
td b { font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sous { display: block; color: var(--schiste); font-size: 13px; line-height: 18px; margin-top: 2px; }
tr.cliquable { position: relative; cursor: pointer; transition: background-color var(--duree-rapide) var(--courbe-standard); }
tr.cliquable:hover { background: color-mix(in srgb, var(--pierre) 60%, var(--surface)); }
tr.cliquable:hover td:first-child b { color: var(--lapis); }
tr.cliquable:active { background: var(--pierre); }
tr.cliquable:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: -2px; }
.tableau-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--joint); background: var(--pierre); font-size: 14px; color: var(--schiste); }

/* ── Empty states, skeletons, notices ────────────────────────── */

/* Empty: a sheet of paper laid on the page, the « vide » paper scene above
   a short title, what will fill the place, and a way on. Centred: it is the
   one thing in its zone. */
.vide { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3);
  padding: var(--space-8) var(--space-6) var(--space-8); background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); }
.vide-anim { width: 120px; height: 104px; flex: none; display: grid; place-items: center; }
.vide-anim > svg, .vide-anim > canvas { max-width: 100%; max-height: 100%; }
.vide-pierres { width: 72px; height: 72px; }
.vide-pierres rect { fill: var(--pierre); stroke: var(--joint-fort); stroke-width: 1.5; }
.vide-pierres .vide-cle { fill: var(--joint-fort); }
.vide-anim.anime .vide-pierres { display: none; }
.vide-texte { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); min-width: 0; max-width: 56ch; }
.vide-action { margin-top: var(--space-3); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.vide h3 { font-family: var(--font-titre); font-size: 20px; line-height: 26px; font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; }
.vide p { color: var(--schiste); max-width: 56ch; text-wrap: pretty; }
/* Inside a card or a drawer the sheet is already there: no second frame. */
.carte .vide, .tiroir-corps .vide, .dialogue-corps .vide { border: 0; padding: var(--space-5) 0; background: transparent; }

/* Failure: the same place, an error mark, plain words and « Réessayer ». */
.etat-erreur { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-5) var(--space-6);
  background: var(--surface); border: 1px solid var(--joint); border-left: 3px solid var(--erreur); border-radius: var(--radius-md); }
.etat-erreur-ico { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--radius-sm); background: var(--erreur-voile); color: var(--erreur); }
.etat-erreur-texte { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); min-width: 0; }
.etat-erreur h3 { font-size: 17px; line-height: 24px; font-weight: 600; }
.etat-erreur p { color: var(--schiste); font-size: 14px; line-height: 22px; max-width: 64ch; }
.etat-erreur .vide-action { justify-content: flex-start; margin-top: var(--space-2); }
.dialogue-corps .etat-erreur, .tiroir-corps .etat-erreur { padding: var(--space-4); }

/* Loading: sheets shaped like the rows to come; a light passes over them
   (transform only, still when motion is reduced). The word « Chargement… »
   only shows if the wait passes 400 ms. */
.chargement { display: flex; flex-direction: column; gap: var(--space-2); }
.squelette-feuille { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: var(--space-3) var(--space-4);
  background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); }
.squelette-feuille .squelette { display: block; height: 10px; border-radius: var(--radius-xs); }
.squelette-feuille .squelette-titre { height: 14px; }
.chargement-mot { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 24px; margin-top: var(--space-1);
  font-size: 13px; line-height: 20px; color: var(--schiste); opacity: 0; animation: mot-apparait var(--duree-rapide) var(--courbe-entree) 400ms forwards; }
.chargement-mot .spinner { position: static; width: 14px; height: 14px; border-width: 2px; }
@keyframes mot-apparait { to { opacity: 1; } }
.squelette { position: relative; overflow: hidden; background: var(--pierre); border-radius: var(--radius-sm); }
.squelette::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 20%, var(--reflet) 50%, transparent 80%);
  animation: reflet 1.6s var(--courbe-standard) infinite; }
@keyframes reflet { to { transform: translateX(100%); } }
@keyframes pouls { 50% { opacity: 0.55; } }
.encart { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); font-size: 14px; line-height: 22px; }
.encart .ico { margin-top: 1px; }
.encart.info { background: var(--lapis-voile); color: var(--lapis); }
.encart.alerte { background: var(--alerte-voile); color: var(--alerte); }
.encart.erreur { background: var(--erreur-voile); color: var(--erreur); }
.encart.succes { background: var(--succes-voile); color: var(--succes); }
.encart.neutre { background: var(--pierre); color: var(--granit); }

/* ── Bureau ──────────────────────────────────────────────────── */

.bureau { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-6); align-items: start; }
.bureau-chiffres { margin-bottom: var(--space-6); grid-template-columns: 1.3fr 1fr 1fr 1fr; }
.attend { position: relative; }
.attend .chiffre-valeur { color: var(--lapis); }
.attend.calme .chiffre-valeur { color: var(--granit); }
.attend-liste { display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 20px; }
.attend-liste a { color: var(--granit); text-decoration: none; }
.attend-liste a:hover { color: var(--lapis); text-decoration: underline; }

.etage { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.equipe { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-5); }
.equipe { grid-column: span 2; }
.equipe[data-equipe="redaction"], .equipe[data-equipe="veille"],
.equipe[data-equipe="pilotage"] { grid-column: span 4; }
.equipe-tete { display: flex; flex-direction: column; gap: 2px; }
.equipe-tete .etiquette { display: flex; justify-content: space-between; gap: var(--space-2); }
.equipe-role { font-size: 13px; line-height: 18px; color: var(--schiste); }
.equipe-agents { flex: 1; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); grid-auto-rows: 1fr; }

.agent {
  position: relative; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-3);
  background: var(--calcaire); border-radius: var(--radius-sm); border-top: 3px solid var(--joint); min-height: 168px; overflow: hidden;
  transition: border-color var(--duree-base) var(--courbe-standard);
}
.agent::after { content: ""; position: absolute; inset: 0; background: var(--lapis-voile); opacity: 0; pointer-events: none;
  transition: opacity 900ms var(--courbe-sortie); }
.agent.vient-de-bouger::after { opacity: 0.85; transition: none; }
.agent > * { position: relative; z-index: 1; }
.agent[data-statut="travaille"] { border-top-color: var(--lapis); }
.agent[data-statut="attend_validation"] { border-top-color: var(--alerte); }
.agent[data-statut="erreur"] { border-top-color: var(--erreur); }
.agent[data-statut="en_pause"] { border-top-color: var(--joint-fort); }
.agent-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-1) var(--space-2); }
.agent-nom { font-weight: 600; font-size: 16px; line-height: 22px; }
.agent-role { font-size: 13px; line-height: 18px; color: var(--schiste); }
.agent-tache { font-size: 14px; line-height: 20px; color: var(--granit); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.agent-tache.muet { color: var(--schiste); }
.agent-meta { font-family: var(--font-mono); font-size: 11px; line-height: 16px; color: var(--schiste); font-variant-numeric: tabular-nums; }
.agent-dernier { margin-top: auto; padding-top: var(--space-2); border-top: 1px solid var(--joint); font-size: 13px; line-height: 18px; color: var(--schiste);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.agent-dernier b { color: var(--granit); font-weight: 600; }
.agent-lien { font-size: 13px; font-weight: 600; }
.agent .badge { font-size: 12px; line-height: 18px; }
/* Working: data flows along the top joint. */
.agent .flux-trait { position: absolute; top: -3px; left: 0; width: 100%; height: 3px; overflow: hidden; z-index: 2; display: none; }
.agent[data-statut="travaille"] .flux-trait { display: block; }
.flux-trait::before { content: ""; position: absolute; inset: 0; width: 34%; background: var(--lapis-profond);
  animation: circule 1.6s var(--courbe-standard) infinite; }
@keyframes circule { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.agent[data-statut="travaille"] .badge-point { animation: clignote 1.2s var(--courbe-standard) infinite; }
@keyframes clignote { 50% { opacity: 0.25; } }

.direct { position: sticky; top: var(--space-6); display: flex; flex-direction: column; max-height: calc(100vh - 48px);
  background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); overflow: hidden; }
.direct-tete { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-4) var(--space-3); border-bottom: 1px solid var(--joint); }
.direct-titre { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.direct-titre h2 { font-family: var(--font-texte); font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: 0; display: flex; align-items: center; gap: var(--space-2); }
.pastille { width: 8px; height: 8px; background: var(--lapis); flex: none; }
.pastille.vivante { animation: clignote 1.6s var(--courbe-standard) infinite; }
.pastille.arretee { background: var(--joint-fort); animation: none; }
.direct-etat { font-family: var(--font-mono); font-size: 11px; color: var(--schiste); }
.fil { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 240px; overscroll-behavior: contain; }
.fil li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--joint);
  border-left: 3px solid transparent; font-size: 14px; line-height: 20px; }
.fil li.entre { animation: ligne-entre var(--duree-base) var(--courbe-entree); }
@keyframes ligne-entre { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.fil li[data-type="erreur"] { border-left-color: var(--erreur); }
.fil li[data-type="attente"] { border-left-color: var(--alerte); }
.fil li[data-type="fin"], .fil li[data-type="resultat"] { border-left-color: var(--succes); }
.fil li[data-type="debut"] { border-left-color: var(--lapis); }
.fil-heure { font-family: var(--font-mono); font-size: 12px; color: var(--schiste); font-variant-numeric: tabular-nums; padding-top: 1px; }
.fil-qui { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.fil-qui b { font-weight: 600; }
.fil-qui .etiquette { font-size: 10px; letter-spacing: 0.06em; }
.fil-type { font-size: 12px; font-weight: 600; }
.fil li[data-type="erreur"] .fil-type { color: var(--erreur); }
.fil li[data-type="attente"] .fil-type { color: var(--alerte); }
.fil li[data-type="fin"] .fil-type, .fil li[data-type="resultat"] .fil-type { color: var(--succes); }
.fil-message { color: var(--granit); overflow-wrap: anywhere; }
.fil-entreprise { display: inline-block; font-size: 13px; }
.fil-vide { padding: var(--space-6) var(--space-4); color: var(--schiste); font-size: 14px; }
.nouveaux { position: absolute; left: 50%; top: 140px; transform: translateX(-50%); z-index: 3; box-shadow: var(--ombre-flottante); }

/* ── À valider: the decisions desk ───────────────────────────── */

.bureau-decision { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.file { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md);
  max-height: calc(100vh - 220px); overflow-y: auto; position: sticky; top: var(--space-6); }
.file button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: var(--space-3) var(--space-4); border: 0; border-bottom: 1px solid var(--joint);
  border-left: 3px solid transparent; background: transparent; color: var(--granit); text-align: left; font: inherit; cursor: pointer;
  transition: background-color var(--duree-rapide) var(--courbe-standard), border-color var(--duree-rapide) var(--courbe-standard); }
.file button:last-child { border-bottom: 0; }
.file button:hover { background: var(--pierre); }
.file button[aria-current="true"] { background: var(--lapis-voile); border-left-color: var(--lapis); }
.file-a { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-objet { font-size: 13px; line-height: 18px; color: var(--schiste); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; gap: var(--space-2); align-items: center; margin-top: 4px; flex-wrap: wrap; }
.file-meta .badge { font-size: 12px; line-height: 18px; padding: 0 6px; }
.file-meta .badge-contour { padding: 0 5px; }

#lettre, #tiroir-titre { scroll-margin-top: 72px; }
.lettre-cadre { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-6); align-items: start; }
.lettre { background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); }
.lettre-tete { position: relative; display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--joint); }
.lettre-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) 0 0; }
.lettre-nav > span:last-child { display: flex; align-items: center; gap: 2px; }
.lettre-lignes { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px var(--space-3); font-size: 14px; line-height: 22px; }
.lettre-lignes dt { color: var(--schiste); }
.lettre-lignes dd { margin: 0; overflow-wrap: anywhere; }
.lettre-objet { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.005em; margin-top: var(--space-2); }
.lettre-corps { padding: var(--space-6); font-size: 16px; line-height: 26px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.lettre-controles { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--joint); background: var(--pierre); }
.lettre-actions { position: sticky; bottom: calc(var(--onglets-h) + var(--sure-bas)); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--joint); background: var(--surface); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.lettre-actions .espace { flex: 1; }
.lettre-edition { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.lettre-edition textarea { min-height: 360px; font-size: 16px; line-height: 26px; }
.refus { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--joint); background: var(--erreur-voile); }
.refus .champ-libelle { color: var(--erreur); }
.raccourcis { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); margin-top: var(--space-3); font-size: 13px; color: var(--schiste); }
.raccourcis span { display: inline-flex; gap: 4px; align-items: center; }

.dossier { display: flex; flex-direction: column; gap: var(--space-4); }
.dossier .carte { padding: var(--space-4) var(--space-5); }
.dossier .carte + .carte { margin-top: 0; }
.dossier h3 { font-size: 12px; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--schiste); margin-bottom: var(--space-3); }
.fiche { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px var(--space-4); font-size: 14px; line-height: 20px; }
.fiche dt { color: var(--schiste); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }
.faits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); font-size: 14px; line-height: 20px; }
.faits li { position: relative; padding-left: var(--space-4); }
.faits li::before { content: ""; position: absolute; left: 0; top: 7px; width: 6px; height: 6px; background: var(--lapis); }
.angle { font-size: 14px; line-height: 22px; padding: var(--space-3); background: var(--lapis-voile); color: var(--granit); border-radius: var(--radius-sm); margin-top: var(--space-3); }
.note-barre { display: flex; align-items: center; gap: var(--space-2); }
.note-barre .meter { width: 64px; }

/* ── Meter & bars (single series, one hue) ───────────────────── */

.meter { position: relative; height: 8px; background: var(--lapis-voile); border-radius: var(--radius-xs); overflow: hidden; }
.meter > span { position: absolute; inset: 0; background: var(--lapis); border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  transform-origin: left; transition: transform var(--duree-moyenne) var(--courbe-entree); }
.meter.alerte { background: var(--alerte-voile); }
.meter.alerte > span { background: var(--alerte); }
.meter.erreur { background: var(--erreur-voile); }
.meter.erreur > span { background: var(--erreur); }

.barres { display: flex; flex-direction: column; gap: var(--space-2); }
.barre-ligne { display: grid; grid-template-columns: minmax(120px, 44%) minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); font-size: 14px; line-height: 20px; }
.barre-ligne .lib { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-ligne .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--granit); min-width: 28px; white-space: nowrap; }
.barre-piste { height: 16px; position: relative; }
.barre-piste > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lapis); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 2px; }

.colonne:last-child .cap { left: auto; right: 0; transform: none; }
.colonnes { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: 2px; height: 160px;
  padding-top: 20px; border-bottom: 1px solid var(--joint); }
.colonne { position: relative; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline: none; }
.colonne > .col-barre { width: min(24px, 70%); background: var(--lapis); border-radius: var(--radius-sm) var(--radius-sm) 0 0; min-height: 2px; }
.colonne.vide-col > .col-barre { background: var(--pierre); }
.colonne.aujourdhui > .col-barre { background: var(--lapis-profond); }
.colonne:hover > .col-barre, .colonne:focus-visible > .col-barre { background: var(--lapis-profond); }
.colonne .bulle { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); display: none; pointer-events: none; z-index: 5;
  white-space: nowrap; padding: 4px 8px; background: var(--granit); color: var(--calcaire); border-radius: var(--radius-sm); font-size: 12px; line-height: 16px;
  animation: bulle-entre var(--duree-rapide) var(--courbe-entree); }
.colonne:hover .bulle, .colonne:focus-visible .bulle { display: block; }
.colonne:nth-child(-n+4) .bulle { left: 0; transform: none; }
.colonne:nth-last-child(-n+4) .bulle { left: auto; right: 0; transform: none; }
@keyframes bulle-entre { from { opacity: 0; } to { opacity: 1; } }
.colonne .cap { position: absolute; z-index: 3; padding: 0 3px; background: var(--surface); border-radius: var(--radius-xs); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-family: var(--font-mono); color: var(--schiste); font-variant-numeric: tabular-nums; }
.colonnes-axe { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin-top: 6px; font-family: var(--font-mono); font-size: 10px; color: var(--schiste); text-align: center; }
.ligne-budget { position: absolute; left: 0; right: 0; border-top: 1px solid var(--alerte); z-index: 1; pointer-events: none; }
.ligne-budget span { position: absolute; right: 0; top: -18px; font-size: 11px; font-family: var(--font-mono); color: var(--alerte); background: var(--surface); padding: 0 4px; }

/* ── Pipeline ────────────────────────────────────────────────── */

.etapes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.etape { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4) var(--space-4) var(--space-5); border-top: 3px solid var(--joint); }
.etape.pleine { border-top-color: var(--granit); }
.etape-num { font-family: var(--font-mono); font-size: 12px; color: var(--schiste); }
.etape-valeur { font-family: var(--font-titre); font-size: 30px; line-height: 36px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.etape-libelle { font-weight: 600; }
.etape-taux { font-size: 13px; line-height: 18px; color: var(--schiste); }
.deux-colonnes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.deux-colonnes .carte + .carte { margin-top: 0; }

/* ── Entreprises: drawer ─────────────────────────────────────── */

.filtres { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; margin-bottom: var(--space-4); }
.filtres .champ { flex: 1 1 200px; }
.filtres .champ.large { flex: 3 1 280px; }
.tiroir-fond { position: fixed; inset: 0; background: var(--voile-fond); z-index: 60; opacity: 0; transition: opacity var(--duree-moyenne) var(--courbe-standard); }
.tiroir-fond.ouvert { opacity: 1; }
.tiroir { position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw); z-index: 61; background: var(--calcaire); box-shadow: var(--ombre-modale);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--duree-moyenne) var(--courbe-entree); }
.tiroir.ouvert { transform: none; }
.tiroir.ferme { transition: transform var(--duree-base) var(--courbe-sortie); }
.tiroir-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); padding: var(--space-5) var(--space-6); background: var(--surface); border-bottom: 1px solid var(--joint); }
.tiroir-tete h2 { font-size: 21px; overflow-wrap: anywhere; }
.tiroir-corps { flex: 1; overflow-y: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.tiroir-corps .carte { padding: var(--space-4) var(--space-5); }
.tiroir-corps .carte + .carte { margin-top: 0; }
.contact + .contact { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--joint); }

/* ── Réponses ────────────────────────────────────────────────── */

.conversation { background: var(--surface); border: 1px solid var(--joint); border-radius: var(--radius-md); }
.conversation + .conversation { margin-top: var(--space-3); }
.conversation summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); padding: var(--space-4) var(--space-5); cursor: pointer;
  border-radius: var(--radius-md); transition: background-color var(--duree-rapide) var(--courbe-standard); }
.conversation summary::-webkit-details-marker { display: none; }
.conversation summary:hover { background: var(--pierre); }
.conversation[open] summary { border-bottom: 1px solid var(--joint); border-radius: var(--radius-md) var(--radius-md) 0 0; }
.conv-qui { font-weight: 600; }
.conv-apercu { grid-column: 1 / -1; color: var(--schiste); font-size: 14px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-meta { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.fil-messages { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); }
.message { max-width: 76ch; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 24px; }
.message .qui { display: block; margin-bottom: 4px; }
.message.recu { background: var(--pierre); align-self: flex-start; }
.message.envoye { background: var(--surface); border: 1px solid var(--joint); border-left: 3px solid var(--lapis); align-self: flex-end; }
.message.brouillon { border-left-color: var(--alerte); border-style: dashed; border-left-style: solid; }

/* ── Réglages ────────────────────────────────────────────────── */

.reglages { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); max-width: 920px; }
.reglages .carte + .carte { margin-top: 0; }
.mode-choix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.mode-option { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--joint-fort); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: var(--granit);
  transition: border-color var(--duree-rapide) var(--courbe-standard), background-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.mode-option:hover { border-color: var(--granit); }
.mode-option:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.mode-option[aria-pressed="true"] { border: 2px solid var(--lapis); background: var(--lapis-voile); padding: calc(var(--space-4) - 1px); }
.mode-option strong { font-size: 16px; }
.mode-option span { font-size: 14px; color: var(--schiste); line-height: 20px; }
.reel-garde { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-4); padding: var(--space-4); border: 1px solid var(--erreur); border-radius: var(--radius-sm); background: var(--erreur-voile); }
.reel-garde .champ-libelle { color: var(--erreur); }
.jours { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.jours label { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0 var(--space-2); border: 1px solid var(--joint-fort);
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: 14px; background: var(--surface);
  transition: background-color var(--duree-rapide) var(--courbe-standard), border-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard); }
.jours label:hover { border-color: var(--granit); }
.jours input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jours label:has(input:checked) { background: var(--lapis); border-color: var(--lapis); color: var(--sur-lapis); }
.jours label:has(input:focus-visible) { outline: 2px solid var(--anneau-focus); outline-offset: 2px; }
.ajout { display: flex; gap: var(--space-2); }
.ajout .input { flex: 1; }
.arret { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }
.arret.actif { border-color: var(--erreur); background: var(--erreur-voile); }
#reg-barre { position: sticky; bottom: calc(var(--space-4) + var(--onglets-h) + var(--sure-bas)); z-index: 20; }
#reg-barre:empty { display: none; }
.enregistrer-barre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4); background: var(--granit); color: var(--calcaire); border-radius: var(--radius-md); box-shadow: var(--ombre-flottante);
  animation: monte var(--duree-base) var(--courbe-entree); }
.enregistrer-barre .btn-secondaire { background: transparent; color: var(--calcaire); border-color: color-mix(in srgb, var(--calcaire) 60%, transparent); }
.enregistrer-barre .btn-secondaire:hover { background: color-mix(in srgb, var(--calcaire) 12%, transparent); color: var(--calcaire); border-color: var(--calcaire); }
.enregistrer-barre .btn-primaire { background: var(--calcaire); color: var(--granit); }
.enregistrer-barre .btn-primaire:hover { background: var(--surface); color: var(--granit); }
@keyframes monte { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Toasts & dialogs ────────────────────────────────────────── */

/* A stack in the manner of Sonner: the newest in front, two more tucked
   behind; hovering or focusing fans them out and pauses their timers. */
/* The zone itself catches the pointer (its height follows the stack, 0 when
   empty), so fanning out never loses the hover between two toasts. */
.toasts { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 90; width: min(400px, calc(100vw - 32px)); height: 0; }
.toast { position: absolute; right: 0; bottom: 0; width: 100%; display: flex; align-items: flex-start; gap: var(--space-3);
  min-height: 52px; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); background: var(--granit); color: var(--calcaire);
  border-radius: var(--radius-md); box-shadow: var(--ombre-flottante); font-size: 14px; line-height: 20px;
  transform: translateY(var(--y, 0)) scale(var(--s, 1)); transform-origin: 50% 0; opacity: var(--o, 1);
  transition: transform 400ms var(--courbe-entree), opacity 240ms var(--courbe-standard), background-color var(--duree-base) var(--courbe-standard); }
.toast > * { transition: opacity var(--duree-rapide) var(--courbe-standard); }
.toast.arriere > * { opacity: 0; }
.toast.arriere[data-rang="1"] { background: color-mix(in srgb, var(--granit) 86%, var(--calcaire)); }
.toast.arriere[data-rang="2"] { background: color-mix(in srgb, var(--granit) 74%, var(--calcaire)); }
.toast.sort { transition: transform var(--duree-base) var(--courbe-sortie), opacity 180ms var(--courbe-sortie); pointer-events: none; }
.toast.rebond { animation: toast-rebond 280ms var(--courbe-rebond); }
@keyframes toast-rebond { 45% { scale: 1.03; } }
.toast-ico { display: flex; padding-top: 0; }
.toast-ico .ico { color: var(--toast-info); }
.toast-success .toast-ico .ico { color: var(--toast-succes); }
.toast-erreur .toast-ico .ico { color: var(--toast-erreur); }
.toast-alerte .toast-ico .ico { color: var(--toast-alerte); }
.toast-erreur { box-shadow: inset 3px 0 0 var(--toast-erreur), var(--ombre-flottante); }
.toast-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.toast-titre { font-weight: 500; }
.toast-desc { font-size: 13px; line-height: 18px; color: color-mix(in srgb, var(--calcaire) 72%, transparent); }
.toast .toast-action { align-self: center; min-height: 30px; padding: 0 var(--space-3); border: 0; background: color-mix(in srgb, var(--calcaire) 14%, transparent);
  color: var(--calcaire); font-size: 13px; }
.toast .toast-action:hover { background: color-mix(in srgb, var(--calcaire) 24%, transparent); color: var(--calcaire); }
.toast-fermer { align-self: center; flex: none; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: color-mix(in srgb, var(--calcaire) 66%, transparent); cursor: pointer;
  transition: background-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.toast-fermer:hover { background: color-mix(in srgb, var(--calcaire) 14%, transparent); color: var(--calcaire); }
.toast-fermer:active, .toast .toast-action:active { transform: scale(0.94); transition-duration: var(--duree-instant); }
.toast button:focus-visible { outline: 2px solid var(--calcaire); outline-offset: 1px; }

dialog.dialogue { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--joint);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--granit); box-shadow: var(--ombre-modale); overflow: hidden; }
dialog.dialogue.dialogue-large { width: min(720px, calc(100vw - 32px)); }
dialog.dialogue[open] { animation: dialogue-entre var(--duree-moyenne) var(--courbe-entree); }
dialog.dialogue::backdrop { background: var(--voile-fond); backdrop-filter: blur(2px); }
dialog.dialogue[open]::backdrop { animation: voile-entre var(--duree-base) var(--courbe-standard); }
dialog.dialogue.sort { animation: dialogue-sort 150ms var(--courbe-sortie) forwards; }
dialog.dialogue.sort::backdrop { animation: voile-sort 150ms var(--courbe-sortie) forwards; }
@keyframes dialogue-entre { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dialogue-sort { to { opacity: 0; transform: translateY(6px) scale(0.985); } }
@keyframes voile-entre { from { opacity: 0; } }
@keyframes voile-sort { to { opacity: 0; } }
.dialogue-form { display: flex; flex-direction: column; max-height: calc(100dvh - 50px); }
.dialogue-corps { position: relative; overflow-y: auto; overscroll-behavior: contain; }
.dialogue-espace { height: var(--space-4); }
.dialogue-tete { position: relative; padding: var(--space-6) var(--space-6) 0; }
.dialogue-tete:has(.dialogue-croix) { padding-right: 64px; }
.dialogue-croix { position: absolute; top: var(--space-4); right: var(--space-4); color: var(--schiste); }
.dialogue-croix:hover { color: var(--granit); background: var(--pierre); }
.groupe-champs { margin: 0; padding: var(--space-4); border: 1px solid var(--joint); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.groupe-champs legend { padding: 0 var(--space-2); font-size: 14px; font-weight: 600; }
.champ-aide-ok { color: var(--succes); }
.dialogue-tete h2 { font-size: 21px; }
.dialogue-tete p { color: var(--schiste); margin-top: var(--space-2); font-size: 14px; }
.dialogue-corps { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.dialogue-pied { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--joint);
  background: color-mix(in srgb, var(--pierre) 55%, var(--surface)); }
.modeles { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Legacy tools (signaux, recherche, campagnes, journal, moteur) ── */

.sig-groupe + .sig-groupe { margin-top: var(--space-8); }
.sig-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--joint); }
.sig-ligne:last-child { border-bottom: 0; }
.sig-ligne.refuse { opacity: 0.6; }
.sig-code { font-family: var(--font-mono); font-size: 11px; color: var(--schiste); margin-left: var(--space-2); }
.sig-desc { color: var(--schiste); font-size: 14px; line-height: 20px; margin-top: 2px; }
.sig-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.sig-meta .badge { white-space: normal; }
.sig-actions { display: flex; gap: var(--space-2); align-items: flex-start; }
.liste-carte { padding: 0; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-3); }
.source { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); background: var(--surface); border: 1px solid var(--joint-fort); border-radius: var(--radius-sm);
  text-align: left; font: inherit; color: var(--granit); cursor: pointer; transition: border-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.source:hover { border-color: var(--granit); }
.source:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.source[aria-pressed="true"] { border: 2px solid var(--lapis); padding: calc(var(--space-4) - 1px); background: var(--lapis-voile); }
.source p { font-size: 14px; line-height: 20px; color: var(--schiste); }
.journal-ligne { display: grid; grid-template-columns: 140px 140px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--joint); font-size: 14px; }
.journal-ligne:last-child { border-bottom: 0; }
.journal { font-family: var(--font-mono); font-size: 12px; line-height: 18px; background: var(--pierre); color: var(--granit); padding: var(--space-4); border-radius: var(--radius-sm);
  max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.etape-courriel + .etape-courriel { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--joint); }
.etape-courriel .corps { white-space: pre-wrap; font-size: 14px; color: var(--schiste); margin-top: 4px; }
.aide-bloc + .aide-bloc { margin-top: var(--space-4); }
.aide-bloc ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.aide-bloc li + li { margin-top: 4px; }
details.aide-q { border-top: 1px solid var(--joint); }
details.aide-q summary { cursor: pointer; padding: var(--space-3) 0; font-weight: 600; }
details.aide-q p { padding-bottom: var(--space-3); color: var(--schiste); }
/* Legacy quota card (claude / codex subscriptions only). */
.progress-wrap + .progress-wrap { margin-top: var(--space-3); }
.progress-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.progress-bar { height: 8px; background: var(--lapis-voile); border-radius: var(--radius-xs); overflow: hidden; }
.progress-fill { height: 100%; background: var(--lapis); }
.progress-fill.yellow { background: var(--alerte); }
.chip { display: inline-flex; gap: 4px; padding: 2px 8px; background: var(--pierre); border-radius: var(--radius-xs); font-size: 13px; }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1240px) {
  .bureau { grid-template-columns: minmax(0, 1fr); }
  .direct { position: relative; top: 0; max-height: 440px; order: -1; }
  .fil { min-height: 0; }
  .lettre-cadre { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .etage { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .equipe[data-equipe] { grid-column: span 1; }
  .equipe[data-equipe="redaction"], .equipe[data-equipe="veille"],
  .equipe[data-equipe="pilotage"] { grid-column: span 2; }
  .bureau-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .etapes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bureau-decision { grid-template-columns: minmax(0, 1fr); }
  .deux-colonnes { grid-template-columns: minmax(0, 1fr); }
  .file { position: relative; top: 0; max-height: 280px; }
}
@media (max-width: 900px) {
  .cadre { grid-template-columns: minmax(0, 1fr); }
  /* The sidebar becomes a drawer. Closed, it is hidden from the keyboard too
     (visibility flips once the slide is over). */
  .barre { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); height: auto; transform: translateX(-100%); box-shadow: var(--ombre-modale);
    padding-top: calc(var(--space-4) + env(safe-area-inset-top, 0px)); padding-bottom: calc(var(--space-4) + var(--sure-bas));
    visibility: hidden; transition: transform var(--duree-base) var(--courbe-sortie), visibility 0s linear var(--duree-base); z-index: 70;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0; overscroll-behavior: contain; }
  .barre.ouverte { transform: none; visibility: visible; transition: transform var(--duree-moyenne) var(--courbe-entree), visibility 0s; }
  .barre-tete { position: relative; padding-right: 48px; }
  .barre .barre-fermer { display: inline-flex; position: absolute; top: -6px; right: 0; color: var(--schiste); }
  .barre-fermer:hover { color: var(--granit); background: var(--pierre); }
  .barre-fond { display: block; position: fixed; inset: 0; background: var(--voile-fond); z-index: 69; opacity: 0; pointer-events: none; transition: opacity var(--duree-moyenne) var(--courbe-standard); }
  .barre-fond.ouvert { opacity: 1; pointer-events: auto; }
  html.tiroir-nav-ouvert, html.tiroir-nav-ouvert body { overflow: hidden; }
  .nav-indic { left: -16px; }
  .tete-mobile { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--space-2); min-height: var(--tete-h);
    padding: env(safe-area-inset-top, 0px) max(var(--marge), env(safe-area-inset-right, 0px)) 0 max(var(--marge), env(safe-area-inset-left, 0px));
    background: var(--surface); border-bottom: 1px solid var(--joint); }
  .bandeau { flex-wrap: wrap; }
  h1 { font-size: 24px; line-height: 30px; }
  .page-tete { grid-template-columns: minmax(0, 1fr); }
  .page-tete > .page-actions { justify-content: flex-start; }
  .section { margin-top: var(--space-8); }
  .toasts { left: var(--marge); right: var(--marge); bottom: calc(var(--space-3) + var(--onglets-h) + var(--sure-bas)); width: auto; }

  /* Tab bar: Bureau, À valider, Clients, and « Plus » for the drawer. */
  .onglets { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    padding: 0 env(safe-area-inset-right, 0px) var(--sure-bas) env(safe-area-inset-left, 0px);
    background: var(--surface); border-top: 1px solid var(--joint); }
  .onglets > a, .onglets > button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-width: 0; min-height: var(--onglets-h); padding: 8px 4px 6px; border: 0; background: transparent; color: var(--schiste);
    font: inherit; font-size: 12px; line-height: 16px; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: color var(--duree-rapide) var(--courbe-standard), background-color var(--duree-rapide) var(--courbe-standard);
  }
  .onglets .ico { width: 22px; height: 22px; transition: transform 180ms var(--courbe-rebond); }
  .onglet-lib { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .onglets > a:hover, .onglets > button:hover { color: var(--granit); background: var(--calcaire); text-decoration: none; }
  .onglets > a:active .ico, .onglets > button:active .ico { transform: scale(0.9); transition-duration: var(--duree-instant); }
  .onglets > a:focus-visible, .onglets > button:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: -4px; border-radius: var(--radius-sm); }
  .onglets > [aria-current="page"], .onglets > .actif { color: var(--lapis); }
  .onglets > [aria-current="page"]::before, .onglets > .actif::before { content: ""; position: absolute; top: -1px; left: 50%; width: 28px; height: 3px;
    margin-left: -14px; background: var(--lapis); }
  .onglets > [aria-expanded="true"] { color: var(--lapis); }
  .onglet-compte { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex;
    align-items: center; justify-content: center; border-radius: var(--radius-xs); box-shadow: 0 0 0 2px var(--surface);
    font-family: var(--font-mono); font-size: 11px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums;
    background: var(--alerte-voile); color: var(--alerte); }
  .onglet-compte.erreur { background: var(--erreur-voile); color: var(--erreur); }
}
@media (max-width: 640px) {
  .etage { grid-template-columns: minmax(0, 1fr); }
  .equipe[data-equipe], .equipe[data-equipe="redaction"], .equipe[data-equipe="veille"],
  .equipe[data-equipe="pilotage"] { grid-column: span 1; }
  .equipe-agents { grid-template-columns: minmax(0, 1fr); }
  .agent { min-height: 0; }
  .bureau-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bureau-chiffres .attend, .bureau-chiffres > :last-child { grid-column: 1 / -1; }
  .chiffre { padding: var(--space-4); }
  .chiffre-valeur { font-size: 28px; line-height: 34px; }
  .etapes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .etape-valeur { font-size: 24px; line-height: 30px; }
  .lettre-tete, .lettre-corps, .lettre-controles, .lettre-actions, .lettre-edition, .refus { padding-left: var(--space-4); padding-right: var(--space-4); }
  .lettre-actions { position: sticky; bottom: calc(var(--onglets-h) + var(--sure-bas)); background: var(--surface); z-index: 5; }
  .lettre-actions .btn { flex: 1 1 auto; }
  .lettre-actions .espace { display: none; }
  .raccourcis { display: none; }
  .carte { padding: var(--space-4); }
  .grille-champs { grid-template-columns: minmax(0, 1fr); }
  .grille-champs .large { grid-column: auto; }
  .masque-mobile { display: none; }
  /* Segments: one row that scrolls sideways; an edge fades where more choices hide (classes set by app.js). */
  .segments { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-padding: 0 24px; }
  .segments::-webkit-scrollbar { display: none; }
  .segments button { flex: none; }
  .segments.suite-droite { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .segments.suite-gauche { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
  .segments.suite-gauche.suite-droite { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
  .mode-choix { grid-template-columns: minmax(0, 1fr); }
  .journal-ligne { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .fil li { grid-template-columns: 54px minmax(0, 1fr); padding: var(--space-3); }
  .tiroir-corps { padding: var(--space-4); }
  .tiroir-tete { padding: var(--space-4); }
  .sig-ligne { grid-template-columns: minmax(0, 1fr); }
  .barre-ligne { grid-template-columns: minmax(80px, 38%) minmax(0, 1fr) 44px; }
  /* Folding tables: each row becomes a card, the first cell as its title,
     the others in pairs under their column's name (data-lib, set by app.js). */
  table.repliable thead { display: none; }
  table.repliable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3) var(--space-4);
    padding: var(--space-4); border-bottom: 1px solid var(--joint); }
  table.repliable tr:last-child { border-bottom: 0; }
  table.repliable td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  table.repliable td:first-child { grid-column: 1 / -1; font-size: 15px; }
  table.repliable td.num { text-align: left; }
  table.repliable td.cache-mobile { display: none; }
  table.repliable td.pleine { grid-column: 1 / -1; }
  table.repliable td:not(:first-child)[data-lib]:not([data-lib=""])::before { content: attr(data-lib); display: block; margin-bottom: 2px;
    font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--schiste); }
  table.repliable td:empty, table.repliable td[data-vide] { display: none; }
  /* Filters: the search on its own row, the choices two by two. */
  .filtres .champ { flex: 1 1 140px; }
  .filtres .champ.large { flex-basis: 100%; }
}
/* Touch screens: every target is 44 px at least (WCAG 2.5.5, charte). */
@media (pointer: coarse) {
  .btn kbd, .raccourcis { display: none; }
  .btn, .btn-sm { min-height: 44px; }
  .btn-icone, .btn-sm.btn-icone { width: 44px; min-width: 44px; }
  .nav a { min-height: 44px; }
  .segments button { min-height: 44px; }
  .input, select.input { min-height: 44px; }
  .coche { min-height: 44px; }
  #logo-lien { display: inline-flex; align-items: center; min-height: 44px; }
  .puce { min-height: 44px; }
  .puce button { flex: none; width: 44px; height: 44px; }
  .page-tete > .page-actions > .btn-sm { min-height: 44px; }
  /* A link standing alone (not inside a sentence) gets a full-height target. */
  a.lien-cible { display: inline-flex; align-items: center; min-height: 44px; }
  .jours label { min-height: 44px; }
  .toast-fermer { width: 44px; height: 44px; }
  .toast .toast-action { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .btn:active, .nav a:active, .segments button:active, .mode-option:active, .source:active { transform: none; }
  .flux-trait::before { animation: none; transform: none; width: 100%; opacity: 0.5; }
  .agent[data-statut="travaille"] .badge-point, .pastille.vivante, .squelette { animation: none; }
  .squelette::after { display: none; }
  .toast, .toast > *, .menu-flottant, .piste::after, .mode-interrupteur { transition: none !important; }
  .mode-point::after, .verif, .palette[open] { animation: none !important; }
  .mode-interrupteur:active, .moi-bouton:active, .menu-item:active, .recherche-palette:active, .palette-option:active { transform: none; }
  .agent.vient-de-bouger::after { opacity: 0; }
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

@media (forced-colors: active) {
  .badge-point, .pastille, .meter > span, .barre-piste > span, .colonne > .col-barre { forced-color-adjust: none; background: CanvasText; }
}

details.carte > summary { cursor: pointer; display: list-item; min-height: 32px; padding: 4px 0; }
details.carte > summary:hover b { color: var(--lapis); }
details.carte[open] > summary { margin-bottom: var(--space-2); }

/* ══════════════════════════════════════════════════════════════
   Comptes, rôles, mise en ligne, palette (20/10/2026)
   ══════════════════════════════════════════════════════════════ */

/* ── Roles: comfort only, the server checks every route ──────── */

body[data-role="observateur"] [data-ecrire] { display: none !important; }
body:not([data-role="admin"]) [data-admin] { display: none !important; }

.bandeau.neutre { background: var(--pierre); color: var(--granit); }
.bandeau.neutre .ico { color: var(--schiste); }

/* ── Page transitions (View Transitions API) ─────────────────── */

.vt-en-cours #contenu { view-transition-name: contenu; }
.vt-en-cours .nav-indic { view-transition-name: nav-indic; }
::view-transition-group(root) { animation-duration: 180ms; animation-timing-function: var(--courbe-standard); }
::view-transition-old(contenu) { animation: vt-sort 140ms var(--courbe-sortie) both; }
::view-transition-new(contenu) { animation: vt-entre 300ms var(--courbe-entree) 40ms both; }
::view-transition-group(nav-indic) { animation-duration: 280ms; animation-timing-function: var(--courbe-entree); }
@keyframes vt-sort { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-entre { from { opacity: 0; transform: translateY(8px); } }

/* ── Sidebar: search, account ────────────────────────────────── */

.recherche-palette {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 40px; padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--joint); border-radius: var(--radius-sm); background: var(--calcaire); color: var(--schiste);
  font: inherit; font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--duree-rapide) var(--courbe-standard), color var(--duree-rapide) var(--courbe-standard),
    background-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond);
}
.recherche-palette .ico { width: 16px; height: 16px; }
.recherche-palette:hover { border-color: var(--joint-fort); color: var(--granit); background: var(--surface); }
.recherche-palette:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.recherche-palette-texte { flex: 1; text-align: left; }
.raccourci-palette { min-width: 0; height: 20px; padding: 0 6px; font-size: 11px; letter-spacing: 0.02em; background: var(--surface); border-color: var(--joint); border-bottom-width: 1px; }

.moi:empty { display: none; }
.moi-bouton {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 52px; padding: var(--space-2);
  border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--granit); font: inherit; text-align: left;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--duree-rapide) var(--courbe-standard), border-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond);
}
.moi-bouton:hover, .moi-bouton[aria-expanded="true"] { background: var(--pierre); }
.moi-bouton[aria-expanded="true"] { border-color: var(--joint); }
.moi-bouton:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.moi-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.moi-nom { font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.moi-role { font-size: 12px; line-height: 16px; color: var(--schiste); }
.moi-chevron { color: var(--schiste); }

/* A person as a dressed stone, chamfered corners, with their initials. */
.avatar {
  --taille: 32px; --av-a: var(--pierre); --av-b: var(--joint);
  width: var(--taille); height: var(--taille); flex: none; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-titre); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; line-height: 1; color: var(--granit);
  background: linear-gradient(155deg, var(--av-a) 0%, var(--av-b) 100%);
  clip-path: polygon(14% 0, 86% 0, 100% 14%, 100% 86%, 86% 100%, 14% 100%, 0 86%, 0 14%);
}
.avatar[data-ton="1"] { --av-a: color-mix(in srgb, var(--pierre) 55%, var(--alerte-voile)); --av-b: color-mix(in srgb, var(--joint) 65%, var(--alerte-voile)); }
.avatar[data-ton="2"] { --av-a: color-mix(in srgb, var(--pierre) 55%, var(--lapis-voile)); --av-b: color-mix(in srgb, var(--joint) 65%, var(--lapis-voile)); }
.avatar-lg { --taille: 40px; font-size: 13px; }
.avatar-sm { --taille: 24px; font-size: 9px; }

/* ── Floating menu (menu button pattern) ─────────────────────── */

.menu-flottant {
  position: fixed; z-index: 85; min-width: 232px; max-width: calc(100vw - 16px); padding: 6px; background: var(--surface);
  border: 1px solid var(--joint); border-radius: var(--radius-md); box-shadow: var(--ombre-flottante);
  animation: menu-entre 160ms var(--courbe-entree);
}
.menu-flottant.depuis-bas { transform-origin: 20% 100%; }
.menu-flottant.depuis-haut { transform-origin: 20% 0; }
.menu-flottant.sort { animation: menu-sort 120ms var(--courbe-sortie) forwards; pointer-events: none; }
@keyframes menu-entre { from { opacity: 0; transform: scale(0.96); } }
@keyframes menu-sort { to { opacity: 0; transform: scale(0.97); } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--granit); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: background-color var(--duree-instant) var(--courbe-standard), transform 180ms var(--courbe-rebond);
}
.menu-item:hover, .menu-item:focus { background: var(--pierre); outline: none; }
.menu-item:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: -2px; }
.menu-item:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.menu-item .ico { color: var(--schiste); }
.menu-item.danger, .menu-item.danger .ico { color: var(--erreur); }
.menu-item.danger:hover, .menu-item.danger:focus { background: var(--erreur-voile); }
.menu-libelle { flex: 1; }
.menu-coche { visibility: hidden; }
.menu-item[aria-checked="true"] .menu-coche { visibility: visible; color: var(--lapis); }
.menu-item kbd { font-size: 10px; height: 18px; }
.menu-filet { height: 1px; margin: 6px -6px; background: var(--joint); }
.menu-titre { padding: 8px 10px 4px; font-size: 11px; line-height: 16px; }

/* ── Mode switch « Essai / En ligne » ────────────────────────── */

.mode-interrupteur, .mode-pastille {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 52px; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--joint); border-radius: var(--radius-md); background: var(--calcaire); color: var(--granit); font: inherit; text-align: left;
}
.mode-interrupteur { cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: border-color var(--duree-rapide) var(--courbe-standard), background-color var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.mode-interrupteur:hover { border-color: var(--joint-fort); background: var(--surface); }
.mode-interrupteur:active { transform: scale(0.98); transition-duration: var(--duree-instant); }
.mode-interrupteur[aria-busy="true"] { cursor: progress; }
.mode-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mode-etat { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 600; }
.mode-sous { font-size: 12px; line-height: 16px; color: var(--schiste); }
.mode-point { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--joint-fort); }
.en-ligne .mode-point { background: var(--succes); }
.en-ligne .mode-point::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--succes); opacity: 0;
  animation: onde 2.4s var(--courbe-sortie) infinite; }
@keyframes onde { 0% { transform: scale(0.4); opacity: 0.7; } 70%, 100% { transform: scale(1.4); opacity: 0; } }
.piste { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; background: var(--joint-fort);
  transition: background-color var(--duree-base) var(--courbe-standard); }
.piste::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--ombre-pose); transition: transform 280ms var(--courbe-rebond); }
[role="switch"][aria-checked="true"] .piste { background: var(--lapis); }
[role="switch"][aria-checked="true"] .piste::after { transform: translateX(16px); }
.mode-pastille { cursor: default; }
.mode-mobile:empty { display: none; }
.mode-mobile > .badge { min-height: 28px; }
.mode-mobile .badge { gap: 6px; }
.mode-mobile.en-ligne .mode-point { background: var(--succes); }

/* ── Mise en ligne: checks, hold to confirm ──────────────────── */

.verifs-resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }
.verifs-resume .compte { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--schiste); }
.verifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--joint); border-radius: var(--radius-md); overflow: hidden; }
.verif { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 2px var(--space-3); align-items: start; padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--joint); background: var(--surface); animation: verif-entre 260ms var(--courbe-entree) both; animation-delay: calc(var(--i, 0) * 35ms); }
.verif:first-child { border-top: 0; }
@keyframes verif-entre { from { opacity: 0; transform: translateY(4px); } }
.verif > .ico { margin-top: 2px; color: var(--succes); }
.verif.ko > .ico { color: var(--erreur); }
.verif.ko.leger > .ico { color: var(--alerte); }
.verif.ko { background: color-mix(in srgb, var(--erreur-voile) 45%, var(--surface)); }
.verif.ko.leger { background: color-mix(in srgb, var(--alerte-voile) 45%, var(--surface)); }
.verif-lib { font-size: 14px; line-height: 20px; font-weight: 600; }
.verif-detail { grid-column: 2 / -1; font-size: 13px; line-height: 18px; color: var(--schiste); overflow-wrap: anywhere; }
.verif .badge { font-size: 12px; line-height: 18px; }
.manque { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border: 1px solid var(--erreur); border-radius: var(--radius-md);
  background: var(--erreur-voile); color: var(--erreur); font-size: 14px; line-height: 20px; }
.manque ul { margin: 0; padding-left: var(--space-5); color: var(--granit); }
.manque li + li { margin-top: 4px; }

.maintenir {
  position: relative; overflow: hidden; width: 100%; min-height: 56px; gap: var(--space-3); font-size: 16px;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.maintenir::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--sur-lapis) 16%, transparent);
  transform: scaleX(var(--p, 0)); transform-origin: left; }
.mel-maintien { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.maintenir > * { position: relative; }
.maintenir-anneau { width: 28px; height: 28px; flex: none; transform: rotate(-90deg); }
.maintenir-anneau circle { fill: none; stroke-width: 3; }
.maintenir-anneau .fond { stroke: color-mix(in srgb, var(--sur-lapis) 32%, transparent); }
/* The one touch of gold on this screen: the ring that fills while you hold. */
.maintenir-anneau .progres { stroke: var(--pyrite); stroke-linecap: round; stroke-dasharray: 69.12; stroke-dashoffset: calc(69.12px * (1 - var(--p, 0))); }
.maintenir.tient { transform: scale(0.985); }
.maintenir-aide { font-size: 13px; line-height: 18px; color: var(--schiste); text-align: center; }
.maintenir-aide.trop-tot { color: var(--alerte); font-weight: 500; }
.mel-date { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
.mel-date .input { max-width: 240px; }
.mel-succes { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-2) 0 var(--space-4); text-align: center; }
.mel-anim { width: 168px; height: 168px; display: grid; place-items: center; }
.mel-anim > .ico { width: 64px; height: 64px; color: var(--succes); stroke-width: 1.5; }
.mel-succes h3 { font-family: var(--font-titre); font-size: 22px; line-height: 28px; font-weight: 800; letter-spacing: -0.015em; }
.mel-succes p { color: var(--schiste); max-width: 46ch; }

/* ── Command palette (APG combobox + listbox) ────────────────── */

dialog.palette { width: min(640px, calc(100vw - 24px)); max-height: min(580px, 78dvh); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--joint); border-radius: var(--radius-lg); background: var(--surface); color: var(--granit); box-shadow: var(--ombre-modale); overflow: hidden; }
dialog.palette[open] { display: flex; flex-direction: column; animation: palette-entre 200ms var(--courbe-entree); }
dialog.palette.sort { animation: palette-sort 120ms var(--courbe-sortie) forwards; }
dialog.palette::backdrop { background: color-mix(in srgb, var(--voile-fond) 70%, transparent); backdrop-filter: blur(2px); }
@keyframes palette-entre { from { opacity: 0; transform: translateY(-6px) scale(0.985); } }
@keyframes palette-sort { to { opacity: 0; transform: scale(0.985); } }
.palette-champ { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); border-bottom: 1px solid var(--joint);
  transition: border-color var(--duree-rapide) var(--courbe-standard); }
.palette-champ:focus-within { border-bottom-color: var(--lapis); }
.palette-champ > .ico { color: var(--schiste); }
.palette-champ input { flex: 1; min-width: 0; min-height: 56px; border: 0; background: transparent; color: var(--granit); font: inherit; font-size: 17px; outline: none; }
.palette-champ input::placeholder { color: var(--schiste); opacity: 1; }
.palette-champ input::-webkit-search-cancel-button { display: none; }
.palette-champ kbd { flex: none; }
.palette-liste { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px; scroll-padding: 6px; }
.palette-groupe + .palette-groupe { margin-top: 4px; }
.palette-groupe-titre { padding: 10px 10px 4px; font-size: 11px; line-height: 16px; }
.palette-option { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 10px 0 12px;
  border-radius: var(--radius-sm); color: var(--granit); cursor: pointer; transition: background-color var(--duree-instant) var(--courbe-standard); }
.palette-option > .ico { color: var(--schiste); }
.palette-option:hover { background: var(--pierre); }
.palette-option[aria-selected="true"] { background: var(--lapis-voile); }
.palette-option[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; background: var(--lapis); border-radius: 0 2px 2px 0; }
.palette-option[aria-selected="true"] > .ico { color: var(--lapis); }
.palette-option:active { transform: scale(0.99); }
.palette-textes { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--space-3); }
.palette-lib { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.palette-lib mark { background: transparent; color: var(--lapis); font-weight: 600; }
.palette-sous { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--schiste); }
.palette-entree { flex: none; display: none; color: var(--schiste); }
.palette-option[aria-selected="true"] .palette-entree { display: inline-flex; }
.palette-etat { padding: var(--space-6) var(--space-4); text-align: center; color: var(--schiste); font-size: 14px; }
.palette-pied { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--joint);
  background: color-mix(in srgb, var(--pierre) 45%, var(--surface)); font-size: 12px; line-height: 20px; color: var(--schiste); }
.palette-pied span { display: inline-flex; align-items: center; gap: 6px; }
.palette-pied kbd { height: 18px; min-width: 18px; font-size: 10px; }

/* ── Responsive and touch for the new pieces ─────────────────── */

@media (max-width: 900px) {
  .mode-mobile { display: inline-flex; flex: none; }
}
.mode-mobile-bouton { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: var(--radius-sm); }
.mode-mobile-bouton .badge { min-height: 28px; transition: filter var(--duree-rapide) var(--courbe-standard), transform 180ms var(--courbe-rebond); }
.mode-mobile-bouton:hover .badge { filter: brightness(0.96); }
.mode-mobile-bouton:active .badge { transform: scale(0.95); transition-duration: var(--duree-instant); }
.mode-mobile-bouton:focus-visible { outline: 2px solid var(--anneau-focus); outline-offset: 0; }
/* Very narrow phones: the mode keeps its dot, its word goes (still read aloud). */
@media (max-width: 360px) {
  .etroit-masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mode-mobile .badge { min-width: 28px; justify-content: center; padding: 0; }
}
@media (max-width: 640px) {
  .tiroir { border-radius: 0; }
  .vide { padding: var(--space-6) var(--space-4); }
  .vide-anim { width: 104px; height: 88px; }
  .etat-erreur { padding: var(--space-4); gap: var(--space-3); }
  .etat-erreur-ico { width: 32px; height: 32px; }
  dialog.palette { margin-top: 8px; max-height: calc(100dvh - 16px); width: calc(100vw - 16px); }
  .palette-textes { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0; }
  .palette-sous { max-width: none; font-size: 12px; line-height: 16px; }
  .palette-pied { display: none; }
  .page-tete h1 { font-size: 26px; line-height: 32px; letter-spacing: -0.02em; }
  .page-tete { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-6); padding-bottom: var(--space-5); }
  .page-tete p.chapo { font-size: 15px; line-height: 24px; }
  .page-tete > .page-actions { justify-content: stretch; padding-bottom: 0; }
  .page-tete > .page-actions > * { flex: 1 1 auto; }
  .page-tete > .page-actions > .btn-primaire { order: -1; flex-basis: 100%; }
  .dialogue-tete, .dialogue-corps, .dialogue-pied { padding-left: var(--space-4); padding-right: var(--space-4); }
  .dialogue-pied .btn { flex: 1 1 auto; }
}
@media (pointer: coarse) {
  .recherche-palette { min-height: 44px; }
  .menu-item { min-height: 44px; }
  .raccourci-palette, .palette-pied { display: none; }
  .palette-option { min-height: 48px; }
}
@media (forced-colors: active) {
  .avatar { forced-color-adjust: none; background: Canvas; color: CanvasText; outline: 1px solid CanvasText; }
  .piste { forced-color-adjust: none; background: GrayText; }
  [role="switch"][aria-checked="true"] .piste { background: Highlight; }
  .nav-indic { forced-color-adjust: none; background: Highlight; }
}

/* Late touch rules, after the components they size. */
@media (pointer: coarse) {
  details.carte > summary, details.aide-q summary { min-height: 44px; padding-top: 10px; padding-bottom: 10px; }
}
