:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #5d6677; --line: #dde1e8;
  --accent: #2f5bd3; --accent-text: #fff; --danger: #b42318; --ok-bg: #e7f5ec; --ok: #1d6b3a;
  --err-bg: #fdecea; --warn-bg: #fff6dd;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171d; --panel: #1c2029; --text: #e6e9ef; --muted: #9aa3b5; --line: #2e3442;
    --accent: #6d8ff0; --accent-text: #0d1220; --danger: #f97066; --ok-bg: #16301f; --ok: #6fd39a;
    --err-bg: #3a1714; --warn-bg: #3a3014; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
.top { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); letter-spacing: .02em; }
.workspaces { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; min-width: 0; }
.workspaces a { padding: .25rem .6rem; border-radius: 6px; text-decoration: none; color: var(--muted); }
.workspaces a[aria-current] { background: var(--bg); color: var(--text); font-weight: 600; }
.workspaces a.new { font-size: .9em; }
.me { display: flex; gap: 1rem; align-items: center; }
.me form { margin: 0; }
.banner { background: var(--warn-bg); padding: .5rem 1.5rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.banner form { margin: 0; }
main { max-width: 1050px; margin: 0 auto; padding: 1.5rem; }
section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem 1.4rem; margin-bottom: 1.2rem; }
section.narrow { max-width: 440px; margin: 3rem auto; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.titlebar { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.narrow-form { max-width: 420px; }
.row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .8rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .9em; }
.hint { font-weight: 400; color: var(--muted); }
input, select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { font: inherit; font-weight: 600; padding: .45rem 1rem; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-block; }
button.danger { background: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 400; }
button.link.danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }
table { width: 100%; border-collapse: collapse; margin-bottom: .8rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.compact td { padding: .3rem .5rem; font-size: .92em; }
td.ua { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { color: var(--muted); font-size: .9em; }
.tag { font-size: .75em; padding: .05rem .4rem; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.notice { background: var(--ok-bg); color: var(--ok); padding: .6rem .9rem; border-radius: 8px; }
.error { background: var(--err-bg); color: var(--danger); padding: .6rem .9rem; border-radius: 8px; }
.secret { background: var(--warn-bg); border-radius: 8px; padding: .8rem 1rem; margin: .8rem 0; }
.secret input { width: 100%; font-family: ui-monospace, monospace; }
.codes { columns: 2; font-family: ui-monospace, monospace; font-size: 1.05em; }
.qr img { display: block; margin: 0 auto; background: #fff; padding: 8px; border-radius: 8px; image-rendering: pixelated; }
code.key { word-break: break-all; }
.empty { text-align: center; padding: 3rem 1.5rem; }
.empty p { max-width: 540px; margin: .5rem auto; }
.actions { display: flex; gap: .8rem; align-items: center; }
.state { display: inline-block; font-size: .78em; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .1rem .45rem; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.state.up { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.state.down { background: var(--danger); color: #fff; border-color: transparent; }
.state.unknown { background: var(--warn-bg); color: var(--text); border-color: transparent; }
.summary { display: flex; gap: .5rem; }
section.flush { padding: 0; overflow-x: auto; }
section.flush table { margin: 0; }
table.checks td.why { max-width: 360px; }
tr.stale td { opacity: .6; }
section.wide { max-width: 760px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem 1rem .2rem; margin: 0; }
legend { font-weight: 600; font-size: .9em; padding: 0 .3rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
button.secondary { background: var(--panel); color: var(--accent); }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .lat { fill: none; stroke: var(--accent); stroke-width: 1.5; }
svg.chart .axis { stroke: var(--line); }
svg.chart .fail { stroke: var(--danger); stroke-width: 2; }
textarea { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .7rem .9rem; overflow-x: auto; font-size: .88em; }
.stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .6rem 0 1rem; }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: 1.4rem; }
/* public status pages */
main.public { max-width: 820px; }
.banner-status { padding: .9rem 1.1rem; border-radius: 10px; font-weight: 700; font-size: 1.1rem; background: var(--ok-bg); color: var(--ok); }
.banner-status.degraded, .banner-status.maintenance { background: var(--warn-bg); color: var(--text); }
.banner-status.outage { background: var(--danger); color: #fff; }
section.maint { border-left: 4px solid #3b82f6; }
section.incident { border-left: 4px solid var(--danger); }
section.incident.minor { border-left-color: #d97706; }
.component { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.component:last-child { border-bottom: none; }
.component-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .4rem; }
.cstatus { font-size: .85em; font-weight: 600; color: var(--ok); }
.cstatus.outage { color: var(--danger); }
.cstatus.maintenance { color: #3b82f6; }
.cstatus.no_data, .cstatus.paused { color: var(--muted); }
.bars { display: flex; gap: 2px; height: 30px; }
.bar { flex: 1; border-radius: 2px; background: var(--line); }
.bar.good { background: #22c55e; }
.bar.fair { background: #84cc16; }
.bar.poor { background: #f59e0b; }
.bar.bad { background: #ef4444; }
.bars-legend { display: flex; justify-content: space-between; margin: .2rem 0 0; }
.footer { text-align: center; margin-top: 1.5rem; }
input.short { width: 5rem; }
.incident-admin { border-bottom: 1px solid var(--line); padding-bottom: .6rem; margin-bottom: .6rem; }

/* Metrics chart (server-drawn SVG). Series colours follow the theme. */
.mchart { width: 100%; height: auto; display: block; }
.mchart .grid { stroke: var(--line); stroke-width: 1; }
.mchart .axis { fill: var(--muted); font-size: 12px; }
.mchart .line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.legend td { padding: .15rem .5rem; }
.swatch { display: inline-block; width: .9rem; height: .25rem; border-radius: 2px; vertical-align: middle; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
:root { --s0: #2f5bd3; --s1: #d9480f; --s2: #2b8a3e; --s3: #ae3ec9; --s4: #e8590c; --s5: #0c8599; --s6: #c2255c; --s7: #5c940d; --s8: #6741d9; --s9: #868e96; }
@media (prefers-color-scheme: dark) {
  :root { --s0: #6d8ff0; --s1: #ff8a5b; --s2: #69db7c; --s3: #da77f2; --s4: #ffa94d; --s5: #3bc9db; --s6: #f783ac; --s7: #a9e34b; --s8: #9775fa; --s9: #ced4da; }
}
.line.s0 { stroke: var(--s0); } .dot.s0 { fill: var(--s0); } .swatch.s0 { background: var(--s0); }
.line.s1 { stroke: var(--s1); } .dot.s1 { fill: var(--s1); } .swatch.s1 { background: var(--s1); }
.line.s2 { stroke: var(--s2); } .dot.s2 { fill: var(--s2); } .swatch.s2 { background: var(--s2); }
.line.s3 { stroke: var(--s3); } .dot.s3 { fill: var(--s3); } .swatch.s3 { background: var(--s3); }
.line.s4 { stroke: var(--s4); } .dot.s4 { fill: var(--s4); } .swatch.s4 { background: var(--s4); }
.line.s5 { stroke: var(--s5); } .dot.s5 { fill: var(--s5); } .swatch.s5 { background: var(--s5); }
.line.s6 { stroke: var(--s6); } .dot.s6 { fill: var(--s6); } .swatch.s6 { background: var(--s6); }
.line.s7 { stroke: var(--s7); } .dot.s7 { fill: var(--s7); } .swatch.s7 { background: var(--s7); }
.line.s8 { stroke: var(--s8); } .dot.s8 { fill: var(--s8); } .swatch.s8 { background: var(--s8); }
.line.s9 { stroke: var(--s9); } .dot.s9 { fill: var(--s9); } .swatch.s9 { background: var(--s9); }
