/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --bg:         #0b1220;
  --surface:    #111c2e;
  --surface-2:  #1a2a42;
  --border:     rgba(255,255,255,0.08);
  --text:       #e2e8f0;
  --muted:      #64748b;
  --online:     #22c55e;
  --degraded:   #f59e0b;
  --offline:    #ef4444;
  --unknown:    #334155;
  --accent:     #635bff;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ────────────────────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11,18,32,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.site-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--online);
  flex-shrink: 0;
}
.site-dot.degraded { background: var(--degraded); }
.site-dot.offline  { background: var(--offline); }
.site-dot.unknown  { background: var(--unknown); }
.site-title { font-weight: 600; font-size: 15px; }
.last-updated { color: var(--muted); font-size: 12px; }

/* ── Banner ────────────────────────────────────────────────────────────── */
.banner {
  padding: 14px 24px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.banner-inner { display: inline-flex; align-items: center; gap: 8px; }
.banner--online   { background: rgba(34,197,94,0.1);  color: #86efac; }
.banner--degraded { background: rgba(245,158,11,0.1); color: #fcd34d; }
.banner--offline  { background: rgba(239,68,68,0.1);  color: #fca5a5; }
.banner-icon { font-size: 16px; }

/* ── Main layout ───────────────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Service group ─────────────────────────────────────────────────────── */
.service-group { margin-bottom: 40px; }
.group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
  flex-shrink: 0;
}
.group-dot.degraded { background: var(--degraded); }
.group-dot.offline  { background: var(--offline); }
.group-dot.unknown  { background: var(--unknown); }
.group-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.group-rows {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

/* ── Service row ───────────────────────────────────────────────────────── */
.service-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.service-row:last-child { border-bottom: none; }

.svc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--unknown);
}
.svc-dot.online   { background: var(--online); }
.svc-dot.degraded { background: var(--degraded); animation: pulse 2s infinite; }
.svc-dot.offline  { background: var(--offline); animation: pulse 2s infinite; }

.svc-name {
  flex: 0 0 160px;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svc-history {
  flex: 1;
  display: flex;
  gap: 2px;
  align-items: center;
  min-width: 0;
}

.history-bar {
  width: 6px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--unknown);
  cursor: default;
  position: relative;
  transition: opacity 0.15s;
}
.history-bar:hover { opacity: 0.75; }
.history-bar[data-status="online"]   { background: var(--online); }
.history-bar[data-status="degraded"] { background: var(--degraded); }
.history-bar[data-status="offline"]  { background: var(--offline); }
.history-bar[data-status="unknown"]  { background: var(--unknown); }

/* Tooltip */
.history-bar::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
  white-space: pre;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
.history-bar:hover::after { opacity: 1; }

.svc-uptime {
  flex: 0 0 72px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.svc-badge {
  flex: 0 0 90px;
  text-align: right;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: capitalize;
}
.badge.online   { background: rgba(34,197,94,0.15);  color: #86efac; }
.badge.degraded { background: rgba(245,158,11,0.15); color: #fcd34d; }
.badge.offline  { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.badge.unknown  { background: rgba(100,116,139,0.15); color: var(--muted); }

/* ── Open incidents ─────────────────────────────────────────────────────── */
.incidents-open {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 32px;
}
.incidents-open h3 {
  font-size: 13px;
  font-weight: 700;
  color: #fca5a5;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.open-incident-item { margin-bottom: 10px; }
.open-incident-item:last-child { margin-bottom: 0; }
.open-incident-title { font-weight: 600; font-size: 14px; }
.open-incident-body  { color: #94a3b8; font-size: 13px; margin-top: 2px; }
.open-incident-meta  { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Incident history ───────────────────────────────────────────────────── */
.incident-history { margin-top: 48px; }
.no-incidents { color: var(--muted); font-size: 13px; }
.section-heading {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 16px;
}

.incident-item {
  border-left: 3px solid var(--border);
  padding-left: 18px;
  margin-bottom: 28px;
  position: relative;
}
.incident-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
}
.incident-item.severity-incident { border-left-color: var(--offline); }
.incident-item.severity-incident::before { border-color: var(--offline); }
.incident-item.severity-warning  { border-left-color: var(--degraded); }
.incident-item.severity-warning::before  { border-color: var(--degraded); }
.incident-item.severity-info     { border-left-color: var(--accent); }
.incident-item.severity-info::before     { border-color: var(--accent); }

.incident-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.incident-title { font-weight: 600; font-size: 14px; }
.incident-status-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 10px;
}
.incident-status-badge.open          { background: rgba(239,68,68,0.15);  color: #fca5a5; }
.incident-status-badge.investigating { background: rgba(245,158,11,0.15); color: #fcd34d; }
.incident-status-badge.resolved      { background: rgba(34,197,94,0.12);  color: #86efac; }
.incident-date { font-size: 12px; color: var(--muted); margin-left: auto; }
.incident-body { color: #94a3b8; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.incident-resolved { font-size: 12px; color: #86efac; margin-top: 6px; }

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

/* ── Pulse animation ────────────────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .svc-name    { flex: 0 0 110px; font-size: 13px; }
  .svc-uptime  { display: none; }
  .svc-badge   { flex: 0 0 70px; }
  .history-bar { width: 4px; height: 22px; }
  .service-row { padding: 12px 14px; gap: 8px; }
}
