:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1b2330;
  --muted: #5d6878;
  --border: #e2e6ec;
  --ok: #1f9d55;
  --ok-soft: #e6f5ec;
  --minor: #c98a00;
  --minor-soft: #fdf3dc;
  --major: #dd6b20;
  --major-soft: #fdeadb;
  --critical: #d64545;
  --critical-soft: #fbe5e5;
  --maint: #3b6fd8;
  --maint-soft: #e5edfb;
  --nodata: #d5dae1;
  --stale: #5d6878;
  --stale-soft: #eceff3;
  --link: #2459c6;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151b;
    --surface: #181d25;
    --text: #e6eaf0;
    --muted: #98a2b1;
    --border: #2a313c;
    --ok: #3cc479;
    --ok-soft: #15291f;
    --minor: #e0a826;
    --minor-soft: #2e2611;
    --major: #f08a45;
    --major-soft: #321f12;
    --critical: #f06a6a;
    --critical-soft: #341819;
    --maint: #6d98ee;
    --maint-soft: #18233a;
    --nodata: #333b47;
    --stale: #98a2b1;
    --stale-soft: #222831;
    --link: #7fa7f5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 600; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--border); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #2c7be5, #1f9d55); }
.brand-sub { font-weight: 400; color: var(--muted); }
.top-links { display: flex; gap: 16px; font-size: 14px; }

main { padding-top: 28px; }

/* Overall banner */
.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 6px solid var(--c, var(--nodata));
}
.banner h1 { font-size: 21px; font-weight: 650; }
.banner-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.banner-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--nodata)); box-shadow: 0 0 0 5px var(--soft, transparent); }
.banner.s-none { --c: var(--ok); --soft: var(--ok-soft); }
.banner.s-minor { --c: var(--minor); --soft: var(--minor-soft); }
.banner.s-major { --c: var(--major); --soft: var(--major-soft); }
.banner.s-critical { --c: var(--critical); --soft: var(--critical-soft); }
.banner.s-maintenance { --c: var(--maint); --soft: var(--maint-soft); }
.banner.s-stale { --c: var(--stale); --soft: var(--stale-soft); }

.stale {
  margin-top: 12px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--stale-soft); color: var(--text); border: 1px solid var(--border); font-size: 14px;
}

.block { margin-top: 28px; }
.block > h2, .block-head { margin-bottom: 12px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-head .muted { font-size: 13px; }

/* Incidents */
.incident {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; border-left: 4px solid var(--c, var(--border));
}
.incident.i-none { --c: var(--muted); }
.incident.i-minor { --c: var(--minor); }
.incident.i-major { --c: var(--major); }
.incident.i-critical { --c: var(--critical); }
.incident.i-maintenance { --c: var(--maint); }
.incident h3 { font-size: 16px; font-weight: 600; }
.incident-meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.updates { list-style: none; margin: 12px 0 0; padding: 0; }
.updates li { padding: 8px 0 0 14px; border-left: 2px solid var(--border); margin-left: 3px; }
.updates li + li { margin-top: 2px; }
.update-status { font-weight: 600; text-transform: capitalize; }
.update-time { color: var(--muted); font-size: 13px; }
.update-body { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
       padding: 1px 7px; border-radius: 999px; background: var(--stale-soft); color: var(--muted); margin-left: 6px; vertical-align: 2px; }

/* Components */
.components { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.component { padding: 16px 18px; }
.component + .component { border-top: 1px solid var(--border); }
.component-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.component-name { font-weight: 600; }
.component-desc { color: var(--muted); font-size: 13px; margin-top: 1px; }
.pill { flex: none; font-size: 13px; font-weight: 600; color: var(--c); display: inline-flex; align-items: center; gap: 6px; }
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.st-operational { --c: var(--ok); }
.st-degraded_performance { --c: var(--minor); }
.st-partial_outage { --c: var(--major); }
.st-major_outage { --c: var(--critical); }
.st-under_maintenance { --c: var(--maint); }
.st-unknown { --c: var(--stale); }

.bars { display: flex; gap: 2px; height: 30px; margin-top: 12px; }
.bar { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--b, var(--nodata)); }
.bar:hover { opacity: .7; }
.bar.b-ok { --b: var(--ok); }
.bar.b-degraded_performance { --b: var(--minor); }
.bar.b-partial_outage { --b: var(--major); }
.bar.b-major_outage { --b: var(--critical); }
.bars-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* Checks */
.checks { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.checks summary { cursor: pointer; font-weight: 600; }
.checks-list { list-style: none; margin: 12px 0 8px; padding: 0; }
.checks-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.checks-list .pill { font-weight: 500; }

/* Past incidents */
.day { padding: 12px 0; border-bottom: 1px solid var(--border); }
.day h3 { font-size: 14px; font-weight: 600; }
.day .none { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.day .incident { margin: 8px 0 0; }

.foot { color: var(--muted); font-size: 13px; padding-top: 32px; padding-bottom: 40px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none; max-width: 240px;
  background: var(--text); color: var(--bg); font-size: 12px; padding: 6px 9px; border-radius: 6px;
}

@media (max-width: 560px) {
  .top-links a:first-child { display: none; }
  .banner { padding: 16px; }
  .banner h1 { font-size: 18px; }
  .bars { gap: 1px; }
  .component-row { align-items: flex-start; }
}
