:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #0b0a08;
  --bg-surface: rgba(19, 17, 13, 0.88);
  --bg-surface-elevated: rgba(26, 23, 18, 0.94);
  --bg-subcard: rgba(255, 235, 190, 0.025);
  --bg-drawer: #100e0b;
  --border-subtle: rgba(224, 179, 94, 0.16);
  --border-strong: rgba(224, 179, 94, 0.34);
  --border-faint: rgba(255, 255, 255, 0.06);
  --text-primary: #f5f1e8;
  --text-secondary: #a39b8b;
  --text-muted: #6e6759;
  --gold: #e0b35e;
  --gold-bright: #f0ca7d;
  --gold-bronze: #7a5821;
  --gold-soft: rgba(224, 179, 94, 0.14);
  --gold-ink: #171208;
  --emerald: #34c77b;
  --emerald-soft: rgba(52, 199, 123, 0.14);
  --amber: #e59a38;
  --amber-soft: rgba(229, 154, 56, 0.24);
  --coral: #e5534b;
  --coral-soft: rgba(229, 83, 75, 0.28);
  --track-bg: rgba(255, 244, 214, 0.08);
  --topbar-bg: rgba(12, 11, 9, 0.84);
  --shadow-card: 0 10px 32px rgba(0, 0, 0, 0.42);
  --watermark-opacity: 0.036;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #f6f3ec;
  --bg-surface: rgba(255, 253, 248, 0.92);
  --bg-surface-elevated: #ffffff;
  --bg-subcard: rgba(154, 110, 32, 0.045);
  --bg-drawer: #fcfaf5;
  --border-subtle: rgba(166, 121, 42, 0.20);
  --border-strong: rgba(166, 121, 42, 0.42);
  --border-faint: rgba(24, 20, 12, 0.07);
  --text-primary: #1f1b14;
  --text-secondary: #6b6252;
  --text-muted: #948a78;
  --gold: #b58328;
  --gold-bright: #cf9b3a;
  --gold-bronze: #dfc184;
  --gold-soft: rgba(181, 131, 40, 0.12);
  --gold-ink: #fffdf9;
  --emerald: #199455;
  --emerald-soft: rgba(25, 148, 85, 0.12);
  --amber: #c97a16;
  --amber-soft: rgba(201, 122, 22, 0.18);
  --coral: #cf3b32;
  --coral-soft: rgba(207, 59, 50, 0.18);
  --track-bg: rgba(31, 27, 20, 0.08);
  --topbar-bg: rgba(248, 245, 238, 0.88);
  --shadow-card: 0 6px 24px rgba(36, 28, 12, 0.06);
  --watermark-opacity: 0.045;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* Subtle PRO / Crown / Diamond / Shield Watermark Pattern */
.bg-watermark {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--watermark-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='200' viewBox='0 0 260 200'%3E%3Cg fill='none' stroke='%23e0b35e' stroke-width='1.1'%3E%3Cg transform='translate(24,26) rotate(-10)'%3E%3Crect x='0' y='0' width='48' height='20' rx='4'/%3E%3Ctext x='24' y='14' text-anchor='middle' fill='%23e0b35e' stroke='none' font-family='sans-serif' font-size='10' font-weight='700' letter-spacing='1.5'%3EPRO%3C/text%3E%3C/g%3E%3Cg transform='translate(148,38) rotate(8)'%3E%3Cpath d='M2 12 L5 4 L10 9 L15 2 L20 9 L25 4 L28 12 Z'/%3E%3C/g%3E%3Cg transform='translate(88,118) rotate(-8)'%3E%3Cpath d='M6 0 L18 0 L24 7 L12 20 L0 7 Z'/%3E%3C/g%3E%3Cg transform='translate(192,134) rotate(-12)'%3E%3Crect x='0' y='0' width='48' height='20' rx='4'/%3E%3Ctext x='24' y='14' text-anchor='middle' fill='%23e0b35e' stroke='none' font-family='sans-serif' font-size='10' font-weight='700' letter-spacing='1.5'%3EPRO%3C/text%3E%3C/g%3E%3Cg transform='translate(28,148) rotate(6)'%3E%3Cpath d='M10 1 L19 5 V11 C19 16.5 15 20.5 10 22 C5 20.5 1 16.5 1 11 V5 Z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  background-size: 260px 200px;
}

