*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --border: #1e1e2e;
  --text: #e8e8ed;
  --text-muted: #8b8b9a;
  --accent: #c41e3a;
  --up: #22c55e;
  --up-bg: rgba(34, 197, 94, 0.12);
  --down: #ef4444;
  --down-bg: rgba(239, 68, 68, 0.12);
  --degraded: #f59e0b;
  --degraded-bg: rgba(245, 158, 11, 0.12);
  --paused: #6b7280;
  --paused-bg: rgba(107, 114, 128, 0.12);
  --radius: 8px;
  --max-width: 720px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.header {
  margin-bottom: 2rem;
  text-align: center;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.brand-link {
  display: inline-block;
  line-height: 0;
}

.brand-link:hover .brand-logo {
  opacity: 0.85;
}

.brand-logo {
  max-width: 220px;
  height: auto;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  transition: opacity 0.15s ease;
}

.subtitle {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.refresh-indicator {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stale-banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: var(--degraded-bg);
  color: var(--degraded);
  font-size: 0.875rem;
}

.overall {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 1.5rem;
}

.overall-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
  background: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

.overall h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.overall-detail {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.overall--operational {
  border-color: rgba(34, 197, 94, 0.3);
  background: var(--up-bg);
}

.overall--operational .overall-indicator {
  background: var(--up);
  animation: none;
}

.overall--degraded {
  border-color: rgba(245, 158, 11, 0.3);
  background: var(--degraded-bg);
}

.overall--degraded .overall-indicator {
  background: var(--degraded);
  animation: none;
}

.overall--major_outage {
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--down-bg);
}

.overall--major_outage .overall-indicator {
  background: var(--down);
  animation: none;
}

.overall--maintenance {
  border-color: rgba(107, 114, 128, 0.3);
  background: var(--paused-bg);
}

.overall--maintenance .overall-indicator {
  background: var(--paused);
  animation: none;
}

.overall--error {
  border-color: rgba(239, 68, 68, 0.3);
}

.overall--error .overall-indicator {
  background: var(--down);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.summary-item {
  padding: 0.875rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.summary-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.summary-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.summary-item--up .summary-value { color: var(--up); }
.summary-item--down .summary-value { color: var(--down); }
.summary-item--degraded .summary-value { color: var(--degraded); }
.summary-item--paused .summary-value { color: var(--paused); }

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.monitor-list,
.incident-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.monitor {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.monitor--loading {
  grid-template-columns: 1fr;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.monitor-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.monitor-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-name--link {
  color: var(--text);
  text-decoration: none;
}

.monitor-name--link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.monitor-downtime {
  font-size: 0.6875rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monitor-type {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.monitor-uptime {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill--up {
  background: var(--up-bg);
  color: var(--up);
}

.status-pill--down {
  background: var(--down-bg);
  color: var(--down);
}

.status-pill--degraded {
  background: var(--degraded-bg);
  color: var(--degraded);
}

.status-pill--paused {
  background: var(--paused-bg);
  color: var(--paused);
}

.status-pill--unknown {
  background: var(--paused-bg);
  color: var(--paused);
}

.incidents {
  margin-top: 2rem;
}

.incident {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  border-left: 3px solid var(--border);
}

.incident--down { border-left-color: var(--down); }
.incident--degraded { border-left-color: var(--degraded); }
.incident--up { border-left-color: var(--up); }

.incident-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.incident-meta,
.incident-reason {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.footer-logo {
  display: block;
  max-width: 120px;
  height: auto;
  margin: 0 auto 1rem;
  filter: brightness(0) invert(1);
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--text);
}

.footer-sep {
  margin: 0 0.35rem;
}

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

@media (max-width: 540px) {
  .brand-logo {
    max-width: 160px;
  }

  .monitor {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    align-items: start;
  }

  .monitor-info {
    grid-column: 1 / -1;
  }

  .monitor-type {
    grid-column: 1;
  }

  .status-pill {
    grid-row: 2;
    grid-column: 2;
    justify-self: end;
  }

  .monitor-uptime {
    grid-column: 1 / -1;
    text-align: left;
    font-size: 0.6875rem;
  }
}
