/* ============================================================================
   RRGI · the build page (build.html; iosp-modular-workshop docs/assessment-pages-plan.md §2.8).
   On site.css and assess.css: the site's own look (Geist and Geist Mono, light, square corners, one
   accent). The builder's rules are the Assessment App's (engine/web/assessment.css and the group bar
   of workshop-runs.css at bcebd5a), rescoped from body.assess to .build and redrawn in the site's
   palette: the App's colour names below map onto site.css's, as graph-light.css does for the graph
   (no core.css, no Fraunces, Newsreader or IBM Plex, no dark mode). The App's workshop header, saved
   queries, saved runs, theme switch and dialog are gone with their rules. Buttons are the site's own
   (button, button.quiet); the builder's class names that clashed with the site's are b-card, b-field
   and b-status. Nothing scrolls sideways at 320, 768, 1100 or 1280 px (verify-build.mjs measures it).
   ========================================================================== */

/* no group yet (reading your groups, none, or not chosen): only "Which group…" / "Start or join a group…" shows,
   never the five steps, the bar, the Helper or Save (Jonathan, 8 October: "I shouldn't even see the builder
   unless I'm in a group") */
#build-app[data-group="none"] > :not(#group-choice) { display: none !important; }

.page.build { max-width: 1280px; }
.build {
  --ink: var(--bg);
  --ink-1: var(--surface);
  --ink-2: var(--surface-2);
  --raise: #eceef2;
  --line: var(--rule);
  --line-2: var(--rule-2);
  --dim: var(--text-2);
  --dimmer: var(--text-3);
  --evidence: var(--accent);
  --question: var(--accent);
  --claim: var(--accent);
  --source: var(--accent);
  --issue: var(--edited);
  --soft: var(--accent-soft);
}
.build .head { padding-bottom: 20px; }
.build h1 { overflow-wrap: anywhere; }

/* ---- signing in taking longer than usual ---------------------------------------------------- */
.b-wait { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--warn); background: var(--surface); }
.b-wait p { margin: 0 0 10px; }
.b-wait .b-wait-acts { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- the group bar ---------------------------------------------------------------------------- */
.b-group-bar { display: grid; gap: 10px; margin: 0 0 18px; padding: 16px 20px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); }
/* it scrolls with the page (Jonathan, 9 October: it covered up to half a laptop's screen); Save stays in reach in the
   slim row pinned under it (.b-pin) */
