/* Zapim Firewall console. Light, cool paper canvas, pine-green accent. Fonts are self-hosted so the
   console works on operator networks without internet access. See docs/DESIGN.md. */
@font-face { font-family: "Overpass"; font-style: normal; font-weight: 300 900; font-display: swap; src: url("/fonts/overpass-latin.woff2") format("woff2"); }
@font-face { font-family: "Overpass"; font-style: italic; font-weight: 300 900; font-display: swap; src: url("/fonts/overpass-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Overpass Mono"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/fonts/overpass-mono-latin.woff2") format("woff2"); }

:root {
  --canvas: #f4f5f7;
  --panel: #ffffff;
  --panel-quiet: #f7f8fa;
  --hairline: #e1e4e8;
  --rule: #c9ced4;
  --ink: #15181c;
  --ink-2: #4f565e;
  --ink-3: #7b838c;
  --accent: #1e6b4a;
  --accent-press: #175539;
  --accent-tint: #e3f0e8;
  --good: #1e6b4a; --good-tint: #e3f0e8;
  --bad: #b3392f; --bad-tint: #f8e3e0;
  --attn: #8a6d00; --attn-tint: #f6efd2;
  --quiet: #676d75; --quiet-tint: #eaedf0;
  --s1: #1f8f5c; --s2: #3f6fa6; --s3: #a8820a; --s4: #8a4b7a; --s5: #008b9e; --s6: #b0463a; --s7: #6e63b8;
  --r: 4px; --r-panel: 6px;
  --shadow: 0 12px 32px rgba(21, 24, 28, .14);
  --sans: "Overpass", "Segoe UI", system-ui, sans-serif;
  --mono: "Overpass Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --topbar: 56px;
  --measure: 68ch;
}
* { box-sizing: border-box; }
html { background: var(--canvas); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; scrollbar-color: var(--rule) transparent; }
body { margin: 0; min-height: 100dvh; }
::selection { background: var(--accent-tint); color: var(--ink); }
input, textarea, select, button { caret-color: var(--accent); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; color: var(--ink-2); }
p { margin: 0 0 .75em; max-width: var(--measure); }
code, .mono { font-family: var(--mono); font-size: 13px; }
.num { font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 13px; }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--r); z-index: 300; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--topbar); display: flex; align-items: stretch; gap: 8px; padding: 0 28px; background: var(--panel); border-bottom: 1px solid var(--hairline); }
.wordmark { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: 15px; white-space: nowrap; margin-right: 20px; }
.wordmark:hover { text-decoration: none; }
.wordmark .mark { width: 26px; height: 26px; }
.nav { display: flex; flex: 1; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); white-space: nowrap; font-weight: 500; border-radius: var(--r); transition: color .14s var(--ease); }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.active { color: var(--ink); }
.nav a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--accent); }
.tools { display: flex; align-items: center; gap: 2px; position: relative; }
.tool { position: relative; width: 36px; height: 36px; border-radius: var(--r); border: 0; background: transparent; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background .14s var(--ease), color .14s var(--ease); }
.tool:hover { background: var(--panel-quiet); color: var(--ink); }
.tool:active { transform: translateY(1px); }
.tool svg, .btn svg, .ico { width: 18px; height: 18px; flex: none; }
.tool .count { position: absolute; top: 4px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font: 600 10px/16px var(--mono); text-align: center; }
.who { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; height: 36px; border-radius: var(--r); border: 0; background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; }
.who:hover { background: var(--panel-quiet); }
.who .role { color: var(--ink-3); font-weight: 400; }
.menu { position: absolute; top: 44px; right: 0; min-width: 280px; max-width: 440px; max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel); box-shadow: var(--shadow); z-index: 60; padding: 6px; animation: rise .16s var(--ease); }
.menu .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px 10px; font-weight: 600; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
.menu .item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--r); background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.menu .item:hover { background: var(--panel-quiet); }
.menu .item.unread b::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.menu .item .hint { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- page ---------- */
.page { max-width: 1440px; margin: 0 auto; padding: 28px 28px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .titles p { margin: 4px 0 0; color: var(--ink-2); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink-2); font-size: 13px; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); text-decoration: none; }
.panel { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel); margin-bottom: 20px; }
.panel > .phead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.panel > .phead h3 { flex: 1; min-width: 160px; }
.panel > .pbody { padding: 16px; }
.panel > .pbody.flush { padding: 0; }
.panel > .pfoot { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--hairline); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.split { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.subnav { position: sticky; top: calc(var(--topbar) + 20px); display: flex; flex-direction: column; gap: 2px; }
.subnav a { padding: 7px 10px; border-radius: var(--r); color: var(--ink-2); }
.subnav a:hover { color: var(--ink); background: var(--panel); text-decoration: none; }
.subnav a.active { color: var(--ink); background: var(--panel); box-shadow: inset 2px 0 0 var(--accent); }
.subnav .group { margin: 10px 10px 4px; font-size: 12px; color: var(--ink-3); }
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 24px; }
.ledger div { padding: 10px 0; border-top: 1px solid var(--hairline); }
.ledger .k { display: block; font-size: 12px; color: var(--ink-2); }
.ledger .v { display: block; font: 500 20px/1.2 var(--mono); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ledger .v.good { color: var(--good); } .ledger .v.bad { color: var(--bad); }
.empty { padding: 32px 16px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.skeleton i { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--panel-quiet), var(--hairline), var(--panel-quiet)); background-size: 200% 100%; animation: sheen 1.2s linear infinite; }
.skeleton i:nth-child(2) { width: 70%; } .skeleton i:nth-child(3) { width: 85%; } .skeleton i:nth-child(4) { width: 55%; }
@keyframes sheen { to { background-position: -200% 0; } }
.error { color: var(--bad); font-size: 13px; }
.ok { color: var(--good); }
.callout { padding: 12px 16px; border-radius: var(--r); background: var(--panel-quiet); border: 1px solid var(--hairline); color: var(--ink-2); font-size: 13px; }
.callout.bad { background: var(--bad-tint); color: var(--bad); border-color: transparent; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--rule); background: var(--panel); color: var(--ink); cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; transition: background .14s var(--ease), border-color .14s var(--ease), transform .08s var(--ease); }
.btn:hover { background: var(--panel-quiet); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn.danger { color: var(--bad); border-color: var(--rule); }
.btn.danger:hover { background: var(--bad-tint); border-color: var(--bad); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--panel-quiet); }
.btn.sm { min-height: 28px; padding: 0 10px; font-size: 13px; }
.btn.sm svg { width: 15px; height: 15px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.seg button { min-height: 28px; padding: 0 12px; border: 0; background: var(--panel); color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .14s var(--ease); }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--panel-quiet); color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.seg button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); padding: 6px 10px; min-height: 34px; min-width: 0; transition: border-color .14s var(--ease); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); vertical-align: middle; }
input[type=search] { padding-left: 10px; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; background: var(--panel-quiet); }
input[readonly] { background: var(--panel-quiet); }
textarea { width: 100%; min-height: 72px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
select { padding-right: 28px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%235c5a55'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > label { color: var(--ink); font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--rule); border-radius: 22px; transition: background .16s var(--ease); cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .16s var(--ease); box-shadow: 0 1px 2px rgba(21,24,28,.25); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.checks { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.rows-editor .row { display: grid; gap: 6px; align-items: center; margin-bottom: 6px; }
.rows-editor .row.head { color: var(--ink-3); font-size: 12px; }
pre.json { background: var(--panel-quiet); border: 1px solid var(--hairline); padding: 12px; border-radius: var(--r); overflow: auto; max-height: 320px; font: 12px/1.5 var(--mono); margin: 0; }
.trace { font: 13px/1.6 var(--mono); background: var(--panel-quiet); border: 1px solid var(--hairline); padding: 10px 12px; border-radius: var(--r); overflow-x: auto; }

/* ---------- status words ---------- */
.state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; background: var(--quiet-tint); color: var(--quiet); }
.state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.state.good { background: var(--good-tint); color: var(--good); }
.state.bad { background: var(--bad-tint); color: var(--bad); }
.state.attn { background: var(--attn-tint); color: var(--attn); }
.state.plain::before { display: none; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 3px; font: 12px/18px var(--mono); background: var(--panel-quiet); border: 1px solid var(--hairline); color: var(--ink-2); margin-right: 4px; }
.lamp { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rule); flex: none; }
.lamp.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-tint); }
.lamp.attn { background: var(--attn); box-shadow: 0 0 0 3px var(--attn-tint); }
.lamp.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-tint); }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; max-width: 100%; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 8px 12px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; }
.tbl th { color: var(--ink-2); font-weight: 500; font-size: 12px; white-space: nowrap; background: var(--panel-quiet); position: sticky; top: 0; z-index: 1; }
.tbl th.num { text-align: right; font-family: var(--sans); font-size: 12px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--panel-quiet); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num { font-family: var(--mono); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions .btn { margin-left: 4px; }
.tbl td .bar { height: 6px; border-radius: 3px; background: var(--s1); min-width: 2px; margin-top: 6px; }
.tbl.dense td, .tbl.dense th { padding: 5px 10px; }
.cdr td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 12px; color: var(--ink-2); font-size: 13px; border-top: 1px solid var(--hairline); }
.toolbar-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--hairline); background: var(--panel-quiet); border-radius: var(--r-panel) var(--r-panel) 0 0; }
.toolbar-row input, .toolbar-row select { min-height: 32px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 20px; overflow-x: auto; }
.tabs button { position: relative; background: transparent; border: 0; color: var(--ink-2); padding: 10px 12px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); }
.tabs button.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent); }

/* ---------- rack (traffic management) ---------- */
.rack { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel); overflow: hidden; }
.unit { display: grid; grid-template-columns: 44px minmax(220px, 1.2fr) minmax(320px, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--hairline); transition: background .14s var(--ease); }
.unit:last-child { border-bottom: 0; }
.unit:hover { background: var(--panel-quiet); }
.unit.off { color: var(--ink-2); }
.unit .u { text-align: center; font: 12px var(--mono); color: var(--ink-3); border-right: 1px solid var(--hairline); align-self: stretch; display: flex; align-items: center; justify-content: center; }
.unit .name { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; color: var(--ink); }
.unit .name a { color: inherit; }
.unit .name a:hover { color: var(--accent); text-decoration: none; }
.unit .desc { color: var(--ink-2); font-size: 13px; margin-top: 2px; max-width: 60ch; }
.unit .counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 2px 14px; font-size: 12px; color: var(--ink-2); }
.unit .counters b { display: block; font: 500 14px var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.unit .ctl { display: flex; align-items: center; gap: 14px; }
.unit .ctl .lbl { font-size: 12px; color: var(--ink-2); }
@media (max-width: 1000px) { .unit { grid-template-columns: 44px 1fr; } .unit .counters, .unit .ctl { grid-column: 2; } }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; }
.widget { position: relative; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel); display: flex; flex-direction: column; min-height: 200px; overflow: hidden; transition: box-shadow .16s var(--ease), border-color .16s var(--ease); }
.widget .whead { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--hairline); }
.widget .whead h3 { flex: 1; font-size: 14px; }
.widget .whead .tool { width: 28px; height: 28px; opacity: 0; transition: opacity .14s var(--ease); }
.widget .whead .tool svg { width: 15px; height: 15px; }
.widget:hover .whead .tool, .widget:focus-within .whead .tool { opacity: 1; }
.widget .grip { cursor: grab; color: var(--ink-3); width: 24px; height: 28px; display: inline-flex; align-items: center; justify-content: center; margin-left: -8px; }
.widget .grip:active { cursor: grabbing; }
.widget .wbody { padding: 14px; flex: 1; overflow: auto; }
.widget .wbody.flush { padding: 0; }
.widget.dragging { opacity: .4; }
.widget.drop-before { box-shadow: -4px 0 0 var(--accent); }
.widget.drop-after { box-shadow: 4px 0 0 var(--accent); }
@media (max-width: 860px) { .dash > .widget { grid-column: span 12 !important; } }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
.chart .axis { stroke: var(--rule); stroke-width: 1; }
.chart .grid { stroke: var(--hairline); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .hover { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.chart .dot { stroke: #fff; stroke-width: 2; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: var(--r); padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 5; line-height: 1.5; }
.tip .t { color: rgba(255,255,255,.7); }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tip .v { font-family: var(--mono); }
.map { width: 100%; position: relative; }
.map svg { width: 100%; height: auto; display: block; }
.map path { fill: var(--quiet-tint); stroke: #fff; stroke-width: .6; transition: fill .14s var(--ease); }
.map path.hit:hover { stroke: var(--ink); stroke-width: 1; }
.map .scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.map .scale i { display: block; height: 8px; flex: 1; border-radius: 4px; background: linear-gradient(90deg, #e3f0e8, #0f3d2a); max-width: 160px; }

/* ---------- dialogs & toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(21, 24, 28, .42); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 100; overflow: auto; animation: fade .14s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: var(--r-panel); width: 100%; max-width: 640px; box-shadow: var(--shadow); animation: rise .18s var(--ease); }
.modal.wide { max-width: 980px; }
.modal .mhead { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--hairline); }
.modal .mhead h2 { flex: 1; font-size: 17px; }
.modal .mbody { padding: 20px; max-height: 70vh; overflow: auto; }
.modal .mfoot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--hairline); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--ink); color: #fff; box-shadow: var(--shadow); max-width: 440px; font-size: 13px; animation: rise .2s var(--ease); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.toast.error svg { color: #f1a89f; } .toast.ok svg { color: #9fd3ac; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: var(--canvas); z-index: 90; padding: 16px; }
.login .box { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--r-panel); padding: 32px; }
.login .wordmark { margin: 0 0 6px; font-size: 18px; }
.login .wordmark .mark { width: 30px; height: 30px; }
.login p { color: var(--ink-2); margin-bottom: 24px; }
.login input { width: 100%; }
.login .btn { width: 100%; margin-top: 6px; }
.login .foot { margin-top: 20px; font-size: 12px; color: var(--ink-3); }

/* ---------- misc ---------- */
.kv-inline { display: inline-flex; gap: 4px; color: var(--ink-2); font-size: 12px; }
.kv-inline b { color: var(--ink); font-weight: 500; }
.verdict { font: 600 22px/1.2 var(--sans); }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.result-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 24px; padding: 4px 0 16px; }
.result-row .k { font-size: 12px; color: var(--ink-2); }
.result-row .v { font: 500 15px var(--mono); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 720px) { .page { padding: 20px 16px 48px; } .topbar { padding: 0 16px; } .wordmark span { display: none; } h1 { font-size: 22px; } }
.state-row { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.state-row .field { margin: 0; min-width: 320px; }
.state-row .field.inline { min-width: 0; padding-bottom: 8px; }
