:root {
  --bg: #0a0612;
  --surface: #110d1e;
  --surface2: #1a1330;
  --border: rgba(255,255,255,0.07);
  --text: #e8e0f0;
  --muted: #6b6080;
  --accent: #a855f7;
  --accent-dim: rgba(168,85,247,0.12);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
}

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

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 24px 0 20px;
  margin-bottom: 36px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: -2px;
}

.last-updated {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ── Overall status banner ── */
.overall-banner {
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  border: 1px solid transparent;
  transition: all 0.3s;
}

.overall-banner.operational {
  background: var(--green-dim);
  border-color: rgba(34,197,94,0.2);
}
.overall-banner.degraded {
  background: var(--yellow-dim);
  border-color: rgba(245,158,11,0.2);
}
.overall-banner.outage {
  background: var(--red-dim);
  border-color: rgba(239,68,68,0.2);
}
.overall-banner.checking {
  background: var(--accent-dim);
  border-color: rgba(168,85,247,0.2);
}

.overall-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.operational .overall-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.degraded .overall-dot   { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.outage .overall-dot     { background: var(--red); box-shadow: 0 0 8px var(--red); }
.checking .overall-dot   { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.2s infinite; }

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

.overall-text strong {
  font-size: 17px;
  font-weight: 700;
  display: block;
  margin-bottom: 1px;
}
.overall-text span {
  font-size: 13px;
  color: var(--muted);
}

/* ── Section headers ── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Services ── */
.services-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
}

.service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.service-row:last-child { border-bottom: none; }
.service-row:hover { background: var(--surface2); }

.service-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.service-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.service-info { min-width: 0; }
.service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.service-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.service-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.service-latency {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: right;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.operational { color: var(--green); background: var(--green-dim); }
.status-badge.operational .dot { background: var(--green); }
.status-badge.degraded { color: var(--yellow); background: var(--yellow-dim); }
.status-badge.degraded .dot { background: var(--yellow); }
.status-badge.outage { color: var(--red); background: var(--red-dim); }
.status-badge.outage .dot { background: var(--red); }
.status-badge.checking { color: var(--accent); background: var(--accent-dim); }
.status-badge.checking .dot { background: var(--accent); animation: pulse 1.2s infinite; }

/* ── Uptime bars ── */
.uptime-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 32px;
}

.uptime-row {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.uptime-row:last-child { border-bottom: none; }

.uptime-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.uptime-service-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.uptime-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
}
.uptime-pct.degraded { color: var(--yellow); }
.uptime-pct.outage { color: var(--red); }

.uptime-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 28px;
}

.uptime-bar {
  flex: 1;
  border-radius: 2px;
  min-width: 2px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.uptime-bar:hover { opacity: 0.75; }
.uptime-bar.up      { background: var(--green); height: 100%; }
.uptime-bar.partial { background: var(--yellow); height: 65%; }
.uptime-bar.down    { background: var(--red); height: 40%; }
.uptime-bar.unknown { background: var(--surface2); height: 100%; border: 1px solid var(--border); }

.uptime-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

/* ── Incidents ── */
.incidents-section { margin-bottom: 48px; }

.no-incidents {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.no-incidents .check { font-size: 24px; margin-bottom: 8px; }

.incident-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.incident-header {
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.incident-severity {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.incident-severity.none       { background: var(--green); }
.incident-severity.minor      { background: var(--yellow); }
.incident-severity.major      { background: var(--red); }
.incident-severity.critical   { background: #dc2626; }

.incident-title {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}
.incident-date {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.incident-updates { padding: 0 20px; }

.incident-update {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.incident-update:last-child { border-bottom: none; }

.update-time {
  color: var(--muted);
  white-space: nowrap;
  min-width: 80px;
  font-size: 12px;
  padding-top: 1px;
}

.update-status {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  height: fit-content;
  flex-shrink: 0;
}
.update-status.investigating { background: var(--red-dim); color: var(--red); }
.update-status.identified    { background: var(--yellow-dim); color: var(--yellow); }
.update-status.monitoring    { background: var(--yellow-dim); color: var(--yellow); }
.update-status.resolved      { background: var(--green-dim); color: var(--green); }

.update-message { color: var(--text); line-height: 1.5; }

/* ── Uptime tooltip ── */
.uptime-tooltip {
  position: fixed;
  transform: translate(-50%, calc(-100% - 8px));
  background: var(--surface2);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  min-width: 140px;
  white-space: nowrap;
}
.uptime-tooltip.visible { opacity: 1; }
.tip-date { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.tip-status { font-weight: 600; font-size: 13px; }
.tip-status.up, .tip-status.operational { color: var(--green); }
.tip-status.partial, .tip-status.degraded { color: var(--yellow); }
.tip-status.down, .tip-status.outage { color: var(--red); }
.tip-status.unknown { color: var(--muted); }
.tip-incident { color: var(--muted); font-size: 11px; margin-top: 4px; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ── Refresh button ── */
.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }
.refresh-btn.spinning { opacity: 0.5; pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 540px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .last-updated { text-align: left; }
  .service-latency { display: none; }
  .uptime-bars { height: 20px; }
}
