:root{
  /* Light theme defaults; overridden by [data-theme="dark"] */
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#6b7280;
  --line:#e5e7eb;
  --accent:#2563eb;
  --shadow:0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);

  --op:#16a34a;       /* operational */
  --deg:#f59e0b;      /* degraded */
  --mnt:#3b82f6;      /* maintenance */
  --dwn:#ef4444;      /* down */
}

/* Dark theme (default) */
html[data-theme="dark"]{
  --bg:#0b1220;
  --card:#0f172a;
  --text:#e5e7eb;
  --muted:#9aa4b2;
  --line:#1f2937;
  --accent:#60a5fa;
  --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);

  --op:#22c55e;
  --deg:#fbbf24;
  --mnt:#60a5fa;
  --dwn:#f87171;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--text);
}
.container{max-width:1100px; margin:0 auto; padding:0 16px}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
.sr-only{position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0}
.skip-link{position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden}
.skip-link:focus{position:static; width:auto; height:auto; margin:8px; padding:8px 12px; background:#fff; box-shadow:var(--shadow); border-radius:8px}

.site-header{
  background:var(--card); border-bottom:1px solid var(--line);
  position:sticky; top:0; z-index:10;
}
.nav-container{display:flex; align-items:center; justify-content:space-between; height:64px}
.brand{display:flex; align-items:center; gap:10px}
.brand-mark{color:var(--op); font-size:22px}
.brand-name{font-weight:700; color:var(--text)}

.right-tools{display:flex; align-items:center; gap:8px}
.theme-toggle{
  background:transparent; border:1px solid var(--line); color:var(--text);
  padding:6px 10px; border-radius:999px; cursor:pointer;
}
.theme-toggle:hover{background:rgba(148,163,184,.12)}
.theme-toggle .icon-sun{display:none}
html[data-theme="light"] .theme-toggle .icon-sun{display:inline}
html[data-theme="light"] .theme-toggle .icon-moon{display:none}
html[data-theme="dark"] .theme-toggle .icon-moon{display:inline}
html[data-theme="dark"] .theme-toggle .icon-sun{display:none}

.top-nav ul{display:flex; gap:14px; list-style:none; margin:0; padding:0}
.top-nav a{display:block; padding:8px 10px; border-radius:8px; color:var(--text)}
.top-nav a.active, .top-nav a:hover{background:rgba(148,163,184,.12)}

.nav-toggle{display:none; background:none; border:1px solid var(--line); padding:8px; border-radius:8px}
.nav-toggle:hover{background:rgba(148,163,184,.12)}
.nav-toggle .bar{display:block; width:22px; height:2px; background:var(--text); margin:4px 0}

.hero{padding:22px 0 18px}
.hero-status{display:flex; align-items:center; gap:10px}
.hero-status h1{font-size:22px; margin:0}
.hero-indicator{width:10px; height:10px; border-radius:999px; box-shadow:0 0 0 4px rgba(22,163,74,.12)}
.hero-indicator[data-status="operational"]{background:var(--op)}
.hero-indicator[data-status="degraded"]{background:var(--deg)}
.hero-indicator[data-status="maintenance"]{background:var(--mnt)}
.hero-indicator[data-status="down"]{background:var(--dwn)}
.subhead{color:var(--muted); margin:8px 0 0}
.last-updated{cursor:pointer}
.last-updated:hover{color:var(--text); text-decoration:underline}

.subscribe{border-top:1px solid var(--line); background:var(--card)}
.subscribe-inner{padding:14px 0}
.subscribe-grid{display:grid; gap:10px; grid-template-columns:repeat(4,1fr)}
.sub-card{
  display:flex; align-items:center; gap:10px; padding:12px; background:var(--card);
  border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow);
}
.sub-card:hover{transform:translateY(-1px); transition:transform .15s ease}
.icon{width:36px; height:36px; display:grid; place-items:center; color:var(--accent); background:rgba(96,165,250,.12); border-radius:8px}
.sub-title{font-weight:600; color:var(--text)}
.sub-note{font-size:12px; color:var(--muted)}

