:root {
  --bg: #fbfaf8; --panel: #ffffff; --ink: #1d1d1f; --muted: #66666e; --line: #e4e2dd; --accent: #2f5d8a;
  --accent-soft: #e8eff6; --ok: #2e7d4f; --warn: #a15c00; --stop: #a33a3a; --code: #f3f1ec;
  --radius: 10px; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141517; --panel: #1c1d20; --ink: #e8e6e3; --muted: #9a9aa3; --line: #2e3035; --accent: #8db7e0;
    --accent-soft: #1f2a36; --ok: #7cc79a; --warn: #e0a85a; --stop: #e08a8a; --code: #24262a;
  }
}
:root[data-theme="dark"] {
  --bg: #141517; --panel: #1c1d20; --ink: #e8e6e3; --muted: #9a9aa3; --line: #2e3035; --accent: #8db7e0;
  --accent-soft: #1f2a36; --ok: #7cc79a; --warn: #e0a85a; --stop: #e08a8a; --code: #24262a;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top { border-bottom: 1px solid var(--line); background: var(--panel); }
header.top .inner, main, footer .inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
header.top .inner { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 650; font-size: 17px; color: var(--ink); }
.brand small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 13px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); }
nav a.on, nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.idbox { display: flex; gap: 6px; }
input, select, button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; }
button { cursor: pointer; background: var(--accent); border-color: var(--accent); color: var(--panel); font-weight: 560; }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; color: var(--accent); }
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 26px; margin: 0 0 6px; font-weight: 650; }
h2 { font-size: 18px; margin: 28px 0 10px; font-weight: 620; }
h3 { font-size: 15px; margin: 18px 0 6px; font-weight: 620; color: var(--muted); text-transform: none; }
p.lead { color: var(--muted); margin: 0 0 18px; max-width: 760px; }
.banner { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
  margin: 0 0 18px; color: var(--ink); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat b { display: block; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 6px 0 12px; }
.controls label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
  background: var(--panel); position: sticky; top: 0; }
th.sort { cursor: pointer; }
th.math { text-transform: none; font-size: 13px; }
.nowrap { white-space: nowrap; }
.rc { display: inline-block; white-space: nowrap; margin-right: 8px; }
.rc.wrap { white-space: normal; display: inline; }
td .rc { line-height: 1.7; }
th.sort.on { color: var(--accent); }
tr:last-child td { border-bottom: 0; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
td.tex { min-width: 180px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line);
  white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.stop { color: var(--stop); border-color: currentColor; }
.badge.plain { color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; margin: 10px 0; color: var(--muted); font-size: 13px; }
dl.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.long { max-height: 220px; overflow: auto; padding: 8px 10px; background: var(--code); border-radius: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.levels { display: flex; gap: 6px; flex-wrap: wrap; }
.levels .lv { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 13px; background: var(--panel); }
.levels .lv b { font-variant-numeric: tabular-nums; }
pre.raw { background: var(--code); padding: 12px; border-radius: 8px; overflow: auto; max-height: 420px; font-size: 12px; }
.loading { color: var(--muted); padding: 24px 0; }
.err { color: var(--stop); }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 18px 0 28px; }
.katex { font-size: 1.02em; }
@media (max-width: 720px) {
  header.top .inner { gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
  nav { order: 3; flex-basis: 100%; }
  .idbox { flex: 1; }
  .idbox input { flex: 1; min-width: 0; }
  dl.kv { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
}
