:root { --bg: #f6f7f9; --fg: #1d2330; --muted: #667085; --card: #fff; --line: #e3e6eb; --accent: #1f6feb; --bad: #b42318; --badbg: #fef3f2; }
@media (prefers-color-scheme: dark) { :root { --bg: #11151c; --fg: #e6e8ec; --muted: #98a2b3; --card: #1a1f29; --line: #2b3240; --accent: #58a6ff; --bad: #f97066; --badbg: #2a1616; } }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--fg); }
/* layout: left sidebar on wide screens, top bar + ☰ menu on phones */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.sidebar { background: var(--card); border-bottom: 1px solid var(--line); }
.sidebar-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.menu-btn { padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; user-select: none; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-toggle:focus-visible + .sidebar .menu-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav, .sidebar-foot { display: none; padding: 0 8px 12px; }
.nav-toggle:checked + .sidebar .nav, .nav-toggle:checked + .sidebar .sidebar-foot { display: block; }
.nav a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="page"] { background: var(--bg); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-group { display: block; margin: 12px 12px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.sidebar-foot .langs { display: block; margin: 0 12px 8px; }
.sidebar-foot form { margin: 0 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
@media (min-width: 900px) {
  body.with-nav { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
  .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
             border-bottom: 0; border-right: 1px solid var(--line); }
  .sidebar-top { padding: 16px 20px; }
  .menu-btn { display: none; }
  .nav, .sidebar-foot { display: block; }
  .nav { flex: 1; }
}
.brand { font-weight: 700; color: var(--fg); text-decoration: none; }
.langs a { margin-left: 6px; color: var(--muted); text-decoration: none; }
.sidebar-foot .langs a:first-child { margin-left: 0; }
.langs a[aria-current] { color: var(--fg); font-weight: 700; }
main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 16px; }  /* width: a grid item with auto margins would shrink to its content */
a { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.narrow { max-width: 420px; margin: 24px auto; }
form.card label, fieldset label { display: block; margin: 10px 0; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
label.check input { display: inline; width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 12px 0; }
button, .button { display: inline-block; padding: 8px 14px; font: inherit; color: #fff; background: var(--accent); border: 0; border-radius: 6px; cursor: pointer; text-decoration: none; }
.button.secondary { background: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.link { padding: 0; color: var(--accent); background: none; }
form.inline { display: inline; margin: 0; }
.muted { color: var(--muted); }
.error { padding: 10px; color: var(--bad); background: var(--badbg); border-radius: 6px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); margin: 12px 0; }
th, td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
tr.inactive { opacity: .55; }
tr.bad td { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stats b { display: block; font-size: 28px; }
.stats span { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.filters select, .filters input { width: auto; margin: 0; }
.filters label.check { margin: 0; }
tr.late td { color: var(--bad); }
.warn { padding: 10px; background: var(--badbg); border-radius: 6px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.actions select { width: auto; flex: 1; margin: 0; }
button.secondary { background: var(--muted); }
button.danger { background: var(--bad); }
audio { width: 100%; }
pre.raw { white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 6px; }
.card.spaced { margin: 12px 0; }
blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--bg); }
.badge { display: inline-block; padding: 0 6px; font-size: 12px; color: #fff; background: var(--accent); border-radius: 8px; }
.narrow.wide { max-width: 640px; }
label .error { display: block; margin-top: 4px; }
/* dashboard: one validated series hue (reference palette slot 1), stepped for dark mode */
.viz-root { --series-1: #2a78d6; }
@media (prefers-color-scheme: dark) { .viz-root { --series-1: #3987e5; } }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile b { font-size: 28px; }
.meter { height: 6px; margin-top: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--fg); border-radius: 3px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.chart { margin: 0; }
.chart figcaption { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.chart figcaption b { color: var(--fg); }
.chart svg { display: block; width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .mark { fill: var(--series-1); }
.chart .hit { fill: transparent; }
.chart .bar:hover .mark { opacity: .8; }
.chart .tick { font-size: 10px; fill: var(--muted); text-anchor: middle; }
.chart .value { font-size: 11px; fill: var(--fg); text-anchor: middle; font-weight: 600; }
details.card summary { cursor: pointer; }
.meter-fill.w0 { width: 0%; }
.meter-fill.w5 { width: 5%; }
.meter-fill.w10 { width: 10%; }
.meter-fill.w15 { width: 15%; }
.meter-fill.w20 { width: 20%; }
.meter-fill.w25 { width: 25%; }
.meter-fill.w30 { width: 30%; }
.meter-fill.w35 { width: 35%; }
.meter-fill.w40 { width: 40%; }
.meter-fill.w45 { width: 45%; }
.meter-fill.w50 { width: 50%; }
.meter-fill.w55 { width: 55%; }
.meter-fill.w60 { width: 60%; }
.meter-fill.w65 { width: 65%; }
.meter-fill.w70 { width: 70%; }
.meter-fill.w75 { width: 75%; }
.meter-fill.w80 { width: 80%; }
.meter-fill.w85 { width: 85%; }
.meter-fill.w90 { width: 90%; }
.meter-fill.w95 { width: 95%; }
.meter-fill.w100 { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 4px 24px; }
