/* InvariantDB Console. "Instrument panel for a ledger": calm, dense, exact.
   Colour carries meaning: verdigris = verified / healthy, amber = held / waiting,
   vermilion = destructive or failing, and nothing else is red.
   Both themes meet WCAG AA for text (4.5:1) and UI contrast (3:1). */

:root {
  color-scheme: dark;
  --bg: #0f1112;
  --bg-raise: #15181a;
  --surface: #191c1e;
  --surface-2: #202427;
  --surface-3: #2a2f33;
  --line: #2c3236;
  --line-strong: #3d454a;
  --text: #ebe8e1;
  --text-2: #b9bab4;
  --muted: #9a9f9b;
  --accent: #5cc3aa;
  --accent-ink: #062520;
  --accent-soft: rgba(92, 195, 170, 0.13);
  --amber: #e6b04e;
  --amber-soft: rgba(230, 176, 78, 0.13);
  --danger: #f2765a;
  --danger-ink: #2a0b04;
  --danger-soft: rgba(242, 118, 90, 0.13);
  --info: #8fb4ff;
  --focus: #9fe3d2;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --radius: 10px;
  --radius-s: 6px;
  --rail: 236px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f2ec;
  --bg-raise: #efede6;
  --surface: #fffefb;
  --surface-2: #f6f4ee;
  --surface-3: #ebe8e0;
  --line: #e0dcd2;
  --line-strong: #c9c4b8;
  --text: #1a1c1b;
  --text-2: #3d413f;
  --muted: #5b605d;
  --accent: #0b7461;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 116, 97, 0.09);
  --amber: #8a5800;
  --amber-soft: rgba(176, 116, 0, 0.11);
  --danger: #b4321a;
  --danger-ink: #ffffff;
  --danger-soft: rgba(180, 50, 26, 0.08);
  --info: #2450a8;
  --focus: #0b7461;
  --shadow: 0 1px 2px rgba(30, 25, 10, 0.05), 0 10px 28px -14px rgba(30, 25, 10, 0.18);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f2ec; --bg-raise: #efede6; --surface: #fffefb; --surface-2: #f6f4ee; --surface-3: #ebe8e0;
    --line: #e0dcd2; --line-strong: #c9c4b8; --text: #1a1c1b; --text-2: #3d413f; --muted: #5b605d;
    --accent: #0b7461; --accent-ink: #ffffff; --accent-soft: rgba(11, 116, 97, 0.09);
    --amber: #8a5800; --amber-soft: rgba(176, 116, 0, 0.11);
    --danger: #b4321a; --danger-ink: #ffffff; --danger-soft: rgba(180, 50, 26, 0.08);
    --info: #2450a8; --focus: #0b7461;
    --shadow: 0 1px 2px rgba(30, 25, 10, 0.05), 0 10px 28px -14px rgba(30, 25, 10, 0.18);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
code, .mono, pre, kbd { font-family: var(--mono); font-size: 0.92em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -0.012em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 8px; }
::selection { background: var(--accent-soft); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-s); border: 1px solid var(--line-strong); }
.skip:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bg-raise); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 680; letter-spacing: -0.01em; font-size: 14.5px; }
.brand-product { color: var(--muted); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail .group { margin: 14px 8px 6px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-s);
  color: var(--text-2); text-decoration: none; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 560; }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.nav-item kbd { margin-left: auto; opacity: 0; }
.nav-item:hover kbd, .nav-item:focus-visible kbd { opacity: 0.8; }
.rail-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .here { color: var(--text); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .icon { width: 12px; height: 12px; opacity: 0.6; }
.topbar .spacer { flex: 1; }
.palette-btn {
  display: flex; align-items: center; gap: 8px; min-width: 240px; padding: 6px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--muted); cursor: pointer; font: inherit;
}
.palette-btn:hover { border-color: var(--line-strong); color: var(--text-2); }
.palette-btn kbd { margin-left: auto; }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; font-size: 11px; line-height: 16px; text-align: center; color: var(--text-2); background: var(--surface-2); }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 560; border: 1px solid var(--line); color: var(--muted); }
.mode-pill.read { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.mode-pill.act { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); background: var(--amber-soft); }
.who { display: flex; align-items: center; gap: 8px; }
.who-chip { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.who-chip .l { font-family: var(--mono); font-size: 12.5px; }
.who-chip .d { font-size: 11px; color: var(--muted); }

.content { padding: 24px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .titles { display: grid; gap: 4px; }
.page-head .lede { color: var(--muted); max-width: 72ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); align-items: start; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); }
.stack { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 12px 16px 16px; }
.card-body.flush { padding: 8px 0 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 6px; text-decoration: none; color: inherit; position: relative; overflow: hidden; }
a.stat:hover { border-color: var(--line-strong); }
.stat .k { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 640; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--text-2); }
.stat.ok .v { color: var(--accent); }
.stat.warn .v { color: var(--amber); }
.stat.bad .v { color: var(--danger); }
.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: transparent; }
.stat.ok::after { background: var(--accent); }
.stat.warn::after { background: var(--amber); }
.stat.bad::after { background: var(--danger); }

