/* IZIRICH - design system maison (DESIGN.md). Tokens repris de la maquette validee.
   Pas de framework CSS, pas de CDN externe (police mono = fallback systeme, decision Lot 2/3). */

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Decision Lot 2 : police mono SYSTEME (pas de self-host JetBrains ni de CDN externe). */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, "Cascadia Mono", Consolas, monospace;

  --bg: #eaeef4;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;

  --accent: #5368d5;
  --accent-weak: #eceffc;
  --accent-strong: #3f52bd;
  --on-accent: #ffffff;

  --up: #059669;   --up-bg: #e6f5ee;
  --down: #dc2626; --down-bg: #fcecec;
  --warn: #b45309; --warn-bg: #fbf0dd;
  --hold: #64748b; --hold-bg: #eef2f7;

  /* Classification action/tracker (FAIT EODHD, pas un jugement - Regle 11) : hors de l'invariant
     boursier (up/down/warn/hold) et de l'indigo (UI seulement), pour ne jamais s'y confondre. */
  --type-stock: #2563eb; --type-stock-bg: #eaf1fd;
  --type-fund: #0d9488;  --type-fund-bg: #e6f7f5;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 1px 3px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
  --radius: 10px;
  --radius-sm: 7px;
}

/* Sombre : suit le systeme, sauf choix explicite via [data-theme]. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f1c; --surface: #141d30; --surface-2: #0f1728;
    --border: #263349; --border-strong: #35455f;
    --text: #e6ecf5; --muted: #93a1b8; --faint: #64748b;
    --accent: #8595f6; --accent-weak: #1b2544; --accent-strong: #9caafa; --on-accent: #0a0f1c;
    --up: #34d399;   --up-bg: #0f2a20;
    --down: #f87171; --down-bg: #34191b;
    --warn: #fbbf24; --warn-bg: #322611;
    --hold: #94a3b8; --hold-bg: #1a2436;
    --type-stock: #60a5fa; --type-stock-bg: #12233f;
    --type-fund: #2dd4bf;  --type-fund-bg: #0f2b28;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 2px 6px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f1c; --surface: #141d30; --surface-2: #0f1728;
  --border: #263349; --border-strong: #35455f;
  --text: #e6ecf5; --muted: #93a1b8; --faint: #64748b;
  --accent: #8595f6; --accent-weak: #1b2544; --accent-strong: #9caafa; --on-accent: #0a0f1c;
  --up: #34d399;   --up-bg: #0f2a20;
  --down: #f87171; --down-bg: #34191b;
  --warn: #fbbf24; --warn-bg: #322611;
  --hold: #94a3b8; --hold-bg: #1a2436;
  --type-stock: #60a5fa; --type-stock-bg: #12233f;
  --type-fund: #2dd4bf;  --type-fund-bg: #0f2b28;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 2px 6px rgba(0,0,0,.45), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; text-wrap: balance; font-weight: 600; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
a { color: var(--accent-strong); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; background: var(--surface); }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--surface-2);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
.brand .name { font-weight: 700; letter-spacing: .3px; font-size: 15px; }
.brand .sub { font-size: 11px; color: var(--faint); }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--faint); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px;
}
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--accent-weak); color: var(--accent-strong); font-weight: 600; }
.nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 26px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(6px); z-index: 5; }
.crumb { font-size: 12.5px; color: var(--muted); }
.crumb b { color: var(--text); font-weight: 600; }
.sys { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.content { padding: 24px 26px 40px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- pills / deltas ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill .led { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.up { color: var(--up); background: var(--up-bg); }
.pill.down { color: var(--down); background: var(--down-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.hold { color: var(--hold); background: var(--hold-bg); }
.pill.accent { color: var(--accent-strong); background: var(--accent-weak); }
/* place de marche / type (action-ETF) : metadonnee neutre (gris), jamais une couleur boursiere (Regle 11) */
.pill.place, .pill.type { color: var(--muted); background: color-mix(in srgb, var(--muted) 12%, transparent); font-size: 10.5px; font-weight: 600; padding: 1px 7px; margin-left: 7px; vertical-align: middle; }
.pill.type-stock { color: var(--type-stock); background: var(--type-stock-bg); }
.pill.type-fund { color: var(--type-fund); background: var(--type-fund-bg); }
.delta { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.hold { color: var(--hold); }

/* ---------- cards / kpi ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 14px; margin-bottom: 22px; }
/* Intertitre d'un bloc de cartes : dit de QUOI parlent les chiffres qui suivent (positions actuelles / depuis le debut). */
.kpi-scope { font-size: 13px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi-scope > span { font-size: 11.5px; font-weight: 400; color: var(--muted); }
/* Bloc d'une ou deux cartes : elles gardent la largeur des autres au lieu de s'etirer sur toute la ligne. */
.kpi-grid.kpi-grid-narrow { grid-template-columns: repeat(auto-fill, minmax(178px, 300px)); }
.kpi { padding: 15px 16px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; letter-spacing: -.5px; }
.kpi .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.spark { display: block; width: 100%; height: 30px; margin-top: 2px; }
/* Graphique de valorisation (Chart.js, canvas responsive : le conteneur donne la hauteur). */
.chart-wrap { position: relative; width: 100%; height: 260px; }
.meter { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter.warn > span { background: var(--warn); }

/* Aide pedagogique : pastille "i" + bulle. Survol au desktop, focus/tap au mobile (bouton focusable). */
.kpi:has(.help) { overflow: visible; }   /* la bulle doit pouvoir depasser la tuile */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; padding: 0; vertical-align: middle;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: var(--surface-2); color: var(--muted);
  font: 700 10px/1 var(--font-sans); font-style: normal; cursor: help; position: relative;
}
.help:hover, .help:focus-visible { border-color: var(--accent); color: var(--accent-strong); }
.help .tip {
  position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(260px, 82vw);
  background: var(--text); color: var(--surface);
  text-transform: none; letter-spacing: normal; text-align: left;
  font: 400 12px/1.45 var(--font-sans);
  padding: 9px 11px; border-radius: 8px; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transition: opacity .12s ease; z-index: 60; pointer-events: none;
  /* Fermee, la bulle ne doit occuper AUCUNE place : invisible mais presente, une bulle proche du bord droit
     elargissait la page, qui glissait d'environ 80 px sur mobile (vu en production le 2026-09-19). */
  display: none;
}
.help .tip::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-bottom-color: var(--text);
}
.help:hover .tip, .help:focus .tip, .help:focus-visible .tip { display: block; opacity: 1; visibility: visible; }

.sec-head { display: flex; align-items: center; margin-bottom: 12px; gap: 10px; }
.sec-head h2 { font-size: 15px; }

/* ---------- tables ---------- */
.verify-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.verify-tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.verify-tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.verify-tbl tbody:last-child tr:last-child td { border-bottom: 0; }
/* Apercu d'import : une ligne a corriger et son explication forment un groupe (un <tbody> par ligne). */
.verify-tbl tr.has-hint td { border-bottom: 0; }
/* L'explication reste dans la zone VISIBLE meme quand le tableau, plus large que l'ecran, defile. */
.verify-tbl .row-hint { position: sticky; left: 12px; max-width: min(900px, calc(100vw - 330px)); line-height: 1.5; }
.verify-tbl .group-row {
  padding: 6px 12px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--faint); background: var(--surface-2);
}
.v-badge { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.v-badge.ok { color: var(--up); background: var(--up-bg); }
.v-badge.no { color: var(--down); background: var(--down-bg); }
.v-badge.un { color: var(--warn); background: var(--warn-bg); }

/* ---------- onglets de periode (historique de valorisation, backlog performance) ---------- */
.range-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: var(--radius-sm); }
.range-tab {
  font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: calc(var(--radius-sm) - 2px);
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.range-tab:hover { color: var(--text); }
.range-tab.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm); }

