/* ===== Mode sombre : activé par <html data-theme="dark"> (choix Auto / Sombre / Clair, voir js/09-theme.js) ===== */
:root[data-theme="dark"]{
  color-scheme:dark;
  --ground:#151514; --surface:#1E1E1C; --active:#2A2A27; --hover:#252522; --chip:#2B2B28;
  --border:#34332F; --rule:#2B2A27; --control:#55524B;
  --text:#EEEBE5; --muted:#ABA69D; --faint:#A09B92; --primary:#EEEBE5;
  --positive:#6FCF9B; --positive-bg:#17342A; --negative:#FF9B8D; --negative-bg:#3C1F1B; --warning-bg:#3A3114; --warning-ink:#F3D987; --info-bg:#1B2B47; --info-ink:#A9C4F5;
  --paper:var(--ground); --cream:var(--chip); --soft:var(--muted); --grey:#6B665E; --white:var(--surface); --ink:var(--text);
  --line:var(--border); --brand:#E8AF24;
  --lx-soft:#ABA69D; --lx-faint:#A09B92;
}
:root[data-theme="dark"] body{background:var(--ground)!important;color:var(--text)}
:root[data-theme="dark"] html,:root[data-theme="dark"]{background:var(--ground)}
/* boutons pleins : fond clair, texte sombre */
:root[data-theme="dark"] .btn-primary,:root[data-theme="dark"] .btn-sm.btn-primary,:root[data-theme="dark"] .btn-dark{background:var(--text)!important;color:#151514!important}
:root[data-theme="dark"] .btn-ghost{background:var(--surface);color:var(--text);border-color:var(--control)}
/* surfaces « inversées » : fond = couleur du texte, donc texte sombre */
:root[data-theme="dark"] .exSteps li.cur,:root[data-theme="dark"] .vzN,:root[data-theme="dark"] .fchip.on,:root[data-theme="dark"] .vzChip.on .vzCk{color:#151514}
:root[data-theme="dark"] .exSteps li.cur i{background:#151514;color:var(--text)}
:root[data-theme="dark"] .vzReco{color:#0f1f17}
:root[data-theme="dark"] .vzChip.on .vzCk{background:var(--text);border-color:var(--text)}
:root[data-theme="dark"] .who .dot{background:var(--text);color:#151514}
:root[data-theme="dark"] .dlgFond .btn-primary{color:#151514!important}
/* champs de saisie */
:root[data-theme="dark"] input,:root[data-theme="dark"] select,:root[data-theme="dark"] textarea,:root[data-theme="dark"] .tin,:root[data-theme="dark"] .search,:root[data-theme="dark"] .eeNum{background:var(--surface)!important;color:var(--text)!important;border-color:var(--control)!important}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:var(--faint)}
:root[data-theme="dark"] input[type="checkbox"],:root[data-theme="dark"] input[type="radio"]{accent-color:#E8AF24}
:root[data-theme="dark"] option{background:var(--surface);color:var(--text)}
/* surfaces blanches codées en dur */
:root[data-theme="dark"] .lx-panel,:root[data-theme="dark"] .lx-kpi,:root[data-theme="dark"] .lx-table,:root[data-theme="dark"] .card,:root[data-theme="dark"] .stat,:root[data-theme="dark"] .tile,:root[data-theme="dark"] .panel,:root[data-theme="dark"] .choice,:root[data-theme="dark"] .appt,:root[data-theme="dark"] .citem{background:var(--surface)!important}
:root[data-theme="dark"] .lx-fill{background:#8a8579}
:root[data-theme="dark"] .fchip.on,:root[data-theme="dark"] .chk.on,:root[data-theme="dark"] .seg button.on,:root[data-theme="dark"] .vzCard.on,:root[data-theme="dark"] .vzPill.on,:root[data-theme="dark"] .vzChip.on,:root[data-theme="dark"] .vzFo.on,:root[data-theme="dark"] .vzSeg button.on{background:var(--active)!important;color:var(--text)!important;border-color:var(--text)!important}
:root[data-theme="dark"] .fchip.on small{color:var(--muted)!important}
:root[data-theme="dark"] .cell.today{background:#3A3114}
:root[data-theme="dark"] .cell.today .dn{color:#F3D987}
:root[data-theme="dark"] tr.due td,:root[data-theme="dark"] td.due{background:var(--warning-bg)!important}
:root[data-theme="dark"] a,:root[data-theme="dark"] a:visited{color:#9DBBF2}
:root[data-theme="dark"] .badge.fini,:root[data-theme="dark"] .pill.ok{background:var(--positive-bg)!important;color:var(--positive)!important}
/* zones restées claires (couleurs d'origine codées en dur) */
:root[data-theme="dark"] .cell.today{background:#3A3114!important}
:root[data-theme="dark"] .imported{background:var(--surface)!important;border-color:var(--control)!important;color:var(--text)}
:root[data-theme="dark"] .tx-add,:root[data-theme="dark"] .cf-g{background:var(--hover)!important;border-color:var(--border)!important}
:root[data-theme="dark"] .tx-chk,:root[data-theme="dark"] .cf-formule{background:var(--surface)!important;border-color:var(--control)!important;color:var(--text)!important}
:root[data-theme="dark"] .tx-chk.on,:root[data-theme="dark"] .tx-btn{background:var(--warning-bg)!important;color:var(--warning-ink)!important;border-color:#E8AF24!important}
:root[data-theme="dark"] .cat-stock,:root[data-theme="dark"] .cat-stock.low,:root[data-theme="dark"] .cat-stock.nostk{background:var(--chip)!important;color:var(--muted)!important}
:root[data-theme="dark"] .cat-thumb,:root[data-theme="dark"] .cat-thumb img{background:#E9E5DA}
:root[data-theme="dark"] .cat-co,:root[data-theme="dark"] .cat-prix,:root[data-theme="dark"] .cat-meta{color:var(--muted)!important}
:root[data-theme="dark"] .cat-prix{color:#E8AF24!important}
:root[data-theme="dark"] .pill.urgent{background:var(--negative-bg)!important;color:var(--negative)!important}
:root[data-theme="dark"] .pill.warn{background:var(--warning-bg)!important;color:var(--warning-ink)!important}
:root[data-theme="dark"] .pill.info{background:var(--info-bg)!important;color:var(--info-ink)!important}
:root[data-theme="dark"] .pill.neutral{background:var(--chip)!important;color:var(--muted)!important}
:root[data-theme="dark"] .lx-kpi .l,:root[data-theme="dark"] .lx-panel h2,:root[data-theme="dark"] .lx-panel .hint,:root[data-theme="dark"] .lx-foot{color:var(--muted)!important}
:root[data-theme="dark"] .lx-kpi .v,:root[data-theme="dark"] .lx-panel h2{color:var(--text)}
:root[data-theme="dark"] .fchip small{color:var(--muted)!important}
:root[data-theme="dark"] iframe{background:#fbfaf6}
:root[data-theme="dark"] .fadd,:root[data-theme="dark"] .lx-b.brand{color:#151514!important}
:root[data-theme="dark"] .cat-co{color:#E8AF24!important}
:root[data-theme="dark"] .tx-add-l,:root[data-theme="dark"] .tx-f label,:root[data-theme="dark"] .cf-h,:root[data-theme="dark"] .cf-f label,:root[data-theme="dark"] .tx-leg,:root[data-theme="dark"] .tx-f>span{color:var(--muted)!important}
:root[data-theme="dark"] .paireMiss{background:var(--warning-bg)!important;color:var(--warning-ink)!important}
:root[data-theme="dark"] .paireHead .pa{color:var(--text)!important}
:root[data-theme="dark"] button[onclick="stkCsv()"]{color:#151514!important}
:root[data-theme="dark"] .cat-card .cat-head .cat-co{color:#E8AF24!important}
