/* ── Design tokens ────────────────────────────────────────────── */
:root {
  --bg-primary:    #0a0a0b;
  --bg-surface:    #111113;
  --bg-elevated:   #18181c;
  --bg-hover:      #1e1e23;
  --border:        #26262c;
  --border-subtle: #1c1c21;
  --text-primary:  #f0f0f2;
  --text-secondary:#8b8b9a;
  --text-muted:    #55556a;
  --accent-green:  #22c55e;
  --accent-yellow: #eab308;
  --accent-red:    #ef4444;
  --accent-blue:   #3b82f6;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     16px;
  --font:          'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.5);
  --shadow-md:     0 4px 16px rgba(0,0,0,.6);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.7);
}

[data-theme="light"] {
  --bg-primary:    #f6f6f8;
  --bg-surface:    #ffffff;
  --bg-elevated:   #ededf2;
  --bg-hover:      #e8e8ef;
  --border:        #dddde6;
  --border-subtle: #e8e8ef;
  --text-primary:  #0d0d0f;
  --text-secondary:#5a5a6e;
  --text-muted:    #9898aa;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07);
  --shadow-md:     0 4px 16px rgba(0,0,0,.09);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.11);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .2s, color .2s;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img.emoji { display: inline !important; height: 1.1em !important; width: 1.1em !important;
  vertical-align: -.15em !important; margin: 0 .05em 0 .1em !important; }

/* ── Layout ───────────────────────────────────────────────────── */
.page { max-width: 880px; margin: 0 auto; padding: 0 16px 80px; }

/* ── Header ───────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 50;
  height: 54px;
  background: rgba(10,10,11,.85);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 8px;
  transition: background .2s, border-color .2s;
}
[data-theme="light"] .header { background: rgba(246,246,248,.88); }

.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 13.5px; letter-spacing: -.025em;
  white-space: nowrap; flex-shrink: 0;
}
.logo img { width: 26px; height: 26px; border-radius: var(--radius-sm); flex-shrink: 0; }

.header-nav { display: flex; align-items: center; gap: 1px; margin-left: 12px; }
.nav-link {
  padding: 5px 11px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: background .12s, color .12s; white-space: nowrap;
}
.nav-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-link--active { background: var(--bg-elevated); color: var(--text-primary); font-weight: 600; }

.header-spacer { flex: 1; }
.header-right { display: flex; align-items: center; gap: 6px; }

.pulse-indicator {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-green); flex-shrink: 0;
  transition: background .3s;
}
.pulse-indicator[data-state="ok"]      { background: var(--accent-green); animation: pulse-dot 2.4s ease-in-out infinite; }
.pulse-indicator[data-state="loading"] { background: var(--accent-yellow); animation: pulse-dot 1s ease-in-out infinite; }
.pulse-indicator[data-state="error"]   { background: var(--accent-red); animation: none; }

.icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
.mobile-menu-btn { display: none; }

/* ── Mobile nav ───────────────────────────────────────────────── */
.mnav-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
}
.mnav-overlay.open { display: block; }
.mnav-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.mnav-panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 10px; gap: 2px;
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.mnav-overlay.open .mnav-panel { transform: translateX(0); }
.mnav-logo {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 16px;
  font-weight: 700; font-size: 14px; letter-spacing: -.02em;
  border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.mnav-logo img { width: 26px; height: 26px; border-radius: var(--radius-sm); }
.mnav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: background .12s, color .12s;
}
.mnav-link:hover { background: var(--bg-elevated); color: var(--text-primary); }
.mnav-link--active { background: var(--bg-elevated); color: var(--text-primary); font-weight: 600; }

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  padding: 64px 20px 48px;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, var(--bg-elevated) 0%, var(--bg-primary) 70%);
  margin-bottom: 4px;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.03) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}
[data-theme="light"] .hero::before {
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,.04) 1px, transparent 0);
}
.hero-inner { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 22px; border-radius: 100px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 17px; font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transition: border-color .3s;
  margin-bottom: 14px;
}
.hero-badge.status--ok   { border-color: rgba(34,197,94,.35); }
.hero-badge.status--warn { border-color: rgba(234,179,8,.35); }
.hero-badge.status--down { border-color: rgba(239,68,68,.35); }

.hero-badge-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.status--ok   .hero-badge-dot { background: var(--accent-green); animation: pulse-ring-green 2s ease infinite; }
.status--warn .hero-badge-dot { background: var(--accent-yellow); }
.status--down .hero-badge-dot { background: var(--accent-red); animation: pulse-ring-red 1.5s ease infinite; }

.hero-timer {
  font-size: 13px; color: var(--text-muted); letter-spacing: .01em;
}

