/* Hallmark · checked: 2026-11-27 · shape: app screen · direction: B Instrument · modes: light+dark */
/* =====================================================================================================================
   Studio : feuille de style commune. Refonte « Instrument » (direction B, 27/11/2026 ; voir JOURNAL-DEV.md).
   Lire cet en-tête avant de toucher un onglet : tout nouvel écran utilise ces jetons et ces composants, rien d'autre.

   PRINCIPES
   - Précis et dense : panneaux nets, filets de 1 px, aucune ombre hors surimpressions (dialogues, menus, toast).
   - La couleur est réservée au sens : accent sarcelle = action ou sélection ; ambre (attn) = attente, à décider ;
     vert (ok), rouge (ko). Jamais de couleur décorative, jamais de bordure de côté épaisse, pas de dégradé.
   - Libellés en casse normale (pas de capitales espacées). Chiffres de mesure (durées, montants, heures, quotas) en
     IBM Plex Mono tabulaire (.num), le reste en IBM Plex Sans. Polices auto-hébergées (web/fonts/, licence OFL.txt).
   - Icônes : web/icons.js (sprite SVG, trait 1,5 px, currentColor). Jamais d'emoji comme icône.
   - Thème : data-theme="light" | "dark" posé sur <html> par theme.js avant le premier rendu (pas de flash) ; sans
     attribut, le thème du système (bloc prefers-color-scheme plus bas). Les deux blocs sombres doivent rester identiques.
   - Contrastes vérifiés (≥ 4,5:1 pour le texte) : ink, ink-2, ink-3 sur canvas, panel, rail, sunk ; accent-ink sur accent ;
     accent-text, attn, ok, ko sur panel, canvas et sur leur fond « -soft ».

   JETONS
   Couleurs   --canvas (fond de page) --panel (surface) --rail (navigation) --sunk (creux, en-têtes de table) --hover
              --ink (texte) --ink-2 (secondaire) --ink-3 (méta, placeholders) --rule --rule-2 (filets)
              --accent --accent-ink (texte sur accent) --accent-soft (fond sélection) --accent-text (lien, texte accent)
              --attn --attn-fill --attn-soft (à décider) ; --ok --ok-fill --ok-soft ; --ko --ko-soft ; --plan (prévu, neutre)
              --me (bulle de Rym) --media --media-ink (lecteur vidéo) --focus
   Séries     --series-1 bleu (Claude, abonnements) · --series-2 magenta (dépenses à l'usage) · --series-3 violet :
              couleurs catégorielles des graphiques et jauges à plusieurs segments, ordre fixe, hors accent et
              hors couleurs d'état. Validées (paires adjacentes, daltonismes, contraste ≥ 3:1 sur panel, clair et sombre).
              Légende : .swatch.s1 .s2 .s3 ; segment de jauge : .meter-fill.s1 .s2 .s3.
   Texte      6 tailles par rôle : --t-meta 12 px (méta, compteurs, en-têtes de table) · --t-small 13 px (secondaire,
              navigation, tables) · --t-body 15 px (courant) · --t-title 18 px (titre de panneau) · --t-screen 22 px
              (titre d'écran) · --t-figure 26 px (chiffre d'une tuile). Graisses 400, 500, 600 seulement.
   Espaces    --s1 4 · --s2 8 · --s3 12 · --s4 16 · --s5 20 · --s6 24 · --s7 32 · --s8 48 (px)
   Rayons     --r-ctl 4 px (contrôles, badges) · --r-box 6 px (panneaux, dialogues) · --r-round (pastilles, voyants)
   Ombres     --shadow-pop (dialogues, menus, toast) seulement ; les cartes n'ont pas d'ombre.
   Contrôles  --h-ctl 32 px sur PC ; 44 px sous 960 px (cibles tactiles)

   COMPOSANTS (classes à utiliser)
   Bouton      <button> = primaire ; .secondary = secondaire (bordure) ; .quiet = discret (sans fond) ; .danger ;
               .icon-btn = carré, icône seule (aria-label obligatoire) ; .linklike = lien dans le texte ; a.button-link.
               Icône dans un bouton : ${icon('check')} avant le libellé.
   Badge       .pill = badge d'état ou fait court (rectangle 20 px, pas de pilule décorative) ; variantes .is-ok .is-attn
               .is-ko .is-accent (les anciennes .lvl-*, .busy restent reconnues) ; .pill.is-wrap = texte long qui passe à
               la ligne. Icône dans un badge : ${icon('clock')} avant le texte. .badge = compteur rond (non-lus).
   Tableau     <table class="table"> (ou tout table) ; th en --t-meta, police d'interface (th.num aussi : seules les
               valeurs sont en mono) ; td.num = chiffres à droite, tabulaires ; conteneur .table-wrap pour défiler
               horizontalement sur téléphone.
   Liste       <ul class="list"> > li.list-row ; .list-main (titre .list-title + .list-sub) ; .list-aside (droite) ;
               .list-meta (heure, mono). Filets entre lignes, pas de cartes.
   Carte       .card = panneau (fond panel, filet, rayon box) ; .card-head (titre h2 + actions ou .pill) ; .card-body.
               JAMAIS de carte dans une carte : à l'intérieur, utiliser .list, .table, .kv ou des sections à filet.
   Clé-valeur  <dl class="kv"><dt>…</dt><dd>…</dd></dl> (valeurs alignées à droite).
   Champ       .field > label + input|select|textarea + .field-help + .field-error ; .field.has-error. Les contrôles
               nus (input, select, textarea) ont déjà le style commun.
   Tuile       .stat > .stat-label + .stat-value (mono, --t-figure) + .stat-sub ; grille .stats.
   État vide   .empty-state > .empty-icon (icône SVG) + h3 + p.muted + bouton éventuel ; .empty-state.small.
   Texte       .muted (ink-3) .subtle (ink-2) .num (mesure) .error .warn .ok ; .sr-only.
   En-tête     .screen-head > .screen-head-text (h1 en --t-screen + p, phrase de sous-titre en --t-small) + actions à droite
   d'écran     (bouton, .segmented). Un par onglet, en tête de section.tab (sauf la Discussion, qui est un fil plein cadre).
   Jauge       .meter (role="meter" ou "img" + aria-label) > .meter-fill[data-w] (un ou plusieurs segments, largeur en % dans
               data-w, posée par app.js : CSP sans style en ligne) ; couleurs .is-ok .is-attn .is-ko .is-accent .is-neutral
               ou séries .s1 .s2 .s3 ; .meter-mark[data-w] = trait d'un seuil ou d'un plafond ; .meter-lg (14 px) ;
               .meter.is-off (journée indisponible : fond vide, filet).
   Segmenté    .segmented = choix exclusif (période, thème) : soit des <button aria-pressed>, soit un <fieldset> de
               <label><input type="radio"><span>…</span></label> (legend lue par les lecteurs d'écran seulement).
   Coquille    header.rail (rail PC / barre du haut mobile), nav button[data-tab], #nav-more, main > .tab.
   ===================================================================================================================== */
