/* Theme: a light product surface with one dark navigation rail. Every colour in
   this sheet comes from the tokens below — nothing further down carries a hex. */
:root {
  /* surfaces */
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --line: #e5e8ec;
  --line-2: #d7dce3;
  --hover: #f3f4f6;
  /* text */
  --ink: #111826;
  --muted: #6b7482;
  --faint: #98a1af;
  /* accent — light green for borders and fills, deep green wherever it is text */
  --accent: #0e9f6e;
  --accent-ink: #07724d;
  --accent-dim: #e7f7f0;
  --accent-line: #b7e6d1;
  /* semantics */
  --warn: #b45309;
  --warn-dim: #fdf3e3;
  --warn-line: #f3ddb4;
  --buyer: #2563eb;
  --dealerA: #7c3aed;
  --dealerB: #d92d20;
  --leak-dim: #fdeceb;
  --leak-line: #f6cfcb;
  --info-dim: #e8f0fe;
  --info-ink: #1d4ed8;
  --on-count: rgba(255, 255, 255, .18);
  /* dark rail */
  --rail: #0e1116;
  --rail-2: #1b212a;
  --rail-3: #151a21;
  --rail-line: #232a34;
  --rail-ink: #eef1f5;
  --rail-muted: #9aa3b0;
  /* shape */
  --radius: 10px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(17, 24, 38, .05);
  --shadow-pop: 0 8px 24px rgba(17, 24, 38, .12), 0 1px 3px rgba(17, 24, 38, .08);
  /* production shell: a brighter accent for fills on the dark rail (the deep
     --accent-ink reads as a hole there), and the dialog backdrop. */
  --accent-hi: #12b87f;
  --scrim: rgba(9, 12, 17, .55);
  --shadow-modal: 0 18px 48px rgba(9, 12, 17, .28), 0 2px 8px rgba(9, 12, 17, .16);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* a11y: a visible keyboard-focus ring, and respect reduced-motion. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.mono, .pid, .list.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.brand .dot { color: var(--accent); }
.tag { color: var(--muted); font-style: italic; }
.ledger { margin-left: auto; font-size: 12px; color: var(--muted); }
.ledger.ok { color: var(--accent-ink); }
.ledger.err { color: var(--dealerB); }
.ledger.warn { color: var(--warn); }

.desk {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); min-height: calc(100vh - 160px);
}
@media (max-width: 900px) { .desk { grid-template-columns: 1fr; } }
.form input { max-width: 100%; }
.panel { background: var(--panel); display: flex; flex-direction: column; }
.panel[data-role="buyer"] { border-top: 3px solid var(--buyer); }
.panel[data-role="dealerA"] { border-top: 3px solid var(--dealerA); }
.panel[data-role="dealerB"] { border-top: 3px solid var(--dealerB); }

.phead {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.who { font-weight: 600; font-size: 15px; }
.pid { color: var(--muted); font-size: 11px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbody { padding: 18px; display: flex; flex-direction: column; gap: 22px; }

.block h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.block h3 .hint { color: var(--muted); font-weight: 400; }
.form { display: flex; flex-direction: column; gap: 9px; }
.form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.form input {
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
  padding: 7px 10px; border-radius: var(--radius); width: 130px; font: inherit;
}
.form input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
button {
  background: var(--accent-ink); color: var(--panel); border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 13px; font-weight: 600; cursor: pointer; font: inherit;
  transition: background .12s ease, border-color .12s ease;
}
button:hover:not(:disabled) { background: var(--accent); }
button:disabled { background: var(--panel-2); color: var(--faint); border-color: var(--line); cursor: not-allowed; }
button.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); font-weight: 500; }
button.ghost:hover:not(:disabled) { background: var(--hover); border-color: var(--muted); }
button.ghost:disabled { background: var(--panel-2); color: var(--faint); border-color: var(--line); }
button.award { width: 100%; margin-top: 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.empty { color: var(--muted); font-size: 12px; padding: 8px 0; }
.card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; font-size: 13px;
}
.card .price { font-weight: 700; font-size: 15px; }
.card.win { border-color: var(--accent); background: var(--accent-dim); }
.card.win .price { color: var(--accent-ink); }
.card .row { display: flex; justify-content: space-between; }
.card .sub { color: var(--muted); font-size: 11px; }