/* ── Metrics grid ─────────────────────────────────────────────── */
.metrics {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 16px;
}
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.metric-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 6px;
}
.metric-value {
  font-size: 24px; font-weight: 700;
  letter-spacing: -.04em; line-height: 1;
  color: var(--text-primary); margin-bottom: 4px;
}
.metric-value.green  { color: var(--accent-green); }
.metric-value.yellow { color: var(--accent-yellow); }
.metric-value.red    { color: var(--accent-red); }
.metric-sub { font-size: 11px; color: var(--text-muted); }

/* ── Alert strips ─────────────────────────────────────────────── */
.alert-strip {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-md);
  border: 1px solid transparent; margin-bottom: 10px;
}
.alert-strip--critical   { background: rgba(239,68,68,.08);  border-color: rgba(239,68,68,.25); }
.alert-strip--major      { background: rgba(234,179,8,.08);  border-color: rgba(234,179,8,.25); }
.alert-strip--minor      { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); }
.alert-strip--maintenance{ background: rgba(59,130,246,.07); border-color: rgba(59,130,246,.2); }

.alert-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px;
  background: var(--accent-red);
}
.alert-dot--blue { background: var(--accent-blue); }
.alert-strip--major .alert-dot { background: var(--accent-yellow); }
.alert-strip--minor .alert-dot { background: var(--accent-blue); }

.alert-body { flex: 1; min-width: 0; }
.alert-title {
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.alert-meta { font-size: 11.5px; color: var(--text-secondary); margin-top: 3px; }

/* ── Filter bar ───────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.search-wrap { flex: 1; position: relative; max-width: 280px; }
.search-wrap svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; }
.search-input {
  width: 100%; height: 34px; padding: 0 10px 0 30px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border-color .12s;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent-blue); }

.filter-pills { display: flex; gap: 5px; }
.fpill {
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-secondary);
  font-family: inherit; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.fpill:hover { background: var(--bg-elevated); color: var(--text-primary); }
.fpill--active { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }
.fpill-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── Monitor groups ───────────────────────────────────────────── */
.monitor-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.group-title {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted);
}
.group-count {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}
.group-count .arrow-up   { color: var(--accent-green); }
.group-count .arrow-down { color: var(--accent-red); }
.group-range {
  font-size: 10.5px; color: var(--text-muted); font-weight: 400;
}
.monitor-list { display: flex; flex-direction: column; }

/* ── Monitor rows ─────────────────────────────────────────────── */
.monitor-row {
  padding: 10px 18px 9px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background .12s;
}
.monitor-row:last-child { border-bottom: none; }
.monitor-row:hover { background: var(--bg-hover); }

.monitor-row-top {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 7px;
}
.monitor-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.dot--ok      { background: var(--accent-green); box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.dot--down    { background: var(--accent-red);   box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.dot--degraded{ background: var(--accent-yellow);}
.dot--unknown { background: var(--text-muted); }

.monitor-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.info-btn {
  display: inline-flex; align-items: center;
  color: var(--text-muted); flex-shrink: 0;
  cursor: help; position: relative;
}
.info-btn:hover { color: var(--text-secondary); }

.monitor-row-right {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.uptime-pct {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  min-width: 42px; text-align: right;
}
.latency-val { font-size: 11px; color: var(--text-muted); min-width: 44px; text-align: right; }

/* ── Status pills ─────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  white-space: nowrap;
}
.pill--ok, .pill--resolved   { background: rgba(34,197,94,.14);  color: #22c55e; }
.pill--down, .pill--investigating { background: rgba(239,68,68,.14); color: #ef4444; }
.pill--degraded, .pill--identified{ background: rgba(234,179,8,.14); color: #eab308; }
.pill--monitoring             { background: rgba(59,130,246,.14); color: #3b82f6; }
.pill--unknown                { background: var(--bg-elevated); color: var(--text-secondary); }

/* ── SSL chips ────────────────────────────────────────────────── */
.ssl-chip {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 100px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
}
.ssl-chip--bad     { background: rgba(239,68,68,.14); color: var(--accent-red); }
.ssl-chip--warn    { background: rgba(239,68,68,.14); color: var(--accent-red); }
.ssl-chip--caution { background: rgba(234,179,8,.14); color: var(--accent-yellow); }

/* ── Uptime bars ──────────────────────────────────────────────── */
.monitor-row-bars { }
.bar-strip {
  display: flex; gap: 2px; align-items: stretch; height: 28px;
  margin-bottom: 3px;
}
.bar-day {
  width: 3px; flex-shrink: 0; border-radius: 2px;
  background: var(--accent-green);
  cursor: default;
  transition: transform .1s, opacity .1s;
}
.bar-day:hover { transform: scaleY(1.25); transform-origin: bottom; }
.bar-day[data-status="down"]    { background: var(--accent-red); }
.bar-day[data-status="degraded"]{ background: var(--accent-yellow); }
.bar-day[data-status="unknown"] { background: var(--border); }

.bar-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
}

/* ── Bar tooltip ──────────────────────────────────────────────── */
.bartip {
  position: fixed; display: none; z-index: 9999; pointer-events: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 12px; min-width: 120px;
  font-family: var(--font);
}
.bartip-date { font-size: 10.5px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.bartip-row  { display: flex; align-items: center; gap: 6px; }
.bartip-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.bartip-dot--ok   { background: var(--accent-green); }
.bartip-dot--warn { background: var(--accent-yellow); }
.bartip-dot--down { background: var(--accent-red); }
.bartip-label { font-size: 12px; font-weight: 600; }
.bartip-label--ok   { color: var(--accent-green); }
.bartip-label--warn { color: var(--accent-yellow); }
.bartip-label--down { color: var(--accent-red); }
.bartip-unknown { font-size: 11px; color: var(--text-muted); }

/* ── Section heading ──────────────────────────────────────────── */
.section-heading {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted); margin: 28px 0 12px;
}

/* ── Incidents ────────────────────────────────────────────────── */
.inc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.inc-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; cursor: pointer;
  transition: background .12s;
}
.inc-header:hover { background: var(--bg-elevated); }

.inc-status-line { flex-shrink: 0; padding-top: 4px; }
.inc-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-muted);
}
.inc-dot--active { background: var(--accent-red); animation: pulse-ring-red 2s ease infinite; }