:root {
  --canvas: #f2f3f5; --panel: #ffffff; --rail: #e8eaee; --sunk: #eceef1; --hover: #dfe2e7;
  --ink: #14171c; --ink-2: #4d5562; --ink-3: #5f6774;
  --rule: #d8dce2; --rule-2: #c5cbd3;
  --accent: #0b6b6b; --accent-ink: #ffffff; --accent-soft: #dcefee; --accent-text: #0a5f5f;
  --attn: #8f4504; --attn-fill: #e8892a; --attn-soft: #fbeedd;
  --ok: #1d7448; --ok-fill: #2f9a62; --ok-soft: #e0f1e7; --ko: #b42318; --ko-soft: #fbe3e0;
  --plan: #9aa3af; --me: #e6eef0; --media: #1b1f25; --media-ink: #f2f3f5; --focus: #0b6b6b;
  --mark: #fde7a6; --mark-text: #14171c; --scrim: rgb(10 12 15 / .45);
  --shadow-pop: 0 1px 2px rgb(20 23 28 / .06), 0 12px 32px -8px rgb(20 23 28 / .22);
  --font-ui: "IBM Plex Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-meta: .75rem; --t-small: .8125rem; --t-body: .9375rem; --t-title: 1.125rem; --t-screen: 1.375rem; --t-figure: 1.625rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;
  --r-ctl: 4px; --r-box: 6px; --r-round: 999px;
  --h-ctl: 32px; --rail-w: 232px; --bar-h: 56px;
  --series-1: #2a78d6; --series-2: #d55181; --series-3: #6250d6;
  color-scheme: light;
}
/* Sombre imposé (data-theme="dark") : même bloc que celui du thème automatique plus bas. */
:root[data-theme="dark"] {
  --canvas: #0f1216; --panel: #161a20; --rail: #12151a; --sunk: #1b2027; --hover: #222831;
  --ink: #e6e9ee; --ink-2: #a3acb8; --ink-3: #8a93a0;
  --rule: #262c35; --rule-2: #343c47;
  --accent: #4fb8b3; --accent-ink: #0b1414; --accent-soft: #15302f; --accent-text: #6fcbc6;
  --attn: #f0a54a; --attn-fill: #d9822b; --attn-soft: #33250f;
  --ok: #5cc48a; --ok-fill: #3e9e68; --ok-soft: #142a1e; --ko: #f07a6e; --ko-soft: #3a1c19;
  --plan: #4a5361; --me: #18282b; --media: #07090b; --media-ink: #f2f3f5; --focus: #6fcbc6;
  --mark: #6b4a12; --mark-text: #fff3d6; --scrim: rgb(0 0 0 / .6);
  --shadow-pop: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -8px rgb(0 0 0 / .6);
  --series-1: #3987e5; --series-2: #d55181; --series-3: #9085e9;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0f1216; --panel: #161a20; --rail: #12151a; --sunk: #1b2027; --hover: #222831;
    --ink: #e6e9ee; --ink-2: #a3acb8; --ink-3: #8a93a0;
    --rule: #262c35; --rule-2: #343c47;
    --accent: #4fb8b3; --accent-ink: #0b1414; --accent-soft: #15302f; --accent-text: #6fcbc6;
    --attn: #f0a54a; --attn-fill: #d9822b; --attn-soft: #33250f;
    --ok: #5cc48a; --ok-fill: #3e9e68; --ok-soft: #142a1e; --ko: #f07a6e; --ko-soft: #3a1c19;
    --plan: #4a5361; --me: #18282b; --media: #07090b; --media-ink: #f2f3f5; --focus: #6fcbc6;
    --mark: #6b4a12; --mark-text: #fff3d6; --scrim: rgb(0 0 0 / .6);
    --shadow-pop: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -8px rgb(0 0 0 / .6);
    --series-1: #3987e5; --series-2: #d55181; --series-3: #9085e9;
    color-scheme: dark;
  }
}

