:root {
  --bg: #f4f6f8; --panel: #ffffff; --panel-2: #eef2f5; --text: #15202b; --muted: #5b6875;
  --border: #d5dde4; --accent: #0b6e99; --accent-ink: #ffffff; --accent-soft: #d9ecf5;
  --demand: #c2410c; --demand-soft: #fde8dc; --supply: #1d4ed8; --supply-soft: #dfe8fd;
  --focus: #7c3aed; --danger: #b91c1c; --ok: #15803d; --ok-soft: #dcfce7; --warn: #a16207; --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .05);
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --panel: #161b22; --panel-2: #1f2630; --text: #e6edf3; --muted: #9aa7b4;
    --border: #2d3743; --accent: #58b6dd; --accent-ink: #04202c; --accent-soft: #0d3a4d;
    --demand: #fb923c; --demand-soft: #3a2415; --supply: #7aa2ff; --supply-soft: #1a2747;
    --focus: #c4b5fd; --danger: #f87171; --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --shadow: none;
    color-scheme: dark;
  }
}

/* Illustration palette (used by public/illustrations.js). */
:root {
  --il-skin: #f2b58f; --il-hair: #3b2a20; --il-ink: #1f2a37; --il-shadow: rgb(15 23 42 / .12);
  --il-demand: #f97316; --il-demand-soft: #ffedd5; --il-supply: #3b82f6; --il-supply-soft: #dbeafe;
  --il-accent: #0b6e99; --il-sun: #fbbf24; --il-hill: #d7e9f1; --il-house: #ffffff; --il-window: #bae6fd;
  --il-leaf: #34d399; --il-bubble: #ffffff; --il-heart: #ef4444; --il-metal: #94a3b8; --il-water: #38bdf8; --il-box: #d6a26b;
  --tone-blue: #e0ecff; --tone-yellow: #fef3c7; --tone-rose: #ffe4e6; --tone-violet: #ede9fe; --tone-orange: #ffedd5; --tone-teal: #d5f5ef;
  --hero-a: #e4f1f8; --hero-b: #e8efff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --il-skin: #e0a47f; --il-hair: #2a1d14; --il-ink: #3f4d60; --il-shadow: rgb(0 0 0 / .35);
    --il-demand: #fb923c; --il-demand-soft: #3a2415; --il-supply: #7aa2ff; --il-supply-soft: #1a2747;
    --il-accent: #58b6dd; --il-sun: #fcd34d; --il-hill: #163445; --il-house: #dbe4ee; --il-window: #7dd3fc;
    --il-leaf: #34d399; --il-bubble: #e6edf3; --il-heart: #f87171; --il-metal: #9aa7b4; --il-water: #38bdf8; --il-box: #c08a55;
    --tone-blue: #172544; --tone-yellow: #342a10; --tone-rose: #3a1a22; --tone-violet: #2a2146; --tone-orange: #3a2415; --tone-teal: #113a34;
    --hero-a: #0f2d3c; --hero-b: #16213b;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
/* App shell: panes scroll inside themselves, the page itself never scrolls (stops the whole layout sliding up). */
html, body { overflow: hidden; }
body { height: 100dvh; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Visible focus everywhere */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.cards:focus-visible, .chat-log:focus-visible { outline-offset: -3px; }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: calc(8px + var(--sat, 0px)); }

kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78em; padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); color: var(--text); }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; margin-right: auto; }
.field-inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; }
select, input[type=search], .field input, .field textarea, .field select {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text);
}
.actions { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
a.btn { text-decoration: none; color: var(--text); }   /* links styled as buttons (e.g. header Join -> /apply) */
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }
.btn.icon { width: 36px; height: 36px; justify-content: center; padding: 0; font-weight: 700; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--danger); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn[hidden] { display: none; }

/* ---------- layout ---------- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.5fr) minmax(260px, 1fr); gap: 12px; padding: 12px; }
.pane { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.pane-head h2 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.pane-sub { margin: 2px 0 8px; color: var(--muted); font-size: .85rem; }
.chat-pane .pane-sub { margin-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.demand .dot { background: var(--demand); }
.supply .dot { background: var(--supply); }
.count { font-size: .75rem; font-weight: 600; background: var(--panel-2); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.filter { width: 100%; }
.relevance { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: .82rem; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 8px; padding: 6px 8px; }
.relevance[hidden] { display: none; }
.btn.small { padding: 3px 8px; font-size: .8rem; }
.btn.small kbd { margin-left: 2px; }
.more-row { display: flex; justify-content: center; padding: 4px 0 8px; }

.pane-tabs { display: none; }

/* ---------- listing cards ---------- */
.cards { list-style: none; margin: 0; padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; scroll-padding: 10px; }
.card {
  width: 100%; text-align: left; border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 10px;
  padding: 10px 12px; background: var(--panel); cursor: pointer; display: grid; gap: 4px;
}
.demand .card { --c: var(--demand); --soft: var(--demand-soft); }
.supply .card { --c: var(--supply); --soft: var(--supply-soft); }
.card:hover { background: var(--panel-2); }
.card[aria-current="true"] { background: var(--soft); }
.card.matched { box-shadow: 0 0 0 2px var(--accent) inset; }
.card-title { font-weight: 600; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: .8rem; }
/* --soft is set per card by .demand/.supply, so a tag OUTSIDE a card (a match row in the chat, a
   result list) had no background at all and rendered as bare text. Fall back to the panel tint. */
.tag { background: var(--soft, var(--panel-2)); color: var(--text); border-radius: 999px; padding: 0 8px; font-size: .75rem; }
.card-desc { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { color: var(--muted); padding: 16px; text-align: center; font-size: .9rem; }

/* ---------- chat ---------- */
.chat-log { flex: 1; min-height: 0; overscroll-behavior: contain; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 4px; }
.msg.error { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.msg.typing { color: var(--muted); font-style: italic; }
.msg-label { font-size: .72rem; color: var(--muted); display: block; margin-bottom: 2px; white-space: normal; }
.msg.user .msg-label { color: inherit; opacity: .8; }

.matches { display: grid; gap: 8px; margin-top: 10px; white-space: normal; }
.match { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; }
.match-pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; }
.match-side { font-size: .85rem; }
.match-side strong { display: block; }
.match-side.d strong { color: var(--demand); }
.match-side.s strong { color: var(--supply); }
.match-side small { color: var(--muted); display: block; }
.match-link { align-self: center; color: var(--accent); font-weight: 700; }
.match-reason { font-size: .82rem; color: var(--muted); margin: 0; }
.match-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.match-actions .btn { padding: 4px 10px; font-size: .82rem; }
.proposal { margin-top: 10px; border: 1px dashed var(--accent); border-radius: 10px; padding: 8px 10px; white-space: normal; display: grid; gap: 6px; }

.suggestions { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 14px 8px; }
.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-size: .85rem; cursor: pointer; }
.suggestions[hidden] { display: none; }
.chip:hover { background: var(--accent-soft); }

.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--border); }
.composer textarea {
  resize: none; min-height: 44px; max-height: 40vh; overflow-y: auto; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.send { width: 44px; height: 44px; justify-content: center; padding: 0; align-self: end; }
.hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: .78rem; }

