:root {
  color-scheme: dark;
  --bg: #070c18;
  --raised: #0b1426;
  --surface: #0f1a2e;
  --line: rgba(108, 166, 218, 0.18);
  --line-strong: rgba(108, 166, 218, 0.4);
  --text: #f2f6fc;
  --muted: #aebbd0;
  --primary: #2f6fb0;
  --sky: #6ca6da;
  --violet: #8a4fa3;
  --berry: #b8336a;
  --red: #e3262b;
  --orange: #f7931e;
  --success: #3ddc97;
  --danger: #c81e23;
  /* lighter tints for small text so every pill clears 4.5:1 on the dark surfaces */
  --red-text: #ff7a7d;
  --violet-text: #c9a2e0;
  --brand: linear-gradient(90deg, #6ca6da 0%, #8a4fa3 28%, #b8336a 52%, #e3262b 76%, #f7931e 100%);
  --display: "Orbitron", "Poppins", system-ui, sans-serif;
  --body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(108, 166, 218, 0.35), 0 0 22px rgba(47, 111, 176, 0.35);
  --max: 1920px;
  --content: 1100px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

a { color: var(--sky); text-decoration-color: rgba(108, 166, 218, 0.4); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; border-radius: 4px; }

/* Backdrop: a faint synthwave scene behind the whole page */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.scene-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 45% at 50% 0%, rgba(138, 79, 163, 0.28), transparent 70%);
}
.scene-sun {
  position: absolute;
  left: 50%;
  top: -40px;
  width: 360px;
  height: 360px;
  margin-left: -180px;
  border-radius: 50%;
  opacity: 0.28;
  filter: blur(1px);
  background: linear-gradient(180deg, #f7931e 0%, #e3262b 45%, #b8336a 75%, #8a4fa3 100%);
  -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 22px, transparent 22px 30px);
  mask-image: repeating-linear-gradient(180deg, #000 0 22px, transparent 22px 30px);
}
.scene-floor {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -30%;
  height: 55%;
  opacity: 0.35;
  transform: perspective(500px) rotateX(62deg);
  background-image:
    linear-gradient(rgba(108, 166, 218, 0.5) 2px, transparent 2px),
    linear-gradient(90deg, rgba(184, 51, 106, 0.5) 2px, transparent 2px);
  background-size: 80px 80px;
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 90%);
  mask-image: linear-gradient(to top, #000 10%, transparent 90%);
}

.brand-bar {
  position: relative;
  z-index: 2;
  height: 5px;
  background: var(--brand);
}

.top, .page, .foot { position: relative; z-index: 1; }

.top-inner, .page, .foot-inner {
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 18px;
  padding-bottom: 6px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-logo { display: block; height: 32px; width: auto; }
.brand-word {
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.14em;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.checked {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 12, 24, 0.6);
}
.checked::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}
.checked.is-stale::before { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.checked.is-error::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.checked.is-loading::before { background: var(--sky); box-shadow: 0 0 8px var(--sky); }

.page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 18px;
  padding-bottom: 40px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(247, 147, 30, 0.45);
  background: rgba(247, 147, 30, 0.08);
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
}
.notice-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 10px var(--orange);
  animation: pulse 1.6s ease-in-out infinite;
  flex: none;
}

