/* finops-core : feuille de style du site DataViz. Jetons clairs / sombres (le thème du visiteur prime sur le réglage du système),
   palette catégorielle validée (8 teintes, ordre fixe), couleurs d'état réservées aux pastilles de risque. */
:root {
  color-scheme: light;
  --font-ui: "Segoe UI", Carlito, "Liberation Sans", system-ui, Arial, sans-serif;
  --font-head: Caladea, "Liberation Serif", Georgia, serif;
  --surface-0: #f6f5f0;        /* fond de page (papier) */
  --surface-1: #ffffff;        /* cartes et graphiques */
  --text-primary: #1b2431;
  --text-secondary: #5a6270;
  --text-muted: #8a9099;
  --line: #ddd9d0;
  --grid: #e8e5de;
  --navy: #0a1f3c;
  --accent: #b08d57;           /* or : filets, eyebrow, tuiles accentuées */
  --neutral: #9a9a9a;          /* série « Autres », deltas négatifs de la cascade */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --good: #2f6b36; --warn: #8c6a34; --crit: #8e2e24;
  --good-bg: #e6f1e7; --warn-bg: #f6ecd9; --crit-bg: #f6e2df;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #12161c; --surface-1: #1b2129; --text-primary: #eeece6; --text-secondary: #b9bcc3; --text-muted: #8a909a; --line: #2d3540; --grid: #2a313b;
    --navy: #dfe6f3; --accent: #c9a76e; --neutral: #7d8390;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --good: #8fd39a; --warn: #e5c27e; --crit: #f0a19a; --good-bg: #1d3322; --warn-bg: #3a3020; --crit-bg: #3d2320;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #12161c; --surface-1: #1b2129; --text-primary: #eeece6; --text-secondary: #b9bcc3; --text-muted: #8a909a; --line: #2d3540; --grid: #2a313b;
  --navy: #dfe6f3; --accent: #c9a76e; --neutral: #7d8390;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --good: #8fd39a; --warn: #e5c27e; --crit: #f0a19a; --good-bg: #1d3322; --warn-bg: #3a3020; --crit-bg: #3d2320;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--surface-0); color: var(--text-primary); font-family: var(--font-ui); font-size: 15px; line-height: 1.45; }
a { color: inherit; }
.viz-root { max-width: 1240px; margin: 0 auto; padding: 0 16px 48px; }
header.top { display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center; padding: 22px 0 14px; border-bottom: 1px solid var(--line); }
.wordmark { font-family: var(--font-head); font-size: 20px; letter-spacing: 0.22em; color: var(--navy); font-weight: 700; }
.wordmark small { display: block; font-family: var(--font-ui); letter-spacing: 0.14em; font-size: 10px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
header h1 { font-family: var(--font-head); font-size: 24px; margin: 0; color: var(--navy); font-weight: 700; line-height: 1.2; }
.small { font-size: 12.5px; color: var(--text-secondary); }
.lab { color: var(--text-secondary); font-size: 12.5px; margin-right: 6px; }
.theme, .basis-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.basis-bar { margin: 6px 0 14px; }
button.seg, button.ghost, select.dim { font: inherit; font-size: 12.5px; border: 1px solid var(--line); background: var(--surface-1); color: var(--text-primary); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
button.seg.on { background: var(--navy); color: var(--surface-1); border-color: var(--navy); }
:root[data-theme="dark"] button.seg.on { background: var(--accent); color: #12161c; border-color: var(--accent); }
button.ghost { padding: 3px 10px; color: var(--text-secondary); }
button.ghost:hover, button.seg:hover { border-color: var(--accent); }
select.dim { border-radius: 8px; padding: 3px 8px; }
nav.toc { position: sticky; top: 0; z-index: 5; background: var(--surface-0); display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
nav.toc a { color: var(--text-secondary); text-decoration: none; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 0; }
nav.toc a:hover { color: var(--accent); }
section.sec { padding: 34px 0 10px; border-bottom: 1px solid var(--line); scroll-margin-top: 56px; }
.eyebrow { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 6px; }
section h2 { font-family: var(--font-head); font-size: 23px; line-height: 1.22; margin: 0 0 16px; color: var(--navy); font-weight: 700; max-width: 1000px; }
section h2:after { content: ""; display: block; width: 56px; height: 3px; background: var(--accent); margin-top: 10px; }
h3 { font-family: var(--font-head); font-size: 16px; margin: 14px 0 6px; color: var(--navy); font-weight: 700; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 10px 0 18px; }
.kpi { background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 12px; border-top: 3px solid var(--navy); }
.kpi.accent { border-top-color: var(--accent); }
.kpi .v { font-family: var(--font-head); font-size: 28px; line-height: 1.1; color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 6px 0 14px; }
.charts.one { grid-template-columns: minmax(0, 1fr); }
.chart-card { margin: 0; background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 10px; min-width: 0; }
.chart-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.chart-card.wide { grid-column: 1 / -1; }
.chart-card figcaption .cth { min-width: 0; }
.chart-card figcaption .ct { display: block; font-weight: 600; font-size: 14px; color: var(--text-primary); }
.chart-card figcaption .cs { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.chart-card .ctrl { display: flex; gap: 6px; align-items: center; }
.chart-body { position: relative; width: 100%; }
.chart-table { max-height: 420px; overflow: auto; }
.hidden { display: none; }
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 14px; }
.table-wrap { min-width: 0; }
.table-wrap.wide { grid-column: 1 / -1; }
.scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; }
table.data th, table.data td { padding: 5px 8px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data thead th { background: var(--surface-0); color: var(--text-secondary); font-weight: 600; font-size: 11.5px; letter-spacing: 0.03em; text-transform: uppercase; }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.sub td { font-weight: 600; background: var(--surface-0); }
table.data tr.group th { font-weight: 600; font-size: 12.5px; color: var(--text-primary); background: var(--surface-0); padding-top: 9px; border-bottom: 1px solid var(--line); }
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.crit { color: var(--crit); background: var(--crit-bg); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin: 8px 0; }
.bul ul { margin: 4px 0 0; padding-left: 18px; }
.bul li { margin: 3px 0; }
.steps { display: grid; gap: 8px; margin: 8px 0 14px; }
.step { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.step .num { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: var(--surface-1); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
:root[data-theme="dark"] .step .num { color: #12161c; }
.step .amt { font-family: var(--font-head); font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
p.note { font-size: 12.5px; color: var(--text-secondary); margin: 8px 0 0; }
footer { padding: 18px 0 0; font-size: 12px; color: var(--text-muted); }
@media (max-width: 900px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
  header.top { grid-template-columns: 1fr; gap: 10px; }
  .tables { grid-template-columns: minmax(0, 1fr); }
  section h2 { font-size: 20px; }
}
@media print {
  nav.toc, .theme, .ctrl, .basis-bar { display: none; }
  .chart-card, .kpi, .step { break-inside: avoid; }
}
