:root {
  color-scheme: light dark;
  --bg: #f6f5f1; --panel: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --line: #dedcd5; --accent: #2a78d6; --accent-ink: #fff;
  --good: #006b00; --warning: #8a5e00; --serious: #b8481a; --critical: #c42e2d;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --panel: #1a1a19; --ink: #f0efec; --ink2: #c3c2b7; --line: #33332f; --accent: #3987e5; --accent-ink: #0b0b0b;
    --good: #5cc45c; --warning: #e0ae3c; --serious: #ee8a5e; --critical: #f08080;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 60px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
h1 { font: 700 15px var(--mono); letter-spacing: .08em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 12px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
a { color: inherit; }
.muted { color: var(--ink2); font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top { position: sticky; top: 0; z-index: 2; display: flex; gap: 18px; align-items: center; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top nav { display: flex; gap: 14px; overflow-x: auto; }
.top nav a { text-decoration: none; color: var(--ink2); white-space: nowrap; padding: 4px 0; }
.top nav a:hover { color: var(--ink); }
#updated { margin-left: auto; white-space: nowrap; }
@media (max-width: 720px) { #updated { display: none; } .top { padding: 8px 12px; } }

main { max-width: 1320px; margin: 0 auto; padding: 0 20px 80px; }
@media (max-width: 720px) { main { padding: 0 12px 60px; } }
section { padding-top: 26px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
section > h2 { margin-bottom: 12px; }

.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .columns { grid-template-columns: 1fr; } }
.columns > div { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-width: 0; }

button, select, input { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 5px 8px; min-height: 32px; }
button { cursor: pointer; }
button:hover { border-color: var(--ink2); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.task { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 2px 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.tasks > .task:first-child, .group ul > .task:first-child { border-top: 0; }
.task input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 1px 0 0; accent-color: var(--accent); }
.task .title { overflow-wrap: anywhere; }
.task .sub { grid-column: 2; font-size: 12.5px; color: var(--ink2); overflow-wrap: anywhere; }
.task .acts { grid-column: 2; display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.task .acts button { min-height: 26px; padding: 1px 7px; font-size: 12px; color: var(--ink2); }
.tag { font-size: 12px; font-family: var(--mono); }
.over { color: var(--critical); font-weight: 600; }
.empty { color: var(--ink2); padding: 6px 0; font-size: 13px; }

.attention li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; }
.attention li:first-child { border-top: 0; }
.sev { font: 600 11px var(--mono); text-transform: uppercase; margin-right: 6px; }
.critical { color: var(--critical); } .serious { color: var(--serious); } .warning { color: var(--warning); } .good { color: var(--good); }

.add { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.add .grow { flex: 1 1 200px; display: flex; }
.add .grow input { width: 100%; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.tile .label { font-size: 12px; color: var(--ink2); }
.tile .value { font: 600 26px/1.2 var(--mono); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .hint { font-size: 12px; color: var(--ink2); }
#money-note { margin-top: 8px; }

:root { --s0: #2a78d6; --s1: #eb6834; --s2: #1baf7a; --s3: #eda100; --s4: #e87ba4; --grid: #ebe9e3; }
@media (prefers-color-scheme: dark) { :root { --s0: #3987e5; --s1: #d95926; --s2: #199e70; --s3: #c98500; --s4: #d55181; --grid: #2a2a27; } }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
@media (max-width: 860px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-width: 0; }
#uptime-grid .card { margin-top: 12px; }
figcaption { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; margin-bottom: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink2); margin-bottom: 6px; }
.legend > span { display: inline-flex; align-items: center; gap: 5px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 5px; }
.legend .key { margin-right: 0; }
.plot { position: relative; min-height: 170px; }
.chart { display: block; }
.s0 { --c: var(--s0); } .s1 { --c: var(--s1); } .s2 { --c: var(--s2); } .s3 { --c: var(--s3); } .s4 { --c: var(--s4); }
.chart .grid { stroke: var(--grid); }
.chart .base { stroke: var(--line); }
.chart .tick { fill: var(--ink2); font-size: 11px; font-family: var(--mono); }
.chart .bar { fill: var(--c); }
.chart .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dotmark { fill: var(--c); stroke: var(--panel); stroke-width: 2; }
.chart .cross { stroke: var(--ink2); stroke-dasharray: 2 3; }
.chart .refline { stroke: var(--ink2); stroke-dasharray: 5 4; }
.chart .reflabel { fill: var(--ink2); font-size: 11px; }
.chart .hit { fill: transparent; }
.tip { position: absolute; background: var(--ink); color: var(--bg); font-size: 12px; padding: 5px 8px; border-radius: 4px; pointer-events: none; white-space: nowrap; z-index: 1; }
.card details { margin-top: 4px; }
.card details .scroll { max-height: 220px; overflow-y: auto; margin-top: 6px; }
.scroll.bare { background: none; border: 0; border-radius: 0; }
.grid30 { width: auto; }
.grid30 th { position: sticky; left: 0; border: 0; padding: 1px 10px 1px 0; font-weight: 500; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.grid30 td { border: 0; padding: 1px; line-height: 0; }
.sq { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }
.sq.up { background: var(--good); }
.sq.dip { background: var(--s3); }
.sq.bad { background: var(--critical); }
.sq.none { background: var(--grid); }

.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.scroll { position: relative; overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { position: sticky; top: 0; text-align: right; font-weight: 600; font-size: 12px; color: var(--ink2); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
th button { all: unset; cursor: pointer; }
th button:focus-visible { outline: 2px solid var(--accent); }
td { padding: 7px 10px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
th.l, td.l { text-align: left; }
td.l { font-family: inherit; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
td.name { position: sticky; left: 0; background: var(--panel); font-weight: 550; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
td.none { color: var(--ink2); opacity: .55; }
tr.detail td { white-space: normal; text-align: left; font-family: inherit; background: var(--bg); }
.detail dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; max-width: 780px; }
.detail dt { color: var(--ink2); }
.detail dd { margin: 0; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; }
.spark { display: block; margin-left: auto; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num-cell { display: inline-flex; gap: 8px; align-items: center; }
td input { width: 90px; min-height: 26px; padding: 1px 6px; text-align: right; font: inherit; }
td button { min-height: 26px; padding: 1px 7px; font-size: 12px; font-family: inherit; }

.group { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
#actors { margin-top: 10px; }
details summary { cursor: pointer; color: var(--ink2); font-size: 13px; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px; display: flex; gap: 10px; align-items: center; z-index: 3; }
.toast[hidden] { display: none; }
.toast button { background: none; border: 1px solid currentColor; color: inherit; min-height: 26px; padding: 1px 8px; }

.login { max-width: 300px; margin: 18vh auto 0; display: grid; gap: 12px; padding: 0 16px; }
.login label { display: grid; gap: 4px; }
.login .bad { color: var(--critical); }