/* ---------- key/value ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- badges / state ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 560; border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; line-height: 18px; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.badge.warn { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: var(--amber-soft); }
.badge.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.hash { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12.5px; max-width: 100%; }
.hash .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.copy:hover { background: var(--surface-3); color: var(--text); }
.copy .icon { width: 13px; height: 13px; }

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 12px;
  border-radius: var(--radius-s); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 540; cursor: pointer; white-space: nowrap; min-height: 32px;
}
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 3px 9px; min-height: 26px; font-size: 12.5px; }
.btn.icon-only { padding: 0; width: 32px; }

input[type="text"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 6px 10px; min-height: 32px; width: 100%;
}
textarea { font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--danger); }
label.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--text-2); font-weight: 540; }
label.field .hint { font-weight: 400; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------- tables ---------- */
.table-tools { display: flex; gap: 8px; align-items: center; padding: 0 16px 10px; flex-wrap: wrap; }
.table-tools .filter { max-width: 280px; }
.table-tools .meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 560; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.data th:first-child, table.data td:first-child { padding-left: 16px; }
table.data th:last-child, table.data td:last-child { padding-right: 16px; }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 2px solid var(--focus); border-radius: 3px; }
table.data th[aria-sort="ascending"] button::after { content: "\2191"; }
table.data th[aria-sort="descending"] button::after { content: "\2193"; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
table.data tbody tr[aria-selected="true"] td { background: var(--accent-soft); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; }
table.data.compact td, table.data.compact th { padding-top: 5px; padding-bottom: 5px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; font-weight: 560; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { all: unset; cursor: pointer; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 540; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 4px 4px 0 0; }

/* ---------- notices ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.notice .icon { margin-top: 2px; }
.notice.warn { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); background: var(--amber-soft); color: var(--text); }
.notice.warn .icon { color: var(--amber); }
.notice.bad { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); color: var(--text); }
.notice.bad .icon { color: var(--danger); }
.notice.ok { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); color: var(--text); }
.notice.ok .icon { color: var(--accent); }
.notice .body { display: grid; gap: 4px; min-width: 0; }
.notice code { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.err { border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); border-radius: var(--radius-s); padding: 10px 12px; display: grid; gap: 4px; font-size: 13px; }
.err .t { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--danger); }
.err .m { color: var(--text); overflow-wrap: anywhere; }
.err .h { color: var(--muted); }
.unavail { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13px; padding: 4px 0; }
.unavail code { color: var(--text-2); }

.skeleton { display: grid; gap: 8px; }
.skeleton i { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
.skeleton i:nth-child(2) { width: 82%; }
.skeleton i:nth-child(3) { width: 64%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

pre.json { margin: 0; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: auto; max-height: 420px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
details.raw { margin-top: 10px; }
details.raw summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
details.raw[open] summary { margin-bottom: 8px; }

/* ---------- integrity chain (signature element) ---------- */
.chain { display: flex; align-items: center; gap: 3px; }
.chain i { width: 10px; height: 14px; border-radius: 2px; background: var(--accent); opacity: 0.85; }
.chain i:nth-child(odd) { opacity: 0.6; }
.chain.warn i { background: var(--amber); }
.chain.bad i { background: var(--danger); }
.chain.unknown i { background: var(--surface-3); opacity: 1; }
.integrity { display: grid; gap: 0; }
.integrity-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.integrity-row:first-child { border-top: 0; }
.integrity-row .name { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.integrity-row .name a { color: var(--text); text-decoration: none; }
.integrity-row .name a:hover { text-decoration: underline; }
.integrity-row .meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- attention list ---------- */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-top: 1px solid var(--line); }
.attn li:first-child { border-top: 0; }
.attn .icon { margin-top: 2px; }
.attn .warn { color: var(--amber); }
.attn .bad { color: var(--danger); }
.attn .ok { color: var(--accent); }
.attn a { margin-left: auto; white-space: nowrap; font-size: 12.5px; }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(5, 7, 8, 0.6); backdrop-filter: blur(2px); }
.dlg-head { padding: 18px 20px 0; display: flex; gap: 12px; align-items: flex-start; }
.dlg-head .glyph { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--surface-3); }
.dlg-head .glyph.danger { background: var(--danger-soft); color: var(--danger); }
.dlg-head .glyph.warn { background: var(--amber-soft); color: var(--amber); }
.dlg-head .glyph .icon { width: 18px; height: 18px; }
.dlg-head h2 { font-size: 16px; }
.dlg-body { padding: 14px 20px; display: grid; gap: 12px; }
.dlg-foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.consequences { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--text-2); }
.typed { display: grid; gap: 6px; }
.typed .target { font-family: var(--mono); background: var(--bg); border: 1px dashed var(--line-strong); padding: 2px 6px; border-radius: 4px; user-select: all; }
.secret-box { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius-s); border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line)); background: var(--amber-soft); }
.secret-box .val { font-family: var(--mono); font-size: 13px; padding: 8px 10px; background: var(--bg); border-radius: 4px; border: 1px solid var(--line); overflow-wrap: anywhere; }