.blind {
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 16px;
  background: var(--panel-2);
  color: var(--muted); font-size: 12px; text-align: center; font-style: italic;
}

.foot { border-top: 1px solid var(--line); background: var(--panel); padding: 16px 22px; }
.privacy-note { color: var(--muted); font-size: 12px; max-width: 900px; }
.reg { margin-top: 8px; font-size: 12px; color: var(--warn); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line-2); color: var(--ink);
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px; opacity: 0;
  box-shadow: var(--shadow-pop);
  transition: opacity .2s; pointer-events: none; max-width: 80vw;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--leak-line); background: var(--leak-dim); color: var(--dealerB); }
/* Errors wait to be dismissed: 2.6s is not long enough to read a ledger error,
   and a message that erases itself reads as "nothing happened". */
.toast.sticky { pointer-events: auto; cursor: pointer; }
.toast.sticky::after { content: " (click to dismiss)"; color: var(--muted); }
.rfq-table tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- app shell (app.html): dark rail + light main ---- */
body.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  background: var(--rail); border-right: 1px solid var(--rail);
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 16px; position: sticky; top: 0; height: 100vh;
}
.side-brand {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
  color: var(--rail-ink); text-decoration: none;
}
.side-brand .dot { color: var(--accent); }
.side-net { font-size: 10.5px; letter-spacing: .12em; color: var(--rail-muted); line-height: 1.7; }
.side-net span { color: var(--faint); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--rail-muted); font-size: 13.5px; text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.side-nav a .ic { width: 16px; text-align: center; opacity: .75; font-size: 13px; }
.side-nav a:hover { background: var(--rail-3); color: var(--rail-ink); }
.side-nav a.on { background: var(--rail-2); color: var(--rail-ink); font-weight: 600; }
.side-nav a.on .ic { opacity: 1; color: var(--accent); }
.side-sep { height: 1px; background: var(--rail-line); margin: 8px 6px; }
/* In-desk nav: smooth-scroll to a section, leaving a little breathing room at the
   top so it doesn't butt against the topbar. (reduced-motion is honoured by the
   global * { scroll-behavior: auto } rule above.) */
html { scroll-behavior: smooth; }
#top, #nav-rfq, #nav-settle, #nav-audit { scroll-margin-top: 76px; }

/* "How to drive it" guide strip under the stats row. */
.howto { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  padding: 11px 22px; font-size: 12.5px; color: var(--muted);
  background: var(--panel-2); border-bottom: 1px solid var(--line); }
.howto strong { color: var(--ink); font-weight: 600; }
.howto span { display: inline-flex; align-items: center; gap: 7px; }
.howto b { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
  border-radius: var(--radius-pill); background: var(--accent-dim); color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.howto em { color: var(--ink); font-style: normal; font-weight: 600; }
.howto i { color: var(--muted); }
.howto-x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 4px; }
.howto-x:hover { color: var(--ink); background: none; }