.text-gold { color: var(--gold); }
.text-emerald { color: var(--emerald); }
.text-amber { color: var(--amber); }
.text-coral { color: var(--coral); }
.gold-icon { color: var(--gold); flex-shrink: 0; }

/* ─── Top Navigation Bar ─── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.topbar-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
html[data-theme="light"] .pro-badge {
  color: var(--gold);
}

.lunar-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: linear-gradient(90deg, rgba(224, 179, 94, 0.16), rgba(224, 179, 94, 0.34), rgba(224, 179, 94, 0.14));
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
}

.lunar-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d6, var(--gold));
  box-shadow: 0 0 8px var(--gold);
  display: inline-block;
  flex-shrink: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}
.live-indicator.is-reconnecting .live-dot {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subcard);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.18s var(--ease-out), color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}
.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--gold);
}
.icon-btn:focus-visible,
.view-tab:focus-visible,
.filter-pill:focus-visible,
.drawer-close-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subcard);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
}
.view-tab:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.view-tab.is-active {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  color: var(--gold-ink);
  font-weight: 600;
}

/* ─── Main Page Shell ─── */
.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  margin: 0 auto;
  padding: 20px 24px 36px;
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.card-heading h2,
.card-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Hero Grid (Map View) ─── */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
  gap: 16px;
  margin-bottom: 22px;
}

.overview-card,
.globe-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kpi-box {
  padding: 12px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
  text-align: center;
}

.kpi-num {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
}

.kpi-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.speed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-faint);
}

.speed-head,
.sub-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.speed-label,
.sub-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.speed-val {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sub-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.spark-wrap {
  height: 54px;
  width: 100%;
}
.spark-wrap svg,
.daily-trend-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.speed-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.overview-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px;
  margin-top: auto;
}

.daily-trend-chart {
  height: 78px;
  width: 100%;
}

.hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 78px;
  justify-content: center;
}

.hotspot-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.2fr) minmax(60px, 1fr) 36px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.hotspot-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-secondary);
}
.hotspot-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hotspot-track {
  height: 4px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}
.hotspot-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
}
.hotspot-pct {
  text-align: right;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Globe Card ─── */
.globe-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 14px;
  align-items: center;
  flex: 1;
  min-height: 310px;
}

.globe-stage {
  position: relative;
  width: 100%;
  height: 316px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: none;
  cursor: grab;
}
.globe-stage:active {
  cursor: grabbing;
}

#region-globe-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.globe-callouts {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.globe-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.36);
  transition: border-color 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}
.globe-tag:hover,
.globe-tag.is-selected {
  border-color: var(--gold);
}
.globe-tag-count {
  padding: 0 5px;
  border-radius: 4px;
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 600;
  font-size: 11px;
}

.globe-hint {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.region-sidebar {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
  align-self: center;
}

.region-sidebar-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.region-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.region-status-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.region-status-item:hover,
.region-status-item.is-selected {
  background: var(--gold-soft);
}

.region-item-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-primary);
}
.region-item-left span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.region-item-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
}
.region-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}

/* ─── Filter Toolbar ─── */
.summary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.summary-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.summary-heading {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.summary-heading h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.summary-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.status-pills,
.target-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s var(--ease-out);
}
.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.filter-pill.is-active {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  color: var(--gold-ink);
  font-weight: 600;
}

.region-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.select-icon {
  position: absolute;
  left: 10px;
  color: var(--text-secondary);
  pointer-events: none;
}
#region-filter-select {
  height: 32px;
  padding: 0 28px 0 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

/* ─── 4-Column Server Cards Grid ─── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.srv-card {
  padding: 16px 16px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .srv-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
  }
}
.srv-card.is-offline {
  opacity: 0.72;
}

.srv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.srv-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.srv-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srv-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.srv-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
}
.srv-card.is-offline .srv-state-dot {
  background: var(--text-muted);
}

/* 3-Column Resource Row */
.srv-res-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.res-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 5px;
}
.res-item-label {
  color: var(--text-muted);
}
.res-item-val {
  font-weight: 600;
  color: var(--text-primary);
}

.res-bar-track {
  height: 3px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
}
.res-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gold);
  transition: width 0.35s var(--ease-out);
}
.res-bar-fill.is-warn { background: var(--amber); }
.res-bar-fill.is-crit { background: var(--coral); }