/* Polices auto-hébergées (IBM Plex 1.1.0, npm @ibm/plex-sans et @ibm/plex-mono, licence SIL OFL 1.1 : fonts/OFL.txt).
   Sous-ensembles officiels « Latin1 » (français complet, €, guillemets, tirets) et « Pi » (espaces fines, flèches). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Regular-Latin1.woff2") format("woff2"); unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Regular-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Italic-Latin1.woff2") format("woff2"); unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexSans-Italic-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexSans-Medium-Latin1.woff2") format("woff2"); unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/IBMPlexSans-Medium-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("fonts/IBMPlexSans-SemiBold-Latin1.woff2") format("woff2"); unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600 700; font-display: swap; src: url("fonts/IBMPlexSans-SemiBold-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2015, U+2028-2029, U+202F, U+2032-2033, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+25CA, U+2713, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular-Latin1.woff2") format("woff2"); unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/IBMPlexMono-Regular-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2028-2029, U+202F, U+2032-2033, U+205F, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+2500-259F, U+25CA, U+2713, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2"); unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500 700; font-display: swap; src: url("fonts/IBMPlexMono-Medium-Pi.woff2") format("woff2"); unicode-range: U+2000-200D, U+2028-2029, U+202F, U+2032-2033, U+205F, U+2070, U+2074-2079, U+2080-2089, U+2190-2199, U+2248, U+2260, U+2264-2265, U+2500-259F, U+25CA, U+2713, U+FEFF, U+FFFD; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--rule-2) transparent; overflow-x: clip; }
body { margin: 0; overflow-x: clip; background: var(--canvas); color: var(--ink); font: 400 var(--t-body)/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0 0 var(--s2); font-weight: 600; line-height: 1.25; text-wrap: balance; }
h1 { font-size: var(--t-screen); letter-spacing: -.01em; } h2 { font-size: var(--t-title); } h3 { font-size: var(--t-body); }
p { text-wrap: pretty; }
a { color: var(--accent-text); text-underline-offset: 2px; }
.muted { color: var(--ink-3); } .subtle { color: var(--ink-2); } .error { color: var(--ko); } .warn { color: var(--attn); } .ok { color: var(--ok); }
.num, time, kbd, .mono { font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .93em; letter-spacing: -.01em; white-space: nowrap; }
code, pre, .mono { font-family: var(--font-num); }
code { background: var(--sunk); padding: .05rem .3rem; border-radius: var(--r-ctl); font-size: .88em; }
pre { white-space: pre-wrap; overflow-x: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Icônes (web/icons.js) */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
svg.i.i-lg { width: 20px; height: 20px; }
svg.i.i-xl { width: 24px; height: 24px; }

