:root {
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --gray: #6b7280;
  --bg: #f9fafb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #2ea3f2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --max-width: 760px;
}

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

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Open Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ── Layout ── */
header {
  background: #1e293b;
  color: #f8fafc;
  padding: 16px 0;
}
header .inner, main .inner, footer .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
header .inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
header h1 { font-size: 18px; font-weight: 600; }
header .logo-img {
  height: 32px;
  width: 32px;
  display: block;
  background: #ffffff;
  border-radius: 6px;
  padding: 3px;
}

main { max-width: var(--max-width); margin: 32px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 24px; }

footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Banner ── */
.banner {
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
  font-size: 17px;
  border: 1px solid transparent;
}
.banner.operational { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.banner.degraded    { background: #fefce8; border-color: #fde68a; color: #92400e; }
.banner.outage      { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.banner .dot { width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0; }
.banner.operational .dot { background: var(--green); }
.banner.degraded    .dot { background: var(--yellow); }
.banner.outage      .dot { background: var(--red); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-title {
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Component rows ── */
.component-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.component-row:last-child { border-bottom: none; }
.component-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.component-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* small status dot */
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot.operational { background: var(--green); }
.status-dot.degraded    { background: var(--yellow); }
.status-dot.outage      { background: var(--red); }
.status-dot.unknown     { background: var(--gray); }

.status-text {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 140px;
  text-align: right;
  flex-shrink: 0;
}
.status-text.operational { color: #15803d; }
.status-text.degraded    { color: #92400e; }
.status-text.outage      { color: #991b1b; }

/* 30-day uptime bar */
.uptime-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex-shrink: 0;
  min-width: 200px;
}
.uptime-bar .buckets {
  display: flex;
  gap: 2px;
}
.uptime-bar .bucket {
  flex: 1;
  height: 22px;
  border-radius: 1px;
  background: var(--border);
}
.uptime-bar .bucket.operational { background: var(--green); opacity: .8; }
.uptime-bar .bucket.degraded    { background: var(--yellow); }
.uptime-bar .bucket.outage      { background: var(--red); }
.uptime-bar .bar-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.uptime-bar .bar-axis .pct { font-weight: 500; }

/* Info tooltip "?" icon */
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 6px;
  cursor: help;
  flex-shrink: 0;
  user-select: none;
}
.info:hover, .info:focus { color: var(--accent); border-color: var(--accent); outline: none; }

/* ── Incidents ── */
.incident {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.incident:last-child { border-bottom: none; }
.incident-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.incident-title { font-weight: 600; font-size: 14px; }
.incident-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.incident-badge.investigating { background: #fef3c7; color: #92400e; }
.incident-badge.identified    { background: #fee2e2; color: #991b1b; }
.incident-badge.monitoring    { background: #e0f2fe; color: #075985; }
.incident-badge.resolved      { background: #f0fdf4; color: #15803d; }
.incident-badge.scheduled     { background: #ede9fe; color: #5b21b6; }
.incident-badge.in_progress   { background: #ddd6fe; color: #4c1d95; }
.incident-badge.completed     { background: #f0fdf4; color: #15803d; }
.incident-date { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.incident-update { font-size: 13px; color: var(--text-muted); padding: 4px 0; }
.incident-update time { font-weight: 500; color: var(--text); }
.incident.maintenance { border-left: 3px solid #7c3aed; padding-left: 17px; }
.incident-type.maintenance {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b21b6;
  background: #ede9fe;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: 1px;
}

/* ── Stale warning ── */
.stale-warning {
  text-align: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
}
.stale-warning.warn  { background: #fefce8; color: #92400e; }
.stale-warning.error { background: #fef2f2; color: #991b1b; }

/* ── Footer timestamp ── */
#last-updated { color: var(--text-muted); font-size: 13px; }

/* ── Probe details (expandable for degraded/outage) ── */
.probe-details {
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 0 8px 20px;
}
.probe-details summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
}
.probe-details summary::-webkit-details-marker { display: none; }
.probe-details summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
.probe-details[open] summary::before { transform: rotate(90deg); }
.probe-detail-content {
  padding: 5px 0 0 14px;
  word-break: break-all;
  line-height: 1.6;
}
.probe-detail-content a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(46,163,242,.4); }
.probe-detail-content a:hover { text-decoration-color: var(--accent); }

/* ── Skeleton loading ── */
.skeleton { background: linear-gradient(90deg, var(--border) 25%, #f3f4f6 50%, var(--border) 75%); background-size: 200%; animation: shimmer 1.4s infinite; border-radius: 4px; }
@keyframes shimmer { from { background-position: 200% } to { background-position: -200% } }
.skeleton-row { height: 16px; margin: 4px 0; }