/* ---------- dialogs ---------- */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--panel); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog-body { padding: 16px 18px; display: grid; gap: 12px; overflow-y: auto; max-height: calc(100vh - 34px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-head h2 { margin: 0; font-size: 1.1rem; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.field { display: grid; gap: 4px; font-size: .9rem; }
.field > span { color: var(--muted); }
.field textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend { color: var(--muted); font-size: .9rem; margin-bottom: 4px; }
.seg label { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.form-error { color: var(--danger); margin: 0; min-height: 1em; }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.keys td:first-child { white-space: nowrap; width: 40%; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }

.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.toast.show { opacity: 1; }

/* ---------- web of trust ---------- */
.muted { color: var(--muted); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; border: 1px solid var(--border); background: var(--panel-2); border-radius: 999px; padding: 1px 8px; color: var(--text); }
.pill.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.avail { display: inline-flex; align-items: center; gap: 5px; }
.avail-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; border: 2px solid var(--muted); flex: none; }
.avail.on { color: var(--ok); font-weight: 600; }
.avail.on .avail-dot { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.avail.off { color: var(--muted); }
.avail-btn[aria-pressed="true"] { border-color: var(--ok); background: var(--ok-soft); }
.card-trust { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .8rem; }
.trust-badge { color: var(--ok); }
.dir-badge { color: var(--text); background: var(--panel-2); border: 1px solid var(--border, currentColor); border-radius: 999px; padding: 0 8px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .85rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.notice { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; margin: 0; font-size: .88rem; }
.notice[hidden] { display: none; }
.hint.ok-text { color: var(--ok); }
dialog.wide-dialog { width: min(720px, calc(100vw - 24px)); }
.acc-section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; display: grid; gap: 8px; }
.acc-section h3 { margin: 0; font-size: .98rem; }
.acc-section p { margin: 0; }
.dialog-body.flat { padding: 0; overflow: visible; max-height: none; gap: 8px; }
.notice.dialog-body.flat { padding: 10px; }
progress { width: 100%; height: 12px; accent-color: var(--ok); }
.copy-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: end; }
.copy-row input { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { flex: 1; min-width: 180px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.plain-list, .ref-list, .member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plain-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.row-actions { display: flex; gap: 6px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.ref-list li { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.ref-list blockquote { margin: 0; }
.ref-by { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 0; }
.trust-path { margin: 0; padding: 8px 10px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 6px; }
#profile-title { margin-right: auto; }
.member-list { max-height: 50vh; overflow-y: auto; }
/* The rewritten directory card puts an avatar before the name, so this has to be a row —
   as a plain block button the 32px avatar sat on its own line above the name. */
.member-row { width: 100%; text-align: left; border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 8px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; }
.member-row:hover { background: var(--panel-2); }
#account-btn kbd, #avail-btn kbd, #community-btn kbd { margin-left: 2px; }
.actions { flex-wrap: wrap; justify-content: flex-end; }

/* ---------- views: simple (guided chat) / advanced (lists + chat) ---------- */
body[data-view="advanced"] .simple-only, body[data-view="simple"] .adv-only { display: none !important; }
body[data-view="simple"] .list-pane, body[data-view="simple"] .pane-tabs,
body[data-view="simple"] #community-btn, body[data-view="simple"] #add-btn, body[data-view="simple"] #suggestions { display: none !important; }
body[data-view="simple"] .layout { grid-template-columns: minmax(0, 860px); justify-content: center; }
body[data-view="simple"] .layout #pane-chat { display: flex; }
body[data-view="simple"] .msg { max-width: 100%; }
body[data-view="simple"] .msg.user { max-width: 80%; }

.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--panel-2); }
.view-switch button { border: 0; background: transparent; border-radius: 999px; padding: 4px 12px; cursor: pointer; color: var(--muted); font-size: .88rem; }
.view-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.view-switch button:hover:not([aria-pressed="true"]) { color: var(--text); }

.simple-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.steps { list-style: none; margin: 0 auto 0 0; padding: 0; display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.steps li { display: flex; align-items: center; gap: 6px; }
.step-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); font-size: .72rem; font-weight: 700; }
.steps li[aria-current="step"] { color: var(--text); font-weight: 600; }
.steps li[aria-current="step"] .step-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.done .step-n { border-color: var(--ok); color: var(--ok); }

.choice-big { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; white-space: normal; }
.big-choice { display: flex; align-items: center; gap: 12px; text-align: left; border: 2px solid var(--border); background: var(--panel); border-radius: 12px; padding: 14px 16px; cursor: pointer; }
.big-choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.big-choice strong { display: block; font-size: 1.05rem; }
.big-choice small { color: var(--muted); }
.big-choice.need { border-left: 6px solid var(--demand); }
.big-choice.offer { border-left: 6px solid var(--supply); }
.big-icon { font-size: 1.8rem; line-height: 1; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; white-space: normal; }
.choice-grid .chip { padding: 7px 14px; font-size: .92rem; }
.chip.other { border-style: dashed; }

.simple-results { margin-top: 10px; display: grid; gap: 8px; white-space: normal; }
.results-h { margin: 0; font-size: .95rem; }
.simple-results .check { margin-top: 0; }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--supply); border-radius: 10px; padding: 10px 12px; }
.result.demand { border-left-color: var(--demand); }
.result-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.result-meta, .result-reason { color: var(--muted); font-size: .84rem; }
.result-reason { font-style: italic; }
.simple-results .more { justify-self: start; }
.next-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-top: 1px dashed var(--border); padding-top: 8px; }
.next-steps .btn { padding: 5px 10px; font-size: .85rem; }
.next-label { color: var(--muted); font-size: .85rem; }

/* ---------- simple view: illustrated design ---------- */
.art { display: inline-block; line-height: 0; flex: none; }
.art svg { width: 100%; height: 100%; display: block; }
body[data-view="simple"] #pane-chat {
  background:
    radial-gradient(circle at 0 0, var(--hero-a), transparent 38%),
    radial-gradient(circle at 100% 100%, var(--hero-b), transparent 40%),
    var(--panel);
}
body[data-view="simple"] .chat-log { gap: 16px; padding: 18px 18px 18px 14px; }
body[data-view="simple"] .msg { border-radius: 16px; }
body[data-view="simple"] .msg.assistant { position: relative; margin-left: 46px; max-width: calc(100% - 46px); background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow); border-top-left-radius: 4px; border-bottom-left-radius: 16px; }
body[data-view="simple"] .msg.user { box-shadow: var(--shadow); border-bottom-right-radius: 4px; }
.msg-avatar { position: absolute; left: -46px; top: 0; width: 36px; height: 36px; }

/* typing indicator */
.msg.typing { display: block; }
.dots { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .35; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* progress bar */
body[data-view="simple"] .simple-bar { background: color-mix(in srgb, var(--panel) 85%, transparent); padding: 10px 14px; }
.steps { gap: 6px; counter-reset: none; }
.steps li { position: relative; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); }
.steps li + li::before { content: ""; position: absolute; left: -7px; top: 50%; width: 6px; border-top: 2px solid var(--border); }
.step-n { width: 26px; height: 26px; background: var(--panel); }
.step-n .art { width: 15px; height: 15px; }
.steps li[aria-current="step"] { background: var(--accent-soft); border-color: var(--accent); }
.steps li.done { border-color: var(--ok); }
.steps li.done .step-n { background: var(--ok-soft); }
.steps li.done + li::before { border-top-color: var(--ok); }