/* ---------- Boutons ---------- */
button, .btn, a.button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--h-ctl);
  padding: 0 var(--s3); border: 1px solid var(--accent); border-radius: var(--r-ctl); background: var(--accent); color: var(--accent-ink);
  font: 500 var(--t-small)/1.2 var(--font-ui); text-decoration: none; cursor: pointer; white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(1.08); }
button:active, .btn:active { filter: brightness(.95); }
button:disabled, .btn[aria-disabled="true"] { background: var(--sunk); color: var(--ink-3); border-color: transparent; cursor: not-allowed; filter: none; }
button.secondary, .btn.secondary, a.button-link.secondary { background: var(--panel); color: var(--ink); border-color: var(--rule-2); }
button.secondary:hover, .btn.secondary:hover, a.button-link.secondary:hover { background: var(--sunk); filter: none; }
button.quiet, .btn.quiet { background: transparent; color: var(--ink-2); border-color: transparent; }
button.quiet:hover, .btn.quiet:hover { background: var(--hover); color: var(--ink); filter: none; }
button.danger, .btn.danger { background: var(--panel); color: var(--ko); border-color: var(--ko); }
button.icon-btn, .btn.icon-btn { width: var(--h-ctl); padding: 0; background: transparent; color: var(--ink-2); border-color: transparent; }
button.icon-btn:hover { background: var(--hover); color: var(--ink); filter: none; }
button.linklike, #tab-system button.linklike { display: inline; min-height: 0; margin: 0; padding: 0; background: none; border: 0; color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; font: inherit; white-space: normal; }
button.linklike:hover { filter: none; }

