:root {
  --bg: #f5f6f8; --card: #fff; --text: #1b1f27; --muted: #5d6675; --line: #dde1e8;
  --brand: #003366; --accent: #fdb827; --ok: #1d7a46; --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171c; --card: #1d2229; --text: #eceff4; --muted: #9aa4b2; --line: #2e3640; --brand: #7fb0e8; --accent: #fdb827; --ok: #5bc88a; --bad: #ff8a80; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header.top { background: #003366; color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 4px solid var(--accent); }
header.top h1 { font-size: 1.05rem; margin: 0; flex: 1; }
header.top button, header.top a { color: #fff; }
main { max-width: 900px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: .9rem; }
label { display: block; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
textarea { min-height: 64px; resize: vertical; }
button, .btn { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; text-decoration: none; display: inline-block; }
@media (prefers-color-scheme: dark) { button, .btn { color: #0b1220; } }
button.secondary, .btn.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
button.link { background: none; color: inherit; padding: 4px 8px; text-decoration: underline; }
button.danger { background: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 0 0 auto; }
.err { color: var(--bad); font-weight: 600; margin-top: 8px; }
.ok { color: var(--ok); font-weight: 600; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8rem; border: 1px solid var(--line); white-space: nowrap; }
.pill.done { color: var(--ok); border-color: var(--ok); }
.list a.item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 52px; }
.list a.item:last-child { border-bottom: 0; }
.crit { border-top: 1px solid var(--line); padding: 14px 0; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.opts button { flex: 1 1 0; min-width: 44px; min-height: 48px; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 8px 0; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.opts button.on { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 800; }
@media (prefers-color-scheme: dark) { .opts button.on { color: #0b1220; } }
.scale { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
details { margin: 6px 0; }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.sticky-total { position: sticky; bottom: 0; background: var(--card); border-top: 2px solid var(--brand); padding: 12px 16px; margin: 0 -16px -16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sticky-total .big { font-size: 1.4rem; font-weight: 800; }
table.grid { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.grid th, table.grid td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.ctr, table.grid th.ctr { text-align: center; padding: 8px 2px; }
table.grid td input[type=number] { width: 6.5em; padding: 6px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { background: transparent; color: var(--text); border: 1px solid var(--line); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .tabs button.on { color: #0b1220; } }
@media (max-width: 520px) { main { padding: 10px; } .card { padding: 12px; } }