.b-group-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.b-group-title { margin: 0; font-size: 17px; overflow-wrap: anywhere; min-width: 0; }
.b-group-kind { color: var(--text-2); }
.b-group-page { font-size: 14px; white-space: nowrap; }
.b-group-members { margin: 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.b-group-members:empty { display: none; }
.b-group-note { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.b-group-note.b-warn { color: var(--warn); }
/* "Working on", its name, and what saving makes (plan §4.1) */
.b-line { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.b-line-select { flex: 1 1 16rem; max-width: 30rem; }
.b-line-name { flex: 1 1 14rem; max-width: 24rem; }
.b-line-select select { width: 100%; }
.b-line-what-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-width: 0; }
.b-line-what-row:not(:has(> :not([hidden]))) { display: none; }
.b-line-what { margin: 0; font-size: 15px; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.b-line-what:empty { display: none; }
.b-line-what-row button { overflow-wrap: anywhere; text-align: left; }
.b-version-line { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }
/* how the algorithm developed (algo-tree.css draws the tree; its rings and boxes filled with the bar's white) */
.b-line-tree { min-width: 0; padding-top: 10px; border-top: 1px solid var(--rule); }
.b-line-tree .algo-tree { --tree-bg: var(--surface); }
.b-tree-wait { margin: 0; font-size: 14px; color: var(--text-2); }
.b-tree-acts { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; }
.b-save-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.b-save-note { flex: 1 1 16rem; min-width: 0; }
/* Save, pinned (Jonathan, 9 October): one line at the top while the page scrolls, no taller than a button and its
   borders (46 px); what the work is, cut to one line, and Save. build.js measures it (--b-bar) for the Helper, which
   sticks under it, and for the page's scroll padding, so nothing focused is hidden under it */
.b-pin { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 0 0 0 12px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); }
.b-pin-what { flex: 1 1 auto; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; color: var(--text-2); }
/* a failure of Save's, in the message line's red while it shows (pages-recheck SHOULD-FIX 1) */
.b-pin-what.b-bad { color: var(--bad); }
.b-pin #save-version { flex: 0 0 auto; }
/* "Building for" and the group, first in the pinned row, for someone in more than one group (Jonathan, 10 October:
   the one choice every load and save follows); on a narrow screen it takes the row's first line to itself */
.b-pin-group { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 4px 8px; min-width: 0; margin: 0; font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; }
.b-pin-group[hidden] { display: none; }
.b-pin-group select { width: auto; min-width: 0; max-width: 18rem; min-height: 32px; padding: 4px 8px; font: 400 14px/1.3 var(--font); color: var(--text); }
@media (max-width: 719.98px) {
  .b-pin:has(.b-pin-group:not([hidden])) { flex-wrap: wrap; }
  .b-pin-group { flex: 1 1 100%; padding: 6px 12px 0 0; }
  .b-pin-group select { flex: 1 1 auto; max-width: none; }
}
@media print { .b-pin { display: none !important; } }
/* what Save said and did, under the pinned row */
#group-msg { margin: 0 0 14px; }
.b-msg { margin: 0; font-size: 15px; color: var(--text-2); overflow-wrap: anywhere; }
.b-msg.b-bad { color: var(--bad); }
.b-msg.b-good { color: var(--ok); }
.b-msg a { margin-left: 4px; }
.b-saved { display: grid; gap: 6px; margin: 0 0 18px; padding: 12px 20px; border: 1px solid var(--rule); border-left: 3px solid var(--ok); background: var(--surface); }
.b-saved p { margin: 0; }
.b-saved-line { font-weight: 600; color: var(--ok); }
/* nothing runs by itself (revision 2): where a version's results are made now */
.b-saved-note { color: var(--text-2); font-size: 15px; }

/* ---- which group ---------------------------------------------------------------------------- */
.b-choice { margin: 0 0 18px; padding: 20px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--surface); }
.b-choice h2 { margin: 0 0 6px; font-size: 20px; }
.b-choice p { margin: 0 0 12px; color: var(--text-2); }
.b-choice-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.b-choice-list button { overflow-wrap: anywhere; text-align: left; }
.b-choice-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- the progress bar, the status line and the load banner ---------------------------------------- */
.build .flow-progress { border: 1px solid var(--rule); border-bottom: 0; background: var(--surface); }
.build .flow-progress ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.build .progress-item { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; color: var(--text-3); font: 500 11px/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.build .progress-item::after { position: absolute; right: -50%; bottom: 9px; left: 50%; height: 1px; background: var(--rule-2); content: ""; }
.build .progress-item:last-child::after { display: none; }
.build .progress-item span { position: relative; z-index: 1; display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--rule-2); background: var(--surface); color: inherit; }
.build .progress-item b { font-weight: 500; }
.build .progress-item.done { color: var(--text-2); }
.build .progress-item.done span { border-color: var(--accent); color: var(--accent); }
.build .progress-item[aria-current="step"] { color: var(--text); }
.build .progress-item[aria-current="step"] span { border-color: var(--accent); background: var(--accent); color: #fff; }
.b-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 18px; padding: 6px 12px; border: 1px solid var(--rule); background: var(--surface-2); color: var(--text-2); font: 400 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.b-status::before { width: 7px; height: 7px; flex: none; background: var(--text-3); content: ""; }
.b-status.ok::before { background: var(--ok); }
.b-status.err { color: var(--bad); }
.b-status.err::before { background: var(--bad); }
.b-status button { min-height: 32px; padding: 4px 10px; font-size: 13px; }
/* "Run it over" in the status line (revision 2, plan §13.7): the view every preview runs over */
.b-run-view { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; color: var(--text-2); }
.b-run-view select { width: auto; min-height: 32px; max-width: 100%; padding: 4px 8px; font: 400 13px/1.3 var(--font); color: var(--text); }
.b-views-msg { margin: -10px 0 18px; font-size: 14px; }
.review-over { margin: 6px 0 0; color: var(--text-2); font: 400 13px/1.4 var(--mono); }
.b-banner { margin: 0 0 18px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 15px; overflow-wrap: anywhere; }
.b-banner button { margin-left: 6px; }

/* ---- the steps and the Helper beside them ------------------------------------------------------- */
.b-workspace { display: block; }
@media (min-width: 1100px) {
  #build-app.has-helper .b-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 20px; align-items: start; }
}
.b-steps { min-width: 0; }
.build .flow-step { display: none; }
#build-app[data-flow="goal"] #goal-step,
#build-app[data-flow="targets"] #targets-step,
#build-app[data-flow="rule"] #rule-step,
#build-app[data-flow="split"] #split-step,
#build-app[data-flow="review"] #review-step { display: block; }
.b-card { min-width: 0; margin: 0 0 24px; padding: clamp(18px, 3vw, 32px); border: 1px solid var(--rule); background: var(--surface); }
.step-heading { margin-bottom: clamp(18px, 3vw, 28px); }
.step-heading h2 { max-width: 30ch; margin: 0; font-size: clamp(24px, 3.4vw, 32px); line-height: 1.12; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.step-heading h2:focus { outline: none; }
.step-heading > p { margin: 8px 0 0; color: var(--text-2); }
.step-position { display: block; min-height: 16px; margin-bottom: 8px; color: var(--accent); font: 500 11px/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.rule-title h2 { max-width: 40ch; font-size: clamp(22px, 3vw, 30px); }
.step-heading .rule-summary { max-width: 62ch; margin-top: 8px; color: var(--text-2); font-size: 15px; }
.step-heading .rule-words { max-width: 62ch; margin-top: 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); color: var(--text); font-size: 15px; overflow-wrap: anywhere; }
.step-heading .rule-words:empty { display: none; }

/* fields */
.field-stack { display: grid; gap: 20px; }
.b-field { display: grid; gap: 6px; min-width: 0; color: var(--text-2); font-size: 14px; }
.b-field > span:first-child, .b-field > label { color: var(--text); font-weight: 500; }
.build .field-note { margin-left: 6px; color: var(--text-3); font: 400 12px/1.4 var(--mono); font-style: normal; }
.persona-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.persona-line input { flex: 1 1 14rem; background: var(--surface-2); }
.persona-kind { color: var(--text-2); font-size: 15px; }
.persona-none { margin: 0; }
.build textarea { resize: vertical; }
.amount-field { width: min(100%, 20rem); }
.money-input { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; border: 1px solid var(--rule-2); background: var(--surface); }
.money-input > span { padding-left: 12px; color: var(--text-2); }
.money-input input { min-height: 44px; width: 100%; padding: 10px 12px; border: 0; background: transparent; color: var(--text); font: 400 16px/1.4 var(--font); outline: none; }
.money-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.amount-words { margin-left: 0; }
.bullets-field { gap: 6px; padding-top: 12px; border-top: 1px solid var(--rule); }
.bullets-heading { max-width: 40ch; margin: 4px 0 0; color: var(--text); font-size: 19px; line-height: 1.3; }
.bullets-lede { margin: 0 0 8px; color: var(--text-2); }

/* the controls the builder draws */
.build .in { box-sizing: border-box; min-width: 0; max-width: min(100%, 24rem); min-height: 40px; padding: 8px 10px; border: 1px solid var(--rule-2); background: var(--surface); color: var(--text); font: 400 15px/1.3 var(--font); }
.build .in:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: none; }
.build .in.num, .build .in.number-input { width: 6rem; }
.build .in.compact { width: auto; max-width: 10rem; }
.build .in.wide { min-width: min(18rem, 100%); }
.build button.tiny-btn { min-height: 36px; padding: 4px 2px; border: 0; border-bottom: 1px solid var(--rule-2); background: transparent; color: var(--text-2); font: 500 12px/1.3 var(--mono); }
.build button.tiny-btn:hover { background: transparent; border-bottom-color: var(--accent); color: var(--text); }
.build button.tiny-btn.remove:hover { border-bottom-color: var(--bad); color: var(--bad); }
.build button.add-button { width: 100%; margin-top: 10px; border-style: dashed; }
.step-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: clamp(20px, 4vw, 32px); padding-top: 16px; border-top: 1px solid var(--rule); }
.step-actions.end { justify-content: flex-end; }
/* step 1: what Continue still needs, beside it while it is off */
.goal-next-why { margin: 0; font-size: 15px; color: var(--text-2); }
.goal-next-why:empty { display: none; }
.builder-issues { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--warn); background: #fbf4ea; color: var(--warn); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.b-retry-line { margin: 8px 0 0; }

/* types */
.target-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.target-choice { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 16px; border: 1px solid var(--rule-2); background: var(--surface); color: var(--text); cursor: pointer; user-select: none; }
.target-choice:hover, .target-choice:focus-within { border-color: var(--text-2); }
.target-choice.selected, .target-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.target-choice input { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.target-choice-name { font-size: 16px; }

/* rules */
.rule-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(15rem, 0.72fr); gap: clamp(16px, 3vw, 24px); align-items: start; }
.rule-editor, .matches-panel { min-width: 0; }
.requirements { display: grid; gap: 10px; }
.requirements:empty { display: none; }
.requirement-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--text-2); }
.root-requirement { min-width: 0; padding: 14px; border: 1px solid var(--rule-2); background: var(--surface-2); }
.root-requirement-top { display: flex; min-height: 28px; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.requirement-number { color: var(--text-3); font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.empty-rule { padding: 14px; border: 1px dashed var(--rule-2); color: var(--text-2); }
.matches-panel { padding: 16px; border: 1px solid var(--rule-2); background: var(--surface-2); }
.matches-panel h3 { margin: 0; color: var(--accent); font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.matches-list, .review-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; }
.matches-list > li { min-width: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); color: var(--text); font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; list-style: none; }
.matches-list > li:last-child { border-bottom: 0; }
.matches-list a, .recipient-name { color: var(--text); }
.matches-list a:hover, .recipient-name:hover { color: var(--accent); }
.match-empty { margin: 0; padding: 12px 0; color: var(--text-2); font-size: 15px; line-height: 1.4; list-style: none; overflow-wrap: anywhere; }
.match-empty button { margin-top: 6px; }
/* words for a screen reader only, inside a live region (the time limit's sentence beside its heading) */
.b-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.draft-node, .sentence-path, .sentence-step { min-width: 0; }
.plain-sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding: 3px 0; font-size: 16px; line-height: 1.45; }
.plain-sentence .in { min-height: 44px; border-color: color-mix(in srgb, var(--accent) 40%, var(--rule-2)); font-size: 15px; }
.plain-sentence .in[aria-invalid="true"] { border-color: var(--warn); }
.plain-sentence .sentence-quantity { width: auto; min-width: min(10.5rem, 100%); }
.plain-sentence .sentence-number { width: 5.5rem; }
.plain-sentence .sentence-kind { width: auto; min-width: min(9rem, 100%); max-width: min(25rem, 100%); }
.plain-sentence .sentence-connection { flex: 1 1 15rem; max-width: min(28rem, 100%); }
.sentence-connection-fixed { display: inline-flex; flex: 1 1 15rem; align-items: center; min-height: 44px; max-width: min(28rem, 100%); padding: 8px 12px; border-left: 2px solid var(--accent); color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.fixed-connection { min-height: 40px; padding: 8px 12px; border-left: 2px solid var(--accent); color: var(--text); }
.sentence-step + .sentence-step { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule-2); }
.sentence-link, .sentence-filter-heading { color: var(--text-2); }
.sentence-filters { display: grid; gap: 8px; margin: 10px 0 6px 12px; padding: 12px 0 4px 14px; border-left: 2px solid var(--accent); }
.sentence-filter-heading { font-size: 14px; }
.sentence-filter { min-width: 0; padding: 8px 0; }
.sentence-filter-note { margin: 6px 0 8px; padding: 8px 10px; border-left: 3px solid var(--warn); background: #fbf4ea; color: var(--text); font-size: 14px; }
.sentence-actions, .condition-alternative-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.sentence-more { margin-top: 6px; }
.sentence-more > summary, .condition-alternatives > summary { width: fit-content; max-width: 100%; padding: 8px 0; color: var(--text-2); font: 500 12px/1.4 var(--mono); cursor: pointer; }
.sentence-more[open] > summary { color: var(--accent); }
.condition-alternatives { margin-top: 4px; color: var(--text-3); }
.condition-alternatives[open] > summary { color: var(--text-2); }
.advanced-condition-heading { margin-bottom: 8px; }
.draft-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; min-height: 44px; }
.draft-line + .draft-line { margin-top: 6px; }
.draft-branch { min-width: 0; margin: 6px 0 10px 10px; padding-left: 14px; border-left: 1px solid var(--rule-2); }
.draft-caption { display: block; padding: 3px 0; color: var(--text-3); font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.node-chip { display: inline-flex; min-height: 30px; flex: 0 0 auto; align-items: center; justify-content: center; padding: 4px 8px; border: 1px solid var(--rule-2); color: var(--text-2); font: 500 11px/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.node-chip.walk, .node-chip.filter, .node-chip.number { border-color: var(--accent); color: var(--accent); }
.node-chip.logic { border-color: var(--edited); color: var(--edited); }
.draft-word { color: var(--text-2); font-size: 15px; }
.path-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.filter-item { min-width: 0; padding: 6px 0 3px 10px; border-left: 2px solid var(--accent); }
.step-item + .step-item { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule-2); }
.rule-chosen:empty { display: none; }
.rule-chosen-set { max-width: 62ch; margin: 6px 0 0; font-size: 14px; }
.rule-chosen-set > summary { cursor: pointer; color: var(--text-2); }
.rule-chosen-set[open] > summary { color: var(--accent); }
.rule-chosen-list { margin: 4px 0 0; padding-left: 24px; color: var(--text-2); }
.rule-chosen-list li { margin: 3px 0; overflow-wrap: anywhere; }
.rule-chosen-list a { color: var(--text); }

/* the help bubbles */
.help-tip { position: relative; display: inline-flex; flex: 0 0 auto; }
.build button.help-button { display: grid; width: 32px; min-height: 32px; height: 32px; place-items: center; padding: 0; border: 1px solid var(--rule-2); background: var(--surface); color: var(--text-2); font: 500 13px/1 var(--mono); cursor: help; }
.build button.help-button:hover, .help-tip.open .help-button { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.help-bubble { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; display: none; width: min(20rem, calc(100vw - 3rem)); padding: 10px 12px; border: 1px solid var(--accent); background: var(--surface); color: var(--text); box-shadow: 0 8px 24px -12px rgba(20, 22, 29, 0.35); font-size: 14px; line-height: 1.45; }
.help-tip:hover .help-bubble, .help-tip:focus-within .help-bubble, .help-tip.open .help-bubble { display: block; }
.help-tip.dismissed .help-bubble { display: none !important; }

/* split */
.split-list { display: grid; gap: 10px; }
.split-part + .split-part { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--rule-2); }
.split-part-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.split-part-heading h3 { margin: 0; font-size: 20px; }
.split-part-heading span { max-width: 36rem; color: var(--text-2); font-size: 14px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 6.5rem) auto minmax(7rem, auto); gap: 12px; align-items: center; min-height: 60px; padding: 10px 14px; border: 1px solid var(--rule-2); background: var(--surface-2); }
.split-name { min-width: 0; color: var(--text); font-size: 16px; overflow-wrap: anywhere; }
.build .share-input { width: 6.5rem; max-width: 100%; text-align: right; font-family: var(--mono); }
.split-money { color: var(--text-2); font: 400 13px/1.3 var(--mono); text-align: right; overflow-wrap: anywhere; }
.split-percent { color: var(--text-2); font: 400 13px/1 var(--mono); }
.split-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 14px; border-top: 1px solid var(--rule-2); }
.split-summary output { color: var(--accent); font: 500 14px/1 var(--mono); }
.split-total.bad { color: var(--warn); }
.split-explainer { margin: 12px 0 16px; padding: 14px 16px; border: 1px solid var(--rule-2); background: var(--surface-2); color: var(--text); }
.split-explainer h4 { margin: 0 0 8px; font-size: 16px; }
.split-explainer ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.55; }
.split-explainer li { margin: 4px 0; }
.split-explainer-note { margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--rule-2); font-size: 14px; }
.within-type-list { display: grid; gap: 14px; }
.within-card { overflow: hidden; border: 1px solid var(--rule-2); background: var(--surface-2); }
.within-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 12px 16px; border-bottom: 1px solid var(--rule-2); }
.within-title { margin: 0; font-size: 17px; }
.within-meta { color: var(--text-2); font: 400 12px/1.4 var(--mono); overflow-wrap: anywhere; }
.within-body { padding: 6px 16px 14px; }
.within-prompt { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; color: var(--text-2); font-size: 14px; }
.allocation-factor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(5rem, 6.5rem); gap: 12px; align-items: center; min-height: 54px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.allocation-factor:last-child { border-bottom: 0; }
.factor-label { min-width: 0; color: var(--text); font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.build .factor-input { width: 6.5rem; max-width: 100%; min-height: 40px; padding: 8px; border: 1px solid var(--rule-2); background: var(--surface); color: var(--text); font: 400 14px/1.2 var(--mono); text-align: right; }
.build .factor-input[aria-invalid="true"] { border-color: var(--warn); }
.within-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.qualification-only { margin: 12px 0 0; color: var(--text-3); font-size: 13px; }
.allocation-formula { margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--rule-2); border-left: 3px solid var(--accent); background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.allocation-preview { display: grid; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--rule-2); }
.allocation-preview-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; color: var(--text-2); font-size: 14px; }
.allocation-preview-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; color: var(--text); }
.allocation-preview-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.allocation-preview-row strong { color: var(--text); font: 400 13px/1.3 var(--mono); white-space: nowrap; }
.allocation-preview-math { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.allocation-preview-score, .allocation-fallback, .allocation-preview-dot { color: var(--text-3); font: 400 12px/1.4 var(--mono); overflow-wrap: anywhere; }
.allocation-fallback { margin: 0 0 4px; }

/* review */
.review-persona { margin: 6px 0 2px; color: var(--text-2); font: 400 13px/1.4 var(--mono); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.review-persona strong { color: var(--accent); font-weight: 500; }
.review-goal { max-width: 50rem; color: var(--text); font-size: 17px; overflow-wrap: anywhere; }
.review-interests { max-width: 50rem; margin: 6px 0 10px; padding-left: 20px; color: var(--text-2); font-size: 15px; overflow-wrap: anywhere; }
.review-summary { font: 400 13px/1.4 var(--mono); }
.review-group { overflow: hidden; border: 1px solid var(--rule-2); background: var(--surface-2); }
.review-group + .review-group { margin-top: 6px; }
.review-group-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--rule-2); color: var(--text-2); font: 500 12px/1.4 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; }
.review-group-head h3, .review-group-head strong { margin: 0; color: inherit; font: inherit; }
.review-group-head strong { color: var(--text); }
.review-rule { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--rule-2); color: var(--text); font-size: 14px; overflow-wrap: anywhere; }
.review-group .rule-chosen-set { padding: 0 14px 10px; }
.recipient-list { margin: 0; padding: 0; list-style: none; }
.recipient-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 52px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.recipient-row:last-child { border-bottom: 0; }
.recipient-name { min-width: 0; overflow-wrap: anywhere; }
.recipient-points { color: var(--text-2); font: 400 12px/1.4 var(--mono); white-space: nowrap; }
.recipient-money { color: var(--text); font: 400 13px/1.3 var(--mono); white-space: nowrap; }
.unallocated { padding: 12px 14px; border: 1px solid var(--warn); color: var(--warn); font: 400 13px/1.4 var(--mono); overflow-wrap: anywhere; }
.demo-note { margin: 16px 0 0; color: var(--text-3); font: 400 12px/1.4 var(--mono); }