/* welcome hero */
.msg .hero { display: flex; align-items: center; gap: 12px 18px; white-space: normal; margin: 6px -12px 0; padding: 14px 14px 0 16px;
  background: linear-gradient(120deg, var(--hero-a), var(--hero-b)); flex-wrap: wrap; }
.hero-text { flex: 1 1 260px; display: grid; gap: 6px; padding-bottom: 14px; }
.hero-title { font-size: 1.35rem; line-height: 1.2; letter-spacing: -.01em; }
.hero-art { width: min(300px, 100%); aspect-ratio: 360 / 170; margin-left: auto; align-self: flex-end; }

/* the two big choices */
.choice-big { gap: 12px; margin-top: 14px; }
.big-choice { gap: 14px; border-radius: 16px; padding: 14px 16px 14px 12px; border-left-width: 2px !important; color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.big-choice:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgb(15 23 42 / .12); }
.big-choice.need { border-color: color-mix(in srgb, var(--demand) 45%, var(--border)); background: linear-gradient(135deg, var(--panel) 55%, var(--demand-soft)); }
.big-choice.offer { border-color: color-mix(in srgb, var(--supply) 45%, var(--border)); background: linear-gradient(135deg, var(--panel) 55%, var(--supply-soft)); }
.big-choice.need:hover { border-color: var(--demand); } .big-choice.offer:hover { border-color: var(--supply); }
.big-art { width: 84px; height: 84px; }
.big-text { display: grid; gap: 2px; }
.big-choice strong { font-size: 1.12rem; }
.big-go { margin-top: 6px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.how { list-style: none; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--border); display: flex; flex-wrap: wrap; gap: 8px 18px; white-space: normal; }
.how li { display: flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.how strong { color: var(--text); }
.how-art { width: 28px; height: 28px; padding: 5px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }

/* kind-of-help tiles */
.choice-grid.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 12px; }
.tile { display: grid; justify-items: center; align-content: start; gap: 8px; padding: 12px 8px 10px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--panel); color: var(--text); cursor: pointer; font: inherit; font-size: .9rem; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 20px rgb(15 23 42 / .1); }
.tile-pic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--tone, var(--panel-2)); }
.tile-pic .art { width: 44px; height: 44px; }
.tile-label { font-weight: 600; line-height: 1.2; }
.tile.other { border-style: dashed; }
.tile.other .tile-label { font-weight: 500; color: var(--muted); }
.tone-blue { --tone: var(--tone-blue); } .tone-yellow { --tone: var(--tone-yellow); } .tone-rose { --tone: var(--tone-rose); }
.tone-violet { --tone: var(--tone-violet); } .tone-orange { --tone: var(--tone-orange); } .tone-teal { --tone: var(--tone-teal); }

/* result cards */
body[data-view="simple"] .result { border-left-width: 1px; border-radius: 14px; padding: 12px; gap: 10px 14px; flex-wrap: nowrap; align-items: flex-start; }
body[data-view="simple"] .result.supply { box-shadow: inset 4px 0 0 var(--supply); }
body[data-view="simple"] .result.demand { box-shadow: inset 4px 0 0 var(--demand); }
.result-pic { position: relative; flex: none; width: 56px; height: 56px; margin-left: 4px; border-radius: 14px; display: grid; place-items: center; background: var(--supply-soft); }
.result.demand .result-pic { background: var(--demand-soft); }
.result-pic > .art { width: 38px; height: 38px; }
.initials { position: absolute; right: -6px; bottom: -6px; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center;
  font-size: .68rem; font-weight: 700; background: var(--panel); color: var(--text); border: 2px solid var(--border); }
.result.is-available .initials { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
body[data-view="simple"] .result .match-actions { flex: none; align-self: center; }
.empty-state { display: flex; align-items: center; gap: 14px; padding: 8px 4px; }
.empty-art { width: 110px; height: 82px; }
.results-h { font-size: 1rem; }

@media (max-width: 640px) {
  .msg .hero { flex-direction: column-reverse; align-items: stretch; }
  .hero-art { width: 100%; max-width: 280px; margin: 0 auto; }
  .hero-title { font-size: 1.15rem; }
  .big-art { width: 64px; height: 64px; }
  .choice-grid.tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .tile-pic { width: 52px; height: 52px; } .tile-pic .art { width: 36px; height: 36px; }
  body[data-view="simple"] .msg.assistant { margin-left: 0; max-width: 100%; }
  .msg-avatar { position: static; width: 24px; height: 24px; vertical-align: middle; margin: -2px 6px 0 0; }
  body[data-view="simple"] .msg.assistant .msg-label { display: inline; }
  .hero-text { flex: none; }
  body[data-view="simple"] .result { flex-wrap: wrap; }
  body[data-view="simple"] .result .match-actions { flex: 1 1 100%; }
  body[data-view="simple"] .result-main { flex: 1 1 0; }
  .result-pic { width: 46px; height: 46px; } .result-pic > .art { width: 32px; height: 32px; }
  .steps li { padding: 3px; }
  .steps li[aria-current="step"] { padding-right: 10px; }
  .step-n { width: 22px; height: 22px; }
}

@media (max-width: 1600px) { .topbar .actions kbd { display: none; } .topbar { gap: 10px; } }

/* ---------- small screens: one pane at a time ---------- */
@media (max-width: 900px) {
  .topbar { gap: 6px 8px; padding: 8px 10px; }
  .brand { font-size: 1rem; }
  .controls { order: 3; width: 100%; gap: 8px; flex-wrap: nowrap; }
  .controls .field-inline:first-child { flex: 1; min-width: 0; }
  .controls select { min-width: 0; max-width: 100%; }
  #location-select { flex: 1; }
  .actions { margin-left: auto; }
  .btn.primary kbd, .composer .hint, .actions .wide, .actions kbd { display: none; }
  .copy-row { grid-template-columns: 1fr; }
  .composer { padding: 8px 10px; }
  .pane-tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border-bottom: 1px solid var(--border); }
  .pane-tabs [role=tab] { border: 0; background: none; padding: 10px; border-bottom: 3px solid transparent; cursor: pointer; }
  .pane-tabs [role=tab][aria-selected=true] { border-bottom-color: var(--accent); font-weight: 600; }
  .layout { grid-template-columns: 1fr; padding: 8px; }
  .layout .pane { display: none; }
  .layout[data-active=demand] #pane-demand, .layout[data-active=chat] #pane-chat, .layout[data-active=supply] #pane-supply { display: flex; }
  .row { grid-template-columns: 1fr; }
  .view-switch button { padding: 4px 9px; }
  .steps { gap: 4px 8px; }
  .steps li { font-size: 0; gap: 0; }          /* numbers only on phones; names stay for screen readers */
  .steps li .sr-only { font-size: .82rem; }
  .steps li[aria-current="step"] { font-size: .82rem; gap: 6px; }
  body[data-view="simple"] .layout { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } .tile:hover, .big-choice:hover { transform: none; } }

