:root {
  color-scheme: light dark;
  --bg: #f6f6f4; --surface: #fcfcfb; --border: #e2e1dc;
  --text: #0b0b0b; --text-2: #52514e; --text-3: #7a7973;
  --accent: #1c5cab;
  --series-1: #2a78d6; --series-2: #eb6834;
  --ok: #1f7a3d; --late: #9a6a00; --off: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121211; --surface: #1a1a19; --border: #34342f;
    --text: #ffffff; --text-2: #c3c2b7; --text-3: #8f8e85;
    --accent: #86b6ef;
    --series-1: #3987e5; --series-2: #d95926;
    --ok: #5cc27f; --late: #e0b040; --off: #f08a84;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 17px; color: var(--text); }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
nav a { color: var(--text-2); padding: 4px 0; border-bottom: 2px solid transparent; }
nav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }
.crumb { color: var(--text-3); padding-right: 8px; border-right: 1px solid var(--border); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
section { margin-top: 32px; }
.muted { color: var(--text-2); } .small { font-size: 13px; } .strong { font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.note { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text-2); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 16px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; color: var(--text); }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card h2 { margin: 2px 0; font-size: 19px; }
.kv { display: flex; gap: 24px; margin: 12px 0 8px; }
.kv dt { color: var(--text-3); font-size: 12px; } .kv dd { margin: 0; font-size: 18px; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; }
.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .of { font-size: 13px; font-weight: 400; color: var(--text-3); }
.tile .sub { font-size: 13px; color: var(--text-2); }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 12px; font-weight: 600; color: var(--text-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.delta { color: var(--text-2); font-size: 13px; margin-left: 6px; }
.state { font-size: 13px; } .state.ok { color: var(--ok); } .state.late { color: var(--late); } .state.off { color: var(--off); }

.monthnav { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; }
.monthnav strong { min-width: 140px; text-align: center; font-size: 17px; }
.btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 18px; }
.btn:hover { text-decoration: none; border-color: var(--accent); } .btn.off { color: var(--text-3); opacity: .5; }

.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { stroke: var(--text-3); stroke-width: 1; }
.chart .tick { fill: var(--text-2); font-size: 11px; }
.chart .s1 { fill: var(--series-1); } .chart .s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; } .chart .col:hover .hit { fill: var(--text); fill-opacity: .06; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.sw.s1 { background: var(--series-1); } .sw.s2 { background: var(--series-2); }
details { margin-top: 12px; } summary { cursor: pointer; color: var(--accent); font-size: 13px; }

.headrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.headrow h1, .headrow h2 { margin: 0; }
.button, button { display: inline-block; font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.button:hover, button:hover { text-decoration: none; border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
button.danger { color: var(--off); border-color: var(--off); }
.form { max-width: 520px; margin-top: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field.check label { font-weight: 400; font-size: 15px; }
.field input:not([type=checkbox]), .field select, .inline input { width: 100%; font: inherit; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.field input[readonly] { color: var(--text-3); background: var(--bg); }
.help { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.error { background: var(--surface); border: 1px solid var(--off); color: var(--off); border-radius: 8px; padding: 8px 12px; }
.inline { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.inline input { width: auto; padding: 4px 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; margin: 16px 0 0; }
.facts dt { font-size: 12px; color: var(--text-3); } .facts dd { margin: 0; }
details.add { margin-top: 16px; }

.user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user form { margin: 0; } .user button { padding: 4px 10px; font-size: 13px; }
.loginbox { max-width: 380px; margin: 48px auto 0; }
.inline.left { display: inline-flex; justify-content: flex-start; margin: 4px 4px 0 0; }
.inline button { padding: 3px 8px; font-size: 13px; }
.creds { grid-template-columns: 1fr; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.creds .big { font-size: 22px; font-weight: 650; letter-spacing: .5px; }
ul.plain { margin: 16px 0 0; padding-left: 20px; } ul.plain li { margin-bottom: 4px; }
@media print { .top, .note, button, a { display: none !important; } body { background: #fff; } }

.tile .small-value { font-size: 20px; }