/* ---------- bottom nav (mobile) ---------- */
.bottomnav, .more-panel { display: none; }
/* Conteneur du controleur « Plus » : ses deux enfants sont fixes, il ne doit occuper aucune place. */
.mobile-nav { display: contents; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: 14px 16px; }
  .content { padding: 18px 15px 30px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .verify-tbl .row-hint { max-width: calc(100vw - 80px); }
  /* Sur mobile, la bulle d'aide s'ouvre en bas de l'ecran, sur toute la largeur, au-dessus de la barre du bas :
     accrochee a sa pastille, celle du bord droit etait coupee et son texte illisible (vu le 2026-09-19). */
  .help .tip { position: fixed; top: auto; bottom: 70px; left: 15px; right: 15px; transform: none; width: auto; max-width: none; }
  .help .tip::before { display: none; }
  /* Encoche des telephones : la barre et le panneau remontent de la zone reservee en bas d'ecran (0 ailleurs). */
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(58px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); z-index: 20;
  }
  .bottomnav a, .bottomnav .more-toggle { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); text-decoration: none; font-size: 10px; font-weight: 600; }
  .bottomnav .more-toggle { position: relative; background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
  .bottomnav a svg, .bottomnav .more-toggle svg { width: 20px; height: 20px; }
  .bottomnav a.active, .bottomnav .more-toggle.active, .bottomnav .more-toggle[aria-expanded="true"] { color: var(--accent-strong); }

  /* Panneau « Plus » : un voile sur la page, la liste posee au-dessus de la barre basse. */
  .more-panel:not([hidden]) {
    display: flex; flex-direction: column; justify-content: flex-end;
    position: fixed; top: 0; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom, 0px)); z-index: 19;
    background: rgba(15, 23, 42, .35);
  }
  .more-sheet {
    background: var(--surface); border-top: 1px solid var(--border); border-radius: 14px 14px 0 0;
    box-shadow: var(--shadow-md); padding: 8px 10px 10px; max-height: 100%; overflow-y: auto;
  }
  .more-sheet a {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px;
  }
  .more-sheet a svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--muted); }
  .more-sheet a.active { background: var(--accent-weak); color: var(--accent-strong); font-weight: 600; }
  .more-sheet a.active svg { color: currentColor; }
  .more-sheet a:last-child { margin-top: 6px; position: relative; }
  .more-sheet a:last-child::before { content: ""; position: absolute; top: -4px; left: 12px; right: 12px; border-top: 1px solid var(--border); }
}

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 360px; padding: 28px 26px; display: flex; flex-direction: column; gap: 14px; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.login-brand .mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.login-brand .name { font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.login-card input { font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.btn-primary { font: inherit; font-weight: 600; font-size: 14px; padding: 10px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); cursor: pointer; }
.btn-primary:hover { background: var(--accent-strong); }
.login-error { background: var(--down-bg); color: var(--down); font-size: 12.5px; padding: 8px 11px; border-radius: var(--radius-sm); font-weight: 500; }

/* ---------- formulaires / boutons / flashes (brique Lot 2) ---------- */
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* Rangee dont les champs portent un label au-dessus : le bouton s'aligne sur le BAS des champs, pas au milieu du bloc
   label + champ (retour Christopher, 2026-09-16 : « Période personnalisée » flottait au-dessus des dates). */
.form-row.align-bottom { align-items: flex-end; }
.input, .select, textarea.input {
  font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text); width: 100%;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.input.num-input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.input.cell { padding: 6px 8px; font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > .lbl { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.btn-secondary {
  font: inherit; font-weight: 600; font-size: 13px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary.active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-weak); }
.btn-primary { font: inherit; font-weight: 600; font-size: 14px; padding: 10px 16px; border: 0; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); cursor: pointer; }
.btn-primary:hover { background: var(--accent-strong); }
/* Etat "action en cours" : Turbo desactive le bouton (data-turbo-submits-with) pendant l'envoi. */
.btn-primary:disabled, .btn-secondary:disabled { opacity: .6; cursor: progress; }
.btn-primary:disabled:hover { background: var(--accent); }
.btn-secondary:disabled:hover { background: var(--surface); }
.btn-danger-ghost { font: inherit; font-size: 12px; padding: 6px 10px; cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--down); }
.flash { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.flash.success { background: var(--up-bg); color: var(--up); }
.flash.error { background: var(--down-bg); color: var(--down); }
.flash.info { background: var(--hold-bg); color: var(--hold); }

/* ---------- reglages (ecran /reglages) ---------- */
.setting { padding: 16px 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.setting label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.setting > input.input, .setting > textarea.input { max-width: 420px; }
.setting-help { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.setting-help dt { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); margin-top: 8px; }
.setting-help dt:first-child { margin-top: 0; }
.setting-help dd { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
[hidden] { display: none !important; }

/* ---------- ecran /reglages/modeles (Lot 2, Tache 13) ---------- */
/* Sobriete gris-bleu, semantique couleur du projet : vert = valide, rouge = echec, ambre = a
   re-tester ou avertissement, gris = neutre. L'indigo (--accent) ne dit jamais un etat metier :
   il ne sert ici qu'a l'attente « test lance », qui est un etat de traitement, pas un verdict. */

.info-panel { padding: 16px 18px; margin-bottom: 6px; }
.info-panel h2 { font-size: 14.5px; margin-bottom: 6px; }
.info-panel p { margin: 0 0 8px; font-size: 13px; color: var(--muted); max-width: 78ch; }
.info-panel p:last-child { margin-bottom: 0; }
.info-panel p.muted { color: var(--faint); }

.empty-state { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* Le pourquoi des cinq tests : ecrit UNE fois, repliable, deplie tant qu'on ne l'a pas replie. */
.tests-why { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 10px; }
.tests-why > summary { cursor: pointer; font-weight: 600; font-size: 13px; list-style-position: outside; }
.tests-why > summary:hover { color: var(--accent-strong); }
.tests-why > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.tests-why dl { margin: 10px 0 2px; display: grid; gap: 9px; }
.tests-why dt { font-weight: 600; font-size: 12.5px; }
.tests-why dd { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); max-width: 86ch; }
/* Mode d'emploi replie d'un ecran ou d'une vue (fiche portefeuille) : meme forme que .tests-why, sans le filet. */
.how-to-read { margin-top: 12px; }
.how-to-read > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); list-style-position: outside; }
.how-to-read > summary:hover { color: var(--accent-strong); }
.how-to-read > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.how-to-read dl { margin: 10px 0 2px; display: grid; gap: 9px; }
.how-to-read dt { font-weight: 600; font-size: 12.5px; }
.how-to-read dd { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); max-width: 86ch; line-height: 1.5; }