/* ---------- installed / native app ---------- */
/* Keep content clear of the notch, status bar, home indicator and rounded corners.
   Capacitor on Android also exposes --safe-area-inset-* for older WebViews. */
:root {
  --sat: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
  --sab: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --sal: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  --sar: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
}
body { padding: 0 var(--sar) 0 var(--sal); }
.topbar { padding-top: calc(10px + var(--sat)); }
.composer { padding-bottom: calc(12px + var(--sab)); }
@media (max-width: 900px) {
  .topbar { padding-top: calc(8px + var(--sat)); }
  .composer { padding-bottom: calc(8px + var(--sab)); }
}
.native-app .web-only, .installed-app .web-only { display: none !important; }
.get-app-line { margin: 4px 0 0; }
/* Touch screens: no tap flash, no accidental text zoom on rotate. */
.native-app { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

/* ---------- new-request alerts ---------- */
.alert-banner { position: fixed; z-index: 50; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100vw - 20px)); display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center;
  background: var(--panel); color: var(--text); border: 2px solid var(--ok); border-radius: 12px; padding: 10px 12px;
  box-shadow: 0 8px 30px rgb(0 0 0 / .25); }
.alert-banner[hidden] { display: none; }
.alert-bell { font-size: 1.6rem; line-height: 1; animation: alert-swing 1s ease-in-out 3; transform-origin: 50% 0; }
.alert-text { margin: 0; display: grid; gap: 2px; min-width: 0; }
.alert-text strong { color: var(--ok); }
.alert-text span { overflow-wrap: anywhere; }
.alert-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes alert-swing { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(18deg); } 75% { transform: rotate(-18deg); } }
@media (prefers-reduced-motion: reduce) { .alert-bell { animation: none; } }
.alert-prefs { display: grid; gap: 4px; }
.alert-prefs .check { margin-top: 0; }
.alert-prefs select, #alert-radius { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.sub-head { margin: 6px 0 4px; font-size: .9rem; }

/* ---------- service requests, private chats, deals ---------- */
.chats-btn .badge { min-width: 1.4em; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.5; text-align: center; }
.chats-btn .badge[hidden] { display: none; }
.pill.warn { border-color: var(--warn); color: var(--warn); background: transparent; }
.pre { white-space: pre-wrap; }

