:root {
  --bg: #0f1117;
  --surface: #171a22;
  --surface-2: #1f2430;
  --border: #2a3142;
  --text: #f4f6fb;
  --muted: #9aa4b8;
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.15);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --page-bg-image:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 24%),
    linear-gradient(var(--bg), var(--bg));
  --page-bg-size: auto;
  --page-bg-position: 0% 0%;
  --page-bg-animation: none;
}

[data-theme="brand"] {
  --page-bg-image:
    radial-gradient(1000px 600px at 25% 15%, rgba(255, 0, 150, 0.22), transparent 61%),
    radial-gradient(1200px 800px at 85% 85%, rgba(40, 0, 90, 0.34), transparent 71%),
    linear-gradient(135deg, #5c1848 0%, #441060 35%, #301848 65%, #1a1040 100%);
  --page-bg-size: 116% 116%;
  --page-bg-position: 0% 0%, 0% 0%, 0% 0%;
  --page-bg-animation: agGradientPan 22s ease-in-out infinite;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background-image: var(--page-bg-image);
  background-size: var(--page-bg-size);
  background-position: var(--page-bg-position);
  animation: var(--page-bg-animation);
  color: var(--text);
  min-height: 100vh;
}

@keyframes agGradientPan {
  0% {
    background-position: 0% 0%, 0% 0%, 0% 0%;
  }

  50% {
    background-position: 100% 30%, 20% 100%, 100% 100%;
  }

  100% {
    background-position: 0% 0%, 0% 0%, 0% 0%;
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
}

a {
  color: #c4b5fd;
}

.page {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
}

.theme-toggle {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 17, 23, 0.55);
  backdrop-filter: blur(8px);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: rgba(196, 181, 253, 0.45);
  color: #e9d5ff;
}

.page-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 32px;
}

.header-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

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

.brand-logo-link {
  display: block;
  flex-shrink: 0;
  line-height: 0;
}

.brand-logo {
  display: block;
  width: 72px;
  height: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.overall {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  min-width: 240px;
}

.overall-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--muted);
  flex-shrink: 0;
}

.overall-label {
  margin: 0;
  font-weight: 600;
}

.overall-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.intro {
  margin-bottom: 28px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.intro p + p {
  margin-top: 12px;
}

.incident-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
}

.incident-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #c4b5fd;
  background: var(--purple-soft);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.incident-manual {
  border-left-color: var(--purple);
}

.provider-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.metric-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-block strong {
  font-size: 0.92rem;
}

.incidents,
.providers {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.incidents-list {
  display: grid;
  gap: 12px;
}

.incident-card,
.provider-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.incident-card {
  padding: 16px 18px;
  border-left: 4px solid var(--red);
}

.incident-card h3,
.provider-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.incident-card p,
.provider-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.providers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.provider-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status-operational {
  color: var(--green);
  background: var(--green-soft);
}

.status-degraded {
  color: var(--amber);
  background: var(--amber-soft);
}

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

.status-unknown {
  color: var(--muted);
  background: rgba(154, 164, 184, 0.12);
}

.provider-meta {
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
}

.meta-row span:last-child {
  color: var(--muted);
  text-align: right;
}

.meta-row-details {
  align-items: start;
}

.probe-toggle {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  color: #c4b5fd;
  font: inherit;
  font-size: 0.88rem;
  text-align: right;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(196, 181, 253, 0.45);
  text-underline-offset: 3px;
}

.probe-toggle:hover {
  color: #e9d5ff;
}

.probe-details {
  margin-top: -4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.probe-details-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.probe-details-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  font-size: 0.86rem;
}

.probe-details-item dt {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.probe-details-item dd {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

.probe-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  color: #ddd6fe;
}

.probe-details-item a {
  color: #c4b5fd;
}

.provider-links {
  display: flex;
  gap: 12px;
  font-size: 0.88rem;
}

.loading,
.error {
  color: var(--muted);
  grid-column: 1 / -1;
}

.error {
  color: #fca5a5;
}

.footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
}

.footer p {
  margin: 0 0 8px;
}

.staff-login a {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .header,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .overall {
    min-width: 0;
  }

  .probe-details-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .provider-metrics {
    grid-template-columns: 1fr;
  }
}