/* --- carte d'un modele --- */
.model-card { padding: 0; margin-bottom: 16px; }
.model-head { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-start; padding: 16px 18px; }
.model-head .ident { flex: 1 1 260px; min-width: 0; }
.model-head h3 { font-size: 16px; }
.model-id { font-size: 11.5px; color: var(--faint); overflow-wrap: anywhere; white-space: normal; }
.model-head .usages { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.model-state { flex: 0 1 auto; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; max-width: 300px; }
.model-state p { margin: 0; font-size: 12px; color: var(--muted); }

.model-facts {
  display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 11px 18px;
  background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--muted);
}
.model-facts b { color: var(--text); font-weight: 600; }
.model-facts b.unknown, .unknown { color: var(--faint); font-weight: 500; font-style: italic; }
/* Glose d'un fait qui ne parle pas tout seul (nom d'un moteur de recherche, par ex.). */
.fact-note { color: var(--faint); font-size: 11.5px; }

.test-summary { margin: 0; padding: 12px 18px 0; font-size: 12.5px; color: var(--muted); }

/* Une ligne = un test, lisible d'un coup d'oeil : nom, verdict, bouton. Le POURQUOI de chaque test
   n'est plus repete ici (il etait ecrit quatre fois, une par modele) : il vit dans le bandeau, une
   seule fois. Ne restent sur la ligne que les notes PROPRES a ce modele (motif d'echec, tentatives
   non concluantes), qui passent alors sur toute la largeur. */
