/* ═══════════════════════════════════════════════════════════
   VPS 监控 v2 — Glassmorphism Aurora Dark Theme
   ═══════════════════════════════════════════════════════════ */
:root {
  color-scheme: dark;
  /* base palette */
  --bg: #060912;
  --bg-2: #0a0f1c;
  --glass: rgba(18, 26, 44, 0.55);
  --glass-2: rgba(22, 32, 54, 0.65);
  --glass-hi: rgba(40, 54, 84, 0.6);
  --stroke: rgba(140, 170, 220, 0.12);
  --stroke-2: rgba(140, 170, 220, 0.22);
  --stroke-hi: rgba(140, 170, 220, 0.34);
  /* ink */
  --ink: #eef3fb;
  --ink-2: #c8d4e6;
  --muted: #8b9bb8;
  --faint: #5d6b86;
  /* status */
  --good: #34d399;
  --good-d: rgba(52, 211, 153, 0.14);
  --good-g: rgba(52, 211, 153, 0.45);
  --warn: #fbbf24;
  --warn-d: rgba(251, 191, 36, 0.14);
  --warn-g: rgba(251, 191, 36, 0.4);
  --bad: #fb7185;
  --bad-d: rgba(251, 113, 133, 0.14);
  --bad-g: rgba(251, 113, 133, 0.4);
  /* accents */
  --blue: #60a5fa;
  --blue-d: rgba(96, 165, 250, 0.14);
  --pink: #f472b6;
  --pink-d: rgba(244, 114, 182, 0.12);
  --purple: #a78bfa;
  --purple-d: rgba(167, 139, 250, 0.12);
  --cyan: #22d3ee;
  /* geometry */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
  /* shadows */
  --sh-1: 0 2px 10px rgba(0, 0, 0, 0.3);
  --sh-2: 0 8px 28px rgba(0, 0, 0, 0.38);
  --sh-3: 0 18px 50px rgba(0, 0, 0, 0.5);
  --glow-blue: 0 0 24px rgba(96, 165, 250, 0.22);
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  /* type */
  --fs-hero: 30px;
  --fs-h1: 19px;
  --fs-h2: 16px;
  --fs-body: 14px;
  --fs-sm: 12.5px;
  --fs-xs: 11px;
  --fs-micro: 10px;
  --maxw: 1640px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-body)/1.55 "Inter", "SF Pro Display", "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Aurora background ─── */
.aurora {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 800px at 80% -10%, rgba(96, 165, 250, 0.1), transparent 60%),
              radial-gradient(900px 700px at -10% 110%, rgba(167, 139, 250, 0.09), transparent 55%),
              linear-gradient(180deg, var(--bg), var(--bg-2));
}
.aurora-blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.42;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora-blob.b1 { width: 520px; height: 520px; left: -120px; top: -80px; background: #1e3a8a; }
.aurora-blob.b2 { width: 460px; height: 460px; right: -100px; top: 30%; background: #6d28d9; animation-delay: -8s; }
.aurora-blob.b3 { width: 420px; height: 420px; left: 40%; bottom: -160px; background: #0e7490; animation-delay: -15s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.96); }
}
.grid-overlay {
  position: absolute; inset: 0; opacity: 0.35;
  background-image: linear-gradient(rgba(140,170,220,0.04) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(140,170,220,0.04) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 80%);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Appbar ─── */
.appbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 13px 22px;
  background: linear-gradient(180deg, rgba(8, 12, 22, 0.85), rgba(8, 12, 22, 0.55));
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.appbar-brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex-shrink: 0; }
.brand-logo {
  width: 44px; height: 44px; border-radius: var(--r-md); flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(96,165,250,0.16), rgba(167,139,250,0.12));
  border: 1px solid rgba(96,165,250,0.28);
  box-shadow: 0 0 18px rgba(96,165,250,0.18), inset 0 1px 0 rgba(255,255,255,0.04);
}
.appbar-brand h1 {
  font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  background: linear-gradient(135deg, var(--ink), var(--blue));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

.appbar-health { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; margin-left: auto; min-width: 0; overflow: hidden; }
.hp-dot {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--r-pill);
  background: var(--glass); border: 1px solid var(--stroke);
  font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2);
  white-space: nowrap; flex-shrink: 0; transition: var(--ease);
}
.hp-dot:hover { border-color: var(--stroke-2); background: var(--glass-hi); }
.hp-dot::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--faint);
}
.hp-dot.good::before { background: var(--good); box-shadow: 0 0 8px var(--good-g); animation: pulse 2.4s ease-in-out infinite; }
.hp-dot.warn::before { background: var(--warn); box-shadow: 0 0 8px var(--warn-g); animation: pulse 2.4s ease-in-out infinite; }
.hp-dot.bad::before { background: var(--bad); box-shadow: 0 0 8px var(--bad-g); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(0.8); } }

