:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1b1f24; --muted: #667085; --line: #e3e6eb;
  --ok: #137333; --ok-bg: #e6f4ea; --bad: #b3261e; --bad-bg: #fce8e6; --warn: #8a5a00; --warn-bg: #fff4d6;
  --accent: #1d4ed8; --on-accent: #ffffff; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a; --card: #1a1f26; --text: #e8eaed; --muted: #9aa4b2; --line: #2b323c;
    --ok: #7ddc96; --ok-bg: #16301f; --bad: #ff8a80; --bad-bg: #3a1c1a; --warn: #ffd37a; --warn-bg: #3a2f12;
    --accent: #8ab4ff; --on-accent: #0b1220;
  }
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
header { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.head-right { display: flex; gap: 10px; align-items: center; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 14px; margin: 18px 0 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat { flex: 1 1 200px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 2px; }
.stat .s { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.alert { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; }
.alert.red { background: var(--bad-bg); color: var(--bad); }
.alert.yellow { background: var(--warn-bg); color: var(--warn); }
.alert b { display: block; }
.alert small { display: block; opacity: .85; word-break: break-word; }
.none { color: var(--ok); background: var(--ok-bg); padding: 8px 10px; border-radius: 8px; }
form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
input, select, button { font: inherit; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
label.inline input { padding: 0; }
button { cursor: pointer; background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
button.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
button:disabled { opacity: .5; cursor: default; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
th.r, td.r { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12px; }
.plus { color: var(--ok); }
.minus { color: var(--bad); }
tr.synthetic td { color: var(--muted); }
tr.jump td { background: var(--bad-bg); }
tr.event td { background: var(--warn-bg); }
a.acc { color: var(--accent); cursor: pointer; text-decoration: underline; }
.chain { font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; margin-top: 10px; word-break: break-word; }
.note { color: var(--muted); font-size: 12px; font-weight: 400; }
.msg { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; }
.login-card h1 { margin-bottom: 14px; }
.login-card form { flex-direction: column; align-items: stretch; }
@media (max-width: 640px) { .wrap { padding: 12px; } }
.hide-box { max-width: 420px; display: flex; flex-direction: column; gap: 3px; }
.live-box { display: inline-flex; margin-left: 10px; font-size: 12px; font-weight: 400; }
#live-state { margin-left: 6px; }
tr.fresh td { animation: fresh 3s ease-out; }
@keyframes fresh { from { background: var(--ok-bg); } to { background: transparent; } }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 4px; }