/* ---------- Champs de formulaire ---------- */
input, textarea, select { width: 100%; min-height: var(--h-ctl); background: var(--panel); color: var(--ink); border: 1px solid var(--rule-2); border-radius: var(--r-ctl); padding: var(--s1) var(--s3); font: inherit; font-size: var(--t-body); caret-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
.field { min-width: 0; display: flex; flex-direction: column; gap: var(--s1); }
.field > label, .field-label { font-size: var(--t-small); font-weight: 500; color: var(--ink-2); }
.field-help { margin: 0; font-size: var(--t-meta); color: var(--ink-3); }
.field-error { margin: 0; font-size: var(--t-small); color: var(--ko); overflow-wrap: anywhere; }

/* ---------- Badges d'état et compteurs ---------- */
.pill { display: inline-flex; align-items: center; gap: var(--s1); height: 20px; padding: 0 var(--s2); border: 0; border-radius: var(--r-ctl); background: var(--sunk); color: var(--ink-2); font-size: var(--t-meta); font-weight: 500; line-height: 1; white-space: nowrap; vertical-align: middle; }
.pill:empty { display: none; }
.pill.is-wrap { height: auto; min-height: 20px; padding-block: 2px; white-space: normal; line-height: 1.35; overflow-wrap: anywhere; }
.pill.is-ok, .pill.lvl-ok { background: var(--ok-soft); color: var(--ok); }
.pill.is-attn, .pill.lvl-warn { background: var(--attn-soft); color: var(--attn); }
.pill.is-ko, .pill.lvl-crit, .pill.warn-pill { background: var(--ko-soft); color: var(--ko); }
.pill.is-accent, .pill.busy { background: var(--accent-soft); color: var(--accent-text); }
.badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 var(--s1); border-radius: var(--r-round); background: var(--accent); color: var(--accent-ink); font: 600 11px/18px var(--font-ui); text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- Carte (panneau) ---------- */
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-box); padding: var(--s4); margin-bottom: var(--s4); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.card-head h2 { margin: 0; font-size: var(--t-body); }
.card-head select { width: auto; }
.card > h2 { font-size: var(--t-body); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.grid > .card { margin-bottom: 0; }

/* ---------- Tableau ---------- */
table { border-collapse: collapse; width: 100%; font-size: var(--t-small); font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: var(--t-meta); font-weight: 500; color: var(--ink-3); background: var(--sunk); }
tbody tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; }
th.num { font-family: var(--font-ui); font-size: var(--t-meta); letter-spacing: 0; }
.table-wrap { overflow-x: auto; min-width: 0; }