/* ─── Command bar (refresh controls) ─── */
.cmd-btn {
  height: 30px; padding: 0 10px; border: 1px solid var(--stroke); border-radius: var(--r-md);
  background: var(--glass); color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer;
  transition: var(--ease); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.cmd-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cmd-btn:hover:not(:disabled) { background: var(--glass-hi); color: var(--ink); border-color: var(--stroke-2); }
.cmd-btn .cmd-label { white-space: nowrap; }
.cmd-btn.tone-good, .cmd-btn.tone-warn, .cmd-btn.tone-bad, .cmd-btn.tone-muted {
  color: var(--ink-2); border-color: var(--stroke);
}
.cmd-btn .spin { width: 13px; height: 13px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Main ─── */
main {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 0 auto; padding: 20px 22px 80px;
  display: flex; flex-direction: column; gap: 18px;
}
.block { width: 100%; }

/* ─── Panel (generic) ─── */
.panel {
  border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sh-1);
  padding: 16px 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
  min-height: 32px;
}
.panel-title { flex-shrink: 0; }
.panel-title h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.panel-title p { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 1; min-width: 0; justify-content: flex-end; margin-left: auto; }
.panel-refresh { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* range tabs */
.range-tabs {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill);
  background: rgba(10, 15, 28, 0.7); border: 1px solid var(--stroke);
  flex-shrink: 1; min-width: 0;
}
.range-tabs button {
  height: 26px; padding: 0 11px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600; cursor: pointer; transition: var(--ease); white-space: nowrap;
  flex-shrink: 0;
}
.range-tabs button:hover { color: var(--ink-2); }
.range-tabs button.active {
  background: linear-gradient(135deg, rgba(96,165,250,0.3), rgba(167,139,250,0.22));
  color: var(--ink); box-shadow: 0 2px 8px rgba(96,165,250,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* ─── Chart host ─── */
.chart-host { width: 100%; overflow: hidden; border-radius: var(--r-md); }
.chart-empty { padding: 36px; text-align: center; color: var(--muted); display: grid; gap: 6px; }
.chart-empty strong { color: var(--ink-2); font-size: var(--fs-body); }
.chart-empty span { font-size: var(--fs-sm); }

/* chart bar (legend only, slim strip) */
.chart-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap;
  width: 100%;
  padding: 0 0 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--stroke);
  min-height: 0;
}
.chart-bar:empty { display: none; }
.chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; justify-content: flex-end; width: 100%; }
.lg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border: 1px solid var(--stroke-2); border-radius: var(--r-pill);
  background: var(--glass); color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 700; cursor: pointer; transition: var(--ease); white-space: nowrap;
}
.lg-btn:hover { border-color: var(--stroke-hi); background: var(--glass-hi); color: var(--ink); transform: translateY(-1px); }
.lg-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; box-shadow: 0 0 8px color-mix(in srgb, var(--c) 65%, transparent); }
.lg-btn svg { display: block; flex-shrink: 0; }
.lg-btn.active {
  border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 16%, var(--glass));
  color: var(--ink); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 28%, transparent);
}
.lg-btn:not(.active) { opacity: 0.5; }
.lg-btn:not(.active):hover { opacity: 0.85; }

