:root {
  --grad: linear-gradient(120deg, #8b5cf6 0%, #fb5a6f 55%, #38bdf8 100%);
  --grad-soft: linear-gradient(
    120deg,
    rgba(139, 92, 246, 0.14),
    rgba(251, 90, 111, 0.12),
    rgba(56, 189, 248, 0.14)
  );

  --up: #22c55e;
  --up-soft: rgba(34, 197, 94, 0.16);
  --degraded: #f59e0b;
  --degraded-soft: rgba(245, 158, 11, 0.16);
  --down: #ef4444;
  --down-soft: rgba(239, 68, 68, 0.16);
  --nodata: #cbd5e1;

  --radius: 16px;
  --radius-sm: 10px;
}

/* Light theme (default) */
:root,
[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-grad:
    radial-gradient(
      1200px 600px at 10% -10%,
      rgba(139, 92, 246, 0.1),
      transparent 60%
    ),
    radial-gradient(
      1000px 600px at 110% 0%,
      rgba(56, 189, 248, 0.1),
      transparent 55%
    );
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --border: #e8eaf2;
  --text: #1a1c2c;
  --text-muted: #6b7088;
  --shadow: 0 10px 30px rgba(28, 30, 60, 0.08);
}

[data-theme="dark"] {
  --bg: #0b0d18;
  --bg-grad:
    radial-gradient(
      1200px 600px at 8% -10%,
      rgba(139, 92, 246, 0.18),
      transparent 60%
    ),
    radial-gradient(
      1000px 600px at 112% 0%,
      rgba(56, 189, 248, 0.14),
      transparent 55%
    );
  --surface: #14172a;
  --surface-2: #181b30;
  --border: #262a45;
  --text: #eef0fa;
  --text-muted: #9aa0bd;
  --nodata: #2c3150;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --bg: #0b0d18;
    --bg-grad:
      radial-gradient(
        1200px 600px at 8% -10%,
        rgba(139, 92, 246, 0.18),
        transparent 60%
      ),
      radial-gradient(
        1000px 600px at 112% 0%,
        rgba(56, 189, 248, 0.14),
        transparent 55%
      );
    --surface: #14172a;
    --surface-2: #181b30;
    --border: #262a45;
    --text: #eef0fa;
    --text-muted: #9aa0bd;
    --nodata: #2c3150;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 20px 64px;
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

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

.brand__logo {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 4px 10px rgba(139, 92, 246, 0.35));
}

.brand__text h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.last-updated {
  font-size: 12.5px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Overall banner ---------- */
.overall {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 26px;
}

.overall::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.7;
  background: var(--up-soft);
  transition: background 0.4s ease;
}

.overall--degraded::before {
  background: var(--degraded-soft);
}
.overall--down::before {
  background: var(--down-soft);
}
.overall--loading::before,
.overall--nodata::before {
  background: var(--grad-soft);
}

.overall__pulse {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 2.2s infinite;
  flex-shrink: 0;
}

.overall--degraded .overall__pulse {
  background: var(--degraded);
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
}
.overall--down .overall__pulse {
  background: var(--down);
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5);
}
.overall--loading .overall__pulse,
.overall--nodata .overall__pulse {
  background: #8b5cf6;
  box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70% {
    box-shadow: 0 0 0 14px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.overall__content {
  position: relative;
  z-index: 1;
}

.overall__content h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.overall__sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ---------- Service cards ---------- */
.services {
  display: grid;
  gap: 18px;
  margin-bottom: 34px;
}

.service {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.service__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

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

.service__id .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 2px;
  background: var(--nodata);
}
.service--up .dot {
  background: var(--up);
}
.service--degraded .dot {
  background: var(--degraded);
}
.service--down .dot {
  background: var(--down);
}

.service__name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.service__url {
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
}
.service__url:hover {
  color: #8b5cf6;
}

.service__status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  letter-spacing: 0.01em;
  background: var(--nodata);
  color: #fff;
}
.status-pill--up {
  background: var(--up-soft);
  color: var(--up);
}
.status-pill--degraded {
  background: var(--degraded-soft);
  color: var(--degraded);
}
.status-pill--down {
  background: var(--down-soft);
  color: var(--down);
}
.status-pill--nodata {
  background: var(--grad-soft);
  color: var(--text-muted);
}

.service__latency {
  font-size: 12px;
}

/* ---------- Uptime bars ---------- */
.service__bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 38px;
  margin-bottom: 16px;
}

.bar {
  flex: 1 1 0;
  min-width: 2px;
  height: 100%;
  border-radius: 3px;
  background: var(--nodata);
  transition:
    transform 0.1s ease,
    filter 0.1s ease;
  cursor: default;
}
.bar:hover {
  transform: scaleY(1.08);
  filter: brightness(1.08);
}
.bar--up {
  background: var(--up);
}
.bar--degraded {
  background: var(--degraded);
}
.bar--down {
  background: var(--down);
}
.bar--nodata {
  background: var(--nodata);
  opacity: 0.45;
}

/* ---------- Stats ---------- */
.service__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat__label {
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat__value {
  font-size: 17px;
  font-weight: 700;
}

/* ---------- Sparkline ---------- */
.chart__header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.sparkline {
  width: 100%;
  height: 80px;
  display: block;
}

/* ---------- Incidents ---------- */
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 14px;
}

.incidents__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.incident {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.incident__bar {
  width: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--down);
}
.incident--degraded .incident__bar {
  background: var(--degraded);
}

.incident__body {
  flex: 1;
}
.incident__title {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
}
.incident__meta {
  font-size: 12.5px;
  color: var(--text-muted);
}
.incident__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 8px;
}
.incident__badge--ongoing {
  background: var(--down-soft);
  color: var(--down);
}
.incident__badge--resolved {
  background: var(--up-soft);
  color: var(--up);
}

.incidents__empty {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--surface-2);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 36px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.footer__dot {
  margin: 0 8px;
}

.muted {
  color: var(--text-muted);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  box-shadow: var(--shadow);
  z-index: 10;
  transition: transform 0.15s ease;
}
.theme-toggle:hover {
  transform: rotate(20deg) scale(1.05);
}

@media (max-width: 560px) {
  .service__stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .stat__value {
    font-size: 15px;
  }
  .brand__text h1 {
    font-size: 19px;
  }
}
