/* =============================================================================
   The sleeve console: one question per panel, in the order an operator asks it.

   Loaded after pages.css, so it reuses the tokens, the record panel and the
   responsive table pattern already on the desk. Nothing here is a framework:
   the only behaviour is the tab switch and the order filters, and both work
   without JavaScript because every control is also a real link or a GET form.

   Reading order: what state is this sleeve in -> what did it do -> is it
   working -> what does it want to hold -> what did it send to the venue.
   ============================================================================= */

.sleeve-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 28px;
  margin: 0 0 22px;
}
.sleeve-title { min-width: 0; }
.sleeve-title h1 {
  margin: 0 0 6px;
  font: 500 clamp(30px, 6vw, 44px)/1 var(--serif);
  letter-spacing: -0.03em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.sleeve-meta {
  margin: 0;
  color: var(--muted);
  font: 11.5px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.sleeve-badge { flex: 0 0 auto; padding-top: 4px; }
.sleeve-badge .state {
  padding: 9px 13px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--panel);
}

/* ---- The headline: four readings, hairline-separated, equity set largest. -------------------
   This is the whole sleeve in one scan. The fourth column is deliberately not another return:
   it is the distance between the book and the weights the strategy said it wanted. */

.headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  margin: 0 0 26px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--rule-strong);
  background: var(--rule);
}
.headline-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 15px 16px 14px;
  background: var(--bg);
}
.headline-stat .k {
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.headline-stat .v {
  font: 600 21px/1.05 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.headline-hero .v { font-size: clamp(24px, 6vw, 32px); }
.headline-stat .n {
  color: var(--muted);
  font: 10.5px/1.45 var(--mono);
  overflow-wrap: anywhere;
}
.headline .gain { color: var(--gain); }
.headline .loss { color: var(--loss); }
.headline-target .v { color: var(--accent); }
.headline-target .v .unknown { color: var(--muted); font: inherit; font-style: italic; }

/* ---- Tabs: three sections, one shape. Sticky under the header on a phone. ------------------ */

.tabs {
  display: flex;
  gap: 2px;
  margin: 0 0 22px;
  padding: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--panel);
}
.tab {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--accent-soft); }
.tab[aria-current="page"],
.tab[aria-current="page"]:hover {
  color: var(--bg);
  background: var(--ink);
}
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 600 9.5px/1 var(--mono);
  letter-spacing: 0;
  opacity: 0.75;
}
.tab-panel[hidden] { display: none; }
.tab-panel:focus { outline: none; }
.tab-panel { scroll-margin-top: 10px; }
/* pages.css tints the first stat, which was `return` before the console added equity beside it. */
.record-panel .detail-stats > div:first-child dd { color: inherit; }
.record-panel .detail-stats > .stat-return dd { color: var(--tone); }

/* ---- What the agent did: cycles as ledger entries, actions as one line each. ---------------- */