.chart-body { display: flex; gap: 0; }
.chart-plot { flex: 1; min-width: 0; position: relative; padding: 2px 4px 2px 8px; }
.chart-plot svg { display: block; width: 100%; height: auto; }
.chart-plot .hitbox { cursor: crosshair; }
.chart-cursor { pointer-events: none; }
.chart-latest {
  flex-shrink: 0; width: 162px; padding: 4px 4px 4px 12px;
  border-left: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 3px;
}
.chart-latest-title { font-size: var(--fs-micro); font-weight: 800; letter-spacing: 0.1em; color: var(--faint); text-transform: uppercase; margin-bottom: 3px; }
.lat-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.3; }
.lat-row.faded { opacity: 0.35; }
.lat-left { display: flex; align-items: center; gap: 5px; min-width: 0; }
.lat-left > * { flex-shrink: 0; }
.lat-name { font-weight: 700; white-space: nowrap; }
.lat-kind, .lat-carr { font-size: var(--fs-micro); color: var(--faint); white-space: nowrap; }
.lat-val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; flex-shrink: 0; }
.lat-val.tone-good { color: var(--good); }
.lat-val.tone-warn { color: var(--warn); }
.lat-val.tone-bad { color: var(--bad); }
.lat-val.tone-unknown { color: var(--faint); }

/* SVG chart internals */
.cg-grid line, .cg-axis { stroke: rgba(140, 170, 220, 0.08); stroke-width: 1; }
.cg-grid text, .cg-axis-label { fill: var(--faint); font-size: 10px; font-family: "SF Mono", "Cascadia Code", monospace; }
.cg-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cg-area { opacity: 0.14; }
.cg-dot-end { filter: drop-shadow(0 0 2px currentColor); }
.cg-dot-soft { filter: none; }

/* tooltip */
.chart-tip {
  display: none; position: absolute; z-index: 30; pointer-events: none;
  min-width: 160px; max-width: 290px; padding: 9px 12px; border-radius: var(--r-sm);
  background: rgba(8, 12, 22, 0.96); border: 1px solid var(--stroke-2);
  box-shadow: var(--sh-3); backdrop-filter: blur(8px); font-size: var(--fs-xs); line-height: 1.5;
}
.chart-tip .tt-time { color: var(--ink-2); font-weight: 700; margin-bottom: 5px; padding-bottom: 4px; border-bottom: 1px solid var(--stroke); }
.chart-tip .tt-row { display: grid; grid-template-columns: 20px auto 1fr auto; gap: 0 7px; align-items: center; margin-top: 2px; }
.chart-tip .tt-row:first-of-type { margin-top: 0; }
.chart-tip .tt-line { width: 18px; height: 12px; display: block; grid-column: 1; }
.chart-tip .tt-name { font-weight: 700; white-space: nowrap; grid-column: 2; }
.chart-tip .tt-carr { font-size: var(--fs-micro); color: var(--faint); white-space: nowrap; grid-column: 3; }
.chart-tip .tt-val { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; grid-column: 4; }

