/* The pages in BasaltDB's Product UI layer: Geist for the interface, Geist
   Mono for everything the database returns or the agent sends, neutral
   panels with one 1px border, diffs in red, green and amber. Dark mode is
   the same layout with the tokens switched. The fonts are served with the
   pages (fonts/, SIL OFL 1.1): the CSP loads nothing from elsewhere. */
@font-face { font-family: "Geist"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Geist-400.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Geist-500.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Geist-600.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/GeistMono-400.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/GeistMono-500.woff2") format("woff2"); }

:root {
  --ui-bg: #f6f8f8;
  --ui-panel: #ffffff;
  --ui-subtle: #f0f3f3;
  --ui-border: #dde3e4;
  --ui-border-strong: #c3cdcf;
  --ui-text: #0b1f24;
  --ui-text-2: #4b5f63;
  --ui-primary: #0e3e48;
  --ui-on-primary: #ffffff;
  --ui-focus: #08d1d0;
  --diff-del-bg: #fdecec;
  --diff-del-fg: #b42318;
  --diff-del-line: #f6d5d3;
  --diff-add-bg: #e7f6ec;
  --diff-add-fg: #1a7f37;
  --diff-hold-bg: #fff4e0;
  --diff-hold-fg: #8a5300;
  --on-danger: #ffffff;
  --on-badge: #ffffff;
  --logo-top: #08d1d0;
  --logo-left: #0e3e48;
  --logo-right: #0e3e48;
  --dim: rgba(11, 31, 36, 0.4);
  --radius-ui-sm: 4px;
  --radius-ui: 6px;
  --row-height: 34px;
  --font-ui: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ui-bg: #0b1417;
    --ui-panel: #101c20;
    --ui-subtle: #15252a;
    --ui-border: #22343a;
    --ui-border-strong: #33494f;
    --ui-text: #e3eef0;
    --ui-text-2: #9db2b6;
    --ui-primary: #08d1d0;
    --ui-on-primary: #06242a;
    --diff-del-bg: #3a1716;
    --diff-del-fg: #ff8a80;
    --diff-del-line: #22343a;
    --diff-add-bg: #10301c;
    --diff-add-fg: #7ee2a0;
    --diff-hold-bg: #3a2a0c;
    --diff-hold-fg: #f5c26b;
    --on-danger: #2a0b0a;
    --on-badge: #0b1417;
    --logo-left: #96e5ac;
    --logo-right: #ffffff;
    --dim: rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
/* Components set their own display; hidden still wins. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 14px/1.5 var(--font-ui);
}

a { color: var(--ui-primary); }
:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }

/* The top bar: logo, BasaltDB / page, the item's id and its state. */
.topbar { background: var(--ui-panel); border-bottom: 1px solid var(--ui-border); padding: 0 16px; }
.bar { max-width: 880px; margin: 0 auto; min-height: 52px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; }
.revert-page .bar { max-width: 1180px; }
.logo { flex: none; }
.logo .col-top { fill: var(--logo-top); }
.logo .col-left { fill: var(--logo-left); }
.logo .col-right { fill: var(--logo-right); }
.brand { font-weight: 600; }
.sep, .crumb-page, .crumb { color: var(--ui-text-2); }
.item-id { font-size: 12px; color: var(--ui-text-2); }
.crumb { font-size: 13px; unicode-bidi: isolate; }
.bar .pill { margin-left: auto; }
.pill { display: inline-block; border-radius: var(--radius-ui-sm); padding: 2px 8px; font-size: 12px; font-weight: 500; background: var(--ui-subtle); color: var(--ui-text-2); vertical-align: middle; }
.pill.hold { background: var(--diff-hold-bg); color: var(--diff-hold-fg); }
.pill.bad { background: var(--diff-del-bg); color: var(--diff-del-fg); }
.pill.ok { background: var(--diff-add-bg); color: var(--diff-add-fg); }

.page { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.revert-page .page { max-width: 1180px; }
main { display: flex; flex-direction: column; gap: 16px; }

h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
p { margin: 0; }
.muted { color: var(--ui-text-2); font-size: 13px; }

pre, code, textarea, input.text, .col, .table-name, .item-id {
  font-family: var(--font-mono);
}
pre, code, textarea, input.text { font-size: 13px; }
code { background: var(--ui-subtle); border-radius: var(--radius-ui-sm); padding: 0 4px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* One level of container: panels, never a rounded card inside one. */
.panel {
  background: var(--ui-panel);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-ui);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.error { border-color: var(--diff-del-fg); }
.error h1 { color: var(--diff-del-fg); }
/* The engine's message for the person keeps its line breaks: one line per step. */
#error-text, #done-text { white-space: pre-line; overflow-wrap: anywhere; }

/* The summary: op badge and headline, the facts, the exact SQL. The most
   dangerous thing on the page is the loudest: the DELETE, not the title. */
.summary-panel { gap: 16px; }
.title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.title-row h1 { flex: 1 1 20rem; min-width: 0; }
.op-badge { font-family: var(--font-mono); font-size: 13px; font-weight: 500; border-radius: var(--radius-ui-sm); padding: 2px 8px; color: var(--ui-text); background: var(--ui-subtle); }
.op-delete { background: var(--diff-del-fg); color: var(--on-danger); }
.op-insert, .op-restore { background: var(--diff-add-fg); color: var(--on-badge); }
.op-update { background: var(--diff-hold-fg); color: var(--on-badge); }
.headline { overflow-wrap: anywhere; }
.lede { color: var(--ui-text-2); }

.summary { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.summary > div { display: flex; gap: 12px; min-width: 0; }
.summary > div.wide { grid-column: span 2; }
.summary dt { width: 72px; flex: none; font-size: 12px; font-weight: 500; color: var(--ui-text-2); padding-top: 1px; }
.summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 13px; }
.summary dd#intent, .summary dd#plan, .summary dd#scope { font-family: var(--font-ui); font-size: 14px; }

.sql { background: var(--ui-subtle); border: 1px solid var(--ui-border); border-radius: var(--radius-ui-sm); padding: 12px 14px; overflow-x: auto; }
.sql pre { line-height: 1.6; }
.sql-params { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; }
.sql-c { font-family: var(--font-mono); font-size: 13px; color: var(--ui-text-2); flex: none; }
.sql-params pre { color: var(--ui-text-2); min-width: 0; }

.why { background: var(--ui-subtle); border: 1px solid var(--ui-border); border-radius: var(--radius-ui-sm); padding: 10px 12px; overflow-wrap: anywhere; }

/* Changes: a header, then one table per table. */
.changes { padding: 0; gap: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--ui-border); }
.panel-note { margin-left: auto; font-size: 12px; color: var(--ui-text-2); flex: 1 1 18rem; text-align: right; }
.counts { display: inline-flex; gap: 8px; font-family: var(--font-mono); font-size: 13px; }
.count-delete { color: var(--diff-del-fg); }
.count-insert { color: var(--diff-add-fg); }
.count-update { color: var(--diff-hold-fg); }

/* Show values (HR-4): above the tables, until the person reveals them;
   then Hide values, which only hides them on this page. */
.reveal { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 12px 20px; border-bottom: 1px solid var(--ui-border); background: var(--ui-subtle); }
.reveal-text { font-size: 13px; color: var(--ui-text-2); flex: 1 1 20rem; }
.reveal-status { flex-basis: 100%; font-size: 13px; color: var(--diff-hold-fg); }
.reveal-status:empty { display: none; }

.groups { padding: 4px 0 8px; }
.groups:empty { display: none; }
.group { padding: 12px 20px; display: flex; flex-direction: column; gap: 8px; }
.group-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-name { font-size: 13px; font-weight: 500; unicode-bidi: isolate; overflow-wrap: anywhere; }
.count { font-size: 12px; color: var(--ui-text-2); }
.tag { background: var(--ui-subtle); border: 1px solid var(--ui-border); border-radius: var(--radius-ui-sm); padding: 0 6px; font-size: 12px; color: var(--ui-text-2); }
.tag.shown { color: var(--ui-text); border-color: var(--ui-border-strong); }
.group-note { font-size: 12px; color: var(--ui-text-2); }
.callout { background: var(--diff-hold-bg); color: var(--diff-hold-fg); border-radius: var(--radius-ui-sm); padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; }
/* A wide table scrolls in its box, never the page. */
.scroll { overflow-x: auto; }

.values { border-collapse: collapse; width: 100%; min-width: max-content; border: 1px solid var(--ui-border); font-family: var(--font-mono); font-size: 13px; }
.values th { text-align: left; background: var(--ui-subtle); color: var(--ui-text-2); font-weight: 500; height: 32px; border-bottom: 1px solid var(--ui-border); padding: 0 12px; white-space: nowrap; }
.values td { height: var(--row-height); padding: 6px 12px; vertical-align: middle; min-width: 6ch; max-width: 32ch; }
.values tr + tr td { border-top: 1px solid var(--ui-border); }
.values .mk { width: 28px; min-width: 0; padding: 0 8px; text-align: center; font-weight: 600; }
.values tr.del { background: var(--diff-del-bg); }
.values tr.del + tr.del td { border-top-color: var(--diff-del-line); }
.values tr.add { background: var(--diff-add-bg); }
.values tr.upd { background: var(--diff-hold-bg); }
.values tr.del .mk { color: var(--diff-del-fg); }
.values tr.add .mk { color: var(--diff-add-fg); }
.values tr.upd .mk { color: var(--diff-hold-fg); }
.values tr.keep .mk { color: var(--ui-text-2); }
/* An update's changed cells: the value now struck through, the value it
   takes highlighted. */
.values td.was { text-decoration: line-through; text-decoration-color: var(--diff-del-fg); color: var(--ui-text-2); }
.values td.set { color: var(--diff-add-fg); font-weight: 500; box-shadow: inset 0 0 0 1px var(--diff-add-fg); }
.values td.hidden-value { color: var(--ui-text-2); letter-spacing: 0.1em; }
.values td.secret { color: var(--diff-hold-fg); }
.values td.key { color: var(--ui-text-2); }
/* A value over 1 MiB of text: its size and sha256 on two lines, muted. */
.values td.large { color: var(--ui-text-2); white-space: pre-line; overflow-wrap: anywhere; }
.values .why { font-family: var(--font-ui); font-size: 13px; color: var(--diff-hold-fg); min-width: 16ch; }
.values tr.unchecked .mk { box-shadow: inset 3px 0 0 var(--diff-hold-fg); }
/* "Changed by" on a revert of several agents: one cell per row, spanning
   its lines, a tag per agent (amber for one that did not ask). */
.values td.who { background: var(--ui-panel); white-space: nowrap; max-width: none; }
.values td.who .ag { margin-left: 0; }
.values td.who .ag + .ag { margin-left: 4px; }
/* Text an agent wrote: right-to-left letters in one value cannot reorder the
   text around it, and a value's spaces show as they are (two spaces are not
   one). Hidden characters are escaped as <U+XXXX> before they get here, and
   a long run of combining marks too; overflow: hidden clips what is left so
   nothing paints over a neighboring cell. */
.values td, .summary dd, .table-name, .headline, #cascade-text { unicode-bidi: isolate; }
.values td { white-space: pre; }
/* A short value never clips: the cell grows to its text and the table scrolls
   in .scroll. Only a long value (over 32 code points) is capped and wraps, so
   no approval value is ever clipped or hidden. */
.values td:not(.long) { max-width: none; }
.values td.long { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 32ch; }
.values td, .summary dd { overflow: hidden; }
/* Values, params, the statement and the intent show in the order they are
   stored, left to right, even with right-to-left letters in them:
   "ש 100 200" cannot read as "200 100 ש" (fidelity over readability).
   web/lib/display.test.mjs checks the selectors. */
.values td, #params, #statement, #intent, #settings { direction: ltr; unicode-bidi: isolate-override; }

/* The plugin approval page: what changes first, then the level's box (1
   calm, 2 one warning, 3 the strong warning with its tick), then the facts. */
.plugin-change { border-color: var(--ui-border-strong); }
.plugin-change-lead { font-weight: 600; }
.plugin-lines { display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; }
.plugin-level-line { font-weight: 500; }
.plugin-level.level-1 .plugin-level-line { color: var(--diff-add-fg); }
.plugin-level.level-2 { background: var(--diff-hold-bg); border-color: var(--diff-hold-fg); }
.plugin-level.level-2 .plugin-level-line { color: var(--diff-hold-fg); }
.plugin-level.level-3 { background: var(--diff-del-bg); border-color: var(--diff-del-fg); }
.plugin-level.level-3 .plugin-level-line { color: var(--diff-del-fg); font-weight: 600; }
.plugin-facts { gap: 16px; }
.plugin-row { display: flex; flex-direction: column; gap: 6px; }
.plugin-who { color: var(--ui-text-2); font-size: 13px; }
.plugin-settings { background: var(--ui-subtle); border: 1px solid var(--ui-border); border-radius: var(--radius-ui-sm); padding: 10px 12px; overflow-wrap: anywhere; }

/* Buttons: primary in ui-primary, a destructive confirm in diff-del-fg. */
button {
  font: inherit;
  font-weight: 600;
  background: var(--ui-primary);
  color: var(--ui-on-primary);
  border: 0;
  border-radius: var(--radius-ui-sm);
  padding: 0 18px;
  min-height: 44px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
/* A pressed button says it is working: a spinner in the text colour (so it shows on primary, secondary, danger and reject buttons, light and dark) and the working label, set by busy() in lib/page.js. */
button[aria-busy="true"] { display: inline-flex; align-items: center; justify-content: center; gap: 10px; opacity: 0.85; cursor: progress; }
button[aria-busy="true"]::before { content: ""; flex: none; width: 16px; height: 16px; box-sizing: border-box; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
@media (prefers-reduced-motion: reduce) { button[aria-busy="true"]::before { animation-duration: 2.5s; } }
button.danger { background: var(--diff-del-fg); color: var(--on-danger); }
button.secondary { background: var(--ui-panel); color: var(--ui-text); border: 1px solid var(--ui-border-strong); font-weight: 500; }
button.reject { color: var(--diff-del-fg); }
.reveal button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; font-size: 13px; }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }

textarea, input.text {
  width: 100%;
  background: var(--ui-subtle);
  color: var(--ui-text);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--radius-ui-sm);
  padding: 8px;
  word-break: break-all;
}

/* The decision: the cascade box, the passkey button, the signed hash. */
.confirm { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.confirm input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--diff-del-fg); }
.act-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sign-foot { border-top: 1px solid var(--ui-border); padding-top: 10px; font-size: 12px; color: var(--ui-text-2); }
.sign-foot:empty, #status:empty { display: none; }
#register, #sign { width: 100%; }

/* The connect page: one step per screen in a column that reads on a
   phone first and sits centred on a laptop. Warnings are coloured strips,
   not paragraphs. */
.connect-page .bar, .connect-page .page { max-width: 480px; }
.connect-page main { gap: 12px; }
.connect-page .screen { display: flex; flex-direction: column; gap: 12px; }
.connect-page .screen > button, .connect-page .stack > button { width: 100%; }
.connect-page .stack { display: flex; flex-direction: column; gap: 8px; }
.connect-page .box { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.connect-page .center { text-align: center; }
.connect-page .mono { font-family: var(--font-mono); unicode-bidi: isolate; overflow-wrap: anywhere; }
.connect-page .small { font-size: 12px; }
.strip { border-radius: var(--radius-ui-sm); padding: 8px 10px; font-size: 13px; border: 1px solid transparent; white-space: pre-line; overflow-wrap: anywhere; }
.strip.warn { background: var(--diff-hold-bg); color: var(--diff-hold-fg); border-color: var(--diff-hold-fg); }
.strip.bad { background: var(--diff-del-bg); color: var(--diff-del-fg); border-color: var(--diff-del-fg); }
.strip.ok { background: var(--diff-add-bg); color: var(--diff-add-fg); border-color: var(--diff-add-fg); }
.strip.box-action { white-space: normal; display: grid; gap: 8px; }
.strip.box-action > p { margin: 0; }
.strip.box-action > button { justify-self: start; min-height: 36px; }
.connect-page .done-title { font-size: 15px; font-weight: 600; }
.nav-row { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.nav-row:not(:has(> :not([hidden]))) { display: none; }
.steps { display: flex; gap: 4px; flex: 1; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--ui-border); }
.steps span.on { background: var(--ui-focus); }
button.back { min-height: 32px; padding: 0 8px; background: transparent; color: var(--ui-primary); font-weight: 500; }
button.link { min-height: 0; padding: 0; background: transparent; color: var(--ui-primary); font-weight: 500; text-decoration: underline; }
.connect-page button.reject { color: var(--diff-del-fg); border-color: var(--diff-del-fg); }
.bot { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--ui-primary); color: var(--ui-on-primary); display: grid; place-items: center; font-weight: 600; font-size: 18px; flex: none; }
.bot h1 { overflow-wrap: anywhere; }
.fp { display: block; font-family: var(--font-mono); font-size: 20px; font-weight: 500; letter-spacing: 0.04em; user-select: all; overflow-wrap: anywhere; }
.more summary { cursor: pointer; color: var(--ui-text-2); font-size: 13px; }
.more ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.more .rows { padding: 0; }
.secret-field { display: flex; gap: 6px; }
.secret-field input { flex: 1; min-width: 0; }
button.icon-btn { min-height: 44px; min-width: 44px; padding: 0; display: grid; place-items: center; }
.icon-btn .eye-closed, .icon-btn[aria-pressed="true"] .eye-open { display: none; }
.icon-btn[aria-pressed="true"] .eye-closed { display: block; }
.checks { list-style: none; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check::before { content: ""; width: 14px; height: 14px; flex: none; }
.check.gone::before { content: "✕"; color: var(--diff-del-fg); font-weight: 700; text-align: center; line-height: 14px; }
.check.ok::before { content: "✓"; color: var(--diff-add-fg); font-weight: 700; text-align: center; line-height: 14px; }
.check.wait::before { border: 2px solid var(--ui-focus); border-right-color: transparent; border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .check.wait::before { animation: none; border-right-color: var(--ui-focus); opacity: 0.5; } }
.db-card { border: 2px solid var(--ui-primary); }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ui-text-2); }
.db-name { font-family: var(--font-mono); font-size: 22px; font-weight: 500; overflow-wrap: anywhere; unicode-bidi: isolate; }
.reach-ok { color: var(--diff-add-fg); font-size: 13px; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; align-items: start; }
.tick { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; padding: 4px 0; font-size: 13px; }
.tick input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--ui-primary); }
.tick .muted { font-size: 12px; }
/* The local setup page's tables: a wider cell for the Read / Read + change
   switch of each ticked table. */