.cycles { display: grid; gap: 14px; }
.cycle {
  min-width: 0;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
.cycle-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.cycle > summary { cursor: pointer; list-style: none; }
.cycle > summary::-webkit-details-marker { display: none; }
.cycle > summary::after {
  content: "+";
  margin-left: 2px;
  color: var(--muted);
  font: 600 12px/1 var(--mono);
}
.cycle[open] > summary::after { content: "−"; }
.cycle-when { font: 600 11px/1.4 var(--mono); }
.cycle-id {
  min-width: 0;
  color: var(--muted);
  font: 10.5px/1.4 var(--mono);
  overflow-wrap: anywhere;
}
.cycle-chip {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--muted);
  font: 600 9.5px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.cycle-chip-held { color: var(--stale); border-color: currentColor; }
.cycle-decision { font: 10.5px/1.4 var(--mono); white-space: nowrap; }
.cycle-hold {
  margin: 0;
  padding: 13px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.cycle-rationale { font: italic 13px/1.5 var(--serif); color: var(--ink); }

.action-list { margin: 0; padding: 0; list-style: none; }
.action {
  display: grid;
  grid-template-columns: 56px minmax(0, 1.1fr) 108px minmax(0, 1.5fr);
  gap: 3px 16px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px dashed var(--rule);
  min-width: 0;
}
.action:last-child { border-bottom: 0; }
.action-side {
  font: 700 10px/1.7 var(--mono);
  letter-spacing: 0.11em;
}
.side-buy { color: var(--gain); }
.side-sell { color: var(--loss); }
.action-what {
  min-width: 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.action-what b { font: 600 13px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.action-status {
  display: inline-block;
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 3px;
  font: 600 9px/1.55 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.status-rejected, .status-refused { color: var(--halt-ink); background: var(--halt-bg); }
.status-pending, .status-acknowledged, .status-submitted { color: var(--stale); }
.action-share {
  font: 600 11.5px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.action-share .of { color: var(--muted); font-weight: 400; font-size: 10px; }
.action-intent { margin-right: 2px; color: var(--muted); }
.action-reason {
  min-width: 0;
  color: var(--ink);
  font: italic 13px/1.45 var(--serif);
  overflow-wrap: anywhere;
}
.action-reason.unknown { font: 11px/1.45 var(--mono); font-style: normal; }
.action-reason.action-refusal {
  color: var(--halt-ink);
  font: 600 11px/1.5 var(--mono);
  font-style: normal;
}
.cycle-note {
  margin: 0;
  padding: 11px 0 2px;
  color: var(--ink);
  font: italic 13px/1.5 var(--serif);
  overflow-wrap: anywhere;
}
.cycle-note.unknown {
  color: var(--muted);
  font: 11px/1.5 var(--mono);
  font-style: normal;
}
.cycle-more {
  margin: 0;
  padding: 11px 0 12px;
  border-top: 1px solid var(--rule);
  font: 11px/1.5 var(--mono);
}
.cycle-more a { text-decoration: none; }
.cycle-more a:hover { text-decoration: underline; }

.empty-hold { border-color: var(--accent); }
.empty-hold p { color: var(--ink); }
.empty-note {
  margin: 8px 0 0;
  color: var(--muted);
  font: italic 13px/1.5 var(--serif);
}
.empty-block .empty-note { color: var(--ink); }

/* ---- What it is targeting: paired bars on one scale, the gap said in percentage points. ---- */

.targets {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}
.target { min-width: 0; padding: 13px 16px; border-top: 1px solid var(--rule); }
.target:first-child { border-top: 0; }
.target-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  margin: 0 0 9px;
}
.target-instr { font: 600 12.5px/1.4 var(--mono); overflow-wrap: anywhere; }
.target-holds,
.target-basis { color: var(--muted); font: 10.5px/1.4 var(--mono); }
.target-gap {
  margin-left: auto;
  font: 600 11.5px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.target-gap-on { color: var(--muted); }
.target-bars { display: grid; gap: 5px; }
.bar-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
}
.bar-k {
  color: var(--muted);
  font: 500 9.5px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bar-track {
  position: relative;
  height: 9px;
  border-radius: 3px;
  background: var(--accent-soft);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 2px;
  border-radius: 3px;
}
.bar-fill-target { background: var(--accent); opacity: 0.5; }
.bar-fill-current { background: var(--ink); }
.bar-track-unknown {
  display: flex;
  align-items: center;
  padding-left: 6px;
  background: repeating-linear-gradient(135deg, var(--rule) 0 4px, transparent 4px 8px);
}
.bar-track-unknown span { color: var(--muted); font: 9px/1 var(--mono); }
.bar-v {
  color: var(--ink);
  font: 600 11px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.bar-v.unknown { font-weight: 400; }

/* ---- Orders: controls first, then the venue's conversation. -------------------------------- */

.order-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 18px;
  margin: 0 0 14px;
}
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter span {
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.filter select,
.filter input {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: 12px/1.2 var(--mono);
  -webkit-appearance: none;
  appearance: none;
}
.filter select:focus-visible,
.filter input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.filter-apply {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font: 600 10.5px/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
}
.filter-apply:hover { background: var(--accent); border-color: var(--accent); }
.filter-clear { align-self: center; font: 11px/1.4 var(--mono); }
.order-count {
  margin: 0 0 2px auto;
  color: var(--muted);
  font: 11px/1.4 var(--mono);
  white-space: nowrap;
}
table.detail-orders td { overflow-wrap: anywhere; }
table.detail-orders td { font-size: 12.5px; vertical-align: top; }
/* The mobile card pattern sets `display:block` on rows, which would otherwise beat the UA
   stylesheet's `[hidden]` while a filter is active. */
table.detail-orders tr[hidden] { display: none; }
table.detail-orders td[data-label="When"] {
  color: var(--muted);
  font: 11.5px/1.45 var(--mono);
  white-space: nowrap;
}
table.detail-orders td[data-label="Fees"] { min-width: 8ch; }
.fee { display: block; color: var(--ink); font: 11px/1.5 var(--mono); }
.price-k {
  display: block;
  color: var(--muted);
  font: 9px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.empty-filter {
  margin: 14px 0 0;
  padding: 18px 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Policy: four blocks, no prose. ---------------------------------------------------------
   State is one line and a dot; limits are a two-column table with the units in the row heads;
   the form is the only place a bound is written; the mandate is a fold of facts. The one
   destructive control is separated from the harmless one by a rule, a colour and a fold, because
   a kill switch beside a submit button is a mis-click waiting to happen. */

.policy-mode {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0;
  font: 600 14px/1.45 var(--mono);
  color: var(--ink);
}
.policy-dot {
  flex: 0 0 auto;
  align-self: center;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gain);
}
.policy-dot-idle { background: var(--muted); }
.policy-mode-v {
  color: var(--muted);
  font: 400 12px/1.5 var(--mono);
}
.policy-left {
  margin: 3px 0 0;
  color: var(--accent);
  font: 600 11.5px/1.5 var(--mono);
  font-variant-numeric: tabular-nums;
}
.policy-says { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.policy-circuit {
  margin: 7px 0 0;
  color: var(--halt-ink);
  font: 600 11px/1.5 var(--mono);
}

.policy-scroll {
  max-width: 38rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
.policy-limits {
  width: 100%;
  border-collapse: collapse;
}
.policy-limits thead th {
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
}
.policy-limits tbody th {
  padding: 9px 14px;
  border-top: 1px solid var(--rule);
  text-align: left;
  font: 400 12.5px/1.4 var(--sans);
  color: var(--ink);
  white-space: nowrap;
}
.policy-limits tbody tr:first-child th,
.policy-limits tbody tr:first-child td { border-top: 0; }
.policy-limits td {
  padding: 9px 14px;
  border-top: 1px solid var(--rule);
  font: 600 12.5px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.policy-limits .num { text-align: right; }
.policy-limits .unit {
  margin-left: 7px;
  color: var(--muted);
  font: 400 10px/1.4 var(--mono);
  letter-spacing: 0;
  text-transform: none;
}

/* The form is a column of paired fields, not a page-wide ledger: 46rem is where a label and its
   input sit close enough to read as one control. The window's own field is a short row because a
   1400px number input is a cursor journey for four characters. */
.policy-arm { max-width: 46rem; }
.policy-arm .actions { justify-content: flex-start; }
.policy-arm .btn { flex: 0 0 auto; min-width: 15rem; }
.field-narrow input { max-width: 11rem; }

/* The mode is three radial buttons that read as one choice. */
.field .mode-set { margin: 0; padding: 0; border: 0; min-width: 0; }
.mode-set legend {
  padding: 0;
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mode-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.field .mode-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: 12.5px/1.3 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.field .mode-option input {
  width: 16px;
  min-height: 0;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
.field .mode-option:has(input:checked) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

/* The kill switch: its own region, its own colour, its own gesture. */
.kill-block {
  max-width: 46rem;
  margin: 26px 0 0;
  padding: 15px 16px 16px;
  border: 1px solid var(--halt-rule);
  border-top: 3px solid var(--halt-rule);
  border-radius: 10px;
  background: var(--halt-bg);
}
.kill-k {
  margin: 0;
  color: var(--halt-ink);
  font: 600 10px/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.kill-says { margin: 4px 0 0; color: var(--halt-ink); font-size: 13px; }
.kill-fold > summary {
  min-height: 44px;
  padding: 10px 0;
  color: var(--halt-ink);
  font: 600 11px/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.kill-form {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed var(--halt-rule);
}
.kill-confirm {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--halt-ink);
  font: 12.5px/1.45 var(--sans);
}
.kill-confirm input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--halt-ink);
}
.btn-kill { flex: 1 1 auto; background: var(--halt-ink); border-color: var(--halt-ink); color: var(--bg); }
.btn-kill:hover { background: var(--halt-rule); border-color: var(--halt-rule); color: var(--bg); }
.btn-kill:focus-visible { outline: 2px solid var(--halt-ink); outline-offset: 2px; }

/* The mandate: reference, folded, two columns. */
.mandate-fold {
  max-width: 46rem;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
.mandate-fold > summary {
  display: flex;
  align-items: center;
  min-height: 46px;
  cursor: pointer;
  font: 600 10.5px/1.4 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.mandate-fold[open] > summary { border-bottom: 1px solid var(--rule); }
.policy-mandate {
  display: grid;
  grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr);
  gap: 9px 16px;
  margin: 13px 0 14px;
}
.policy-mandate div { display: contents; }
.policy-mandate dt {
  color: var(--muted);
  font: 500 9.5px/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.policy-mandate dd {
  margin: 0;
  font: 12px/1.5 var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ---- Chat: the composer's base. The thread itself lives in chat.css, in the panel. -------- */

/* The composer base: a field with the send control inside it, sized by the script as it grows. */
.composer {
  padding: 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--panel);
}
.composer-field {
  position: relative;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  background: var(--bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer textarea {
  flex: 1 1 auto;
  width: 100%;
  min-height: 46px;
  max-height: 9.6rem; /* about six lines, then it scrolls */
  padding: 12px 50px 12px 13px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  font: 14px/1.55 var(--sans);
  resize: none;
  overflow-y: hidden;
}
.composer textarea:disabled { opacity: 0.72; cursor: not-allowed; }
.composer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 14px;
  margin-top: 8px;
}

/* ---- The decision fold: present, precise, out of the way until asked for. ------------------- */

.decisions-fold {
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
.decisions-fold > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 14px;
  min-height: 48px;
  padding: 12px 0;
  cursor: pointer;
  list-style: none;
}
.decisions-fold > summary::-webkit-details-marker { display: none; }
.fold-k {
  font: 600 10px/1.3 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.fold-v { color: var(--muted); font: 11px/1.4 var(--mono); }
.decisions-fold[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.decisions-fold .decisions { margin: 0 0 16px; }
.facts-fold { margin-top: 12px; }
.facts-fold > summary {
  min-height: 36px;
  padding: 6px 0;
  color: var(--accent);
  font: 500 11px/1.4 var(--mono);
  cursor: pointer;
}

/* ---- The range: a window over recorded valuations, one control per page. --------------------
   Seven links, the same chip the cost row uses, because both are states of the same view and a
   second visual grammar for "which slice am I looking at" would be a second thing to learn. The
   selected chip is filled, so it survives the reload that choosing it causes. */

.record-range {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--rule);
}

/* On the sleeve page the row sits at the top of the record panel, which already has its own
   padding and bottom rule; it must not add a second divider inside it. */
.record-panel > .record-range {
  margin: 0 0 10px;
  padding: 0;
  border-bottom: 0;
}

.record-range-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-width: 0;
}

.record-range-k {
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.record-range-k::after { content: ":"; letter-spacing: 0; margin-left: -0.09em; }

.record-range-label {
  font: 500 12px/1.6 var(--mono);
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.record-range-set { gap: 4px; }

/* The chips are narrower than a cost chip and never wrap: seven of them are the width of a
   phone's line, which is the reason they are one row rather than a select. */
.record-range-set .record-toggle {
  padding: 7px 8px;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* ---- The authentication banner ---------------------------------------------------------------
   A standing fact about the deployment, stated on every page while `TAPEBOOK_AUTH=off`. Inverted
   ink rather than the halt red or the amber "needs you": it must be impossible to miss without
   competing with an event. It is not dismissible — the posture is not a notification. */

.auth-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--bg);
  font: 500 12px/1.45 var(--mono);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

/* ---- The approval fold and the card's outcome ----------------------------------------------- */

/* Two decisions and one token. The buttons stay visible so the card reads as an offer; the
   credentials fold away, because typing a token is the rare act and the decision is the common
   one. The summary is a real target (44px) rather than a link with an arrow drawn on it. */
.decision-form .approve-fold {
  grid-column: 1 / -1;
  margin-top: 12px;
}
.decision-form .approve-fold > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 0 4px;
  color: var(--accent);
  font: 500 11.5px/1.3 var(--mono);
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
}
.decision-form .approve-fold > summary::-webkit-details-marker { display: none; }
.decision-form .approve-fold > summary::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4.5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 120ms ease;
}
.decision-form .approve-fold[open] > summary::after { transform: rotate(90deg); }
.decision-form .approve-fold > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.approve-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 12px;
  padding: 4px 0 12px;
}

@media (max-width: 600px) {
  .approve-fields { grid-template-columns: minmax(0, 1fr); }
}

/* The outcome is one line. The state chip above already carries the word and its colour, so this
   line is plain ink: the sentence a reader looks for after the fact, not a second status mark. */
.move-outcome {
  margin: 10px 0 0;
  font: 500 12px/1.5 var(--mono);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* A refusal is the route's own sentence, printed where the reader pressed. It is an error and it
   looks like one, at the size the card's body text is read at. */
.move-refused {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid var(--halt-rule);
  border-radius: 6px;
  background: var(--halt-bg);
  color: var(--halt-ink);
  font: 12.5px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

/* ---- A card's state: one tone for the chip and the top bar -----------------------------------
   The state is reinforcement, never the only signal: the chip keeps its word ("Approved",
   "Auto-approved", "Rejected", "Executed", "Proposed"), and the 2px top bar repeats it in the same
   colour so a glance down a thread separates settled from waiting without reading. The bar is the
   card's existing top edge, so nothing new appears — only its colour.

   approved and auto-approved are both the sleeve's success colour (--gain); proposed is the amber
   that means "needs you"; rejected and failed are the halt colour; executed and expired are
   neutral, because they are over and ask nothing. */

.move.tone-ok { border-top-color: var(--gain); }
.move.tone-wait { border-top-color: var(--stale); }
.move.tone-bad { border-top-color: var(--halt-ink); }
.move.tone-none { border-top-color: var(--rule-strong); }

.move.tone-ok .state { color: var(--gain); }
.move.tone-wait .state { color: var(--stale); }
.move.tone-bad .state { color: var(--halt-ink); }
.move.tone-none .state { color: var(--muted); }

/* The same tones for a state chip that is not on a card — the connectors table. One vocabulary:
   `ok` is proven, `wait` is configured and unproven, `bad` is a fault, `none` asks nothing. */
.state.tone-ok { color: var(--gain); }
.state.tone-wait { color: var(--stale); }
.state.tone-bad { color: var(--halt-ink); }
.state.tone-none { color: var(--muted); }

/* ---- Connectors: what exists, what is configured, what is proven (ADR-0048) ------------------
   Grouped by kind, one table per group, each in its own scroll container: at 320px the table moves
   sideways inside its card and the page does not. The state chip, the reason sentence and the
   input badges are the whole page — there is no explanatory paragraph, because the row that needs
   explaining already carries its own sentence. */

.connectors-notice {
  max-width: 96ch;
  margin: 0 0 18px;
  color: var(--muted);
  font: 12px/1.6 var(--mono);
}

.connectors-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 0 0 20px;
  padding: 0 0 13px;
  border-bottom: 1px solid var(--rule);
}

.connector-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.connector-chip-count {
  margin-left: 7px;
  font-size: 10px;
  opacity: 0.7;
}

.connectors-search {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.connectors-search input {
  width: 13rem;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: 12px/1.3 var(--mono);
  -webkit-appearance: none;
  appearance: none;
}
.connectors-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.connectors-search button {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: 500 11.5px/1 var(--mono);
  cursor: pointer;
}
.connectors-search button:hover { border-color: var(--ink); }
.connectors-search button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.connectors-group { margin: 0 0 28px; }
.connectors-group h2 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 9px;
  font: 500 12.5px/1.3 var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink);
}
.connectors-count {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
}

/* The scroll is the container's, not the page's. `min-width` is what gives the six columns room
   to stay readable instead of squeezing the reason to three words a line. */
.connectors-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}

table.connectors {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}
/* Fixed widths, because the reason is the column that carries the sentence: left to itself the
   table hands its room to a long variable name and squeezes the why to three words a line. */
.col-name { width: 16%; }
.col-state { width: 9%; }
.col-why { width: 34%; }
.col-inputs { width: 21%; }
.col-proven { width: 15%; }
.col-docs { width: 5%; }
table.connectors thead th {
  padding: 9px 13px;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
table.connectors td {
  padding: 11px 13px;
  border-top: 1px solid var(--rule);
  vertical-align: top;
  text-align: left;
}
table.connectors tbody tr:first-child td { border-top: 0; }
table.connectors .state { white-space: nowrap; }

.connector-label {
  display: block;
  font: 500 13px/1.35 var(--sans);
  color: var(--ink);
}
.connector-id {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font: 10.5px/1.4 var(--mono);
}
.connector-why {
  color: var(--muted);
  font: 12px/1.55 var(--mono);
  overflow-wrap: break-word;
}
.connector-proven {
  color: var(--muted);
  font: 11.5px/1.55 var(--mono);
  overflow-wrap: break-word;
}

/* An input is present or it is not. `set` stays quiet — presence is not proof — and the missing
   name is the loud one, because a half-configured connector is the state that costs the time. */
.connector-badge {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--muted);
  font: 10px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.connector-badge code { font: inherit; }
/* Missing and nothing else set: quiet. The row already says "nothing configured". */
.connector-badge.is-missing {
  border-style: dashed;
  border-color: var(--rule-strong);
}
/* Missing *and* something else set, or missing while the desk was told to run it: a fault, and
   the loud one, because a half-configured connector is the state that costs the time. */
.connector-badge.is-missing.is-alarm {
  border-style: solid;
  border-color: var(--halt-rule);
  background: var(--halt-bg);
  color: var(--halt-ink);
}

.connector-docs { white-space: nowrap; }
.connector-doc {
  color: var(--accent);
  font: 500 11.5px/1.4 var(--mono);
  text-decoration: none;
}
.connector-doc:hover { text-decoration: underline; }
.connector-doc:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 719px) {
  .connectors-search { margin-left: 0; width: 100%; }
  .connectors-search input { flex: 1 1 auto; width: auto; }
}

/* Why this card is still open. The action layer writes `requires approval: …` into the same
   column a decision's reason uses, so the label is what tells the two apart (GAP-132). */
.move-waiting {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 10px 0 0;
  min-width: 0;
}

.move-waiting-k {
  color: var(--stale);
  font: 600 9.5px/1.5 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.move-waiting-k::after { content: ":"; letter-spacing: 0; margin-left: -0.09em; }

.move-waiting-v {
  color: var(--ink);
  font: 12px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

/* The policy answered before the card was drawn. It sits above the fold and reads as a state, not
   as an offer: the only control left on this card is the one that stops it. */
.move-auto {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font: 12px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

/* ---- The app frame: one column for the page, one for chat. ----------------------------------
   On a wide screen the page is a frame rather than a document: masthead across the top, then a
   scrolling content column beside the chat panel. The panel needs no measuring and no script —
   it is a grid row, so "from under the masthead to the foot of the viewport" is what the row is,
   and the page beside it reflows instead of being covered. Below 1024px this is off, the panel is
   fixed, and the document scrolls normally. */

@media (min-width: 1024px) {
  body {
    height: 100dvh;
    padding-bottom: 0;
    overflow: hidden;
  }
  .app-shell {
    display: grid;
    grid-template-areas:
      "masthead masthead"
      "content chat";
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
  }
  .masthead { grid-area: masthead; }
  .app-content {
    grid-area: content;
    min-height: 0;
    /* The panel's own border is the gutter; the column keeps a small one so a scrollbar never
       sits on a figure. 12px is what leaves the headline its four columns at 1280. */
    padding-right: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* The panel is draggable, so this column's width changes under the pointer. A classic
       scrollbar that appears as the text reflows would narrow the column again mid-drag — the
       page would twitch twice for every pixel the panel gained. The gutter is reserved for the
       whole session instead, and a drag moves the text rather than the scrollbar. */
    scrollbar-gutter: stable;
  }
  .app-content .foot { margin-bottom: 4px; }
}

/* ---- One restrained entrance, not a light show. -------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.sleeve-head,
.headline,
.why,
.tabs { animation: rise 0.3s ease-out both; }
.tab-panel { animation: rise 0.3s 0.06s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  .sleeve-head, .headline, .why, .tabs, .tab-panel { animation: none; }
}

/* ---- Widths ---------------------------------------------------------------------------------
   The chat panel takes a column of its own on a wide screen, so "how much room does this layout
   have" is the width of `main`, not the width of the window. The media queries below stay as the
   fallback; the container queries after them refine against the column the page is actually drawn
   in, which is what decides whether four headline figures fit. */

@media (min-width: 560px) {
  .headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .headline { grid-template-columns: 1.2fr 1fr 1fr 1.2fr; }
  .tabs { max-width: 640px; }
}

@container page (max-width: 479px) {
  .headline { grid-template-columns: minmax(0, 1fr); }
}
@container page (min-width: 480px) and (max-width: 839px) {
  .headline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container page (min-width: 840px) {
  .headline { grid-template-columns: 1.2fr 1fr 1fr 1.2fr; }
}

@media (max-width: 719px) {
  .sleeve-head { margin-bottom: 18px; }
  .sleeve-badge { padding-top: 0; }
  .headline { margin-bottom: 22px; }
  .headline-stat { padding: 13px 14px 12px; }

  /* The tabs stay under the header while the panel scrolls: switching a section must never
     mean scrolling back to the top to find the switch. */
  .tabs {
    position: sticky;
    top: 0;
    z-index: 12;
    margin: 0 -15px 20px;
    padding: 8px 15px;
    border: 0;
    border-bottom: 1px solid var(--rule-strong);
    border-radius: 0;
    background: var(--bg);
    box-shadow: 0 8px 14px -12px rgba(0, 0, 0, 0.45);
  }
  .tab { font-size: 10.5px; letter-spacing: 0.08em; padding: 5px 6px; }
  .tab-panel, .decision { scroll-margin-top: 74px; }

  .action { grid-template-columns: 46px minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; }
  .action-share { grid-column: 2; }
  .action-reason { grid-column: 2; }
  .cycle { padding: 0 13px; }
  .cycle-when { width: 100%; }
  .cycle > summary { position: relative; padding-right: 16px; }
  .cycle > summary::after { position: absolute; top: 14px; right: 0; margin: 0; }
  .cycle-chip { margin-left: 0; }
  .cycle-decision { margin-left: auto; }
  .target { padding: 12px 13px; }
  .target-gap { width: 100%; margin-left: 0; }
  .bar-row { grid-template-columns: 40px minmax(0, 1fr) 58px; gap: 8px; }
  .order-tools { align-items: stretch; }
  .filters { width: 100%; }
  .filter { flex: 1 1 120px; }
  .filter-apply { flex: 1 1 100%; }
  .filter-clear { flex: 0 0 auto; align-self: center; }
  .order-count { margin-left: 0; }
  .composer-foot { align-items: baseline; }
}

@media (max-width: 380px) {
  .headline-stat .v { font-size: 19px; }
  .headline-hero .v { font-size: 23px; }
  .action { grid-template-columns: 40px minmax(0, 1fr); }
  .bar-row { grid-template-columns: 36px minmax(0, 1fr) 54px; }
}

/* ---- Market: browse the registry, read one bundle, install, rate (ADR-0049) ------------------
   The page's whole job is that no number reads heavier than its evidence. So: the claim badge sits
   beside the figures rather than in a footnote, a return never appears without its basis, days and
   trade count, and the count of fetches is never called a count of people. */

.market-head h1 { margin-bottom: 4px; }
.bundle-head { margin-bottom: 14px; }
.bundle-title { min-width: 0; }
.bundle-title h1 { margin: 0 0 6px; }

.market-id {
  margin: 4px 0 0;
  color: var(--muted);
  font: 11.5px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.market-summary {
  max-width: 72ch;
  margin: 10px 0 0;
  color: var(--ink);
  font: 14px/1.55 var(--sans);
}
.market-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.market-tag {
  padding: 2px 7px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--muted);
  font: 10.5px/1.6 var(--mono);
}

/* The tools row: search, sort, kind — three controls in one line that wraps. */
.market-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin: 0 0 20px;
  padding: 0 0 13px;
  border-bottom: 1px solid var(--rule);
}
.market-search { display: flex; gap: 6px; }
.market-search input {
  width: 15rem;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: 12px/1.3 var(--mono);
  -webkit-appearance: none;
  appearance: none;
}
.market-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.market-search button,
.market-rate button {
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: 500 11.5px/1 var(--mono);
  cursor: pointer;
}
.market-search button:hover,
.market-rate button:hover { border-color: var(--ink); }
.market-sorts,
.market-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.market-sorts { margin-left: auto; }

/* Cards, one per bundle: a shape at a glance, then the numbers and their label. */
.market-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 16px;
}
.market-card {
  min-width: 0;
  padding: 14px 15px 15px;
  border: 1px solid var(--rule);
  border-top: 2px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--panel);
}
.market-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
}
.market-card-head h2 {
  margin: 0;
  font: 500 16px/1.3 var(--sans);
  letter-spacing: -0.01em;
}
.market-card-head a { color: var(--ink); text-decoration: none; }
.market-card-head a:hover { text-decoration: underline; }
.market-card-head a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.market-evidence-block { margin: 10px 0 0; }
.market-evidence {
  margin: 0;
  color: var(--ink);
  font: 11.5px/1.6 var(--mono);
  overflow-wrap: anywhere;
}
.claim-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--stale);
  border-radius: 4px;
  color: var(--stale);
  font: 10px/1.6 var(--mono);
  white-space: nowrap;
}
.market-caveats {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font: 11px/1.55 var(--mono);
}
.market-caveat-k { color: var(--stale); }
.market-counts {
  margin: 9px 0 0;
  color: var(--muted);
  font: 11.5px/1.5 var(--mono);
}
.market-publisher {
  margin: 6px 0 0;
  color: var(--muted);
  font: 11px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

/* The full fingerprint is one disclosure away: no tooltip, so a phone can reach it. */
.market-fp { display: inline-block; }
.market-fp > summary {
  display: inline;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  list-style: none;
}
.market-fp > summary::-webkit-details-marker { display: none; }
.market-fp p { margin: 3px 0 0; }
.market-fp code { font: 10.5px/1.5 var(--mono); overflow-wrap: anywhere; }

/* Ratings: the median and the count, then five plain bars. No stars, no "reviews". */
.market-ratings { margin: 14px 0; }
.market-rating-line {
  margin: 0 0 8px;
  color: var(--ink);
  font: 12.5px/1.4 var(--mono);
}
.rating-bars { display: flex; flex-direction: column; gap: 3px; max-width: 17rem; }
.rating-bar-row {
  display: grid;
  grid-template-columns: 1ch 1fr 2ch;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font: 10px/1.4 var(--mono);
}
.rating-score { text-align: right; }
.rating-track {
  height: 6px;
  border-radius: 3px;
  background: var(--rule);
  overflow: hidden;
}
.rating-fill { display: block; height: 100%; background: var(--accent); opacity: 0.75; }
.rating-count { text-align: left; }
.market-basis { margin: 8px 0 0; color: var(--muted); font: 10.5px/1.5 var(--mono); }

/* One line about a state: staged, refused, yanked, blocked. */
.market-staged {
  margin: 12px 0;
  padding: 9px 12px;
  border: 1px solid var(--gain);
  border-radius: 6px;
  color: var(--gain);
  font: 12px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.market-staged code { font: inherit; }
.market-yanked {
  margin: 10px 0;
  padding: 9px 12px;
  border: 1px solid var(--halt-rule);
  border-radius: 6px;
  background: var(--halt-bg);
  color: var(--halt-ink);
  font: 12px/1.5 var(--mono);
}
.market-blocked {
  margin: 10px 0;
  color: var(--halt-ink);
  font: 11.5px/1.5 var(--mono);
  overflow-wrap: anywhere;
}
.market-mark {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--halt-rule);
  border-radius: 4px;
  background: var(--halt-bg);
  color: var(--halt-ink);
  font: 10px/1.6 var(--mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.market-yank-reason {
  display: block;
  margin-top: 3px;
  color: var(--halt-ink);
  font: 10.5px/1.45 var(--mono);
}

/* Connector requirements: required and recommended, each with this desk's own state. */
.market-requirements { margin: 20px 0 0; }
.market-requirements h2,
.market-versions h2,
.market-rate h2,
.market-installed h2 {
  margin: 0 0 8px;
  font: 500 12px/1.3 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.market-connector-group { margin: 0 0 12px; }
.market-connector-group h3 {
  margin: 0 0 5px;
  color: var(--muted);
  font: 500 10px/1.4 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.market-connectors { margin: 0; padding: 0; list-style: none; }
.market-connectors li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  padding: 5px 0;
  border-top: 1px solid var(--rule);
}
.market-connectors li:first-child { border-top: 0; }
.market-connector-why,
.market-connector-note { color: var(--muted); font: 11px/1.5 var(--mono); }
.market-connectors-empty { margin: 0; font: 11.5px/1.5 var(--mono); }

/* Versions: its own scroll box, so at 320px the table moves and the page does not. */
.market-versions { margin: 24px 0 0; }
.market-versions-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
}
table.market-versions-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}
table.market-versions-table thead th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
table.market-versions-table td,
table.market-versions-table tbody th {
  padding: 8px 12px;
  border-top: 1px solid var(--rule);
  text-align: left;
  vertical-align: middle;
}
table.market-versions-table tbody tr:first-child > * { border-top: 0; }
table.market-versions-table tbody th { font: 500 12px/1.4 var(--mono); }
table.market-versions-table .num { text-align: right; font-family: var(--mono); }
.market-install-cell { white-space: nowrap; }
.market-install { display: inline-flex; gap: 6px; align-items: center; }
.market-install select,
.market-rate select,
.market-rate input {
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  background: var(--bg);
  color: var(--ink);
  font: 11px/1.3 var(--mono);
}
table.market-versions-table .btn {
  min-height: 30px;
  padding: 5px 11px;
  flex: 0 0 auto;
  font-size: 11px;
}
table.market-versions-table .btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Rate: a score, an optional note, and one line saying what signs it. */
.market-rate { margin: 24px 0 0; }
.market-rate form { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; }
.market-rate-k {
  color: var(--muted);
  font: 500 9.5px/1.3 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.market-rate input { width: 16rem; max-width: 100%; }

.market-installed { margin: 24px 0 0; }
.market-update { margin: 6px 0 0; color: var(--muted); font: 11px/1.5 var(--mono); }
.market-update code { font: inherit; }

.market-cursor { margin: 16px 0 0; font: 11.5px/1.5 var(--mono); }
.market-cursor a { color: var(--accent); }

@media (max-width: 719px) {
  .market-search { width: 100%; }
  .market-search input { flex: 1 1 auto; width: auto; }
  .market-sorts { margin-left: 0; }
  .market-card { padding: 12px 13px 13px; }
}

/* ---- Connectors as tiles: the default view ---------------------------------------------------
   A verified connector is a fact about work the desk has done, so it is one glyph, one name and a
   dot — a shape you scan, not a row of diagnostics you read. The diagnostics live behind one link
   (`all connectors`), because that matrix answers a different question ("why is this not
   working?") and is not what an operator opens the page to see. */

.connectors-toggle {
  margin: 0 0 12px;
  font: 11.5px/1.5 var(--mono);
}
.connectors-toggle a { color: var(--accent); }
.connectors-toggle a:hover { text-decoration: underline; }
.connectors-basis { margin: 0 0 16px; }

/* Fixed-ish tracks rather than `1fr`: two verified connectors should read as two tiles at the
   left, not as two columns stretched across a wall with nothing in it. */
.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 12rem));
  justify-content: start;
  gap: 10px;
}

.connector-tile {
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--panel);
  transition: border-color 120ms ease;
}
.connector-tile[open] { border-color: var(--rule-strong); }
.connector-tile > summary {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 8px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 12px 13px;
  cursor: pointer;
  list-style: none;
}
.connector-tile > summary::-webkit-details-marker { display: none; }
.connector-tile > summary:hover { border-radius: 10px; background: var(--bg); }
.connector-tile > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 10px;
}

/* The glyph is decoration; the name beside it is the word. `currentColor` keeps one path set
   legible in both schemes and under any future tone. */
.connector-glyph {
  display: block;
  color: var(--muted);
  flex: 0 0 auto;
}
.connector-tile[open] .connector-glyph { color: var(--ink); }

.connector-name {
  font: 500 13px/1.35 var(--sans);
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* The state dot is reinforcement for the tile, never the only signal: the state is in the
   sr-only word inside the summary and in the tile body's evidence. */
.connector-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule-strong);
}
.connector-dot.tone-ok { background: var(--gain); }
.connector-dot.tone-wait { background: var(--stale); }
.connector-dot.tone-bad { background: var(--halt-ink); }
.connector-dot.tone-none { background: var(--rule-strong); }

.connector-tile-body {
  padding: 0 13px 12px 47px;
  border-top: 1px solid var(--rule);
  margin-top: 2px;
  padding-top: 10px;
}
.connector-evidence {
  margin: 0;
  color: var(--muted);
  font: 11px/1.55 var(--mono);
  overflow-wrap: anywhere;
}
.connector-doc-line { margin: 6px 0 0; font: 11px/1.4 var(--mono); }

@media (max-width: 719px) {
  .connector-grid {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 8px;
  }
  .connector-tile > summary { grid-template-columns: 22px minmax(0, 1fr) 8px; gap: 8px; padding: 10px 11px; }
  .connector-glyph { width: 22px; height: 22px; }
  .connector-name { font-size: 12.5px; }
  .connector-tile-body { padding-left: 41px; }
}