/* ─── Traffic stats ─── */
.traffic-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tcard {
  position: relative; overflow: hidden; padding: 15px 16px; border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--stroke); border-left: 3px solid var(--faint);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sh-1); transition: var(--ease-out);
}
.tcard:hover { transform: translateY(-3px); border-color: var(--stroke-2); box-shadow: var(--sh-2); }
.tcard.good { border-left-color: var(--good); }
.tcard.warn { border-left-color: var(--warn); }
.tcard.bad { border-left-color: var(--bad); }
.tcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard-name { font-size: var(--fs-h2); font-weight: 800; }
.tcard-cycle { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tcard-big { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 10px; min-width: 0; }
.tcard-big strong { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-big .quota { color: var(--faint); font-size: var(--fs-sm); font-weight: 600; }
.tcard-pct {
  flex-shrink: 0; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 800; background: rgba(140,170,220,0.1); color: var(--ink-2);
}
.tcard-pct.good { background: var(--good-d); color: var(--good); }
.tcard-pct.warn { background: var(--warn-d); color: var(--warn); }
.tcard-pct.bad { background: var(--bad-d); color: var(--bad); }
.tcard-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tcard-pills span { padding: 3px 9px; border-radius: var(--r-pill); background: rgba(140,170,220,0.07); border: 1px solid var(--stroke); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.tcard-pills span.tone-good { color: var(--good); background: var(--good-d); border-color: rgba(52,211,153,0.22); }
.tcard-pills span.tone-warn { color: var(--warn); background: var(--warn-d); border-color: rgba(251,191,36,0.22); }
.tcard-pills span.tone-bad { color: var(--bad); background: var(--bad-d); border-color: rgba(251,113,133,0.22); }
.tcard-pills span.tone-muted { color: var(--muted); }

/* usage meter */
.meter { height: 7px; overflow: visible; border-radius: var(--r-pill); background: rgba(140,170,220,0.1); box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); position: relative; margin-top: 11px; }
.meter-track { position: relative; width: 100%; height: 100%; border-radius: inherit; overflow: visible; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--good), var(--blue)); box-shadow: 0 0 10px var(--good-g); transition: width 0.7s cubic-bezier(0.4,0,0.2,1); }
.meter.warn .meter-fill { background: linear-gradient(90deg, var(--good), var(--warn)); box-shadow: 0 0 10px var(--warn-g); }
.meter.bad .meter-fill { background: linear-gradient(90deg, var(--warn), var(--bad)); box-shadow: 0 0 10px var(--bad-g); }
.meter-fill.unlimited { background: linear-gradient(90deg, rgba(140,170,220,0.3), rgba(140,170,220,0.12)); box-shadow: none; }
.meter-timemark {
  position: absolute; top: -4px; bottom: -4px; width: 2px; background: rgba(232,237,242,0.85);
  border-radius: 2px; box-shadow: 0 0 8px rgba(232,237,242,0.5), 0 0 0 2px rgba(9,13,20,0.7);
  transform: translateX(-50%); pointer-events: auto; z-index: 2;
}
.meter-timemark::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 6px rgba(232,237,242,0.6); }