.access-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.seg { display: inline-flex; border: 1px solid var(--ui-border-strong); border-radius: var(--radius-ui-sm); overflow: hidden; margin-left: auto; }
.seg button { min-height: 28px; padding: 0 8px; font-size: 12px; font-weight: 500; border: 0; border-radius: 0; background: var(--ui-subtle); color: var(--ui-text-2); }
.seg button + button { border-left: 1px solid var(--ui-border-strong); }
.seg button[aria-pressed="true"] { background: var(--ui-primary); color: var(--ui-on-primary); }
.seg button:disabled { opacity: 0.5; }
.label-tables { display: flex; flex-direction: column; gap: 8px; }
.label-table { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 8px 12px; }
.label-table summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 4px; list-style: none; }
.label-table summary::-webkit-details-marker { display: none; }
.label-table summary::before { content: "▸"; color: var(--ui-text-2); width: 1em; flex: none; }
.label-table[open] summary::before { content: "▾"; }
.label-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 0; border-top: 1px solid var(--ui-border); }
.label-row .col-name { flex: 1 1 8rem; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.label-row select { font: inherit; font-size: 13px; min-height: 36px; width: 100%; background: var(--ui-subtle); color: var(--ui-text); border: 1px solid var(--ui-border-strong); border-radius: var(--radius-ui-sm); padding: 0 6px; }
.label-row input.region { width: 4.5em; text-transform: uppercase; padding: 6px; }
/* One width for every picker, wide enough for "Personal: address
   (suggested)", at the row's right edge; the country box and the
   suggestion go under it, right-aligned. */
.label-pick { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; width: 14.5rem; max-width: 100%; margin-left: auto; }
.label-suggested { font-size: 12px; color: var(--ui-text-2); text-align: right; }
.rest-choice { margin: 0; min-width: 0; }
.rest-choice legend { float: left; width: 100%; padding: 0; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.rest-note { display: flex; flex-direction: column; gap: 2px; margin: 0 0 0 26px; font-size: 12px; color: var(--ui-text-2); overflow-wrap: anywhere; }
.label-fixed-line { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.label-fixed { font-size: 12px; border-radius: 10px; padding: 1px 8px; background: var(--ui-subtle); color: var(--ui-text-2); }

/* Lists of the other pages (passkeys): one bordered line each. */
.rows { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.row { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 12px; overflow-x: auto; }
.row-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }

/* The revert page: the rows on the left, the scope and the decision on
   the right; on a phone, the decision in a bar fixed to the bottom and the
   scope and the Reject note in sheets over the page. */
.revert-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.revert-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ag { font-family: var(--font-mono); font-size: 13px; padding: 0 6px; border-radius: var(--radius-ui-sm); background: var(--ui-subtle); border: 1px solid var(--ui-border); color: var(--ui-text); margin-left: auto; unicode-bidi: isolate; }
.ag.other { background: var(--diff-hold-bg); color: var(--diff-hold-fg); border-color: transparent; }

.decision { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; }
.decision-bar, .note-sheet { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sum { color: var(--ui-text-2); font-size: 13px; }
.acts { display: flex; flex-direction: column; gap: 8px; }
.acts button { width: 100%; }
.note-label { display: block; font-size: 12px; font-weight: 500; color: var(--ui-text-2); }
.note-sheet textarea { font-family: var(--font-ui); font-size: 14px; word-break: normal; background: var(--ui-panel); min-height: 5rem; }
.hint { display: flex; gap: 8px; font-size: 12px; color: var(--ui-text-2); }
.hint span:last-child { margin-left: auto; }
.grab { display: none; }
.dim { display: none; }
.code-label { font-weight: 600; }

/* The scope (owner decision, Nov 12): chips, runs and the widen, in the
   decision column on a wide screen, in a bottom sheet on a phone. */
.scope-panel { background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 16px; }
.plab { font-size: 12px; font-weight: 500; color: var(--ui-text-2); margin: 0 0 8px; }
.plab small { font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
button.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 1px solid var(--ui-border-strong); border-radius: var(--radius-ui-sm); background: var(--ui-panel); color: var(--ui-text); font-weight: 400; font-size: 13px; }
button.chip.on { border-color: var(--ui-focus); background: var(--ui-subtle); }
button.chip.other { color: var(--diff-hold-fg); }
button.chip:disabled { opacity: 1; cursor: default; }
button.chip .mono { font-family: var(--font-mono); font-size: 13px; unicode-bidi: isolate; }
.tk { width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--ui-border-strong); font-size: 11px; display: grid; place-items: center; flex: none; }
.chip.on .tk { background: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-on-primary); }
.runs { display: flex; flex-direction: column; border: 1px solid var(--ui-border); border-radius: var(--radius-ui-sm); margin-bottom: 12px; overflow: hidden; }
.runs button.chip { width: 100%; border: 0; border-top: 1px solid var(--ui-border); border-radius: 0; min-height: 40px; }
.runs button.chip:first-child { border-top: 0; }
.runs button.chip .w { margin-left: auto; color: var(--ui-text-2); font-size: 13px; }
button.widen { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 56px; border: 1px dashed var(--ui-border-strong); border-radius: var(--radius-ui-sm); background: transparent; color: var(--ui-text); padding: 8px 12px; text-align: left; font-weight: 400; margin-bottom: 12px; }
.plus { width: 28px; height: 28px; border-radius: var(--radius-ui-sm); background: var(--ui-subtle); border: 1px solid var(--ui-border); display: grid; place-items: center; font-weight: 600; flex: none; }
.widen .t { display: block; font-weight: 600; }
.widen .s { display: block; color: var(--ui-text-2); font-size: 12px; }
#scope-status:empty { display: none; }
.scope-line, .scope-done { display: none; }

/* Phone: a 16px gutter, one column, tables scroll in their box. */
@media (max-width: 760px) {
  .panel { padding: 16px; }
  .changes { padding: 0; }
  .panel-head, .reveal, .group { padding-left: 16px; padding-right: 16px; }
  .panel-note { text-align: left; margin-left: 0; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .summary > div.wide { grid-column: auto; }
  .act-row button { width: 100%; }

  .crumb { display: none; }
  .revert-grid { display: block; padding-bottom: 9rem; }
  .decision { position: static; }
  .decision-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; border-radius: 0; border-width: 1px 0 0; padding: 10px 16px 14px; gap: 6px; }
  .decision-bar .sum { font-size: 12px; }
  .decision-bar .acts { flex-direction: row-reverse; }
  .decision-bar #sign { flex: 1; }
  .decision-bar #reject { width: auto; }
  .decision-bar .sign-foot, .decision-bar #decline { display: none; }
  .note-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; border-radius: var(--radius-ui) var(--radius-ui) 0 0; max-height: 85vh; overflow-y: auto; }
  .note-sheet .acts { flex-direction: row-reverse; }
  .note-sheet .acts #reject-send { flex: 1; }
  .note-sheet .acts #reject-cancel { width: auto; }
  .grab { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--ui-border-strong); margin: 0 auto 8px; }
  .dim { display: block; position: fixed; inset: 0; z-index: 3; background: var(--dim); }

  button.scope-line { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; background: var(--ui-panel); color: var(--ui-text); border: 1px solid var(--ui-border-strong); border-radius: var(--radius-ui-sm); padding: 8px 12px; text-align: left; font-weight: 400; font-size: 13px; }
  .scope-line b { display: block; font-size: 14px; }
  .scope-line .s { color: var(--ui-text-2); }
  .scope-line .ed { margin-left: auto; color: var(--ui-primary); font-weight: 600; }
  .scope-panel { display: none; }
  .scope-panel.open { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; margin: 0; border-radius: var(--radius-ui) var(--radius-ui) 0 0; max-height: 85vh; overflow-y: auto; }
  button.scope-done { display: block; width: 100%; }
}

