:root {
  color-scheme: light;
  --page:           #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --series-1:       #2a78d6;
  --status-good:    #0ca30c;
  --status-critical:#d03b3b;
  --status-warning: #fab219;
  --good-text:      #006300;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);
    --series-1:       #3987e5;
    --good-text:      #0ca30c;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 24px 0 8px; color: var(--text-secondary); }
.sub { color: var(--text-muted); font-size: 12.5px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: 1080px; margin: 0 auto; padding: 18px 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 26px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.scan-meta { text-align: right; font-size: 13px; color: var(--text-secondary); }

.btn {
  font: inherit; font-size: 13.5px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); cursor: pointer;
}
.btn:hover { border-color: var(--baseline); }
.btn.primary { background: var(--series-1); border-color: transparent; color: #fff; }
.btn.primary:disabled { opacity: .55; cursor: default; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }

.banner {
  max-width: 1040px; margin: 0 auto 12px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-1); font-size: 13.5px;
}
.banner.error { border-left: 4px solid var(--status-critical); }
.banner.notif { border-left: 4px solid var(--status-warning); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.banner.notif.reconnect { border-left-color: var(--status-good); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px;
}
.tile-label { font-size: 12px; color: var(--text-muted); }
.tile-value { font-size: 26px; font-weight: 600; margin-top: 2px; }
.tile-value small { font-size: 14px; font-weight: 500; color: var(--text-secondary); }

.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 16px;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px;
  padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text-secondary); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status.online .dot { background: var(--status-good); }
.status.online { color: var(--good-text); }
.status.offline .dot { background: var(--status-critical); }
.status.offline { color: var(--status-critical); }

.dev-name { cursor: pointer; font-weight: 500; }
.dev-name:hover { text-decoration: underline dotted; }
.dev-name .router-tag {
  font-size: 10.5px; font-weight: 600; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; margin-left: 6px;
  vertical-align: 1px;
}
.watch-btn { background: none; border: none; cursor: pointer; font-size: 17px; opacity: .35; padding: 2px 6px; }
.watch-btn.on { opacity: 1; }
.forget-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 13px; }
.forget-btn:hover { color: var(--status-critical); }

.filters { display: flex; gap: 10px; align-items: center; }
select {
  font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary);
  max-width: 220px;
}
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 12.5px; padding: 5px 12px; border: none; cursor: pointer;
  background: transparent; color: var(--text-secondary);
}
.seg button.on { background: var(--series-1); color: #fff; }

.chart-sub { margin: -4px 0 6px; }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--series-1); }
.chart .bar-hit { fill: transparent; }
.chart .bar-hit:hover + .bar, .chart .hot .bar { opacity: .8; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--baseline); stroke-width: 1; }
.chart text { fill: var(--text-muted); font-size: 11px; font-family: inherit; font-variant-numeric: tabular-nums; }
.chart .empty-msg { fill: var(--text-secondary); font-size: 13px; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tooltip .t-val { font-weight: 600; }

.ongoing { color: var(--status-critical); font-weight: 500; }
footer { text-align: center; padding: 8px 0 24px; }
