:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --border: #dfe3e8;
  --text: #1c2430;
  --muted: #667085;
  --accent: #1f6feb;
  --accent-soft: #e6f0ff;
  --ok: #1a7f37;
  --warn: #b26a00;
  --err: #c62828;
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", "Roboto", "Helvetica", "Arial", sans-serif;
  --radius: 8px;
  --topbar-h: 64px;
  --sidebar-w: 232px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --panel: #161c24; --border: #2a333f; --text: #e6ebf1; --muted: #93a0b0;
    --accent: #4c8dff; --accent-soft: #1b2a45;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--panel); border-radius: 6px; padding: 6px 12px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:disabled { opacity: .6; cursor: default; }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
button.tiny { padding: 2px 8px; font-size: 12px; }
input, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 20px; padding: 0 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 11.5px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: flex; align-items: flex-end; gap: 10px; flex: 1; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.field input, .field select { font-size: 13px; }
.field.grow { flex: 1; }
.token-wrap { display: flex; gap: 4px; }
.token-wrap input { flex: 1; font-family: var(--mono); }
.check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); padding-bottom: 7px; white-space: nowrap; }
.status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); min-width: 150px; justify-content: flex-end; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa4b2; flex: none; }
.status .status-text { max-width: 360px; text-align: right; } /* a proxy refusal's message wraps here, within the bar's height, rather than squeezing the form */
.status.ok .dot { background: var(--ok); } .status.err .dot { background: var(--err); } .status.busy .dot { background: var(--warn); }

/* layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--topbar-h)); }
.sidebar { border-right: 1px solid var(--border); background: var(--panel); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow: auto; }
.nav-group-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 8px 4px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--text); }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-path { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.nav-count { font-size: 11px; background: var(--bg); border: 1px solid var(--border); padding: 0 7px; border-radius: 10px; color: var(--muted); min-width: 22px; text-align: center; }
.nav-item.active .nav-count { border-color: var(--accent); color: var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding: 10px 8px 0; font-size: 12px; border-top: 1px solid var(--border); }
.content { padding: 22px 26px 60px; min-width: 0; }

/* family page */
.family-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.family-title { margin: 0 0 4px; font-size: 22px; }
.family-title code { font-size: 14px; color: var(--muted); margin-left: 8px; }
.family-desc { margin: 0; color: var(--muted); max-width: 900px; line-height: 1.45; }
.tabs { display: flex; gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.tab { border: none; background: transparent; padding: 5px 12px; border-radius: 6px; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.inline-field { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.inline-field input { width: 190px; }
.inline-field input.by-id { width: 110px; }
/* the Data tab's Filters row (contract 0.36.0): a control per filter the document declares,
   collapsed until a filter is in force; a chip per filter sent, with its clear */
details.filters { margin-bottom: 10px; }
details.filters summary { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
details.filters summary .chip { padding: 1px 8px; }
.filter-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 0 2px; }
.filter-controls .inline-field input { width: 120px; font-family: var(--mono); }
.filter-controls .inline-field select { max-width: 200px; }
.filter-controls input.invalid { border-color: var(--err); color: var(--err); }
.chip .chip-clear { all: unset; cursor: pointer; margin-left: 2px; padding: 0 4px; border-radius: 8px; line-height: 1; color: var(--muted); }
.chip .chip-clear:hover, .chip .chip-clear:focus-visible { background: var(--bg); color: var(--text); }

.meta-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; min-height: 26px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.chip.mono b { font-family: var(--mono); }
.chip.ok { border-color: #9fd7ae; color: var(--ok); } .chip.ok b { color: var(--ok); }
.chip.warn { border-color: #f0c674; color: var(--warn); } .chip.warn b { color: var(--warn); }
.chip.err { border-color: #f1a5a5; color: var(--err); } .chip.err b { color: var(--err); }
/* the Data tab's pager: the list's own pages, at the end of the meta strip */
.meta-strip .pager { display: inline-flex; gap: 6px; margin-left: auto; }
.pager button { padding: 3px 10px; font-size: 12px; }
.pager button:disabled { opacity: .45; cursor: default; }

.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid #f1a5a5; background: #fff2f2; color: var(--err); margin-bottom: 10px; line-height: 1.5; }
@media (prefers-color-scheme: dark) { .alert { background: #3a1c1c; } }
.alert code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }
.alert .alert-title { font-weight: 700; }

.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; cursor: help; }
/* a column the gateway sorts by (contract 0.31.0): a header that is a control — ascending,
   descending, then the collection's own order; the mark shows the order served */
th.sortable { cursor: default; padding: 0; }
th.sortable .sort-btn { all: unset; display: block; box-sizing: border-box; width: 100%; padding: 8px 10px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; user-select: none; }
th.sortable .sort-btn:hover { color: var(--text); }
th.sortable .sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
th.sortable .sort-mark { margin-left: 4px; font-size: 9px; opacity: .45; }
th.sortable.sorted .sort-btn { color: var(--text); }
th.sortable.sorted .sort-mark { opacity: 1; color: var(--accent); }
tbody tr:hover { background: var(--bg); }
tr.clickable { cursor: pointer; }
tr.row-deleted > td { opacity: .5; }
tr.row-deleted:hover > td { opacity: .8; }
td.key a { font-family: var(--mono); font-weight: 600; }
td .null { color: var(--muted); font-style: italic; }
td .bool-t { color: var(--ok); font-weight: 700; } td .bool-f { color: var(--muted); }
td .num, td .int64 { font-family: var(--mono); }
td .sub { display: block; color: var(--muted); font-size: 11px; }
/* an object or array served whole in a list cell (the approvals' before and after: the row as
   it stands and as proposed) wraps at 180ch instead of running the width of its JSON on one
   line. break-word, not anywhere: a list wider than the page shrinks every column to its
   narrowest, and `anywhere` makes that a sliver, while break-word keeps the JSON's own width
   up to the cap. The drawer's value column wraps already */
table:not(.detail-table) td code.json { display: block; max-width: 180ch; white-space: pre-wrap; overflow-wrap: break-word; }
.enum { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); }
.enum.e-active, .enum.e-verified { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.enum.e-pending_approval, .enum.e-draft, .enum.e-discovered, .enum.e-unverified { background: #fff6e0; color: var(--warn); border-color: #f0c674; }
.enum.e-suspended, .enum.e-frozen, .enum.e-revoked, .enum.e-retired { background: #fdecec; color: var(--err); border-color: #f1a5a5; }
.enum.e-unknown, .enum.e-none { color: var(--muted); }
/* a risk posture (contract 0.56.0): NORMAL, HEDGE_ONLY (reduce only), BLOCKED (cut only) */
.enum.e-normal { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.enum.e-hedge_only { background: #fff6e0; color: var(--warn); border-color: #f0c674; }
.enum.e-blocked { background: #fdecec; color: var(--err); border-color: #f1a5a5; }
/* a key's health (contract 0.21.0) and an account's connection reading (0.60.0): whether a connector is serving it, beside its status */
.health { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); background: var(--bg); white-space: nowrap; }
.health.h-serving { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.health.h-degraded, .health.h-stale, .health.h-unserved { background: #fff6e0; color: var(--warn); border-color: #f0c674; }
.health.h-down { background: #fdecec; color: var(--err); border-color: #f1a5a5; }
.health.h-none { color: var(--muted); }
.health-reading { display: block; }
.health-reading + .health-reading { margin-top: 3px; }
.health-reading .role { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-right: 5px; }
/* a user's or a role's granted bits: one line per family, the family then its verbs */
.scopes { display: flex; flex-wrap: wrap; gap: 3px 4px; width: max-content; max-width: 460px; white-space: normal; }
.scope-family { padding: 0 7px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.scope-family .role { color: var(--muted); margin-right: 5px; }
.approvals-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
/* the order lifecycle (orders-domain.md 3.2): the live band, the proven terminals, the provisional one */
.enum.e-queued, .enum.e-instructed { background: #fff6e0; color: var(--warn); border-color: #f0c674; }
.enum.e-open, .enum.e-partially_filled, .enum.e-filled { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.enum.e-canceled, .enum.e-rejected, .enum.e-expired, .enum.e-instruction_expired, .enum.e-not_found_at_venue { background: #fdecec; color: var(--err); border-color: #f1a5a5; }
.enum.e-expired_unconfirmed { background: #fff6e0; color: var(--err); border-color: #f0c674; }
.enum.e-buy { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.enum.e-sell { background: #fdecec; color: var(--err); border-color: #f1a5a5; }
.empty-state { padding: 34px; text-align: center; color: var(--muted); }

/* docs */
.doc-section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.doc-section h2 { margin: 0 0 6px; font-size: 15px; }
.doc-section h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.doc-section p { line-height: 1.5; margin: 6px 0; }
.op-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.method { font-family: var(--mono); font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 5px; background: #e6f6ea; color: var(--ok); }
.op-path { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.op-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); padding: 1px 7px; border-radius: 10px; }
.doc-table th, .doc-table td { white-space: normal; }
.doc-table td.name { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.doc-table td.type { font-family: var(--mono); color: var(--muted); white-space: nowrap; }
.req { color: var(--err); font-size: 11px; font-weight: 700; margin-left: 4px; }
.enum-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.desc-long { color: var(--muted); font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; }
.code-block { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; overflow: auto; white-space: pre; margin: 6px 0 0; }
details.spec-desc summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }

/* overview */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.card:hover { border-color: var(--accent); }
.card-title { font-weight: 700; font-size: 15px; }
.card-path { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 12px; color: var(--muted); }
.card-count { font-size: 20px; font-weight: 700; color: var(--text); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10,14,20,.35); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(720px, 94vw); background: var(--panel); border-left: 1px solid var(--border); z-index: 31; overflow: auto; padding: 18px 22px 40px; box-shadow: -6px 0 24px rgba(0,0,0,.15); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-head h2 code { color: var(--muted); font-size: 13px; margin-left: 6px; }
.detail-table td.name { font-family: var(--mono); font-weight: 600; width: 220px; }
.detail-table td.val { white-space: normal; word-break: break-all; }
.detail-table td .hint { display: block; color: var(--muted); font-size: 11.5px; white-space: normal; margin-top: 2px; }
.drawer .code-block { max-height: 360px; }

@media (max-width: 1100px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; }
  .conn { flex-wrap: wrap; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
}

/* the order ticket */
.ticket { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; max-width: 1100px; }
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; align-items: end; }
.ticket .field span em { font-style: normal; color: var(--muted); font-weight: 400; }
.ticket .field input, .ticket .field select { font-family: var(--mono); font-size: 13px; }
.ticket-check { padding-bottom: 9px; }
.ticket-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ticket-hint { color: var(--muted); font-size: 12px; }
.ticket-result { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.ticket-result .result-title { font-weight: 700; margin-bottom: 6px; }
.ticket-result.ok .result-title { color: var(--ok); }
.ticket-result.err .result-title { color: var(--err); }
.ticket-result.busy .result-title { color: var(--warn); }
.ticket-result .result-line { margin: 3px 0; }
.drawer-actions { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
button.danger { border-color: #f1a5a5; color: var(--err); }
button.danger:hover { background: #fdecec; }
.drawer .legs { margin-top: 14px; }
.drawer .legs h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.method.m-post { background: var(--accent-soft); color: var(--accent); }

/* the Users page (identity plan R7): the /me banner, the admission band, the capability grid */
.me-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 18px; background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: 12.5px; }
.me-banner.warn { background: #fff6e0; }
@media (prefers-color-scheme: dark) { .me-banner.warn { background: #3a2f14; } }
.me-banner .sub { color: var(--muted); font-family: var(--mono); font-size: 12px; }
/* the banner's key/value pairs: the key muted, the value plain; a group shares one key */
.me-banner .kv { display: inline-flex; align-items: baseline; gap: 5px; }
.me-banner .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.me-banner .v { font-weight: 600; }
.me-banner select { padding: 1px 4px; }
.me-banner .kv-group { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.me-banner .kv-group .kv .k { text-transform: none; letter-spacing: 0; font-size: 12px; }
.band { padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 10px; font-size: 12.5px; line-height: 1.5; }
.band.warn { border-color: #f0c674; background: #fff6e0; color: var(--warn); }
@media (prefers-color-scheme: dark) { .band.warn { background: #3a2f14; color: #f0c674; } }
/* a decision nobody can make (the Orgs page's proposals no one can approve) */
.band.err { border-color: #f1a5a5; background: #fff2f2; color: var(--err); }
@media (prefers-color-scheme: dark) { .band.err { background: #3a1c1c; color: #f1a5a5; } }
/* a band's rows, each a link that opens its drawer over the page on screen */
.band a { color: inherit; text-decoration: underline; }
tr.row-discovered td, tr.row-pending td { background: #fff9eb; }
@media (prefers-color-scheme: dark) { tr.row-discovered td, tr.row-pending td { background: #2f2812; } }
/* the Orgs page (identity plan R8): the pending band, the activation form, the approval-count warning */
.org-write { margin-top: 12px; }
.org-form .approvals-warn { margin-top: 10px; }
/* the New organisation form's disclosures: each summary reads what it sends */
.org-form details.org-more { margin-top: 10px; }
.org-form details.org-more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
.org-form details.org-more .field { margin-top: 6px; max-width: 420px; }
.user-write { margin-top: 12px; }
.user-form .caps-head { margin: 14px 0 6px; font-size: 12.5px; }
.caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
/* the capability picker: one row per family, one column per verb, read first */
.caps-table { width: auto; font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.caps-table th, .caps-table td { padding: 3px 14px; border-bottom: 1px solid var(--border); text-align: center; }
.caps-table thead th { position: static; cursor: default; font-family: var(--mono); font-size: 11px; text-transform: none; letter-spacing: 0; }
.caps-table thead th.read { font-style: italic; }
.caps-table th.cap-family-name { text-align: left; font-family: var(--mono); font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; cursor: default; position: static; }
.caps-table tbody tr:last-child > * { border-bottom: none; }
.caps-table tbody tr:hover { background: var(--accent-soft); }
.caps-table td.cap-none { color: var(--border); }
.caps-table .cap { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.caps-table .cap.unknown { color: var(--muted); font-size: 11px; }
/* a bit the holder may never hold — an API key's approve bits, users:manage, api-keys:manage, risk:propose (OA5) */
.caps-table .cap.refused { cursor: not-allowed; opacity: .4; }
.caps-table th:nth-child(2), .caps-table td:nth-child(2) { border-right: 1px solid var(--border); }
.caps .cap { padding: 2px 0; font-family: var(--mono); font-size: 12px; color: var(--text); }
.caps .cap.platform { color: var(--muted); }
/* the Accounts page (contract 0.60.0, plans/org-api-simplification.md OA3): the rows the band
   counts — a withdrawn connection (DRAFT), one the venue refuses (DOWN) — the drawer's head,
   and the key panels beneath the account's fields: one per key, its verbs, the rotation and
   Add a key as collapsed sections like the generated commands */
tr.row-draft td { background: #fff9eb; }
tr.row-down td { background: #fdf0f0; }
@media (prefers-color-scheme: dark) { tr.row-draft td { background: #2f2812; } tr.row-down td { background: #3a1c1c; } }
.band-line + .band-line { margin-top: 6px; }
.keys { display: inline-flex; flex-wrap: wrap; gap: 3px 4px; align-items: center; }
.key-chip .enum { margin-left: 4px; }
.account-top .ticket-hint { display: block; margin: 2px 0 6px; }
.account-top .ticket-hint.down { color: var(--err); }
.drawer-actions .chip.connection .health { margin-left: 4px; }
.keys-section { margin-top: 14px; }
.keys-section h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.key-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.key-panel h4 { margin: 0 0 6px; font-size: 13.5px; }
.key-panel .role-chip { font-family: var(--mono); font-weight: 400; }
.key-line { margin: 4px 0; line-height: 1.5; }
.key-line > .role { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-right: 6px; }
.key-verbs .key-note { flex: 1 1 220px; min-width: 180px; font-family: var(--mono); font-size: 12.5px; }
.key-roles .choice { max-width: 420px; }

/* the Algos page (plans/algos-domain.md A4d): the document text area and its byte gauge, the
   drawer's remark, the lifecycle and the document outcome as chips */
.algo-form textarea, .algo-reconfigure textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; resize: vertical; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.algo-form textarea:focus, .algo-reconfigure textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.doc-gauge { font-style: normal; color: var(--muted); }
.doc-gauge.over { color: var(--err); font-weight: 600; }
.algo-form .spec-desc pre { max-height: 240px; }
.algo-refs { margin-top: 8px; line-height: 1.5; }
.drawer-actions .algo-remark { flex: 1 1 220px; min-width: 180px; font-family: var(--mono); font-size: 12.5px; }
.toolbar .algo-remark { width: 220px; font-family: var(--mono); font-size: 12.5px; }
.drawer .doc-text { max-height: 260px; white-space: pre-wrap; word-break: break-word; }
tr.row-applied td { background: #f1f8f3; }
@media (prefers-color-scheme: dark) { tr.row-applied td { background: #14281b; } }
.enum.e-created, .enum.e-staged { background: #fff6e0; color: var(--warn); border-color: #f0c674; }
.enum.e-started, .enum.e-applied { background: #e6f6ea; color: var(--ok); border-color: #9fd7ae; }
.enum.e-stopped { color: var(--muted); }
.enum.e-error, .enum.e-deleted, .enum.e-refused { background: #fdecec; color: var(--err); border-color: #f1a5a5; }

/* the generated command surface (schema-form.js): one collapsed section per unsafe route the
   document publishes — on the family's Commands tab for the creates, on a row's drawer for
   the routes that name it. Deliberately the ticket's own look: a generated form and a
   hand-written one are the same kind of thing to the person using them. */
.tab.tab-link { display: inline-flex; align-items: center; color: var(--accent); }
.tab.tab-link:hover { background: var(--panel); }
.command { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.command > summary { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; }
.command > summary::-webkit-details-marker { display: none; }
.command > summary::before { content: "▸"; color: var(--muted); }
.command[open] > summary::before { content: "▾"; }
.command[open] > summary { border-bottom: 1px solid var(--border); }
.command > summary:hover { background: var(--bg); }
.command .op-summary { color: var(--muted); font-size: 12.5px; }
.command > .desc-long { margin: 10px 14px 0; }
/* the form inside a section carries the section's frame, not its own */
.command .ticket { border: none; padding: 14px; max-width: none; }
.command .ticket-grid { align-items: start; }
.command .field { min-width: 0; }
.command .field details.spec-desc { margin-top: 4px; }
.command .field details.spec-desc summary { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command .field details.spec-desc[open] summary { white-space: normal; }
.field-wide { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
fieldset.gen-object { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px 12px; margin: 0; }
fieldset.gen-object legend { font-size: 11px; color: var(--muted); padding: 0 4px; }
.row-commands { margin-top: 18px; }
.commands-head { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.method.m-put { background: #fff6e0; color: var(--warn); }

/* The Approvals page (contract 0.25.0): the bell on the sidebar count, the proposal's panel
   over the row it opens, and the diff of what the proposal changes. */
.nav-count.bell { border-color: var(--warn); color: var(--warn); font-weight: 600; }
.nav-count.bell.quiet { border-color: var(--border); color: var(--muted); font-weight: 400; }
.nav-item.active .nav-count.bell { border-color: var(--warn); color: var(--warn); }
tr.row-returned td { color: var(--muted); }
tr.row-stuck td.key, tr.row-stuck td:first-child { color: var(--warn); }
.proposal-panel { margin: 8px 0 14px; padding: 10px 12px; border: 1px solid #f0c674; border-radius: var(--radius); background: #fffaf0; }
.proposal-panel .approvers, .proposal-panel .returned { margin: 4px 0 8px; }
.proposal-panel .diff-head { margin: 10px 0 6px; font-size: 13px; color: var(--muted); }
.diff th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.diff tr.changed td.name { color: var(--warn); }
.ticket-hint.prefilled { display: block; margin: 4px 0 8px; color: var(--warn); }

/* Connect an account (plans/org-api-simplification.md OA3; the wizard of
   plans/completed/platform-design-review.md §4.1): the three cards — the venue, the purpose
   and the account as choices and fields, the venue card, the paste of the account's key and
   its transfers key — and the account's check: its verdict, each key's, the approval, the
   connectors' health. */
.nav-flow .nav-name { font-weight: 600; }
.wizard { max-width: 1100px; }
.wizard .family-title { margin: 0 0 4px; }
.wizard .family-desc { margin-bottom: 14px; }
.wizard-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; }
.wizard-card h2 { margin: 0 0 10px; font-size: 15px; }
.wizard-card h3 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.wizard-card p { margin: 6px 0; line-height: 1.5; }
.wizard-card .connect-form { border: none; padding: 0; max-width: none; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.choice { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; max-width: 340px; line-height: 1.4; }
.choice:hover { border-color: var(--accent); }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.disabled { cursor: not-allowed; color: var(--muted); }
.choice input { margin-top: 3px; }
.choice .sub { display: block; color: var(--muted); font-size: 12px; }
.choice .sub.note { color: var(--warn); }
.choice .sub-inline { color: var(--muted); font-weight: 400; font-size: 12px; }
.wizard-card .grant { font-family: var(--mono); font-size: 13px; }
.egress-list { display: flex; align-items: flex-start; gap: 8px; }
.egress-list .code-block { margin: 0; flex: 0 1 auto; }
.connect-form .legs { margin-bottom: 16px; }
.connect-form .leg-error { color: var(--err); font-size: 12px; }
.connect-form .leg-hint { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
/* the account's own key and, when ticked, the transfers key beside it — each its legs and name */
.connect-form .key-legs { margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.connect-form .key-legs h3 { margin: 0 0 8px; }
.connect-form .key-legs .legs { margin-bottom: 8px; }
.transfers-choice { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 10px; line-height: 1.4; }
.transfers-choice.disabled { color: var(--muted); }
.transfers-choice .sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.transfers-choice .sub.note { color: var(--warn); }
.account-fields { margin-top: 10px; }
.account-fields input.invalid { border-color: var(--err); }
.key-verdicts .key-verdict { margin-left: 12px; }
.served-key { margin: 4px 0; }
.served-key > .role { color: var(--muted); font-family: var(--mono); font-size: 11px; margin-right: 6px; }
.connect-form textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; resize: vertical; color: inherit; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.connect-form textarea.secret { -webkit-text-security: disc; }
.connect-form .invalid { border-color: var(--err); }
.verdict { margin: 10px 0; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); border-left-width: 4px; line-height: 1.5; }
.verdict-title { font-weight: 700; margin-bottom: 2px; }
.verdict.v-ok { border-color: #9fd7ae; border-left-color: var(--ok); }
.verdict.v-ok .verdict-title { color: var(--ok); }
.verdict.v-warn { border-color: #f0c674; border-left-color: var(--warn); }
.verdict.v-warn .verdict-title { color: var(--warn); }
.verdict.v-err { border-color: #f1a5a5; border-left-color: var(--err); }
.verdict.v-err .verdict-title { color: var(--err); }
.verdict.v-wait { border-left-color: var(--accent); }
.verdict.v-wait .verdict-title { color: var(--accent); }
.verdict.v-muted .verdict-title { color: var(--muted); }
.ways { margin: 10px 0; }
.way { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); line-height: 1.5; }
.steps { margin: 6px 0 0; padding-left: 22px; }
.steps li { margin: 6px 0; }
.steps li.done { color: var(--muted); }
.steps li.done b { text-decoration: line-through; }
.steps button:disabled { opacity: .45; cursor: default; }
.approval { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); line-height: 1.6; }
.served .table-wrap { margin-top: 4px; }
.add-transfers { margin: 12px 0; }
.check-observed { margin-top: 12px; }
/* The API keys page (OA5): the bearer an issue or a rotation answered, shown once. */
.secret-box { margin: 8px 0; padding: 8px 12px; border: 1px solid var(--warn); border-radius: var(--radius); }
.secret-line { display: flex; gap: 6px; align-items: center; }
.secret-line .secret-value { flex: 1; font-family: var(--mono); font-size: 12.5px; }
.api-key-write { margin-top: 12px; }
