/* ════════════════════════════════════════════════════════════════════
   Bug Dashboard v2 — styles. Variables partagées : assets/theme.css
   (navy/accent/green/red/border/bg/white/text/muted/font/font-mono).
   Secours ci-dessous si le thème ne charge pas.
   ════════════════════════════════════════════════════════════════════ */
:root{
  --navy:#0C1A2E; --accent:#0C447C; --green:#1A7A42; --red:#C0392B; --border:#E8EAED;
  --muted:#6B7A90; --bg:#F4F5F7; --white:#FFFFFF; --text:#0C1A2E;
  --font:'Manrope',system-ui,sans-serif; --font-mono:'DM Mono',ui-monospace,monospace;
  --amber:#eda100; --purple:#4a3aa7; --blue:#2a78d6;
  --surface-2:#F3F5F8; --grid:#E5E8EE; --ink-2:#4B5A70;
  --good:#0ca30c; --warn:#fab219; --serious:#ec835a; --critical:#d03b3b;
  --radius:12px; --shadow:0 1px 3px rgba(12,26,46,.05);
  /* Surfaces propres à l'outil (valeurs claires = rendu d'origine). */
  --bd-raised:#fff;          /* contenu posé dans une section : champs, tuiles, alertes, versions */
  --bd-section:#F5F5F5; --bd-section-line:#D9D9D9; --bd-section-sub:#5B6A80;
  --bd-halo:#fff;            /* liserés et halos des graphiques */
  --bd-field:#fbfcfe;        /* zones de saisie longues */
  --bd-strong:var(--navy);   /* fond plein : bouton principal, segment choisi */
  --bd-good-ink:#006300;     /* « dans les temps », écart positif */
  --bd-hover:#eef4ff; --bd-hover-2:#f3f7ff; --bd-tint:#EAF1F8;
  --bd-spark:#B9C0CC;
}
/* Mode sombre : raccord aux jetons --tk-* (assets/theme.css). --navy et
   --white y deviennent encre et surface ; les fonds pleins passent par --bd-strong. */
