:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e3e2de;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77766f;
  --series-1: #2a78d6;
  --series-1-fill: rgba(42, 120, 214, .10);
  --good: #0a7d35;
  --critical: #c42b2b;
  --accent: #2a78d6;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #121211;
    --surface-1: #1a1a19;
    --border: #2d2d2b;
    --grid: #262624;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --series-1: #3987e5;
    --series-1-fill: rgba(57, 135, 229, .16);
    --good: #4cc27a;
    --critical: #f07171;
    --accent: #3987e5;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface-1: #1a1a19;
  --border: #2d2d2b;
  --grid: #262624;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --series-1: #3987e5;
  --series-1-fill: rgba(57, 135, 229, .16);
  --good: #4cc27a;
  --critical: #f07171;
  --accent: #3987e5;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }

.top, main, .foot { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 6px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--text-primary); }
.brand:hover { text-decoration: none; }
.beta { font-size: 12px; font-weight: 500; color: var(--text-secondary); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; }
.theme { display: grid; place-items: center; background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; padding-top: 24px; padding-bottom: 32px; }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-top: 16px; }
h1 { font-size: 24px; margin: 18px 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }

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

.notice { margin-top: 16px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary); font-size: 14px; }

.add { display: flex; gap: 8px; flex-wrap: wrap; }
.add input { flex: 1 1 260px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text-primary); font: inherit; }
.btn { padding: 9px 16px; border-radius: 8px; border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.msg { margin-top: 8px; font-size: 14px; min-height: 20px; color: var(--text-secondary); }
.msg.err { color: var(--critical); }

.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input { padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text-primary); font: inherit; width: 240px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--text-secondary); user-select: none; }
th.sort { cursor: pointer; }
th.sort:hover { color: var(--text-primary); }
th.l, td.l { text-align: left; }
tbody tr:hover { background: var(--bg); }
tr.row { cursor: pointer; }
.ch { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.ch img, .ch .ph { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; background: var(--grid); }
.ch .t { font-weight: 600; color: var(--text-primary); white-space: normal; max-width: 300px; }
.ch .s { color: var(--text-muted); font-size: 12px; }
.up { color: var(--good); }
.down { color: var(--critical); }
.zero { color: var(--text-muted); }
.pending { color: var(--text-muted); font-style: italic; }
.spark { display: block; }

.head { display: flex; gap: 16px; align-items: flex-start; margin-top: 18px; }
.head img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex: none; }
.head h1 { margin: 0 0 2px; }
.head .desc { color: var(--text-secondary); white-space: pre-line; margin-top: 8px; max-width: 760px; font-size: 14px; }
.back { display: inline-block; margin-top: 14px; font-size: 14px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 300px; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1-fill); }
.chart .cross { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.tip { position: absolute; pointer-events: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; }
.tip b { font-size: 15px; }
.ranges { display: flex; gap: 4px; }
.ranges button { background: none; border: 1px solid var(--border); color: var(--text-secondary); border-radius: 7px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.ranges button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
details summary { cursor: pointer; color: var(--text-secondary); font-size: 14px; }

@media (max-width: 640px) {
  .tile .value { font-size: 22px; }
  .head img { width: 56px; height: 56px; }
  .hide-sm { display: none; }
}