/* ─── Node cards ─── */
.node-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ncard {
  position: relative; overflow: hidden; padding: 16px 17px; border-radius: var(--r-xl);
  background: var(--glass); border: 1px solid var(--stroke);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--sh-1); transition: var(--ease-out);
}
.ncard:hover { transform: translateY(-3px); border-color: var(--stroke-2); box-shadow: var(--sh-2); }
.ncard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--faint); }
.ncard.good::before { background: var(--good); box-shadow: 0 0 16px var(--good-g); }
.ncard.warn::before { background: var(--warn); box-shadow: 0 0 14px var(--warn-g); }
.ncard.bad::before { background: var(--bad); box-shadow: 0 0 12px var(--bad-g); }
.ncard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ncard-id { min-width: 0; display: flex; align-items: center; gap: 11px; }
.health-ring { width: 44px; height: 44px; flex-shrink: 0; position: relative; }
.health-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.health-ring .ring-bg { fill: none; stroke: rgba(140,170,220,0.12); stroke-width: 4; }
.health-ring .ring-fg { fill: none; stroke: var(--faint); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.4,0,0.2,1); }
.health-ring.good .ring-fg { stroke: var(--good); }
.health-ring.warn .ring-fg { stroke: var(--warn); }
.health-ring.bad .ring-fg { stroke: var(--bad); }
.health-ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.health-ring.good .ring-label { color: var(--good); }
.health-ring.warn .ring-label { color: var(--warn); }
.health-ring.bad .ring-label { color: var(--bad); }
.health-ring .ring-label svg { transform: none; width: 16px; height: 16px; }
.ncard-id-text { min-width: 0; }
.ncard-name { display: flex; align-items: center; gap: 7px; }
.ncard-name strong { font-size: var(--fs-h1); font-weight: 800; line-height: 1.1; }
.ncard-reco { padding: 2px 8px; border-radius: var(--r-pill); color: var(--good); background: var(--good-d); font-size: var(--fs-micro); font-weight: 700; }
.ncard-host { display: block; margin-top: 3px; color: var(--faint); font-size: var(--fs-micro); font-family: "SF Mono", "Cascadia Code", monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ncard-actions { display: flex; flex-direction: row; align-items: center; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.ncard-stab { padding: 4px 11px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.ncard-stab.good { color: var(--good); background: var(--good-d); }
.ncard-stab.warn { color: var(--warn); background: var(--warn-d); }
.ncard-stab.bad { color: var(--bad); background: var(--bad-d); }

/* carrier gauges */
.carr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.carr-cell {
  --lane: var(--faint);
  position: relative; overflow: hidden; padding: 11px 12px; border-radius: var(--r-md);
  background: rgba(6, 10, 20, 0.4); border: 1px solid var(--stroke);
}
.carr-cell.telecom { --lane: var(--blue); }
.carr-cell.unicom { --lane: var(--pink); }
.carr-cell.mobile { --lane: var(--good); }
.carr-cell::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--faint); }
.carr-cell.good::before { background: var(--good); box-shadow: 0 0 8px var(--good-g); }
.carr-cell.warn::before { background: var(--warn); box-shadow: 0 0 8px var(--warn-g); }
.carr-cell.bad::before { background: var(--bad); box-shadow: 0 0 8px var(--bad-g); }
.carr-cell.unknown::before { background: var(--faint); opacity: 0.5; }
.carr-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); font-size: var(--fs-xs); }
.carr-label small { color: var(--faint); font-size: var(--fs-micro); font-weight: 600; }
.carr-val { margin-top: 5px; color: var(--ink); font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.carr-cell.good .carr-val { color: var(--good); }
.carr-cell.warn .carr-val { color: var(--warn); }
.carr-cell.bad .carr-val { color: var(--bad); }
.carr-cell.unknown .carr-val { color: var(--faint); }
.carr-bar { height: 3px; margin-top: 8px; overflow: hidden; border-radius: var(--r-pill); background: rgba(140,170,220,0.1); }
.carr-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--faint), transparent); opacity: 0.7; transition: width 0.6s ease; }
.carr-cell.good .carr-bar i { background: linear-gradient(90deg, var(--good), transparent); opacity: 0.95; }
.carr-cell.warn .carr-bar i { background: linear-gradient(90deg, var(--warn), transparent); opacity: 0.95; }
.carr-cell.bad .carr-bar i { background: linear-gradient(90deg, var(--bad), transparent); opacity: 0.95; }

/* strips (outbound/return) */
.strip {
  display: grid; gap: 6px; margin-top: 11px; padding: 10px 11px; border-radius: var(--r-md);
  background: rgba(6, 10, 20, 0.32); border: 1px solid var(--stroke); border-left: 3px solid var(--faint);
}
.strip.good { border-left-color: var(--good); background: rgba(52,211,153,0.05); }
.strip.warn { border-left-color: var(--warn); background: rgba(251,191,36,0.05); }
.strip.bad { border-left-color: var(--bad); background: rgba(251,113,133,0.05); }
.strip-line { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; color: var(--muted); font-size: var(--fs-xs); line-height: 1.35; }
.strip-label { color: var(--faint); font-size: var(--fs-micro); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.strip-line strong { color: var(--ink); font-size: var(--fs-sm); font-weight: 800; font-variant-numeric: tabular-nums; }
.strip.good .strip-line strong { color: var(--good); }
.strip.warn .strip-line strong { color: var(--warn); }
.strip.bad .strip-line strong { color: var(--bad); }
.strip-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip-geo { font-size: var(--fs-xs); color: var(--faint); line-height: 1.45; word-break: break-word; overflow-wrap: anywhere; }

/* quality detail (always visible) */
.q-detail {
  display: flex; flex-direction: column; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--stroke);
}

