:root {
  --paper: #f4efe5; --card: #fffdf8; --ink: #2b2118; --muted: #7a6c5c; --line: #e4dac7;
  --brand: #8a3f1c; --brand-dark: #6b2f14; --green: #46633b; --gold: #c18f2a; --red: #a63a2b; --blue: #3a6684;
  --radius: 14px; --shadow: 0 1px 2px rgba(60, 40, 20, .08), 0 4px 14px rgba(60, 40, 20, .06);
  --nav-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1c1712; --card: #272019; --ink: #f1e8da; --muted: #a8998a; --line: #3a3026;
    --brand: #d98a5c; --brand-dark: #e9a67e; --green: #8db77c; --gold: #e0b252; --red: #e0786a; --blue: #7fb0cf;
    --shadow: 0 1px 2px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; margin: 22px 0 10px; } h3 { font-size: 1.05rem; }
a { color: var(--brand); }
#app { max-width: 880px; margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + 32px); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.top .org { color: var(--muted); font-size: .85rem; }
.banner { padding: 9px 14px; font-size: .88rem; text-align: center; background: var(--gold); color: #261a05; }
.banner.red { background: var(--red); color: #fff; } .banner.blue { background: var(--blue); color: #fff; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; }
.grid { display: grid; gap: 10px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 700px) { .g4 { grid-template-columns: repeat(4, 1fr); } .g2d { grid-template-columns: 1fr 1fr; } }
.g4 { grid-template-columns: repeat(2, 1fr); } .g2d { grid-template-columns: 1fr; }
@media (min-width: 700px) { .g4 { grid-template-columns: repeat(4, 1fr); } .g2d { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat .n { font: 600 1.9rem/1.1 Georgia, serif; } .stat .l { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.stat .s { font-size: .8rem; color: var(--muted); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-decoration: none; color: inherit; }
.row:active { background: var(--line); }
.row .main { flex: 1; min-width: 0; } .row .t { font-weight: 600; } .row .sub { color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { text-align: right; font-variant-numeric: tabular-nums; font-size: .92rem; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; background: var(--line); color: var(--ink); }
.chip.green { background: #dfead8; color: #2f4b27; } .chip.gold { background: #f5e6bd; color: #6a4a07; } .chip.red { background: #f3d3cd; color: #7d2417; } .chip.blue { background: #d4e4ee; color: #234a66; }
@media (prefers-color-scheme: dark) { .chip.green { background: #2f4b27; color: #cfe6c4; } .chip.gold { background: #5b4410; color: #f5e6bd; } .chip.red { background: #6b2a20; color: #f7d5cf; } .chip.blue { background: #254b66; color: #d4e4ee; } }
button, .btn { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--brand); color: #fff; cursor: pointer; min-height: 44px; }
button.ghost, .btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
button.danger { background: var(--red); } button.small { min-height: 34px; padding: 6px 12px; font-size: .88rem; }
button:disabled { opacity: .5; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tabs { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink); white-space: nowrap; font-size: .92rem; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
input, select, textarea { font: inherit; width: 100%; padding: 11px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); min-height: 44px; }
.row select { width: auto; min-height: 38px; padding: 6px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.hidden { display: none !important; }
nav.tabbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
nav.tabbar a { flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: .72rem; }
nav.tabbar a span { font-size: 1.35rem; line-height: 1; } nav.tabbar a.on { color: var(--brand); font-weight: 700; }
dialog { width: min(560px, 100%); max-height: 92vh; border: 0; border-radius: 18px 18px 0 0; padding: 18px 18px 26px; background: var(--card); color: var(--ink); margin: auto auto 0; box-shadow: 0 -8px 40px rgba(0,0,0,.35); }
@media (min-width: 700px) { dialog { border-radius: 18px; margin: auto; } }
dialog::backdrop { background: rgba(20, 12, 5, .55); }
.err { color: var(--red); font-size: .9rem; margin-top: 10px; }
.meter { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 6px; } .meter i { display: block; height: 100%; background: var(--green); }
.meter.warn i { background: var(--gold); } .meter.bad i { background: var(--red); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .92rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 14px; } .timeline .ev { margin-bottom: 14px; position: relative; }
.timeline .ev::before { content: ""; position: absolute; left: -21px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.auth { max-width: 420px; margin: 8vh auto 0; } .auth h1 { font-size: 2rem; } .brandmark { font: 700 .8rem/1 system-ui; letter-spacing: .2em; color: var(--brand); text-transform: uppercase; margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; } td, th { padding: 7px 4px; border-bottom: 1px solid var(--line); text-align: left; } th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.check { width: 26px; height: 26px; min-height: 0; padding: 0; accent-color: var(--green); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px); background: #2b2118; color: #fff; padding: 10px 16px; border-radius: 99px; z-index: 50; font-size: .9rem; box-shadow: var(--shadow); max-width: 90vw; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }
