:root {
  --paper: #f2f1ec;
  --ink: #0b0b0a;
  --bg: var(--ink);
  --fg: var(--paper);
  --mute: #8c8b85;
  --faint: #4d4c48;
  --line: #262624;
  --hover: #151514;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --nav: 236px;
  --pad: 32px;
}

:root[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --mute: #6b6a65;
  --faint: #a8a7a1;
  --line: #d5d4ce;
  --hover: #e8e7e1;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: var(--paper);
    --fg: var(--ink);
    --mute: #6b6a65;
    --faint: #a8a7a1;
    --line: #d5d4ce;
    --hover: #e8e7e1;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--fg); color: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 1px dashed var(--fg); outline-offset: 3px; }
h1, h2, h3 { font-weight: 400; }

.mono { font-family: var(--mono); font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.faint { color: var(--mute); }
.label {
  font: 500 10.5px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--mute);
}
.hint { color: var(--mute); font-size: 12px; }

/* shell */

.shell { display: grid; grid-template-columns: var(--nav) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.brand { padding: 22px var(--pad) 20px; border-bottom: 1px solid var(--line); }
.brand-mark { display: flex; align-items: center; gap: 10px; font: 700 13px/1 var(--sans); letter-spacing: 0.24em; text-transform: uppercase; }
.logo-mark { flex-shrink: 0; display: block; }
.login-brand { display: inline-flex; align-items: center; gap: 10px; }
.login-brand .logo-mark { color: var(--fg); }
.brand-sub { margin-top: 10px; }

.nav-list { list-style: none; padding: 16px 0; }
.nav-link {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: 0 8px;
  align-items: baseline;
  padding: 8px var(--pad);
  color: var(--mute);
  font-size: 14px;
}
.nav-link:hover { color: var(--fg); }
.nav-link[aria-current="page"] { color: var(--fg); box-shadow: inset 2px 0 0 var(--fg); }
.nav-index, .nav-count { font: 11px/1 var(--mono); }
.nav-count:not(:empty) { padding: 3px 5px; background: var(--fg); color: var(--bg); }
.nav-keys { display: inline-flex; gap: 3px; }
kbd, .nav-keys kbd {
  display: inline-block;
  min-width: 17px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  font: 10px/1.2 var(--mono);
  text-align: center;
  color: var(--mute);
}
.nav-link:hover .nav-keys kbd, .nav-link[aria-current="page"] .nav-keys kbd { color: var(--fg); }
.nav.keys-armed .nav-link .nav-keys kbd:first-child { opacity: 0.35; }
.nav.keys-armed .nav-link .nav-keys .nav-key { color: var(--bg); background: var(--fg); border-color: var(--fg); }

.nav-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 20px var(--pad) 24px; display: grid; gap: 16px; }
.status-row { display: grid; gap: 7px; }
.status-line { display: flex; justify-content: space-between; align-items: baseline; font: 11px/1 var(--mono); }
.nav-actions { display: flex; gap: 14px; }
.kbd-hint { font: 10.5px/1.7 var(--mono); color: var(--faint); letter-spacing: 0.02em; }
.kbd-hint kbd { min-width: 0; padding: 0 4px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.crumb { font: 11px/1 var(--mono); letter-spacing: 0.09em; text-transform: uppercase; color: var(--mute); }
.topbar-end { display: flex; align-items: center; gap: 16px; margin-left: 12px; }
.alerts-prompt { padding: 6px 10px; }
.alerts-prompt[hidden] { display: none; }
@media (max-width: 640px) { .alerts-prompt .wide-only { display: none; } .alerts-prompt { padding: 5px 8px; } }
.status-line .link { font: inherit; }
.status-line .link:disabled { cursor: default; text-decoration: none; color: var(--faint); }
.crumb b { color: var(--fg); font-weight: 500; }
.content { padding: 40px var(--pad) 96px; max-width: 1480px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-title { font: 400 46px/0.95 var(--sans); letter-spacing: -0.035em; }
.page-title sup { font: 11px/1 var(--mono); letter-spacing: 0.08em; vertical-align: top; margin-left: 10px; color: var(--mute); }
.page-aside { display: flex; align-items: center; gap: 14px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 48px 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--fg); }
.section-title:first-child { margin-top: 0; }

/* controls */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--fg);
  background: transparent;
  font: 500 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.solid:hover { background: transparent; color: var(--fg); }
.btn.ghost { border-color: var(--line); }
.btn.ghost:hover { border-color: var(--fg); background: transparent; color: var(--fg); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.link {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--faint);
  padding: 0 0 1px;
  font: 500 10.5px/1.3 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
}
.link:hover { border-bottom-color: var(--fg); }
.link.danger { border-bottom-style: dashed; }

.seg { display: inline-flex; border: 1px solid var(--line); justify-self: start; }
.seg button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  background: none;
  font: 500 10.5px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.field { display: grid; gap: 6px; }
.input, .select, .textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 0;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--fg); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input.mono { font-size: 12px; }
.select { -webkit-appearance: none; appearance: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after { content: "↓"; position: absolute; right: 0; top: 8px; font: 11px var(--mono); color: var(--mute); pointer-events: none; }
.select option { background: var(--bg); color: var(--fg); }
.textarea { border: 1px solid var(--line); padding: 12px; min-height: 160px; resize: vertical; font: 12px/1.55 var(--mono); }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.check input {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  flex: none;
  border: 1px solid var(--fg);
  cursor: pointer;
}
.check input:checked { background: var(--fg); box-shadow: inset 0 0 0 2px var(--bg); }

.choices { display: grid; border-top: 1px solid var(--line); }
.choice {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.choice input { -webkit-appearance: none; appearance: none; width: 11px; height: 11px; margin-top: 4px; border: 1px solid var(--fg); border-radius: 50%; }
.choice input:checked { background: var(--fg); box-shadow: inset 0 0 0 2px var(--bg); }
.choice-title { font-weight: 500; }
.choice-text { color: var(--mute); font-size: 12px; }

.form { display: grid; gap: 22px; align-content: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.form-actions { display: flex; align-items: center; gap: 16px; padding-top: 6px; }
.form-error { font: 12px/1.5 var(--mono); border-left: 2px solid var(--fg); padding-left: 10px; }
.form-error:empty { display: none; }

/* layout blocks */

.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(360px, 1fr); gap: 40px; align-items: start; }
.side { position: sticky; top: 84px; }

.panel { position: relative; border: 1px solid var(--line); padding: 26px; }
.panel::before, .panel::after { content: ""; position: absolute; width: 8px; height: 8px; border: 0 solid var(--fg); }
.panel::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.panel::after { right: -1px; bottom: -1px; border-right-width: 1px; border-bottom-width: 1px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 22px; }
.panel-title { font-size: 22px; letter-spacing: -0.02em; line-height: 1.1; }
.panel + .panel { margin-top: 24px; }
.panel h3 { margin: 30px 0 12px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 18px; }
.toolbar-grow { flex: 1; min-width: 180px; }

.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); border-top: 1px solid var(--line); }
.kv > dt, .kv > dd { padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv > dt { font: 500 10.5px/1.6 var(--mono); text-transform: uppercase; letter-spacing: 0.09em; color: var(--mute); }
.kv > dd { font: 12px/1.6 var(--mono); word-break: break-word; overflow-wrap: anywhere; display: flex; justify-content: space-between; gap: 14px; }

.code {
  position: relative;
  font: 12px/1.6 var(--mono);
  background: var(--hover);
  padding: 14px 64px 14px 16px;
  white-space: pre-wrap;
  word-break: break-all;
  border-left: 2px solid var(--fg);
}
.code-copy { position: absolute; top: 10px; right: 12px; }
.token { font: 13px/1.5 var(--mono); padding: 14px 16px; border: 1px solid var(--fg); word-break: break-all; }
.notice { border-left: 2px solid var(--fg); padding: 2px 0 2px 12px; font-size: 12px; }

/* tables */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font: 500 10.5px/1.2 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--mute);
  padding: 0 14px 10px 0;
  border-bottom: 1px solid var(--fg);
  white-space: nowrap;
}
.table td { padding: 13px 14px 13px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.mono, .table td .mono { font-size: 12px; }
.table tr.row { cursor: pointer; }
.table tr.row:hover > td { background: var(--hover); }
.table tr.row[aria-selected="true"] > td { box-shadow: inset 0 -1px 0 var(--fg); }
.table tr.row[aria-selected="true"] > td:first-child { box-shadow: inset 2px -1px 0 var(--fg); padding-left: 10px; }
.table .right { text-align: right; }
.nowrap { white-space: nowrap; }
.cell-sub { display: block; color: var(--mute); font: 11px/1.5 var(--mono); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.table-scroll > .table { min-width: 560px; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.expand > td { padding: 0 0 26px; }

/* stats */

.stats { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr; border-top: 1px solid var(--fg); }
.stat { padding: 16px 22px 24px; border-right: 1px solid var(--line); min-width: 0; }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat-value { margin-top: 18px; font: 300 60px/0.9 var(--sans); letter-spacing: -0.045em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 0.42em; letter-spacing: 0; margin-left: 4px; color: var(--mute); }
.stat.hero .stat-value { font-size: 128px; }
.stat-note { margin-top: 12px; color: var(--mute); font-size: 12px; max-width: 30ch; }
.stats.minor { border-top-color: var(--line); }
.stats.minor .stat-value { font-size: 34px; margin-top: 12px; }

.ticks { display: flex; gap: 3px; height: 16px; }
.ticks i { flex: 1; background: var(--line); }
.ticks i.on { background: var(--fg); }
.ticks.small { height: 8px; gap: 2px; }

.bars { display: grid; gap: 0; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 60px; align-items: center; gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.bar { height: 6px; background: var(--line); }
.bar > i { display: block; height: 100%; background: var(--fg); }

/* feed */

.feed { border-top: 1px solid var(--fg); }
.feed-meta { display: flex; justify-content: space-between; margin-bottom: 10px; }
.item {
  display: grid;
  grid-template-columns: 20px 78px 112px minmax(0, 1fr) 150px;
  gap: 20px;
  padding: 16px 0 16px 16px;
  border-bottom: 1px solid var(--line);
  align-items: start;
  box-shadow: inset 3px 0 0 var(--lvl, var(--line));
}
.item.acked { color: var(--mute); box-shadow: inset 3px 0 0 var(--line); }
.item.acked .item-title { font-weight: 400; }
.item.acked .lvl-glyph, .item.acked .lvl { opacity: 0.5; }
.item.fresh { animation: fresh 2s ease-out; }
@keyframes fresh { 0% { background: var(--hover); } 100% { background: transparent; } }
@keyframes fresh-tint { 0% { background: color-mix(in srgb, var(--lvl, var(--fg)) 30%, transparent); } 100% { background: transparent; } }
@supports (color: color-mix(in srgb, red 50%, transparent)) {
  .item.acked { box-shadow: inset 3px 0 0 color-mix(in srgb, var(--lvl, var(--line)) 28%, transparent); }
  .item.fresh { animation-name: fresh-tint; }
}
.item time { font: 12px/1.45 var(--mono); }
.item-title { font-weight: 600; margin-bottom: 3px; }
.item-body { white-space: pre-wrap; word-break: break-word; }
.clamped .link.more { display: block; margin-top: 8px; }
.item-side { text-align: right; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font: 10.5px/1 var(--mono); padding: 3px 5px; border: 1px solid var(--line); color: var(--mute); }

.status { font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.status.dead { background: var(--fg); color: var(--bg); padding: 3px 5px; }
.status.active::after { content: "_"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.live { display: inline-flex; align-items: center; gap: 8px; }
.live-dot { width: 7px; height: 7px; border: 1px solid var(--fg); }
.live[data-state="live"] .live-dot { background: var(--fg); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.legend { display: grid; gap: 0; border-top: 1px solid var(--line); }
.legend-row { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }

.empty { padding: 56px 0; border-top: 1px solid var(--fg); }
.empty-title { font: 300 40px/1 var(--sans); letter-spacing: -0.03em; margin-bottom: 14px; }
.empty-line { color: var(--mute); max-width: 56ch; }
.empty-line + .empty-line { margin-top: 6px; }
.loading { padding: 24px 0; }
.loading::after { content: "…"; }
.error-block { border: 1px solid var(--fg); padding: 14px 16px; }

details > summary { display: inline-block; cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  max-width: calc(100vw - 32px);
  z-index: 50;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  font: 500 11px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: opacity 0.18s, transform 0.18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* levels & styles */

.lvl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 7px 4px 6px;
  border: 1px solid var(--lvl, var(--line));
  background: var(--lvl, transparent);
  color: var(--lvl-ink, var(--fg));
  font: 500 10px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lvl .icon { flex: none; }
.lvl-glyph { display: inline-flex; padding-top: 1px; color: var(--fg); }
.icon { display: block; }
.inline-code { font: 0.92em var(--mono); padding: 1px 4px; background: var(--hover); border: 1px solid var(--line); }
.md-link { border-bottom: 1px solid currentColor; }
.item-body > :first-child { margin-top: 0; }
.md-p, .md-h, .md-quote, .md-list, .md-pre, .md-rule { margin: 0.45em 0; white-space: normal; }
.md-h { font-weight: 600; }
.md-h1 { font-size: 1.2em; }
.md-h2 { font-size: 1.08em; }
.md-quote { padding: 2px 0 2px 12px; border-left: 3px solid var(--line); color: var(--mute); }
.md-list { padding-left: 1.4em; }
.md-list .md-list { margin: 0.15em 0; }
.md-list li + li { margin-top: 0.15em; }
.md-pre { padding: 10px 12px; background: var(--hover); border: 1px solid var(--line); overflow-x: auto; }
.md-pre code { font: 12px/1.55 var(--mono); white-space: pre; }
.md-rule { border: 0; border-top: 1px solid var(--line); }
s { text-decoration-thickness: 1px; }
.plain-list { list-style: none; display: grid; gap: 4px; }
.plain-list li::before { content: "— "; color: var(--mute); }
.style-summary { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; display: inline-block; border: 1px solid var(--line); }
.test-result { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-top: 6px; }
.textarea.short { min-height: 90px; font: 13px/1.5 var(--sans); }

.tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 1px solid var(--line); margin: -8px 0 32px; }
.tabs a { padding: 10px 16px 12px 0; margin-right: 20px; color: var(--mute); font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--fg); }
.section-lead { max-width: 70ch; margin-bottom: 24px; }
.form.narrow { max-width: 560px; }

.level-head, .level-grid {
  display: grid;
  grid-template-columns: 130px 90px minmax(120px, 1fr) 150px 44px 130px 80px;
  gap: 16px;
  align-items: center;
}
.level-head { padding-bottom: 10px; border-bottom: 1px solid var(--fg); }
.level-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.level-color { display: flex; align-items: center; gap: 10px; }
.swatch-input { -webkit-appearance: none; appearance: none; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; }
.swatch-input::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch-input::-webkit-color-swatch { border: 0; }
.swatch-input::-moz-color-swatch { border: 0; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 4px; margin-top: 12px; padding: 10px; border: 1px solid var(--line); }
.icon-grid.static { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); margin-top: 8px; }
.icon-cell { display: grid; place-items: center; gap: 4px; min-height: 40px; padding: 6px; border: 1px solid transparent; background: none; color: var(--fg); cursor: pointer; }
.icon-cell small { font: 9.5px var(--mono); color: var(--mute); }
.icon-cell:hover, .icon-cell[aria-pressed="true"] { border-color: var(--fg); }
.icon-grid.static .icon-cell { cursor: default; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); }
.swatch::before { content: ""; width: 18px; height: 18px; background: var(--sw); }
.swatch-x { border: 0; background: none; color: var(--mute); cursor: pointer; font-size: 14px; line-height: 1; }
.swatch-x:hover { color: var(--fg); }
.swatch-add { display: inline-flex; align-items: center; gap: 8px; }
.level-filter .seg { flex-wrap: wrap; }
.preview { cursor: default; }

.who { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.who:hover span:first-child { text-decoration: underline; }
.login-step { margin-bottom: 4px; }

/* login */

.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 28px var(--pad) 40px; }
.login-top { display: flex; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.login-mark { align-self: center; white-space: nowrap; font: 700 clamp(56px, 13.5vw, 220px)/0.9 var(--sans); letter-spacing: -0.025em; margin-left: -0.04em; }
.mark-outline, .mark-split { color: transparent; -webkit-text-stroke: 1.5px var(--fg); }
.mark-split {
  background: linear-gradient(90deg, var(--fg) 50%, transparent 50%);
  -webkit-background-clip: text;
  background-clip: text;
}
.login-grid { display: grid; grid-template-columns: 1fr minmax(320px, 560px); gap: 48px; align-items: end; padding-top: 24px; border-top: 1px solid var(--fg); }
.login-copy { max-width: 44ch; color: var(--mute); font-size: 15px; line-height: 1.45; }
.login-form { display: grid; gap: 14px; }
.login-row { display: flex; gap: 14px; align-items: end; }
.login-row .input { font: 14px var(--mono); }
.login-error { min-height: 18px; }

/* responsive */

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2n) { border-right: 0; }
  .stat:nth-child(odd) { padding-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat.hero .stat-value { font-size: 96px; }
}

@media (max-width: 760px) {
  :root { --pad: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: static; height: auto; min-width: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-list { display: flex; overflow-x: auto; padding: 0; }
  .nav-link { grid-template-columns: auto auto; gap: 6px; padding: 12px var(--pad); white-space: nowrap; }
  .nav-link .nav-index, .nav-keys { display: none; }
  .nav-link[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--fg); }
  .nav-foot { display: none; }
  .brand { display: flex; justify-content: space-between; align-items: center; padding: 16px var(--pad); }
  .brand-sub { margin: 0; }
  .page-title { font-size: 34px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .item { grid-template-columns: 20px 1fr auto; gap: 12px; padding-left: 12px; }
  .item time { grid-column: 2; }
  .item .lvl { grid-column: 3; grid-row: 1; }
  .item-main { grid-column: 2 / 4; }
  .item-side { grid-column: 2 / 4; text-align: left; }
  .form-row { grid-template-columns: 1fr; }
  .login-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
  .kv > dt { border-bottom: 0; padding-bottom: 0; }
}

/* narrow screens */

@media (max-width: 1200px) {
  .level-head { display: none; }
  .level-grid {
    grid-template-columns: 130px minmax(0, 1fr) 170px 44px;
    grid-template-areas: "tag label color icon" "key rank rank action";
    row-gap: 10px;
  }
  .level-grid > :nth-child(1) { grid-area: tag; }
  .level-grid > :nth-child(2) { grid-area: key; }
  .level-grid > :nth-child(3) { grid-area: label; }
  .level-grid > :nth-child(4) { grid-area: color; }
  .level-grid > :nth-child(5) { grid-area: icon; justify-self: end; }
  .level-grid > :nth-child(6) { grid-area: rank; max-width: 220px; }
  .level-grid > :nth-child(7) { grid-area: action; justify-self: end; }
}

@media (max-width: 760px) {
  .level-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "tag icon" "label label" "color key" "rank action";
  }
  .level-grid > :nth-child(1) { justify-self: start; }
  .level-grid > :nth-child(2) { justify-self: end; }
  .level-grid > :nth-child(6) { max-width: none; }
}

@media (pointer: coarse) {
  .input, .select, .textarea, .login-row .input, .input.mono { font-size: 16px; }
  .btn { min-height: 44px; }
  .seg button { min-height: 40px; }
  .link, .nav-link, .tabs a, .icon-cell { position: relative; }
  .link::after { content: ""; position: absolute; inset: -12px -8px; }
  .check, .choice { min-height: 36px; }
  .kbd-hint, .nav-keys { display: none; }
  .table tr.row:hover > td { background: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.unsupported { padding: 32px var(--pad); font: 14px/1.5 var(--sans); }

/* delivery, roles, danger */

.tab-actions { display: flex; justify-content: flex-end; margin: -12px 0 20px; }
.route-now { padding: 4px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.route-name { font: 300 34px/1.1 var(--sans); letter-spacing: -0.02em; margin-top: 10px; }
.route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 40px; }
.route-card .hint + .hint { margin-top: 8px; }
.route-card.active, .queue-card.active { border-color: var(--fg); }
.queue-card + .queue-card { margin-top: 20px; }
.steps { display: grid; gap: 14px; padding-left: 20px; max-width: 80ch; }
.steps li { padding-left: 6px; }
.steps .code { margin-top: 8px; }
.perm-table td, .perm-table th { padding-right: 10px; }
.center { text-align: center; }
.table .center { text-align: center; }
.btn.danger { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.btn.danger:hover { background: transparent; color: var(--fg); }
.danger-zone { border-style: dashed; }

@media (max-width: 1100px) {
  .route-grid { grid-template-columns: minmax(0, 1fr); }
}
.route-grid > .panel + .panel { margin-top: 0; }

/* charts: one color per connector (s1-s8, s0 for "other"), stepped separately for dark and light */

:root {
  --s0: #8c8b85;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #0ca30c; --s7: #9085e9; --s8: #e66767;
  --q1: #104281; --q2: #1c5cab; --q3: #2a78d6; --q4: #5598e7; --q5: #9ec5f4;
  --viz-grid: #1f1f1d;
  --viz-base: #3a3a37;
}
:root[data-theme="light"] {
  --s0: #a8a7a1;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --q1: #cde2fb; --q2: #9ec5f4; --q3: #5598e7; --q4: #2a78d6; --q5: #184f95;
  --viz-grid: #e1e0d9;
  --viz-base: #b9b8b1;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --s0: #a8a7a1;
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
    --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
    --q1: #cde2fb; --q2: #9ec5f4; --q3: #5598e7; --q4: #2a78d6; --q5: #184f95;
    --viz-grid: #e1e0d9;
    --viz-base: #b9b8b1;
  }
}

.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; background: var(--sw, var(--s0)); }
.s0 { --sw: var(--s0); } .s1 { --sw: var(--s1); } .s2 { --sw: var(--s2); } .s3 { --sw: var(--s3); } .s4 { --sw: var(--s4); }
.s5 { --sw: var(--s5); } .s6 { --sw: var(--s6); } .s7 { --sw: var(--s7); } .s8 { --sw: var(--s8); }

.chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font: 12px/1.3 var(--mono); }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-button { border: 0; background: none; padding: 2px 0; cursor: pointer; max-width: 100%; text-align: left; }
.chip-button:hover .chip > span { text-decoration: underline; text-underline-offset: 3px; }
a .chip:hover > span { text-decoration: underline; text-underline-offset: 3px; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px 22px; margin: -12px 0 32px; }
.filter { display: grid; gap: 4px; min-width: 150px; }
.filter .select { padding: 6px 18px 6px 0; font-size: 12px; }
.filter .select-wrap::after { top: 6px; }
.filters > .link { margin-bottom: 8px; }
.filter-pill { display: inline-flex; align-items: center; gap: 10px; height: 30px; padding: 0 4px 0 10px; border: 1px solid var(--fg); }
.pill-x { border: 0; background: none; width: 24px; height: 24px; cursor: pointer; font: 14px/1 var(--mono); color: var(--mute); }
.pill-x:hover { color: var(--fg); }
.refreshing { opacity: 0.55; transition: opacity 0.15s; }

.block { margin-top: 56px; }
.overview .stats + .block { margin-top: 48px; }
.viz-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 16px; list-style: none; font-size: 12px; }
.viz-legend li { display: inline-flex; align-items: center; gap: 7px; }

.viz { position: relative; }
.viz-plot { width: 100%; min-height: 248px; }
.viz-svg { display: block; overflow: visible; }
.viz-svg:focus-visible { outline: 1px dashed var(--fg); outline-offset: 6px; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; shape-rendering: crispEdges; }
.viz-base { stroke: var(--viz-base); stroke-width: 1; shape-rendering: crispEdges; }
.viz-axis { fill: var(--mute); font: 10.5px var(--mono); font-variant-numeric: tabular-nums; }
.viz-band { fill: transparent; }
.viz-band.on { fill: var(--hover); }
.viz-hit { fill: transparent; cursor: pointer; }
.viz-mark { fill: var(--sw); }
.viz-hint { margin-top: 10px; }
.viz-table { margin-top: 12px; }
.viz-table summary { list-style: none; display: inline-block; }
.viz-table summary::-webkit-details-marker { display: none; }
.viz-table[open] summary { margin-bottom: 14px; }
.viz-table .table-scroll { max-height: 360px; overflow-y: auto; }

.viz-tip {
  position: absolute;
  z-index: 3;
  min-width: 180px;
  max-width: 280px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--fg);
  pointer-events: none;
  font-size: 12px;
}
.viz-tip-head { font: 500 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); margin-bottom: 8px; }
.viz-tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 8px; padding: 2px 0; }
.viz-tip-row b { font: 500 12px var(--mono); font-variant-numeric: tabular-nums; text-align: right; min-width: 3ch; }
.viz-tip-row span { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz-tip-row.strong { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.viz-tip-row.strong b { font-size: 14px; }
.viz-tip .key { width: 12px; height: 2px; background: var(--sw); }
.viz-tip .key.blank { background: none; }

.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--sw); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.connector-table td { vertical-align: middle; }
.connector-table tr.quiet .chip, .connector-table tr.quiet .num { color: var(--mute); }
.connector-table .share { min-width: 120px; }
.share-bar { display: inline-block; vertical-align: middle; width: 72px; height: 4px; margin-right: 10px; background: var(--line); }
.share-bar > i { display: block; height: 100%; background: var(--sw); }
.cell-link { display: inline-block; margin-left: 14px; font-size: 10px; }

.level-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; grid-template-columns: 130px 1fr 60px; }
.level-row:hover { background: var(--hover); }
.level-row.on { box-shadow: inset 2px 0 0 var(--fg); padding-left: 10px; }

.heat { position: relative; }
.heat-grid { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat-hour { font: 10px/1 var(--mono); color: var(--mute); padding-bottom: 4px; }
.heat-day { font: 10.5px/1 var(--mono); color: var(--mute); text-transform: uppercase; letter-spacing: 0.06em; }
.heat-cell { display: block; height: 22px; border-radius: 2px; background: var(--hover); }
.heat-grid .heat-cell:hover { outline: 1px solid var(--fg); outline-offset: 1px; }
.heat-cell.q1 { background: var(--q1); } .heat-cell.q2 { background: var(--q2); } .heat-cell.q3 { background: var(--q3); }
.heat-cell.q4 { background: var(--q4); } .heat-cell.q5 { background: var(--q5); }
.heat-scale { display: flex; align-items: center; gap: 4px; margin-top: 14px; }
.heat-scale .heat-cell { width: 18px; height: 10px; }
.heat-scale .label:first-child { margin-right: 6px; }
.heat-scale .label:last-child { margin-left: 6px; }

/* events: each row carries its connector's color on the left edge */
.table tr.tinted > td:first-child { box-shadow: inset 3px 0 0 var(--sw); padding-left: 12px; }
.table tr.picked > td { background: var(--hover); }

@media (max-width: 760px) {
  .filters { gap: 12px 16px; margin-top: -4px; }
  .filter { min-width: calc(50% - 8px); flex: 1; }
  .filters .seg { width: 100%; }
  .filters .seg button { flex: 1; padding: 0 6px; }
  .viz-legend { justify-content: flex-start; }
  .heat-grid { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat-cell { height: 16px; }
  .heat-hour { font-size: 8.5px; }
}
.section-title + .stats { border-top: 0; }
.stat-value small { white-space: nowrap; }
.table-scroll > .latest-table, .table-scroll > .events-table { min-width: 760px; }
@media (max-width: 760px) {
  .section-title:has(.viz-legend) { flex-wrap: wrap; gap: 10px; }
  .section-title .viz-legend { flex-basis: 100%; }
}

/* delivery outcome per destination: status colors always come with a mark and words */
:root { --ok: #0ca30c; --bad: #d03b3b; }
.dest-list { display: grid; }
.dest-row { display: grid; grid-template-columns: 200px minmax(120px, 1fr) minmax(0, 300px) 64px; gap: 24px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dest-name { font-size: 14px; }
.dest-bar { display: flex; gap: 2px; height: 8px; }
.dest-bar > i { display: block; height: 100%; min-width: 3px; border-radius: 4px; }
.dest-bar .ok { background: var(--ok); }
.dest-bar .bad { background: var(--bad); }
.dest-bar .wait { background: var(--faint); }
.dest-counts { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.dest-rate { font: 300 22px/1 var(--sans); text-align: right; font-variant-numeric: tabular-nums; }
.dest-note { margin-top: 12px; }
.outcome { display: inline-flex; align-items: center; gap: 6px; }
.outcome-mark { font-style: normal; font-weight: 700; }
.outcome.ok .outcome-mark { color: var(--ok); }
.outcome.bad .outcome-mark { color: var(--bad); }
.failures { margin-top: 36px; }
.failure-error { word-break: break-word; }
@media (max-width: 760px) {
  .dest-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .dest-bar { grid-column: 1 / -1; grid-row: 2; }
  .dest-counts { grid-column: 1 / -1; }
  .dest-rate { grid-row: 1; grid-column: 2; }
}

.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-top: 1px solid var(--line); }
.level-card { display: grid; gap: 10px; justify-items: start; padding: 16px 20px 18px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.level-card:first-child { padding-left: 0; }
.level-card:hover { background: var(--hover); }
.level-card[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--fg); }
.level-count { font: 300 34px/1 var(--sans); letter-spacing: -0.03em; }
.share-bar.wide { width: 100%; max-width: 220px; margin: 0; }
.failure-list { display: grid; }
.failure-row {
  display: grid;
  grid-template-columns: 96px 200px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 12px 0 12px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--sw);
  background: none;
  text-align: left;
  cursor: pointer;
}
.failure-row:hover { background: var(--hover); }
@media (max-width: 760px) {
  .failure-row { grid-template-columns: auto minmax(0, 1fr); }
  .failure-row .failure-error { grid-column: 1 / -1; }
  .failure-row > .link { display: none; }
  .level-cards { grid-template-columns: 1fr 1fr; }
  .level-card:nth-child(odd) { padding-left: 0; }
}

/* in-page alerts */

.alert-stack {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top, 0px));
  right: 20px;
  z-index: 60;
  width: min(380px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  pointer-events: none;
}
.alert-card {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 12px 14px 14px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-left: 4px solid var(--lvl, var(--fg));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  animation: alert-in 180ms ease-out;
}
.alert-card.urgent { border-color: var(--lvl, var(--fg)); border-left-width: 6px; }
.alert-card.leaving { opacity: 0; transform: translateX(16px); transition: opacity 160ms ease-in, transform 160ms ease-in; }
.alert-glyph { padding-top: 1px; }
.alert-glyph .lvl-glyph { color: var(--lvl, var(--fg)); }
.alert-meta { color: var(--mute); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-title { font: 500 15px/1.3 var(--sans); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.alert-body {
  margin-top: 4px;
  font: 13px/1.45 var(--sans);
  color: var(--fg);
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.alert-actions { display: flex; gap: 16px; margin-top: 10px; }
.alert-close {
  align-self: start;
  width: 28px;
  height: 28px;
  margin: -6px -4px 0 0;
  border: 0;
  background: none;
  color: var(--mute);
  font: 20px/1 var(--sans);
  cursor: pointer;
}
.alert-close:hover, .alert-close:focus-visible { color: var(--fg); }
.alert-count { color: var(--fg); font-weight: 600; }
.alert-card.bump { animation: alert-bump 260ms ease-out; }
@keyframes alert-bump { 0% { transform: translateX(-6px); } 100% { transform: none; } }
.tag.repeat { border-color: var(--fg); color: var(--fg); font-weight: 600; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) {
  .alert-stack { top: calc(12px + env(safe-area-inset-top, 0px)); right: 16px; left: 16px; width: auto; }
}

/* account banner, password meter */

.pw-meter { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 10px; align-self: end; min-height: 38px; }
.pw-bar { display: inline-grid; grid-template-columns: repeat(4, 22px); gap: 3px; }
.pw-bar i { height: 4px; background: var(--line); }
.pw-label { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.pw-advice { grid-column: 1 / -1; }
.pw-meter[data-score="0"] .pw-bar i:nth-child(-n + 1), .pw-meter[data-score="1"] .pw-bar i:nth-child(-n + 1) { background: #d03b3b; }
.pw-meter[data-score="2"] .pw-bar i:nth-child(-n + 2) { background: #e8a23b; }
.pw-meter[data-score="3"] .pw-bar i:nth-child(-n + 3) { background: #2ea66b; }
.pw-meter[data-score="4"] .pw-bar i { background: #0ca30c; }
.login-step { font: 500 20px/1.2 var(--sans); margin-bottom: 8px; }
.qr { display: block; width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 6px; border: 1px solid var(--line); }
.recovery-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 28px; font: 14px/1.5 var(--mono); padding: 14px 16px; background: var(--hover); border: 1px solid var(--line); }
.secret-text { font: 13px/1.5 var(--mono); word-break: break-all; }

/* walkthrough */

.tour { position: fixed; inset: 0; z-index: 80; }
.tour-shade { position: absolute; inset: 0; }
.tour.centered .tour-shade { background: rgba(0, 0, 0, 0.55); }
.tour-spot {
  position: fixed;
  border: 2px solid var(--fg);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  transition: top 180ms ease, left 180ms ease, width 180ms ease, height 180ms ease;
  pointer-events: none;
}
.tour.centered .tour-spot { display: none; }
.tour-card {
  position: fixed;
  width: min(420px, calc(100vw - 32px));
  padding: 20px 22px 18px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  outline: none;
}
.tour.centered .tour-card { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); }
.tour-count { color: var(--mute); margin-bottom: 8px; }
.tour-title { font: 500 20px/1.2 var(--sans); margin-bottom: 8px; }
.tour-text { font: 14px/1.5 var(--sans); }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 14px; margin-top: 18px; }
.tour-links, .tour-nav { display: inline-flex; align-items: center; gap: 14px; }
.tour-nav { gap: 8px; margin-left: auto; }
@media (max-width: 720px) {
  .tour-card { left: 16px !important; right: 16px; width: auto; top: auto !important; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .tour.centered .tour-card { transform: none; top: auto !important; left: 16px !important; }
}