/* ---------- command palette ---------- */
dialog.palette { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; background: transparent; padding: 4px 0; font-size: 15px; min-height: 0; }
.palette-input input:focus-visible { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; color: var(--text-2); }
.palette-list li[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.palette-list li .kind { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.palette-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 60; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 13px; animation: rise 0.18s ease-out; }
.toast.ok .icon { color: var(--accent); }
.toast.bad .icon { color: var(--danger); }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- query ---------- */
.editor { display: grid; gap: 10px; }
.editor textarea { min-height: 140px; background: var(--bg); }
.result-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; padding: 0 16px 10px; }

/* ---------- sign-in ---------- */
.signin-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr); }
.signin-art { position: relative; overflow: hidden; background: var(--bg-raise); border-right: 1px solid var(--line); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.signin-art .ledger { position: absolute; inset: 0; opacity: 0.55; }
.signin-art .ledger-lines { position: absolute; inset: 0; background-image: repeating-linear-gradient(0deg, transparent 0 31px, var(--line) 31px 32px); mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); }
.signin-art .claim { position: relative; max-width: 30ch; font-size: 28px; line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; }
.signin-art .claim em { font-style: normal; color: var(--accent); }
.signin-art .points { position: relative; display: grid; gap: 10px; color: var(--text-2); max-width: 44ch; }
.signin-art .points div { display: flex; gap: 10px; }
.signin-art .points .icon { color: var(--accent); margin-top: 2px; }
.signin-panel { display: grid; place-items: center; padding: 32px; }
.signin-form { width: min(380px, 100%); display: grid; gap: 14px; }
.signin-form .brand { padding: 0 0 6px; }
.signin-form .fine { color: var(--muted); font-size: 12.5px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail .group, .rail-foot, .nav-item kbd { display: none; }
  .brand { padding: 4px 8px; }
  .nav-item[aria-current="page"]::before { display: none; }
  .palette-btn { min-width: 0; }
  .palette-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .signin-wrap { grid-template-columns: 1fr; }
  .signin-art { display: none; }
  .content { padding: 16px; }
  .topbar { padding: 8px 16px; flex-wrap: wrap; }
  .who-chip { display: none; }
}

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

@media (forced-colors: active) {
  .badge, .btn, .card, .stat { border: 1px solid CanvasText; }
  .nav-item[aria-current="page"] { outline: 2px solid Highlight; }
}

.divider { height: 16px; }
dialog.wide { width: min(900px, calc(100vw - 32px)); }
.dlg-head .icon-only { margin-left: auto; }
.spacer { flex: 1; }
.bm-bg { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.2; }
.bm-lines { stroke: var(--accent); stroke-width: 1.8; }
.bm-check { stroke: var(--text); stroke-width: 1.8; }
.shell { background: linear-gradient(to right, var(--bg-raise) calc(var(--rail) - 1px), var(--line) calc(var(--rail) - 1px), var(--line) var(--rail), var(--bg) var(--rail)); }
.rail { border-right: 0; }
.card-body.flush details.raw { margin: 10px 16px 14px; }
.row > select, .row > input, .tools select, .tools input, .table-tools input, label.row select { width: auto; }
#q-graph { min-width: 240px; }
.card-body > .dt .table-tools:first-child { padding-left: 0; padding-right: 0; }
td code, td .hash { white-space: nowrap; }
@media (max-width: 960px) { .shell { background: var(--bg); } }
input.masked { -webkit-text-security: disc; font-family: var(--mono); }
.breakglass { border-top: 1px solid var(--line); padding-top: 12px; }
.breakglass .signin-form { width: 100%; margin-top: 12px; }
.sso-soon { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.sso-soon p { flex-basis: 100%; margin: 0; }
