:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #16191d;
  --muted: #5b6470;
  --line: #dfe3e8;
  --accent: #0b5cad;
  --accent-soft: #e8f0fa;
  --pos: #0a6b3d;
  --neg: #a8231b;
  --warn: #8a5a00;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px rgba(16, 24, 40, 0.05);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --panel: #171b21;
    --ink: #e8ebef;
    --muted: #9aa4b0;
    --line: #2a303a;
    --accent: #7db4f5;
    --accent-soft: #1b2a3d;
    --pos: #5fd39a;
    --neg: #ff8a80;
    --warn: #f0bf6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }

.masthead {
  background: linear-gradient(180deg, #101820 0%, #17212c 100%);
  color: #eef2f7;
  padding: 34px 0 30px;
  border-bottom: 1px solid #0b1118;
}
.masthead .eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9fb6cc;
}
.masthead h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.masthead .dek {
  margin: 0;
  max-width: 68ch;
  color: #c3ceda;
  font-size: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding-top: 24px;
  padding-bottom: 12px;
}

@media (max-width: 960px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.panel h3 {
  margin: 20px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.panel h3:first-of-type { margin-top: 4px; }

.inputs form { margin: 0; }

.field { margin: 0 0 12px; }
.field label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field .hint { font-variant-numeric: tabular-nums; opacity: 0.85; }

input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  font: 14px var(--mono);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 420px) {
  .row2 { grid-template-columns: 1fr; }
}

.presets { display: flex; gap: 6px; flex-wrap: wrap; }
button {
  font: 600 13px var(--font);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button.ghost { color: var(--muted); }
button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.fineprint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 15px;
}
.kpi .label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi .value {
  font: 650 22px/1.1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi .sub {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
}
.kpi.alert { border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.kpi.alert .value { color: var(--neg); }
.kpi.good .value { color: var(--pos); }

.statement {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 18px;
  margin: 0;
  font-size: 14px;
}
.statement > .section {
  grid-column: 1 / -1;
  margin: 10px 0 2px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.statement > .section:first-of-type { margin-top: 0; }
.statement dt { color: var(--muted); }
.statement dd {
  margin: 0;
  text-align: right;
  font: 13.5px var(--mono);
  font-variant-numeric: tabular-nums;
}
.statement dd.neg { color: var(--neg); }
.statement dd.pos { color: var(--pos); }

.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: right;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th:first-child { text-align: left; }
tbody td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td:first-child { text-align: left; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--line);
  border-bottom: 0;
}
tbody td.neg { color: var(--neg); }
tbody td.pos { color: var(--pos); }

.disclaimer {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin: 4px 0 8px;
}

.foot {
  color: var(--muted);
  font-size: 12px;
  padding: 10px 0 30px;
}

@media (max-width: 560px) {
  .statement { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; font-size: 13px; }
  .kpi .value { font-size: 19px; }
}