/* The connect page's two tabs: Connect a bot and Remove BasaltDB. */
.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--ui-border); }
.tabs [role="tab"] { min-height: 40px; padding: 0 14px; background: transparent; color: var(--ui-text-2); border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-weight: 500; }
.tabs [role="tab"][aria-selected="true"] { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }
pre.sql { white-space: pre-wrap; word-break: break-word; font-size: 0.85em; }

/* The setup page's Update check (CONTRACT.md, The Update check): one row
   per finding, a mark, its words and its action; and the passkey list. */
.check-row { display: flex; align-items: flex-start; gap: 10px; background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 10px 12px; }
.check-row .mark { width: 16px; flex: none; font-weight: 700; text-align: center; }
.check-row.critical { border-color: var(--diff-del-fg); }
.check-row.critical .mark { color: var(--diff-del-fg); }
.check-row.warning .mark { color: var(--diff-hold-fg); }
.check-row button.fix { padding: 6px 12px; background: var(--ui-primary); color: var(--ui-on-primary, #fff); border-radius: var(--radius-ui-sm); }
#u-end[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.allset-mark { font-size: 32px; color: var(--diff-add-fg); margin: 0; }
.check-row.good .mark { color: var(--diff-add-fg); }
.check-row.later .mark { color: var(--ui-text-2); }
.check-row .words { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.check-row .words strong { font-size: 14px; overflow-wrap: anywhere; }
.check-row .words span { font-size: 13px; color: var(--ui-text-2); overflow-wrap: anywhere; }
.check-row button { min-height: 0; padding: 0; margin-left: auto; background: transparent; color: var(--ui-primary); border: 0; font-weight: 600; font-size: 13px; white-space: nowrap; }
.check-row button.remove { padding: 4px 10px; color: var(--diff-del-fg); border: 1px solid var(--diff-del-fg); border-radius: var(--radius-ui-sm); background: var(--ui-panel); }
/* The connect page's Update check: one bordered row per finding, a mark,
   the finding and its action; the passkey list in the same rows. */
.connect-page .doc-top { margin: 0; }
.connect-page .fix-rows { display: flex; flex-direction: column; gap: 8px; }
.connect-page .fix-row { display: flex; align-items: flex-start; gap: 10px; background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 10px 12px; }
.connect-page .fix-mark { width: 16px; flex: none; font-weight: 700; }
.connect-page .fix-row.warn .fix-mark { color: var(--diff-hold-fg); }
.connect-page .fix-row.good .fix-mark { color: var(--diff-add-fg); }
.connect-page .fix-body { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.connect-page .fix-body strong { font-size: 14px; }
.connect-page .fix-body .muted { font-size: 13px; }
.connect-page .fix-act { margin-left: auto; white-space: nowrap; text-decoration: none; font-weight: 600; }
.connect-page .pk-row { align-items: center; }
.connect-page .pk-remove { margin-left: auto; flex: none; min-height: 32px; padding: 0 10px; background: var(--ui-panel); color: var(--diff-del-fg); border: 1px solid var(--diff-del-fg); font-weight: 600; }
.connect-page .revoke-lines { list-style: none; margin: 0; font-size: 14px; }
.connect-page .small-fp { font-size: 15px; }
.connect-page .cert-box p { margin: 0; }
.connect-page .cert-new { font-weight: 600; overflow-wrap: anywhere; }
.connect-page .cert-was { color: var(--ui-text-2); font-size: 13px; overflow-wrap: anywhere; }
/* The confirm step, "Is this your database?" (confirm.js). */
.id-facts { display: flex; flex-direction: column; gap: 6px; }
.id-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.id-facts span { color: var(--ui-text-2); flex: none; }
.id-facts strong { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.id-facts strong.same, .ok-line { color: var(--diff-add-fg); }
.id-facts strong.diff { color: var(--diff-del-fg); }
.ok-line { font-size: 14px; font-weight: 600; }
#s-confirm button.link { display: block; margin: 12px auto 0; }

/* The home page at the root of the local pages. */
.home-title { display: flex; align-items: center; gap: 10px; font-size: 26px; }
.home-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--diff-add-fg); box-shadow: 0 0 0 4px var(--diff-add-bg); }
.home-sub { font-size: 15px; }
.home-sub strong { color: var(--ui-text); font-weight: 600; }
.home-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.home-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; background: var(--ui-panel); border: 1px solid var(--ui-border); border-radius: var(--radius-ui); padding: 10px 14px; }
.home-row b { display: block; font-weight: 600; }
.home-mark { font-weight: 700; }
.home-row.ok .home-mark { color: var(--diff-add-fg); }
.home-row.need .home-mark { color: var(--diff-hold-fg); }
.home-row.unknown .home-mark { color: var(--ui-text-2); }
.home-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; font-weight: 600; }
a.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; font-weight: 600; text-decoration: none; background: var(--ui-primary); color: var(--ui-on-primary); border-radius: var(--radius-ui-sm); }