.inc-body { flex: 1; min-width: 0; }
.inc-title {
  font-size: 13.5px; font-weight: 600; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 3px;
}
.inc-meta { font-size: 11px; color: var(--text-secondary); }

.inc-chevron {
  color: var(--text-muted); flex-shrink: 0;
  margin-top: 2px; transition: transform .18s;
}
.inc-card--open .inc-chevron { transform: rotate(90deg); }

.inc-timeline {
  display: none;
  padding: 6px 16px 14px 44px;
  border-top: 1px solid var(--border-subtle);
}
.inc-card--open .inc-timeline { display: block; }

.tl-item {
  display: flex; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0; margin-top: 6px;
}
.tl-dot--resolved      { background: var(--accent-green); }
.tl-dot--monitoring    { background: var(--accent-blue); }
.tl-dot--identified    { background: var(--accent-yellow); }
.tl-dot--investigating { background: var(--accent-red); }
.tl-time {
  font-size: 10.5px; color: var(--text-secondary);
  white-space: nowrap; width: 110px; flex-shrink: 0; padding-top: 1px;
}
.tl-msg { font-size: 12px; color: var(--text-primary); line-height: 1.55; }

.inc-empty { padding: 8px 0; font-size: 12px; color: var(--text-secondary); }
.inc-empty-state {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  background: rgba(34,197,94,.06);
  border: 1px solid rgba(34,197,94,.18);
  border-radius: var(--radius-md);
  font-size: 13px; color: var(--accent-green);
}
.incidents-note { font-size: 11px; color: var(--text-muted); margin-top: 8px; text-align: center; }

/* ── Skeleton ─────────────────────────────────────────────────── */
.skel {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.6s ease-in-out infinite;
  display: block;
}
.skel-row {
  padding: 11px 18px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 8px;
}
.skel-row:last-child { border-bottom: none; }
.skel-line { height: 11px; }

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-secondary); font-size: 13px;
}
.empty-state svg { display: block; margin: 0 auto 12px; opacity: .3; }

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border-subtle);
  padding: 16px 20px;
  text-align: center;
  font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  gap: 0; flex-wrap: wrap;
}
.footer-sep { margin: 0 8px; opacity: .4; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}
@keyframes pulse-ring-green {
  0%  { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100%{ box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes pulse-ring-red {
  0%  { box-shadow: 0 0 0 0 rgba(239,68,68,.5); }
  70% { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
  100%{ box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

/* Staggered reveal */
.reveal { opacity: 0; transform: translateY(10px); }
.reveal.revealed {
  animation: fadeInUp .4s ease calc(var(--delay, 0ms)) both;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 680px) {
  .header-nav    { display: none; }
  .mobile-menu-btn { display: inline-flex; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-value  { font-size: 20px; }
  .filter-bar    { flex-wrap: wrap; }
  .search-wrap   { max-width: 100%; order: -1; flex: 0 0 100%; }
  .filter-pills  { overflow-x: auto; }
  .hero          { padding: 44px 16px 34px; }
  .hero-badge    { font-size: 15px; padding: 9px 18px; }
  .page          { padding: 0 12px 64px; }
  .monitor-row   { padding: 9px 14px 8px; }
  .group-header  { padding: 10px 14px; }
  .inc-header    { padding: 11px 14px; }
  .inc-timeline  { padding: 6px 14px 12px 38px; }
}
@media (max-width: 400px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .monitor-row-right { gap: 6px; }
  .uptime-pct  { min-width: 36px; }
  .latency-val { display: none; }
}