.intake { display: grid; gap: 10px; margin-top: 8px; white-space: normal; }
.quick-replies { margin-top: 0; }
.request-card { border: 1px solid var(--accent); background: var(--panel); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.msg.assistant .request-card { color: var(--text); }
.request-card .detail-grid { font-size: .9rem; }

/* Requester identification + one-time-code step, shown in the chat before the provider count. */
.verify-card { border: 1px solid var(--accent); background: var(--panel); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 8px; }
.msg.assistant .verify-card { color: var(--text); }
.verify-card:focus-visible, .verify-done:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.verify-steps { margin: 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.verify-ask { margin: 0; font-size: .95rem; }
.verify-form { display: grid; gap: 10px; }
.verify-form .field input { width: 100%; box-sizing: border-box; background: var(--panel-2, var(--bg)); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: inherit; min-height: 44px; }
.verify-form .field small.hint { font-size: .75rem; }
.verify-form .code-input { font-size: 1.25rem; letter-spacing: .4em; font-variant-numeric: tabular-nums; max-width: 11ch; }
.verify-form .match-actions { gap: 8px; flex-wrap: wrap; }
.verify-form .match-actions .btn { min-height: 44px; }
.verify-form .form-error:empty { display: none; min-height: 0; }
.verify-done { margin: 0 0 8px; font-weight: 600; }
@media (max-width: 460px) {
  .verify-form .match-actions { display: grid; }
  .verify-form .match-actions .btn { width: 100%; }
  .verify-form .code-input { max-width: 100%; }
}

dialog.chats-dialog { width: min(780px, calc(100vw - 24px)); }
.chats-dialog.in-room .chats-body { height: min(820px, calc(100vh - 34px)); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.chats-dialog .dialog-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.chats-content { min-height: 0; display: grid; gap: 4px; }
.request-list, .room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.request-list > li { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.request-row-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.request-row-head .muted { font-size: .82rem; flex-basis: 100%; }
.room-row { width: 100%; text-align: left; display: grid; gap: 2px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 8px 10px; cursor: pointer; font: inherit; }
.room-row:hover { border-color: var(--accent); }
.room-row.unread { border-color: var(--ok); border-width: 2px; }
.room-row .muted { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-state { font-size: .8rem; font-weight: 600; }

.room { display: flex; flex-direction: column; gap: 8px; min-height: 0; height: 100%; }
.room-head { display: grid; gap: 4px; }
.room-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; }
.room-request summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: 2px 0; }
.room-request[open] { max-height: 30vh; overflow-y: auto; }
.room-request .detail-grid { font-size: .88rem; padding: 6px 0; }
.room-deal { flex: 0 1 auto; max-height: 45%; overflow-y: auto; }
.room-deal:empty { display: none; }
.room-deal:focus-visible { outline-offset: -3px; }
.room-deal:has(.deal-form) { max-height: none; flex: 1 1 auto; }
.room-log { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.room-log[hidden], .room-composer[hidden] { display: none; }
.room-log:focus-visible { outline-offset: -3px; }
.room-msg { max-width: 82%; padding: 8px 11px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: .92rem; }
.room-msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.room-msg.mine .msg-label { color: inherit; opacity: .85; }
.room-msg.theirs { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.room-msg.matchmaker { align-self: center; max-width: 92%; background: var(--accent-soft); border: 1px dashed var(--accent); }
.room-msg.privacy { background: var(--panel-2); border-color: var(--warn); }
.room-msg.system { align-self: center; max-width: 92%; background: transparent; color: var(--muted); font-size: .8rem; text-align: center; padding: 2px 8px; }
.room-msg.system.sealed { color: var(--ok); font-weight: 700; }
.room-msg.pending { font-style: italic; }
.redacted-note { font-weight: 600; }
.room-composer { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: end; }
.room-composer textarea { resize: none; max-height: 40vh; overflow-y: auto; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; }
.room-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.room-actions:empty { display: none; }

.deal-card { border: 2px solid var(--supply); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--panel); }
.deal-card.sealed { border-color: var(--ok); background: var(--ok-soft); }
.deal-card h3 { margin: 0; font-size: 1rem; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.deal-card .detail-grid { font-size: .9rem; }
.deal-card .field textarea, .deal-form input, .deal-form textarea { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; }
.deal-form { display: grid; gap: 10px; }
.deal-form h3 { margin: 0; font-size: 1rem; }

@media (max-width: 900px) {
  dialog.chats-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .chats-dialog .chats-body, .chats-dialog.in-room .chats-body { height: 100dvh; max-height: 100dvh; padding: calc(10px + var(--sat)) 12px calc(10px + var(--sab)); }
  .room-msg { max-width: 92%; }
  .room-deal { max-height: 40%; }
}

/* ---------- "what happens next" journey (service requests) ---------- */
.journey { margin: 4px 0 2px; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); white-space: normal; }
.journey-h { margin: 0 0 10px; font-size: .9rem; color: var(--text); }
.journey-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: none; }
.journey-step { position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; text-align: center; font-size: .8rem; color: var(--muted); }
.journey-step strong { color: var(--text); font-size: .86rem; }
.journey-text { line-height: 1.3; }
/* dashed connector between the pictures */
.journey-step:not(:last-child)::after { content: ""; position: absolute; top: 30px; left: calc(50% + 34px); right: calc(-50% + 30px); border-top: 2px dashed var(--border); }
.journey-step.done:not(:last-child)::after { border-top-style: solid; border-color: var(--accent); }
.journey-pic { position: relative; display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--panel); border: 2px solid var(--border); }
.journey-art { display: block; width: 42px; height: 42px; }
.journey-art svg { width: 100%; height: 100%; display: block; }
.journey-num { position: absolute; right: -4px; top: -4px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; background: var(--panel-2, var(--panel)); color: var(--muted); border: 1px solid var(--border); }
.journey-step.todo .journey-pic { opacity: .7; }
.journey-step.done .journey-pic { border-color: var(--accent); }
.journey-step.done .journey-num { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.journey-step.current .journey-pic { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: journey-pulse 2s ease-in-out infinite; }
.journey-step.current .journey-num { background: var(--text); color: var(--panel); border-color: var(--text); }
.journey-step.current strong { color: var(--accent); }
@keyframes journey-pulse { 50% { box-shadow: 0 0 0 7px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .journey-step.current .journey-pic { animation: none; } }
/* narrow: vertical timeline */
@media (max-width: 640px) {
  .journey-steps { grid-template-columns: 1fr; gap: 10px; }
  .journey-step { grid-template-columns: 52px 3.8em 1fr; grid-template-rows: auto; justify-items: start; align-items: center; column-gap: 10px; text-align: left; }
  .journey-step .journey-pic { grid-row: 1; width: 52px; height: 52px; }
  .journey-art { width: 36px; height: 36px; }
  .journey-step strong { white-space: nowrap; }
  .journey-step:not(:last-child)::after { top: 54px; bottom: -10px; left: 25px; right: auto; border-top: 0; border-left: 2px dashed var(--border); }
  .journey-step.done:not(:last-child)::after { border-left-style: solid; border-color: var(--accent); }
}

/* ---------- one chat thread per provider (requester side) ---------- */
.chats-dialog.in-room .chats-content { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chats-dialog.in-room .chats-content > .room, .chats-dialog.in-room .chats-content > .compare-panel { flex: 1 1 auto; min-height: 0; height: auto; }
.thread-bar { flex: 0 0 auto; display: grid; gap: 2px; min-width: 0; }
.thread-tabs { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 3px 3px 5px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.thread-tab { position: relative; flex: 0 0 auto; scroll-snap-align: start; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 5px 12px 5px 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.thread-tab:hover { border-color: var(--accent); }
.thread-tab[aria-selected="true"] { background: var(--accent-soft); border: 2px solid var(--accent); padding: 4px 11px 4px 5px; }
.thread-tab:focus-visible { outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px; }
.thread-tab.offer:not([aria-selected="true"]) { border-color: var(--supply); }
.thread-tab.sealed { border-color: var(--ok); }
.thread-tab.closed:not([aria-selected="true"]) { opacity: .7; }
.thread-tab.closed strong { text-decoration: line-through; text-decoration-thickness: 1px; }
.thread-avatar { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.thread-tab.sealed .thread-avatar { background: var(--ok); color: #fff; }
.thread-tab.closed .thread-avatar { background: var(--muted); color: var(--bg); }
.thread-tab.compare .thread-avatar { background: var(--panel); color: var(--text); border: 1px solid var(--border); font-size: 1rem; }
.thread-text { display: grid; line-height: 1.2; }
.thread-text small { color: var(--muted); font-size: .75rem; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-tab .badge { position: absolute; top: -4px; right: -4px; min-width: 1.4em; padding: 0 5px; border-radius: 999px; background: var(--danger); color: var(--bg); font-size: .7rem; font-weight: 700; line-height: 1.5; text-align: center; }
.thread-hint { margin: 0; font-size: .78rem; }

.compare-panel { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 8px; padding-right: 2px; }
.compare-panel:focus-visible { outline-offset: -3px; }
.compare-panel h3 { margin: 0; font-size: 1.02rem; }
.compare-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.compare-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--panel); display: grid; gap: 6px; align-content: start; }
.compare-card.offer { border: 2px solid var(--supply); }
.compare-card.sealed { border: 2px solid var(--ok); background: var(--ok-soft); }
.compare-card.closed { opacity: .75; }
.compare-head { display: flex; gap: 10px; align-items: center; }
.compare-head h4 { margin: 0; font-size: .98rem; }
.compare-trust { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: .8rem; }
.compare-card .room-state { margin: 0; }
.compare-card .detail-grid { font-size: .86rem; }
.compare-card .detail-grid dd { overflow-wrap: anywhere; }
.compare-card .latest { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 700px) {
  .thread-hint { display: none; }
  .compare-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) { .thread-tabs { scroll-behavior: smooth; } }

/* ---------- voice call with the matchmaker ---------- */
.call-btn kbd { margin-left: 2px; }
.mic-btn { align-self: end; }
.mic-btn[hidden], .call-btn[hidden] { display: none; }

dialog.call-dialog { width: min(520px, calc(100vw - 24px)); }
.call-body { gap: 10px; }
.call-stage { display: grid; justify-items: center; gap: 4px; padding: 4px 0 0; }
.call-orb { position: relative; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, var(--accent-soft), var(--panel-2)); border: 1px solid var(--border); font-size: 2rem; }
.call-orb-ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.call-orb-face { line-height: 1; }
.call-dialog[data-phase="listening"] .call-orb-ring { opacity: .9; animation: call-pulse 1.6s ease-out infinite; }
.call-dialog[data-phase="speaking"] .call-orb-ring { opacity: .7; border-color: var(--supply); animation: call-pulse 1.1s ease-out infinite; }
.call-dialog[data-phase="thinking"] .call-orb-ring { opacity: .6; border-style: dashed; animation: call-spin 2.4s linear infinite; }
.call-dialog[data-phase="listening"] .call-orb { transform: scale(calc(1 + var(--level, 0) * .07)); transition: transform .08s linear; }
.call-dialog[data-phase="muted"] .call-orb { filter: grayscale(1); opacity: .7; }
@keyframes call-pulse { 0% { transform: scale(1); opacity: .85; } 100% { transform: scale(1.22); opacity: 0; } }
@keyframes call-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .call-orb-ring { animation: none !important; opacity: .5 !important; }
  .call-dialog[data-phase="listening"] .call-orb { transform: none; }
}
.call-status { margin: 0; font-weight: 600; text-align: center; }
.call-time { margin: 0; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.call-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); font-size: .85rem; }
.call-note[hidden] { display: none; }

.call-captions { overflow-y: auto; max-height: min(38vh, 300px); min-height: 90px; display: grid; gap: 8px; align-content: start;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.call-captions:focus-visible { outline-offset: -3px; }
.cap { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: 8px; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cap-who { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .02em; padding-top: 2px; overflow-wrap: normal; }
.cap.you .cap-text { font-weight: 600; }
.cap.call .cap-text { color: var(--muted); font-style: italic; }
.call-interim { margin: 0; color: var(--muted); font-style: italic; font-size: .9rem; }
.call-interim[hidden] { display: none; }
.call-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.call-actions[hidden] { display: none; }
.call-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.call-mic[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.call-mic[aria-pressed="false"] { color: var(--danger); }
.call-mic.talking { box-shadow: 0 0 0 3px var(--accent-soft); }
.call-hint { grid-column: auto; }
.call-private { align-items: start; color: var(--muted); font-size: .78rem; }
.call-private[hidden] { display: none; }
.call-private input { margin-top: 2px; }

@media (max-width: 620px) {
  dialog.call-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .call-body { max-height: 100dvh; height: 100dvh; align-content: start;
    padding-bottom: calc(16px + env(safe-area-inset-bottom)); padding-top: calc(16px + env(safe-area-inset-top)); }
  .call-captions { max-height: none; flex: 1; }
  .cap { grid-template-columns: 82px 1fr; }
  .call-controls .btn { flex: 1 1 45%; justify-content: center; }
}

/* ---------- SaSo's idle call offer ---------- */
.idle-pop { position: fixed; z-index: 45; right: max(14px, env(safe-area-inset-right, 0px));
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); width: min(370px, calc(100vw - 20px));
  display: grid; grid-template-columns: 116px 1fr; gap: 4px 6px; align-items: end;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 14px; padding: 10px 12px 12px; box-shadow: 0 10px 34px rgb(0 0 0 / .22);
  animation: idle-pop-in .28s ease-out; }
.idle-pop[hidden] { display: none; }
@keyframes idle-pop-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.idle-pop-close { position: absolute; top: 2px; right: 2px; width: 30px; height: 30px; color: var(--muted); }
.idle-pop-art { grid-row: 1 / span 2; align-self: end; display: block; cursor: pointer; }
.idle-pop-art svg { width: 100%; height: auto; overflow: visible; display: block; }
.idle-pop-body { display: grid; gap: 6px; min-width: 0; }
.idle-pop-title { margin: 0; font-size: 1rem; line-height: 1.25; padding-right: 26px; }
.idle-pop-text { margin: 0; font-size: .85rem; color: var(--muted); }
.idle-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.idle-pop-actions .btn { padding: 6px 10px; }

/* SaSo's own animation: a gentle bob, a waving arm holding the call button, a blink and a ringing halo. */
.saso-body { animation: saso-bob 3.4s ease-in-out infinite; transform-origin: 66px 120px; }
.saso-arm { animation: saso-wave 2.6s ease-in-out infinite; transform-origin: 100px 102px; }
.saso-ring { animation: saso-ring 2.1s ease-out infinite; transform-origin: 136px 58px; }
.saso-eyes { animation: saso-blink 6s ease-in-out infinite; transform-origin: 66px 63px; }
.saso-spark { animation: saso-spark 1.9s ease-in-out infinite; }
.idle-pop-art:hover .saso-arm, .idle-pop-art:focus-within .saso-arm { animation-duration: 1.1s; }
@keyframes saso-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes saso-wave { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(6deg); } }
@keyframes saso-ring { 0% { transform: scale(.78); opacity: .85; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes saso-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.12); } }
@keyframes saso-spark { 0%, 100% { opacity: .4; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .idle-pop { animation: none; }
  .saso-body, .saso-arm, .saso-ring, .saso-eyes, .saso-spark { animation: none !important; }
  .saso-ring { opacity: .5; }
}
@media (max-width: 620px) {
  .idle-pop { left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); width: auto;
    grid-template-columns: 92px 1fr; }
  .idle-pop-title { font-size: .95rem; }
}

/* =====================================================================
   HealthLink — hiring pipeline, settlement, contact release, directory.
   Everything below is written in terms of the tokens declared at the top
   of this file, so light and dark themes both follow automatically.
   ===================================================================== */

/* A plain .tag outside a .demand/.supply card had no --soft to read, so it
   rendered with no background at all. Give it a fallback. */
.tag { background: var(--soft, var(--panel-2)); }
.tag.ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }

/* ---------- small shared helpers ---------- */
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.plain-list.tight li { padding: 2px 0; border-bottom: 0; font-size: .85rem; color: var(--muted); }
.field-wrap { display: grid; gap: 4px; min-width: 0; }
.pay { font-weight: 600; color: var(--text); }
.score { font-weight: 600; color: var(--accent); font-size: .85rem; }

/* "Why HealthLink matched you" — the score plus its reasons. */
.why { display: grid; gap: 4px; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.why-list li { font-size: .75rem; color: var(--muted); background: var(--panel-2);
  border-radius: 999px; padding: 1px 8px; }

/* ---------- the pipeline board ---------- */
.pipe-wrap { display: grid; gap: 10px; min-width: 0; }
.pipe-wrap > h3 { margin: 0; font-size: 1.05rem; }
.pipe-wrap > h3:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.pipe-board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(265px, 1fr);
  gap: 10px; align-items: start;
  overflow-x: auto; overflow-y: auto; max-height: 62vh;
  padding: 2px 2px 10px; scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.pipe-board:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

.pipe-col {
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; scroll-snap-align: start;
  border-top: 3px solid var(--border);
}
.pipe-col-h { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pipe-empty { margin: 0; font-size: .8rem; }

/* Each column is tinted by the stage it holds, so the board reads at a glance. */
.pipe-col.stage-invited     { border-top-color: var(--muted); }
.pipe-col.stage-applied     { border-top-color: var(--supply); }
.pipe-col.stage-shortlisted { border-top-color: var(--accent); }
.pipe-col.stage-interview   { border-top-color: var(--warn); }
.pipe-col.stage-offer       { border-top-color: var(--demand); }
.pipe-col.stage-hired       { border-top-color: var(--ok); }
.pipe-col.stage-rejected,
.pipe-col.stage-withdrawn   { border-top-color: var(--danger); opacity: .85; }

.pipe-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px;
  overflow-y: auto; max-height: 46vh; }
.pipe-cards:focus-visible { outline-offset: -3px; }

.pipe-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  display: grid; gap: 6px; padding: 8px; }
.pipe-card.unread { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.pipe-card:focus-within { border-color: var(--focus); }

/* The card body is one big button, so it must lay out like a block. */
.pipe-card-open { display: grid; gap: 6px; width: 100%; text-align: left;
  background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
.pipe-card-open:hover { color: var(--accent); }
.pipe-card-open:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 8px; }

.pipe-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pipe-who > span:last-child { display: grid; min-width: 0; }
.pipe-who strong { overflow-wrap: anywhere; }
.pipe-who small { font-size: .78rem; }
.pipe-score { font-size: .8rem; font-weight: 600; color: var(--accent); }
.pipe-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.pipe-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pipe-summary { font-size: .8rem; color: var(--muted); }

/* The "Move to…" disclosure. Real buttons, no drag-and-drop anywhere. */
.stage-menu { display: grid; gap: 6px; padding: 8px; margin-top: 2px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.stage-menu input { width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; font-size: .85rem; }

/* ---------- stage strip (inside one application) ---------- */
.stage-strip { display: grid; gap: 6px; }
.stage-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.stage-step { font-size: .78rem; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.stage-step.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.stage-step.current { color: var(--accent-ink); background: var(--accent);
  border-color: transparent; font-weight: 600; }
.stage-history, .settle-history { font-size: .8rem; color: var(--muted); }
.stage-history summary, .settle-history summary { cursor: pointer; padding: 2px 0; }
.stage-history summary:focus-visible, .settle-history summary:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* ---------- contact release ---------- */
.contact-panel { display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel-2); }
.contact-panel > h4 { margin: 0; }
.contact-panel p { margin: 0; font-size: .85rem; }
.contact-panel.locked { border-style: dashed; color: var(--muted); }
.contact-panel.open { border-color: var(--ok); background: var(--ok-soft); }
.contact-panel.open dt, .contact-panel.open dd { color: var(--text); }
.contact-why { font-weight: 600; font-size: .85rem; }

/* ---------- settlement ---------- */
.settle-strip { display: grid; gap: 8px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); border-left: 4px solid var(--accent); }
.settle-strip > h3 { margin: 0; font-size: .98rem; display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; }
.settle-strip > h3:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.settle-strip.mode-escrow { border-left-color: var(--supply); }
.settle-strip.status-released, .settle-strip.status-paid { border-left-color: var(--ok); }
.settle-strip.status-refunded { border-left-color: var(--danger); }
.settle-strip.status-awaiting_prepayment, .settle-strip.status-invoiced { border-left-color: var(--warn); }

.settle-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.settle-step { font-size: .83rem; color: var(--muted); }
.settle-step.done { color: var(--ok); }
.settle-step.current { color: var(--text); font-weight: 600; }
.settle-plan { font-size: .83rem; color: var(--muted); }
.settle-action { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.settle-action input { flex: 1 1 170px; min-width: 0; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--panel); color: var(--text); font: inherit; font-size: .85rem; }

/* ---------- top matches ---------- */
.match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.match-list > li { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px;
  background: var(--panel); display: grid; gap: 6px; }
.match-row { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.match-row > div { display: grid; gap: 3px; min-width: 0; }
.match-row p { margin: 0; font-size: .83rem; }
.room-match { display: grid; gap: 4px; }
.room-sub { font-size: .83rem; }

/* ---------- directory ---------- */
.dir-filters { display: grid; gap: 8px; }
.dir-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.dir-field { display: flex; align-items: center; }
.dir-row .check { margin-top: 0; }

.member-card { display: grid; gap: 6px; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; background: var(--panel); }
.member-main { display: grid; gap: 2px; min-width: 0; text-align: left; }
.member-main .muted { font-size: .82rem; }
.member-card .row-actions { flex-wrap: wrap; }

/* ---------- ratings ---------- */
.rating-badge { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.rating-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: .85rem; }
.stars { color: var(--warn); letter-spacing: .06em; }
.stars-pick { display: inline-flex; gap: 2px; }
.star-opt { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; font-size: .85rem; }
.star-opt input { accent-color: var(--accent); }

/* ---------- profile + opening forms ---------- */
.opening-form { display: grid; gap: 10px; }
.check-set { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 12px;
  margin: 0; display: grid; gap: 2px; min-width: 0; }
.check-set legend { font-size: .85rem; font-weight: 600; padding: 0 4px; color: var(--muted); }
.check-set .hint { margin: 6px 0 0; }
.check-set .row { margin-top: 6px; }

.upload-row { display: grid; gap: 6px; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; background: var(--panel-2); }
.upload-row p { margin: 0; font-size: .85rem; }
.upload-row .row-actions { display: inline-flex; margin-left: 8px; }
.upload-row input[type="file"] { font-size: .85rem; max-width: 100%; }
.logo-preview { display: flex; align-items: center; gap: 10px; }
.logo-preview img { border-radius: 8px; border: 1px solid var(--border); background: var(--panel); object-fit: contain; }

.branch-list { display: grid; gap: 8px; }
.branch-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }

.org-detail { display: flex; gap: 12px; align-items: flex-start; }
.org-logo { border-radius: 8px; border: 1px solid var(--border); background: var(--panel);
  object-fit: contain; flex: 0 0 auto; }

.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pick-list .check { margin-top: 0; align-items: flex-start; }
.pick-list .check span { display: grid; }

.avail-line { margin: 0; font-size: .88rem; }
.invitation { display: grid; gap: 4px; }
.result-title { display: block; }
.result-sub { font-size: .83rem; color: var(--muted); }

/* ---------- index.html bits that had no rules ---------- */
.role-seg { flex-wrap: wrap; }
.invite-toggle { justify-self: start; }
.step-label { white-space: nowrap; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  /* The board stops being columns and becomes one scrolling stack. */
  .pipe-board { grid-auto-flow: row; grid-auto-columns: auto; max-height: none;
    overflow-x: visible; scroll-snap-type: none; }
  .pipe-cards { max-height: none; }
  .branch-row { grid-template-columns: 1fr; }
  .row.three { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dir-row { gap: 8px; }
  .dir-row > * { flex: 1 1 100%; }
  .org-detail { flex-direction: column; }
  .settle-action input { flex-basis: 100%; }
  .upload-row .row-actions { margin-left: 0; margin-top: 6px; display: flex; }
}

/* The second counter on the Engagements button is a money step waiting on you,
   not an unread message — it must not look like the unread badge. */
.chats-btn .badge.action { background: var(--warn); color: #1b1403; }

/* The pipeline board is the one view that genuinely needs the screen's full width: at the
   dialog's default 780px only 2.7 of its six columns were visible on a 1440px display, with
   660px of screen going unused. Widen the dialog only while a board is in it. Scoped to
   >=901px so the mobile full-screen rule above still wins on small screens. */
@media (min-width: 901px) {
  dialog.chats-dialog:has(.pipe-board) { width: min(1480px, calc(100% - 36px)); }
}

/* Headings that exist only as programmatic focus targets (tabindex="-1", moved to after an
   action completes). :focus-visible does not match when focus arrives straight after a click,
   so the user would get no signal that focus had moved. These can never be clicked into by a
   mouse user, so a plain :focus ring is safe here and keeps focus visible in both themes. */
#settle-h:focus, #pipeline-h:focus, .pipe-wrap > h3:focus {
  outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px;
}

/* The two front doors on the welcome card became links to the guided sign-up (/onboard), so they
   need an anchor's defaults cleared — they were <button>s. */
.big-choice { text-decoration: none; color: var(--text); }
.big-choice:hover strong, .big-choice:hover small { text-decoration: none; }
/* A button that reads as a link, for the "just browse instead" escape hatch under them. */
.linkish {
  font: inherit; color: var(--accent); background: none; border: 0; padding: 0;
  text-decoration: underline; cursor: pointer;
}
.linkish:hover { text-decoration: none; }
.linkish:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.hint.center { text-align: center; }

/* ---------------------------------------------------------------------------
   The onboarding agent on the home page.
   Written only in terms of the existing tokens, so dark theme and the mobile
   breakpoints below need no extra rules.
   --------------------------------------------------------------------------- */

/* Live profile completeness. Turns accent-coloured the moment there is enough
   to match on, which is the same moment the stepper moves to "Matches". */
.onb-progress { display: grid; gap: 4px; margin: 10px 0 2px; }
.onb-progress .hint { grid-column: 1; }
.onb-bar { height: 6px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
.onb-bar > span { display: block; height: 100%; width: 0; background: var(--muted); border-radius: 999px; transition: width .25s ease; }
.onb-progress.ready .onb-bar > span { background: var(--accent); }
.onb-progress.ready .hint { color: var(--accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .onb-bar > span { transition: none; } }

/* Suggested answers under a question, inside the chat rather than above the composer. */
.suggestions.inline { padding: 8px 0 2px; }

/* A cross-cover match says so. Never styled as an error — it is a real, if
   inexact, match, and the label is what keeps it honest. */
.tag.related { background: var(--accent-soft); color: var(--text); font-style: italic; }
.result.is-related { border-left-style: dashed; }

.hint.muted { color: var(--muted); }

/* On a phone the agent's answers are tapped, not clicked. The chips and the
   buttons inside a match row were 29–30px high, which is below a comfortable
   target; give everything inside the chat a 44px minimum there. Desktop keeps
   the denser sizing, where a pointer is precise. */
@media (max-width: 700px) {
  #chat-log .chip,
  #chat-log .btn,
  #chat-log .match-actions .btn,
  #chat-log .match-actions a.btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #chat-log .suggestions.inline { gap: 8px; }
}

/* ---------------------------------------------------------------- relocation needs & package fit
   `display: contents` on purpose: the wrapper exists so the onboarding panel can be re-rendered in
   place when somebody edits a must-have, and it must not add a box that changes any of the existing
   `.msg .hero` / `.msg.assistant .request-card` layout.

   The ✓ / ✗ / ? states are distinguished by the SYMBOL in the text as well as by colour, and each tag
   carries an aria-label spelling out "Included" / "Not included" / "Not stated" — "not stated" is a
   different fact from "not included" and must survive a monochrome screen and a screen reader both. */
.msg-extras { display: contents; }

.fit-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: baseline; margin-top: 4px; font-size: .8rem; }
.fit-label { color: var(--muted); font-weight: 700; }
.fit-note { flex: 1 1 100%; margin: 2px 0 0; font-size: .78rem; }
/* See the note in onboard.css: one of these tags carries a school name and must wrap rather than be
   clipped at the card edge. */
.tag.fit { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.tag.fit.ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.tag.fit.no { border-color: var(--danger); color: var(--danger); background: transparent; }
.tag.fit.unknown { border-style: dashed; border-color: var(--warn); color: var(--warn); background: transparent; }

.needs-card { margin: 10px 0 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.needs-card .results-h { margin-top: 0; }
.need-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.need-sub { margin: 8px 0 0; text-transform: uppercase; letter-spacing: .5px; font-size: .74rem; }
.need-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .82rem; padding: 3px 4px 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
}
.need-chip.must { border-color: var(--accent); background: var(--accent-soft); }
.need-x {
  appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 1.05rem; line-height: 1; min-width: 28px; min-height: 28px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.need-x:hover { color: var(--danger); background: var(--panel); }
.need-x:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 44px minimum where a finger is the pointer, 28px where a mouse is — a sidebar of 44px × buttons on
   a desktop would be absurd, and 28px on a phone is unusable. Keyed on the viewport width as well as
   the pointer, because a desktop browser at a phone width reports a FINE pointer — which is precisely
   the configuration every responsive check is run in, so `coarse` alone is a rule nobody verifies. */
@media (pointer: coarse), (max-width: 700px) {
  .need-chip { padding: 5px 4px 5px 12px; }
  .need-x { min-width: 44px; min-height: 44px; }
  .tag.fit { padding: 5px 10px; }
}

/* =============================================================================================
   The answer control under the agent's question (see public/answers.js)

   Shared by the home-page matchmaker and /onboard, because they are one agent and one conversation —
   a chip that looks or behaves differently depending on which page you are on is not a style
   difference, it is two answers to the same question.

   Everything here is a real radio, checkbox, number box, select or date input. The native control is
   left VISIBLE inside each chip rather than hidden behind a styled box: it is what tells someone at a
   glance whether this question takes one answer or several, and it is what makes Space, the arrow keys
   and a screen reader work without a line of JavaScript.
   ============================================================================================= */
.ans-wrap { display: flex; flex-direction: column; gap: 6px; }
.ans-lead { margin: 0; }
.ans-hint { margin: 0; color: var(--muted); }
.ans { display: flex; flex-direction: column; gap: 8px; }

/* ---- the chip group ---- */
.ans-set {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0; padding: 0; border: 0; min-width: 0;
}
.ans-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; min-height: 36px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel); color: var(--text);
  font-size: .92rem; line-height: 1.25; cursor: pointer;
  /* A long option carries a whole phrase ("A school with the right curriculum within reach"); it wraps
     inside the chip rather than being clipped at the container edge. */
  max-width: 100%; overflow-wrap: anywhere;
}
/* `display: inline-flex` beats the UA stylesheet's `[hidden] { display: none }` on specificity, so the
   options past "Show more" would render anyway. Give the attribute its meaning back here — the same
   trap /onboard already hit with its upload row. */
.ans-chip[hidden], .ans-other[hidden], .ans-more[hidden] { display: none !important; }
.ans-chip:hover { border-color: var(--accent); }
.ans-chip input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
/* Always a visible ring, on the chip where :has() is available and on the control itself everywhere. */
.ans-chip input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ans-chip:has(input:focus-visible) { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 35%, transparent); }
.ans-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.ans-chip:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.ans-chip-text { min-width: 0; }

.ans-count { margin: 0; font-size: .85rem; color: var(--muted); min-height: 1.1em; }
.ans-more { align-self: flex-start; }

/* ---- the search box for a long list ---- */
.ans-search { display: flex; }
.ans-q {
  flex: 1; min-width: 0; max-width: 320px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--text); font: inherit; font-size: .92rem;
}
.ans-q:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }

/* ---- "Other…", numbers, money, dates ---- */
.ans-other { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ans-other-input, .ans-num, .ans-date, .ans-select {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--text); font: inherit; font-size: .92rem; min-width: 0;
}
.ans-other-input { flex: 1; min-width: 160px; max-width: 280px; }
.ans-num { width: 7.5rem; }
.ans-date { width: 11rem; }
.ans-select { max-width: 13rem; }
.ans-other-input:focus-visible, .ans-num:focus-visible, .ans-date:focus-visible, .ans-select:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent);
}
.ans-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ans-label { font-size: .88rem; color: var(--muted); }
.ans-unit { font-size: .88rem; color: var(--muted); }

.ans-actions, .ans-buttons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ans-buttons .ans-btn { font-weight: 600; }

/* On a phone every one of these is tapped, not clicked. Keyed on BOTH the width and the pointer:
   a desktop browser at phone width does not report pointer: coarse, so a rule keyed on that alone is
   one nobody ever actually verifies. */
@media (max-width: 760px), (pointer: coarse) {
  .ans-chip { min-height: 44px; padding: 10px 14px; }
  .ans-chip input { width: 18px; height: 18px; }
  .ans .btn, .ans-buttons .btn, .ans-actions .btn { min-height: 44px; }
  .ans-q, .ans-num, .ans-date, .ans-select, .ans-other-input { min-height: 44px; }
  .ans-num { width: 6.5rem; }
  .ans-select { max-width: 100%; }
}