/* ---------- Liste ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--rule); min-width: 0; }
.list-row:first-child { border-top: 0; }
.list-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-title { display: block; font-weight: 600; }
.list-sub { display: block; color: var(--ink-2); font-size: var(--t-small); }
.list-meta { flex: none; color: var(--ink-3); font: 400 var(--t-meta) var(--font-num); padding-top: 2px; }
.list-aside { flex: none; display: flex; align-items: center; gap: var(--s2); }

/* ---------- Clé-valeur, tuiles de chiffres ---------- */
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s3); margin: 0; font-size: var(--t-small); }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-box); }
.stat-label { font-size: var(--t-small); color: var(--ink-2); }
.stat-value { font: 500 var(--t-figure)/1.15 var(--font-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: var(--t-meta); color: var(--ink-3); overflow-wrap: anywhere; }
.stat.is-attn .stat-value { color: var(--attn); } .stat.is-ok .stat-value { color: var(--ok); } .stat.is-ko .stat-value { color: var(--ko); }

/* ---------- État vide ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s1); padding: var(--s6) var(--s4); border: 1px dashed var(--rule-2); border-radius: var(--r-box); grid-column: 1 / -1; }
.empty-state h3 { margin: var(--s1) 0 0; font-size: var(--t-body); }
.empty-state p { max-width: 32rem; margin: 0 0 var(--s2); }
.empty-state.small { padding: var(--s4); }
.empty-icon { display: grid; place-items: center; color: var(--ink-3); }
.empty-icon svg.i { width: 24px; height: 24px; }

/* =====================================================================================================================
   Coquille : rail latéral (PC) ; barre du haut + barre d'onglets en bas (sous 960 px)
   ===================================================================================================================== */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.login .card { width: min(360px, 100%); display: grid; gap: var(--s3); padding: var(--s6); }
.login h1 { margin: 0; }
.login button { min-height: 40px; }

#app:not([hidden]) { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); height: 100vh; height: 100dvh; }
#app > .rail { grid-column: 1; grid-row: 1 / -1; }
#app > #config-banner { grid-column: 2; grid-row: 1; }
#app > #health-banner { grid-column: 2; grid-row: 2; }
#app > main { grid-column: 2; grid-row: 3; min-height: 0; overflow-y: auto; width: 100%; padding: var(--s6); }
.tab { display: none; max-width: 1240px; margin: 0 auto; } .tab.active { display: block; }

.rail { display: flex; flex-direction: column; gap: var(--s4); min-height: 0; overflow-y: auto; padding: var(--s4) var(--s3); background: var(--rail); border-right: 1px solid var(--rule); }
.rail-top { display: flex; flex-direction: column; gap: var(--s2); }
.brand { display: flex; align-items: baseline; gap: var(--s2); padding: 0 var(--s2); min-width: 0; }
.brand-mark { font-size: var(--t-body); font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.brand-name { font-size: var(--t-meta); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-status { display: flex; align-items: center; gap: var(--s2); min-height: var(--h-ctl); padding: var(--s1) var(--s2); border: 1px solid var(--rule); border-radius: var(--r-box); background: var(--panel); color: var(--ink-2); font-size: var(--t-small); overflow-wrap: anywhere; }
.agent-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: var(--r-round); background: var(--plan); }
.agent-status.busy { color: var(--ink); }
.agent-status.busy::before { background: var(--accent); animation: lamp 1.6s ease-in-out infinite; }
@keyframes lamp { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .agent-status.busy::before { animation: none; } }
/* « Claude est revenu, réessaie » (barre d'état pendant une pause du quota, et carte État de Système). */
.claude-retry-bar { width: 100%; min-height: var(--h-ctl); font-size: var(--t-small); }
.claude-retry-bar[hidden] { display: none; }
.claude-retry-status:empty { display: none; }

.rail-nav { display: flex; flex-direction: column; }
.nav { display: flex; flex-direction: column; gap: var(--s4); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { margin: 0 0 2px; padding: 0 var(--s2); font-size: var(--t-meta); font-weight: 500; color: var(--ink-3); }
.nav button, .nav-more { justify-content: flex-start; gap: var(--s2); width: 100%; min-height: var(--h-ctl); padding: 0 var(--s2); background: transparent; border: 0; color: var(--ink-2); font-size: var(--t-small); font-weight: 500; text-align: left; }
.nav button:hover, .nav-more:hover { background: var(--hover); color: var(--ink); filter: none; }
.nav button.active { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.nav button.active svg.i { color: var(--accent); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav .badge { margin-left: auto; }
.nav-more, .nav-sheet-backdrop { display: none; }

@media (max-width: 960px) {
  :root { --h-ctl: 40px; }
  #app:not([hidden]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); }
  #app > .rail { grid-column: 1; grid-row: 1; }
  #app > #config-banner { grid-column: 1; grid-row: 2; }
  #app > #health-banner { grid-column: 1; grid-row: 3; }
  #app > main { grid-column: 1; grid-row: 4; padding: var(--s4); }
  /* Barre du haut : marque et état de l'IA. */
  .rail { flex-direction: row; align-items: center; gap: var(--s2); overflow: visible; padding: var(--s2) var(--s3) var(--s2) var(--s4); border-right: 0; border-bottom: 1px solid var(--rule); background: var(--panel); }
  .rail-top { flex: 1; flex-direction: row; align-items: center; gap: var(--s2); min-width: 0; }
  .brand { flex: 1; padding: 0; }
  .agent-status { min-height: 0; min-width: 0; padding: 0; border: 0; background: none; font-size: var(--t-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .agent-status { display: block; flex: 0 1 auto; }
  .agent-status::before { display: inline-block; margin-right: var(--s1); vertical-align: middle; }
  .claude-retry-bar { display: none; } /* sous 960 px : bouton dans la carte État de Système */
  /* Barre d'onglets en bas : Discussion, Production, Publications, Journal, Plus (le reste en feuille). */
  .rail-nav { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
    max-height: 100dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--panel); border-top: 1px solid var(--rule); }
  .nav, .nav-group { display: contents; }
  .nav-group-title, .nav button:not(.nav-main) { display: none; }
  .nav button.nav-main, .nav-more { order: 1; position: relative; flex-direction: column; justify-content: center; gap: 2px; width: auto; min-height: var(--bar-h); padding: var(--s1) 2px;
    border-radius: 0; background: none; box-shadow: none; color: var(--ink-3); font-size: 11px; line-height: 1.15; text-align: center; }
  .nav button.nav-main .nav-label, .nav-more .nav-label { flex: none; white-space: normal; overflow: visible; }
  .nav button.nav-main svg.i, .nav-more svg.i { width: 20px; height: 20px; }
  .nav button.nav-main.active, .nav-more.has-active { color: var(--accent-text); background: none; box-shadow: none; font-weight: 600; }
  .nav button.nav-main.active svg.i, .nav-more.has-active svg.i { padding: var(--s1) var(--s4); box-sizing: content-box; border-radius: var(--r-round); background: var(--accent-soft); color: var(--accent-text); }
  .nav button.nav-main .badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
  .nav-more { display: flex; }
  /* Feuille « Plus » : les autres destinations, groupées, au-dessus de la barre. */
  .rail-nav.is-open .nav-group-title { display: block; grid-column: 1 / -1; margin: 0; padding: var(--s3) var(--s4) var(--s1); }
  .rail-nav.is-open .nav-group:first-child .nav-group-title { display: none; }
  .rail-nav.is-open .nav button:not(.nav-main) { display: flex; grid-column: 1 / -1; min-height: 48px; padding: 0 var(--s4); border-radius: 0; font-size: var(--t-body); }
  .rail-nav.is-open .nav button:not(.nav-main) svg.i { width: 20px; height: 20px; }
  .rail-nav.is-open .nav button:not(.nav-main).active { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }
  .rail-nav.is-open { box-shadow: var(--shadow-pop); border-radius: var(--r-box) var(--r-box) 0 0; }
  .nav-sheet-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 3; background: var(--scrim); }
  button:not(.linklike):not(.nav button):not(.nav-more), .btn, a.button-link { min-height: 44px; }
  body .toast, body .kbd-pending { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 12px); }
}
@media (max-width: 380px) { .brand-name { display: none; } }

/* =====================================================================================================================
   Composants partagés par plusieurs onglets
   ===================================================================================================================== */

/* ---------- En-tête d'écran ---------- */
.screen-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s3) var(--s4); margin-bottom: var(--s5); }
.screen-head-text { min-width: 0; }
.screen-head h1 { margin: 0; }
.screen-head-text > p { margin: 2px 0 0; max-width: 72ch; font-size: var(--t-small); color: var(--ink-2); }
.screen-head-text > p:empty { display: none; }

/* ---------- Jauge ---------- */
.meter { position: relative; display: flex; gap: 2px; width: 100%; height: 8px; overflow: hidden; border-radius: 2px; background: var(--sunk); box-shadow: inset 0 0 0 1px var(--rule); }
.meter-lg { height: 14px; }
.meter-fill { display: block; flex: none; height: 100%; background: var(--ink-3); }
.meter-fill:last-of-type { border-radius: 0 2px 2px 0; }
.meter-fill.s1 { background: var(--series-1); } .meter-fill.s2 { background: var(--series-2); } .meter-fill.s3 { background: var(--series-3); }
.meter-fill.is-neutral { background: var(--ink-3); }
.meter-fill.is-accent { background: var(--accent); }
.meter-fill.is-ok { background: var(--ok-fill); }
.meter-fill.is-attn { background: var(--attn-fill); }
.meter-fill.is-ko { background: var(--ko); }
.meter-mark { position: absolute; left: 0; top: 0; bottom: 0; border-right: 2px solid var(--ink); pointer-events: none; }
.meter.is-off { background: transparent; box-shadow: inset 0 0 0 1px var(--rule-2); }
.swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--ink-3); }
.swatch.s1 { background: var(--series-1); } .swatch.s2 { background: var(--series-2); } .swatch.s3 { background: var(--series-3); }