/* ---- the Helper ---------------------------------------------------------------------------------- */
.helper-panel { display: grid; gap: 12px; min-width: 0; margin: 0 0 24px; padding: 18px; border: 1px solid var(--rule); border-top: 3px solid var(--accent); background: var(--surface); }
/* on a wide screen it stays beside the step, just under the pinned Save row (build.js measures the row: --b-bar), and
   scrolls within itself when it is taller than the screen */
@media (min-width: 1100px) { .helper-panel { position: sticky; top: calc(var(--b-bar, 0px) + 16px); max-height: calc(100vh - var(--b-bar, 0px) - 32px); overflow-y: auto; } }
/* …and there the answer shows at the panel's top, under its heading: the part of the panel that is on the screen
   whether the panel has stuck or not (on a phone it stays where the person waited, under the progress) */
@media (min-width: 1100px) { .helper-panel > h2 { order: -2; } .helper-panel > .helper-ready { order: -1; } }
.helper-panel h2 { margin: 0; color: var(--accent); font: 500 12px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.helper-intro { margin: 0; color: var(--text-2); font-size: 14px; }
.helper-state { margin: 0; padding: 8px 10px; border-left: 3px solid var(--warn); background: #fbf4ea; color: var(--text); font-size: 14px; }
.helper-state:empty, .helper-state[hidden] { display: none; }
.helper-panel .b-retry-line { margin: 0; }
.helper-panel .b-retry-line:has(> [hidden]:only-child) { display: none; }
.helper-banner { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: 14px; }
.helper-banner p { margin: 0; }
.helper-banner p + p { margin-top: 8px; }
.helper-banner-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.helper-recommend, .helper-send, .helper-put { width: 100%; }
.helper-actions { display: grid; gap: 8px; }
.helper-status { margin: 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.helper-status:empty { display: none; }
.helper-status.err { color: var(--bad); }
.helper-status.ok { color: var(--ok); }
.helper-panel.busy { opacity: 0.9; }
.helper-progress { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--rule-2); border-left: 3px solid var(--accent); background: var(--surface-2); }
.helper-progress-queue { margin: 0; color: var(--text); font-size: 14px; font-weight: 500; }
.helper-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.helper-progress-stage { min-width: 0; color: var(--text); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.helper-progress.working .helper-progress-stage::before { display: inline-block; width: 10px; height: 10px; margin-right: 7px; border: 2px solid var(--rule-2); border-top-color: var(--accent); border-radius: 50%; vertical-align: -1px; animation: b-spin 0.9s linear infinite; content: ""; }
@keyframes b-spin { to { transform: rotate(360deg); } }
.helper-progress-elapsed { flex: none; color: var(--accent); font: 400 12px/1 var(--mono); font-variant-numeric: tabular-nums; }
.helper-progress-notes { display: grid; gap: 6px; max-height: 14rem; margin: 0; padding: 6px 0 0; overflow-y: auto; list-style: none; border-top: 1px dashed var(--rule-2); }
.helper-progress-notes:empty { display: none; }
.helper-progress-note { position: relative; padding-left: 14px; color: var(--text-2); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.helper-progress-note::before { position: absolute; left: 0; color: var(--accent); content: "›"; }
.helper-progress-note.partial { color: var(--text); }
.helper-progress-note.partial::after { color: var(--accent); content: "…"; }
.helper-progress.done { border-left-color: var(--ok); background: transparent; }
.helper-progress.done .helper-progress-stage { color: var(--ok); }
.helper-progress.failed, .helper-progress.lost { border-left-color: var(--warn); background: #fbf4ea; }
.helper-progress.failed .helper-progress-stage, .helper-progress.lost .helper-progress-stage { color: var(--text); }
.helper-progress-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.helper-progress-acts:not(:has(> :not([hidden]))) { display: none; }
.helper-keep-open { margin: 0; color: var(--text-2); font: 400 12px/1.5 var(--mono); }
.helper-ready { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--accent); background: var(--accent-soft); }
.helper-ready h3 { margin: 0; color: var(--accent); font-size: 16px; }
.helper-note { padding: 12px; border: 1px dashed var(--rule-2); }
.helper-note h3 { margin: 0 0 6px; color: var(--text-2); font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.helper-note-body p { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.helper-note-summary { margin-bottom: 10px !important; color: var(--text); }
.helper-reasons { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: reason; }
.helper-reason { position: relative; padding-left: 26px; counter-increment: reason; }
.helper-reason::before { position: absolute; top: 1px; left: 0; display: grid; width: 18px; height: 18px; place-items: center; background: var(--accent-soft); color: var(--accent); content: counter(reason); font: 600 11px/1 var(--mono); }
.helper-reason-decision { display: block; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.helper-reason-why { margin-top: 3px !important; color: var(--text); }
.helper-reason-replaced, .helper-reason-bullet { margin-top: 4px !important; color: var(--text-2); font-size: 13px !important; }
.helper-reason-replaced { padding: 3px 7px; border-left: 2px solid var(--warn); background: #fbf4ea; }
.helper-reason-bullet { font-style: italic; }
.helper-reason-label { font-style: normal; font-weight: 600; }

/* ---- narrower screens ----------------------------------------------------------------------------- */
@media (max-width: 800px) {
  .rule-workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .build .progress-item { gap: 0; }
  .build .progress-item b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .target-options { grid-template-columns: minmax(0, 1fr); }
  .step-actions button { flex: 1 1 0; }
  .step-actions .goal-next-why { flex: 1 1 100%; }
  .split-row { grid-template-columns: minmax(0, 1fr) minmax(5rem, 6.5rem) auto; }
  .split-money { grid-column: 1 / -1; text-align: left; }
  .draft-branch { margin-left: 2px; padding-left: 8px; }
  .draft-line .in { max-width: 100%; flex: 1 1 11rem; }
  .draft-line .in.wide { width: 100%; min-width: 0; }
  .sentence-filters { margin-left: 4px; padding-left: 10px; }
  .b-group-bar, .b-choice { padding: 14px 16px; }
}
@media (max-width: 720px) {
  .recipient-row { grid-template-columns: minmax(0, 1fr) auto; }
  .recipient-points { grid-column: 1 / -1; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .helper-progress.working .helper-progress-stage::before { animation: none; }
}
