:root {
  --bg: #0a0d13;
  --bg-panel: #12161f;
  --bg-card: #151b26;
  --line: #232c3b;
  --text: #e6ecf5;
  --muted: #8c99ad;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --accent: #60a5fa;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 480px at 12% -10%, rgba(96, 165, 250, 0.12), transparent 60%),
    radial-gradient(700px 420px at 92% 0%, rgba(52, 211, 153, 0.09), transparent 62%);
  background-repeat: no-repeat;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #05070b;
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus { left: 0; }

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 56px;
}

/* ---------- top bar ---------- */

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

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, #1f2937, #0b1220);
  border: 1px solid var(--line);
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.7);
}

h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.overall {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  font-size: 0.88rem;
  font-weight: 600;
}
.overall-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}
.overall[data-state="operational"] { color: var(--ok); border-color: rgba(52, 211, 153, 0.34); }
.overall[data-state="operational"] .overall-dot { background: var(--ok); box-shadow: 0 0 10px rgba(52, 211, 153, 0.75); }
.overall[data-state="degraded"] { color: var(--warn); border-color: rgba(251, 191, 36, 0.34); }
.overall[data-state="degraded"] .overall-dot { background: var(--warn); box-shadow: 0 0 10px rgba(251, 191, 36, 0.7); }
.overall[data-state="outage"] { color: var(--bad); border-color: rgba(248, 113, 113, 0.36); }
.overall[data-state="outage"] .overall-dot { background: var(--bad); box-shadow: 0 0 10px rgba(248, 113, 113, 0.7); }

.refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(96, 165, 250, 0.4);
  background: linear-gradient(180deg, #1c2a44, #16203a);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.refresh:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.refresh:active:not(:disabled) { transform: translateY(0); }
.refresh:disabled { opacity: 0.65; cursor: progress; }
.refresh:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.refresh-icon { width: 17px; height: 17px; flex: none; }
.refresh.is-busy .refresh-icon { animation: spin 0.8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- meta row ---------- */

.meta {
  margin: 26px 0 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(18, 22, 31, 0.7);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
}

.updated {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.updated time {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.dot-sep { padding: 0 6px; opacity: 0.5; }
.rel { color: var(--muted); }

.auto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.auto input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

/* ---------- cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--muted);
}
.card[data-state="operational"]::before { background: var(--ok); }
.card[data-state="degraded"]::before { background: var(--warn); }
.card[data-state="outage"]::before { background: var(--bad); }
.card:hover { transform: translateY(-2px); border-color: #2f3b50; }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-name {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.card-desc {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill[data-state="operational"] { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.3); }
.pill[data-state="degraded"] { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.3); }
.pill[data-state="outage"] { color: var(--bad); background: rgba(248, 113, 113, 0.11); border-color: rgba(248, 113, 113, 0.32); }

.stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat { min-width: 0; }
.stat dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat dd {
  margin: 3px 0 0;
  font-size: 1.02rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.spark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 46px;
  padding: 6px 8px;
  border-radius: 9px;
  background: rgba(9, 12, 18, 0.65);
  border: 1px solid rgba(35, 44, 59, 0.75);
}
.spark-bar {
  flex: 1 1 0;
  border-radius: 2px;
  min-height: 3px;
  background: var(--muted);
  transition: height 0.25s ease;
}
.spark-bar[data-state="operational"] { background: var(--ok); }
.spark-bar[data-state="degraded"] { background: var(--warn); }
.spark-bar[data-state="outage"] { background: var(--bad); }
.spark-bar[data-state="empty"] { background: #1f2735; }

.note {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
  min-height: 2.4em;
}

.foot {
  margin-top: 30px;
  text-align: center;
  color: #6b7688;
  font-size: 0.78rem;
}
.foot p { margin: 0; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .shell { padding: 28px 16px 44px; }
  .topbar-right { width: 100%; justify-content: space-between; }
}

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