.main{padding:18px 0 32px}
.toolbar{display:flex; align-items:center; justify-content:space-between; gap:10px; margin:8px 0 14px}
.filters{display:flex; gap:6px}
.chip{border:1px solid var(--line); background:var(--card); color:var(--text); padding:8px 12px; border-radius:999px; cursor:pointer}
.chip--active{background:#111827; border-color:#111827; color:#fff}
html[data-theme="dark"] .chip--active{background:#e5e7eb; color:#0f172a; border-color:#e5e7eb}

.components .grid{display:grid; gap:12px; grid-template-columns:repeat(3,1fr)}
.card{
  background:var(--card); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow);
  padding:14px; display:flex; flex-direction:column; gap:10px; position:relative; overflow:hidden;
}
.card:hover{box-shadow:0 2px 3px rgba(0,0,0,.12), 0 10px 28px rgba(0,0,0,.22)}
.card-header{display:flex; justify-content:space-between; align-items:center; gap:10px}
.name{font-weight:600}
.uptime{color:var(--muted); font-size:13px}
.meta{color:var(--muted); font-size:12px}

.status-badge{
  font-size:12px; font-weight:600; padding:6px 10px; border-radius:999px; display:inline-flex; align-items:center; gap:6px;
  color:#065f46; background:#ecfdf5; border:1px solid #bbf7d0;
  transition:background .25s ease, color .25s ease, border-color .25s ease;
}
.status-badge .dot{width:8px; height:8px; border-radius:999px; background:var(--op)}
.status-badge[data-status="operational"]{color:#065f46; background:#ecfdf5; border-color:#bbf7d0}
.status-badge[data-status="operational"] .dot{background:var(--op)}
.status-badge[data-status="degraded"]{color:#92400e; background:#fffbeb; border-color:#fde68a}
.status-badge[data-status="degraded"] .dot{background:var(--deg)}
.status-badge[data-status="maintenance"]{color:#1e3a8a; background:#eff6ff; border-color:#bfdbfe}
.status-badge[data-status="maintenance"] .dot{background:var(--mnt)}
.status-badge[data-status="down"]{color:#7f1d1d; background:#fef2f2; border-color:#fecaca}
.status-badge[data-status="down"] .dot{background:var(--dwn)}

html[data-theme="dark"] .status-badge[data-status="operational"]{color:#10b981;background:rgba(16,185,129,.12);border-color:rgba(16,185,129,.35)}
html[data-theme="dark"] .status-badge[data-status="degraded"]{color:#fbbf24;background:rgba(251,191,36,.12);border-color:rgba(251,191,36,.35)}
html[data-theme="dark"] .status-badge[data-status="maintenance"]{color:#93c5fd;background:rgba(147,197,253,.12);border-color:rgba(147,197,253,.35)}
html[data-theme="dark"] .status-badge[data-status="down"]{color:#f87171;background:rgba(248,113,113,.12);border-color:rgba(248,113,113,.35)}

.card details{
  border-top:1px dashed var(--line);
  padding-top:10px;
}
.card details summary{
  list-style:none; cursor:pointer; color:var(--accent); font-weight:500;
}
.card details summary::-webkit-details-marker{display:none}
.log{margin:8px 0 0; padding:0; list-style:none; display:flex; flex-direction:column; gap:8px}
.log li{display:flex; gap:10px}
.log .date{font-size:12px; color:var(--muted); width:140px; flex:0 0 140px}
.log .desc{font-size:14px; color:var(--text)}

.history{margin-top:20px}
.muted{color:var(--muted)}

.skeleton-grid{display:grid; gap:12px; grid-template-columns:repeat(3,1fr); margin:6px 0 0}
.skeleton-card{height:120px; background:#f3f4f6; border-radius:14px; position:relative; overflow:hidden}
html[data-theme="dark"] .skeleton-card{background:#111827}
.skeleton-card::after{
  content:""; position:absolute; inset:0; transform:translateX(-100%); background:linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  animation:shimmer 1.2s infinite;
}
@keyframes shimmer{100%{transform:translateX(100%)}}

/* Responsive */
@media (max-width: 960px){
  .components .grid{grid-template-columns:repeat(2,1fr)}
  .subscribe-grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width: 640px){
  .nav-toggle{display:block}
  .top-nav{position:absolute; top:64px; left:0; right:0; background:var(--card); border-bottom:1px solid var(--line); display:none}
  .top-nav.open{display:block}
  .top-nav ul{flex-direction:column; padding:8px}
  .components .grid{grid-template-columns:1fr}
  .log .date{width:100px; flex:0 0 100px}
}

/* Subtle fade for status change */
@keyframes fadeBadge{from{filter:saturate(.2); transform:translateY(-2px); opacity:.4} to{filter:saturate(1); transform:none; opacity:1}}
.status-badge.changed{animation:fadeBadge .35s ease}

.site-footer{border-top:1px solid var(--line); background:var(--card)}
.footer-inner{display:flex; align-items:center; justify-content:space-between; gap:10px; padding:16px 0}
.footer-inner a{color:var(--muted)}