:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efea;
  --line: #e4e2db;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7c7b75;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --critical: #d03b3b;
  --critical-ink: #a32525;
  --critical-tint: #fbeeec;
  --warning-tint: #fdf6e6;
  --unknown: #c9c7bf;
  --accent: #141413;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 2px rgb(20 20 19 / 4%), 0 4px 16px rgb(20 20 19 / 4%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #2e2e2b;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8f8e86;
    --good-ink: #5fd35f;
    --warning-ink: #fab219;
    --critical-ink: #ff8a80;
    --critical-tint: #2c1b1a;
    --warning-tint: #2a2416;
    --unknown: #4a4945;
    --accent: #fcfcfb;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
button { font: inherit; color: inherit; cursor: pointer; }
.link-btn { background: none; border: 0; padding: 4px 6px; color: var(--text-2); border-radius: var(--radius-sm); }
.link-btn:hover { color: var(--text); background: var(--surface-2); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.brand-lg { font-size: 22px; margin-bottom: 8px; }
.brand-mark { width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--good); }
.semi { color: var(--text-3); margin-right: 2px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--text-2); }
.login-card input { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; }
.login-card button { background: var(--accent); color: var(--surface); border: 0; border-radius: var(--radius-sm); padding: 11px; font-weight: 600; }
.invite-hello { margin: 0 0 4px; color: var(--text-2); }
.login-error { min-height: 1em; margin: 0; color: var(--critical-ink); font-size: 13px; }

