:root {
  --brand: #4f46e5;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #e3e7ec;
  --ok: #2fb167;
  --minor: #e9b404;
  --partial: #f0801b;
  --major: #e5484d;
  --maint: #3b82f6;
  --nodata: #d5dae0;
  --tooltip-bg: #1f2933;
  --tooltip-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --text: #e6e9ed; --muted: #97a1ad; --border: #2a3039;
    --nodata: #39404a; --tooltip-bg: #e6e9ed; --tooltip-text: #11151a; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --text: #e6e9ed; --muted: #97a1ad; --border: #2a3039;
  --nodata: #39404a; --tooltip-bg: #e6e9ed; --tooltip-text: #11151a; --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
.wrap { max-width: 880px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; }
.brand { font-weight: 700; font-size: 22px; color: var(--text); text-decoration: none; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.brand img { height: 32px; display: block; }
.brand small { font-weight: 500; color: var(--muted); font-size: 15px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px;
  background: var(--brand); color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }

main { padding-top: 32px; }

/* overall banner */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-radius: 8px;
  color: #fff; font-size: 20px; font-weight: 600; background: var(--ok); margin-bottom: 28px;
}
.banner svg { flex: none; }
.banner--loading { background: var(--nodata); color: var(--text); font-weight: 500; font-size: 16px; }
.banner--degraded_performance { background: var(--minor); }
.banner--partial_outage { background: var(--partial); }
.banner--major_outage { background: var(--major); }
.banner--under_maintenance { background: var(--maint); }
.banner .updated { margin-left: auto; font-size: 13px; font-weight: 400; opacity: .9; }

/* incident cards */
.incident {
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--minor);
  border-radius: 8px; margin-bottom: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.incident--none { border-left-color: var(--muted); }
.incident--major { border-left-color: var(--partial); }
.incident--critical { border-left-color: var(--major); }
.incident--maintenance { border-left-color: var(--maint); }
.incident h2 { margin: 0; padding: 14px 18px; font-size: 17px; border-bottom: 1px solid var(--border); }
.incident .meta { color: var(--muted); font-size: 13px; padding: 10px 18px 0; }
.updates { list-style: none; margin: 0; padding: 4px 18px 8px; }
.updates li { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 120px 1fr; gap: 12px; }
.updates li:last-child { border-bottom: 0; }
.updates .st { font-weight: 700; text-transform: capitalize; }
.updates .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.updates time { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 560px) { .updates li { grid-template-columns: 1fr; gap: 2px; } }

/* components */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head .hint { color: var(--muted); font-size: 13px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 36px; }
.group + .group { border-top: 1px solid var(--border); }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 16px 18px; background: none; border: 0;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.group-head .name { font-weight: 600; flex: 1; min-width: 0; }
.group-head .chev { transition: transform .15s; color: var(--muted); flex: none; }
.group.collapsed .chev { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group-body { padding: 0 18px 4px 18px; }
.component { padding: 14px 0 16px 26px; border-top: 1px dashed var(--border); }
.comp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.comp-row .name { flex: 1; min-width: 0; font-weight: 500; }
.info { color: var(--muted); cursor: help; font-size: 13px; line-height: 1; background: none; padding: 0; font-family: inherit; border: 1px solid var(--border); border-radius: 50%; width: 18px; height: 18px; display: inline-grid; place-items: center; margin-left: 6px; vertical-align: middle; }
.info:hover, .info:focus-visible, .info.active { color: var(--text); border-color: var(--muted); }
@media (max-width: 560px) { .component { padding-left: 0; } }

.status-text { font-size: 14px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.status-text .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.s-operational { color: var(--ok); }
.s-degraded_performance { color: var(--minor); } .s-degraded_performance .dot { background: var(--minor); }
.s-partial_outage { color: var(--partial); } .s-partial_outage .dot { background: var(--partial); }
.s-major_outage { color: var(--major); } .s-major_outage .dot { background: var(--major); }
.s-under_maintenance { color: var(--maint); } .s-under_maintenance .dot { background: var(--maint); }

/* uptime bars */
.bars { display: flex; gap: 2px; height: 34px; }
.bar { flex: 1; min-width: 2px; border-radius: 2px; background: var(--ok); cursor: pointer; }
.bar:hover, .bar.active { opacity: .7; }
.l-minor { background: var(--minor); }
.l-partial { background: var(--partial); }
.l-major { background: var(--major); }
.l-maint { background: var(--maint); }
.l-nodata { background: var(--nodata); }
.bar-legend { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.bar-legend .line { flex: 1; height: 1px; background: var(--border); }
.bar-legend .d30, .bar-legend .d60 { display: none; }
@media (max-width: 760px) {
  .bars .bar:nth-child(-n+30) { display: none; }
  .bar-legend .d90 { display: none; } .bar-legend .d60 { display: inline; }
}
@media (max-width: 520px) {
  .bars .bar:nth-child(-n+60) { display: none; }
  .bar-legend .d60 { display: none; } .bar-legend .d30 { display: inline; }
}

.tooltip {
  position: absolute; z-index: 10; max-width: 260px; padding: 10px 12px; border-radius: 6px; font-size: 13px;
  background: var(--tooltip-bg); color: var(--tooltip-text); box-shadow: 0 6px 20px rgba(0,0,0,.18); pointer-events: none;
}
.tooltip strong { display: block; margin-bottom: 4px; }
.tooltip ul { margin: 6px 0 0; padding-left: 16px; }

/* history */
.day { padding: 16px 0; border-bottom: 1px solid var(--border); }
.day:last-child { border-bottom: 0; }
.day h3 { margin: 0 0 6px; font-size: 15px; }
.day .empty { color: var(--muted); margin: 0; font-size: 14px; }
.hist-item { margin: 8px 0 0; }
.hist-item a { font-weight: 600; text-decoration: none; }
.hist-item .i-minor { color: var(--minor); } .hist-item .i-major { color: var(--partial); }
.hist-item .i-critical { color: var(--major); } .hist-item .i-maintenance { color: var(--maint); }
.hist-item .i-none { color: var(--text); }
.hist-item p { margin: 2px 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hist-item small { color: var(--muted); }
.hist-item p strong { text-transform: capitalize; }
.hist-item details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.panel.pad { padding: 0 18px; }

.site-footer { color: var(--muted); font-size: 13px; padding-bottom: 40px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--muted); }
.error { padding: 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--major); margin-bottom: 20px; }

/* subscribe */
.subscribe { position: relative; }
.btn { border: 0; cursor: pointer; font-family: inherit; }
.sub-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 320px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
}
.sub-panel label { display: block; font-size: 14px; margin-bottom: 10px; }
.sub-panel input[type=email] {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; margin-bottom: 10px;
}
.sub-panel .btn { width: 100%; justify-content: center; }
.sub-msg { font-size: 13px; margin: 10px 0 0; }
.sub-msg:empty { display: none; }
.sub-msg.ok { color: var(--ok); } .sub-msg.err { color: var(--major); }
.sub-alt { display: block; font-size: 13px; margin-top: 12px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.notice { margin-top: 20px; padding: 12px 16px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--ok); font-size: 14px; }
.notice.err { border-left-color: var(--major); }
