/* Faro Café: the look (docs/cafe-plan.md §3.7). Dark by default (desks), light on request; every colour is a token here.
   Palettes validated with the dataviz validator (docs/palette.md): categorical per mode, ENSO as a diverging trio with a
   grey midpoint, stress as a one-hue ordinal ramp that flips its anchor in dark mode. Status colours are reserved for
   levels and always travel with a word and a shape. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(/fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0f1316; --surface: #161b20; --surface-2: #1b2127; --surface-3: #222930; --well: #12171b;
  --line: #242b32; --line-2: #313a43; --grid: #232a31; --axis: #3a434c;
  --ink: #e8e6e1; --ink-strong: #ffffff; --ink-2: #c4c2bc; --muted: #9aa0a6; --faint: #6c737a;
  --accent: #c8893a; --accent-soft: rgba(200, 137, 58, 0.14); --accent-line: rgba(200, 137, 58, 0.45); --on-accent: #1a1209;
  --good: #2e9e63; --warning: #d9a53a; --serious: #e07a2d; --critical: #d14b3c;
  --good-soft: rgba(46, 158, 99, 0.14); --warning-soft: rgba(217, 165, 58, 0.14); --serious-soft: rgba(224, 122, 45, 0.15); --critical-soft: rgba(209, 75, 60, 0.16);
  --nino: #d1603d; --neutral: #68665f; --nina: #3f84cf;
  --nino-soft: rgba(209, 96, 61, 0.16); --nina-soft: rgba(63, 132, 207, 0.16);
  --s1: #3f84cf; --s2: #c08231; --s3: #8e6bbf; --s4: #49a072;
  --st0: #674519; --st1: #8e5d1d; --st2: #b6761e; --st3: #db9337; --st4: #f9b565;
  --dry: #c08231; --wet: #3f84cf;
  --land: #1a2026; --land-line: #2b333b; --water: #0c1013; --region-line: #0f1316;
  --tier-A: #9ec5f4; --tier-B: #5598e7; --tier-C: #256abf; --tier-D: #184f95; --tier-ink: #0b1220; --tier-ink-d: #e8eefc;
  --band: rgba(154, 160, 166, 0.16); --band-2: rgba(154, 160, 166, 0.09);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --fs-xs: 11px; --fs-sm: 12px; --fs-dense: 13px; --fs-base: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 28px; --fs-display: 44px;
  --r-sm: 4px; --r: 8px; --r-pill: 999px;
  --gut: 24px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ee; --surface: #ffffff; --surface-2: #fbf9f6; --surface-3: #f1ede6; --well: #f3efe8;
  --line: #e6e0d6; --line-2: #d6cec2; --grid: #ece7df; --axis: #c9c1b5;
  --ink: #1f1a14; --ink-strong: #000000; --ink-2: #3d362e; --muted: #6f685e; --faint: #9a9287;
  --accent: #8a5a1f; --accent-soft: rgba(138, 90, 31, 0.10); --accent-line: rgba(138, 90, 31, 0.40); --on-accent: #ffffff;
  --good-soft: rgba(46, 158, 99, 0.12); --warning-soft: rgba(217, 165, 58, 0.16); --serious-soft: rgba(224, 122, 45, 0.13); --critical-soft: rgba(209, 75, 60, 0.11);
  --neutral: #605e56;
  --s1: #3f84cf; --s2: #bb7d2c; --s3: #8e6bbf; --s4: #429a6d;
  --st0: #d1a472; --st1: #c1863c; --st2: #a96a05; --st3: #895400; --st4: #694000;
  --dry: #bb7d2c;
  --land: #ebe6de; --land-line: #d3cbbf; --water: #f6f3ee; --region-line: #ffffff;
  --band: rgba(111, 104, 94, 0.15); --band-2: rgba(111, 104, 94, 0.08);
  --shadow: 0 10px 28px rgba(60, 40, 10, 0.16);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-base)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
b.num, .num b, .mono b, td.n b { font-weight: 600; }
.num, .mono, td.n, th.n { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.u { color: var(--muted); font-family: var(--font); font-size: 0.85em; margin-left: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- header ---------------------------------------------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px);
       border-bottom: 1px solid var(--line); }
.top-in { max-width: 1480px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 0 var(--gut); height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: var(--fs-lg); letter-spacing: 0.01em; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand small { font-weight: 400; color: var(--muted); font-size: var(--fs-sm); }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-dense); white-space: nowrap; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a.on { color: var(--ink); background: var(--surface-3); box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--r-pill); border: 1px solid var(--line-2);
        background: var(--surface); font-size: var(--fs-sm); white-space: nowrap; text-decoration: none; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip.enso { border-color: color-mix(in srgb, var(--nino) 55%, var(--line)); background: var(--nino-soft); }
.chip.enso.nina { border-color: color-mix(in srgb, var(--nina) 55%, var(--line)); background: var(--nina-soft); }
.chip.enso.neutral { border-color: var(--line-2); background: var(--surface); }
.chip b { font-weight: 600; }
.asof { font-size: var(--fs-xs); color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.iconbtn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface);
           cursor: pointer; color: var(--muted); }
.iconbtn:hover { color: var(--ink); border-color: var(--axis); }
.iconbtn svg { width: 18px; height: 18px; }
.sel { height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); padding: 0 30px 0 10px; font-size: var(--fs-dense);
       appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
       background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; max-width: 220px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 44px; min-width: 210px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
        box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu button, .menu a { display: flex; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer;
                        text-decoration: none; font-size: var(--fs-dense); min-height: 40px; align-items: center; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: var(--fs-sm); color: var(--muted); }
.menu .who b { display: block; color: var(--ink); font-size: var(--fs-dense); }

/* ---- page ------------------------------------------------------------------------------------------------------ */
main { max-width: 1480px; margin: 0 auto; padding: 22px var(--gut) 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
.page-head .lede { margin: 6px 0 0; color: var(--muted); max-width: 820px; }
.eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.c12 { grid-column: span 12; } .c9 { grid-column: span 9; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; }
.c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
h2.sec { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; margin: 28px 0 10px;
         display: flex; align-items: center; gap: 10px; }
h2.sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
h2.sec:first-child { margin-top: 0; }

/* ---- cards ----------------------------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; position: relative; min-width: 0; }
.card.edge { border-left: 4px solid var(--line-2); }
.edge-0 { border-left-color: var(--good) !important; } .edge-1 { border-left-color: var(--warning) !important; }
.edge-2 { border-left-color: var(--serious) !important; } .edge-3 { border-left-color: var(--critical) !important; }
.edge-nino { border-left-color: var(--nino) !important; } .edge-nina { border-left-color: var(--nina) !important; } .edge-neutral { border-left-color: var(--neutral) !important; }
.edge-none { border-left-color: var(--line-2) !important; } .edge-accent { border-left-color: var(--accent) !important; }
.card h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; }
.card .sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }
.card-head { display: flex; align-items: flex-start; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.pad0 { padding: 0; }
.empty { color: var(--muted); font-size: var(--fs-dense); padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--well); }
.empty b { color: var(--ink-2); font-weight: 600; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.note { font-size: var(--fs-sm); color: var(--muted); }
.note b { color: var(--ink-2); font-weight: 600; }

/* ---- tags: tier, level, phase, species ------------------------------------------------------------------------- */
.tier { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-sm); font: 600 var(--fs-xs)/1 var(--mono);
        color: var(--tier-ink); cursor: help; flex: none; }