/* ---------- Contrôle segmenté ---------- */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; min-width: 0; margin: 0; padding: 2px; border: 1px solid var(--rule-2); border-radius: var(--r-box); background: var(--panel); }
.segmented > legend { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.segmented button, .segmented label > span { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 var(--s3); border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--ink-2); font: 500 var(--t-small)/1.2 var(--font-ui); white-space: nowrap; cursor: pointer; }
.segmented button:hover, .segmented label:hover > span { background: var(--hover); color: var(--ink); filter: none; }
.segmented button[aria-pressed="true"], .segmented input:checked + span { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.segmented label { position: relative; display: inline-flex; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 0; }
@media (max-width: 960px) { .segmented label > span { min-height: 40px; } }

/* ---------- Texte Markdown, voyants, montants signés ---------- */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md table { border-collapse: collapse; } .md td, .md th { border: 1px solid var(--rule); padding: var(--s1) var(--s2); }
.md-image { overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: var(--r-round); margin-right: var(--s1); }
.dot.ok { background: var(--ok-fill); } .dot.ko { background: var(--ko); }
.dot.info { background: var(--ink-3); } .dot.warn { background: var(--attn-fill); } .dot.crit { background: var(--ko); }
.pos { color: var(--ok); } .neg { color: var(--ko); } .zero { color: var(--ink); }
.field.has-error input, .field.has-error select, .wakeup-row.has-error input[aria-invalid] { border-color: var(--ko); }
[aria-invalid="true"] { border-color: var(--ko) !important; }

/* ---------- Bandeaux : panne critique (F8), configuration illisible (A-04) ---------- */
.health-banner { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s3); padding: var(--s2) var(--s4); background: var(--ko-soft); color: var(--ink); border-bottom: 1px solid var(--ko); font-size: var(--t-small); min-width: 0; }
.health-banner[hidden] { display: none; }
.health-banner .hb-text { flex: 1 1 16rem; min-width: 0; overflow-wrap: anywhere; }
.health-banner .hb-link { white-space: nowrap; }
.config-banner .hb-text code { font-size: .85em; }
.config-banner .config-excerpt { flex: 1 1 100%; min-width: 0; max-width: 100%; margin: var(--s1) 0 0; padding: var(--s2) var(--s3); overflow-x: auto; background: var(--canvas); color: var(--ink); border: 1px solid var(--ko); border-radius: var(--r-ctl); font-size: var(--t-meta); line-height: 1.35; white-space: pre; }