.q-block { display: flex; flex-direction: column; gap: 5px; padding: 9px 11px; border-radius: var(--r-md); background: rgba(6,10,20,0.3); border: 1px solid var(--stroke); }
.q-block-title { color: var(--faint); font-size: var(--fs-micro); font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.q-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.q-pills { display: flex; flex-direction: column; gap: 5px; }
.q-network { display: contents; }
.q-meta { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.3fr); gap: 9px; }
.q-links { overflow: visible; }
.q-links .inline-links { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: 4px; }
.q-route-body { overflow: visible; }
.q-unlock { overflow: visible; }

/* pills & chips */
.vpill {
  display: inline-flex; align-items: center; max-width: 100%;
  padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid var(--stroke);
  background: rgba(140,170,220,0.06); color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vpill.good { color: var(--good); background: var(--good-d); border-color: rgba(52,211,153,0.2); }
.vpill.warn { color: var(--warn); background: var(--warn-d); border-color: rgba(251,191,36,0.2); }
.vpill.bad { color: var(--bad); background: var(--bad-d); border-color: rgba(251,113,133,0.2); }
.vpill.muted { color: var(--muted); }

.detail-link {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke); font-size: var(--fs-xs); font-weight: 600; color: var(--blue);
  transition: var(--ease);
}
.detail-link:hover { background: var(--blue-d); border-color: rgba(96,165,250,0.25); color: var(--ink); text-decoration: none; }
.inline-links { display: flex; flex-direction: column; gap: 2px; }
.inline-links .detail-link { justify-content: flex-start; }

/* route matrix */
.route-matrix { display: grid; gap: 3px; min-width: 0; }
.route-matrix-row { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 6px 5px; align-items: center; }
.route-matrix-head { color: var(--faint); font-size: var(--fs-micro); font-weight: 700; justify-items: center; }
.route-city { color: var(--muted); font-size: var(--fs-xs); font-weight: 800; text-align: left; white-space: nowrap; }
.route-path {
  min-width: 0; min-height: 26px; padding: 4px 6px; border-radius: var(--r-sm);
  background: rgba(140,170,220,0.06); color: var(--ink-2);
  font-family: "SF Mono", "Cascadia Code", monospace; font-size: var(--fs-xs); text-align: center; line-height: 1.2;
  display: flex; align-items: center; justify-content: center; overflow-wrap: anywhere;
}
.route-path.good { color: var(--good); background: var(--good-d); }
.route-path.warn { color: var(--warn); background: var(--warn-d); }
.route-path.bad { color: var(--bad); background: var(--bad-d); }
.route-path.weak { opacity: 0.76; border: 1px dashed rgba(251,191,36,0.22); }
.route-path.has-geo { flex-direction: column; padding-top: 2px; padding-bottom: 2px; }
.route-class-text { display: block; }
.route-geo-text { display: block; font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; margin-top: 1px; }
.route-matrix-empty { color: var(--muted); font-size: var(--fs-xs); line-height: 1.4; }

/* ─── Error banner ─── */
.error-banner {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  max-width: 680px; width: calc(100% - 32px); padding: 11px 18px; border-radius: var(--r-md);
  background: rgba(185, 28, 28, 0.92); color: #fecaca;
  font-size: var(--fs-sm); line-height: 1.4; font-weight: 600;
  box-shadow: var(--sh-3); z-index: 100; backdrop-filter: blur(8px); border: 1px solid rgba(251,113,133,0.4);
}

/* ─── Misc ─── */
.empty { padding: 28px; color: var(--muted); text-align: center; font-size: var(--fs-sm); }
.btn-sm { font-size: var(--fs-xs); padding: 3px 9px; }
.unlock-chips, .network-profile { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(140,170,220,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,170,220,0.3); }

