:root {
  color-scheme: dark;
  --bg: #060606;
  --bg-grid:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at top, rgba(55, 65, 81, 0.14), transparent 42%);
  --bg-grid-size: 28px 28px, 28px 28px, auto;
  --panel: rgba(10, 10, 10, 0.92);
  --panel-soft: rgba(18, 18, 18, 0.92);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --text-soft: #707070;
  --good: #00d26a;
  --warn: #ffb020;
  --bad: #ff4d4f;
  --idle: #8a8a8a;
  --radius: 22px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

body[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f6f8;
  --bg-grid:
    linear-gradient(rgba(17, 24, 39, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.05) 1px, transparent 1px),
    radial-gradient(circle at top, rgba(148, 163, 184, 0.2), transparent 42%);
  --panel: rgba(255, 255, 255, 0.94);
  --panel-soft: rgba(248, 250, 252, 0.96);
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --idle: #64748b;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  padding: 18px;
  background-color: var(--bg);
  background-image: var(--bg-grid);
  background-size: var(--bg-grid-size);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page-shell {
  max-width: 1520px;
  margin: 0 auto;
}

.hero,
.summary-pill,
.meta-card,
.legend-card,
.monitor-card,
.status-banner {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 24px;
  padding: 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.05;
}

.subtext {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.hero-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
}

.filter-tabs,
.control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab,
.ghost-button,
select {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font: inherit;
}

.filter-tab {
  cursor: pointer;
}

.filter-tab.active {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.ghost-button {
  cursor: pointer;
}

.status-banner {
  margin-top: 14px;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 14px;
}

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

.summary-pill {
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-pill-label {
  color: var(--text-soft);
  font-size: 12px;
}

.summary-pill-value {
  font-size: 22px;
}

.meta-row {
  margin-top: 12px;
}

.meta-card {
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.legend-card {
  margin-top: 12px;
  border-radius: 18px;
  padding: 14px 16px;
}

.legend-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 12px;
}

.legend-head strong {
  font-size: 14px;
}

.legend-head span {
  color: var(--text-muted);
  font-size: 12px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.legend-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-soft);
  padding: 12px;
}

.legend-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.legend-dot.good {
  background: var(--good);
}

.legend-dot.warn {
  background: var(--warn);
}

.legend-dot.bad {
  background: var(--bad);
}

.legend-dot.idle {
  background: var(--idle);
}

.legend-item-title {
  font-size: 13px;
  font-weight: 700;
}

.legend-item-desc {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.cards-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px;
}

.monitor-card {
  border-radius: 24px;
  padding: 18px;
  min-height: 330px;
  display: flex;
  flex-direction: column;
}

.card-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.card-title-wrap {
  min-width: 0;
  flex: 1;
}

.card-title {
  margin: 2px 0 6px;
  font-size: 20px;
  line-height: 1.2;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-badge.good {
  color: var(--good);
  background: rgba(0, 210, 106, 0.12);
}

.status-badge.warn {
  color: var(--warn);
  background: rgba(255, 176, 32, 0.14);
}

.status-badge.bad {
  color: var(--bad);
  background: rgba(255, 77, 79, 0.14);
}

.status-badge.idle {
  color: var(--idle);
  background: rgba(255, 255, 255, 0.08);
}

.metric-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-panel {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
}

.metric-label {
  display: block;
  color: var(--text-soft);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-value {
  display: block;
  font-size: 30px;
  line-height: 1;
  margin-bottom: 8px;
}

.metric-sub {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 36px;
}

.metric-bar {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.metric-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.metric-fill.good {
  background: linear-gradient(90deg, rgba(0, 210, 106, 0.5), var(--good));
}

.metric-fill.warn {
  background: linear-gradient(90deg, rgba(255, 176, 32, 0.45), var(--warn));
}

.metric-fill.bad {
  background: linear-gradient(90deg, rgba(255, 77, 79, 0.4), var(--bad));
}

.card-footer {
  margin-top: 18px;
}

.state-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
}

.state-chip.good {
  color: var(--good);
  background: rgba(0, 210, 106, 0.1);
}

.state-chip.warn {
  color: var(--warn);
  background: rgba(255, 176, 32, 0.12);
}

.state-chip.bad {
  color: var(--bad);
  background: rgba(255, 77, 79, 0.12);
}

.empty-state {
  border-radius: 22px;
  border: 1px dashed var(--border);
  padding: 42px 18px;
  text-align: center;
  color: var(--text-muted);
  background: var(--panel);
}

@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  .hero {
    flex-direction: column;
  }

  .hero-controls {
    width: 100%;
    min-width: 0;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}