/* =====================================================================================================================
   Surimpressions : raccourcis, toast
   ===================================================================================================================== */
@keyframes badge-in { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .badge { animation: none; } }
kbd { display: inline-block; min-width: 1.5em; padding: 0 var(--s1); border: 1px solid var(--rule-2); border-radius: var(--r-ctl); background: var(--sunk); color: var(--ink-2); font: 400 var(--t-meta)/1.5 var(--font-num); text-align: center; }
.shortcuts-line { font-size: var(--t-small); }
.help-dialog { width: 26rem; max-width: calc(100% - 32px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--rule); border-radius: var(--r-box); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-pop); }
.help-dialog::backdrop { background: var(--scrim); }
.help-body { padding: var(--s4) var(--s5) var(--s5); }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.help-head h2 { margin: 0; }
.help-close { width: var(--h-ctl); padding: 0; }
.help-dialog > .help-body > p { margin: var(--s1) 0 var(--s3); font-size: var(--t-small); }
.shortcuts { margin: 0; display: grid; }
.shortcut { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) 0; border-top: 1px solid var(--rule); }
.shortcut:first-child { border-top: 0; }
.shortcut dt { white-space: nowrap; color: var(--ink-2); font-size: var(--t-small); }
.shortcut dd { margin: 0; text-align: right; }
.shortcut.is-off dt, .shortcut.is-off dd { color: var(--ink-3); }
.kbd-pending { position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%); z-index: 5; padding: var(--s1) var(--s3); border-radius: var(--r-box); background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow-pop); font-size: var(--t-small); color: var(--ink-2); }

.toast { position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%); z-index: 6; max-width: calc(100% - 32px); padding: var(--s2) var(--s4); border-radius: var(--r-box); background: var(--panel); color: var(--ink); border: 1px solid var(--rule); box-shadow: var(--shadow-pop); font-size: var(--t-small); overflow-wrap: anywhere; }
.toast.warn { border-color: var(--attn-fill); } .toast.ok { border-color: var(--ok-fill); }

/* Notifications et application installable (carte de Système) */
#notif-card p { margin: var(--s1) 0; overflow-wrap: anywhere; }
#install-zone { padding-top: var(--s2); margin-top: var(--s3); border-top: 1px solid var(--rule); }
.https-hint { margin-top: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r-ctl); background: var(--accent-soft); font-size: var(--t-small); overflow-wrap: anywhere; }
.https-hint p { margin: var(--s1) 0; }
.https-hint a, #notif-card a { color: var(--accent-text); }