/* ─── Animations ─── */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.panel, .tcard, .ncard { animation: fade-in 0.4s ease both; }
body.loaded .panel, body.loaded .tcard, body.loaded .ncard { animation: none; }
.tcard:nth-child(2) { animation-delay: 0.05s; }
.tcard:nth-child(3) { animation-delay: 0.1s; }
.tcard:nth-child(4) { animation-delay: 0.15s; }

/* ─── Responsive ─── */
@media (max-width: 1280px) {
  .traffic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .node-grid { grid-template-columns: 1fr; }
  .chart-latest { width: 130px; }
  .chart-legend { max-width: none; justify-content: flex-end; }
}
@media (max-width: 760px) {
  .appbar { gap: 8px; padding: 9px 12px; }
  .appbar-brand { gap: 8px; }
  .brand-logo { width: 36px; height: 36px; border-radius: var(--r-sm); }
  .brand-logo svg { width: 22px; height: 22px; }
  .appbar-brand h1 { font-size: 16px; }
  .appbar-health { gap: 3px; }
  .hp-dot { padding: 3px 7px; font-size: 9px; gap: 3px; border-radius: var(--r-sm); }
  .hp-dot::before { width: 6px; height: 6px; }
  main { padding: 14px 13px 60px; gap: 14px; }
  .traffic-grid { grid-template-columns: 1fr; }
  .tcard-big strong { font-size: 22px; }
  .panel { padding: 14px 13px; border-radius: var(--r-lg); }
  .panel-head { gap: 6px; }
  .panel-title h2 { font-size: 14px; }
  .panel-tools { gap: 5px; }
  .cmd-btn { height: 28px; padding: 0 8px; font-size: var(--fs-micro); gap: 3px; }
  .cmd-btn .cmd-ic { width: 14px; height: 14px; }
  .range-tabs { padding: 2px; }
  .range-tabs button { height: 24px; padding: 0 6px; font-size: 10px; }
  .carr-grid { grid-template-columns: 1fr; }
  .ncard { padding: 14px; border-radius: var(--r-lg); }
  .ncard-top { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .ncard-actions { flex-direction: row; align-items: center; }
  .health-ring { width: 38px; height: 38px; }
  .health-ring .ring-label svg { width: 14px; height: 14px; }
  .chart-bar { gap: 4px; }
  .chart-legend { width: 100%; justify-content: flex-end; }
  .chart-body { flex-direction: column; gap: 8px; }
  .chart-plot { padding: 2px; }
  .chart-latest { width: 100%; border-left: none; border-top: 1px solid var(--stroke); padding: 8px 0 0; }
  .lat-row { font-size: var(--fs-micro); }
  .q-meta { grid-template-columns: 1fr; }
  .route-matrix-row { grid-template-columns: auto repeat(3, minmax(0,1fr)); min-width: 0; gap: 5px 3px; }
  .route-path { min-height: 24px; padding: 3px; font-size: 9.5px; }
  .route-geo-text { font-size: 7.5px; }
  .route-city { font-size: 9.5px; }
  .chart-legend { gap: 5px; }
  .lg-btn { height: 24px; padding: 0 7px; font-size: var(--fs-micro); }
}
@media (max-width: 480px) {
  .appbar { gap: 6px; padding: 8px 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-logo svg { width: 19px; height: 19px; }
  .appbar-brand h1 { font-size: 15px; }
  .appbar-health { gap: 2px; }
  .hp-dot { padding: 3px 5px; font-size: 8.5px; gap: 3px; }
  .hp-dot::before { width: 5px; height: 5px; }
  .tcard-big strong { font-size: 20px; }
  .cg-grid text, .cg-axis-label { font-size: 9px; }
  .panel-title h2 { font-size: 13px; }
  .panel-tools { gap: 4px; }
  .cmd-btn { height: 26px; padding: 0 6px; }
  .cmd-btn .cmd-label { display: none; }
  .cmd-btn .cmd-ic { width: 14px; height: 14px; }
  .range-tabs button { font-size: 9px; padding: 0 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora-blob, .hp-dot::before { animation: none !important; }
  * { transition-duration: 0.01ms !important; }
}