.card {
  background: rgba(11, 20, 38, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 24px 18px 22px;
  border-color: var(--line-strong);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 70% at 100% 0%, var(--hero-tint, rgba(61, 220, 151, 0.14)), transparent 70%);
}
.hero > * { position: relative; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(22px, 5.6vw, 40px);
  line-height: 1.15;
  letter-spacing: 0.03em;
  color: var(--hero-color, var(--text));
  text-shadow: 0 0 24px var(--hero-shadow, rgba(61, 220, 151, 0.35));
}
.hero-sub {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--muted);
  max-width: 60ch;
}
.hero-stamp {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.hero[data-overall="operational"] { --hero-color: var(--success); --hero-shadow: rgba(61, 220, 151, 0.4); --hero-tint: rgba(61, 220, 151, 0.14); }
.hero[data-overall="degraded"] { --hero-color: var(--orange); --hero-shadow: rgba(247, 147, 30, 0.4); --hero-tint: rgba(247, 147, 30, 0.14); }
.hero[data-overall="partial_outage"] { --hero-color: var(--orange); --hero-shadow: rgba(227, 38, 43, 0.4); --hero-tint: rgba(227, 38, 43, 0.14); }
.hero[data-overall="major_outage"] { --hero-color: var(--red-text); --hero-shadow: rgba(227, 38, 43, 0.5); --hero-tint: rgba(227, 38, 43, 0.2); }
.hero[data-overall="maintenance"] { --hero-color: var(--sky); --hero-shadow: rgba(108, 166, 218, 0.4); --hero-tint: rgba(138, 79, 163, 0.2); }
.hero[data-overall="unknown"], .hero[data-overall="loading"] { --hero-color: var(--muted); --hero-shadow: rgba(108, 166, 218, 0.2); --hero-tint: rgba(108, 166, 218, 0.08); }

/* HP bar */
.hp { margin-top: 18px; max-width: 560px; }
.hp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.hp-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2em;
}
.hp-value {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.hp-track {
  height: 22px;
  padding: 3px;
  border: 2px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
.hp-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #3ddc97, #6ca6da);
  box-shadow: 0 0 12px rgba(61, 220, 151, 0.5);
  transition: width 700ms ease, background 300ms;
  position: relative;
  min-width: 0;
}
.hp-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 10px, rgba(7, 12, 24, 0.25) 10px 12px);
}
.hp[data-level="mid"] .hp-fill { background: linear-gradient(90deg, #f7931e, #3ddc97); box-shadow: 0 0 12px rgba(247, 147, 30, 0.5); }
.hp[data-level="low"] .hp-fill { background: linear-gradient(90deg, #e3262b, #f7931e); box-shadow: 0 0 12px rgba(227, 38, 43, 0.5); animation: pulse 1.4s ease-in-out infinite; }
.hp[data-level="maintenance"] .hp-fill { background: linear-gradient(90deg, #6ca6da, #8a4fa3); box-shadow: 0 0 12px rgba(108, 166, 218, 0.5); }
.hp[data-level="unknown"] .hp-fill { background: rgba(174, 187, 208, 0.35); box-shadow: none; }

/* Legend */
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 14px; border-radius: 2px; display: inline-block; }
.swatch-operational { background: var(--success); }
.swatch-degraded { background: var(--orange); }
.swatch-outage { background: var(--red); }
.swatch-maintenance { background: repeating-linear-gradient(135deg, var(--sky) 0 3px, var(--primary) 3px 6px); }
.swatch-nodata { background: var(--surface); border: 1px solid var(--line-strong); }

/* Component rows */
.components { list-style: none; margin: 0; padding: 0; }
.row {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; padding-top: 4px; }
.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.row-name {
  font-weight: 600;
  font-size: 15px;
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: var(--display);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  background: rgba(7, 12, 24, 0.7);
  flex: none;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.pill-operational { color: var(--success); }
.pill-degraded { color: var(--orange); }
.pill-degraded::before { animation: pulse 1.6s ease-in-out infinite; }
.pill-outage { color: var(--red-text); }
.pill-outage::before { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1s ease-in-out infinite; }
.pill-maintenance { color: var(--sky); }
.pill-unknown { color: var(--muted); }

/* 90-day bars */
.uptime { display: block; }
.bar {
  display: flex;
  gap: 2px;
  height: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bar > li {
  flex: 1 1 0;
  min-width: 0;
  display: block;
}
.cell {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--success);
  cursor: default;
  display: block;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: inherit;
}
.cell:hover, .cell:focus-visible { transform: scaleY(1.18); outline-offset: 2px; }
.cell-degraded { background: var(--orange); }
.cell-outage { background: var(--red); }
.cell-maintenance { background: repeating-linear-gradient(135deg, var(--sky) 0 3px, var(--primary) 3px 6px); }
.cell-nodata { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.cell-today { box-shadow: 0 0 0 1px rgba(242, 246, 252, 0.7); }
.cell-today.cell-nodata { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 1px rgba(242, 246, 252, 0.7); }

.axis {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.axis-mid { font-weight: 500; color: var(--text); }
.axis-start-90 { display: inline; }
.axis-start-30 { display: none; }

@media (max-width: 559px) {
  .bar > li.old { display: none; }
  .axis-start-90 { display: none; }
  .axis-start-30 { display: inline; }
}

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Incidents */
.group-title {
  margin: 14px 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-title:first-child { margin-top: 0; }
.group-title-active { color: var(--orange); }
.incidents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.day-label {
  margin: 10px 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.incident {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(15, 26, 46, 0.7);
  padding: 14px 14px 10px;
}
.incident-active { border-color: rgba(247, 147, 30, 0.45); box-shadow: 0 0 0 1px rgba(247, 147, 30, 0.12), 0 0 24px rgba(247, 147, 30, 0.12); }
.incident-active.incident-maintenance { border-color: rgba(108, 166, 218, 0.5); box-shadow: 0 0 0 1px rgba(108, 166, 218, 0.12), 0 0 24px rgba(47, 111, 176, 0.25); }
.incident-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.incident-title { margin: 0; font-size: 16px; font-weight: 600; flex: 1 1 auto; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag-minor { color: var(--orange); }
.tag-major { color: var(--red-text); }
.tag-maintenance { color: var(--sky); }
.tag-state { color: var(--violet-text); }
.tag-state-resolved, .tag-state-completed { color: var(--success); }
.incident-meta { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.incident-meta b { font-weight: 500; color: var(--text); }
.updates { list-style: none; margin: 12px 0 0; padding: 0; border-top: 1px solid var(--line); }
.update { display: grid; grid-template-columns: 1fr; gap: 2px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.update:last-child { border-bottom: 0; }
.update-when { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.update-state { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--violet-text); }
.update-state-resolved, .update-state-completed { color: var(--success); }
.update-body { margin: 2px 0 0; font-size: 14px; }
.empty { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* Tooltip */
.tip {
  position: absolute;
  z-index: 10;
  max-width: 240px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  pointer-events: none;
}
.tip b { display: block; font-weight: 600; }
.tip span { color: var(--muted); }

/* Footer */
.foot { padding: 10px 0 36px; }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  font-size: 13px;
  color: var(--muted);
}
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }
.foot-note { margin: 0; }

/* Skeleton */
.skeleton .sk { display: block; border-radius: 6px; background: rgba(108, 166, 218, 0.12); animation: shimmer 1.4s ease-in-out infinite; }
.sk-name { width: 140px; height: 16px; }
.sk-pill { width: 84px; height: 24px; border-radius: 999px; }
.sk-bar { height: 28px; width: 100%; border-radius: 4px; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes shimmer { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

@media (min-width: 640px) {
  :root { --gutter: 24px; }
  body { font-size: 16px; }
  .card { padding: 24px 24px; }
  .hero { padding: 30px 28px 26px; }
  .row { display: grid; grid-template-columns: 220px 1fr; align-items: start; gap: 16px; padding: 16px 0; }
  .row-head { flex-direction: column; align-items: flex-start; margin-bottom: 0; gap: 8px; padding-top: 2px; }
  .bar { height: 32px; gap: 3px; }
  .update { grid-template-columns: 150px 1fr; }
  .update-when { grid-row: span 2; }
  .top-inner { padding-top: 24px; }
  .brand-logo { height: 40px; }
}

@media (min-width: 1100px) {
  :root { --content: 1240px; --gutter: 32px; }
  .page { padding-top: 28px; gap: 22px; }
  .hero { padding: 40px 36px 34px; }
  .hero-title { font-size: 44px; }
  .row { grid-template-columns: 260px 1fr; }
  .bar { height: 36px; }
  .scene-sun { width: 520px; height: 520px; margin-left: -260px; top: -80px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cell:hover, .cell:focus-visible { transform: none; }
}