/* Bottom 2-Col Split in Server Card */
.srv-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-faint);
}

.srv-mini-col {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.srv-mini-meta {
  min-width: 0;
}
.srv-mini-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.srv-mini-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.srv-mini-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.srv-mini-col:first-child .srv-mini-val {
  white-space: normal;
  overflow: visible;
}

.mini-bars-chart {
  width: 44px;
  height: 28px;
  flex-shrink: 0;
}
.mini-line-chart {
  width: 52px;
  height: 26px;
  flex-shrink: 0;
}
.mini-bars-chart svg,
.mini-line-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

#theme-toggle-btn svg[hidden] {
  display: none;
}

/* Flag Icon */
.flag-icon {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  vertical-align: -1px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* ─── View 2 & View 3 Shared Banners ─── */
.smart-banner {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.banner-icon,
.section-icon-box {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--gold-soft);
  border: 1px solid var(--border-subtle);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.banner-label {
  font-size: 11px;
  color: var(--text-muted);
}
.banner-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.section-banner {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.section-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-banner-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.section-banner-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.section-count-pill {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subcard);
  font-size: 12px;
  color: var(--text-primary);
}

/* ─── View 3: Resource Overview 3-Column ─── */
.resource-three-col {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.12fr) minmax(0, 0.96fr);
  gap: 16px;
  margin-bottom: 16px;
}

.res-widget {
  padding: 18px 18px 16px;
}

.mini-legend {
  display: inline-flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-secondary);
}
.mini-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.swatch-down,
.swatch-up {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}
.swatch-down { background: var(--gold-bright); }
.swatch-up { background: var(--gold-bronze); }

.seven-day-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  height: 186px;
  align-items: end;
  padding-top: 12px;
}
.day-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 6px;
}
.day-bar-well {
  width: 100%;
  max-width: 34px;
  flex: 1;
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.day-seg-down {
  width: 100%;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
}
.day-seg-up {
  width: 100%;
  background: var(--gold-bronze);
}
.day-col-date {
  font-size: 11px;
  color: var(--text-muted);
}

/* Heatmap Table */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px 6px;
}
.heatmap-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 4px 4px;
  text-align: center;
}
.heatmap-table th:first-child {
  text-align: left;
}
.heatmap-srv-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 165px;
}
.heatmap-srv-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.heat-cell {
  text-align: center;
  padding: 7px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
}
.heat-cell.heat-mid {
  background: var(--amber-soft);
  border-color: rgba(229, 154, 56, 0.35);
}
.heat-cell.heat-high {
  background: var(--coral-soft);
  border-color: rgba(229, 83, 75, 0.45);
}

/* Quota Rank List */
.quota-rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 6px;
}
.quota-row {
  display: grid;
  grid-template-columns: 16px minmax(92px, 1.15fr) minmax(70px, 1fr) 38px 86px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  cursor: pointer;
}
.quota-idx {
  color: var(--text-muted);
  font-size: 11px;
}
.quota-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.quota-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quota-pct {
  text-align: right;
  font-weight: 600;
}
.quota-amount {
  text-align: right;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.renewal-card {
  padding: 18px 20px;
}
.renewal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.renewal-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
  cursor: pointer;
  transition: border-color 0.16s var(--ease-out);
}
.renewal-item:hover {
  border-color: var(--border-strong);
}
.renewal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.renewal-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── View 2: Network Matrix & Curves ─── */
.network-matrix-card {
  padding: 18px 20px;
  margin-bottom: 16px;
}
.matrix-table-wrap {
  overflow-x: auto;
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.matrix-table th,
.matrix-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-faint);
  text-align: right;
}
.matrix-table th:first-child,
.matrix-table td:first-child {
  text-align: left;
}
.matrix-table th {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}
.matrix-table tbody tr {
  cursor: pointer;
  transition: background 0.14s var(--ease-out);
}
.matrix-table tbody tr:hover {
  background: var(--gold-soft);
}

.network-curves-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.net-node-card {
  padding: 18px 20px;
}
.net-chart-box {
  height: 120px;
  margin-top: 10px;
}
.net-chart-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── Footer Lunar Pill ─── */
.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 8px 24px 36px;
}
.lunar-footer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
}
.lunar-sep {
  color: var(--text-muted);
}

