:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,.10); --border-strong: rgba(11,11,11,.18);
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-wash: #eaf2fc;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s-prev: #c3c2b7;
  --good: #0ca30c; --good-text: #006300; --warn: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #fff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10); --border-strong: rgba(255,255,255,.2);
    --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: #16273d;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s-prev: #4a4a47; --good-text: #0ca30c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--accent-ink); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 10px; color: var(--ink); }
h3 { font-size: 13px; font-weight: 650; margin: 0 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
p.sub { color: var(--ink-2); margin: 0 0 16px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }
/* nav */
.nav { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.nav .in { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 4px; min-height: 52px; flex-wrap: wrap; }
.nav .brand { font-weight: 700; margin-right: 12px; color: var(--ink); }
.nav a.item { padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a.item:hover { background: var(--accent-wash); text-decoration: none; color: var(--ink); }
.nav a.item.on { background: var(--accent-wash); color: var(--accent-ink); }
.nav .who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.nav form { margin: 0; }
/* cards / grid */
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g2 { grid-template-columns: repeat(2, 1fr); }
.g32 { grid-template-columns: 3fr 2fr; }
@media (max-width: 900px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3, .g2, .g32 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card.pad0 { padding: 0; }
.card .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card .hd .more { font-size: 13px; }
/* stat tiles */
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 650; line-height: 1.1; margin: 4px 0 2px; letter-spacing: -.02em; }
.tile.hero .value { font-size: 48px; }
.tile .delta { font-size: 13px; color: var(--ink-2); }
.tile .delta.up { color: var(--good-text); } .tile .delta.down { color: var(--critical); }
.tile .delta::before { content: ""; }
/* tables */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: color-mix(in srgb, var(--accent-wash) 60%, transparent); }
table.t .num { text-align: right; font-variant-numeric: tabular-nums; }
table.t th a { color: inherit; } table.t th a.on { color: var(--accent-ink); }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--ink-2); background: var(--surface); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.current::before { background: var(--good); } .badge.current { color: var(--good-text); }
.badge.lapsed::before { background: var(--warn); }
.badge.never::before, .badge.pending::before { background: var(--serious); }
.badge.incomplete::before, .badge.inactive::before { background: var(--muted); }
.badge.comped::before { background: var(--s1); }
.pill { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
/* forms */
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { width: 100%; min-height: 72px; resize: vertical; }
.btn { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--accent-wash); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--critical); border-color: var(--critical); } .btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--accent-ink); padding: 0; }
/* tabs & filters */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 8px 12px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--accent-ink); border-color: var(--accent); } .tabs a:hover { text-decoration: none; color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 12px 0; border: 1px solid; font-weight: 500; }
.flash.ok { background: #e9f7e9; border-color: #b7e2b7; color: #0e5a0e; } .flash.error { background: #fdecec; border-color: #f3b9b9; color: #8a1f1f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .flash.ok { background: #10240f; border-color: #235f23; color: #9be29b; } :root:not([data-theme="light"]) .flash.error { background: #2a1212; border-color: #6b2323; color: #f0a3a3; } }
details.box { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; margin-top: 12px; background: var(--surface); }
details.box summary { padding: 12px 16px; cursor: pointer; font-weight: 600; list-style: none; }
details.box summary::-webkit-details-marker { display: none; }
details.box summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .15s; }
details.box[open] summary::before { transform: rotate(90deg); }
details.box .in { padding: 0 16px 16px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 12px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 14px; } .kv dt { color: var(--ink-2); } .kv dd { margin: 0; }
/* charts */
.viz { position: relative; }
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz .grid line { stroke: var(--grid); stroke-width: 1; }
.viz .axis line, .viz .baseline { stroke: var(--axis); stroke-width: 1; }
.viz text { font-family: inherit; font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz text.lbl { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.viz .hit { fill: transparent; cursor: default; }
.viz .hit:hover + .bar, .viz .col:hover rect.seg { filter: brightness(1.08); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 6px 0 0; }
.legend .k { display: inline-flex; gap: 6px; align-items: center; } .legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .sw.line { width: 16px; height: 2px; border-radius: 1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--page); font-size: 12px; padding: 6px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .08s; z-index: 3; }
.tip.show { opacity: 1; }
.tip b { font-weight: 650; }
/* misc */
.empty { color: var(--muted); padding: 18px; text-align: center; }
.login { max-width: 380px; margin: 12vh auto; }
.login .card { padding: 26px; }
.login label.f { margin-bottom: 12px; } .login input { width: 100%; }
@media print { .nav, .filters, .btn, form { display: none !important; } .card { box-shadow: none; border: 0; } body { background: #fff; } }
.list { list-style: none; margin: 0; padding: 0; } .list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; } .list li:last-child { border: 0; }
.right { text-align: right; } .copybar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
