:root {
  --bg: #f6f5f2; --panel: #ffffff; --fg: #1d1c1a; --muted: #6b6860; --line: #e4e1da;
  --accent: #2f5d50; --accent-soft: #e3efe9; --warn: #8a5a00; --warn-soft: #fbf0d9; --bad: #9b2c2c; --bad-soft: #fbe5e5;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614; --panel: #1f1f1c; --fg: #ecebe6; --muted: #a29f96; --line: #34332e;
    --accent: #8cc7b3; --accent-soft: #1f3a32; --warn: #e5b85c; --warn-soft: #3a2f17; --bad: #f08c8c; --bad-soft: #3d1f1f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: 28px 0 22px; margin-bottom: 24px; }
.brand { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
h1 { margin: 4px 0 6px; font: 400 32px/1.2 Georgia, "Times New Roman", serif; }
h2 { margin: 0 0 12px; font: 400 22px/1.3 Georgia, "Times New Roman", serif; }
.lede { margin: 0; color: var(--muted); max-width: 60ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 20px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.row label { color: var(--muted); font-size: 14px; }
select, button { font: inherit; font-size: 15px; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.tile-t2 { background: var(--accent-soft); border-color: transparent; }
.tile-label { margin: 0; font-size: 13px; color: var(--muted); }
.tile-num { margin: 2px 0 0; font: 400 30px/1.2 Georgia, serif; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 600px; font-size: 15px; }
th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill[data-s="Final"] { background: var(--accent-soft); color: var(--accent); }
.pill[data-s="So far"] { background: var(--warn-soft); color: var(--warn); }
.pill[data-s="Needs amount"], .pill[data-s="Could not load"] { background: var(--bad-soft); color: var(--bad); }
.pill:empty { display: none; }
.note { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; font-size: 14px; }
.banner-bad { background: var(--bad-soft); color: var(--bad); }
.actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.rules { margin: 0; padding: 0; list-style: none; }
.rules li { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr minmax(140px, 1fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rules li > :last-child { text-align: right; }
@media (max-width: 620px) { .rules li { grid-template-columns: 1fr; } .rules li > :last-child { text-align: left; } }
.rules li:last-child { border-bottom: 0; }
.foot { color: var(--muted); font-size: 13px; margin: 8px 0 40px; }
@media (max-width: 520px) { h1 { font-size: 26px; } .tile-num { font-size: 26px; } }
@media print { .actions, .row select { display: none; } body { background: #fff; } .card { break-inside: avoid; } }
