:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #16202b;
  --muted: #5b6775;
  --line: #e2e6eb;
  --accent: #0f6e6e;
  --accent-soft: #e3f1f0;
  --s-disposable: #c2552b;
  --s-mix: #0f6e6e;
  --s-reusable: #3c5ccf;
  --warn: #a33a1d;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1419; --surface: #182029; --ink: #e6ebf0; --muted: #9aa7b4;
    --line: #2a3440; --accent: #4fb3ad; --accent-soft: #1b3332;
    --s-disposable: #e8825a; --s-mix: #4fb3ad; --s-reusable: #8ea2f2; --warn: #ef8a6b;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1419; --surface: #182029; --ink: #e6ebf0; --muted: #9aa7b4;
  --line: #2a3440; --accent: #4fb3ad; --accent-soft: #1b3332;
  --s-disposable: #e8825a; --s-mix: #4fb3ad; --s-reusable: #8ea2f2; --warn: #ef8a6b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 22px 0 18px; }
.top h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.01em; }
.lede { margin: 0; color: var(--muted); max-width: 820px; }
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 20px; padding-top: 20px; padding-bottom: 20px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.controls { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 900px) { .controls { position: static; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 15px; margin: 0 0 10px; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.card-head .hint { margin: 0; }
details.card summary { cursor: pointer; list-style: none; }
details.card summary h2 { display: inline; }
details.card summary::before { content: "▸ "; color: var(--muted); }
details[open].card summary::before { content: "▾ "; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label output { float: right; color: var(--ink); font-weight: 600; }
select, input[type=number] { width: 100%; margin-top: 4px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); color: var(--ink); font: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 10px; }
.results { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--muted); }
.kpi.hero { border-color: var(--accent); background: var(--accent-soft); }
.kpi.warn .v { color: var(--warn); }
.chart { position: relative; height: 300px; }
.chart.small { height: 260px; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 700px) { .split { grid-template-columns: 1fr; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; white-space: normal; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.tbl tr.total td { font-weight: 700; }
.sortable th { cursor: pointer; user-select: none; }
.sortable tbody tr { cursor: pointer; }
.sortable tbody tr:hover { background: var(--accent-soft); }
.sortable tr.sel { background: var(--accent-soft); font-weight: 600; }
.scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button[aria-selected=true] { background: var(--accent); color: #fff; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.prose { font-size: 14px; }
.prose h3 { font-size: 14px; margin: 16px 0 4px; }
.prose code { background: var(--bg); padding: 1px 4px; border-radius: 4px; font-size: 12.5px; }
.foot { color: var(--muted); font-size: 12.5px; padding-bottom: 30px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
label.check { display:flex; gap:8px; align-items:center; color: var(--ink); }
label.check input { accent-color: var(--accent); }