/* ─── Right Slide-Over Drawer ─── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.node-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 100vw);
  z-index: 70;
  background: var(--bg-drawer);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.65);
  transform: translateX(102%);
  transition: transform 0.28s var(--ease-out);
  display: flex;
  flex-direction: column;
}
.node-drawer.is-open {
  transform: translateX(0);
}

.drawer-scroll {
  overflow-y: auto;
  padding: 22px 22px 36px;
  flex: 1;
}

.drawer-header {
  margin-bottom: 18px;
}
.drawer-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.drawer-region-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
}
.drawer-close-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-subcard);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.drawer-close-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.drawer-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.d-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-subcard);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.health-box {
  display: flex;
  align-items: center;
  gap: 16px;
}
.health-score {
  font-size: 36px;
  font-weight: 600;
  line-height: 1;
}
.health-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
}
.health-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.drawer-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.drawer-kpi-item {
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subcard);
  border: 1px solid var(--border-faint);
}
.drawer-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.drawer-kpi-val {
  font-size: 17px;
  font-weight: 600;
}

.d-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 10px;
}
.d-sec-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.d-sec-note {
  margin: -4px 0 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.accounting-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.accounting-quota {
  font-size: 16px;
  font-weight: 600;
  color: var(--gold-bright);
}
html[data-theme="light"] .accounting-quota { color: var(--gold); }
.accounting-lines {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Daily Traffic Horizontal Bars in Drawer */
.daily-bars-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.daily-bar-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.daily-bar-date {
  color: var(--text-muted);
}
.daily-bar-track {
  height: 7px;
  border-radius: 3px;
  background: var(--track-bg);
  display: flex;
  overflow: hidden;
}
.daily-bar-down {
  height: 100%;
  background: var(--gold-bright);
}
.daily-bar-up {
  height: 100%;
  background: var(--gold-bronze);
}
.daily-bar-val {
  text-align: right;
  font-weight: 600;
}

/* Probe Targets List in Drawer */
.probe-list,
.kv-list {
  display: flex;
  flex-direction: column;
}
.probe-row,
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-faint);
  font-size: 12px;
}
.probe-name,
.kv-key {
  color: var(--text-secondary);
}
.probe-right {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.probe-ms {
  font-weight: 600;
  color: var(--gold-bright);
}
html[data-theme="light"] .probe-ms { color: var(--gold); }
.probe-loss {
  font-size: 11px;
  color: var(--text-muted);
}
.kv-val {
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
}

/* Carrier Return Badges (三网回程) */
.carrier-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.carrier-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  font-size: 12px;
}
.carrier-line {
  padding: 5px 10px;
  background: var(--bg-surface-elevated);
  font-weight: 600;
  color: var(--text-primary);
}
.carrier-isp {
  padding: 5px 9px;
  background: var(--gold-soft);
  color: var(--text-secondary);
  border-left: 1px solid var(--border-subtle);
}

/* Unlock Chips */
.unlock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.unlock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-faint);
  background: var(--bg-subcard);
  font-size: 11px;
}
.unlock-chip.is-ok {
  border-color: rgba(52, 199, 123, 0.28);
}
.unlock-chip.is-no {
  opacity: 0.68;
}
.unlock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.unlock-chip.is-ok .unlock-dot { background: var(--emerald); }
.unlock-chip.is-no .unlock-dot { background: var(--coral); }
.unlock-region {
  color: var(--gold);
  font-weight: 600;
}

.small-toggle-group {
  display: inline-flex;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.small-toggle-btn {
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.small-toggle-btn.is-active {
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 600;
}

/* ─── Responsive Breakpoints ─── */
@media (max-width: 1280px) {
  .server-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .resource-three-col {
    grid-template-columns: 1fr;
  }
  .renewal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .hero-grid,
  .network-curves-grid {
    grid-template-columns: 1fr;
  }
  .server-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar-inner,
  .page-shell {
    padding-left: 14px;
    padding-right: 14px;
  }
  .lunar-header-pill {
    display: none;
  }
  .globe-layout,
  .speed-grid,
  .overview-bottom-grid,
  .server-grid,
  .renewal-grid {
    grid-template-columns: 1fr;
  }
  .globe-stage {
    height: 250px;
  }
  .drawer-kpi-grid,
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quota-row {
    grid-template-columns: 16px 1fr 42px;
  }
  .quota-amount {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