.test-row { display: grid; grid-template-columns: minmax(0, 1fr) 300px max-content; gap: 8px 16px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.test-row:last-child { border-bottom: 0; }
.t-name { font-weight: 600; font-size: 13.5px; }
.t-notes { grid-column: 1 / -1; }
.t-detail { margin: 0; font-size: 12.5px; color: var(--muted); }
.t-verdict { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.t-when { font-size: 11.5px; color: var(--faint); }
.t-action { justify-self: end; }

.btn-small { font-size: 12px; padding: 7px 11px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.btn-note { font-size: 10.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .4px; }

.model-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.model-foot .danger-box { flex: 1 1 340px; }

/* Encadre d'action risquee : bordure PLEINE en ambre, visuellement distinct d'une simple note
   (rules/code-quality : une action qui engage de l'argent s'annonce avant le clic). */
.danger-box { border: 1px solid var(--warn); background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; }
.danger-box b { font-weight: 700; }

/* Note contextuelle : porte l'etat dans sa couleur, jamais une couleur decorative. */
.note { font-size: 12.5px; padding: 9px 12px; border-radius: var(--radius-sm); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.down { background: var(--down-bg); color: var(--down); }
.note.hold { background: var(--hold-bg); color: var(--hold); }
.model-card > .note { margin: 0 18px 14px; }
.model-card > .model-head + .note { margin-top: 0; }
.t-notes .note { margin: 2px 0 0; }

/* --- blocs d'affectation --- */
.assign-card { padding: 0; margin-bottom: 16px; }
.assign-head { padding: 16px 18px 12px; }
.assign-head h3 { font-size: 15px; margin-bottom: 6px; }
.assign-head p { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); max-width: 80ch; }
.assign-head p:last-child { margin-bottom: 0; }
.assign-head p.muted { color: var(--faint); }

.assign-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 260px); gap: 10px 18px; align-items: start; padding: 14px 18px; border-top: 1px solid var(--border); }
.assign-row--static { background: var(--surface-2); }
.assign-what p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.assign-what .model-id { margin-top: 5px; }
.assign-now, .assign-set { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.assign-row .lbl { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.static-answer { font-size: 12.5px; color: var(--muted); }
.assign-card .note { margin: 10px 18px 0; }
.assign-foot { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.foot-note { font-size: 11.5px; color: var(--faint); max-width: 60ch; }

@media (max-width: 860px) {
  .test-row, .assign-row { grid-template-columns: minmax(0, 1fr); }
  .t-action { justify-self: start; }
  .model-state { max-width: 100%; flex-basis: 100%; }
  /* Les listes deroulantes portent deja width:100% : garder align-items:flex-start (base) evite
     qu'une pastille d'etat s'etire sur toute la largeur. */
}

/* Carte-lien vers un ecran voisin (ex. /reglages -> /reglages/modeles). Indigo = UI seulement. */
.gate-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 18px; text-decoration: none; color: inherit; }
.gate-card:hover { border-color: var(--accent); }
.gate-icon { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-weak); color: var(--accent-strong); display: flex; align-items: center; justify-content: center; }
.gate-icon svg { width: 18px; height: 18px; }
.gate-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gate-text b { font-size: 14px; }
.gate-text span { font-size: 12.5px; color: var(--muted); }
.gate-go { margin-left: auto; color: var(--accent-strong); font-size: 17px; font-weight: 700; }
/* Deux cartes-liens a la suite (modeles, prompts) : l'espace entre elles reste celui d'une liste. */
.gate-card + .gate-card { margin-top: -8px; }

/* ---------- ecran /reglages/prompts (Lot 2, Tache 21) ---------- */
/* Meme vocabulaire que l'ecran des modeles : rouge = refus du garde-fou ou appel en echec, ambre =
   avertissement ou essai non concluant, gris = neutre. L'indigo ne marque que l'attente d'un essai,
   un etat de traitement et non un verdict. */

/* --- la liste --- */
.prompt-list { padding: 0; }
.prompt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 18px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--border); text-decoration: none; color: inherit; }
.prompt-row:first-child { border-top: 0; }
.prompt-row:hover { background: var(--surface-2); }
.prompt-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.prompt-ident { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prompt-ident b { font-size: 13.5px; font-weight: 600; }
.prompt-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.prompt-meta b { color: var(--text); }

/* --- l'ecran d'un prompt --- */
.prompt-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.prompt-facts b { color: var(--text); font-weight: 600; }
.prompt-card { padding: 0; margin-bottom: 16px; scroll-margin-top: 70px; }
.prompt-card-head { padding: 16px 18px 12px; }
.prompt-card-head h2 { font-size: 15px; margin-bottom: 6px; }
.prompt-card-head p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 88ch; }
.prompt-card-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.prompt-card-body > .note, .prompt-card-body > .danger-box { margin: 0; }

