:root {
  --bg: #f8f7f4; --surface: #ffffff; --surface-2: #f2f0eb; --line: #e4dfd6; --text: #15130f; --muted: #655d53;
  --good: #067647; --good-soft: #e7f6ec; --bad: #b42318; --bad-soft: #fdecea; --warn: #b54708;
  --c1: var(--accent); --c2: #2563eb; --c3: #0d9488; --c4: #9333ea; --c5: #ca8a04; --c6: #64748b;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0e0c; --surface: #181613; --surface-2: #201d19; --line: #322c25; --text: #f2eee8; --muted: #a39a8e;
    --good: #56d364; --good-soft: rgb(86 211 100 / .12); --bad: #ff7b72; --bad-soft: rgb(255 123 114 / .12); --warn: #f0b429;
    --c2: #60a5fa; --c3: #2dd4bf; --c4: #c084fc; --c5: #facc15; --c6: #94a3b8; color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15.5px/1.6 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: .92em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }

.crumb { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; }
h1 { margin: 4px 0 2px; font-size: clamp(36px, 6.2vw, 68px); font-weight: 800; letter-spacing: -.04em; line-height: 1.02; }
.lede { margin: 0; max-width: 640px; color: var(--muted); font-size: clamp(15.5px, 1.6vw, 17.5px); line-height: 1.65; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 80%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--text); font: 600 14px var(--font); text-decoration: none; cursor: pointer; transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .25s, background .25s; }
.btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--fx-2, #06b6d4))); border-color: transparent; color: var(--on-accent, #fff); box-shadow: 0 10px 30px -12px var(--accent); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 22px; }
.kpi { background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: blur(12px) saturate(140%); backdrop-filter: blur(12px) saturate(140%); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 16px; min-width: 0; box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 18px 40px -30px rgb(0 0 0 / .35); }
.kpi .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi .big { font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 4px; line-height: 1.15; background: linear-gradient(95deg, var(--text) 35%, var(--accent)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.kpi .note { font-size: 13px; color: var(--muted); }
.card { background: color-mix(in srgb, var(--surface) 84%, transparent); -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); border: 1px solid var(--line); border-radius: 24px; padding: clamp(18px, 3vw, 28px); margin-top: 20px; min-width: 0; box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, 0 24px 60px -40px rgb(0 0 0 / .45); }
.card h2 { margin: 0 0 6px; font-size: clamp(19px, 2.2vw, 23px); letter-spacing: -.025em; line-height: 1.25; }
.card h2::before { content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 10px 3px 0; border-radius: 3px; background: linear-gradient(135deg, var(--accent), var(--fx-2, #06b6d4)); box-shadow: 0 0 12px var(--accent); }
.card p.sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; max-width: 820px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; margin-top: 20px; }
.grid2 > .card { margin-top: 0; }
.chart { position: relative; min-height: 120px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg text { fill: var(--muted); font: 11px var(--font); }
.chart svg text.lab { fill: var(--text); font-weight: 600; }
.chart .grid line { stroke: var(--line); }
.chart .axis { stroke: var(--muted); }
.chart circle.pt { cursor: pointer; }
.chart circle.pt:focus { outline: none; stroke: var(--text); stroke-width: 2; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.controls { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin: 4px 0 14px; font-size: 14px; }
.controls label { color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--font); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.seg button { transition: color .2s, background .25s, box-shadow .25s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
select { font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; max-width: 100%; }
input[type=range] { flex: 1 1 240px; accent-color: var(--accent); min-width: 0; }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.readout div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 14px; min-width: 0; }
.readout div.hl { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.readout b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr var(--valw, auto); gap: 10px; align-items: center; font-size: 14px; }
.bar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--c, var(--accent)); border-radius: 6px; }
.bar .val { font: 600 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.bar.dim .name, .bar.dim .val { color: var(--muted); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.hl td { background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
tr.bad td { background: var(--bad-soft); }
tr.good td { background: var(--good-soft); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.no { background: var(--bad-soft); color: var(--bad); }
.pill.mid { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; overflow-wrap: anywhere; }
pre.box { font: 13px/1.55 var(--mono); white-space: pre-wrap; margin: 0; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.step { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); font: 600 12.5px var(--mono); }
.step.on { border-color: var(--accent); color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
ul.plain { margin: 8px 0 0; padding-left: 18px; }
ul.plain li { margin: 5px 0; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
footer { margin-top: 44px; padding-top: 22px; color: var(--muted); font-size: 13px; text-align: center; border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 60%, transparent), transparent) 1; }
tbody tr { transition: background .2s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.fx-hero .links { margin-top: 8px; }
.err { color: var(--bad); }
@media (max-width: 640px) { .card { padding: 16px; } .bar { grid-template-columns: minmax(80px, 38%) 1fr var(--valw, auto); } }
.track.dv { position: relative; border-radius: 3px; }
.track.dv::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }
.track.dv .fill { border-radius: 0; }
table.heat td { min-width: 38px; text-align: center; font-weight: 600; }
table.heat th { text-align: center; }
.qlist { display: grid; gap: 12px; }
.q { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.qhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.q p { margin: 8px 0 0; overflow-wrap: anywhere; }
.sbar { display: grid; gap: 4px; margin: 0 0 12px; }
.sname { font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.strack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.strack span { display: block; height: 100%; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.box.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
table.kv { font-size: 13px; }
table.kv th { text-transform: none; letter-spacing: 0; font-size: 12.5px; width: 40%; padding: 4px 8px 4px 0; }
table.kv td { padding: 4px 0; overflow-wrap: anywhere; }
button.step { cursor: pointer; color: var(--text); }
.btn:disabled { opacity: .45; cursor: default; }
input.text { flex: 1 1 280px; min-width: 0; font: 15px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.cropbox > div { border: 1px solid var(--line); border-radius: 8px; background-color: #fff; max-width: 100%; }

/* download buttons: quiet until the chart or table is hovered or the button is focused */
.dl { position: absolute; top: -4px; right: 0; z-index: 2; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--muted); font: 700 11px/1.4 var(--mono); letter-spacing: .04em; cursor: pointer; opacity: .55; transition: opacity .2s, color .2s, border-color .2s; }
.dl:hover, .dl:focus-visible { opacity: 1; color: var(--text); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.chart:hover .dl, .tbl:hover .dl { opacity: 1; }
.tbl { position: relative; padding-top: 26px; }
.tbl > .dl { top: 0; }
@media print { .dl { display: none; } }