/* layout */
.app { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 12px; }
.top-right { display: flex; align-items: center; gap: 12px; }
main { display: grid; gap: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* summary */
.summary { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-top: 6px; }
.summary p { margin: 2px 0 0; }
.summary-icon { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 20px; background: var(--unknown); }
.summary-icon.good { background: var(--good); }
.summary-icon.critical { background: var(--critical); }
.summary-icon.warning { background: var(--warning); color: #3a2a00; }

/* systems */
.systems { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.sys { min-width: 0; grid-template-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px;
  display: grid; gap: 10px; box-shadow: var(--shadow); }
.sys.down { border-color: color-mix(in srgb, var(--critical) 55%, var(--line)); background: var(--critical-tint); }
.sys-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sys-head > div { min-width: 0; }
.sys-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sys-host { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 3px 8px 3px 6px; border-radius: 999px; background: var(--surface-2); }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.status.up { color: var(--good-ink); } .status.up .dot { background: var(--good); }
.status.down { color: var(--critical-ink); } .status.down .dot { background: var(--critical); animation: pulse 1.6s ease-in-out infinite; }
.status.unknown { color: var(--text-2); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .status.down .dot { animation: none; } }
.bars { display: grid; grid-template-columns: repeat(48, minmax(0, 1fr)); gap: 2px; height: 26px; align-items: end; }
.bar { height: 100%; border-radius: 1px; background: var(--unknown); opacity: .55; }
.bar.ok { background: var(--good); opacity: 1; }
.bar.part { background: var(--warning); opacity: 1; }
.bar.bad { background: var(--critical); opacity: 1; }
.bar:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.sys-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 6px 12px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.chip:hover { color: var(--text); }
.chip[aria-selected="true"] { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.chip .n { font-size: 11px; opacity: .75; }
.chip .crit { font-size: 11px; font-weight: 700; color: #fff; background: var(--critical); border-radius: 999px; padding: 0 6px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.toggle input { accent-color: var(--critical); width: 16px; height: 16px; }

/* events */
.events { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ev { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 12px; padding: 14px 16px; border-top: 1px solid var(--line);
  cursor: pointer; position: relative; }
.ev:first-child { border-top: 0; }
.ev:hover { background: var(--surface-2); }
.ev.critical { background: var(--critical-tint); }
.ev.critical::before, .ev.warning::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--critical); }
.ev.warning::before { background: var(--warning); }
.sev { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800;
  color: #fff; margin-top: 1px; }
.sev.critical { background: var(--critical); }
.sev.warning { background: var(--warning); color: #3a2a00; }
.sev.good { background: var(--good); }
.sev.info { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.ev-title { font-weight: 550; overflow-wrap: anywhere; }
.ev-meta { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-2); }
.tag { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 6px; background: var(--surface); }
.sev-label { font-weight: 650; }
.sev-label.critical { color: var(--critical-ink); }
.sev-label.warning { color: var(--warning-ink); }
.sev-label.good { color: var(--good-ink); }
.ev-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.ev-body { grid-column: 2 / 4; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--text-2);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 6px; cursor: text;
  max-height: 360px; overflow: auto; }
.ev-body a { color: inherit; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-2); }
.more { margin: 12px auto 0; display: block; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; color: var(--text-2); }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--accent); color: var(--surface); font-size: 12px;
  padding: 6px 9px; border-radius: var(--radius-sm); white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); }

@media (max-width: 560px) {
  .app { padding: 0 14px 48px; }
  .top-right #updated { display: none; }
  .summary { padding: 18px; }
  h1 { font-size: 19px; }
  .ev { grid-template-columns: 24px 1fr; }
  .ev-time { grid-column: 2; grid-row: 3; }
  .ev-body { grid-column: 1 / 3; }
}

/* visitors (dashboard) */
:root { --series: #2a78d6; }
@media (prefers-color-scheme: dark) { :root { --series: #3987e5; } }
.visitors { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.vis { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  color: inherit; text-decoration: none; }
.vis:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
.vis-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vis-name { font-weight: 600; }
.vis-more { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.vis-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.vis-num { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.vis-unit { font-size: 13px; color: var(--text-2); }
.delta { font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.mini { display: flex; gap: 2px; height: 40px; align-items: flex-end; }
.mini span { flex: 1 1 0; min-width: 0; background: var(--series); border-radius: 2px 2px 0 0; min-height: 2px; }
.mini span.prev { opacity: .35; }
.vis-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.online { display: inline-flex; align-items: center; gap: 6px; }
.online::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.online.zero::before { background: var(--unknown); }
.newref { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.newref b { font-weight: 600; color: var(--text); }
.vis-error { font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 14px 16px; }

/* site page */
.site-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.back { font-size: 13px; color: var(--text-2); text-decoration: none; display: inline-block; margin-bottom: 6px; }
.back:hover { color: var(--text); }
.site-domain { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.range { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.range button { border: 0; background: none; padding: 7px 12px; font-size: 13px; color: var(--text-2); }
.range button + button { border-left: 1px solid var(--line); }
.range button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-label { font-size: 12px; color: var(--text-2); }
.tile-num { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 2px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 8px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font-size: 11px;
  color: var(--text-3); height: 200px; }
.chart-plot { position: relative; height: 200px; border-bottom: 1px solid var(--line);
  background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 50%; }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-bars .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.chart-bars .col span { width: 100%; background: var(--series); border-radius: 2px 2px 0 0; min-height: 1px; }
.chart-bars .col:hover span { filter: brightness(1.15); outline: 2px solid var(--text); outline-offset: 1px; }
.chart-x { grid-column: 2; display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 6px; }
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.list h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; }
.list h3 span { color: var(--text-3); font-weight: 500; }
.row { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; font-size: 13px; }
.row .share { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--series) 14%, transparent); border-radius: var(--radius-sm); }
.row .lbl { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .val { position: relative; font-weight: 600; }
.list .none { font-size: 13px; color: var(--text-3); padding: 5px 8px; }
#site-view { display: grid; gap: 20px; }

/* grouped system card (e.g. Kaziki: main domain + subdomains) */
.sys.group { grid-column: span 2; }
.sys.partial { border-color: color-mix(in srgb, var(--critical) 40%, var(--line)); }
.subs { display: grid; gap: 8px; }
.sub { display: grid; grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1.5fr) 64px; gap: 10px; align-items: center; }
.sub-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sub-name .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--unknown); }
.sub-name .dot.up { background: var(--good); }
.sub-name .dot.down { background: var(--critical); }
.sub-label { display: grid; min-width: 0; font-size: 13px; font-weight: 550; line-height: 1.25; }
.sub-label .sys-host { font-weight: 400; font-size: 11px; }
.bars-sm { height: 18px; }
.sub-ms { font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub.down .sub-ms { color: var(--critical-ink); }
@media (max-width: 560px) { .sys.group { grid-column: auto; } }

/* "Don't count my visits" */
.head-right { display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nocount { margin-bottom: 12px; font-size: 14px; }
.nocount p { margin: 0 0 10px; max-width: 70ch; }
.nocount code { font-size: 12px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 1px 4px; }
.nocount-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.nocount-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.nc-state { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff; }
.nc-state.done { background: var(--good); border-color: var(--good); }
.nc-name { display: grid; font-weight: 550; min-width: 0; }
.nc-name .sys-host { font-weight: 400; }
.nc-open { font-size: 13px; font-weight: 600; color: var(--surface); background: var(--accent); text-decoration: none;
  padding: 6px 12px; border-radius: var(--radius-sm); white-space: nowrap; }

/* incidents */
.incidents { display: grid; gap: 10px; }
.inc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); display: grid; gap: 8px; position: relative; overflow: hidden; }
.inc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--critical); }
.inc.needs_you::before { background: var(--warning); }
.inc.fixed::before, .inc.resolved::before { background: var(--good); }
.inc.resolved { box-shadow: none; }
.inc.flash { outline: 2px solid var(--text); outline-offset: 2px; }
.inc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.inc-title { font-weight: 600; flex: 1; min-width: 12ch; overflow-wrap: anywhere; }
.inc-state { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--critical-tint); color: var(--critical-ink); }
.inc-state.fixing, .inc-state.approved { background: var(--surface-2); color: var(--text); }
.inc-state.needs_you { background: var(--warning-tint); color: var(--warning-ink); }
.inc-state.fixed, .inc-state.resolved { background: var(--surface-2); color: var(--good-ink); }
.inc-note { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.inc-note a, .inc-proposal a { color: inherit; }
.inc-proposal { background: var(--warning-tint); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.inc-label { font-size: 12px; font-weight: 700; color: var(--warning-ink); margin-bottom: 4px; }
.inc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inc-session { margin-left: auto; font-family: ui-monospace, monospace; }
.inc-reply { display: grid; gap: 8px; }
.inc-reply textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; resize: vertical; }
.inc-none { margin: 0; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--surface); border-color: var(--accent); font-weight: 600; }
.recent { margin-top: 12px; }
.recent summary { cursor: pointer; margin-bottom: 10px; }
.medic-stale { color: var(--warning-ink); font-weight: 600; }
.alerts-help { display: grid; gap: 10px; }
.alerts-help p { margin: 0; }
.inc > * { grid-column: 1 / -1; }
.top-right .link-btn { white-space: nowrap; }
@media (max-width: 560px) { #updated { display: none; } }

/* incident flow: whose turn, steps, history */
.inc.turn-you { border-color: var(--warning); }
.inc.turn-claude::before { background: var(--text-3); }
.inc.turn-you::before { background: var(--warning); }
.inc-head .tag { margin-left: auto; }
.turn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.turn.you { background: var(--warning-tint); }
.turn.done, .turn.check { background: var(--surface-2); }
.turn-title { font-weight: 650; font-size: 14px; }
.turn.you .turn-title { color: var(--warning-ink); }
.turn.done .turn-title, .turn.check .turn-title { color: var(--good-ink); }
.turn-text { font-size: 13px; color: var(--text-2); }
.turn-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--text-3); }
.turn-dot.claude { background: var(--text); animation: pulse 1.6s ease-in-out infinite; }
.turn-dot.you { background: var(--warning); }
.turn-dot.check { background: var(--good); animation: pulse 1.6s ease-in-out infinite; }
.turn-dot.done { background: var(--good); }
.inc-flash { font-size: 13px; font-weight: 600; color: var(--good-ink); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.step { min-width: 0; padding-right: 4px; display: grid; justify-items: start; gap: 2px; position: relative; padding-top: 14px;
  font-size: 12px; color: var(--text-3); }
.step::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 2px; background: var(--line); }
.step.done::before, .step.now::before { background: var(--good); }
.step.now.you::before { background: var(--warning); }
.step.now.claude::before { background: var(--text); }
.step-dot { position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.step.done .step-dot { background: var(--good); }
.step.now .step-dot { background: var(--text); box-shadow: 0 0 0 3px var(--surface-2); }
.step.now.you .step-dot { background: var(--warning); }
.step.now.check .step-dot { background: var(--good); }
.step.done, .step.now { color: var(--text-2); }
.step.now .step-label { font-weight: 700; color: var(--text); }
.step-time { font-size: 11px; color: var(--text-3); }
.inc-note { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.inc-label { color: var(--text-2); }
.inc-proposal .inc-label { color: var(--warning-ink); }
.inc-history ol { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); display: grid; gap: 4px; }
.inc-history time { color: var(--text-3); font-size: 12px; }
.inc-history summary { cursor: pointer; }
.inc-session { margin-left: 0; font-size: 11px; }
.btn.quiet { border-color: transparent; background: none; color: var(--text-2); }
.btn:disabled { opacity: .6; cursor: default; }
.summary-icon.working { background: var(--text); color: var(--surface); }
@media (max-width: 560px) { .step { font-size: 11px; } .step-time { font-size: 10px; } }