.prompt-editor { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px 20px; align-items: start; padding: 0 18px 18px; }
.prompt-form { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.prompt-form .lbl, .subject-form .lbl, .trial-form .lbl { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
textarea.input.prompt-body { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; min-height: 240px; }
.prompt-form-foot { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 6px; }

.prompt-aside { display: flex; flex-direction: column; gap: 8px; padding: 13px 15px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--muted); min-width: 0; }
.prompt-aside h3 { font-size: 13px; color: var(--text); }
.prompt-aside h3:not(:first-child) { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.prompt-aside p { margin: 0; }
.prompt-aside p.muted { color: var(--faint); }
.prompt-aside b { color: var(--text); }
.prompt-card code { font-family: var(--font-mono); font-size: 11.5px; background: var(--hold-bg); color: var(--text); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.var-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.var-list li .pill { margin-left: 4px; vertical-align: middle; }
.var-list p { margin: 4px 0 0; }
.aside-details > summary { cursor: pointer; font-weight: 600; color: var(--text); }
.aside-details dl { margin: 8px 0 0; display: grid; gap: 8px; }
.aside-details dd { margin: 3px 0 0; }

/* Refus du garde-fou : bordure pleine rouge, au-dessus du formulaire (un refus bloque, il se voit). */
.refusal-box { border: 1px solid var(--down); background: var(--down-bg); color: var(--down); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; margin-bottom: 12px; }
.refusal-box p { margin: 5px 0 8px; }
.refusal-box ul, .warn-block ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.warn-block { margin-bottom: 12px; }
.tech-detail { display: block; margin-top: 6px; font-size: 11.5px; opacity: .85; overflow-wrap: anywhere; }
.danger-extra { display: block; margin-top: 6px; }

.subject-form { display: flex; flex-direction: column; gap: 6px; }
.subject-form .form-row .select, .trial-form .form-row .select { flex: 1 1 260px; width: auto; min-width: 0; }
.subject-state { margin: 0; font-size: 13px; color: var(--muted); }
.subject-state b { color: var(--text); }
.foot-note b { color: var(--muted); }
.prompt-card-body > .foot-note { margin: -4px 0 0; max-width: 88ch; }

/* Le texte exact : complet (jamais coupe), qui defile dans son cadre quand il est long. */
.prompt-preview { margin: 0; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 460px; overflow: auto; }
.estimate { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.estimate b { color: var(--text); }
.estimate-caveat { color: var(--warn); }
.prompt-card-body > p.static-answer { margin: 0; }

.trial-form { display: flex; flex-direction: column; gap: 6px; }
.trial-form .foot-note { margin: 2px 0 0; }
.pending-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: 6px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12.5px; color: var(--muted); }
.pending-row b { color: var(--text); }
.trials-title { font-size: 13.5px; margin-top: 6px; }
.trial-list { display: flex; flex-direction: column; }
.trial { padding: 12px 0; border-top: 1px solid var(--border); }
.trial-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 13px; }
.trial-text { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.trial .static-answer { display: block; margin: 6px 0 0; }
.raw-output, .version-body { margin-top: 8px; }
.raw-output > summary, .version-body > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.raw-output > summary:hover, .version-body > summary:hover, .aside-details > summary:hover { color: var(--accent-strong); }

.version-list { border-top: 1px solid var(--border); }
.version-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.version-ident { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; }
.version-row .version-body { grid-column: 1 / -1; margin-top: 2px; }
.history-empty { display: block; padding: 0 18px 12px; }
.stats-note { margin: 0; padding: 12px 18px 14px; }

@media (max-width: 860px) {
  .prompt-row { grid-template-columns: minmax(0, 1fr) auto; }
  .prompt-meta { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .prompt-row .gate-go { grid-column: 2; grid-row: 1 / span 2; }
  .prompt-editor { grid-template-columns: minmax(0, 1fr); }
  .prompt-card-head, .prompt-card-body, .prompt-editor, .version-row { padding-left: 14px; padding-right: 14px; }
  .stats-note, .history-empty { padding-left: 14px; padding-right: 14px; }
  .version-row { grid-template-columns: minmax(0, 1fr); }
}

/* Fix round 1 (Tache 21) : quel texte l'apercu montre, et sur quel texte porte l'essai reel. */
.preview-source { margin: 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.preview-source b { color: var(--text); }
.trial-scope { margin: 2px 0 0; font-size: 12.5px; font-weight: 600; color: var(--text); }
.trial-scope.draft { color: var(--warn); }
.prompt-card-body > .refusal-box { margin: 0; }
.refusal-box ul { margin-top: 6px; }

/* ---------- ecran /couts (Lot 2, Tache 24) ---------- */
/* Ambre = plafond atteint ou cout inconnu (un avertissement de fait). L'indigo ne remplit que la
   jauge d'un plafond non atteint : un etat d'interface, jamais un jugement sur un montant. */

.cost-kpis { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cost-kpis .kpi.is-reached { border-color: var(--warn); }
.cost-kpis .val-word { font-family: var(--font-sans); font-size: 16px; font-weight: 600; letter-spacing: normal; color: var(--muted); }
.cost-kpis .val .val-word { font-size: inherit; }
.cost-kpis .foot a { margin-left: auto; font-size: 12px; }
.at-least { font-family: var(--font-sans); font-size: .62em; font-weight: 600; color: var(--warn); letter-spacing: normal; vertical-align: middle; }
td .at-least { font-size: 11.5px; }
.cost-unknown { display: block; font-size: 11.5px; font-weight: 500; color: var(--warn); }
.kpi .cost-unknown { margin-top: -4px; }
/* Juste sous un plafond : un fait (non atteint), dit en gris, jamais en ambre. */
.cost-near { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.kpi .cost-near { margin-top: -4px; }

.cost-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; align-items: start; margin-bottom: 4px; }
.guard-panel, .credits-panel { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.guard-panel p, .credits-panel p { margin: 0; }
.guard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.guard-head h2 { margin: 0; }
.guard-panel .danger-box a { font-weight: 600; margin-left: 4px; }
.setting-key { display: block; margin-top: 4px; font-size: 11px; opacity: .8; font-weight: 400; }
.credits-line { color: var(--text) !important; }
.credits-val { font-size: 17px; font-weight: 600; }

.cost-sec-head { flex-wrap: wrap; margin-top: 28px; }
.cost-sec-head .range-tabs { margin-left: auto; }
.cost-lede { margin: -4px 0 12px; font-size: 12.5px; color: var(--muted); }

.cost-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.cost-card { padding: 0; min-width: 0; }
.cost-card > h3 { font-size: 13.5px; padding: 14px 16px 4px; }
.cost-card > .empty-state { margin: 0; text-align: left; padding: 10px 16px 18px; }
.tbl-scroll { overflow-x: auto; }
.cost-tbl th.n, .cost-tbl td.n { text-align: right; }
.cost-tbl td { color: var(--muted); }
.cost-tbl td .row-name { color: var(--text); font-weight: 600; }
.cost-tbl td.cost-td .num, .calls-tbl td .num { color: var(--text); }
.cost-tbl td.cost-td { white-space: nowrap; }
.cost-tbl td:first-child { min-width: 10.5em; }
.cost-tbl tbody tr:hover { background: var(--surface-2); }
.calls-tbl td { white-space: nowrap; }
.call-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 11px; color: var(--faint); }
.call-sub .pill { font-size: 10.5px; padding: 1px 7px; }
.calls-tbl .none { color: var(--faint); }

.cost-notes { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.cost-notes .foot-note, .cost-card-foot .foot-note { max-width: 100ch; margin: 0; }
.cost-card-foot { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px 14px; border-top: 1px solid var(--border); }
.reminder { margin: 0; max-width: 100ch; font-size: 11.5px; color: var(--faint); border-left: 2px solid var(--border-strong); padding: 2px 0 2px 9px; }
.reminder-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 4px; }

@media (max-width: 860px) {
  .cost-sec-head .range-tabs { margin-left: 0; max-width: 100%; overflow-x: auto; }
}
@media (max-width: 560px) {
  .chart-wrap { height: 220px; }
}
@media (max-width: 560px) {
  .cost-card > h3 { padding: 12px 12px 2px; }
  .cost-card > .empty-state { padding: 8px 12px 14px; }
  .cost-card-foot { padding: 12px; }
  /* Sur telephone, chaque ligne devient une petite fiche : le nom et le cout sur la premiere ligne
     (le cout ne doit jamais etre cache hors de l'ecran), les chiffres secondaires en dessous. */
  .cost-tbl { display: block; }
  .cost-tbl thead { display: none; }
  .cost-tbl tbody { display: block; }
  .cost-tbl tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .cost-tbl tbody tr:last-child { border-bottom: 0; }
  .cost-tbl td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  .cost-tbl td.n { text-align: left; }
  .cost-tbl td:first-child { min-width: 0; }
  .cost-tbl .c-name { order: 1; flex: 1 1 45%; color: var(--text); }
  .cost-tbl td.c-cost { order: 2; flex: 0 1 auto; max-width: 55%; margin-left: auto; text-align: right; white-space: normal; }
  .cost-tbl .c-cost .cost-unknown { text-align: right; }
  /* Deux sauts de ligne forces (pseudo-elements, qui sont des elements flex ordonnables) : nom et
     cout / date, modele et statut / chiffres secondaires. */
  .cost-tbl tr::before, .cost-tbl tr::after { content: ""; flex-basis: 100%; height: 0; }
  .cost-tbl tr::before { order: 3; }
  .cost-tbl tr::after { order: 7; }
  .agg-tbl tr::after { display: none; }
  .cost-tbl .c-date { order: 4; flex-basis: 100%; font-size: 11.5px; color: var(--faint); }
  .cost-tbl .c-model { order: 5; font-size: 12px; }
  .cost-tbl .c-status { order: 6; margin-left: auto; }
  .cost-tbl .c-calls { order: 8; }
  .cost-tbl .c-in { order: 9; }
  .cost-tbl .c-out { order: 10; }
  .cost-tbl .c-search { order: 11; }
  .cost-tbl .c-dur { order: 12; }
  .cost-tbl .c-calls, .cost-tbl .c-in, .cost-tbl .c-out, .cost-tbl .c-search, .cost-tbl .c-dur { font-size: 11.5px; }
  .agg-tbl .c-calls::after, .agg-tbl .c-in::after, .agg-tbl .c-out::after {
    content: " " attr(data-label); font-family: var(--font-sans); font-weight: 400; color: var(--faint);
  }
  .calls-tbl .c-in::before, .calls-tbl .c-out::before, .calls-tbl .c-search::before, .calls-tbl .c-dur::before {
    content: attr(data-label) " : "; font-family: var(--font-sans); font-weight: 400; color: var(--faint);
  }
  .calls-tbl td { white-space: normal; }
}

/* ---- Journal des erreurs (chantier « aucune erreur silencieuse », 2026-09-17) ---- */
.err-summary { padding: 12px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.err-empty { padding: 20px 16px; }
.err-empty p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.err-note { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.err-card { padding: 14px 16px; margin-bottom: 12px; }
.err-card.err-unseen { border-left: 3px solid var(--accent); }
.err-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.err-when { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.err-title { margin-top: 8px; font-weight: 600; overflow-wrap: anywhere; }
.err-state { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.err-path, .err-source { margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.err-path { font-size: .9em; color: var(--text); }
.err-source { font-size: .82em; color: var(--muted); }
.err-class { margin-top: 8px; font-weight: 600; overflow-wrap: anywhere; }
.err-message { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: .88em; }
.err-trace { margin-top: 8px; }
.err-trace summary { cursor: pointer; color: var(--muted); font-size: .9em; }
.err-trace pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; background: #0f172a; color: #e2e8f0; border-radius: 6px; padding: 10px; font-size: .78em; line-height: 1.4; }
.err-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.err-actions .btn-secondary { text-decoration: none; }
.err-muted { margin-top: 18px; }
.err-muted > summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 10px; }

/* Fiche societe : les articles ou la societe n'est que citee, replies (2026-09-20). Ils representaient la
   moitie de la liste et chassaient les vraies actualites de l'ecran. */
.news-mentions { border-top: 1px solid var(--border); }
.news-mentions > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 12px 16px; }
.news-mentions > summary:hover { color: var(--text); }
.news-mentions-note { margin: 0; padding: 0 16px 10px; color: var(--faint); font-size: 11.5px; line-height: 1.5; }

/* Pastille du menu : rouge des qu'une ERREUR est a voir, ambre s'il n'y a que des avertissements. */
.nav-count { margin-left: auto; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: 999px; color: var(--warn); background: var(--warn-bg); }
.nav-count.has-error { color: var(--down); background: var(--down-bg); }
.bottomnav .nav-count { position: absolute; top: 4px; right: 50%; transform: translateX(22px); margin-left: 0; }
.bottomnav a { position: relative; }
.more-sheet .nav-count { margin-left: auto; }
.gate-card .nav-count { margin-left: 8px; }

/* ---- Sources d'actualites (lot 3 PR 2) : un bloc par connecteur, une ligne par releve ---- */
.src-paused { margin-bottom: 14px; }
.src-card { padding: 0; margin-bottom: 16px; scroll-margin-top: 70px; }
.src-head { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start; justify-content: space-between; padding: 16px 18px 12px; }
.src-title { flex: 1 1 360px; min-width: 0; }
.src-title h2 { font-size: 15px; margin-bottom: 6px; }
.src-title p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 88ch; line-height: 1.5; }
.src-toggle { flex: 0 0 auto; }
.src-row { padding: 12px 18px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.src-row-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; }
.src-when { font-size: 12px; color: var(--muted); margin-left: auto; }
.src-empty { margin: 0; font-size: 12.5px; color: var(--muted); }
.src-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px 14px; }
.src-stats > div { min-width: 0; }
.src-stats dt { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.src-stats dd { margin: 3px 0 0; font-size: 14px; }
.src-sub { display: block; font-size: 11.5px; color: var(--muted); }
.src-na { font-size: 12px; color: var(--faint); }
.src-foot { margin: 0; max-width: 88ch; }
.src-note { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .src-head, .src-row { padding-left: 14px; padding-right: 14px; }
  .src-when { margin-left: 0; flex-basis: 100%; }
  .src-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- bandeau « systeme vivant » (lot 4 PR 3) ---------- */
/* Gris quand tout va bien, ambre sinon. Jamais de vert ni de rouge : ils appartiennent a la lecture
   boursiere (hausse / baisse), et un bandeau vert permanent finirait de toute facon par ne plus se lire. */
.sysbanner { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 8px 12px;
  border-radius: var(--radius-sm); font-size: 12.5px; text-decoration: none;
  background: var(--hold-bg); color: var(--muted); border: 1px solid transparent; }
.sysbanner:hover { border-color: var(--border); }
.sysbanner.stale, .sysbanner.paused { background: var(--warn-bg); color: var(--warn); }
/* Indigo : une passe en cours est un fait d'interface, pas une hausse ni une baisse. */
.sysbanner.running { background: var(--accent-weak); color: var(--accent-strong); }
.sysbanner-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; opacity: .75; }
.sysbanner-text { min-width: 0; }

/* ---------- ecran des passes ---------- */
.pass-card { padding: 0; margin-bottom: 16px; }
.pass-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 13px 18px; }
.pass-date { font-size: 14.5px; }
.pass-when { margin-left: auto; font-size: 12px; color: var(--muted); }
.pass-error { margin: 0 18px 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--down-bg); color: var(--down); font-size: 12.5px; }
/* Les chiffres de la nuit : memes conventions que les autres releves (etiquette en capitales, valeur en mono). */
.pass-numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px 14px;
  padding: 0 18px 14px; border-bottom: 1px solid var(--border); }
.pass-numbers > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pass-numbers .lbl { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.pass-numbers .val { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 15px; }
.pass-num-note { font-size: 11px; color: var(--muted); }
.pass-quiet { margin: 0; padding: 12px 18px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border); }
.pass-steps { list-style: none; margin: 0; padding: 0; }
.pass-step { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: start; gap: 12px;
  padding: 10px 18px; border-bottom: 1px solid var(--border); }
.pass-step:last-child { border-bottom: 0; }
.pass-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--hold); }
.pass-dot.done { background: var(--up); }
.pass-dot.partial { background: var(--warn); }
.pass-dot.stalled { background: var(--down); }
.pass-dot.running { background: var(--accent); }
.pass-dot.skipped, .pass-dot.pending { background: transparent; border: 1.5px solid var(--border); }
.pass-step-name { font-size: 13px; font-weight: 600; }
.pass-step-desc { margin-top: 2px; font-size: 12px; color: var(--muted); max-width: 84ch; line-height: 1.45; }
.pass-step-num { text-align: right; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.pass-step-state { font-size: 11.5px; color: var(--muted); }
.pass-step-state.warn { color: var(--warn); }
.pass-failures { border-top: 1px solid var(--border); padding: 10px 18px 12px; }
.pass-failures > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.pass-failures ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.pass-failures li { font-size: 12px; }
.pass-fail-step { font-weight: 600; }
.pass-fail-key { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-left: 6px; overflow-wrap: anywhere; }
.pass-fail-msg { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .pass-head, .pass-numbers, .pass-step, .pass-failures, .pass-quiet { padding-left: 14px; padding-right: 14px; }
  .pass-error { margin-left: 14px; margin-right: 14px; }
  .pass-when { margin-left: 0; flex-basis: 100%; }
  .pass-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Le compte passe sous le libelle : a 320 px, une troisieme colonne ecrase la description. */
  .pass-step { grid-template-columns: 10px minmax(0, 1fr); }
  .pass-step-num { grid-column: 2; text-align: left; flex-direction: row; gap: 10px; align-items: baseline; }
}
.pass-val-pending { color: var(--faint); }

/* ------------------------------------------------------------------------------------------------
   Lot 4, PR 4 : la fiche d'un mecanisme (/mecanismes/{code}).
   Reprend les briques existantes (card info-panel, verify-tbl, setting, note, pill) ; n'ajoute que ce
   qui n'existait pas : le curseur de severite, les poids relatifs et le bloc d'apercu retroactif.
   ------------------------------------------------------------------------------------------------ */
.mech-banner { margin-bottom: 14px; }

/* Une precision collee a la donnee qu'elle eclaire, jamais renvoyee ailleurs (spec §21.4). */
.soft { color: var(--faint); font-size: 11.5px; font-weight: 400; }
.row-why { margin-top: 3px; line-height: 1.45; max-width: 74ch; white-space: normal; }

.plain-list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.plain-list li { font-size: 12.5px; }
.err-list { margin: 6px 0 0; padding-left: 18px; }

.mech-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 6px 0 10px; }
.mech-stats > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.mech-stats b { font-size: 22px; line-height: 1.1; }
.mech-stats span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

.severity { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; margin: 4px 0 14px; }
.severity legend { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); padding: 0 6px; }
.severity-crans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.severity-cran { display: flex; flex-direction: column; gap: 3px; cursor: pointer; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.severity-cran:hover { border-color: var(--accent); }
.severity-cran.is-on { border-color: var(--accent); background: var(--accent-weak); }
.severity-cran input { margin: 0 0 2px; }
.severity-cran b { font-size: 13.5px; }

.weights { display: grid; gap: 8px; }
.weights > label { display: grid; grid-template-columns: minmax(0, 1fr) 110px 62px; align-items: center; gap: 10px; font-size: 12.5px; }
.weights .input { max-width: 110px; }
.weights .share { color: var(--muted); text-align: right; }

.preview { margin: 16px 0 10px; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-sm); }
.preview h3 { margin: 0 0 8px; font-size: 13.5px; }
.preview p { margin: 0 0 8px; font-size: 13px; color: var(--muted); max-width: 82ch; }
.preview .note { margin: 10px 0; }
.preview-headline { font-size: 14px !important; color: var(--text) !important; }
.preview-headline b { color: var(--accent-strong); }
/* Les limites du chiffre, en retrait mais AU CONTACT du chiffre : jamais dans une aide separee. */
.preview-caveat { font-style: italic; font-size: 12px !important; border-left: 2px solid var(--border); padding-left: 10px; }

.planned { background: var(--surface-2); }
.planned .plain-list li { opacity: .92; }

@media (max-width: 720px) {
  .mech-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .severity-crans { grid-template-columns: 1fr; }
  .weights > label { grid-template-columns: minmax(0, 1fr) 84px; }
  .weights .share { grid-column: 2; text-align: left; }
}
.preview-check { display: block; line-height: 1.5; max-width: 82ch; margin: 8px 0; }
.field-error { margin: 0; font-size: 12.5px; color: var(--down); background: var(--down-bg); padding: 7px 10px; border-radius: var(--radius-sm); }
/* Les crans sont des BOUTONS d'envoi : ils doivent se lire comme des cartes, pas comme des boutons. */
.severity-cran { font: inherit; text-align: left; cursor: pointer; }
.severity-cran .cran-on { color: var(--accent-strong); font-weight: 600; }
/* Le bouton d'envoi par defaut : present dans le DOM (c'est lui que la touche Entree declenche), invisible
   a l'ecran, hors du parcours au clavier. */
.default-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* --- Ecran de simulation du bareme (PR 2 de la refonte de notation). ------------------------------
   Une question = un groupe, et DANS le groupe une grille libelle / valeur. Sans cette grille, les
   trente-deux poids s'empilaient en champs pleine largeur : la page faisait trois ecrans et on ne
   pouvait pas comparer deux poids d'un coup d'oeil, ce qui est pourtant tout l'objet de cet ecran. */
.weights-question { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px 14px; margin: 0 0 12px; }
.weights-question legend { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); padding: 0 6px; }
.weights-grid { display: grid; grid-template-columns: 1fr 86px; gap: 8px 14px; align-items: center; }
.weights-grid label { font-size: 13px; color: var(--muted); }
.weights-grid .input { text-align: right; padding: 6px 9px; font-size: 13.5px; }
.scope-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px; }
.scope-picker .select, .scope-picker select.input { width: auto; min-width: min(460px, 100%); }
@media (max-width: 720px) {
  /* Le libelle au-dessus du champ : a 390 px, deux colonnes coupent les libelles en trois lignes. */
  .weights-grid { grid-template-columns: 1fr; gap: 4px; }
  .weights-grid .input { text-align: left; }
  .weights-grid label { margin-top: 6px; }
}

