:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --down: #dc2626;
  --down-soft: #fee2e2;
  --accent: #0284c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 22px rgba(15, 23, 42, 0.04);
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-muted: #0f172a;
  --border: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.16);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --down: #f87171;
  --down-soft: rgba(248, 113, 113, 0.16);
  --accent: #38bdf8;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 22px 18px 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

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

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

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 8px;
}

.nav-link:hover {
  color: var(--accent);
  background: var(--surface);
}

.btn-primary {
  border: none;
  background: var(--accent);
  color: #ffffff;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

html[data-theme="dark"] .btn-primary {
  color: #0f172a;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.summary-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.summary-banner.ok {
  border-left: 5px solid var(--ok);
}

.summary-banner.warn {
  border-left: 5px solid var(--warn);
}

.summary-banner.down {
  border-left: 5px solid var(--down);
}

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

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pulse-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

.pulse-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
}

.pulse-dot.down {
  background: var(--down);
  box-shadow: 0 0 0 4px var(--down-soft);
}

.summary-title {
  font-size: 16px;
  font-weight: 700;
}

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

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

.services-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.service-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.service-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.service-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.service-name:hover {
  color: var(--accent);
}

.kind-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-badge.down {
  background: var(--down-soft);
  color: var(--down);
}

.service-metrics {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0;
  gap: 10px;
  flex-wrap: wrap;
}

.uptime-bars {
  display: grid;
  grid-template-columns: repeat(48, 1fr);
  gap: 3px;
  height: 22px;
  margin-top: 6px;
}

.bar-slot {
  border-radius: 3px;
  background: var(--surface-muted);
}

.bar-slot.ok {
  background: var(--ok);
}

.bar-slot.down {
  background: var(--down);
}

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 80;
  pointer-events: none;
}

html[data-theme="dark"] .toast {
  background: #f1f5f9;
  color: #0f172a;
}
