:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --border: #e8e6df;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --text-dim: #9a9a9a;
  --accent: #cc785c;
  --op: #2f9960;
  --op-bg: #e8f5ee;
  --op-border: #c4e2d1;
  --deg: #eab308;
  --deg-bg: #fef9c3;
  --deg-border: #fde68a;
  --part: #e07c2d;
  --part-bg: #fdf0e3;
  --part-border: #f4c99c;
  --maj: #d63638;
  --maj-bg: #fce8e9;
  --maj-border: #f3b2b4;
  --maint: #6366f1;
  --maint-bg: #eef0fe;
  --maint-border: #c7cdfa;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.container { max-width: 960px; margin: 0 auto; padding: 24px 32px; }

/* ── Header ───────────────────────── */
.header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.brand {
  display: flex; align-items: center; gap: 20px;
  flex-wrap: wrap; justify-content: center;
}
.brand-logo {
  height: 56px; width: auto; display: block;
}
.brand-name { font-size: 28px; font-weight: 600; line-height: 1; }
.brand-tag { color: var(--text-muted); font-weight: 400; }

/* ── Error Rate widget (reprise realtime) ───────────────────────── */
.threat-score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  min-width: 260px;
}
.threat-header { margin-bottom: 8px; }
.threat-title {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.error-rate-content {
  display: flex; align-items: center; gap: 14px; padding: 4px 0;
}
.error-rate-value {
  font-size: 28px; font-weight: 700; color: var(--text);
  min-width: 70px; text-align: center; transition: color 0.3s;
}
.error-rate-scale { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.scale-level {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  transition: all 0.3s ease;
}
.scale-level.critical  { background: rgba(214, 54, 56, 0.10); }
.scale-level.warning   { background: rgba(212, 160, 41, 0.10); }
.scale-level.good      { background: rgba(15, 123, 147, 0.10); }
.scale-level.excellent { background: rgba(47, 153, 96, 0.10); }
.scale-level.critical  .scale-label { color: #c43b3b; }
.scale-level.warning   .scale-label { color: #b47400; }
.scale-level.good      .scale-label { color: #0f7b93; }
.scale-level.excellent .scale-label { color: var(--op); }
.scale-level.critical  .scale-arrow { color: #c43b3b; }
.scale-level.warning   .scale-arrow { color: #b47400; }
.scale-level.good      .scale-arrow { color: #0f7b93; }
.scale-level.excellent .scale-arrow { color: var(--op); }
.scale-arrow {
  font-size: 10px; opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.scale-level.active { transform: scale(1.05); }
.scale-level.active .scale-arrow {
  opacity: 1; animation: arrowPulse 1s ease infinite;
}
@keyframes arrowPulse {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}
.scale-label { text-transform: uppercase; letter-spacing: 0.5px; }
.threat-details {
  text-align: center; font-size: 11px;
  color: var(--text-muted); margin-top: 6px;
}

/* ── Current status hero ───────────────────────── */
.hero {
  background: var(--op-bg);
  border: 1px solid var(--op-border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 40px;
  display: flex; align-items: center; gap: 16px;
  transition: background 0.3s, border-color 0.3s;
}
.hero.degraded       { background: var(--deg-bg); border-color: var(--deg-border); }
.hero.partial_outage { background: var(--part-bg); border-color: var(--part-border); }
.hero.major_outage   { background: var(--maj-bg); border-color: var(--maj-border); }
.hero-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--op);
  transition: background 0.3s;
}
.hero.degraded       .hero-icon { background: var(--deg); }
.hero.partial_outage .hero-icon { background: var(--part); }
.hero.major_outage   .hero-icon { background: var(--maj); }
.hero-icon svg { width: 20px; height: 20px; color: white; }
.hero-title { font-size: 20px; font-weight: 600; color: #0e4c2c; transition: color 0.3s; }
.hero.degraded       .hero-title { color: #7a5a0f; }
.hero.partial_outage .hero-title { color: #7a3d0f; }
.hero.major_outage   .hero-title { color: #7a1719; }
.hero-sub { font-size: 13px; color: #3a7355; margin-top: 2px; transition: color 0.3s; }
.hero.degraded       .hero-sub { color: #7a6a3f; }
.hero.partial_outage .hero-sub { color: #7a5540; }
.hero.major_outage   .hero-sub { color: #7a4a4c; }

.hero-body { flex: 1; }
.hero-services {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 10px;
}
.hero-services .svc-chip {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-weight: 500;
}
.hero-explain {
  margin-top: 10px; font-size: 13px; line-height: 1.5;
  padding: 8px 12px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text);
  border-left: 3px solid var(--op);
  transition: border-color 0.3s;
}
.hero.degraded       .hero-explain { border-left-color: var(--deg); }
.hero.partial_outage .hero-explain { border-left-color: var(--part); }
.hero.major_outage   .hero-explain { border-left-color: var(--maj); }
.hero.maintenance    .hero-explain { border-left-color: var(--maint); }

/* ── Sections ───────────────────────── */
.section { margin-bottom: 48px; }
.section-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 16px; letter-spacing: 0.01em;
}

/* ── Service rows + 90-day bars ───────────────────────── */
.service {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.service-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.service-name { font-size: 15px; font-weight: 600; }
.service-status {
  font-size: 13px; color: var(--op); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.service-status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.service-status.degraded       { color: var(--deg); }
.service-status.partial_outage { color: var(--part); }
.service-status.major_outage   { color: var(--maj); }
.service-status.maintenance    { color: var(--maint); }

.uptime-bars {
  display: flex; gap: 2px; height: 34px;
  margin-bottom: 10px;
}
.bar {
  flex: 1; min-width: 2px;
  background: var(--op);
  border-radius: 2px; cursor: pointer;
  transition: transform 0.1s;
}
.bar:hover { transform: scaleY(1.15); }
.bar.degraded       { background: var(--deg); }
.bar.partial_outage { background: var(--part); }
.bar.major_outage   { background: var(--maj); }
.bar.maintenance    { background: var(--maint); }
.bar.not_yet        { background: #d1d5db; opacity: 0.45; }
.uptime-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
}
.uptime-pct { font-weight: 600; color: var(--text); }

/* ── Incidents ───────────────────────── */
.incidents-group { margin-bottom: 28px; }
.incidents-date {
  font-size: 13px; font-weight: 600; color: var(--text);
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.incident {
  padding: 14px 0;
  border-bottom: 1px solid #f0ede5;
}
.incident:last-child { border-bottom: none; }
.incident-title {
  font-size: 14px; font-weight: 500; color: var(--text);
  margin-bottom: 6px;
}
.incident-meta {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.sev-tag {
  font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.sev-tag.resolved       { background: var(--op-bg);    color: var(--op); }
.sev-tag.degraded       { background: var(--deg-bg);   color: #8a6a0f; }
.sev-tag.partial_outage { background: var(--part-bg);  color: #8a3d0b; }
.sev-tag.major_outage   { background: var(--maj-bg);   color: #8a1719; }
.sev-tag.maintenance    { background: var(--maint-bg); color: #3a3cad; }
.svc-chip {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: #f0ede5; color: var(--text-muted);
}
.incident-updates {
  margin-top: 8px; padding-left: 14px;
  border-left: 2px solid var(--border);
}
.update-item {
  font-size: 12px; color: var(--text-muted);
  padding: 4px 0;
}
.update-status {
  font-weight: 600; text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.03em;
  margin-right: 6px;
}
.update-status.investigating { color: var(--part); }
.update-status.identified    { color: var(--deg); }
.update-status.monitoring    { color: var(--op); }
.update-status.resolved      { color: var(--op); }
.update-status.maintenance   { color: var(--maint); }

/* ── Footer + tooltip ───────────────────────── */
.footer {
  text-align: center; color: var(--text-dim);
  font-size: 12px; padding: 32px 0 16px;
  margin-top: 32px; border-top: 1px solid var(--border);
}
.tooltip {
  position: absolute;
  background: #1a1a1a; color: white;
  padding: 6px 10px; border-radius: 6px;
  font-size: 11px; pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  white-space: nowrap; z-index: 10;
}
.tooltip.visible { opacity: 1; }

.loading { color: var(--text-dim); font-style: italic; }