/* ------------------------------------------------------------------------------------------------
   Debat des chocs confirmes, tache 8 : l'ecran /debats et la page d'un debat. Reprend card, info-panel,
   verify-tbl, pill, v-badge, soft ; n'ajoute que la mise en page propre a ces deux ecrans.
   ------------------------------------------------------------------------------------------------ */
.debate-block { margin-bottom: 16px; }
.debate-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 6px; }
.debate-block-head h2 { margin: 0; }
.debate-reading td { vertical-align: top; }
.debate-reading td .soft { display: block; margin-top: 2px; }
.debate-rate { font-size: 16px; font-weight: 600; }
.debate-small { display: flex; width: fit-content; margin-top: 4px; }
.debate-reading tr.debate-total td { font-weight: 600; background: var(--surface-2); }
.debate-reasons { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; }
.debate-reasons .num { display: inline-block; min-width: 2.5ch; text-align: right; margin-right: 6px; font-weight: 600; }
.debate-states td { vertical-align: top; }
.debate-states .debate-count { width: 4ch; text-align: right; font-size: 14px; font-weight: 600; }
.debate-other-states { border-top: 1px solid var(--border); padding: 10px 18px 12px; }
.debate-other-states > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.debate-other-states .verify-tbl { margin-top: 8px; }
.debate-help { font-size: 12px; color: var(--muted); line-height: 1.45; max-width: 80ch; }
.debate-list td { vertical-align: top; }
.debate-list .soft { display: block; margin-top: 2px; }
.debate-link, .debate-company { font-weight: 600; text-decoration: none; }
.debate-link:hover, .debate-company:hover { text-decoration: underline; }
.debate-dry { display: inline-flex; margin-top: 4px; }
.debate-outcome-text { font-size: 12.5px; font-weight: 600; color: var(--muted); }

