:root {
  --bg: #f6f5f1; --panel: #ffffff; --ink: #1c1b19; --muted: #6a6862; --line: #e3e2dd;
  --actual: #2a78d6; --fair: #eb6834; --band: rgba(235, 104, 52, .14); --path: #7a4fd0; --pathband: rgba(122, 79, 208, .13);
  --good: #1f8f5a; --good-bg: #e2f4ea; --bad: #c8402f; --bad-bg: #fbe6e2; --flat-bg: #eeede8; --accent: #1f4e78;
  --warn-bg: #fdf3d7; --warn-line: #e6c65c;
  --radius: 10px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416; --panel: #1c1e21; --ink: #ecebe7; --muted: #9a9a94; --line: #2e3136;
    --actual: #5aa2f5; --fair: #f58a5c; --band: rgba(245, 138, 92, .16); --path: #a98bf0; --pathband: rgba(169, 139, 240, .15);
    --good: #4cc38a; --good-bg: #173427; --bad: #f0796a; --bad-bg: #3b1d19; --flat-bg: #26282c; --accent: #8fbfe8;
    --warn-bg: #33290f; --warn-line: #7d6520;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 28px; padding-bottom: 48px; }

.site-head { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; flex-wrap: wrap; }
.brand { font-weight: 650; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.site-head nav { display: flex; gap: 4px; }
.site-head nav a { padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 550; }
.site-head nav a[aria-current] { background: var(--flat-bg); color: var(--ink); }
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 18px 0 30px; }

h1 { font-size: 30px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; }
h2 { font-size: 19px; letter-spacing: -.01em; margin: 34px 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.lede { color: var(--muted); font-size: 17px; max-width: 760px; margin: 0 0 22px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.two { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }

.kpi .k { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 27px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--flat-bg); }
.pill.good, .good-t { color: var(--good); } .pill.good { background: var(--good-bg); }
.pill.bad, .bad-t { color: var(--bad); } .pill.bad { background: var(--bad-bg); }

.callout { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 16px; margin: 18px 0; }
.callout b { font-weight: 650; }

a.card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
a.card .go { color: var(--accent); font-weight: 600; font-size: 14px; margin-top: 8px; display: inline-block; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.scroll { overflow-x: auto; }

/* controls */
.controls label { display: block; font-weight: 600; font-size: 13.5px; margin: 14px 0 2px; }
.controls label span { float: right; font-variant-numeric: tabular-nums; color: var(--accent); }
.controls input[type=range] { width: 100%; accent-color: var(--accent); }
.controls .hint { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.controls input[type=number] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); font: inherit; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
button, .btn { font: inherit; font-weight: 600; font-size: 13.5px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); }
button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--panel); }
.toggle { display: flex; gap: 14px; align-items: center; font-size: 13.5px; color: var(--muted); }

/* charts */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .ref { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .tick { fill: var(--muted); font-size: 12px; }
.chart .note { fill: var(--muted); font-size: 12px; }
.chart .future { fill: var(--flat-bg); opacity: .65; }
.chart .band { stroke: none; }
.chart-tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); min-width: 190px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; }
.chart-tip span { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tip i, .legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); padding: 4px 0 0 52px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i.box { height: 10px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }

/* docs */
.docs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 26px; align-items: start; }
@media (max-width: 800px) { .docs { grid-template-columns: 1fr; } }
.docs aside { position: sticky; top: 74px; display: flex; flex-direction: column; gap: 2px; }
.docs aside a { padding: 6px 10px; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 550; }
.docs aside a[aria-current] { background: var(--flat-bg); color: var(--ink); }
.md h1 { font-size: 27px; } .md h2 { border-top: 1px solid var(--line); padding-top: 22px; } .md h3 { margin-top: 22px; font-size: 16px; }
.md table { display: block; overflow-x: auto; margin: 12px 0; font-size: 14px; }
.md th, .md td { text-align: left; white-space: normal; vertical-align: top; min-width: 90px; }
.md code { font-family: var(--mono); font-size: .9em; background: var(--flat-bg); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--flat-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md li { margin: 4px 0; }
.md blockquote { margin: 12px 0; padding: 2px 16px; border-left: 3px solid var(--line); color: var(--muted); }

[hidden] { display: none !important; }
.chain { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.chain .kpi:last-child { border-color: var(--accent); }
.chain .kpi .v { font-size: 24px; }
@media (max-width: 980px) { .chain { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.hero { padding: 26px 0 6px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; padding-left: 38px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--flat-bg); font-weight: 650; font-size: 13px; display: grid; place-items: center; }
.steps code, .panel code { font-family: var(--mono); font-size: .88em; background: var(--flat-bg); padding: 1px 5px; border-radius: 4px; }

.chain { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.chain .kpi { padding: 14px 14px; }
.chain .kpi .v { font-size: 22px; }
@media (max-width: 1240px) { .chain { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.lenses { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.lens table td { white-space: normal; font-size: 13.5px; padding: 6px 6px; }
.lens table td:nth-child(2) { white-space: nowrap; }
.lens table td:nth-child(3) { text-align: left; font-size: 12.5px; }
.lens p { margin: 0 0 8px; }

@media (max-width: 800px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs aside { position: static; flex-direction: row; flex-wrap: wrap; }
}
.md { min-width: 0; overflow-wrap: anywhere; }