:root[data-theme="dark"]{
  --navy:var(--tk-ink); --text:var(--tk-ink); --accent:var(--tk-accent); --muted:var(--tk-muted);
  --border:var(--tk-line); --bg:var(--tk-page-bg); --white:var(--tk-surface);
  --green:var(--tk-ok); --green-bg:var(--tk-ok-bg); --red:var(--tk-bad); --red-bg:var(--tk-bad-bg);
  --surface-2:var(--tk-field); --grid:var(--tk-line); --ink-2:var(--tk-ink-2);
  --purple:#8577E0; --critical:#E25C5C;
  --shadow:0 1px 3px var(--tk-shadow-c);
  --bd-raised:var(--tk-surface-2); --bd-section:var(--tk-surface); --bd-section-line:var(--tk-line); --bd-section-sub:var(--tk-muted);
  --bd-halo:var(--tk-surface); --bd-field:var(--tk-field); --bd-strong:var(--tk-strong); --bd-good-ink:var(--tk-ok);
  --bd-hover:rgba(106,165,232,.12); --bd-hover-2:rgba(106,165,232,.12); --bd-tint:var(--tk-info-bg);
  --bd-spark:#5A6A80;
}
*{box-sizing:border-box;}
body{margin:0; font-family:var(--font); background:var(--bg); color:var(--text); font-size:13.5px;}
main{display:block; padding:24px clamp(16px,3vw,40px) 60px; max-width:1600px; margin:0 auto;}
a{color:var(--accent);}
.hidden{display:none !important;}
button{font-family:var(--font); font-weight:700; font-size:12.5px; border:none; border-radius:8px; padding:9px 16px; cursor:pointer;}
button.primary{background:var(--bd-strong); color:#fff;}
button.primary:hover{background:var(--accent);}
button.ghost, .btn-like{background:var(--bd-raised); color:var(--muted); border:1px solid var(--border); font-weight:700; font-size:12.5px; border-radius:8px; padding:9px 14px; cursor:pointer; display:inline-flex; align-items:center; gap:6px;}
button.ghost:hover, .btn-like:hover{border-color:var(--navy); color:var(--navy);}
button.ghost.danger{color:var(--red);}
button:disabled{opacity:.45; cursor:not-allowed;}
button.small{padding:6px 10px; font-size:11.5px;}
.icon-btn{background:transparent; border:1px solid transparent; color:var(--muted); padding:4px 7px; border-radius:6px; font-size:12px;}
.icon-btn:hover{border-color:var(--border); color:var(--navy); background:var(--bd-raised);}
.tk-topbar__actions{margin-left:auto; display:flex; align-items:center; gap:10px;}
.tk-topbar__user{color:rgba(255,255,255,.75); font-size:12px;}
.tk-topbar__user b{color:#fff;}

.tk-hero .mode-badge{margin-top:8px}
.mode-badge{display:inline-flex; align-items:center; gap:6px; font-size:11px; font-weight:700; padding:4px 10px; border-radius:999px; background:var(--bd-tint); color:var(--accent);}
.mode-badge.local{background:#FBF1E6; color:#b0611f;}
.mode-badge a{color:inherit;}

/* ── Cartes / sections ──────────────────────────────────────────────── */
.card{background:var(--white); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px 16px; margin-bottom:16px; box-shadow:var(--shadow);}
.card h2{font-size:14.5px; margin:0 0 2px; color:var(--navy); font-weight:800;}
.card .sub{font-size:12px; color:var(--muted); margin-bottom:12px;}
.card-head{display:flex; justify-content:space-between; align-items:flex-start; gap:12px;}
.card-head .sub{margin-bottom:0;}
.card-tools{display:flex; gap:6px; align-items:center; flex:none; flex-wrap:wrap; justify-content:flex-end;}
.section-title{display:flex; align-items:center; gap:10px; margin:22px 0 10px;}
.section-title h3{margin:0; font-size:12px; text-transform:uppercase; letter-spacing:.6px; color:var(--muted); font-weight:800;}
.section-title .line{flex:1; height:1px; background:var(--border);}
.collapse-btn{display:inline-flex; align-items:center; gap:6px; background:var(--bd-raised); color:var(--muted); border:1px solid var(--border); border-radius:8px; padding:6px 11px; font-size:12px; font-weight:700; cursor:pointer; white-space:nowrap;}
.collapse-btn:hover{border-color:var(--navy); color:var(--navy);}
.collapse-btn .chev{display:inline-block; transition:transform .15s ease; font-size:11px;}
.collapse-btn.is-collapsed .chev{transform:rotate(-90deg);}
.empty{text-align:center; padding:36px 20px; color:var(--muted); font-size:13px;}

/* ── Section données ────────────────────────────────────────────────── */
textarea#pasteArea{width:100%; min-height:110px; border:1.5px dashed var(--border); border-radius:10px; padding:12px; font-family:var(--font-mono); font-size:12px; color:var(--text); resize:vertical; background:var(--bd-field);}
textarea#pasteArea:focus{outline:2px solid var(--accent); border-style:solid;}
.paste-actions{display:flex; gap:10px; margin-top:10px; align-items:center; flex-wrap:wrap;}
.paste-actions input[type=text]{border:1px solid var(--border); border-radius:8px; padding:8px 10px; font-family:var(--font); font-size:12.5px; min-width:240px;}
.status-msg{font-size:12px; color:var(--muted);}
.status-msg.ok{color:var(--green); font-weight:700;}
.status-msg.err{color:var(--red); font-weight:700;}
.col-chips{display:flex; gap:6px; flex-wrap:wrap; margin-top:10px;}
.chip{font-size:11px; font-weight:700; padding:3px 9px; border-radius:999px; border:1px solid var(--border); background:var(--bd-raised); color:var(--muted);}
.chip.on{background:#E7F2EC; color:var(--green); border-color:rgba(26,122,66,.25);}
.chip.off{background:#FBEAE8; color:var(--red); border-color:rgba(192,57,43,.2);}
.chip.opt{background:#F4F5F7; opacity:.85;}   /* colonne absente et non bloquante : gris + croix */

/* ── Barre de filtres (une seule, au-dessus de tout ce qu'elle filtre) ── */
.filterbar{position:sticky; top:var(--tk-stick,56px); z-index:30; padding:14px 20px 12px; margin:0 0 16px; display:flex; flex-direction:column; gap:10px; align-items:stretch;}
.filterbar h2{margin:0;}
.is-folded .sub-more{display:none;}
#kpiBody .kpi-grid{margin:12px 0 0;}
.filter-head{display:flex; gap:12px; align-items:center; flex-wrap:wrap;}
.filter-body{display:flex; gap:14px; align-items:center; flex-wrap:wrap;}
.filter-head .collapse-btn, .section-title .collapse-btn{padding:4px 9px;}
.ticket-search{position:relative; flex:0 1 300px; min-width:190px;}
.ticket-search input{width:100%; box-sizing:border-box; border:1px solid var(--border); border-radius:8px; padding:6px 10px; font-family:var(--font); font-size:12.5px; background:var(--bd-raised); color:var(--text);}
.ticket-search input:focus{outline:none; border-color:var(--accent);}
.ts-list{position:absolute; top:calc(100% + 4px); left:0; width:min(560px, 92vw); z-index:60; background:var(--bd-raised); border:1px solid var(--border); border-radius:10px; box-shadow:0 8px 24px rgba(12,26,46,.18); padding:4px; max-height:340px; overflow:auto;}
.ts-item{display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:baseline; padding:7px 10px; border-radius:7px; cursor:pointer; font-size:12.5px;}
.ts-item b{color:var(--navy); font-family:var(--font-mono); font-size:12px;}
.ts-item:hover, .ts-item.is-cur{background:var(--bd-hover);}
.ts-item .ts-sum{color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;}
.ts-item .ts-st{color:var(--muted); font-size:11px; white-space:nowrap;}
.ts-item.is-done .ts-sum{color:var(--muted);}
.ts-more, .ts-none{padding:7px 10px; font-size:12px; color:var(--muted);}
.cube-head{margin-bottom:14px;}
.cube-head.is-folded{margin-bottom:0;}
.filter-group{display:flex; align-items:center; gap:6px; flex-wrap:wrap;}
.filter-label{font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); font-weight:800; margin-right:2px;}
.seg{display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; background:var(--bd-raised);}
.seg button{background:var(--bd-raised); color:var(--muted); border:none; border-right:1px solid var(--border); padding:6px 12px; font-size:12px; font-weight:700; border-radius:0;}
.seg button:last-child{border-right:none;}
.seg button:hover:not(:disabled):not(.is-on){background:var(--bd-hover-2); color:var(--navy);}
.seg button.is-on{background:var(--bd-strong); color:#fff;}
.fchip{background:var(--bd-raised); color:var(--muted); border:1px solid var(--border); border-radius:999px; padding:5px 11px; font-size:12px; font-weight:700; display:inline-flex; align-items:center; gap:6px;}
.fchip .dot{width:8px; height:8px; border-radius:50%; display:inline-block;}
.fchip.is-on{border-color:var(--navy); color:var(--navy); background:var(--bd-tint);}
.fchip.is-pick{border-color:var(--accent); color:var(--accent); background:var(--bd-tint); cursor:pointer;}
.fchip.is-pick .x{font-weight:800; opacity:.6;}
.fchip.is-pick:hover{background:#dce9f6;}
.filter-reset{margin-left:auto;}
.filter-head .filter-summary{margin-left:auto;}
.filter-head .filter-summary + .filter-reset{margin-left:0;}
.filter-summary{font-size:12px; color:var(--muted);}
.filter-summary.is-filtered{color:var(--accent); font-weight:700;}
.seg .seg-n{font-weight:700; opacity:.55; font-size:11px; margin-left:1px;}
.seg button.is-on .seg-n{opacity:.75;}

/* ── KPI ────────────────────────────────────────────────────────────── */
.kpi-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:12px; margin-bottom:16px;}
.kpi{background:var(--bd-raised); border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px 12px; position:relative; overflow:hidden; cursor:pointer; transition:box-shadow .15s ease, transform .15s ease; box-shadow:var(--shadow);}
.kpi::before{content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--accent);}
.kpi.tone-good::before{background:var(--good);}
.kpi.tone-warn::before{background:var(--warn);}
.kpi.tone-serious::before{background:var(--serious);}
.kpi.tone-critical::before{background:var(--critical);}
.kpi.tone-purple::before{background:var(--purple);}
.kpi.tone-neutral::before{background:#B9C0CC;}
.kpi:hover{box-shadow:0 6px 18px rgba(12,26,46,.12); transform:translateY(-1px);}
.kpi .label{font-size:11px; text-transform:uppercase; letter-spacing:.5px; color:var(--muted); font-weight:700; margin-bottom:6px;}
.kpi .value{font-size:26px; font-weight:800; color:var(--navy); line-height:1; display:flex; align-items:baseline; gap:8px;}
.kpi .value small{font-size:13px; color:var(--muted); font-weight:700;}
.kpi .sub{font-size:11.5px; color:var(--muted); margin-top:6px; line-height:1.35;}
.kpi .delta{font-size:11.5px; font-weight:800; margin-left:auto;}
.kpi .delta.up{color:#006300;} .kpi .delta.down{color:var(--critical);} .kpi .delta.flat{color:var(--muted);}
.kpi .spark{position:absolute; right:12px; bottom:10px; width:84px; height:26px; opacity:.9;}
.kpi.has-spark .sub{padding-right:92px;}

/* ── Alertes ────────────────────────────────────────────────────────── */
.alerts{display:flex; flex-direction:column; gap:8px;}
.alert{display:flex; gap:10px; align-items:flex-start; padding:10px 12px; border-radius:10px; border:1px solid var(--border); background:var(--bd-raised); cursor:pointer;}
.alert:hover{border-color:var(--navy);}
.alert .ic{width:22px; height:22px; border-radius:6px; display:inline-flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; color:#fff; flex:none;}
.alert.critical .ic{background:var(--critical);} .alert.serious .ic{background:var(--serious);} .alert.warning .ic{background:var(--warn); color:#0b1a2e;} .alert.info .ic{background:var(--blue);}
.alert b{color:var(--navy);}
.alert .txt{font-size:12.5px; line-height:1.4;}
.alert .cnt{margin-left:auto; font-family:var(--font-mono); font-size:12px; color:var(--muted); flex:none;}

/* ── Cube (cartes pivot) ───────────────────────────────────────────── */
.cube-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(460px,1fr)); gap:16px;}
.cube-grid .card{margin-bottom:0; min-width:0;}
.card.wide{grid-column:1 / -1;}
.cube-grid .card.w2{grid-column:span 2;}
.style-seg{display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden;}
.style-seg button{background:var(--bd-raised); border:none; border-right:1px solid var(--border); color:var(--muted); padding:4px 8px; font-size:11px; border-radius:0;}
.style-seg button:last-child{border-right:none;}
.style-seg button.is-on{background:var(--bd-strong); color:#fff;}
.style-seg button:hover:not(.is-on){background:var(--bd-hover-2); color:var(--navy);}
.dim-select{font-family:var(--font); font-weight:700; font-size:11px; border:1px solid var(--border); border-radius:6px; padding:4px 6px; background:var(--bd-raised); color:var(--muted); max-width:130px;}
.chart-body{margin-top:12px; min-height:60px;}
.cube-grid .card-head{flex-direction:column; align-items:stretch; gap:8px;}
/* Cartes du cube : tout se règle sur la carte — poignée de glissement, titre
   éditable en place, corbeille, et carte « + » en fin de grille. */
.card-ident{display:flex; align-items:center; gap:6px;}
.cube-grid .card .grip{cursor:grab; color:#B9C0CC; font-size:14px; padding:0 2px; touch-action:none; user-select:none;}
.cube-grid .card .grip:active{cursor:grabbing;}
.cube-grid .card.is-dragging{opacity:.55; outline:2px dashed var(--accent); outline-offset:2px;}
.card-title{flex:1; min-width:0; border:1px solid transparent; background:transparent; border-radius:6px; padding:2px 4px;
  font-family:inherit; font-size:14.5px; font-weight:800; color:var(--navy);}
.card-title:hover{border-color:var(--border);}
.card-title:focus{border-color:var(--accent); background:var(--white); outline:none;}
.card-add{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:150px;
  border:2px dashed var(--border); background:transparent; box-shadow:none; color:var(--muted); font-family:inherit;
  font-size:12.5px; font-weight:700; cursor:pointer;}
.card-add:hover{border-color:var(--accent); color:var(--accent); background:var(--white);}
.card-add .plus{font-size:30px; line-height:1; font-weight:400;}
.cube-grid .card-tools{justify-content:flex-start; padding-top:6px; border-top:1px dashed var(--border);}

/* empilé horizontal */
.hs-row{display:grid; grid-template-columns:150px 1fr 44px; align-items:center; gap:10px; margin-bottom:8px;}
.hs-label{font-size:12.5px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;}
.hs-label:hover{color:var(--accent); text-decoration:underline;}
.hs-track{display:flex; height:20px; gap:2px;}
.hs-seg{height:100%; border-radius:2px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:10.5px; font-weight:700; cursor:pointer; min-width:0;}
.hs-seg:first-child{border-radius:4px 2px 2px 4px;} .hs-seg:last-child{border-radius:2px 4px 4px 2px;}
.hs-seg:hover{filter:brightness(1.1); box-shadow:inset 0 0 0 2px rgba(255,255,255,.7);}
.hs-total{font-family:var(--font-mono); font-size:12px; color:var(--muted); text-align:right;}
/* empilé vertical */
.vs-wrap{display:flex; align-items:flex-end; gap:18px; overflow-x:auto; padding:6px 4px 2px;}
.vs-col{display:flex; flex-direction:column; align-items:center; gap:6px; flex:none;}
.vs-total{font-family:var(--font-mono); font-size:11px; color:var(--muted);}
.vs-track{position:relative; width:44px; height:190px; background:var(--surface-2); border-radius:6px;}
.vs-fill{position:absolute; left:0; right:0; bottom:0; display:flex; flex-direction:column-reverse; gap:2px;}
.vs-seg{width:100%; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:10px; font-weight:700; cursor:pointer; border-radius:2px;}
.vs-fill .vs-seg:last-child{border-radius:4px 4px 2px 2px;}
.vs-seg:hover{filter:brightness(1.1); box-shadow:inset 0 0 0 2px rgba(255,255,255,.7);}
.vs-label{font-size:11.5px; font-weight:600; color:var(--text); text-align:center; max-width:72px; word-break:break-word; cursor:pointer; line-height:1.2;}
.vs-label:hover{color:var(--accent);}
/* barres simples */
.bar-row{display:grid; grid-template-columns:170px 1fr 44px; align-items:center; gap:10px; margin-bottom:8px; cursor:pointer; border-radius:6px; padding:2px 4px; margin-left:-4px; margin-right:-4px;}
.bar-row:hover{background:var(--bd-hover);}
.bar-label{font-size:12.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.bar-track{height:14px; background:var(--surface-2); border-radius:4px;}
.bar-fill{height:100%; border-radius:0 4px 4px 0;}
.bar-val{font-family:var(--font-mono); font-size:12px; color:var(--muted); text-align:right;}
/* barres groupées (2D) */
.gb-row{display:grid; grid-template-columns:150px 1fr; gap:10px; margin-bottom:10px; align-items:start;}
.gb-label{font-size:12.5px; font-weight:600; padding-top:2px; cursor:pointer;}
.gb-label:hover{color:var(--accent);}
.gb-bars{display:flex; flex-direction:column; gap:3px;}
.gb-bar{display:grid; grid-template-columns:1fr 36px; gap:8px; align-items:center;}
.gb-track{height:9px; background:var(--surface-2); border-radius:3px;}
.gb-fill{height:100%; border-radius:0 3px 3px 0; cursor:pointer;}
.gb-fill:hover{filter:brightness(1.1);}
.gb-val{font-family:var(--font-mono); font-size:11px; color:var(--muted);}
/* heatmap */
.hm{display:grid; gap:3px; font-size:12px;}
.hm-colhead{font-size:11px; font-weight:700; color:var(--muted); text-align:center; padding:0 2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;}
.hm-colhead:hover, .hm-rowhead:hover{color:var(--accent);}
.hm-rowhead{font-size:12px; font-weight:600; padding-right:8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; align-self:center; cursor:pointer;}
.hm-cell{height:34px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12px; font-weight:700; cursor:pointer; position:relative;}
.hm-cell:hover{box-shadow:0 0 0 2px var(--bd-halo), 0 0 0 4px var(--accent); z-index:1;}
.hm-cell.zero{color:#B9C0CC; font-weight:500;}
.hm-tot{font-family:var(--font-mono); font-size:11.5px; color:var(--muted); text-align:center; align-self:center;}
/* Heatmap scindée : un bloc « en cours », un bloc « terminé ». */
.hm-split .hm-band{display:flex; align-items:center; justify-content:center; gap:8px; border-radius:6px; padding:5px 0; margin-bottom:4px; font-size:11px; font-weight:800; letter-spacing:.3px;}
.hm-split .hm-band .dot{width:8px; height:8px; border-radius:50%; background:currentColor;}
.hm-split .hm-band b{font-family:var(--font-mono); font-size:11.5px; font-weight:500;}
.hm-split .hm-band.g-open{background:#eef4fc; color:#2a78d6;}
.hm-split .hm-band.g-done{background:#eff7ef; color:#008300;}
.hm-split .hm-sub{height:34px; border-radius:6px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12.5px; font-weight:700; cursor:pointer;}
.hm-split .hm-sub.g-open{background:#eef4fc; color:#1c5cab; border:1px solid #cde2fb;}
.hm-split .hm-sub.g-done{background:#eff7ef; color:#046a04; border:1px solid #d2ebd2;}
.hm-split .hm-sub:hover{box-shadow:0 0 0 2px var(--bd-halo), 0 0 0 4px var(--accent);}
.hm-split .hm-tot.strong{font-weight:700; color:var(--navy);}
.hm-split .hm-gap{border-left:1px dashed #D8DDE6; width:1px; justify-self:center;}
/* ── Cartes à trois niveaux ─────────────────────────────────────────
   « nest » / « nestbars » : les colonnes descendent en sous-lignes sous chaque
   ligne, le découpage prend les colonnes. Les lignes de groupe sont posées sur
   un fond clair, les sous-lignes rentrent d'un cran. « subcols » réutilise la
   grille de la heatmap scindée, avec un bandeau neutre par colonne — bleu et
   vert y sont déjà pris par la rampe et par les couleurs du découpage. */
/* Un découpage large (5 priorités × 4 résolutions, par exemple) dépasse la
   carte même en pleine largeur : le tableau défile alors horizontalement plutôt
   que de perdre ses dernières colonnes hors champ. */
/* Le « × » et le « › » restent collés à leur sélecteur quand la ligne passe
   à la ligne suivante : un chevron orphelin en fin de ligne ne veut rien dire. */
.cfg-pair{display:inline-flex; align-items:center; gap:6px; min-width:0;}
.hm-scroll{overflow-x:auto; overflow-y:hidden; scrollbar-width:thin; padding-bottom:2px;}
.nst{display:grid; gap:3px; font-size:12px;}
.nst-corner{}
/* En-tête du découpage : peu de colonnes, mais des libellés qui peuvent être
   longs — ils reviennent à la ligne plutôt que de finir en points de suspension,
   et la ligne d'en-tête s'aligne sur le bas. */
.nst-colhead{font-size:10.5px; font-weight:700; color:var(--muted); letter-spacing:.2px; text-align:center; padding:0 4px 5px; line-height:1.3; align-self:end; cursor:pointer;}
.nst-colhead .dot{width:7px; height:7px; border-radius:50%; display:inline-block; margin-right:4px; vertical-align:1px;}
.nst-colhead:hover{color:var(--accent);}
.nst-grp{background:#F5F8FC; border-radius:6px; height:31px; display:flex; align-items:center; gap:7px; padding:0 9px; font-weight:800; color:var(--navy); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;}
.nst-grp:hover{color:var(--accent);}
.nst-gnum{background:#F5F8FC; border-radius:6px; height:31px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12px; font-weight:800; color:var(--navy); cursor:pointer;}
.nst-sub{height:28px; display:flex; align-items:center; gap:6px; padding-left:17px; font-size:11.5px; font-weight:600; color:var(--ink-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;}
.nst-sub:hover{color:var(--accent);}
.nst-sub .tick{color:#C3CAD5; font-size:10px; flex:none;}
.nst-snum{height:28px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12px; font-weight:600; color:var(--ink-2); cursor:pointer;}
.nst-gnum:hover, .nst-snum:hover, .nst-tnum:hover{box-shadow:inset 0 0 0 2px var(--accent); border-radius:6px;}
.nst-gnum.zero, .nst-snum.zero, .nst-tnum.zero{color:#C3CAD5; font-weight:500;}
.nst-snum.strong{color:var(--navy); font-weight:800;}
.nst-rule{height:1px; background:var(--border); margin:4px 0;}
.nst-totl{height:30px; display:flex; align-items:center; font-weight:800; color:var(--navy);}
.nst-tnum{height:30px; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:12.5px; font-weight:800; color:var(--navy); cursor:pointer;}
.nst-bar{display:flex; align-items:center; padding:0 7px; min-width:0;}
.nst-grp + .nst-bar{background:#F5F8FC; border-radius:6px; height:31px;}
.nst-track{display:flex; height:15px; border-radius:5px; overflow:hidden; min-width:2px;}
.nst-seg{display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:10.5px; font-weight:700; line-height:1; white-space:nowrap; min-width:0; overflow:hidden; cursor:pointer;}
.nst-seg:hover{filter:brightness(1.1); box-shadow:inset 0 0 0 2px rgba(255,255,255,.7);}
.hm-split .hm-band.g-flat{background:#F1F3F7; color:var(--ink-2); cursor:pointer;}
.hm-split .hm-band.g-flat .dot{background:var(--muted);}
.hm-split .hm-sub.g-flat{background:#F7F9FC; color:var(--navy); border:1px solid #E4E8EE;}
.hm-split .hm-sub.g-flat.zero{color:#C3CAD5; font-weight:500;}
.hm-subcols .hm-colhead{display:flex; align-items:center; justify-content:center; gap:4px; min-width:0;}
.hm-subcols .hm-colhead .dot{width:7px; height:7px; border-radius:50%; flex:none;}
.hm-subcols .hm-colhead .t{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.hm-subcols .hm-tot.zero{color:#C3CAD5;}
.chart-note{margin-top:8px; font-size:11px; color:var(--muted);}
.hm-scales{display:flex; align-items:center; gap:22px; flex-wrap:wrap; margin-top:10px;}
.hm-scales .hm-scale{margin-top:0;}
.hm-scale{display:flex; align-items:center; gap:6px; margin-top:10px; font-size:11px; color:var(--muted);}
.hm-scale .steps{display:flex; gap:2px;} .hm-scale .steps span{width:18px; height:10px; border-radius:2px; display:block;}
/* donut */
.donut-wrap{display:flex; align-items:center; gap:24px; justify-content:center; padding-top:4px; flex-wrap:wrap;}
.donut{width:160px; height:160px; border-radius:50%; position:relative; flex:none;}
.donut-hole{position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:96px; height:96px; border-radius:50%; background:var(--white); display:flex; flex-direction:column; align-items:center; justify-content:center;}
.donut-hole .n{font-size:22px; font-weight:800; color:var(--navy);}
.donut-hole .l{font-size:10px; color:var(--muted); text-transform:uppercase; letter-spacing:.3px;}
.donut-legend{display:flex; flex-direction:column; gap:7px;}
.donut-legend-item{display:flex; align-items:center; gap:8px; font-size:12.5px; cursor:pointer; padding:2px 6px; border-radius:6px;}
.donut-legend-item:hover{background:var(--bd-hover);}
.donut-legend-item .dot{width:10px; height:10px; border-radius:3px; flex:none;}
.donut-legend-item .val{margin-left:auto; font-family:var(--font-mono); color:var(--muted); padding-left:14px;}
/* tableau */
table{width:100%; border-collapse:collapse; font-size:12.5px;}
th,td{text-align:left; padding:7px 9px; border-bottom:1px solid var(--border);}
th{color:var(--muted); font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.3px;}
td.num, th.num{text-align:right; font-family:var(--font-mono); font-variant-numeric:tabular-nums;}
tr[data-dd]{cursor:pointer;} tr[data-dd]:hover{background:var(--bd-hover);}
td[data-dd]{cursor:pointer;} td[data-dd]:hover{color:var(--accent); text-decoration:underline;}
.pct-track{background:var(--surface-2); border-radius:6px; height:8px; width:100%; min-width:80px;}
.pct-fill{height:100%; border-radius:6px;}
tfoot td{font-weight:800; color:var(--navy); border-top:2px solid var(--border);}
/* légende */
.legend{display:flex; flex-wrap:wrap; gap:8px 14px; margin-top:12px; padding-top:10px; border-top:1px solid var(--border);}
.legend-item{display:flex; align-items:center; gap:6px; font-size:11.5px; color:var(--ink-2); cursor:pointer;}
.legend-item .dot{width:9px; height:9px; border-radius:2px; flex:none;}
.legend-item:hover{color:var(--navy);}
/* tooltip */
.tip{position:fixed; z-index:2000; pointer-events:none; background:#0C1A2E; color:#fff; font-size:12px; padding:7px 10px; border-radius:8px; box-shadow:0 8px 24px rgba(12,26,46,.25); max-width:300px; line-height:1.4; opacity:0; transition:opacity .08s ease;}
.tip.is-on{opacity:1;}
.tip b{color:#fff;} .tip .muted{color:rgba(255,255,255,.7);}

/* ── Drill-down ────────────────────────────────────────────────────── */
/* Fenêtre du message de fin de version : le texte s'y relit et s'y retouche
   avant d'être copié, d'où un vrai champ plutôt qu'un bloc figé. */
.msg-panel{max-width:760px;}
.msg-body{padding:16px 20px 20px;}
.msg-body textarea{width:100%; min-height:440px; border:1px solid var(--border); border-radius:10px; padding:14px 16px;
  font-family:var(--font); font-size:13.5px; line-height:1.65; color:var(--text); resize:vertical; background:var(--bd-field);}
.msg-body textarea:focus{outline:2px solid var(--accent); border-color:var(--accent);}
.msg-body textarea[readonly]{color:var(--muted); background:var(--surface-2);}
/* Champs longs du tiroir de configuration */
.cfg-block{display:block; margin:10px 0;}
.cfg-area{width:100%; min-height:110px; font-family:var(--font-mono); font-size:12px; line-height:1.6; resize:vertical;}
.dd-overlay{position:fixed; inset:0; background:rgba(12,26,46,.5); display:none; align-items:flex-start; justify-content:center; padding:48px 20px; z-index:1000;}
.dd-overlay.is-open{display:flex;}
.dd-panel{background:var(--white); border-radius:14px; width:100%; max-width:1180px; max-height:calc(100vh - 80px); display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(12,26,46,.3);}
.dd-head{display:flex; justify-content:space-between; align-items:flex-start; gap:14px; padding:16px 20px 12px; border-bottom:1px solid var(--border);}
.dd-head h3{margin:0 0 3px; font-size:15px; color:var(--navy); font-weight:800;}
.dd-sub{font-size:12px; color:var(--muted);}
.dd-actions{display:flex; gap:8px; flex:none; flex-wrap:wrap; justify-content:flex-end;}
.dd-tabs{display:flex; gap:4px; padding:10px 20px 0; border-bottom:1px solid var(--border);}
.dd-tab{background:transparent; color:var(--muted); border:1px solid transparent; border-bottom:none; border-radius:8px 8px 0 0; padding:8px 14px; font-size:12.5px;}
.dd-tab.is-on{background:var(--white); color:var(--navy); border-color:var(--border); margin-bottom:-1px;}
.dd-count{font-family:var(--font-mono); font-size:11px; background:var(--bg); padding:1px 7px; border-radius:999px; margin-left:4px;}
.dd-tab.is-on .dd-count{background:var(--bd-strong); color:#fff;}
.dd-body{padding:10px 20px 18px; overflow:auto;}
.dd-body table{font-size:12px;}
.dd-body th{cursor:pointer; white-space:nowrap; position:sticky; top:0; background:var(--white);}
.dd-body th.is-sorted{color:var(--navy);}
td.dd-key a{font-family:var(--font-mono); font-weight:700; text-decoration:none;}
td.dd-key a:hover{text-decoration:underline;}
.dd-sum{display:inline-block; max-width:320px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; vertical-align:bottom;}
.dd-empty{color:#B9C0CC;} .dd-warn{color:var(--serious); font-weight:700;}
body.dd-open{overflow:hidden;}

/* ── Tiroir de configuration ───────────────────────────────────────── */
.cfg-backdrop{position:fixed; inset:0; background:rgba(12,26,46,.35); z-index:900; display:none;}
.cfg-backdrop.is-open{display:block;}
.cfg-drawer{position:fixed; top:0; right:0; bottom:0; width:min(780px,96vw); background:var(--white); z-index:950; transform:translateX(102%); transition:transform .2s ease; display:flex; flex-direction:column; box-shadow:-12px 0 40px rgba(12,26,46,.2);}
.cfg-drawer.is-open{transform:translateX(0);}
.cfg-head{display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border);}
.cfg-head h3{margin:0; font-size:15px; color:var(--navy);}
.cfg-tabs{display:flex; gap:4px; padding:10px 20px 0; border-bottom:1px solid var(--border); flex-wrap:wrap;}
.cfg-tab{background:transparent; color:var(--muted); border:1px solid transparent; border-bottom:none; border-radius:8px 8px 0 0; padding:8px 12px; font-size:12.5px;}
.cfg-tab.is-on{background:var(--white); color:var(--navy); border-color:var(--border); margin-bottom:-1px;}
.cfg-body{padding:16px 20px 30px; overflow:auto; flex:1;}
.cfg-help{font-size:12px; color:var(--muted); line-height:1.5; margin:0 0 12px;}
.cfg-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px;}
.cfg-item{display:flex; align-items:center; gap:8px; padding:7px 10px; border:1px solid var(--border); border-radius:10px; background:var(--bd-raised);}
.cfg-item.dragging{opacity:.4;}
.cfg-item .grip{cursor:grab; color:#B9C0CC; font-size:14px;}
.cfg-item .dot{width:12px; height:12px; border-radius:3px; flex:none;}
.cfg-name{flex:1; min-width:120px; font-weight:700; font-size:12.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.cfg-muted{color:var(--muted); font-weight:500; font-style:normal; font-size:11px;}
.cfg-input{border:1px solid var(--border); border-radius:6px; padding:5px 8px; font-family:var(--font); font-size:12px; width:150px;}
.cfg-input.num{width:64px; font-family:var(--font-mono); text-align:right;}
.cfg-select{border:1px solid var(--border); border-radius:6px; padding:5px 6px; font-family:var(--font); font-size:12px; background:var(--bd-raised); max-width:170px;}
.cfg-table tr.is-on{background:var(--bd-tint);}
.cfg-table tr.is-on .cfg-input{border-color:var(--navy);}
.cfg-check{font-size:12px; color:var(--muted); display:inline-flex; align-items:center; gap:4px; white-space:nowrap;}
.cfg-color summary{list-style:none; cursor:pointer; font-size:14px; display:inline-flex; align-items:center; gap:6px; padding:3px 6px; border:1px solid var(--border); border-radius:6px; background:var(--bd-raised);}
.cfg-color summary:hover{border-color:var(--navy);}
.cfg-color summary .dot{display:inline-block; width:14px; height:14px; border-radius:4px; border:1.5px solid rgba(0,0,0,.08); flex:none;}
.cfg-color summary::after{content:'▾'; font-size:10px; color:var(--muted);}
.cfg-color summary::-webkit-details-marker{display:none;}
.cfg-color{position:relative;}
.cfg-color[open] .sw-row{position:absolute; right:0; top:100%; z-index:5; background:var(--bd-raised); border:1px solid var(--border); border-radius:10px; padding:8px; box-shadow:0 10px 28px rgba(12,26,46,.2); display:grid; grid-template-columns:repeat(8,20px); gap:5px; width:max-content;}
.sw{width:20px; height:20px; border-radius:5px; border:1.5px solid rgba(0,0,0,.08); padding:0; cursor:pointer;}
.sw.is-on{outline:2px solid var(--navy); outline-offset:1px;}
.sw-auto{grid-column:1/-1; width:auto; height:auto; font-size:10px; padding:3px; background:var(--bd-raised); color:var(--muted); border:1px solid var(--border);}
.cfg-table th, .cfg-table td{padding:6px 8px;}
.cfg-cards .cfg-card{flex-wrap:wrap;}
.cfg-title{width:190px;}
.cfg-x{color:var(--muted); font-weight:700;}
.cfg-grid{display:flex; flex-direction:column; gap:10px; font-size:12.5px; margin-bottom:16px;}
.cfg-grid label{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.cfg-body h4{margin:6px 0 8px; font-size:13px; color:var(--navy);}
.cfg-actions{display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px;}
.cfg-pre{font-size:11px; background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:10px; max-height:300px; overflow:auto;}


/* ── Évolution (lot 3) ─────────────────────────────────────────────── */
.lc{width:100%; height:auto; display:block;}
.lc .grid{stroke:var(--grid); stroke-width:1;} .lc .axis{stroke:#C3C8D2; stroke-width:1;}
.lc text{font-family:var(--font); font-size:10px; fill:var(--muted);}
.lc .ln{fill:none; stroke-width:2; stroke-linejoin:round; stroke-linecap:round;}
.lc .pt{stroke:var(--bd-halo); stroke-width:2; cursor:pointer;}
.lc .area{opacity:.12;}
.bu .ramp{fill:none; stroke:#B9C0CC; stroke-width:2; stroke-dasharray:6 4; stroke-linejoin:round;}
.bu .proj{fill:none; stroke-width:2; stroke-dasharray:3 4; opacity:.65;}
.bu .mark{stroke:#C3C8D2; stroke-width:1; stroke-dasharray:3 3;}
.bu .today{stroke:var(--navy); stroke-width:1.5; stroke-dasharray:4 3; opacity:.5;}
.bu .today-band{fill:#fa8072; opacity:.20;}
/* Ligne de repère (plafond de tickets) des graphiques d'évolution. */
.lc .thr{stroke:#C0392B; stroke-width:1.5; stroke-dasharray:5 4; opacity:.8;}
.lc .thr-l{fill:#C0392B; font-size:10.5px; font-weight:700;}
.legend .dot.thr-dot{background:transparent; border-top:2px dashed #C0392B; height:0; width:12px; border-radius:0;}
.bt .today-band{fill:#fa8072; opacity:.14;}
.bt .today{stroke:#8d94a3; stroke-dasharray:4 3;}
.bt .mark{stroke:#9AA6B6; stroke-width:1.5; stroke-dasharray:4 3;}
.bt .mark-l{fill:#6B7A90; font-size:10.5px; font-weight:700; paint-order:stroke; stroke:var(--bd-halo); stroke-width:3px; stroke-linejoin:round;}
.bt .thr-l{paint-order:stroke; stroke:var(--bd-halo); stroke-width:3px; stroke-linejoin:round;}
.bt .weekend{fill:#8d94a3; opacity:.09;}
/* ── Aires empilées sur le calendrier ───────────────────────────────
   Les bandes ne se touchent pas : un filet de surface de 2 px les sépare,
   comme entre deux segments d'une barre empilée. Le sommet porte un point
   par photo — l'aire ne doit pas laisser croire à une mesure continue. */
.ba .ar{fill-opacity:.88;}
.ba .ar-sep{fill:none; stroke:var(--bd-halo); stroke-width:2; stroke-linejoin:round;}
.ba .ar-top{fill:none; stroke-width:2; stroke-linejoin:round; filter:brightness(.82);}
.ba .ar-pt{fill:var(--bd-halo); stroke-width:2;}
.ba .ar-hit{fill:transparent; cursor:crosshair;}
.ba .ar-lab{font-family:var(--font-mono); font-size:11px; font-weight:700; paint-order:stroke; stroke:var(--bd-halo); stroke-width:3px; stroke-linejoin:round;}
.legend .dot.ring{background:var(--bd-halo); border:2px solid var(--muted); border-radius:50%; width:9px; height:9px;}
.bu .weekend{fill:#8d94a3; opacity:.09;}
.bu .tick{stroke:#A8B0BE; stroke-width:1;}
.bu .tick.half{stroke:#CFD5DE;}
.bu .mark.kick, .bt .mark.kick{stroke:var(--blue);}
.bu .mark-l.kick, .bt .mark-l.kick{fill:var(--blue);}
.bu .mark-l{font-size:9.5px; fill:var(--muted); font-weight:700;}
.bu .gap{stroke-width:2;}
.bu .gap-l{font-size:11px; font-weight:800;}
.legend-item .dot.dash{background:#B9C0CC; border-radius:1px; height:3px; width:12px;}
.bc .bar{cursor:pointer; transition:opacity .12s ease;}
.bc .bar:hover{opacity:.82;}
.chart-scroll{overflow-x:auto; padding-bottom:4px;}
.hist-controls{display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:8px;}
.hist-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; max-height:280px; overflow:auto;}
.hist-item{display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid var(--border); border-radius:10px; font-size:12.5px; background:var(--bd-raised);}
.hist-item.is-current{border-color:var(--navy);}
.hist-item .when{font-family:var(--font-mono); font-size:11.5px; color:var(--muted); flex:none; width:118px;}
.hist-item .name{flex:1; font-weight:700; color:var(--navy);}
.hist-item .meta{font-size:11px; color:var(--muted);}
/* Journal : un bloc par version — son officielle, puis le travail replié. */
.ver-block{margin-top:14px;}
.ver-block + .ver-block{border-top:1px dashed var(--border); padding-top:14px;}
.ver-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:6px;}
.ver-head .ver-name{font-size:13px; font-weight:800; color:var(--navy);}
.ver-head .collapse-btn{margin-left:auto; padding:4px 9px;}
.ver-head .sub{margin-left:auto; font-size:11.5px;}
.hist-list.ver-sub{margin-top:6px; padding-left:18px; border-left:2px solid var(--border);}
.diff-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px; margin-top:10px;}
.diff-box{border:1px solid var(--border); border-radius:10px; padding:10px 12px; cursor:pointer; background:var(--bd-raised);}
.diff-box:hover{border-color:var(--navy);}
.diff-box .n{font-size:22px; font-weight:800; color:var(--navy);} .diff-box .l{font-size:11.5px; color:var(--muted);}

/* ── IA (lot 4) ───────────────────────────────────────────────────── */
.ai-card{border-left:4px solid var(--purple);}
.ai-text{font-size:13.5px; line-height:1.6; color:var(--text);}
.ai-text h4{margin:12px 0 4px; font-size:13px; color:var(--navy);}
.ai-text ul{margin:4px 0 8px 18px; padding:0;} .ai-text li{margin:2px 0;}
.ai-text code{font-family:var(--font-mono); font-size:12px; background:var(--bg); padding:1px 5px; border-radius:4px;}
.ai-text a{font-family:var(--font-mono); font-weight:700; text-decoration:none;}
.ai-meta{font-size:11px; color:var(--muted); margin-top:8px;}
.ai-ask{display:flex; gap:8px; margin-top:12px;}
.ai-ask input{flex:1; border:1px solid var(--border); border-radius:8px; padding:9px 12px; font-family:var(--font); font-size:13px;}
.ai-answer{margin-top:10px; padding:12px 14px; background:var(--bg); border-radius:10px;}
.ai-setup{font-size:12.5px; background:#FBF1E6; border:1px solid #F1D9BE; border-radius:10px; padding:10px 12px; color:#7a4a12; line-height:1.5;}
.ai-setup code{background:var(--bd-raised);}
.spinner{display:inline-block; width:14px; height:14px; border:2px solid var(--border); border-top-color:var(--navy); border-radius:50%; animation:spin .8s linear infinite; vertical-align:middle;}
@keyframes spin{to{transform:rotate(360deg);}}

.archive-banner{display:flex; align-items:center; gap:12px; flex-wrap:wrap; background:#FBF1E6; border:1px solid #F1D9BE; border-radius:10px; padding:10px 14px; margin:8px 0 12px; font-size:12.5px; color:#7a4a12;}
.archive-banner b{color:#5a3608;}
.archive-banner button{margin-left:auto;}
footer{margin-top:10px; font-size:11.5px; color:var(--muted); line-height:1.6;}
/* Sous 1000 px la grille perd sa deuxième colonne : « 2 colonnes » y retombe sur une. */
@media (max-width:1000px){ .cube-grid .card.w2{grid-column:auto;} }
@media (max-width:900px){ .cube-grid{grid-template-columns:1fr;} .hs-row, .bar-row{grid-template-columns:110px 1fr 40px;} }
@media print{ .filterbar, .tk-topbar, .paste-card, .collapse-btn, .card-tools, .dd-overlay, .cfg-drawer, .cfg-backdrop{display:none !important;} .card{break-inside:avoid;} }
/* ── Historique des régressions ── */
.rg-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:16px 24px; margin-top:12px;}
.rg-lbl{font:700 10.5px var(--font-mono); letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin-bottom:6px;}
.rg-row{display:grid; grid-template-columns:minmax(70px,1fr) 1.2fr 24px; gap:8px; align-items:center; font-size:12px; margin:3px 0;}
.rg-l{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--ink-2);}
.rg-bar{height:6px; border-radius:3px; background:var(--border); overflow:hidden;} .rg-bar i{display:block; height:100%; background:var(--serious);}
.rg-row b{font:600 12px var(--font-mono); text-align:right;}
.rg-weeks{display:flex; align-items:flex-end; gap:4px; height:92px;}
.rg-wk{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:2px; min-width:0;}
.rg-wk i{display:block; width:100%; max-width:22px; background:var(--serious); border-radius:3px 3px 0 0; min-height:1px;}
.rg-n{font:600 10.5px var(--font-mono); color:var(--ink-2);} .rg-d{font:500 9.5px var(--font-mono); color:var(--muted);}
.rg-list{margin-top:12px;} .rg-list summary{cursor:pointer; font-weight:700; font-size:12.5px; color:var(--accent);}
#alertsCount:empty{display:none;}

/* Sections numérotées 1 à 5 : fond gris léger, le contenu (champs, tuiles, alertes, versions) reste blanc. */
#sec-cube .card:not(.card-add), #sec-history .card, .card.sec{background:var(--bd-section); border-color:var(--bd-section-line); box-shadow:none;}
#sec-cube .card:not(.card-add) .sub, #sec-history .card .sub, .card.sec .sub{color:var(--bd-section-sub);}

/* Date de référence : verrouillée et grisée, le crayon la déverrouille. */
.ref-field{display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted);}
.ref-field label{font-weight:700; white-space:nowrap;}
.ref-field input, .ref-field select{border:1px solid var(--border); border-radius:8px; padding:7px 8px; font-family:var(--font); font-size:12.5px; background:var(--bd-raised); color:var(--text);}
.ref-field input:disabled, .ref-field select:disabled{background:#EDEEF0; color:#8A94A3; cursor:not-allowed;}
.ref-edit{background:var(--bd-raised); color:var(--muted); border:1px solid var(--border); border-radius:8px; padding:6px 9px; font-size:13px; cursor:pointer; line-height:1;}
.ref-edit:hover{border-color:var(--navy); color:var(--navy);}
.ref-ok{color:var(--green); border-color:var(--green);}
.ref-field.is-fixed input:disabled, .ref-field.is-fixed select:disabled{background:var(--bd-tint); color:var(--accent); border-color:var(--accent); cursor:default;}

.code-line{display:flex; align-items:center; gap:10px; margin-top:8px; font-size:11.5px; color:var(--muted);} .code-line b{color:var(--ink-2); font-weight:600;}
.code-bar{flex:0 0 90px; height:3px; border-radius:2px; background:var(--border); overflow:hidden;} .code-bar i{display:block; height:100%; background:var(--muted);}

/* ════════════════════════════════════════════════════════════════════
   Mode sombre — couleurs écrites en dur ci-dessus (le clair n'en dépend pas).
   ════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .tk-btn--on-dark{color:#fff;}   /* --white y vaut la surface */
[data-theme="dark"] button.primary:hover{background:#3B7DCB;}
[data-theme="dark"] .mode-badge{background:var(--tk-info-bg); color:var(--tk-info);}
[data-theme="dark"] .mode-badge.local{background:var(--tk-warn-bg); color:var(--tk-warn);}
[data-theme="dark"] .chip.on{background:var(--tk-ok-bg); border-color:rgba(76,194,122,.3);}
[data-theme="dark"] .chip.off{background:var(--tk-bad-bg); border-color:rgba(240,138,138,.3);}
[data-theme="dark"] .chip.opt{background:var(--tk-field);}
[data-theme="dark"] .paste-actions input[type=text], [data-theme="dark"] .cfg-input, [data-theme="dark"] .ai-ask input{background:var(--bd-raised); color:var(--text);}
[data-theme="dark"] .fchip.is-on{border-color:var(--tk-accent);}
[data-theme="dark"] .fchip.is-pick:hover{background:rgba(106,165,232,.22);}
[data-theme="dark"] .kpi.tone-neutral::before{background:var(--tk-line-2);}
[data-theme="dark"] .kpi:hover{box-shadow:0 6px 18px rgba(0,0,0,.4);}
[data-theme="dark"] .kpi .delta.up{color:var(--tk-ok);}
[data-theme="dark"] .cube-grid .card .grip, [data-theme="dark"] .cfg-item .grip, [data-theme="dark"] .dd-empty{color:#5A6A80;}
/* Heatmaps : zéros, bandeaux et sous-totaux */
[data-theme="dark"] .hm-cell.zero, [data-theme="dark"] .nst-sub .tick,
[data-theme="dark"] .nst-gnum.zero, [data-theme="dark"] .nst-snum.zero, [data-theme="dark"] .nst-tnum.zero,
[data-theme="dark"] .hm-split .hm-sub.g-flat.zero, [data-theme="dark"] .hm-subcols .hm-tot.zero{color:#56667D;}
[data-theme="dark"] .hm-split .hm-band.g-open{background:rgba(42,120,214,.18); color:#8DB8F0;}
[data-theme="dark"] .hm-split .hm-band.g-done{background:rgba(0,131,0,.2); color:#7BD48A;}
[data-theme="dark"] .hm-split .hm-sub.g-open{background:rgba(42,120,214,.14); color:#A9CBF5; border-color:rgba(106,165,232,.32);}
[data-theme="dark"] .hm-split .hm-sub.g-done{background:rgba(0,131,0,.16); color:#8FDB9C; border-color:rgba(76,194,122,.3);}
[data-theme="dark"] .hm-split .hm-gap{border-left-color:var(--tk-line-2);}
[data-theme="dark"] .nst-grp, [data-theme="dark"] .nst-gnum, [data-theme="dark"] .nst-grp + .nst-bar{background:var(--bd-raised);}
[data-theme="dark"] .hm-split .hm-band.g-flat{background:var(--bd-raised);}
[data-theme="dark"] .hm-split .hm-sub.g-flat{background:var(--tk-field); border-color:var(--tk-line);}
/* Infobulle : se détache du fond sombre */
[data-theme="dark"] .tip{background:#1C2A3F; border:1px solid var(--tk-line-2); box-shadow:0 8px 24px rgba(0,0,0,.5);}
/* Fenêtres et tiroir */
[data-theme="dark"] .dd-overlay{background:var(--tk-overlay);}
[data-theme="dark"] .cfg-backdrop{background:var(--tk-overlay);}
[data-theme="dark"] .dd-panel{box-shadow:0 20px 60px rgba(0,0,0,.55); border:1px solid var(--tk-line);}
[data-theme="dark"] .cfg-drawer{box-shadow:-12px 0 40px rgba(0,0,0,.5); border-left:1px solid var(--tk-line);}
[data-theme="dark"] .cfg-color[open] .sw-row{box-shadow:0 10px 28px rgba(0,0,0,.5);}
[data-theme="dark"] .sw, [data-theme="dark"] .cfg-color summary .dot{border-color:rgba(255,255,255,.12);}
/* Graphiques d'évolution (SVG) */
[data-theme="dark"] .lc .axis, [data-theme="dark"] .bu .mark{stroke:var(--tk-line-2);}
[data-theme="dark"] .bu .ramp{stroke:#6B7A90;}
[data-theme="dark"] .legend-item .dot.dash{background:#6B7A90;}
[data-theme="dark"] .lc .thr{stroke:#F08A8A;}
[data-theme="dark"] .lc .thr-l{fill:#F08A8A;}
[data-theme="dark"] .legend .dot.thr-dot{border-top-color:#F08A8A;}
[data-theme="dark"] .bt .mark{stroke:#6B7A90;}
[data-theme="dark"] .bt .mark-l{fill:var(--tk-muted);}
[data-theme="dark"] .bt .weekend, [data-theme="dark"] .bu .weekend{fill:#8d94a3; opacity:.07;}
[data-theme="dark"] .bu .tick{stroke:#4E5D73;} [data-theme="dark"] .bu .tick.half{stroke:var(--tk-line-2);}
[data-theme="dark"] .bu .today-band, [data-theme="dark"] .bt .today-band{opacity:.12;}
/* IA, bandeau d'archive, date de référence */
[data-theme="dark"] .ai-setup, [data-theme="dark"] .archive-banner{background:var(--tk-warn-bg); border-color:rgba(245,192,72,.3); color:var(--tk-warn);}
[data-theme="dark"] .archive-banner b{color:#FFD98A;}
[data-theme="dark"] .ref-field input:disabled, [data-theme="dark"] .ref-field select:disabled{background:var(--tk-field); color:var(--tk-muted);}
/* Pastille « aperçu » du thème partagé : fond clair écrit en dur dans assets/theme.css. */
[data-theme="dark"] .tk-badge--preview{background:var(--tk-info-bg); color:var(--tk-info);}