.debate-back { margin: 0 0 6px !important; }
.debate-back a { text-decoration: none; font-size: 12.5px; }
.page-head h1 .pill.place { font-size: 11px; }
.debate-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 18px; }
.debate-summary > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.debate-summary .soft { line-height: 1.45; }
.debate-detail { font-size: 12px; color: var(--text); background: var(--surface-2); border-radius: var(--radius-sm); padding: 5px 8px; overflow-wrap: anywhere; }
.debate-summary .lbl, .debate-gemini .lbl, .debate-risk .lbl, .debate-sources .lbl { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.debate-fact { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 0; margin-bottom: 10px; }
.debate-fact-main, .debate-gemini { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; }
.debate-gemini { background: var(--surface-2); border-left: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; }
.debate-fact-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.debate-fact-no { font-family: var(--font-mono); font-weight: 700; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 7px; }
.debate-quote { margin: 0; padding: 2px 0 2px 10px; border-left: 2px solid var(--border-strong); font-size: 12.5px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.debate-article { font-size: 12.5px; overflow-wrap: anywhere; }

.debate-round { font-size: 13.5px; margin: 6px 0 10px; color: var(--muted); }
.debate-seats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; align-items: start; }
.debate-seat { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; font-size: 13px; }
.debate-seat-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.debate-seat-head .soft { overflow-wrap: anywhere; }
.debate-verdicts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.debate-verdicts dt { font-size: 10.5px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.debate-verdicts dd { margin: 2px 0 0; }
.debate-reason { display: block; margin-top: 3px; line-height: 1.4; }
.debate-summary-fr { margin: 0; font-style: italic; line-height: 1.5; }
.debate-risk { margin: 0; font-size: 12.5px; line-height: 1.5; }
.debate-risk .lbl { display: block; }
.debate-reasoning > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); }
.debate-reasoning p { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.debate-sources ul { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.debate-sources li { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.debate-source-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.debate-url { font-size: 11.5px; overflow-wrap: anywhere; }
/* Une source ecartee reste visible (on voit ce que le siege a tente), barree : elle ne compte pas. */
.debate-sources li.source-rejected .debate-url, .debate-sources li.source-rejected .debate-quote { text-decoration: line-through; color: var(--faint); }
.debate-alert { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12.5px/1.55 var(--font-sans); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.debate-delivery { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; }

@media (max-width: 1100px) {
  .debate-seats { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .debate-summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .debate-summary { grid-template-columns: 1fr; }
  .debate-fact { grid-template-columns: 1fr; }
  .debate-gemini { border-left: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
  /* La liste devient une carte par choc : six colonnes ne tiennent pas a 390 px. */
  .debate-list thead { display: none; }
  .debate-list, .debate-list tbody, .debate-list tr, .debate-list td { display: block; width: 100%; }
  .debate-list tr { padding: 10px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .debate-list td { padding: 0; border: 0; }
  .debate-list td::before { content: attr(data-label); display: block; font-size: 10px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
  .debate-states .debate-help { display: block; }
  .debate-states tr { display: grid; grid-template-columns: 4ch minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .debate-states td { padding: 0; border: 0; }
  .debate-states td.debate-help { grid-column: 2; }
  .debate-other-states { padding-left: 14px; padding-right: 14px; }
  .debate-other-states .debate-states tr { grid-template-columns: minmax(0, 1fr); padding-left: 0; padding-right: 0; }
  .debate-other-states .debate-states td.debate-help { grid-column: 1; }
}