.tier-A { background: var(--tier-A); } .tier-B { background: var(--tier-B); } .tier-C { background: var(--tier-C); color: var(--tier-ink-d); } .tier-D { background: var(--tier-D); color: var(--tier-ink-d); }
.lvl { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.lvl svg { width: 12px; height: 12px; flex: none; }
.lvl-0 { color: var(--good); } .lvl-1 { color: var(--warning); } .lvl-2 { color: var(--serious); } .lvl-3 { color: var(--critical); }
.lvl .w { color: var(--ink-2); font-weight: 500; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600;
        border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; background: var(--surface-2); }
.pill .sw { width: 8px; height: 8px; border-radius: 2px; }
.pill.new { border-color: var(--accent-line); color: var(--ink); background: var(--accent-soft); }
.pill.cleared { opacity: 0.7; }
.sp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.sp-arabica { background: var(--s1); } .sp-robusta { background: var(--s3); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }

/* ---- the hero row ---------------------------------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero .card { padding: 18px 20px; }
.kpi-label { font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi-val { font-size: var(--fs-display); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; margin: 6px 0 4px; display: flex; align-items: baseline; gap: 8px; }
.kpi-val .of { font-size: var(--fs-lg); color: var(--muted); font-weight: 400; }
.kpi-val.mid { font-size: 34px; }
.drivers { margin-top: 10px; display: grid; gap: 5px; }
.drv { display: grid; grid-template-columns: minmax(0, 1fr) 70px 44px; gap: 8px; align-items: center; font-size: var(--fs-sm); }
.drv .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); text-decoration: none; }
.drv .nm:hover { color: var(--ink); text-decoration: underline; }
.drv .bar { height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; }
.drv .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.drv .v { text-align: right; font-family: var(--mono); color: var(--ink-2); }
.coverage { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.enso-hero { background: radial-gradient(120% 140% at 100% 0%, var(--nino-soft), transparent 60%), var(--surface); }
.enso-hero.nina { background: radial-gradient(120% 140% at 100% 0%, var(--nina-soft), transparent 60%), var(--surface); }
.enso-hero.neutral { background: var(--surface); }
.enso-big { font-size: 26px; font-weight: 600; line-height: 1.15; margin: 8px 0 2px; letter-spacing: -0.01em; }
.enso-oni { font-family: var(--mono); font-size: var(--fs-2xl); font-weight: 600; }
.enso-line { font-size: var(--fs-sm); color: var(--muted); }
.mini-oni { margin-top: 10px; }
.asof-card .row { gap: 8px; }
.asof-list { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--fs-sm); margin-top: 8px; }
.asof-list dt { color: var(--muted); } .asof-list dd { margin: 0; font-family: var(--mono); text-align: right; }
.headline { font-size: var(--fs-lg); line-height: 1.45; font-weight: 500; margin: 6px 0 0; }

/* ---- the map --------------------------------------------------------------------------------------------------- */
.map-card { padding: 0; overflow: hidden; }
.map-wrap { position: relative; }
.map-wrap svg.map { display: block; width: 100%; height: auto; background: var(--water); touch-action: manipulation; }
.map .country { fill: var(--land); stroke: var(--land-line); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.map .rg { stroke: var(--region-line); stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity 0.15s; }
.map .rg:hover, .map .rg.on { stroke: var(--ink); stroke-width: 2; }
.map .rg.bub { stroke: var(--bg); stroke-width: 2; fill-opacity: 0.95; }
.map .rg.bub:hover { stroke: var(--ink); }
.map .rg.dim { opacity: 0.35; }
.map .lbl { font: 500 10px var(--font); fill: var(--muted); pointer-events: none; }
.map .clbl { font: 600 10px var(--font); fill: var(--faint); letter-spacing: 0.12em; text-transform: uppercase; pointer-events: none; }
.map .pin { pointer-events: none; }
.map .pin .core { stroke: var(--bg); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map .pin .ring { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; animation: pulse 2.2s ease-out infinite; }
.map .pin text { font: 600 9px var(--mono); fill: #fff; text-anchor: middle; dominant-baseline: central; }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .map .pin .ring { animation: none; opacity: 0.5; } .dial .prog { transition: none !important; } }
.map-legend { position: absolute; left: 14px; bottom: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--line);
              border-radius: var(--r); padding: 9px 11px; font-size: var(--fs-xs); color: var(--muted); backdrop-filter: blur(6px); }
.map-legend .ramp { display: flex; gap: 2px; margin: 5px 0 3px; }
.map-legend .ramp i { width: 30px; height: 9px; border-radius: 2px; }
.map-legend .ramp-l { display: flex; justify-content: space-between; font-family: var(--mono); }
.map-legend .keys { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.map-legend .keys span { display: inline-flex; align-items: center; gap: 5px; }
.map-title { position: absolute; left: 16px; top: 14px; right: 16px; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.map-title h3 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.map-title .sub { color: var(--muted); font-size: var(--fs-sm); }
.map-title > * { pointer-events: auto; }
.hatch-bg { background: repeating-linear-gradient(135deg, var(--surface-3) 0 3px, var(--line-2) 3px 5px); }
.hover-card { position: fixed; z-index: 50; width: 290px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow);
              padding: 12px 14px; pointer-events: none; font-size: var(--fs-sm); }
.hover-card h4 { margin: 0; font-size: var(--fs-base); font-weight: 600; }
.hover-card .hc-row { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.hover-card .hc-al { margin-top: 8px; display: grid; gap: 4px; }

/* ---- figures (cafe-charts.js) ---------------------------------------------------------------------------------- */
.fig { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; min-width: 0; position: relative; }
.fig.flat { border: 0; padding: 0; background: none; }
.fig-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.fig-titles { flex: 1; min-width: 0; }
.fig-title { font-size: var(--fs-base); font-weight: 600; line-height: 1.35; margin: 0; }
.fig-sub { font-size: var(--fs-sm); color: var(--muted); margin-top: 1px; line-height: 1.4; }
.fig-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.fig-asof { font: 400 var(--fs-xs) var(--mono); color: var(--faint); white-space: nowrap; }
.fig-tbtn { height: 24px; padding: 0 8px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: var(--r-sm); font-size: var(--fs-xs);
            cursor: pointer; font-weight: 500; }
.fig-tbtn:hover, .fig-tbtn[aria-pressed="true"] { color: var(--ink); border-color: var(--axis); background: var(--surface-3); }
.fig-plot { position: relative; min-height: 40px; }
.fig-plot svg { display: block; overflow: visible; }
.fig-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted); margin: 0 0 6px; }
.fig-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fig-legend .lk { width: 16px; height: 0; border-top: 2px solid; }
.fig-legend .lk.dash { border-top-style: dashed; }
.fig-legend .bk { width: 10px; height: 10px; border-radius: 2px; }
.fig-legend .bandk { width: 16px; height: 10px; border-radius: 2px; background: var(--band); }
.fig-foot { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; line-height: 1.45; }
.fig-table { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.fig-absent { padding: 22px 16px; text-align: center; color: var(--muted); font-size: var(--fs-dense); border: 1px dashed var(--line-2); border-radius: var(--r-sm);
              background: var(--well); }
.fig-absent b { display: block; color: var(--ink-2); margin-bottom: 2px; font-weight: 600; }
svg .grid-l { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
svg .axis-l { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
svg .tick { font: 400 10.5px var(--mono); fill: var(--muted); }
svg .tick-s { font: 400 10px var(--font); fill: var(--muted); }
svg .lab { font: 500 11px var(--font); fill: var(--ink-2); }
svg .lab-m { font: 500 11px var(--mono); fill: var(--ink-2); }
svg .lab-b { font: 600 12px var(--mono); fill: var(--ink); }
svg .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
svg .ref-t { font: 400 10px var(--font); fill: var(--muted); }
svg .cross { stroke: var(--ink-2); stroke-width: 1; pointer-events: none; }
svg .hit { fill: transparent; cursor: crosshair; }
svg .barhit { fill: transparent; cursor: default; }
svg .mk:hover, svg .mk.hl { filter: brightness(1.25); }
:root[data-theme="light"] svg .mk:hover, :root[data-theme="light"] svg .mk.hl { filter: brightness(0.85); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--shadow);
       padding: 8px 10px; font-size: var(--fs-sm); min-width: 120px; max-width: 300px; }
.tip .th { color: var(--muted); font-size: var(--fs-xs); margin-bottom: 4px; font-family: var(--mono); }
.tip .tr { display: flex; align-items: center; gap: 8px; line-height: 1.6; }
.tip .tr .k { width: 12px; height: 0; border-top: 2px solid; flex: none; }
.tip .tr .k.dash { border-top-style: dashed; }
.tip .tr .k.box { height: 8px; border: 0; border-radius: 2px; }
.tip .tr b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.tip .tr .n { color: var(--muted); }
.tip .tn { color: var(--muted); font-size: var(--fs-xs); margin-top: 4px; max-width: 280px; }

/* dial */
.dial { display: block; }
.dial .track { fill: none; stroke: var(--surface-3); }
.dial .band { fill: none; stroke: var(--band); }
.dial .prog { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1); }
.dial .ptr { stroke: var(--surface); stroke-width: 2; }
.dial .big { font: 600 22px var(--mono); fill: var(--ink); text-anchor: middle; }
.dial .sm { font: 400 10px var(--font); fill: var(--muted); text-anchor: middle; }
.dial .tk { stroke: var(--muted); stroke-width: 1.5; }

/* ---- tables ---------------------------------------------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: var(--fs-dense); }
table.t th { text-align: left; font-weight: 600; font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 9px 10px;
             border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
table.t th.sortable { cursor: pointer; user-select: none; }
table.t th.sortable:hover { color: var(--ink); }
table.t th .arr { margin-left: 4px; color: var(--accent); }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tr.click { cursor: pointer; }
table.t tr.sel td { background: var(--accent-soft) !important; }
table.t td.hl-load { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--band-2) 6px 8px); }
table.t td .absent { color: var(--faint); font-family: var(--font); font-size: var(--fs-xs); }
table.t.compact td { padding: 6px 8px; }
table.t td.cell-w { position: relative; }
.inbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; }
.stressbar { display: inline-flex; align-items: center; gap: 8px; }
.stressbar .sq { width: 14px; height: 14px; border-radius: 3px; flex: none; }
.rname { font-weight: 500; text-decoration: none; }
.rname:hover { text-decoration: underline; }

/* ---- alerts list ----------------------------------------------------------------------------------------------- */
.alerts { display: grid; gap: 8px; }
.al { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r); padding: 11px 14px;
      display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; align-items: start; text-decoration: none; }
a.al:hover { border-color: var(--axis); }
.al.cleared { opacity: 0.6; }
.al.al-c { grid-template-columns: auto 1fr auto; align-items: center; padding: 8px 12px; }
.al .al-text { font-size: var(--fs-dense); line-height: 1.45; color: var(--ink); }
.al .al-meta { grid-column: 2 / 4; display: flex; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.al .al-meta .mono { color: var(--ink-2); }
.al .readings { font-family: var(--mono); font-size: var(--fs-xs); color: var(--ink-2); background: var(--surface-3); border-radius: var(--r-sm); padding: 1px 6px; }

/* ---- region page ----------------------------------------------------------------------------------------------- */
.rhead { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; margin-bottom: 18px; }
.rhead h1 { margin: 0; font-size: 32px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: var(--fs-sm); color: var(--muted); }
.facts b { color: var(--ink-2); font-weight: 500; font-family: var(--mono); }
.facts .f { white-space: nowrap; }
.stress-box { text-align: right; }
.stress-box .v { font-size: var(--fs-display); font-weight: 600; line-height: 1; }
.wincard { padding: 18px 20px 20px; }
.win-top { display: grid; grid-template-columns: 170px 1fr; gap: 22px; align-items: center; margin-bottom: 14px; }
.win-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.win-title h3 { font-size: var(--fs-xl); }
.win-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px 18px; margin-top: 12px; }
.stat .l { font-size: var(--fs-xs); color: var(--muted); }
.stat .v { font-size: var(--fs-xl); font-weight: 600; font-family: var(--mono); line-height: 1.25; }
.stat .d { font-size: var(--fs-xs); color: var(--muted); }
.win-how { font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; line-height: 1.5; }
.win-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
details.closed-wins > summary { cursor: pointer; list-style: none; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
                                 display: flex; align-items: center; gap: 10px; min-height: 44px; }
details.closed-wins > summary::-webkit-details-marker { display: none; }
details.closed-wins > summary::before { content: ""; border: 5px solid transparent; border-left: 7px solid var(--accent); margin-right: -4px; }
details.closed-wins[open] > summary::before { border: 5px solid transparent; border-top: 7px solid var(--accent); margin: 4px 0 -4px; }
details.closed-wins[open] > summary { margin-bottom: 14px; }
.readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rd { padding: 14px 16px; }
.rd .rd-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd .rd-name { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.rd .rd-val { font-size: var(--fs-2xl); font-weight: 600; margin: 4px 0 2px; font-family: var(--mono); line-height: 1.15; }
.rd .rd-val .u { font-size: var(--fs-base); }
.rd .rd-how { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; margin-top: 6px; }
.rd .rd-src { font-size: var(--fs-xs); color: var(--faint); margin-top: 6px; }
.rd.absent .rd-val { color: var(--faint); font-size: var(--fs-lg); font-family: var(--font); font-weight: 500; }
.phase-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.phase-col { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface-2); border-top: 3px solid var(--neutral); }
.phase-col.p-nino { border-top-color: var(--nino); } .phase-col.p-nina { border-top-color: var(--nina); }
.phase-col.now { box-shadow: 0 0 0 1px var(--accent-line); }
.phase-col h4 { margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.phase-col .pr { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.phase-col .pr b { font-family: var(--mono); color: var(--ink); font-size: var(--fs-dense); font-weight: 600; text-align: right; }
.phase-col .pbar { grid-column: 1 / 3; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 1px 0 5px; position: relative; overflow: hidden; }
.phase-col .pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; }
.phase-col .pbar .base { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--ink-2); }

/* ---- ENSO page ------------------------------------------------------------------------------------------------- */
.enso-state { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 24px 26px; }
.enso-state .big { font-size: 64px; font-weight: 600; line-height: 1; font-family: var(--mono); letter-spacing: -0.03em; }
.enso-state h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; }
.enso-state p { margin: 8px 0 0; color: var(--ink-2); max-width: 760px; }
.heat td.hc { text-align: right; font-family: var(--mono); font-size: var(--fs-sm); }
.heat th.grp { text-align: center; border-left: 1px solid var(--line-2); }
.heat td.gl, .heat th.gl { border-left: 1px solid var(--line-2); }
.meaning-list { display: grid; gap: 8px; }
.mrow { display: grid; grid-template-columns: minmax(150px, 1.3fr) 2fr auto; gap: 14px; align-items: center; padding: 10px 14px; border: 1px solid var(--line);
        border-radius: var(--r); background: var(--surface); text-decoration: none; }
.mrow:hover { border-color: var(--axis); }
.mbars { display: grid; gap: 4px; }
.mbar { display: grid; grid-template-columns: 96px 1fr 44px; gap: 8px; align-items: center; font-size: var(--fs-xs); color: var(--muted); }
.mbar .tr { height: 7px; background: var(--surface-3); border-radius: 4px; position: relative; }
.mbar .tr i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.mbar .tr .base { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink-2); }
.mbar b { font-family: var(--mono); color: var(--ink); text-align: right; font-weight: 600; }

/* ---- brief ----------------------------------------------------------------------------------------------------- */
.brief { max-width: 860px; margin: 0 auto; }
.brief-paper { padding: 44px 52px 40px; }
.brief .kicker { font: 500 var(--fs-sm) var(--mono); color: var(--accent); letter-spacing: 0.04em; }
.brief h1 { font-size: 30px; line-height: 1.3; font-weight: 600; margin: 12px 0 22px; letter-spacing: -0.012em; text-wrap: balance; }
.brief .para { display: grid; grid-template-columns: 170px 1fr; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.brief .para h3 { margin: 0; font-size: var(--fs-dense); font-weight: 600; color: var(--ink-2); line-height: 1.5; }
.brief .para h3 a { text-decoration: none; } .brief .para h3 a:hover { text-decoration: underline; }
.brief .para p { margin: 0; font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.brief .sig { margin-top: 22px; font-size: var(--fs-sm); color: var(--muted); }

/* ---- forms and buttons ----------------------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-sm);
       border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-weight: 500; font-size: var(--fs-dense); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--axis); background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: var(--fs-sm); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.block { width: 100%; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .field .lab { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, textarea.input { width: 100%; min-height: 42px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--well); padding: 9px 12px; font-size: var(--fs-base); }
textarea.input { min-height: 84px; resize: vertical; font-family: var(--font); line-height: 1.5; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); padding: 0 12px; min-height: 36px; cursor: pointer; font-size: var(--fs-sm); color: var(--muted); border-right: 1px solid var(--line-2); }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; max-height: 260px; overflow: auto; padding: 8px;
          border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--well); }
.checks label { display: flex; gap: 8px; align-items: center; font-size: var(--fs-dense); min-height: 32px; cursor: pointer; }
.checks input { width: 16px; height: 16px; accent-color: var(--accent); }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kind { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; cursor: pointer; background: var(--surface); text-align: left; min-height: 64px; }
.kind b { display: block; font-size: var(--fs-dense); }
.kind span { font-size: var(--fs-xs); color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }
.kind[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.msg { font-size: var(--fs-sm); margin-top: 8px; min-height: 18px; }
.msg.err { color: var(--critical); } .msg.ok { color: var(--good); }
.keybox { font: 500 var(--fs-dense) var(--mono); background: var(--well); border: 1px dashed var(--accent-line); border-radius: var(--r-sm); padding: 12px; word-break: break-all; }
pre.code { font: 400 var(--fs-sm)/1.6 var(--mono); background: var(--well); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; margin: 0;
           white-space: pre; color: var(--ink-2); }
.status-s { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; }
.status-s i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-s.sent i { background: var(--good); } .status-s.failed i { background: var(--critical); } .status-s.building i { background: var(--warning); } .status-s.queued i { background: var(--s1); }
dl.defs { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 0; margin: 0; font-size: var(--fs-dense); }
dl.defs dt, dl.defs dd { padding: 9px 0; border-top: 1px solid var(--line); margin: 0; }
dl.defs dt { font-family: var(--mono); font-size: var(--fs-sm); color: var(--ink-2); padding-right: 14px; }
dl.defs dd { color: var(--ink-2); line-height: 1.55; }
.prose { max-width: 820px; color: var(--ink-2); line-height: 1.6; }
.prose p { margin: 0 0 10px; }

/* ---- track record ---------------------------------------------------------------------------------------------- */
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.score-card .big { font-family: var(--font) !important; font-size: 38px; font-weight: 600; line-height: 1.1; margin: 4px 0; }
.score-card .grid2 { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: var(--fs-sm); color: var(--muted); margin-top: 8px; }
.score-card .grid2 b { font-family: var(--mono); color: var(--ink); text-align: right; font-weight: 600; }
.ivl { display: block; }
.sealed { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; }
.sealed svg { width: 28px; height: 28px; flex: none; color: var(--accent); margin-top: 2px; }
.sealed p { margin: 0; color: var(--ink-2); max-width: 900px; }

/* ---- sign-in / landing ----------------------------------------------------------------------------------------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.25fr 1fr; }
.land-art { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px;
            background: radial-gradient(90% 70% at 20% 10%, var(--accent-soft), transparent 60%), radial-gradient(70% 60% at 90% 90%, var(--nino-soft), transparent 60%), var(--bg);
            border-right: 1px solid var(--line); }
.land-art h1 { font-size: 46px; line-height: 1.08; letter-spacing: -0.025em; margin: 0 0 18px; font-weight: 600; max-width: 640px; }
.land-art .lede { font-size: 17px; color: var(--ink-2); max-width: 600px; line-height: 1.6; margin: 0; }
.land-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 720px; }
.land-facts .card { padding: 14px 16px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.land-facts .v { font-size: var(--fs-2xl); font-weight: 600; font-family: var(--mono); line-height: 1.2; }
.land-facts .l { font-size: var(--fs-sm); color: var(--muted); }
.land-map { opacity: 0.95; max-width: 640px; }
.land-form { display: flex; align-items: center; justify-content: center; padding: 40px 32px; background: var(--surface); }
.land-form form { width: 100%; max-width: 360px; }
.land-form h2 { margin: 0 0 6px; font-size: var(--fs-xl); font-weight: 600; }
.land-form p { color: var(--muted); margin: 0 0 22px; font-size: var(--fs-dense); }
.land-form .alt { margin-top: 18px; font-size: var(--fs-sm); color: var(--muted); display: grid; gap: 8px; }
.land-form .alt a { color: var(--accent); }

/* ---- bottom bar (phone) ---------------------------------------------------------------------------------------- */
.bbar { display: none; }
.sheet { position: fixed; inset: auto 0 0 0; z-index: 45; background: var(--surface); border-top: 1px solid var(--line-2); border-radius: 14px 14px 0 0; box-shadow: var(--shadow);
         padding: 10px 12px calc(76px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sheet a, .sheet button { min-height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-radius: var(--r); text-decoration: none; border: 1px solid var(--line);
                          background: var(--surface-2); font-size: var(--fs-dense); cursor: pointer; text-align: left; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: var(--r);
         z-index: 70; box-shadow: var(--shadow); font-size: var(--fs-dense); max-width: calc(100vw - 32px); }

/* ---- responsive ------------------------------------------------------------------------------------------------ */
@media (max-width: 1560px) { .top .asof { display: none; } }
@media (max-width: 1200px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .c3 { grid-column: span 6; }
  .readings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .c9, .c8, .c7, .c6, .c5, .c4 { grid-column: span 12; }
  .nav { display: none; }
  .landing { grid-template-columns: 1fr; }
  .land-art { border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 720px) {
  :root { --gut: 16px; }
  .top-in { height: 52px; gap: 10px; }
  .brand small, .asof.hide-sm, .top .sel { display: none; }
  .chip.enso .w-long { display: none; }
  main { padding: 16px var(--gut) calc(88px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 24px; }
  .hero { grid-template-columns: 1fr; }
  .c3 { grid-column: span 12; }
  .kpi-val { font-size: 40px; }
  .readings { grid-template-columns: 1fr; }
  .phase-cols { grid-template-columns: 1fr; }
  .win-top { grid-template-columns: 1fr; justify-items: start; }
  .rhead { grid-template-columns: 1fr; }
  .rhead h1 { font-size: 26px; }
  .stress-box { text-align: left; }
  .brief-paper { padding: 24px 18px; }
  .brief h1 { font-size: 22px; }
  .brief .para { grid-template-columns: 1fr; gap: 4px; }
  .mrow { grid-template-columns: 1fr; gap: 8px; }
  .enso-state { grid-template-columns: 1fr; gap: 12px; padding: 18px; }
  .enso-state .big { font-size: 48px; }
  .land-art { padding: 28px 18px; }
  .land-art h1 { font-size: 32px; }
  .land-facts { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .land-facts .v { font-size: var(--fs-xl); }
  .map-legend { position: static; margin: 8px 12px 12px; }
  .map-title { position: static; padding: 14px 14px 6px; }
  .bbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: var(--surface);
          border-top: 1px solid var(--line-2); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bbar a, .bbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; text-decoration: none; color: var(--muted);
                          font-size: 10.5px; border: 0; background: none; cursor: pointer; border-radius: var(--r); }
  .bbar a.on { color: var(--ink); }
  .bbar a.on svg { color: var(--accent); }
  .bbar svg { width: 22px; height: 22px; }
  .fig { padding: 12px 12px 10px; }
  .fig-head { flex-wrap: wrap; }
  .card { padding: 14px; }
  dl.defs { grid-template-columns: 1fr; }
  dl.defs dd { border-top: 0; padding-top: 0; }
  .al { grid-template-columns: 1fr; }
  .al .pill { justify-self: start; }
  .al.al-c { grid-template-columns: auto 1fr auto; }
  .fig-titles { flex: 1 1 100%; }
  .facts .f { white-space: normal; }
  .page-head .asof { white-space: normal; }
  .wincard { padding: 14px 12px 14px 12px; }
  .wincard .fig { padding: 10px 10px 8px; }
  .tbl-wrap table.t { min-width: 680px; }
  .tbl-wrap table.t.compact { min-width: 0; }
  .map-title h3 { font-size: var(--fs-base); }
  .al .al-meta { grid-column: 1; }
}
@media print {
  .top, .bbar, .fig-tools .fig-tbtn { display: none !important; }
}
.land-map svg.map { background: transparent; }
