:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --axis-text: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .1);
  --wash: rgba(11, 11, 11, .05);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-text: #006300;
  --warning-text: #7a5400;
  --critical-text: #b32c2c;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a29a;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, .1);
    --wash: rgba(255, 255, 255, .06);
    --series-1: #3987e5;
    --series-2: #d95926;
    --good-text: #0ca30c;
    --warning-text: #fab219;
    --critical-text: #f08080;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 8px max(16px, calc((100vw - 1320px) / 2)); background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 600; text-decoration: none; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 4px 10px; border-radius: 6px; text-decoration: none; color: var(--ink-2); }
.nav a:hover { background: var(--wash); }
.nav a.active { background: var(--wash); color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.live { color: var(--muted); font-size: 13px; }
.ghost { padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: transparent; }
.ghost:hover { background: var(--wash); }
main { max-width: 1352px; margin: 0 auto; padding: 20px 16px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sub { color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; min-width: 0; }
.grid { display: grid; gap: 16px; }
.nodes { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.charts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); }
.section { margin-top: 24px; }
.wide { grid-column: 1 / -1; }
input.filter, select.filter { padding: 4px 10px; background: var(--surface); border: 1px solid var(--axis); border-radius: 6px; max-width: 100%; }
input.filter { width: 260px; margin-right: 8px; }
.chains { display: grid; gap: 4px; }
.hop-bad { color: var(--critical-text); }
.section > h2 { margin-bottom: 10px; }
.node-card { display: block; text-decoration: none; }
.node-card:hover { border-color: var(--axis); }
.node-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.node-title { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 10px 14px; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 20px; font-weight: 600; line-height: 1.25; }
.stat-note { color: var(--muted); font-size: 12px; }
.meter { height: 4px; margin-top: 4px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 2px; background: var(--series-1); }
.meter > i.warning { background: var(--warning); }
.meter > i.critical { background: var(--critical); }
.spark { display: block; width: 100%; height: 40px; margin-top: 12px; }
.spark-cap { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 10px; height: 10px; flex: none; }
.badge.ok { color: var(--good-text); }
.badge.ok::before { border-radius: 50%; background: var(--good); }
.badge.warning { color: var(--warning-text); }
.badge.warning::before { background: var(--warning); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.badge.critical, .badge.offline { color: var(--critical-text); }
.badge.critical::before { background: var(--critical); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.badge.offline::before { border: 2px solid var(--critical); border-radius: 50%; }
.controls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.controls button { padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px; background: transparent; font-variant-numeric: tabular-nums; }
.controls button:hover { background: var(--wash); }
.controls button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chart-wrap.stale { opacity: .55; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-now { font-size: 18px; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; margin-bottom: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .tip-key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.chart { display: block; width: 100%; height: 190px; touch-action: pan-y; }
.chart text { fill: var(--axis-text); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .cross { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
details.twin { margin-top: 6px; }
details.twin summary { color: var(--muted); font-size: 12px; cursor: pointer; }
details.twin .scroll { max-height: 220px; overflow: auto; margin-top: 6px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; white-space: nowrap; }
th, td { padding: 6px 12px 6px 0; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; padding-right: 0; }
td.break { overflow-wrap: break-word; }
.tooltip { position: fixed; z-index: 20; min-width: 130px; padding: 8px 10px; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .16); font-size: 12px; }
.tooltip[hidden] { display: none; }
.tip-time { color: var(--muted); margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-value { font-weight: 600; font-size: 13px; }
.tip-label { color: var(--muted); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: min(360px, 100%); }
.login h1 { margin-bottom: 4px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.login label { display: grid; gap: 4px; color: var(--ink-2); }
.login input { width: 100%; padding: 8px 10px; background: transparent; border: 1px solid var(--axis); border-radius: 6px; }
.primary { padding: 8px 12px; border: 0; border-radius: 6px; background: var(--ink); color: var(--surface); font-weight: 600; }
.primary[disabled] { opacity: .6; cursor: default; }
.error { color: var(--critical-text); min-height: 20px; margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 1px 8px; border-radius: 4px; background: var(--wash); font-size: 12px; font-variant-numeric: tabular-nums; }
.banner { margin-bottom: 16px; }
.banner ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.banner li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.limits { margin-bottom: 16px; font-size: 13px; }
.limits h2 { margin-bottom: 8px; }
@media (forced-colors: active) { .meter > i, .badge::before { background: CanvasText; } }