/* Audit-trail view (sidebar → Audit trail): the regulator's post-trade record. */
.audit-view { flex: 1; padding: 26px 28px; overflow-y: auto; }
.audit-title { font-size: 17px; font-weight: 600; margin: 0; }
.audit-title .hint { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 5px; }
table.audit {
  width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 16px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
table.audit th, table.audit td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); }
table.audit th { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; background: var(--panel-2); }
table.audit tbody tr:last-child td { border-bottom: 0; }
table.audit tbody tr:hover td { background: var(--hover); }
table.audit td.num, table.audit td.mono { font-family: ui-monospace, Menlo, monospace; }
table.audit th.num { text-align: right; }
table.audit td.num { text-align: right; }
table.audit td.mono { color: var(--muted); }
table.audit td.hi { color: var(--ink); font-weight: 600; }
table.audit td#create-modes .mode { color: var(--accent-ink); font-size: 12px; }
table.audit tr.sel td { background: var(--accent-dim); }
table.audit tr.sel:hover td { background: var(--accent-dim); }
table.audit tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
table.audit td button.ghost { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.audit-empty { color: var(--muted); margin-top: 18px; }

/* Every RFQ this party can see, filtered by a chip row. */
.rfq-table tbody tr { cursor: pointer; }
.rfq-bar { display: flex; align-items: baseline; gap: 16px; margin-top: 18px; }
.rfq-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rfq-chip {
  background: var(--panel); color: var(--muted); border: 1px solid var(--line-2);
  border-radius: var(--radius-pill); padding: 5px 12px; font-size: 12.5px; font-weight: 500;
}
.rfq-chip:hover:not(:disabled) { background: var(--hover); color: var(--ink); border-color: var(--muted); }
.rfq-chip span {
  color: var(--muted); background: var(--hover); margin-left: 7px;
  padding: 1px 6px; border-radius: var(--radius-pill); font-size: 11px; font-variant-numeric: tabular-nums;
}
.rfq-chip.on { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.rfq-chip.on:hover { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.rfq-chip.on span { background: var(--on-count); color: var(--panel); }
.rfq-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.rfq-search {
  flex: 0 1 220px; min-width: 140px; font: inherit; font-size: 13px;
  padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink);
}
.rfq-search::placeholder { color: var(--faint); }
.rfq-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
/* The whole row is a target, not just its button. */
.rfq-table tbody tr { cursor: pointer; }
/* Ten columns do not fit a laptop in portrait or a phone at all: let the table
   scroll inside its own box rather than pushing the page sideways. */
#rfq-table, #audit-table { overflow-x: auto; }
#rfq-table table, #audit-table table { min-width: 900px; }
table.audit td .sub { font-size: 11px; color: var(--muted); }

/* Status pills in the RFQ table. */
.pill {
  display: inline-block; border-radius: var(--radius-pill); padding: 3px 10px;
  font-size: 11.5px; font-weight: 500; line-height: 1.5; white-space: nowrap;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.pill.ok { background: var(--accent-dim); color: var(--accent-ink); border-color: var(--accent-line); }
.pill.live { background: var(--info-dim); color: var(--info-ink); border-color: var(--info-dim); }
.pill.wait { background: var(--hover); color: var(--muted); border-color: var(--line); }

/* Portfolio view: holdings per party, aggregated by instrument. */
.pf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 380px)); gap: 16px; margin-top: 18px; }
.pf-col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.pf-col h3 { margin: 0 0 6px; font-size: 14px; }
.pf-col .pid { display: block; font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.pf-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pf-row:last-child { border-bottom: 0; }
.pf-row .num { font-family: ui-monospace, Menlo, monospace; }
@media (max-width: 760px) { .pf-grid { grid-template-columns: 1fr; } }
.pf-registry { margin-top: 30px; }
.pf-reg-title { margin: 0 0 10px; font-size: 15px; color: var(--ink); }
.pf-reg-title .hint { font-weight: 400; color: var(--muted); }

/* Verify-privacy view: a live on-ledger proof. */
.vf-verdict { font-size: 22px; font-weight: 700; color: var(--muted); margin-top: 22px; }
.vf-verdict.ok { color: var(--accent-ink); }
.vf-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; max-width: 1150px; }
.vf-row { display: flex; align-items: center; gap: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.vf-name { width: 200px; font-weight: 600; color: var(--ink); font-size: 15px; }
.vf-detail { flex: 1; color: var(--muted); font-size: 14px; line-height: 1.5; }
.vf-detail b { color: var(--ink); font-family: ui-monospace, Menlo, monospace; }
.vf-badge { width: 34px; height: 34px; flex-shrink: 0; border-radius: var(--radius-pill); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.vf-badge.ok { background: var(--accent-dim); color: var(--accent-ink); }
.vf-badge.bad { background: var(--leak-dim); color: var(--dealerB); }
.vf-note { margin-top: 22px; max-width: 1050px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.vf-note code { font-family: ui-monospace, Menlo, monospace; color: var(--accent-ink); background: var(--accent-dim); padding: 1px 5px; border-radius: 4px; }
/* Out-of-the-box: the "what a public chain would leak" contrast panel. */
.vf-contrast { margin-top: 40px; max-width: 1150px; border-top: 1px solid var(--line); padding-top: 28px; }
.vf-contrast h3 { font-size: 17px; color: var(--ink); margin: 0 0 18px; }
.vf-tally { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.vf-stat { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; color: var(--muted); font-size: 13.5px; line-height: 1.45; background: var(--panel); }
.vf-stat .vf-num { font-size: 40px; font-weight: 800; font-family: ui-monospace, Menlo, monospace; line-height: 1; }
.vf-stat.leak { background: var(--leak-dim); border-color: var(--leak-line); } .vf-stat.leak .vf-num { color: var(--dealerB); }
.vf-stat.safe { background: var(--accent-dim); border-color: var(--accent-line); } .vf-stat.safe .vf-num { color: var(--accent-ink); }
.vf-cmp {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.vf-cmp th { text-align: left; color: var(--muted); font-weight: 600; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; background: var(--panel-2); }
.vf-cmp td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.vf-cmp tr:last-child td { border-bottom: 0; }
.vf-cmp td.k { color: var(--ink); font-weight: 600; width: 30%; }
.vf-cmp td.leak { color: var(--dealerB); }
.vf-cmp td.safe { color: var(--accent-ink); }
/* Provable best-execution view. */
.be-intro { max-width: 1050px; color: var(--muted); font-size: 14px; line-height: 1.6; margin: 18px 0 26px; }
.be-intro b { color: var(--ink); }
.be-card { max-width: 1000px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px; background: var(--panel); box-shadow: var(--shadow); }
.be-card.ok { border-color: var(--accent-line); }
.be-card.warn { border-color: var(--warn-line); }
.be-head { font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.be-head .hint { color: var(--muted); font-weight: 400; }
.be-verdict { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); }
.be-verdict.ok { background: var(--accent-dim); color: var(--accent-ink); }
.be-verdict.warn { background: var(--warn-dim); color: var(--warn); }
.be-tbl { width: 100%; border-collapse: collapse; margin: 14px 0 8px; font-size: 13px; }
.be-tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 12px; border-bottom: 1px solid var(--line); font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; }
.be-tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.be-tbl td.num { font-family: ui-monospace, Menlo, monospace; }
.be-tbl tr.be-win td { color: var(--accent-ink); font-weight: 600; }
.be-tbl tr.be-ok td { color: var(--ink); }
.be-tbl tr.be-bad td { color: var(--dealerB); }
.be-tag { font-size: 10px; background: var(--accent-dim); color: var(--accent-ink); padding: 1px 6px; border-radius: var(--radius-pill); font-weight: 700; vertical-align: middle; }
.be-note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.be-card.none { border-style: dashed; background: var(--panel-2); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side .ledger {
  margin: 0; font-size: 11px; color: var(--rail-muted);
  border: 1px solid var(--rail-line); border-radius: var(--radius-sm); padding: 7px 9px; background: var(--rail-3);
}
.side .ledger::before { content: "● "; color: var(--warn); }
.side .ledger.ok { color: var(--rail-muted); }
.side .ledger.ok::before { color: var(--accent); }
.side .ledger.err { color: var(--rail-muted); }
.side .ledger.err::before { color: var(--dealerB); }
.side-lens { font-size: 11px; color: var(--rail-muted); line-height: 1.5; }

.main { display: flex; flex-direction: column; min-width: 0; }
body.app .topbar { justify-content: space-between; }
.topbar-cta { color: var(--muted); font-size: 12px; text-decoration: none; }
.topbar-cta:hover { color: var(--ink); }
body.app .desk { min-height: 0; flex: 1; }

/* KPI stat tiles — one glanceable dashboard row over live ledger state. */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.stat { background: var(--panel); padding: 13px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 19px; font-weight: 700; color: var(--ink); }
.stat .l { font-size: 10.5px; color: var(--muted); letter-spacing: .07em; text-transform: uppercase; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 760px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .side-net, .side-lens { display: none; }
  .side-nav { flex-direction: row; flex-wrap: wrap; margin-left: auto; }
  .side-foot { margin: 0; }
}

/* ============================================================
   Production shell: rail CTA, identity block, dialogs, the
   create page. Everything below is light-on-dark inside .side
   and dark-on-white everywhere else.
   ============================================================ */

/* The one primary action on the page. Sits between the brand block and the nav,
   so it is filled with the bright accent rather than the deep --accent-ink,
   which would disappear into the rail. */
.side-cta {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--panel);
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; letter-spacing: -.01em;
}
.side-cta span { font-size: 15px; line-height: 1; }
.side-cta:hover:not(:disabled) { background: var(--accent-hi); }
.side-cta:active:not(:disabled) { background: var(--accent-ink); }
.side-cta:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }

/* Signed-in identity, pinned to the bottom of the rail. */
.ident {
  display: flex; flex-direction: column; gap: 7px;
  background: var(--rail-3); border: 1px solid var(--rail-line);
  border-radius: var(--radius-sm); padding: 10px;
}
.ident-label {
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--rail-muted);
}
/* ponytail: native select arrow kept — restyling the closed control is enough to
   fix white-on-white here; a custom caret would mean an inline SVG for no gain. */
.ident-select {
  width: 100%; font: inherit; font-size: 12.5px;
  background: var(--rail-2); color: var(--rail-ink);
  border: 1px solid var(--rail-line); border-radius: var(--radius-sm);
  padding: 7px 8px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.ident-select:hover { border-color: var(--rail-muted); }
.ident-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
/* Popup list: some platforms fall back to the system default here, so name both. */
.ident-select option { background: var(--rail-2); color: var(--rail-ink); }
.ident-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ident-bal {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px; font-weight: 700; color: var(--rail-ink);
  font-variant-numeric: tabular-nums;
}
.ident-pid {
  font-size: 10.5px; color: var(--rail-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- dialogs ---- */
.modal-host {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: var(--scrim);
}
.modal-host[hidden] { display: none; }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-modal);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-x {
  margin-left: auto; background: none; border: 0; padding: 0 4px;
  color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.modal-x:hover:not(:disabled) { background: none; color: var(--ink); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body > *:first-child { margin-top: 0; }
.modal-body .form input { width: 100%; max-width: 180px; }
.modal-body table.audit { margin-top: 12px; font-size: 12.5px; }
.modal-body .list + .form, .modal-body .card + .form { margin-top: 14px; }

/* ---- create page: execution mode cards ---- */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 20px; max-width: 900px; }
#create-modes .mode {
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  text-align: left; padding: 18px 20px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); font-weight: 400;
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
#create-modes .mode:hover:not(:disabled) { background: var(--panel); border-color: var(--line-2); box-shadow: var(--shadow-pop); }
#create-modes .mode:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#create-modes .mode-n { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); font-weight: 700; }
#create-modes .mode h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
#create-modes .mode p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
#create-modes .mode-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; font-size: 11.5px; color: var(--muted); }
#create-modes .mode-facts span { display: inline-flex; align-items: baseline; gap: 6px; }
#create-modes .mode-facts b { color: var(--ink); font-weight: 600; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
/* Selected. Marked three ways — border, tint, and a tick on the caption — so it
   does not depend on colour alone. */
#create-modes .mode.on { border-color: var(--accent); background: var(--accent-dim); }
#create-modes .mode.on:hover:not(:disabled) { background: var(--accent-dim); border-color: var(--accent); }
#create-modes .mode.on h3 { font-weight: 700; }
#create-modes .mode.on .mode-n::after { content: " ✓ selected"; }
#create-modes .mode.on .mode-facts b { color: var(--accent-ink); }

/* ---- create page: the terms form ---- */
.create-form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px; align-items: end;
  max-width: 900px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line);
}
.create-form label {
  display: flex; flex-direction: column; gap: 5px;
  color: var(--muted); font-size: 12px; justify-content: flex-start;
}
.create-form input, .create-form select {
  width: 100%; max-width: none; font: inherit; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 8px 10px;
}
.create-form input:focus, .create-form select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.create-form p, .create-form .hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.create-form button { grid-column: 1 / -1; justify-self: start; padding: 9px 18px; }

/* Session log: the table or the empty line, plus a scroll floor on narrow screens. */
#activity-body { overflow-x: auto; }
#activity-body .audit-empty { margin-top: 14px; }

@media (max-width: 760px) {
  .side-cta { width: auto; flex: 0 0 auto; order: 2; }
  .side-foot { flex: 1 1 100%; }
  .ident { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
  .ident-label { flex: 0 0 100%; }
  .ident-select { width: auto; flex: 1 1 160px; }
  .ident-pid { flex: 1 1 100%; }
  .modes { grid-template-columns: 1fr; }
  .create-form { grid-template-columns: 1fr; }
  .modal-host { padding: 12px; align-items: flex-end; }
  .modal { max-height: calc(100vh - 24px); }
}
