:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #14181f;
  --muted: #5f6a7a;
  --line: #e3e7ee;
  --accent: #3f6cf5;
  --accent-soft: rgba(63, 108, 245, 0.12);
  --warn: #b4690e;
  --warn-soft: rgba(180, 105, 14, 0.12);
  --bar: linear-gradient(90deg, #3f6cf5, #6f9bff);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
[data-theme="dark"] {
  --bg: #12161d;
  --panel: #1a2029;
  --text: #eef2f8;
  --muted: #9aa6b6;
  --line: #29313d;
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, 0.16);
  --warn: #f2b675;
  --warn-soft: rgba(242, 182, 117, 0.14);
  --bar: linear-gradient(90deg, #7aa2ff, #a7c1ff);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 inherit;
  -webkit-text-size-adjust: 100%;
}
.shell { max-width: 1080px; margin: 0 auto; padding: 20px 16px 32px; display: grid; gap: 16px; }
.bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: 0.2px; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
.live { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: #2fbf71; box-shadow: 0 0 0 4px rgba(47, 191, 113, 0.16); }
.dot.warn { background: var(--warn); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-height: 32px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.banner { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--warn-soft); color: var(--warn); border: 1px solid transparent; }
.banner.error { background: var(--accent-soft); color: var(--accent); }
.toolbar { display: grid; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.segmented { display: inline-flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px;
  min-height: 44px; padding: 0 16px; border-radius: 8px; cursor: pointer;
}
.segmented button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.field select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; max-width: 60vw;
}
.field.check { gap: 6px; min-height: 44px; }
.field.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.ghost {
  font: inherit; font-size: 14px; color: var(--text); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; min-height: 44px; padding: 0 16px;
}
.ghost:disabled { opacity: 0.5; cursor: progress; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.kpi-label { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.kpi-value { margin: 0; font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 15px; font-weight: 500; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rank li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .no { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }
.rank .who { min-width: 0; }
.rank .name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .meta { font-size: 12px; color: var(--muted); }
.rank .track { height: 6px; border-radius: 999px; background: var(--bg); margin-top: 6px; overflow: hidden; }
.rank .fill { height: 100%; border-radius: 999px; background: var(--bar); }
.rank .count { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 600; }
.channels { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.channels li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.channels li:last-child { border-bottom: 0; }
.channels .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); font-size: 14px; margin: 12px 2px; }
.foot { color: var(--muted); font-size: 12px; }
.foot p { margin: 0; }
@media (max-width: 420px) {
  .shell { padding: 14px 12px 24px; }
  .kpi-value { font-size: 22px; }
  .segmented button { padding: 0 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  .fill, .dot { transition: width 0.35s ease, background 0.2s ease; }
}
