:root {
  --bg: #f6f7f5; --panel: #fff; --ink: #1b1f1c; --muted: #646b66; --faint: #8b918d; --line: #e3e6e2; --soft: #eef1ed;
  --accent: #1d7348; --accent-ink: #fff; --accent-soft: #e3f1e8;
  --blue: #2563a8; --blue-soft: #e6eef8; --amber: #a2620a; --amber-soft: #fbf0dc; --red: #b4362b; --red-soft: #f9e5e2;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 1px 1px rgb(0 0 0 / .03);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121513; --panel: #1a1e1b; --ink: #e7eae7; --muted: #a2a9a4; --faint: #7d847f; --line: #2c322e; --soft: #222824;
    --accent: #3fae73; --accent-ink: #08130c; --accent-soft: #1c3527;
    --blue: #7fb0ea; --blue-soft: #1c2a3b; --amber: #e0a54a; --amber-soft: #3a2c15; --red: #ef8a7f; --red-soft: #3d1f1c;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 0 0 .4rem; }
p { margin: 0 0 .6rem; }
small, .muted { color: var(--muted); }
.faint { color: var(--faint); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); padding: .05rem .3rem; border-radius: 4px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--panel); border-bottom: 1px solid var(--line); }
.top .in { max-width: 76rem; margin: 0 auto; padding: 0 1.25rem; display: flex; align-items: center; gap: 1.5rem; height: 3.4rem; }
.brand { font-weight: 650; color: var(--ink); display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 1.45rem; height: 1.45rem; border-radius: 6px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-size: .8rem; }
.nav { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); padding: .4rem .7rem; border-radius: 7px; white-space: nowrap; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--soft); text-decoration: none; }
.nav a.on { color: var(--ink); background: var(--soft); }
.top .right { margin-left: auto; display: flex; align-items: center; gap: .9rem; white-space: nowrap; }
.switch { display: inline-flex; align-items: center; gap: .45rem; padding: .28rem .7rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted); }
.switch::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--faint); }
.switch.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.switch.on::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.switch:hover { text-decoration: none; }
.who { color: var(--muted); font-size: .85rem; }
.linkbtn { border: 0; background: none; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; padding: 0; }
.linkbtn:hover { color: var(--ink); }

main { max-width: 76rem; margin: 0 auto; padding: 1.6rem 1.25rem 4rem; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.head .grow { flex: 1 1 20rem; }
.lead { color: var(--muted); max-width: 46rem; }

/* blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.stack > * + * { margin-top: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.card .card-head { display: flex; align-items: baseline; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line); }
.card .card-head h2 { margin: 0; }
.card .card-head .more { margin-left: auto; font-size: .88rem; }
.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.main-side { grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
@media (max-width: 900px) { .cols-2, .main-side { grid-template-columns: minmax(0, 1fr); } }

.banner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.25rem;
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.banner .text { flex: 1 1 24rem; }
.banner b { display: block; font-size: 1rem; }
.banner.off { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.banner.off b { color: var(--amber); }
.banner.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.banner.on b { color: var(--accent); }
.banner.bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.banner.bad b { color: var(--red); }
.flash { background: var(--blue-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); border-radius: var(--radius);
  padding: .65rem 1rem; margin-bottom: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--ink); box-shadow: var(--shadow); }
a.tile:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.tile .n { font-size: 1.6rem; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: .88rem; }

/* buttons and forms */
.btn { display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .9rem; font-weight: 550; padding: .42rem .85rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { font-size: .82rem; padding: .25rem .6rem; border-radius: 7px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=email], input[type=search], input[type=number], select, textarea {
  font: inherit; font-size: .92rem; padding: .42rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
label { font-size: .88rem; color: var(--muted); }
.field { display: grid; gap: .25rem; }
.form { display: grid; gap: .8rem; max-width: 34rem; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.form select, .form input[type=text], .form input[type=email], .form input[type=number] { width: 100%; }
.inline { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin: 0; }
.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--ink); font-size: .92rem; }

/* pop-over menu built on <details> */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--soft); }
details.menu .pop { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .14); padding: .75rem; width: 17rem; display: grid; gap: .55rem; }
details.menu .pop.left { right: auto; left: 0; }

/* tabs and toolbar */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: .55rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-size: .78rem; background: var(--soft); color: var(--muted); padding: .05rem .45rem; border-radius: 999px; margin-left: .3rem; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar input[type=search] { width: 18rem; max-width: 100%; }
.toolbar .spacer { flex: 1; }
.bulk { display: none; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .8rem; background: var(--blue-soft); border-radius: 8px; }
.bulk.show { display: inline-flex; }

/* tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; padding: .55rem .75rem;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--soft) 55%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.tight, th.tight { width: 1%; white-space: nowrap; }
.t-title { font-weight: 600; color: var(--ink); }
.t-sub { color: var(--muted); font-size: .84rem; }
tr.group td { background: var(--soft); font-weight: 600; font-size: .84rem; padding: .4rem .75rem; }
tbody tr.group:hover td { background: var(--soft); }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* status pills */
.pill { display: inline-block; font-size: .76rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--accent-soft); color: var(--accent); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.lang { font-size: .72rem; font-weight: 700; letter-spacing: .04em; padding: .08rem .38rem; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }

/* people ladder and timeline */
.ladder { display: grid; gap: 0; }
.rung { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: .9rem; padding: .85rem 1.1rem; border-top: 1px solid var(--line); align-items: start; }
.rung:first-child { border-top: 0; }
.rung .step { font-size: .78rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-top: .15rem; }
.rung .name { font-weight: 600; }
.rung .meta { color: var(--muted); font-size: .86rem; overflow-wrap: anywhere; }
.rung .state { text-align: right; display: grid; gap: .35rem; justify-items: end; font-size: .86rem; }
.rung.off .name, .rung.off .meta { opacity: .55; }
.rung.off .name { text-decoration: line-through; }
@media (max-width: 640px) { .rung { grid-template-columns: minmax(0, 1fr); } .rung .state { justify-items: start; text-align: left; } }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; font-size: .9rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .75rem; padding: .55rem 1.1rem; border-top: 1px solid var(--line); font-size: .9rem; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); gap: .6rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks .icon { font-weight: 700; text-align: center; }
.checks .ok .icon { color: var(--accent); }
.checks .no .icon { color: var(--red); }
.checks .warn .icon { color: var(--amber); }
.checks .detail { color: var(--muted); font-size: .86rem; }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .75rem 1.1rem; border-top: 1px solid var(--line); font-size: .88rem; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: .8rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; margin: .4rem 0 0; color: var(--muted); }
.login { max-width: 25rem; margin: 9vh auto 0; }
.login .card { padding: 1.5rem; }
