/* JimuSim UI -- dark, dense, calm (zcode-style transcript; old-repo-grade
   shots). Fixed copy lives in i18n.js; event bodies stay unmodified. */
:root {
  --bg0: #070b14; --bg1: #0d1424; --bg2: #111a2e; --rail: #0c1322;
  --line: rgba(151, 173, 222, .14); --line2: rgba(151, 173, 222, .24);
  --tx0: #e8eefb; --tx1: #b7c3da; --tx2: #8494b0; --tx3: #6e7e9c;
  --acc: #4da3ff; --acc-soft: rgba(77, 163, 255, .13);
  --who: #b48cff;   /* S-173: the Designer label's dedicated hue */
  --term: #7fd4c0;  /* S-173: COMSOL-native token tone (single token) */
  --advisory: #ff9c9c;  /* S-173: warning copy tone (hints/disclaimer) */
  /* S-176: leftover-constant tokens (light-theme completion) */
  --halo-a: rgba(57, 210, 245, .06); --halo-b: rgba(77, 124, 255, .08);
  --top-glass: rgba(13, 20, 36, .82);   /* header banner */
  --panel-glass: rgba(12, 19, 34, .6);   /* rail/glass surfaces */
  --fold-glass: rgba(13, 20, 36, .5);
  --composer-glass: rgba(13, 20, 36, .72);
  --chrome-tint: rgba(151, 173, 222, .04);
  --chrome-tint2: rgba(151, 173, 222, .12);
  --dash-line: rgba(151, 173, 222, .1);
  /* ui-opt 2026-11-29: scrollbar thumb re-tokened to the phosphor family
     (the old blue-gray rgba(151,173,222,*) predates the Block Console
     layer and read off-palette in both themes). */
  --scroll-thumb: rgba(166, 255, 112, .16);
  --scroll-thumb-hi: rgba(166, 255, 112, .3);
  --shadow-1: 0 2px 14px rgba(0, 0, 0, .25);
  --shadow-2: 0 6px 22px rgba(0, 0, 0, .38);
  --shot-mat: #0a0f1c;                    /* frame behind COMSOL pngs */
  --ok: #3ddc97; --ok-soft: rgba(61, 220, 151, .12);
  --warn: #fcd34d; --warn-soft: rgba(252, 211, 77, .09);
  --err: #ff8080; --err-soft: rgba(255, 128, 128, .09);
  --mono: "Cascadia Mono", "Cascadia Code", "Noto Sans Mono CJK SC",
          Consolas, monospace;
  --font: "Cascadia Mono", "Cascadia Code", "Noto Sans Mono CJK SC",
          "Microsoft YaHei", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
/* Owner order 2026-11-30: the user face renders at 90% (the ratio the
   owner found comfortable in the browser) without moving breakpoints. */
html { zoom: .9; }
body {
  margin: 0; color: var(--tx0);
  /* S-197 J4: rides the --font token (this stack had drifted -- it was
     missing "Microsoft YaHei" vs the token definition). */
  font: 13.5px/1.6 var(--font);
  background:
    radial-gradient(1100px 520px at 78% -12%, var(--halo-a), transparent 60%),
    radial-gradient(900px 600px at -12% 30%, var(--halo-b), transparent 55%),
    var(--bg0);
  display: flex; flex-direction: column;
}
button, input, select, textarea { font-family: inherit; }
:root { color-scheme: dark; }   /* S-163: native dropdowns/pickers follow the dark theme */
:focus-visible { outline: 2px solid rgba(77, 163, 255, .55); outline-offset: 2px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hi); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
#top {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px;
  background: var(--top-glass); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); flex: none;
}
#brand {
  font-weight: 700; letter-spacing: .4px; color: var(--tx0);
  display: flex; align-items: center; gap: 8px;
}
#brand::before {
  content: ""; width: 10px; height: 10px; border-radius: 3px;
  background: linear-gradient(135deg, var(--acc), var(--term));
  /* ui-opt 2026-11-29: glow follows the accent (was hardcoded old blue) */
  box-shadow: 0 0 8px rgba(166, 255, 112, .45);
}
#runsel {
  /* 2026-10-23 user order (three rounds, ending here): the run id reads as
     PLAIN TEXT -- no box, no fill, no caret. The user only needs to see
     their own run number.
     Width follows the selected id, not the widest one: past runs carry odd
     long ids (20261018-S228-acceptance) that used to stretch a 19-char
     id's box (field-sizing: content, Chrome 123+; older engines fall back
     to the widest option, still readable). Measured on a 124.6px id:
     191 -> 174 -> 141 -> 125px (= the id's own width, 17px tall).
     The element stays a select: clicking the number still opens the list
     of past runs -- the only way into them from this page. */
  field-sizing: content;
  width: max-content; max-width: 44vw;
  margin: 0; padding: 0;
  border: 0; border-radius: 0; background: none;
  color: var(--tx1); font-size: 12.5px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
#runmeta { color: var(--tx2); font-size: 12px; overflow: hidden;
           text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  padding: 2px 9px; border-radius: 9px; flex: none;
  background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(61, 220, 151, .35);
  animation: pulse 1.6s ease-in-out infinite;
}
.badge.hidden { display: none; }
@keyframes pulse { 50% { opacity: .45; } }

/* S-301 (owner order 2026-10-25): pending-install is an ALERT now (the
   pre-run gate locks the composer until the agent app is installed)
   -- the old gray-muted style retired; rides the --err token (same
   family as .endbar.bad, no new semantic). */
#helperbtn.pending { color: var(--err); border-color: var(--err); }
#helperbtn.installed { color: var(--advisory); border-color: var(--line2); }
/* S-294 J26 verdict (leader order 2026-10-25): the S-270 localbanner /
   localcmd styles are removed with the retired local helper. Agent
   states = pending / online / paused on the shared helperbtn (online and
   paused ride the text semantics, no extra color). The
   #helperbtn.installed selector stays as replay-era fallback; no
   producer remains. */

/* ---------- layout ---------- */
#main { flex: 1; display: flex; min-height: 0; }
/* S-163 (ZCode form): the left column is a self-contained vertical stack --
   sticky zone / scrolling narrative / live status line / composer. It owns
   its own scroll region so nothing inside can ever spill under the rail. */
#left {
  flex: 1; min-width: 320px; display: flex; flex-direction: column;
  min-height: 0; padding: 10px 14px 10px;
}
#stream {
  /* S-209 J22 (10-17 user order, interpretation correction): content
     fills TOP-DOWN and the column only scrolls once it is full -- the
     bottom-hug flex form (S-207 carry-over) is retired; the original
     "Thinking closer to the composer" order is served by the statusline
     collapse and the tightened margins alone. Plain block layout also
     retires the flex-child squeeze class (J1b) structurally. */
  flex: 1; min-height: 0; overflow-y: auto; padding: 6px 4px 12px;
}
#right {
  width: 340px; flex: none; display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px; overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--line); background: var(--panel-glass);
  resize: horizontal; direction: ltr;
}
#right > .rail { direction: ltr; }

/* ---- S-232: gate action row (the modal retired; the stream card is the
     action face) ---- */
.pcard .gatebtns {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px;
}
.pcard .gateanswer {
  display: flex; align-items: stretch; gap: 8px; margin-top: 10px;
}
.pcard .gateanswer textarea {
  flex: 1; min-width: 120px; min-height: 58px; max-height: 140px;
  resize: vertical; overflow-y: auto; padding: 8px 10px;
  color: var(--tx0); background: var(--bg0); border: 1px solid var(--line2);
  font: 13px/1.45 var(--font);
}
.pcard .gateanswer textarea:focus { border-color: var(--acc); }
.pcard .gateanswer textarea:disabled { opacity: .55; }
.pcard .gateanswer .gatesend { flex: none; }
/* S-233: the preview-hold busy line (dim, phints-like) */
.pcard .gatewait { padding: 0 12px 2px 6px; font-size: 11.5px;
                   color: var(--tx2); }

/* folded narrative line (ZCode "Used N tools" form): one line, expandable */
details.foldline {
  border-left: 2px solid var(--line2); padding: 2px 0 2px 10px;
  margin: 4px 0; font-size: 12.5px; color: var(--tx2);
}
details.foldline > summary {
  cursor: pointer; list-style: none; color: var(--tx2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
details.foldline > summary::before { content: "\25B8 "; color: var(--tx2); }
details.foldline[open] > summary::before { content: "\25BE "; }
/* S-172 user orders 2+3: "N. Designer: <fixed phrase>" -- the who-label
   carries the accent, the action phrase a step lighter; the legacy
   digest-snippet form (old archives) keeps the plain tone. */
summary .fturn { color: var(--tx3); }
summary .fwho { color: var(--who); font-weight: 600; margin-right: 4px; }
summary .fact { color: var(--tx1); }
/* S-172 user order 2: COMSOL-native tokens in markdown bodies (color
   only -- the S-154 mono whitelist stays code-semantics-only) */
.term { color: var(--term); }
/* S-173 user order 2: advisory copy pops red -- hints channel lines and
   taught-disclaimer fragments in markdown bodies */
.warn { color: var(--advisory); }
/* S-173: confirm ROW items carry the native list bullet (engine emits
   "- " rows -> md-ul/li disc). No ::before marker here -- an earlier
   face-scoped glyph decorated the head/digest .md-p lines instead of
   the rows (joint-verify ②, removed). */
/* S-181: mechanical operation-detail line (dim, top of a turn body) */
.foldline .opsline { color: var(--tx2); font-size: 11.5px;
                     margin: 0 0 4px; }
/* S-180 (user order 1 / B2): unified markdown typography -- 1.6 line
   height + justified paragraphs with exactly half a line after each
   (0.8em at 1.6). Entries and indented continuation lines stay left. */
.md { line-height: 1.6; }
.md .md-p { text-align: justify; margin: 0 0 .8em; }
.md li, .md .md-p.md-ind1, .md .md-p.md-ind2 { text-align: left; }
details.foldline > .foldbody {
  margin-top: 4px; padding: 6px 8px; border-radius: 7px;
  background: var(--fold-glass); border: 1px solid var(--line);
  /* S-179 user order 4: no inner scrollbar -- full height; the stream
     column (#stream) carries the one scroll */
  color: var(--tx1); font-size: 12.5px;
}

/* ---- Composer: modes left, input center, run controls right ---- */
#composer { flex: none; }
#composer .crow {
  display: flex; align-items: stretch; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--composer-glass); padding: 8px;
  --crow-h: 68px;
  --ctl-h: 30px;
}
.cstack { display: flex; flex-direction: column; gap: 8px;
          justify-content: space-between; flex: none; }
.cstack button { height: var(--ctl-h); }
.mode-stack { min-width: 96px; }
.modebtn { width: 96px; text-align: left !important; }
.modebtn.current { color: var(--tx0); border-color: var(--line);
                   background: var(--bg0); }
.modebtn:disabled { opacity: .45; cursor: not-allowed; }
/* ui-opt 2026-11-29: focus ring follows the global brick-amber rule
   (line 1144) -- this selector outranked it and kept the old blue. */
.modebtn:focus-visible { outline: 2px solid var(--block-amber);
                         outline-offset: 1px; }
#composer #cin { flex: 1; min-width: 60px; }
#composer #send { flex: none; }

/* ---------- right rail ---------- */
.rail {
  background: var(--rail); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; flex: none;
  box-shadow: var(--shadow-1);
}
.rail-title {
  font-size: 11px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--tx2); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.rail-title::before {
  content: ""; width: 5px; height: 5px; border-radius: 2px; background: var(--acc);
}
.rail-body { font-size: 12.5px; color: var(--tx1); }
.rail-body .empty { color: var(--tx3); font-size: 12px; padding: 2px 0 4px; }
.shots { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shot img {
  width: 100%; display: block; border: 1px solid var(--line2);
  border-radius: 8px; background: var(--shot-mat);
}
/* S-264 J2: the sizing contract belongs to the RAIL, not to one wrapper.
   The "keep the last picture" branch of the geometry handler re-parents
   nodes, and a bare img/canvas outside `.shot` matched no rule at all --
   it rendered at its intrinsic 640x480 inside a ~316px rail and got clipped
   (live specimen 20261021-222742-327: "the picture suddenly got huge, then
   went back to normal about twenty seconds later"). */
.rail-body img, .rail-body canvas { max-width: 100%; }
.shot .cap { color: var(--tx3); font-size: 11px; margin-top: 3px;
             font-family: var(--font); overflow: hidden; text-overflow: ellipsis; }
.stage { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.stage .mark { width: 13px; text-align: center; color: var(--ok); flex: none; }
.stage .mark.wait { color: var(--warn); animation: pulse 1.4s infinite; }
.stage .txt { flex: 1; font-family: var(--font); font-size: 12px; }
.stage .used { color: var(--tx3); font-size: 11.5px; font-family: var(--font); }

/* markdown surfaces (S-145 transcript; S-150 panel bodies too) */
.md { color: var(--tx0); font-size: 13px; }
/* S-180 verify(P1①): margin moved to the S-180 rule above (a later
   same-specificity margin here would silently override it) */
.md .md-p { white-space: pre-wrap; word-break: break-word; }
.md .md-h { font-weight: 600; margin: 8px 0 3px; color: var(--tx0); }
.md .md-h1 { font-size: 15px; }
.md .md-h2 { font-size: 14px; }
.md .md-h3, .md .md-h4 { font-size: 13px; color: var(--tx1); }
.md .md-ul, .md .md-ol {
  margin: 3px 0 3px 18px; padding: 0; color: var(--tx1);
}
.md .md-ul { list-style: disc; }
.md .md-ol { list-style: decimal; }
.md li { margin: 1px 0; white-space: pre-wrap; }
.md code {
  font-family: var(--mono); font-size: 12px; color: var(--acc);
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 4px;
}
.md .md-code {
  margin: 4px 0; padding: 7px 10px; border-radius: 7px;
  background: var(--bg1); border: 1px solid var(--line);
  color: var(--tx1); font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}
.md strong { color: var(--tx0); font-weight: 650; }
/* S-209 J4 (10-17 user order 4): the *italics* notation renders as an
   upright solid underline -- oblique at 13px in a dimmed tone was not
   legible (S-206's italic form overruled by the user; the notation's
   semantics live in the prompts, the FORM lives here). */
.md em { font-style: normal; text-decoration: underline;
         text-underline-offset: 3px; color: var(--tx0); }
.md a { color: var(--acc); text-decoration: none; }
.md a:hover { text-decoration: underline; }

/* ---------- transcript (zcode-style: flat, dense, no bubbles) ---------- */
/* S-197 J4: the old transcript row rules (.tr*) were removed -- dead
   since S-163 (zero DOM refs; the pin clause retired with them). */
.pcard {
  margin: 6px 0 10px 12px; border: 1px solid var(--line);
  border-left: 3px solid var(--tx3); border-radius: 9px;
  background: var(--bg2); overflow: hidden;
}
.pcard .phead {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px;
  font-size: 10.5px; letter-spacing: .8px;
  color: var(--tx3); font-family: var(--font);
  border-bottom: 1px solid var(--line); background: var(--chrome-tint);
}
.pcard .phead .pface {
  padding: 1px 8px; border-radius: 6px; font-size: 11px;
  letter-spacing: .5px; background: var(--chrome-tint2);
}
.pcard .phead .ptime { margin-left: auto; text-transform: none; letter-spacing: 0; }
.pcard .phead .pplanstatus { margin-left: auto; font-size: 11px; letter-spacing: .4px; }
/* S-201 J7: card TEXT edges share one x -- left paddings 6/6/8 with
   borders 3/1/1 put pcard/endbar text where foldline text sits
   (equation 6+3 == 8+1 == foldline composite 21). .phead keeps 12px on
   purpose (the chip box is its own shape). Pinned by equation in
   test_ui_js, not by measured pixels. */
/* S-206 D4 (user order: left-column text boxes fully expand, no inner
   scroll): the S-150 22em cap is GONE for every card body; long cards
   ride the #stream column scroll. Kept: #stream (column-level) and the
   composer input box. */
.pcard .pbody { padding: 8px 12px 8px 6px; font-size: 13px; }
/* S-209 J24 (user order A8): symmetric card padding -- the .8em md-p
   tail margin on the LAST block doubled the bottom gap (18.4px vs 8px).
   Section rhythm inside the card is untouched. */
.pcard .pbody .md > :last-child { margin-bottom: 0; }
.pcard .pbody pre {
  font-family: var(--font);
  margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--tx0);
  font-size: 12.8px;
}
.pcard .phints { white-space: pre-wrap; padding: 0 12px 8px 6px; color: var(--advisory); font-size: 11.5px; }
/* S-186 J4 + S-189: every non-designer stream panel is ONE card anatomy
   (chip + time + always-visible body) with the semantics in the LEFT
   BORDER only, in three tiers -- blue = decision faces (confirm/
   question/gap/summary), red = advisory (warning), gray = informational
   (panel default); error keeps its own tone. The label chip stays
   single-tone (tx3 by .phead inheritance). S-186 deleted the gate rules
   as DEAD (gates were foldlines); S-189 made gate faces cards, so the
   rules are LIVE again -- border-left-color only. */
.pcard.face-warning { border-left-color: var(--advisory); }
.pcard.face-summary { border-left-color: var(--acc); }
.pcard.face-confirm, .pcard.face-question, .pcard.face-gap {
  border-left-color: var(--acc); }
.pcard.face-error { border-left-color: var(--err); }
.pcard.face-error .phead { color: var(--err); background: var(--err-soft); }
.endbar {
  border-radius: 9px; padding: 8px 13px 8px 8px; margin: 10px 0 14px 12px;
  font-weight: 600; font-size: 12.5px; font-family: var(--font);
}
.endbar.ok { background: var(--ok-soft); color: var(--ok);
             border: 1px solid rgba(61, 220, 151, .3); }
.endbar.bad { background: var(--err-soft); color: var(--err);
              border: 1px solid rgba(255, 128, 128, .3); }
@media (max-width: 940px) { #right { display: none; } }

/* render fallback (S-149 safeRender) */
.render-fallback {
  margin: 3px 0; padding: 6px 9px; font-family: var(--font);
  font-size: 11.5px; color: var(--warn); background: var(--bg1);
  border: 1px dashed var(--line); border-radius: 6px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- S-150: layering, language, panel scroll ---------- */
#langsel {
  font: inherit; font-size: 11px; color: var(--tx2);
  background: var(--bg1); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 4px;
}

/* ---- S-153 P2a uplink chrome ------------------------------------------- */
/* S-163 (verify M3): #scen rule removed with the picker */
/* S-163: composer now lives inside #left (see layout block above) -- the
   old full-width footer styles are gone; keep only the gate-wait accent. */
#composer.gate-wait #cin { border-color: var(--acc); }
#cin {
  font-family: var(--font); font-size: 13px;
  line-height: 1.45;
  flex: 1; resize: none; height: var(--crow-h); min-height: var(--crow-h);
  max-height: 140px; overflow-y: auto;
   color: var(--tx0);
  background: var(--bg0); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px;
}
#send { font-size: 12px; }
#send:disabled { opacity: .45; cursor: default; }

/* ---- S-154: GFM tables + panel hint wrapping --------------------------- */
.md-table { border-collapse: collapse; margin: 6px 0; width: 100%;
            font-size: 12px; }
.md-table .md-th, .md-table .md-td {
  border: 1px solid var(--line2); padding: 4px 8px; text-align: left;
  vertical-align: top;
}
.md-table .md-th { background: var(--bg2); color: var(--tx0); }

/* S-154 (user order 2): leading-space hierarchy of panel lines becomes a
   real indent level (the literal spaces are stripped in markdown.js). */
.md .md-p.md-ind1 { padding-left: 12px; }
.md .md-p.md-ind2 { padding-left: 24px; }

/* ---- S-156 P2c: gate buttons (S-232: row rides the gate card) ----- */
.gbtn { font: inherit; font-size: 11.5px; color: var(--tx1);
        background: var(--bg2); border: 1px solid var(--line2);
        border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.gbtn:hover { color: var(--tx0); border-color: var(--acc); }
.gbtn.primary { color: var(--ok); border-color: var(--ok); }

/* ---- S-159: post-run feedback bar --------------------------------------- */
.fbbar { display: flex; gap: 8px; align-items: center; margin: 6px 0;
         padding: 8px 12px; border: 1px dashed var(--line2);
         border-radius: 8px; color: var(--tx2); font-size: 12.5px; }
.fbbar .fbq { color: var(--tx1); }

.fbbar .fbin { flex: 1; min-width: 80px; font: 12px/1.4 var(--font);
               color: var(--tx1); background: var(--bg0);
               border: 1px solid var(--line); border-radius: 7px;
               padding: 5px 9px; }
#cin:disabled { opacity: .55; cursor: not-allowed; }

/* Live operation/thinking lane directly above the composer. Agent work uses
   the wrench glyph; LLM reasoning uses the operating pixel cube. */
#deltabox { display: none; min-height: 0; flex: none;
            margin: 0 2px 2px; padding: 4px 10px;
            border-left: 2px solid var(--acc);
            color: var(--tx2); font: 11.5px/1.45 var(--font);
            white-space: nowrap; overflow: hidden;
            opacity: .9; }
/* S-187: label + pin lane share one flex row (baseline-aligned) */
#deltabox.on { display: flex; align-items: baseline; }
/* S-172 user order 5: the thinking shim breathes (turn.start -> first
   delta/phase) so the line never looks dead on pure-protocol turns */
#deltabox.think { animation: thinkpulse 1.7s ease-in-out infinite; }
@keyframes thinkpulse { 50% { opacity: .45; } }
#deltabox.operation .dcur::after { content: ""; display: inline-block;
                                  width: 2.2em; text-align: left;
                                  animation: opdots 5s steps(1, end) infinite; }
@keyframes opdots {
  0% { content: ""; } 20% { content: "."; } 40% { content: ".."; }
  60% { content: "..."; } 80% { content: "...."; } 100% { content: "....."; }
}

/* ---- S-175 user order 2: Light theme (default) + Dark (kept) ---------- */
html[data-theme="light"] {
  --bg0: #f7f9fc; --bg1: #ffffff; --bg2: #eef2f8; --rail: #f2f5fa;
  --line: rgba(23, 42, 74, .14); --line2: rgba(23, 42, 74, .24);
  --tx0: #16233c; --tx1: #33445f; --tx2: #5a6b88; --tx3: #8494ad;
  --acc: #1668d6; --acc-soft: rgba(22, 104, 214, .10);
  --who: #7c4dcc; --term: #0e8d74; --advisory: #d63b3b;
  --ok: #0e9f6e; --ok-soft: rgba(14, 159, 110, .10);
  --warn: #b45309; --warn-soft: rgba(180, 83, 9, .10);
  --err: #d63b3b; --err-soft: rgba(214, 59, 59, .08);
  color-scheme: light;
}
html[data-theme="light"] {
  --halo-a: rgba(23, 108, 220, .05); --halo-b: rgba(124, 77, 220, .05);
  --top-glass: rgba(255, 255, 255, .88);
  --panel-glass: rgba(255, 255, 255, .72);
  --fold-glass: #f4f7fb;
  --composer-glass: rgba(255, 255, 255, .85);
  --chrome-tint: rgba(23, 42, 74, .04);
  --chrome-tint2: rgba(23, 42, 74, .12);
  --dash-line: rgba(23, 42, 74, .12);
  /* ui-opt 2026-11-29: light scrollbar joins the green-ink family
     (console-line rgba(39,75,44,*)) instead of the old navy */
  --scroll-thumb: rgba(39, 75, 44, .26);
  --scroll-thumb-hi: rgba(39, 75, 44, .42);
  --shadow-1: 0 2px 10px rgba(23, 42, 74, .10);
  --shadow-2: 0 6px 18px rgba(23, 42, 74, .12);
  --shot-mat: #ffffff;
}
html[data-theme="light"] body { background: var(--bg0); color: var(--tx1); }
/* S-175 verify(qwen extras): light-mode touches for leftovers */
html[data-theme="light"] .pcard .phead { background: rgba(23, 42, 74, .04); }
html[data-theme="light"] .shot img { background: #ffffff; }
/* S-175 (r1 both): a GENERIC .hidden (the plan card was retired by
   S-209 J25, the gate modal by S-232 -- the class stays for the
   live badge) */
.hidden { display: none !important; }

/* Wrench and pixel-cube labels share the live lane. */
#deltabox .dlabel { flex: none; color: var(--tx2); margin-right: 6px; }
#deltabox .dlabel svg { width: 12px; height: 12px; fill: none;
                        stroke: currentColor; stroke-width: 2;
                        stroke-linecap: round; stroke-linejoin: round; }
#deltabox .dlabel.thinking { width: 12px; height: 12px; align-self: center; }
.thinking-cube { display: block; position: relative; width: 12px; height: 12px;
                 perspective: 40px; }
.thinking-cube-body, .thinking-cube-turn-layer { position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; margin: -4.5px; transform-style: preserve-3d; }
.thinking-cube-body { transform: rotateX(-25deg) rotateY(-38deg); }
.thinking-cubie { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
                  margin: -1.5px; transform-style: preserve-3d; }
.thinking-face { position: absolute; inset: .2px; border: 0;
                 border-radius: 50%; backface-visibility: hidden; }
.thinking-face.front { background: #42b889; transform: translateZ(1.5px); }
.thinking-face.back { background: #4d8fc8; transform: rotateY(180deg) translateZ(1.5px); }
.thinking-face.right { background: #ed714c; transform: rotateY(90deg) translateZ(1.5px); }
.thinking-face.left { background: #eda14d; transform: rotateY(-90deg) translateZ(1.5px); }
.thinking-face.top { background: #f4e8c6; transform: rotateX(90deg) translateZ(1.5px); }
.thinking-face.bottom { background: #e8c64f; transform: rotateX(-90deg) translateZ(1.5px); }
#deltabox .dlane { position: relative; flex: 1; min-width: 0;
                   overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  /* Keep every animated selector inside this exemption block. */
  #deltabox.think, #send.live::before,
  .badge, .stage .mark.wait, #deltabox.operation .dcur::after,
  .console-command::after, .task-state.active::before { animation: none; }
  #stream > *, #stream .foldbody { animation: none; }
  .execution-pulse, .execution-card.running .execution-pulse { animation: none; }
  .execution-card.settled .execution-pulse { animation: none; }
  #stream > *, #stream .foldbody { transition: none; }
  #deltabox.operation .dcur::after { content: "…"; }
  /* S-301+: the download-progress indeterminate slide joins the family
     (a static 40% strip reads fine without motion). */
  .dlprog-fill.indeterminate { animation: none; }
  #top #brand::before, #top #brand .brand-mark,
  #console-head .brick-chain i,
  #right .rail,
  #aboutmodal .aboutcard,
  #weblogin, #websetup,
  #webturn { animation: none; }
  #console-head .brick-chain i,
  .hbtns button, .cstack button, .gbtn, .rail, .shot img,
  #webturn, #weblogin, #websetup { transition: none; }
  /* ui-opt 2026-11-29: guide card, completion stamp, jump flash */
  .guidecard, .flow-jump-flash { animation: none; }
  #task-steps li.just-done .task-step-no { animation: none; }
  #task-steps li.just-done .task-step-no::after { animation: none;
    content: none; }
}
/* status line under the thinking line (phase/slot notices) */
#statusline { min-height: 15px; margin: 0 2px 2px; padding: 0 10px;
              color: var(--tx3); font-size: 11px; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }
/* S-209 J1 (user order 1): an empty status line takes no vertical space
   (its 19px dead band kept the fold line far from the composer); any
   notice -- slot.wait, reconnect -- restores the band unchanged. */
#statusline:empty { display: none; }
/* placeholder fold (turn.start) + flat folds (placeholder-only bodies) */
.foldline.livefold > summary { color: var(--tx3); }
.foldline.flat > summary::before { content: ""; }
.foldline.flat > .foldbody { display: none; }
/* S-175: the warning head tint stays; the face chip tone itself is
   unified tx3 (S-186) -- semantics live in the card's left border */
.pcard.face-warning > .phead { background: var(--err-soft); }
/* header buttons + About dialog */
.hbtns { margin-left: auto; display: flex; gap: 6px; }
/* Compact composer controls; the run button keeps one fixed glyph column. */
.cstack button { background: var(--bg0); color: var(--tx1);
                 border: 1px solid var(--line); border-radius: 8px;
                 font: 12px var(--font); cursor: pointer;
                 padding: 0 8px 0 18px; white-space: nowrap; text-align: right; }
#newbtn { text-align: left; }
#newbtn::before { display: inline-block; width: 10px; margin-right: 5px;
                  text-align: center; content: "+"; font-size: 18px;
                  font-weight: 600; line-height: 1; color: var(--ok); }
#send { min-width: 88px; font-weight: 600; text-align: left; color: var(--tx0); }
#send::before { display: inline-block; width: 10px; margin-right: 5px;
                text-align: center; content: "▶"; font-size: 10px; color: var(--ok); }
#send.live { color: var(--err); border-color: var(--err);
             background: var(--err-soft); }
#send.live::before { content: "●"; font-size: 9px; color: var(--err);
                     animation: thinkpulse 1.4s infinite; }
.hbtns button { background: var(--bg2); color: var(--tx1);
                border: 1px solid var(--line2); border-radius: 6px;
                padding: 3px 10px; font: 11.5px var(--font); cursor: pointer; }
#aboutmodal { position: fixed; inset: 0; background: rgba(4, 8, 16, .55);
              display: flex; align-items: center; justify-content: center;
              z-index: 60; }
#aboutmodal .aboutcard { max-width: 560px; width: 92%; background: var(--bg1);
              border: 1px solid var(--line2); border-radius: 12px;
              padding: 18px 22px; }
#aboutmodal h2 { margin: 0 0 10px; color: var(--tx0); font-size: 16px; }
/* S-176 user order: sections per LINE -- bold head, justified body,
   module entries as list rows (NOT columns) */
#aboutmodal .ahead { color: var(--tx0); font-weight: 700; font-size: 13px;
                     margin: 12px 0 4px; }
#aboutmodal .ahead:first-child { margin-top: 0; }
#aboutmodal .atext { color: var(--tx1); font-size: 12.5px; line-height: 1.6;
                     margin: 0 0 4px; text-align: justify; }
#aboutmodal .alist { color: var(--tx1); font-size: 12.5px; line-height: 1.55;
                     margin: 0 0 2px; padding-left: 14px; position: relative; }
#aboutmodal .alist::before { content: "▪"; position: absolute;
                     left: 2px; color: var(--acc); font-size: 10px; }
#aboutmodal button { background: var(--acc); color: #fff; border: 0;
              border-radius: 7px; padding: 6px 18px; font: 12.5px var(--font);
              cursor: pointer; }
#aboutmodal.hidden { display: none; }

/* ---- S-296 web face shell (public only; these nodes never exist on the
   local face, so these rules are inert there) -------------------------- */

#webqueue {
  display: block;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--tx2, #888);
  background: var(--bg1, #f6f6f6);
}
#webqueue:empty { display: none; }

#webturn {
  position: fixed; top: 56px; right: 16px; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  max-width: calc(100vw - 32px); padding: 12px 14px;
  color: var(--tx0); background: var(--bg1);
  border: 1px solid var(--acc); border-radius: 10px;
  box-shadow: var(--shadow-2); font-size: 13px;
}
#webturn button {
  flex: none; padding: 4px 9px; color: var(--tx1);
  background: var(--chrome-tint2); border: 1px solid var(--line2);
  border-radius: 6px; cursor: pointer; font-size: 12px;
}

#weblogin {
  max-width: 360px;
  margin: 48px auto;
  padding: 20px 24px;
  border: 1px solid var(--bd, #ddd);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#weblogin label { display: flex; flex-direction: column; gap: 4px;
  font-size: 13px; }
#weblogin input { padding: 6px 8px; border: 1px solid var(--bd, #ccc);
  border-radius: 4px; }
#weblogin button { padding: 8px; cursor: pointer; }
#weblogin .msg { min-height: 1em; font-size: 13px; color: var(--warn, #b00); }

.autobadge {
  display: inline-block;
  margin-left: 8px;
  padding: 0 6px;
  font-size: 11px;
  border: 1px solid var(--bd, #ccc);
  border-radius: 8px;
  color: var(--tx2, #888);
}

/* S-301 (owner order 2026-10-25): failure reason line under the outcome
   bar -- plain-language category text (never raw error strings); rides
   the same --err/-soft family so a failed session says WHERE it failed. */
.errline {
  color: var(--err); background: var(--err-soft);
  border-left: 3px solid var(--err);
  border-radius: 7px; padding: 7px 12px; margin: 0 0 12px 12px;
  font-size: 12.5px; line-height: 1.5; max-width: 60em;
}

/* S-301+ (owner order 2026-10-26): setup download progress rides NEXT TO
   the helper button (the top banner was easy to miss); online state goes
   green (--ok family, mirroring the pending alert's --err). */
.dlprog { display: inline-flex; align-items: center; gap: 8px;
          vertical-align: middle; margin-left: 10px; }
.dlprog-bar { width: 130px; height: 6px; border-radius: 3px;
              background: var(--line); overflow: hidden; }
.dlprog-fill { height: 100%; background: var(--acc);
               border-radius: 3px; transition: width .3s ease; }
.dlprog-fill.indeterminate {
  animation: dlslide 1.2s ease-in-out infinite alternate;
  width: 40% !important; }
@keyframes dlslide { from { transform: translateX(-60%); }
                     to { transform: translateX(220%); } }
.dlprog-txt { font-size: 11px; color: var(--tx2); white-space: nowrap; }
#helperbtn.online { color: var(--ok); border-color: var(--ok); }

/* S-302 gate countdown: shrinking bar + seconds readout on the live gate
   card. Deliberately NO css animation -- width updates are JS-driven, so
   the S-203 reduced-motion exemption family is untouched. */
.gatecd { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.gatecd-track { flex: 1; height: 6px; border-radius: 3px;
                background: var(--line); overflow: hidden; }
.gatecd-fill { height: 100%; background: var(--acc); border-radius: 3px; }
.gatecd-txt { font-size: 11px; color: var(--tx2); white-space: nowrap; }

/* S-303 agent update states: amber = newer build published,
   muted-blue pulse-free = mid-swap (JS text only, no css animation). */
#helperbtn.update { color: #a06a00; border-color: #d9a521; }
#helperbtn.updating { color: var(--tx2); border-color: var(--tx2); }

/* ---- display craft pass (display-only; no behavior change) ----
   Upgrades on top of the established language: crisper card chrome,
   living affordances (hover/focus), a primary Send hierarchy, tabular
   numerals for machine timestamps, and quieter depth tokens. Every color
   rides existing theme tokens; geometry pins (text-edge equation, card
   margins) are untouched. */

:root {
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .22);
  --shot-shadow: 0 2px 6px rgba(0, 0, 0, .30);
}
html[data-theme="light"] {
  --shadow-card: 0 1px 3px rgba(23, 42, 74, .08);
  --shot-shadow: 0 1px 4px rgba(23, 42, 74, .12);
}

/* stream cards: a shade more presence + legible chrome row */
.pcard { box-shadow: var(--shadow-card); }
.pcard .phead { padding: 6px 12px; }
.pcard .phead .pface { font-weight: 600; }
.pcard .phead .ptime { font-variant-numeric: tabular-nums; }

/* fold lines: the header answers hover/open with one tone step */
details.foldline > summary { transition: color .15s ease; }
details.foldline > summary:hover,
details.foldline[open] > summary { color: var(--tx1); }

/* end bars: a status glyph ahead of the words (padding equation intact) */
.endbar.ok::before { content: "\2713\00A0\00A0"; }
.endbar.bad::before { content: "\2715\00A0\00A0"; }
.endbar { font-size: 13px; }

/* feedback bar: a settled surface instead of a draft dashed box */
.fbbar { border: 1px solid var(--line2); background: var(--bg2); }

/* composer: the input lifts off the glass; focus reads as one field */
#composer .crow { transition: border-color .15s ease, box-shadow .15s ease; }
#composer .crow:focus-within {
  border-color: var(--line2);
  box-shadow: 0 0 0 3px var(--acc-soft);
}
#composer #cin { background: var(--bg1); }
#cin:focus { border-color: var(--acc); }

/* send: the only filled primary on the page; stop keeps the outline
   danger language shared with the other destructive states */
#send { background: var(--acc); border-color: var(--acc); color: var(--bg1); }
#send::before { color: inherit; }
#send:disabled {
  background: var(--bg2); border-color: var(--line);
  color: var(--tx3); opacity: 1;
}
#send.live {
  background: var(--err-soft); border-color: var(--err); color: var(--err);
}

/* buttons answer the pointer (state colors on IDs keep precedence) */
.cstack button, .hbtns button, #langsel {
  transition: color .15s ease, border-color .15s ease;
}
.cstack button:hover:not(:disabled) { color: var(--tx0); border-color: var(--line2); }
.hbtns button:hover { color: var(--tx0); border-color: var(--tx3); }
#langsel:hover { color: var(--tx1); }
#runsel:hover { color: var(--tx0); }
.modebtn.current { box-shadow: inset 2px 0 0 var(--acc); }

/* right rail: quieter float + framed pictures + tabular durations */
.rail { box-shadow: var(--shadow-card); }
.shot img { box-shadow: var(--shot-shadow); }
.shot .cap { margin-top: 6px; }
.stage { margin: 4px 0; }
.stage .used, #runmeta { font-variant-numeric: tabular-nums; }

/* about dialog: settle the sheet on glass + shadow */
#aboutmodal { backdrop-filter: blur(3px); }
#aboutmodal .aboutcard { box-shadow: var(--shadow-2); }

/* ---- zh type hierarchy pass (html[lang="zh"] scoped; EN untouched) ----
   Owner order 2026-11-02: the in-turn text tiers read as one dense
   mass in Chinese. A three-step scale (chapter head / prose / block
   intro+list) separated by size, weight and color; CJK gets half-step
   sizes and taller leading because dense hanzi needs more air than
   latin at the same nominal size. Geometry pins (left edges, paddings)
   stay untouched; EN rendering is byte-identical. */

/* tier 1 -- turn chapter head: one clear step up, action phrase bolded */
html[lang="zh"] details.foldline { margin: 9px 0 4px; font-size: 13.5px;
                                   line-height: 1.5; }
html[lang="zh"] summary .fact { font-weight: 600; }
html[lang="zh"] summary .fturn { font-variant-numeric: tabular-nums; }

/* tier 3 -- prose: the dominant tier (+1px, taller leading, deeper sink) */
html[lang="zh"] .md { font-size: 14px; line-height: 1.75; }
html[lang="zh"] .md .md-p { margin: 0 0 .9em; }
html[lang="zh"] .md .md-h1 { font-size: 16px; }
html[lang="zh"] .md .md-h2 { font-size: 15px; }
html[lang="zh"] .md .md-h3, html[lang="zh"] .md .md-h4 { font-size: 14px; }
html[lang="zh"] .foldbody { font-size: 13px; line-height: 1.7; }
html[lang="zh"] .pcard .pbody { font-size: 14px; }

/* tier 4 -- block intro reads as a sub-head; list is one lighter step */
html[lang="zh"] .md .md-p:has(+ .md-ul),
html[lang="zh"] .md .md-p:has(+ .md-ol) {
  font-weight: 600; color: var(--tx0);
  margin: .2em 0 .5em;
}
html[lang="zh"] .md .md-ul, html[lang="zh"] .md .md-ol {
  margin: 4px 0 10px 20px; }
html[lang="zh"] .md li { font-size: 13.5px; line-height: 1.7;
                         margin: 2.5px 0; }
html[lang="zh"] .md li::marker { color: var(--tx3); }

/* small chrome: lift the tiny zh lines off the awkward floor */
html[lang="zh"] .pcard .phead { font-size: 11px; }
html[lang="zh"] .rail-title { font-size: 11.5px; }
html[lang="zh"] .stage .txt { font-size: 12.5px; }
html[lang="zh"] .stage .used { font-size: 12px; }
html[lang="zh"] .pcard .phints { font-size: 12px; }
html[lang="zh"] .shot .cap { font-size: 11.5px; }

/* ---- stage labels retired (owner order 2026-11-02, zh+en alike) ----
   The in-turn operation-detail line (S-181 opsline) no longer renders.
   A turn whose body carried ONLY that line collapses to its chapter
   head alone -- body box hidden and the caret dropped, matching the
   established flat-fold idiom. Events, the audit trail and the CLI
   panel keep the full detail: this is a display-side removal only.
   Exception (same-day owner order): the absorption turn's line (the
   lessons writeback phrase, zh and en variants) reads as the turn's
   body prose, not a stage label. */
.foldline .opsline { display: none; }
.foldline.act-read_more .opsline {
  display: block; font-size: 13px; line-height: 1.6;
  color: var(--tx1); font-weight: 400; }
html[lang="zh"] .foldline.act-read_more .opsline {
  font-size: 14px; line-height: 1.75; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more) {
  cursor: default; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > summary { cursor: default; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > summary::before { content: ""; }
details.foldline:has(.foldbody > .opsline:only-child):not(.act-read_more)
  > .foldbody { display: none; }

/* ---- Block Console: the final left-face visual layer ----
   The earlier card geometry remains as the legacy base; this layer replaces
   it with one continuous writing surface. Light is a white board, dark is a
   black board. Event names, DOM structure and gate behavior stay unchanged. */
:root {
  --console-bg: #0b0e0c;
  --console-bg2: #111612;
  --console-input: #0e120f;
  --console-text: #dce6de;
  --console-muted: #95a49a;
  --console-dim: #738178;
  --console-line: rgba(177, 204, 185, .18);
  --console-strong: rgba(177, 204, 185, .42);
  --console-accent: #8fc7a7;
  --who: #a9d6b8;
}
html[data-theme="light"] {
  --console-bg: #ffffff;
  --console-bg2: #f4f7f4;
  --console-input: #ffffff;
  --console-text: #26332a;
  --console-muted: #56645a;
  --console-dim: #66736a;
  --console-line: rgba(35, 65, 45, .18);
  --console-strong: rgba(35, 65, 45, .42);
  --console-accent: #1f6d4b;
  --who: #276549;
}
#left {
  padding: 16px 20px 12px;
  color: var(--console-text);
  background: var(--console-bg);
  font-family: var(--mono);
}
#stream {
  padding: 10px 2px 24px;
  color: var(--console-text);
  font-family: var(--mono);
}
#stream > * { animation: consoleReveal .34s cubic-bezier(.2,.7,.2,1) both; }
#stream .foldbody {
  animation: consoleReveal .28s .05s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes consoleReveal {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes consoleCursor { 50% { opacity: 0; } }

#left details.foldline {
  margin: 10px 0 4px; padding: 2px 0 2px 20px;
  border-left: 0; color: var(--console-muted);
  font-family: var(--mono); font-size: 12.5px;
}
#left details.foldline > summary { color: var(--console-muted); }
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  margin: 0 9px 0 -16px; vertical-align: 1px;
  border-radius: 0; background: var(--console-accent);
  box-shadow: 3px 3px 0 var(--console-line);
}
#left details.foldline.flat > summary::before { opacity: .55; }
#left summary .fturn { color: var(--console-dim); }
#left summary .fact { color: var(--console-text); font-weight: 500; }
html[lang="zh"] #left summary .fact { font-weight: 500; }
#left details.foldline > .foldbody {
  margin: 6px 0 14px 3px; padding: 2px 0 2px 20px;
  color: var(--console-muted); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#left .foldline .opsline,
#left .foldline.act-read_more .opsline { color: var(--console-muted); }
#left .md { color: var(--console-text); font-family: var(--mono); }
#left .md .md-p { margin-bottom: .75em; text-align: left; }
#left .md .md-h,
#left .md .md-h3,
#left .md .md-h4 { color: var(--console-text); }
#left .md .md-ul { list-style: square; }
#left .md li::marker { color: var(--console-accent); }
#left .md strong,
#left .md em { color: var(--console-text); }
#left .md a,
#left .md code { color: var(--console-accent); }
#left .md code {
  background: var(--console-bg2); border-color: var(--console-line);
  border-radius: 2px;
}
#left .md .md-code {
  color: var(--console-muted); background: var(--console-bg2);
  border-color: var(--console-line); border-radius: 2px;
}
#left .md-table .md-th,
#left .md-table .md-td { border-color: var(--console-line); }
#left .md-table .md-th { background: var(--console-bg2); }

#left .pcard {
  margin: 18px 0; overflow: visible;
  color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
}
#left .pcard .phead {
  gap: 8px; padding: 0 0 7px;
  color: var(--console-dim); background: transparent;
  border: 0; font-family: var(--mono); font-size: 11px;
}
#left .pcard .phead .pface {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 6px; color: var(--console-muted);
  background: var(--console-bg2); border: 1px solid var(--console-line);
  border-radius: 2px; font-family: var(--mono); font-weight: 500;
}
#left .pcard .phead .pface::before {
  content: ""; width: 4px; height: 4px; background: currentColor;
}
#left .pcard .phead .ptime { margin-left: 2px; color: var(--console-dim); }
#left .pcard .pbody { padding: 0 0 0 20px; font-family: var(--mono); }
#left .pcard .pbody pre {
  color: var(--console-text); font-family: var(--mono);
}
#left .pcard .phints,
#left .pcard .gatewait {
  padding: 0 0 0 20px; color: var(--console-muted);
  font-family: var(--mono);
}
#left .pcard .phints { color: var(--advisory); }
#left .pcard .gatebtns { padding-left: 20px; }
#left .pcard.face-warning .pface { color: var(--advisory); }
#left .pcard.face-summary .pface,
#left .pcard.face-confirm .pface,
#left .pcard.face-question .pface,
#left .pcard.face-gap .pface { color: var(--console-accent); }
#left .pcard.face-error .pface,
#left .pcard.face-error .phead { color: var(--err); background: transparent; }
#left .autobadge {
  margin: 0 0 12px 20px; color: var(--console-muted);
  background: var(--console-bg2); border-color: var(--console-line);
  border-radius: 2px; font-family: var(--mono);
}

#left .endbar {
  margin: 16px 0; padding: 5px 0;
  border: 0; border-radius: 0; background: transparent;
  font-family: var(--mono); font-weight: 500;
}
#left .endbar.ok,
#left .endbar.bad { background: transparent; border: 0; }
#left .endbar.ok { color: var(--ok); }
#left .endbar.bad { color: var(--err); }
#left .endbar.ok::before,
#left .endbar.bad::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  margin-right: 10px; background: currentColor;
}
#left .errline {
  margin: 0 0 14px; padding: 4px 0;
  color: var(--err); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#left .fbbar {
  flex-wrap: wrap; margin: 18px 0 8px; padding: 14px 0 4px;
  color: var(--console-muted); background: transparent;
  border: 0; border-top: 1px solid var(--console-line); border-radius: 0;
  font-family: var(--mono);
}
#left .fbbar .fbq { color: var(--console-text); }
#left .fbbar .fbin {
  color: var(--console-text); background: var(--console-input);
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#left .render-fallback {
  color: var(--warn); background: transparent;
  border-color: var(--console-line); border-radius: 2px;
  font-family: var(--mono);
}

#left .gbtn {
  color: var(--console-muted); background: transparent;
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#left .gbtn:hover { color: var(--console-text); border-color: var(--console-accent); }
#left .gbtn.primary { color: var(--console-accent); border-color: var(--console-accent); }
#left .gatecd-track,
#left .gatecd-fill { border-radius: 0; }
#left .gatecd-track { background: var(--console-line); }
#left .gatecd-fill { background: var(--console-accent); }
#left .gatecd-txt { color: var(--console-dim); font-family: var(--mono); }

#deltabox {
  margin: 0 0 2px; padding: 4px 0;
  color: var(--console-muted); border-left: 0;
  font-family: var(--mono);
}
#deltabox .dlabel { color: var(--console-dim); }
#statusline {
  position: relative; padding: 0 0 0 16px;
  color: var(--console-dim); font-family: var(--mono);
}
#statusline:not(:empty)::before {
  content: ">"; position: absolute; left: 1px; color: var(--console-accent);
}
#composer .crow {
  border-color: var(--console-strong); border-radius: 3px;
  color: var(--console-text); background: var(--console-input);
  box-shadow: none; font-family: var(--mono);
}
#composer .crow::before {
  content: ">"; align-self: center; flex: none;
  color: var(--console-accent); font: 14px var(--mono);
}
#composer .crow:focus-within {
  border-color: var(--console-accent); box-shadow: none;
}
#composer #cin {
  padding: 8px 6px; color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; font-family: var(--mono);
}
#composer #cin:focus { border-color: transparent; }
#composer #cin:focus-visible { outline: none; }
#composer .cstack button {
  color: var(--console-muted); background: transparent;
  border-color: var(--console-strong); border-radius: 2px;
  font-family: var(--mono);
}
#composer .cstack button:hover:not(:disabled) {
  color: var(--console-text); border-color: var(--console-accent);
}
#composer .modebtn.current {
  color: var(--console-text); background: var(--console-bg2);
  border-color: var(--console-line); box-shadow: inset 3px 0 0 var(--console-accent);
}
#composer #send {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); border-radius: 2px;
}
#composer #send:disabled {
  color: var(--console-dim); background: var(--console-bg2);
  border-color: var(--console-line);
}
#composer #send.live {
  color: var(--err); background: transparent; border-color: var(--err);
}
#composer.gate-wait #cin { border-color: transparent; }

/* ---- CMD x Block Console: phosphor terminal + snap-together modules ---- */
:root {
  --console-bg: #050806;
  --console-bg2: #0b110c;
  --console-input: #070b08;
  --console-text: #d8e5d8;
  --console-muted: #96a897;
  /* ui-opt 2026-11-29: dim text 4.3-4.4:1 -> 5.0-5.3:1 on dark surfaces */
  --console-dim: #78897b;
  --console-line: rgba(166, 255, 112, .18);
  --console-strong: rgba(166, 255, 112, .46);
  --console-accent: #a6ff70;
  --console-chrome: #090d0a;
  --console-block: #0d140e;
  --console-grid: rgba(166, 255, 112, .045);
  --block-green: #a6ff70;
  --block-amber: #ffbf47;
  --block-cyan: #61d9d4;
  --block-red: #ff7168;
  --block-shadow: #010201;
  --block-highlight: #e4ffd2;
  --acc: #a6ff70;
  --acc-soft: rgba(166, 255, 112, .10);
  --who: #61d9d4;
  --term: #ffcc66;
  --advisory: #ff8178;
  --ok: #a6ff70;
  --ok-soft: rgba(166, 255, 112, .10);
  --warn: #ffbf47;
  --warn-soft: rgba(255, 191, 71, .10);
  --err: #ff7168;
  --err-soft: rgba(255, 113, 104, .10);
  --shot-mat: #080c09;
}
html[data-theme="light"] {
  --console-bg: #f2f0e8;
  --console-bg2: #e7e7dc;
  --console-input: #faf9f3;
  --console-text: #1b251d;
  --console-muted: #49594c;
  /* ui-opt 2026-11-29: dim text 3.9-4.4:1 -> 4.7-5.2:1 on light surfaces;
     stays lighter than --console-muted so the mute hierarchy holds */
  --console-dim: #5a675c;
  --console-line: rgba(39, 75, 44, .19);
  --console-strong: rgba(39, 75, 44, .45);
  --console-accent: #347a3c;
  --console-chrome: #e4e4d9;
  --console-block: #faf9f3;
  --console-grid: rgba(39, 75, 44, .055);
  --block-green: #80bd61;
  --block-amber: #d99a2b;
  --block-cyan: #3b9d9a;
  --block-red: #c8554d;
  --block-shadow: #b4b5a8;
  --block-highlight: #f4ffe9;
  --acc: #347a3c;
  --acc-soft: rgba(52, 122, 60, .09);
  --who: #167078;
  --term: #8a6100;
  --advisory: #b83b34;
  --ok: #347a3c;
  --ok-soft: rgba(52, 122, 60, .09);
  --warn: #986000;
  --warn-soft: rgba(152, 96, 0, .09);
  --err: #bd443d;
  --err-soft: rgba(189, 68, 61, .08);
  --shot-mat: #ffffff;
}
body {
  color: var(--console-text);
  background: var(--console-bg);
  letter-spacing: .01em;
}
button, input, select, textarea { border-radius: 0; }
button { -webkit-tap-highlight-color: transparent; }
::selection { color: var(--console-bg); background: var(--console-accent); }
:focus-visible { outline: 2px solid var(--block-amber); outline-offset: 3px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--console-strong); border: 2px solid var(--console-bg);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: var(--console-accent); }
::-webkit-scrollbar-track { background: var(--console-bg2); }
/* title bar */
#top {
  position: relative; z-index: 20; min-height: 0; gap: 10px;
  padding: 10px 16px 6px; color: var(--console-text);
  background: transparent; backdrop-filter: none;
  border-bottom: 0;
  box-shadow: none;
}
#top::before { content: none; }
#brand {
  flex: none; gap: 10px; color: var(--console-text);
  font-size: 15px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; text-shadow: 2px 2px 0 var(--block-shadow);
}
#top #brand::before {
  content: ""; display: block; width: 30px; height: 23px; flex: none;
  border: 1px solid var(--block-highlight); border-radius: 0;
  background:
    radial-gradient(circle at 25% 24%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 75% 24%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 25% 72%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    radial-gradient(circle at 75% 72%, var(--block-highlight) 0 1px,
      var(--block-green) 1.5px 3px, transparent 3.5px),
    var(--console-accent);
  box-shadow: 3px 3px 0 var(--block-shadow);
  animation: brickSnap .48s cubic-bezier(.2,.8,.2,1) both;
}
#brand::after {
  content: "BLOCK\A CONSOLE"; white-space: pre; margin-left: 1px;
  padding-left: 10px; border-left: 1px solid var(--console-strong);
  color: var(--console-dim); font-size: 8px; font-weight: 600;
  line-height: 1.25; letter-spacing: .18em; text-shadow: none;
}
#runsel {
  color: var(--block-amber); font-size: 11.5px; font-weight: 600;
  min-height: 26px; padding: 0 3px;
}
#runsel:hover { color: var(--console-text); }
#runsel option, #langsel option {
  color: var(--console-text); background: var(--console-block);
}
#runmeta { color: var(--console-dim); font-size: 11px; }
.badge {
  padding: 2px 7px; color: var(--console-bg); background: var(--console-accent);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow); font-size: 9px;
}
.hbtns { gap: 7px; }
.hbtns button, .settings button, #langsel {
  min-height: 28px; padding: 3px 9px; color: var(--console-muted);
  background: var(--console-block); border: 1px solid var(--console-strong);
  border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow);
  font-size: 10.5px; transition: transform .12s ease, box-shadow .12s ease,
    color .12s ease, border-color .12s ease;
}
.hbtns button:hover, .settings button:hover, #langsel:hover {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--block-shadow);
}
.hbtns button:active, .settings button:active { transform: translate(1px, 1px); box-shadow: none; }
#helperbtn.pending { color: var(--block-red); border-color: var(--block-red); }
#helperbtn.online { color: var(--console-accent); border-color: var(--console-accent); }
#helperbtn.update { color: var(--block-amber); border-color: var(--block-amber); }
.settings { position: relative; flex: none; }
.settings #settingsbtn {
  display: grid; place-items: center; width: 32px; height: 30px; padding: 0;
}
.settings #settingsbtn svg { width: 17px; height: 17px; }
.settings #settingsmenu {
  position: absolute; top: calc(100% + 5px); right: 0; z-index: 60;
  min-width: 168px; padding: 6px; background: var(--console-block);
  border: 1px solid var(--console-strong); box-shadow: 4px 4px 0 var(--block-shadow);
}
.settings #settingsmenu[hidden] { display: none !important; }
.settings #revokeagent { width: 100%; }

/* static boot header */
#main { background: var(--console-bg); }
#left { position: relative; padding: 0 20px 14px; }
#console-head {
  position: relative; flex: none; min-height: 68px; padding: 13px 172px 11px 4px;
  border-bottom: 1px solid var(--console-line);
}
.console-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.console-command {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  color: var(--console-text); font-size: 12px; white-space: nowrap;
}
.console-subline {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 7px;
  color: var(--console-dim); font-size: 9px; letter-spacing: .09em;
}
.console-subline span::before { content: "["; margin-right: 3px; }
.console-subline span::after { content: "]"; margin-left: 3px; }
.brick-chain {
  position: absolute; right: 5px; bottom: 15px; display: flex;
  align-items: flex-end; gap: 5px; padding: 0 3px 4px;
  border-bottom: 3px solid var(--console-strong);
}
#console-head .brick-chain i {
  position: relative; display: block; width: 29px; height: 16px;
  color: var(--block-green); background: currentColor;
  border: 1px solid currentColor; box-shadow: 3px 3px 0 var(--block-shadow);
  animation: brickSnap .46s cubic-bezier(.2,.8,.2,1) both;
}
#console-head .brick-chain i::before {
  content: ""; position: absolute; left: 3px; right: 3px; top: -5px; height: 5px;
  background: radial-gradient(ellipse at 5px 5px, currentColor 0 3px,
    transparent 3.5px) 0 0 / 14px 5px repeat-x;
}
#console-head .brick-chain i::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.25),
    transparent 48%, rgba(0,0,0,.16));
}
#console-head .brick-chain i:nth-child(2) {
  width: 37px; height: 20px; color: var(--block-amber); animation-delay: .07s;
}
#console-head .brick-chain i:nth-child(3) {
  width: 31px; height: 16px; color: var(--block-cyan); animation-delay: .14s;
}
#console-head .brick-chain i:nth-child(4) {
  width: 23px; height: 23px; color: var(--block-red); animation-delay: .21s;
}
#stream {
  padding: 18px 5px 30px 4px;
  scrollbar-gutter: stable;
}
#stream:focus-visible { outline: 1px solid var(--console-line); outline-offset: -2px; }

/* transcript commands and inline block plates */
#left details.foldline { margin-top: 14px; }
#left details.foldline > summary {
  transition: color .15s ease, transform .15s ease;
}
#left details.foldline > summary:hover { transform: translateX(3px); }
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  box-shadow: 2px 2px 0 var(--block-shadow), 0 -2px 0 var(--console-strong);
}
#left details.foldline[open] > summary::before { background: var(--block-amber); }
#left summary .fwho { color: var(--who); font-weight: 700; }
#left summary .fturn { color: var(--console-dim); }
#left details.foldline > .foldbody { position: relative; }
#left details.foldline > .foldbody::before {
  content: "└─"; position: absolute; left: 0; top: 1px;
  color: var(--console-dim); font-size: 11px;
}
#left .md .md-h { letter-spacing: .02em; }
#left .md .md-ul { list-style: square; }
#left .md code { border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow); }
#left .md .md-code { border-left: 3px solid var(--block-cyan); border-radius: 0; }
#left .md a { color: var(--block-cyan); text-decoration: underline; }
#left .md-table .md-th { color: var(--console-accent); }

#left .pcard {
  --face: var(--console-accent);
  position: relative; margin: 24px 0; padding-right: 7px;
}
#left .pcard.face-warning { --face: var(--advisory); }
#left .pcard.face-summary,
#left .pcard.face-confirm,
#left .pcard.face-question,
#left .pcard.face-gap { --face: var(--console-accent); }
#left .pcard.face-error { --face: var(--err); }
#left .pcard .phead {
  position: relative; z-index: 1; min-height: 27px; padding: 0;
  align-items: flex-end;
}
#left .pcard .phead .pface {
  position: relative; gap: 8px; padding: 4px 10px;
  color: var(--console-bg); background: var(--face); border: 1px solid var(--face);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow);
  font-size: 10px; font-weight: 800; letter-spacing: .08em;
}
#left .pcard .phead .pface::before {
  content: ""; width: 16px; height: 5px; border-radius: 0;
  background: radial-gradient(ellipse at 4px 4px, var(--console-bg) 0 2px,
    transparent 2.5px) 0 0 / 9px 5px repeat-x;
  opacity: .55;
}
#left .pcard .phead .ptime { margin-left: auto; padding-bottom: 3px; }
#left .pcard .pbody {
  margin-top: 6px; padding: 12px 15px 12px 20px;
  color: var(--console-text); border: 1px solid var(--console-strong);
  border-left: 3px solid var(--face); border-radius: 0;
  background:
    radial-gradient(circle at calc(100% - 25px) 8px, var(--console-strong) 0 2px,
      transparent 2.5px),
    radial-gradient(circle at calc(100% - 13px) 8px, var(--console-strong) 0 2px,
      transparent 2.5px),
    var(--console-block);
  box-shadow: 4px 4px 0 var(--block-shadow);
}
#left .pcard::after {
  content: ""; position: absolute; right: 0; top: 54px; width: 7px; height: 15px;
  background: var(--face); clip-path: polygon(0 0, 100% 25%, 100% 75%, 0 100%);
}
#left .pcard .phints,
#left .pcard .gatewait {
  margin-top: 5px; padding: 7px 12px 7px 20px;
  background: var(--console-block); border-left: 3px solid var(--face);
}
#left .pcard .gatebtns,
#left .pcard .gateanswer { padding: 4px 0 0 20px; }
#left .pcard .gateanswer textarea {
  color: var(--console-text); background: var(--console-input);
  border-color: var(--console-strong); font-family: var(--mono);
}
#left .autobadge { border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow); }
#left .gbtn, .fbbar .gbtn {
  position: relative; padding: 6px 11px; color: var(--console-muted);
  background: var(--console-block); border: 1px solid var(--console-strong);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow);
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}
#left .gbtn::before, .fbbar .gbtn::before {
  content: "■"; margin-right: 6px; color: var(--console-accent); font-size: 7px;
}
#left .gbtn.primary, .fbbar .gbtn.primary {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); font-weight: 700;
}
#left .gbtn.primary::before, .fbbar .gbtn.primary::before { color: var(--console-bg); }
#left .gbtn:hover, .fbbar .gbtn:hover {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--block-shadow);
}
#left .gbtn.primary:hover, .fbbar .gbtn.primary:hover { color: var(--console-bg); }
#left .gbtn:active, .fbbar .gbtn:active { transform: translate(2px, 2px); box-shadow: none; }
#left .gatecd-track { height: 8px; border: 1px solid var(--console-line); }
#left .gatecd-fill {
  background: repeating-linear-gradient(90deg, var(--console-accent) 0 10px,
    transparent 10px 13px);
}
#left .endbar {
  padding: 8px 12px; border: 1px solid var(--console-line) !important;
  border-left: 3px solid currentColor !important; border-radius: 0;
  background: var(--console-block) !important;
  box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .errline {
  padding: 8px 12px; background: var(--err-soft);
  border-left: 3px solid var(--err); box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .fbbar {
  padding: 12px; border: 1px dashed var(--console-strong);
  background: var(--console-block); box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .fbbar .fbin { border-radius: 0; }
#left .render-fallback { border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow); }

/* command input buffer */
#deltabox {
  margin: 4px 2px; padding: 6px 9px; color: var(--console-muted);
  background: var(--console-block); border: 1px dashed var(--console-line);
}
#deltabox .dlabel { color: var(--block-cyan); }
#statusline { color: var(--block-amber); }
.composer-lane {
  display: grid; grid-template-areas: "lane"; align-items: center;
  min-height: 36px;
}
.composer-lane > * { grid-area: lane; min-width: 0; }
.composer-lane:has(#deltabox.on) .composer-caption { visibility: hidden; }
.composer-caption {
  display: flex; justify-content: space-between; gap: 12px; margin: 8px 2px 5px;
  color: var(--console-dim); font-size: 9px; letter-spacing: .12em;
}
.composer-caption span:first-child::before {
  content: "■"; margin-right: 6px; color: var(--console-accent); font-size: 7px;
}
#composer .crow {
  --crow-h: 64px; --ctl-h: 30px;
  position: relative; gap: 9px; padding: 9px;
  border: 1px solid var(--console-strong); border-radius: 0;
  background: var(--console-input); box-shadow: 4px 4px 0 var(--block-shadow);
}
#composer .crow::before {
  content: "C:\\>"; align-self: flex-start; margin: 9px 0 0 2px;
  color: var(--console-accent); font: 700 12px var(--mono);
}
#composer .crow:focus-within {
  border-color: var(--console-accent);
  box-shadow: 4px 4px 0 var(--block-shadow), 0 0 0 1px var(--console-accent);
}
#composer #cin {
  padding: 7px 6px; color: var(--console-text); caret-color: var(--console-accent);
  background: transparent; font-size: 13px;
}
#composer #cin::placeholder { color: var(--console-dim); opacity: .85; }
#composer .cstack button {
  color: var(--console-muted); background: var(--console-block);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow);
  transition: transform .12s ease, box-shadow .12s ease, color .12s ease;
}
#composer .cstack button:hover:not(:disabled) {
  color: var(--console-accent); border-color: var(--console-accent);
  transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--block-shadow);
}
#composer .cstack button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
#composer .modebtn.current {
  color: var(--console-accent); background: var(--console-bg2);
  border-color: var(--console-accent); box-shadow: inset 4px 0 0 var(--console-accent);
}
#composer #send {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); box-shadow: 3px 3px 0 var(--block-shadow);
}
#composer #send:hover:not(:disabled) { color: var(--console-bg); }
#composer #send:disabled {
  color: var(--console-dim); background: var(--console-bg2);
  border-color: var(--console-line); box-shadow: none;
}
#composer #send.live {
  color: var(--block-red); background: var(--err-soft); border-color: var(--block-red);
}
#cin:disabled { opacity: .5; }

/* numbered output modules */
#right {
  counter-reset: rail; width: 320px; gap: 15px; padding: 17px 15px;
  color: var(--console-text); border-right: 2px solid var(--console-accent);
  background-color: var(--console-bg2);
  background-image: linear-gradient(var(--console-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--console-grid) 1px, transparent 1px);
  background-size: 22px 22px;
}
#right .rail {
  --rail-accent: var(--block-cyan);
  counter-increment: rail; position: relative; padding: 13px 12px 12px;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: 4px 4px 0 var(--block-shadow);
  animation: railDock .38s cubic-bezier(.2,.75,.25,1) both;
  transition: transform .15s ease, border-color .15s ease;
}
#right .rail::before {
  content: ""; position: absolute; top: -5px; left: 15px; width: 39px; height: 5px;
  background: radial-gradient(ellipse at 6px 5px, var(--rail-accent) 0 4px,
    transparent 4.5px) 0 0 / 20px 5px repeat-x;
}
#right .rail:hover { border-color: var(--rail-accent); transform: translateY(-2px); }
#right #rail-progress { --rail-accent: var(--block-green); }
#right #rail-results { --rail-accent: var(--block-amber); }
/* ui-opt 2026-11-29: the 10px brick-hue titles read 2.1-3.1:1 on the light
   card surfaces -- below the 4.5:1 small-text floor. Light theme derives a
   darker title tone per rail (hue kept); the brick ::before and the hover
   border keep the saturated --rail-accent, so the block identity stays. */
html[data-theme="light"] #right #rail-progress { --rail-title: #447330; }
html[data-theme="light"] #right #rail-geometry { --rail-title: #206f6c; }
html[data-theme="light"] #right #rail-results { --rail-title: #7d5a10; }
#right .rail:nth-child(2) { animation-delay: .07s; }
#right .rail:nth-child(3) { animation-delay: .14s; }
.rail-title {
  gap: 8px; margin-bottom: 11px;
  /* ui-opt 2026-11-29: --rail-title overrides in the light theme (4.5:1
     floor); dark keeps the saturated accent */
  color: var(--rail-title, var(--rail-accent));
  font-size: 10px; font-weight: 800; letter-spacing: .09em;
}
.rail-title::before {
  content: ""; width: 17px; height: 11px; flex: none; border-radius: 0;
  background: radial-gradient(circle at 30% 20%, var(--block-highlight) 0 1px,
    transparent 1.5px), var(--rail-accent);
  box-shadow: 2px 2px 0 var(--block-shadow);
}
.rail-title::after {
  content: "[0" counter(rail) "]"; margin-left: auto;
  color: var(--console-dim); font-size: 9px; font-weight: 400;
}
.rail-body { color: var(--console-muted); }
.rail-body .empty {
  padding: 8px; color: var(--console-dim); background: var(--console-bg2);
  border-left: 2px solid var(--rail-accent); font-size: 11px;
}
.rail-body .empty::before { content: "> "; color: var(--rail-accent); }
.shots { gap: 13px; }
.shot img {
  border: 1px solid var(--console-strong); border-radius: 0;
  background: var(--shot-mat); box-shadow: 3px 3px 0 var(--block-shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.shot img:hover { border-color: var(--rail-accent); transform: translateY(-1px); }
.shot canvas {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--console-strong); background: var(--shot-mat);
  box-shadow: 3px 3px 0 var(--block-shadow);
}
.shot:not(.zoomed) { cursor: zoom-in; }
.shot.zoomed {
  --rail-accent: var(--console-accent);
  position: fixed; inset: 24px; z-index: 300; display: flex;
  flex-direction: column; justify-content: center; gap: 12px; margin: 0;
  padding: 16px; overflow: auto; cursor: zoom-out;
  background: var(--console-bg); border: 1px solid var(--rail-accent);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .72);
}
.shot.zoomed img, .shot.zoomed canvas {
  flex: 0 1 auto; width: 100%; height: auto; max-height: calc(100vh - 100px);
  margin: 0 auto; object-fit: contain; transform: none;
  box-shadow: none;
}
.shot .cap { color: var(--console-dim); }
.shot .cap::before { content: "// "; color: var(--rail-accent); }
.stage {
  gap: 8px; margin: 0; padding: 7px 0;
  border-bottom: 1px dashed var(--console-line);
}
.stage:last-child { border-bottom: 0; }
.stage .mark {
  display: inline-grid; place-items: center; width: 17px; height: 17px;
  color: var(--console-bg); background: var(--ok); border: 1px solid var(--ok);
  font-size: 10px;
}
.stage .mark.wait { color: var(--console-bg); background: var(--warn); border-color: var(--warn); }
.stage .txt { color: var(--console-text); }
.stage .used {
  padding: 0 4px; color: var(--console-dim); border: 0;
  font-size: 10px;
}

/* dialogs, authentication, setup and shell notices */
#aboutmodal {
  background: rgba(1, 4, 2, .82); backdrop-filter: blur(2px);
}
#aboutmodal .aboutcard {
  position: relative; width: min(640px, 92vw); max-width: 640px;
  max-height: 86vh; padding: 0; overflow-y: auto;
  color: var(--console-text); background: var(--console-bg);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 8px 8px 0 var(--console-strong);
  animation: dialogSnap .26s steps(4, end) both;
}
#aboutmodal .aboutcard::before {
  content: "C:\\JIMUSIM\\ABOUT.TXT"; display: block; padding: 8px 22px;
  color: var(--console-bg); background: var(--console-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .1em;
}
#aboutmodal .abody { padding: 20px 24px 24px; }
#aboutmodal h2 { color: var(--console-accent); font-size: 19px; letter-spacing: .06em; }
#aboutmodal h2::before { content: "■ "; color: var(--block-amber); font-size: 12px; }
#aboutmodal .ahead {
  margin-top: 17px; padding-left: 9px; color: var(--console-text);
  border-left: 4px solid var(--block-amber); font-size: 12px;
}
#aboutmodal .atext, #aboutmodal .alist { color: var(--console-muted); text-align: left; }
#aboutmodal .alist::before { color: var(--console-accent); }
#aboutmodal button {
  margin-top: 12px; padding: 7px 18px; color: var(--console-bg);
  background: var(--console-accent); border: 1px solid var(--console-accent);
  border-radius: 0; box-shadow: 3px 3px 0 var(--block-shadow); font-weight: 700;
}
#weblogin, #websetup {
  position: relative; z-index: 70; width: min(440px, calc(100% - 32px));
  margin: auto; padding: 26px; color: var(--console-text);
  background: var(--console-bg); border: 1px solid var(--console-accent);
  border-radius: 0; box-shadow: 8px 8px 0 var(--block-shadow);
  animation: dialogSnap .26s steps(4, end) both;
}
#websetup {
  position: fixed; top: 76px; left: 16px; right: 16px;
  width: min(600px, calc(100% - 32px)); max-height: calc(100vh - 100px);
  margin: 0 auto; overflow-y: auto;
}
#weblogin::before, #websetup::before {
  display: block; margin: -26px -26px 22px; padding: 8px 12px;
  color: var(--console-bg); background: var(--console-accent);
  font-size: 10px; font-weight: 800; letter-spacing: .09em;
}
#weblogin::before { content: "C:\\JIMUSIM\\AUTH.CMD"; }
#websetup::before { content: "C:\\JIMUSIM\\SETUP.CMD"; }
#weblogin h2, #websetup h2 { margin: 0 0 12px; color: var(--console-accent); }
#weblogin h2::before, #websetup h2::before { content: "■ "; color: var(--block-amber); }
#weblogin p, #websetup p { color: var(--console-muted); line-height: 1.7; }
#weblogin label { gap: 6px; color: var(--console-muted); }
#weblogin input {
  padding: 9px 10px; color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong); caret-color: var(--console-accent);
}
#weblogin input:focus { border-color: var(--console-accent); }
#weblogin button, #websetup button, #webqueue button, #webturn button {
  padding: 8px 12px; color: var(--console-bg); background: var(--console-accent);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 3px 3px 0 var(--block-shadow); font-weight: 700;
}
#weblogin .msg, #websetup .msg { color: var(--block-amber); }
#websetup a { color: var(--block-cyan); }
#webqueue {
  position: relative; z-index: 30; padding: 8px 14px;
  color: var(--block-amber); background: var(--console-block);
  border-bottom: 1px solid var(--block-amber);
}
#webqueue[data-kind="queue"]::before { content: "QUEUE> "; color: var(--console-accent); font-weight: 700; }
#webqueue[data-kind="agent"]::before { content: "AGENT> "; color: var(--console-accent); font-weight: 700; }
#webturn {
  top: 72px; right: 18px; padding: 13px 14px;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-accent); border-radius: 0;
  box-shadow: 5px 5px 0 var(--block-shadow);
  animation: toastSnap .25s steps(4, end) both;
}
.autobadge { border-radius: 0; background: var(--console-block); }
.dlprog-bar {
  width: 130px; height: 8px; border: 1px solid var(--console-line); border-radius: 0;
}
.dlprog-fill {
  background: repeating-linear-gradient(90deg, var(--console-accent) 0 10px,
    transparent 10px 13px); border-radius: 0;
}
.dlprog-txt { color: var(--console-muted); }

@keyframes brickSnap {
  0% { opacity: 0; transform: translateY(-18px) rotate(-4deg); }
  70% { opacity: 1; transform: translateY(2px) rotate(0); }
  100% { opacity: 1; transform: translateY(0) rotate(0); }
}
@keyframes railDock {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes dialogSnap {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastSnap {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Designer narrative: sans-serif prose stays readable while command labels,
   metadata and code keep the CMD voice. Square markers and flat section rules
   carry the Block vocabulary without nesting prose cards. */
:root {
  --designer-font: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  --designer-mono: var(--font);
  --designer-text: #d2ded3;
  --designer-link: var(--block-cyan);
  --designer-xs: 12px;
  --designer-sm: 12px;
  --designer-body: 12px;
  --designer-lg: 12px;
  --designer-xl: 12px;
}
html[data-theme="light"] { --designer-text: #29382d; --designer-link: #167078; }

#left details.foldline > summary {
  min-height: 32px; font-family: var(--designer-mono);
  font-size: var(--designer-sm); line-height: 20px;
}
#left summary .fturn {
  font-size: var(--designer-xs); font-variant-numeric: tabular-nums;
}
#left summary .fwho { letter-spacing: .025em; }
#left summary .fact,
html[lang="zh"] #left summary .fact { font-weight: 600; letter-spacing: .01em; }
#left details.act-ask > summary::before,
#left details.act-ask[open] > summary::before { background: var(--block-cyan); }
#left details.act-ask > .foldbody::before { color: var(--block-cyan); }
#left details.foldline > .foldbody {
  margin: 10px 0 24px 3px; padding: 8px 20px 12px 20px;
}
#left .foldline .opsline,
#left .foldline.act-read_more .opsline {
  margin: 0 0 12px; color: var(--console-dim);
  font-family: var(--designer-mono); font-size: var(--designer-xs);
  line-height: 20px; letter-spacing: .015em;
}

#left .foldbody .md,
#left .pcard .pbody .md {
  color: var(--designer-text); font-family: var(--designer-font);
  font-size: var(--designer-body); font-weight: 400;
  line-height: 1.5; letter-spacing: .012em;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
html[lang="zh"] #left .foldbody .md,
html[lang="zh"] #left .pcard .pbody .md { line-height: 1.5; letter-spacing: .02em; }
#left .foldbody .md .md-p,
#left .pcard .pbody .md .md-p {
  margin: 0 0 16px; text-align: justify; text-justify: inter-ideograph;
  white-space: normal; word-break: normal; overflow-wrap: break-word;
  line-break: strict; font-variant-numeric: tabular-nums;
}
#left .foldbody .md > :last-child,
#left .pcard .pbody .md > :last-child { margin-bottom: 0; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h {
  margin: 24px 0 12px; padding: 4px 0 4px 12px;
  color: var(--console-text); border-left: 4px solid var(--block-amber);
  font-family: var(--designer-mono); font-size: var(--designer-lg);
  font-weight: 700; line-height: 28px; letter-spacing: .025em;
  text-align: left;
}
#left .foldbody .md .md-h1,
#left .pcard .pbody .md .md-h1 { font-size: var(--designer-xl); }
#left .foldbody .md .md-h3,
#left .foldbody .md .md-h4,
#left .pcard .pbody .md .md-h3,
#left .pcard .pbody .md .md-h4 {
  font-size: var(--designer-body); line-height: 24px;
}
#left .foldbody .md .md-h::before,
#left .pcard .pbody .md .md-h::before {
  content: "■"; margin-right: 9px; color: var(--block-amber); font-size: 9px;
  vertical-align: 2px;
}

#left .foldbody .md-p.md-lead,
#left .pcard .pbody .md-p.md-lead {
  margin: 20px 0 14px; padding: 4px 0 4px 14px;
  color: var(--console-text); background: transparent;
  border-left: 2px solid var(--block-cyan); box-shadow: none;
  font-weight: 500; line-height: 1.75;
}
#left .foldbody .md-p.md-lead > strong:first-of-type,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type {
  color: var(--console-text); font-weight: 700;
}
#left .foldbody .md-p.md-lead > strong:first-of-type::before,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  content: "■"; margin-right: 9px; color: var(--block-amber);
  font-size: 8px; vertical-align: 2px;
}

#left .foldbody .md-ul,
#left .pcard .pbody .md-ul {
  margin: 8px 0 18px; padding: 0; list-style: none;
  color: var(--designer-text); background: transparent;
  border-top: 0; border-bottom: 0;
}
#left .foldbody .md-ul li,
#left .pcard .pbody .md-ul li {
  position: relative; margin: 0; padding: 8px 0 8px 24px;
  color: inherit; font-size: inherit; line-height: 1.7; text-align: left;
}
#left .foldbody .md-ul li + li,
#left .pcard .pbody .md-ul li + li { border-top: 1px dashed var(--console-line); }
#left .foldbody .md-ul li::before,
#left .pcard .pbody .md-ul li::before {
  content: ""; position: absolute; left: 2px; top: 1.15em;
  width: 8px; height: 8px; transform: translateY(-50%);
  background: var(--console-block); border: 1px solid var(--block-cyan);
  box-shadow: 1px 1px 0 var(--block-shadow);
}
#left .foldbody .md-ol,
#left .pcard .pbody .md-ol { margin: 8px 0 18px 30px; padding: 0; }
#left .foldbody .md-ol li,
#left .pcard .pbody .md-ol li {
  margin: 0; padding: 7px 0 7px 6px; line-height: 1.7; text-align: left;
}
#left .foldbody .md-ol li::marker,
#left .pcard .pbody .md-ol li::marker {
  color: var(--block-cyan); font-family: var(--designer-mono);
  font-size: var(--designer-sm); font-weight: 700;
}
#left .foldbody .md strong,
#left .pcard .pbody .md strong { color: var(--console-text); font-weight: 700; }
#left .foldbody .md em,
#left .pcard .pbody .md em { text-underline-offset: 4px; }
#left .foldbody .md a,
#left .pcard .pbody .md a { color: var(--designer-link); }
#left .foldbody .md code,
#left .pcard .pbody .md code {
  padding: 2px 6px; font-family: var(--designer-mono);
  font-size: var(--designer-sm); line-height: 20px;
}
#left .foldbody .md .md-code,
#left .pcard .pbody .md .md-code {
  margin: 12px 0 18px; padding: 12px 14px;
  font-family: var(--designer-mono); font-size: var(--designer-sm);
  line-height: 1.7; tab-size: 4;
}
#left .foldbody .md-table,
#left .pcard .pbody .md-table {
  margin: 12px 0 18px; font-size: var(--designer-sm); line-height: 1.6;
}
#left .foldbody .md-table .md-th,
#left .foldbody .md-table .md-td,
#left .pcard .pbody .md-table .md-th,
#left .pcard .pbody .md-table .md-td { padding: 8px 10px; }
#left .foldbody .md-table .md-th,
#left .pcard .pbody .md-table .md-th {
  font-family: var(--designer-mono); font-size: var(--designer-xs);
  letter-spacing: .025em;
}

#left .pcard .phead { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 16px; }
#left .pcard .phead .pface {
  padding: 5px 10px; font-size: var(--designer-xs); line-height: 16px;
  letter-spacing: .06em;
}
#left .pcard .phead .ptime { font-size: var(--designer-xs); line-height: 16px; }
#left .pcard .pbody {
  color: var(--designer-text); font-family: var(--designer-font);
  font-size: var(--designer-body); line-height: 1.75;
}
#left .pcard .pbody > pre {
  font-family: var(--designer-mono); font-size: var(--designer-sm); line-height: 1.7;
}
#left .pcard .phints,
#left .pcard .gatewait {
  margin-top: 8px; padding: 10px 14px 10px 20px;
  font-family: var(--designer-font); font-size: var(--designer-sm);
  line-height: 1.65; letter-spacing: .01em;
}
#left .pcard .phints { color: var(--advisory); }
#left .pcard .gatewait { color: var(--console-muted); }
#left .autobadge { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 20px; }

/* Decision controls use one indexed action stack. Option labels stay
   left-aligned for fast scanning; long answers wrap without shrinking controls. */
#left .pcard .gatebtns {
  counter-reset: gate-option; display: grid; grid-template-columns: 1fr;
  gap: 9px; margin: 16px 15px 0 0; padding: 16px 0 0 20px;
  border-top: 1px dashed var(--console-line);
}
#left .gatebtns .gbtn {
  counter-increment: gate-option; display: flex; align-items: flex-start;
  width: 100%; min-height: 44px; padding: 11px 14px;
  color: var(--console-text); background: transparent;
  border: 1px solid var(--console-line);
  border-left: 3px solid var(--console-strong); border-radius: 0;
  box-shadow: 2px 2px 0 var(--block-shadow);
  font-family: var(--designer-font); font-size: var(--designer-sm);
  font-weight: 400; line-height: 1.6; text-align: left; white-space: normal;
  transition: transform .18s ease, box-shadow .18s ease,
    color .18s ease, border-color .18s ease, background-color .18s ease;
}
#left .gatebtns .gbtn::before {
  content: "0" counter(gate-option); flex: none; width: 26px; margin-right: 10px;
  color: var(--console-dim); font-family: var(--designer-mono);
  font-size: var(--designer-xs); font-weight: 600; line-height: 22px;
  font-variant-numeric: tabular-nums;
}
#left .gatebtns .gbtn::after {
  content: "↵"; flex: none; margin-left: auto; padding-left: 14px;
  color: var(--console-dim); font-family: var(--designer-mono);
  font-size: 16px; line-height: 22px;
}
#left .gatebtns .gbtn.primary {
  color: var(--console-accent); background: var(--acc-soft);
  border-color: var(--console-accent); box-shadow: 2px 2px 0 var(--block-shadow);
  font-weight: 700;
}
#left .gatebtns .gbtn.primary::before,
#left .gatebtns .gbtn.primary::after { color: var(--console-accent); }
#left .gatebtns .gbtn:hover:not(:disabled) {
  color: var(--console-accent); background: var(--console-bg2);
  border-color: var(--console-accent); transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--block-shadow);
}
#left .gatebtns .gbtn:hover:not(:disabled)::after { color: var(--console-accent); }
#left .gatebtns .gbtn:active:not(:disabled) {
  transform: translate(1px, 1px); box-shadow: none;
}
#left .gatebtns .gbtn:focus-visible {
  outline: 2px solid var(--block-amber); outline-offset: 3px;
}
#left .gatebtns .gbtn:disabled { opacity: .5; cursor: wait; box-shadow: none; }

#left .pcard .gateanswer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch; gap: 10px; margin: 14px 15px 0 0; padding: 0 0 0 20px;
}
#left .pcard .gateanswer textarea {
  min-width: 0; min-height: 64px; max-height: 180px; padding: 12px 14px;
  color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong);
  border-left: 3px solid var(--block-amber); border-radius: 0;
  font-family: var(--designer-font); font-size: var(--designer-sm);
  line-height: 1.7; resize: vertical; caret-color: var(--console-accent);
}
#left .pcard .gateanswer textarea::placeholder { color: var(--console-dim); opacity: 1; }
#left .pcard .gateanswer textarea:focus {
  border-color: var(--console-accent); outline: none;
}
#left .pcard .gateanswer textarea:focus-visible {
  outline: 2px solid var(--block-amber); outline-offset: 3px;
}
#left .pcard .gateanswer .gatesend {
  align-self: stretch; min-width: 96px; min-height: 44px; margin: 0;
  font-family: var(--designer-mono); font-size: var(--designer-sm); line-height: 20px;
}
#left .pcard .gateanswer .gatesend::before { content: ">"; margin-right: 7px; }
#left .pcard .gatecd-txt { font-family: var(--designer-mono); font-size: var(--designer-xs); line-height: 16px; }

@media (max-width: 700px) {
  #left details.foldline > .foldbody { padding: 8px 8px 12px 20px; }
  #left .foldbody .md .md-h,
  #left .pcard .pbody .md .md-h { margin-top: 20px; padding-left: 10px; }
  #left .foldbody .md-p.md-lead,
  #left .pcard .pbody .md-p.md-lead { padding-left: 10px; }
  #left .pcard .gatebtns, #left .pcard .gateanswer { margin-right: 4px; }
  #left .pcard .gateanswer { grid-template-columns: 1fr; }
  #left .pcard .gateanswer .gatesend { min-height: 44px; }
}
@media (max-width: 480px) {
  #left details.foldline > summary { font-size: 13px; }
  #left .foldbody .md-ul li,
  #left .pcard .pbody .md-ul li { padding-left: 20px; }
  #left .gatebtns .gbtn { padding: 10px; }
  #left .gatebtns .gbtn::before { width: 22px; margin-right: 6px; }
  #left .gatebtns .gbtn::after { padding-left: 8px; }
}

@media (max-width: 1180px) {
  #right { width: 300px; }
  #console-head { padding-right: 150px; }
  .console-subline span:last-child { display: none; }
}
@media (max-width: 940px) {
  #left { min-width: 0; }
  #console-head { padding-right: 160px; }
}
@media (max-width: 700px) {
  #top { flex-wrap: wrap; gap: 7px; padding: 8px 10px; }
  #brand { font-size: 13px; }
  #brand::after, #runmeta { display: none; }
  .hbtns { margin-left: auto; }
  #runsel { max-width: 42vw; }
  #left { padding: 0 10px 11px; }
  #console-head { padding-right: 105px; }
  .console-subline span:nth-child(2) { display: none; }
  #console-head .brick-chain { transform: scale(.78); transform-origin: right bottom; }
  #composer .crow::before { display: none; }
  .composer-caption span:last-child { display: none; }
  #left .pcard { padding-right: 4px; }
  #left .pcard .pbody { padding-right: 10px; }
}
@media (max-width: 480px) {
  #top #brand::before { width: 25px; height: 20px; }
  #runsel { order: 2; flex: 1 0 100%; max-width: none; min-height: 22px; }
  .hbtns { gap: 4px; }
  .hbtns button, #langsel { padding: 3px 6px; font-size: 9px; }
  #console-head { min-height: 58px; padding-right: 4px; }
  #console-head .brick-chain { display: none; }
  .console-command { font-size: 10px; }
  #stream { padding-top: 12px; }
  #left .pcard .phead .ptime { display: none; }
  #composer .crow { gap: 6px; padding: 7px; }
  .mode-stack { min-width: 72px; }
  .modebtn { width: 72px; }
  #composer #send { min-width: 76px; }
  #left .pcard .gatebtns { padding-left: 8px; }
  #weblogin, #websetup { padding: 20px; }
  #weblogin::before, #websetup::before { margin: -20px -20px 18px; }
}

/* Designer command stream: open chapters, semantic rule colors and one
   reading rhythm. No stream entry owns a plate, shadow or side connector. */
:root {
  --designer-measure: 1080px;
  --designer-list: 12px;
  --stream-gutter: clamp(16px, 2vw, 32px);
  --gate-question: var(--block-cyan);
  --gate-confirm: var(--block-green);
  --gate-gap: var(--block-amber);
}
html[data-theme="light"] {
  color-scheme: light;
  --gate-question: #167078;
  --gate-confirm: #347a3c;
  --gate-gap: #986000;
}
#stream {
  padding-right: var(--stream-gutter);
  padding-left: var(--stream-gutter);
}
#stream > details.foldline,
#stream > .pcard,
#stream > .endbar,
#stream > .errline,
#stream > .fbbar,
#stream > .render-fallback {
  width: 86%; max-width: var(--designer-measure);
  margin-left: 4%; margin-right: 10%;
}

/* Designer: command head, quiet prose, compact parameter rows. */
#left details.foldline {
  margin: 0 0 20px; padding: 8px 0 0 2px;
  border-top: 1px solid var(--console-strong);
}
#left details.foldline > summary {
  display: flex; align-items: baseline; min-height: 48px;
  font-size: var(--designer-sm);
}
#left summary .fwho { color: var(--console-text); font-weight: 700; }
#left summary .fact {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
#left summary .ftime {
  flex: none; margin-left: auto; padding-left: 16px;
  color: var(--console-dim); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  content: ">"; display: inline-block; width: auto; height: auto;
  margin: 0 9px 0 0; vertical-align: 0; color: var(--console-dim);
  background: transparent; box-shadow: none;
  font-family: var(--designer-mono); font-size: 12px; font-weight: 400;
  line-height: 16px;
}
#left details.foldline > .foldbody { margin: 0; padding: 0 0 12px 18px; }
#left details.foldline > .foldbody::before { display: none; }
#left .foldbody .md .md-p,
#left .pcard .pbody .md .md-p {
  margin: 0 0 10px; text-align: justify; text-justify: inter-ideograph;
  line-break: strict; overflow-wrap: break-word;
}
#left .foldbody .md strong,
#left .pcard .pbody .md strong { font-weight: 600; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h {
  margin: 18px 0 10px; padding: 2px 0 2px 12px;
  border-left: 2px solid var(--block-amber);
}
#left .foldbody .md-p.md-lead,
#left .pcard .pbody .md-p.md-lead {
  margin: 14px 0 10px; padding: 3px 0 3px 12px;
  border-left: 2px solid var(--block-cyan);
  font-weight: 500; line-height: 1.5;
}
#left .foldbody .md-p.md-lead > strong:first-of-type::before,
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  margin-right: 8px; font-size: 7px;
}
#left .foldbody .md-ul,
#left .pcard .pbody .md-ul { margin: 6px 0 12px; }
#left .foldbody .md-ul li,
#left .pcard .pbody .md-ul li {
  padding: 5px 0 5px 23px; font-size: var(--designer-list); line-height: 1.5;
  text-align: justify; text-justify: inter-ideograph;
}
#left .foldbody .md-ul li + li,
#left .pcard .pbody .md-ul li + li { border-top: 1px dashed var(--console-line); }
#left .foldbody .md-ol li,
#left .pcard .pbody .md-ol li { text-align: justify; text-justify: inter-ideograph; }
#left .foldbody .md-ul li::before,
#left .pcard .pbody .md-ul li::before {
  width: 7px; height: 7px; box-shadow: none;
}
#left .foldbody .md-ol,
#left .pcard .pbody .md-ol { margin: 6px 0 12px 29px; }

/* Panels are log sections, not cards. Cyan asks, green confirms, amber
   flags a trade-off; body copy keeps the same neutral color throughout. */
#left .pcard {
  --face: var(--console-accent);
  position: relative; margin: 0 0 20px; padding: 20px 0 0 18px;
  border: 0; border-top: 1px solid var(--console-strong);
}
#left .pcard:last-child { border-bottom: 0; }
#left .pcard::after { display: none; }
#left .pcard.face-question { --face: var(--gate-question); }
#left .pcard.face-confirm { --face: var(--gate-confirm); }
#left .pcard.face-gap { --face: var(--gate-gap); }
#left .pcard.face-summary { --face: var(--gate-question); }
#left .pcard.face-warning { --face: var(--advisory); }
#left .pcard.face-error { --face: var(--err); }
#left .pcard .phead {
  display: block; position: absolute; top: 23px; right: 0;
  min-height: 0; padding: 0;
}
#left .pcard .phead .pface { display: none; }
#left .pcard .phead .ptime {
  display: block; margin: 0; color: var(--console-dim);
  text-align: right; font-variant-numeric: tabular-nums;
  line-height: 18px;
}
#left .pcard .pbody .md > :first-child {
  margin-top: 0; padding-top: 3px; padding-right: 88px;
  max-width: calc(100% - 88px); overflow-wrap: anywhere;
}
#left .pcard .ptool {
  color: var(--face); font-family: var(--designer-mono);
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  white-space: nowrap;
}
#left .pcard .pbody {
  margin: 0; padding: 0; color: var(--designer-text);
  background: transparent; border: 0; box-shadow: none;
}
#left .pcard .pbody .md-p { margin-bottom: 10px; }
#left .pcard .pbody .md-p.md-lead {
  margin-top: 0; border-left-color: var(--face);
}
#left .pcard .pbody .md-p.md-lead > strong:first-of-type::before {
  content: none; color: var(--face);
}
#left .pcard .pbody .md-ul { margin-top: 6px; margin-bottom: 0; }
#left .pcard .pbody .md-ul li { padding-top: 5px; padding-bottom: 5px; }
#left .pcard .pbody .md-ul li::before { border-color: var(--face); }

/* One 12px scale covers transcript, decision faces, rail and live lanes. */
#left summary .fturn,
#left .pcard .phead .ptime,
#left .gatebtns .gbtn::before,
#left .gatebtns .gbtn::after,
#brand, #runsel, #runmeta, .badge, .hbtns button, .settings button, #langsel,
.rail-title, .rail-body, .rail-body .empty, .stage .txt, .stage .used,
.shot .cap, .console-command, .console-subline, .composer-caption,
#composer .cstack button, #composer #cin, #statusline, #deltabox { font-size: 12px; }

#left .pcard .phints,
#left .pcard .gatewait {
  margin: 12px 0 0; padding: 0 0 0 12px; background: transparent;
  border: 0; border-left: 1px solid var(--face); box-shadow: none;
}
#left .autobadge {
  margin: 12px 0 0; padding: 0; color: var(--console-dim);
  background: transparent; border: 0; box-shadow: none;
}

/* Decision options are indexed command rows. The open rule and semantic
   color identify the recommended action without creating nested cards. */
#left .pcard .gatebtns {
  gap: 0; margin: 12px 0 0; padding: 3px 0 0; border-top: 0;
}
#left .gatebtns .gbtn {
  min-height: 44px; padding: 9px 10px 9px 0; color: var(--console-muted);
  background: transparent; border: 0;
  border-bottom: 1px dashed var(--console-line); box-shadow: none;
  font-weight: 400;
}
#left .gatebtns .gbtn::before {
  content: "[0" counter(gate-option) "]";
  width: 36px; margin-right: 5px; font-weight: 400;
}
#left .gatebtns .gbtn::after { font-size: 12px; }
#left .gatebtns .gbtn.primary {
  color: var(--face); background: transparent; border: 0;
  border-bottom: 1px dashed var(--console-strong);
  box-shadow: none; font-weight: 600;
}
#left .gatebtns .gbtn.primary::before,
#left .gatebtns .gbtn.primary::after { color: var(--face); }
#left .gatebtns .gbtn:hover:not(:disabled) {
  color: var(--face); background: transparent;
  border-bottom-color: var(--face); box-shadow: none;
  transform: translateX(3px);
}
#left .gatebtns .gbtn:active:not(:disabled) {
  box-shadow: none; transform: translateX(1px);
}
#left .pcard .gateanswer {
  grid-template-columns: minmax(0, 1fr) auto; gap: 12px;
  margin: 12px 0 0; padding: 0;
}
#left .pcard .gateanswer textarea {
  min-height: 64px; padding: 10px 12px; background: transparent;
  border: 0; border-left: 1px solid var(--face);
  border-bottom: 1px solid var(--console-line); box-shadow: none;
}
#left .pcard .gateanswer .gatesend {
  align-self: end; min-width: 72px; min-height: 44px; padding: 8px 0;
  color: var(--face); background: transparent; border: 0;
  border-bottom: 1px solid var(--face); box-shadow: none; font-weight: 600;
}
#left .pcard .gateanswer .gatesend:hover:not(:disabled) {
  color: var(--face); background: transparent;
  border-bottom-color: var(--face); box-shadow: none;
  transform: translateY(-1px);
}
#left .pcard .gatecd { margin: 12px 0 0; }
#left .pcard .gatecd-track { height: 4px; border: 0; }

/* Terminal, error and feedback entries follow the same open-log anatomy. */
#left .endbar {
  margin-top: 0; margin-bottom: 0; padding: 18px 0 18px 18px;
  color: var(--console-muted); background: transparent !important;
  border: 0 !important; border-top: 1px solid var(--console-line) !important;
  box-shadow: none; font-size: var(--designer-sm); font-weight: 500;
}
#left .endbar.ok::before,
#left .endbar.bad::before { width: 6px; height: 6px; margin-right: 12px; }
#left .errline {
  margin-top: 0; margin-bottom: 0; padding: 0 0 18px 18px;
  color: var(--err); background: transparent; border: 0; box-shadow: none;
  font-size: var(--designer-sm); line-height: 1.7;
}
#left .fbbar {
  margin-top: 0; margin-bottom: 0; padding: 20px 0 22px 18px;
  color: var(--console-muted); background: transparent;
  border: 0; border-top: 1px solid var(--console-line); box-shadow: none;
}
#left .fbbar .fbin {
  padding: 7px 4px; color: var(--console-text); background: transparent;
  border: 0; border-bottom: 1px solid var(--console-line); border-radius: 0;
  box-shadow: none;
}
#left .fbbar .gbtn,
#left .fbbar .gbtn.primary {
  padding: 7px 4px; color: var(--console-muted); background: transparent;
  border: 0; border-bottom: 1px solid var(--console-line);
  box-shadow: none; font-weight: 500;
}
#left .fbbar .gbtn::before,
#left .fbbar .gbtn.primary::before { content: ">"; margin-right: 6px; font-size: inherit; }
#left .fbbar .gbtn.primary { color: var(--console-accent); }
#left .fbbar .gbtn:hover,
#left .fbbar .gbtn.primary:hover {
  color: var(--console-accent); background: transparent;
  border-bottom-color: var(--console-accent); box-shadow: none;
  transform: translateY(-1px);
}
#left .render-fallback {
  padding: 12px 0 12px 18px; color: var(--warn); background: transparent;
  border: 0; border-left: 1px solid var(--warn); box-shadow: none;
}

@media (max-width: 700px) {
  :root { --stream-gutter: 18px; }
  #stream > details.foldline,
  #stream > .pcard,
  #stream > .endbar,
  #stream > .errline,
  #stream > .fbbar,
  #stream > .render-fallback { width: 100%; }
  #left .pcard { padding-right: 0; }
  #left .pcard .gateanswer { grid-template-columns: 1fr; }
  #left .pcard .gateanswer .gatesend { justify-self: end; }
}
@media (max-width: 480px) {
  :root { --stream-gutter: 12px; }
  #left .pcard { padding-left: 12px; }
  #left .pcard .gatebtns { padding-left: 0; }
  #left .pcard .phead .pface::after { letter-spacing: .04em; }
}

/* Information flow: one composer slot, with scrollable thoughts while the
   model is active, a tool task while work runs, and the input caption at rest. */
.composer-lane { grid-template-areas: "lane"; align-items: start; }
.composer-lane > * { grid-area: lane; }
.composer-lane:has(#operationbox.on) .composer-caption { visibility: hidden; }
#deltabox, #operationbox {
  min-width: 0; max-width: 100%; margin: 4px 2px; padding: 6px 9px;
  color: var(--console-muted); background: var(--console-block);
  border: 1px dashed var(--console-line); font-size: 12px;
}
#deltabox.on, #operationbox.on { display: flex; align-items: baseline; }
#operationbox { display: none; align-items: baseline; }
#operationbox .dlabel { flex: none; margin-right: 6px; color: var(--block-cyan); }
#operationbox .dlabel svg {
  width: 12px; height: 12px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
#deltabox.think { animation: none; }
#deltabox .dlane { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#deltabox .dlane > span {
  white-space: nowrap;
  transition: transform .35s cubic-bezier(.4,0,.2,1),
              opacity .35s cubic-bezier(.4,0,.2,1);
}
#deltabox .dcur { display: inline-block; }
#deltabox .dout { position: absolute; left: 0; top: 0; }
#deltabox .dlane > span.djump { transition: none; }
#deltabox .dlane[data-ovf="1"] {
  -webkit-mask-image: linear-gradient(to right, transparent 0,
    black 16px, black calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0,
    black 16px, black calc(100% - 16px), transparent 100%);
}
@media (prefers-reduced-motion: reduce) {
  #deltabox .dlane > span { transition: none; }
}

/* Decision tools and the final summary use the whole reading measure. */
#left .pcard.face-confirm .phead,
#left .pcard.face-gap .phead,
#left .pcard.face-question .phead,
#left .pcard.face-summary .phead { display: none; }
#left .pcard.face-confirm .pbody .md > :first-child,
#left .pcard.face-gap .pbody .md > :first-child,
#left .pcard.face-question .pbody .md > :first-child,
#left .pcard.face-summary .pbody .md > :first-child {
  padding-right: 0; max-width: none;
}

@font-face {
  font-family: "JimuPixel";
  src: url("/ui/JimuPixel-Regular.ttf") format("truetype");
  font-style: normal; font-weight: 400; font-display: swap;
}

/* Turn number, Builder and action share pixel type; only Builder is bold. */
#left summary .fturn,
#left summary .fwho,
#left summary .fact {
  color: var(--console-text); background: transparent; border: 0; box-shadow: none;
  font-family: "JimuPixel", var(--designer-mono); font-size: 12px !important;
  line-height: 16px; letter-spacing: .04em !important; text-transform: uppercase;
  -webkit-font-smoothing: none; font-smooth: never;
  white-space: nowrap;
}
#left summary .fturn { font-weight: 400; }
#left summary .fwho { font-weight: 700; }
#left summary .fact {
  flex: 0 1 auto; display: inline-block; max-width: 100%; padding: 0;
  font-weight: 400 !important;
}

/* Decorative console captions stay below the functional 12px text scale. */
.console-subline, .composer-caption {
  font-size: 8px; letter-spacing: .08em; opacity: .78;
}
.composer-caption { margin: 11px 2px 2px; }

/* Terminal text shares panel copy's indent; feedback stays at the stream edge. */
#left .endbar { margin-left: 4%; margin-right: 10%; }
#left .fbbar { margin-left: 0; margin-right: 0; }
#left .endbar { padding-left: 18px; }
#stream > .fbbar { width: 100%; max-width: none; }
#left .fbbar { padding-left: 0; font-family: var(--designer-font); }
#left .endbar.ok::before, #left .endbar.bad::before { display: none; }
#left .fbbar .fbq {
  color: var(--console-text); font-size: 15px; font-weight: 650;
  line-height: 1.5; letter-spacing: .01em;
}
#left .fbbar .fbin,
#left .fbbar .gbtn,
#left .fbbar .gbtn.primary {
  font-family: var(--designer-font); font-size: 15px; line-height: 1.5;
}
#left .fbbar .gbtn::before { content: none; }
#left .fbbar .gbtn.primary { padding-right: calc(4px + 1em); }
#left .fbbar .gbtn:last-child { margin-right: 0; }

/* Transcript color semantics: neutral prose, cyan information, green success,
   amber attention, red warnings/errors, and dim secondary metadata. */
:root {
  --text-info: var(--gate-question);
  --text-success: var(--gate-confirm);
  --text-caution: var(--gate-gap);
  --text-warning: var(--advisory);
  --text-error: var(--err);
}
#left .pcard { --face: var(--text-info); }
#left .pcard.face-question,
#left .pcard.face-summary { --face: var(--text-info); }
#left .pcard.face-confirm { --face: var(--text-success); }
#left .pcard.face-gap { --face: var(--text-caution); }
#left .pcard.face-warning { --face: var(--text-warning); }
#left .pcard.face-error { --face: var(--text-error); }
#stream > details.foldline,
#stream > .pcard,
#stream > .endbar,
#stream > .errline,
#stream > .render-fallback {
  margin-left: 4%; margin-right: 10%;
}
#stream > .session-command {
  width: 86%; max-width: var(--designer-measure); margin: 0 10% 20px 4%;
  padding: 12px 0;
  color: var(--console-accent); font: 700 13.5px/1.6 var(--font);
  letter-spacing: .03em; overflow-wrap: anywhere;
}
#stream > .session-command .session-input { color: var(--console-text); }
@media (max-width: 700px) {
  #stream > .session-command { width: 100%; }
}
#left .pcard .phints { color: var(--text-warning); }
#left .endbar.ok { color: var(--text-success); }
#left .endbar.bad, #left .errline { color: var(--text-error); }
#left .fbbar .gbtn.primary { color: var(--text-success); }
#left .fbbar .gbtn:hover {
  color: var(--console-text); border-bottom-color: var(--console-text);
}
#left .fbbar .gbtn.primary:hover {
  color: var(--text-success); border-bottom-color: var(--text-success);
}
#left .render-fallback {
  color: var(--text-warning); border-left-color: var(--text-warning);
}

.console-command::after {
  content: "■"; display: inline-block; margin-left: 8px;
  color: var(--console-text); font-size: 10px;
  animation: consoleCursorBlink 1.1s steps(1, end) infinite;
}
@keyframes consoleCursorBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .console-command::after { animation: none; }
}

#top { align-items: flex-end; }
.settings #settingsbtn { height: 28px; }
#brand {
  text-shadow: none; align-items: flex-end;
  padding: 0; gap: 10px;
  background: none; border: 0; box-shadow: none;
}
#brand::before, #brand::after { content: none; }
#brand .brand-mark {
  width: 46px; height: 52px; flex: none; overflow: visible;
  margin-left: 0;
}
#brand .brand-mark polygon {
  transform-box: fill-box; transform-origin: center;
}
#brand .brand-copy {
  display: grid; gap: 5px; min-width: 0;
}
#brand .brand-cn {
  display: block;
  color: color-mix(in srgb, var(--block-green) 45%, var(--console-text));
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 30px; font-weight: 800; letter-spacing: .08em; line-height: 1.05;
  white-space: nowrap; text-align: justify; text-align-last: justify;
  -webkit-font-smoothing: antialiased;
}
html[data-theme="light"] #brand .brand-cn { color: #245a40; }
#brand .brand-slogan {
  display: block;
  color: var(--console-muted);
  font-family: "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  font-size: 7.5px; font-weight: 500; line-height: 1.4;
  letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
  text-align: justify; text-align-last: justify;
}
html[data-theme="light"] #brand .brand-slogan { color: var(--console-text); }
.site-legal {
  position: relative; z-index: 80; flex: none; display: flex;
  flex-wrap: wrap; gap: 0 24px;
  align-items: center; justify-content: center; min-height: 30px;
  padding: 5px 16px; color: var(--console-dim);
  background: var(--console-chrome); border-top: 1px solid var(--console-line);
  font: 10px/1.5 var(--font); letter-spacing: .04em; text-align: center;
}
.site-legal a { color: inherit; text-decoration: none; opacity: .45; }
.site-legal a:hover, .site-legal a:focus-visible {
  color: var(--console-accent); opacity: 1;
}
@media (max-width: 700px) {
  #brand .brand-mark { width: 42px; height: 48px; margin-left: 0; }
  #brand .brand-cn { font-size: 28px; }
  #brand .brand-slogan { font-size: 7px; }
  .site-legal { padding: 5px 10px; font-size: 9px; }
}
@media (max-width: 480px) {
  #brand { gap: 8px; }
  #brand .brand-mark { width: 36px; height: 42px; margin-left: 0; }
  #brand .brand-cn { font-size: 26px; }
  #brand .brand-slogan { font-size: 6.5px; letter-spacing: .08em; }
}

@media (min-width: 701px) {
  #top { padding-left: 24px; }
}
#console-head {
  min-height: 64px; margin-top: 5px; padding-top: 12px; padding-bottom: 10px;
}
.console-line { min-height: 22px; }
.console-command { line-height: 1.6; letter-spacing: .035em; }
.console-subline {
  gap: 8px 22px; margin-top: 7px; font-size: 9px;
  line-height: 1.5; letter-spacing: .1em;
}
#console-head .brick-chain { bottom: 14px; }
@media (max-width: 700px) {
  #top { padding-left: 14px; }
  #console-head {
    min-height: 58px; margin-top: 4px; padding-top: 10px; padding-bottom: 9px;
  }
  .console-subline { gap: 7px 14px; }
}

/* Information flow: drafting-table chapters and semantic decision worksheets. */
:root {
  --designer-body: 13px;
  --designer-list: 13px;
  --stream-measure: 1040px;
  --stream-ghost: rgba(166, 255, 112, .025);
  --stream-shadow: rgba(0, 0, 0, .18);
  --question-soft: rgba(97, 217, 212, .08);
}
html[data-theme="light"] {
  --stream-ghost: rgba(52, 122, 60, .025);
  --stream-shadow: rgba(39, 75, 44, .10);
  --question-soft: rgba(22, 112, 120, .07);
}
#stream { overflow-x: hidden; }
#stream > details.foldline,
#stream > .pcard,
#stream > .session-command,
#stream > .endbar {
  width: calc(100% - 32px); max-width: var(--stream-measure);
  margin-left: 0; margin-right: auto;
}
#stream > .session-command {
  padding: 12px 22px; font-size: 15px;
  background: linear-gradient(90deg, var(--stream-ghost), transparent 72%);
  border-left: 2px solid var(--console-strong);
}
#left .endbar { padding-right: 22px; padding-left: 22px; }

/* Builder chapters share one grid, marker and reading rhythm. */
#left details.foldline {
  position: relative; margin: 0 0 14px; padding: 0;
  border: 0; background: transparent;
}
#left details.foldline > summary {
  position: relative; align-items: center; min-height: 50px;
  padding: 13px 22px 11px;
  border-top: 1px solid var(--console-line);
  border-bottom: 1px solid transparent;
  color: var(--console-text); cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
#left details.foldline > summary::after {
  content: ""; position: absolute; top: -1px; left: 0;
  width: 42px; height: 2px; background: var(--console-strong);
  transition: width .22s ease, background-color .18s ease;
}
#left details.foldline[open] > summary {
  background: linear-gradient(90deg, var(--stream-ghost), transparent 68%);
  border-bottom-color: var(--console-line);
}
#left details.foldline[open] > summary::after {
  width: 72px; background: var(--console-accent);
}
#left details.foldline > summary:hover {
  background: var(--stream-ghost); border-top-color: var(--console-strong);
}
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before {
  content: "+"; display: inline-grid; place-items: center; align-self: center;
  flex: none; width: 22px; height: 22px; margin: 0 12px 0 0;
  color: var(--console-dim); background: transparent;
  border: 1px solid var(--console-line); font-size: 15px; line-height: 1;
  text-align: center; transition: color .18s ease, border-color .18s ease,
    background-color .18s ease;
}
#left details.foldline[open] > summary::before {
  content: "−"; color: var(--console-accent);
  background: var(--acc-soft); border-color: var(--console-strong);
}
#left details.foldline.flat { margin-bottom: 4px; }
#left details.foldline.flat > summary { min-height: 44px; cursor: default; }
#left details.foldline.flat > summary::after { width: 24px; }
#left details.foldline.flat > summary::before,
#left details.foldline.flat[open] > summary::before {
  content: "·"; color: var(--console-dim); background: transparent;
  border-color: transparent;
}
#left summary .fturn,
#left summary .fwho,
#left summary .fact { font-size: 15px !important; line-height: 1.5; }
#left summary .fturn {
  min-width: 30px; color: var(--console-dim); font-variant-numeric: tabular-nums;
}
#left summary .fwho { color: var(--console-text); letter-spacing: .06em !important; }
#left summary .fact { color: var(--console-muted); }
#left summary .ftime {
  color: var(--console-dim); font-size: 12px; font-variant-numeric: tabular-nums;
}
#left details.foldline > .foldbody {
  max-width: none; margin: 0 0 8px; padding: 6px 22px 20px;
  background: linear-gradient(90deg, var(--stream-ghost), transparent 58%);
  border-left: 0; border-bottom: 1px solid var(--console-line);
}
#left .foldbody .md,
#left .pcard .pbody .md { line-height: 1.75; }
html[lang="zh"] #left .foldbody .md,
html[lang="zh"] #left .pcard .pbody .md { line-height: 1.8; }
#left .foldbody .md .md-p { margin-bottom: 12px; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h {
  margin: 20px 0 10px; padding: 3px 0 3px 12px;
  border-left-color: var(--console-accent); font-size: 14px; line-height: 1.5;
}
#left .foldbody .md-p.md-lead,
#left .pcard .pbody .md-p.md-lead {
  margin: 14px 0 12px; padding: 5px 0 5px 13px;
  background: var(--stream-ghost); line-height: 1.7;
}
#left .foldbody .md-ul li,
#left .pcard .pbody .md-ul li {
  padding-top: 7px; padding-bottom: 7px; line-height: 1.65;
}
#left .foldbody .md-ul li::before,
#left .pcard .pbody .md-ul li::before {
  top: 1.2em; width: 6px; height: 6px; background: var(--console-block);
}

/* Decision worksheets separate reading, guidance and actions. */
#left .pcard {
  --face-soft: var(--acc-soft);
  margin-top: 22px; margin-bottom: 24px; padding: 0;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-line);
  border-top: 2px solid var(--face);
  box-shadow: none; scroll-margin: 20px;
}
#left .pcard.face-question,
#left .pcard.face-summary { --face-soft: var(--question-soft); }
#left .pcard.face-confirm { --face-soft: var(--ok-soft); }
#left .pcard.face-gap { --face-soft: var(--warn-soft); }
#left .pcard.face-warning,
#left .pcard.face-error { --face-soft: var(--err-soft); }
#left .pcard[data-gid] {
  border-color: var(--face);
  box-shadow: 0 10px 28px var(--stream-shadow);
}
#left .pcard .phead { top: 19px; right: 18px; }
#left .pcard .pbody {
  padding: 20px 22px;
  background: linear-gradient(135deg, var(--face-soft), transparent 52%);
}
#left .pcard .pbody .md > :last-child { margin-bottom: 0; }
#left .pcard.face-confirm .pbody .md > :first-child,
#left .pcard.face-gap .pbody .md > :first-child,
#left .pcard.face-question .pbody .md > :first-child {
  margin: 0 0 15px; padding: 0 0 14px;
  border-bottom: 1px solid var(--console-line);
  color: var(--console-text); font-size: 15px; font-weight: 600;
  line-height: 1.65; letter-spacing: .01em;
}
#left .pcard .ptool {
  display: inline-block; margin-right: 7px;
  color: var(--face); font-size: inherit; font-weight: 700;
  letter-spacing: .08em;
}
#left .pcard.face-summary .pbody .md strong { font-weight: 400; }
#left .pcard .pbody .md-p.md-lead {
  margin-top: 0; border-left-color: var(--face);
}
#left .pcard .pbody .md-ul { margin: 8px 0 2px; }
#left .pcard .pbody .md-ul li::before { border-color: var(--face); }
#left .pcard .phints,
#left .pcard .gatewait {
  margin: 0; padding: 12px 22px;
  background: var(--face-soft); border: 0;
  border-top: 1px solid var(--console-line); font-size: 13px;
}
#left .autobadge {
  margin: 0; padding: 10px 22px; color: var(--console-dim);
  background: var(--console-block); border-top: 1px solid var(--console-line);
}
#left .endbar, #left .errline { font-size: 13px; }

/* Choices share one action deck; the first option carries the face color. */
#left .pcard .gatebtns {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 10px; margin: 0; padding: 16px 22px 20px;
  background: var(--console-bg2); border-top: 1px solid var(--console-line);
}
#left .gatebtns .gbtn,
#left .gatebtns .gbtn.primary {
  align-items: center; min-height: 48px; padding: 11px 13px;
  color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: none; font-size: 13px; font-weight: 500;
  transition: color .16s ease, background-color .16s ease,
    border-color .16s ease, transform .16s ease;
}
#left .gatebtns .gbtn::before,
#left .gatebtns .gbtn.primary::before { color: var(--console-dim); }
#left .gatebtns .gbtn::after { color: var(--console-dim); }
#left .gatebtns .gbtn.primary {
  color: var(--console-bg); background: var(--face); border-color: var(--face);
  font-weight: 700;
}
#left .gatebtns .gbtn.primary::before,
#left .gatebtns .gbtn.primary::after { color: var(--console-bg); }
#left .gatebtns .gbtn:hover:not(:disabled),
#left .gatebtns .gbtn.primary:hover:not(:disabled) {
  color: var(--face); background: var(--face-soft);
  border-color: var(--face); box-shadow: none; transform: translateY(-1px);
}
#left .gatebtns .gbtn:hover:not(:disabled)::after { color: var(--face); }
#left .gatebtns .gbtn:active:not(:disabled),
#left .gatebtns .gbtn.primary:active:not(:disabled) { transform: translateY(0); }
#left .pcard .gateanswer {
  gap: 12px; margin: 0; padding: 16px 22px 20px;
  background: var(--console-bg2); border-top: 1px solid var(--console-line);
}
#left .pcard .gatebtns:has(+ .gateanswer) { padding-bottom: 4px; }
#left .pcard .gatebtns + .gateanswer { padding-top: 12px; border-top: 0; }
#left .pcard .gateanswer textarea {
  min-height: 76px; padding: 11px 13px;
  color: var(--console-text); background: var(--console-input);
  border: 1px solid var(--console-strong); border-left: 3px solid var(--face);
  font-size: 13px;
}
#left .pcard .gateanswer textarea:hover { border-color: var(--face); }
#left .pcard .gateanswer .gatesend {
  align-self: stretch; min-width: 88px; padding: 10px 14px;
  color: var(--console-bg); background: var(--face); border: 1px solid var(--face);
  transition: transform .16s ease, filter .16s ease;
}
#left .pcard .gateanswer .gatesend:hover:not(:disabled) {
  color: var(--console-bg); background: var(--face); transform: translateY(-1px);
  filter: brightness(1.06);
}
#left .pcard .gatecd {
  margin: 0; padding: 0 22px 16px; background: var(--console-bg2);
}
#left .pcard .gatecd-track { background: var(--console-line); }
#left .pcard .gatecd-fill { background: var(--face); }

@media (max-width: 700px) {
  #stream > details.foldline,
  #stream > .pcard,
  #stream > .session-command,
  #stream > .endbar { width: 100%; }
  #left details.foldline > summary { padding-right: 16px; padding-left: 16px; }
  #left details.foldline > .foldbody { padding-right: 16px; padding-left: 16px; }
  #stream > .session-command { padding-right: 16px; padding-left: 16px; }
  #left .endbar { padding-right: 16px; padding-left: 16px; }
  #left .pcard .pbody { padding: 17px 16px; }
  #left .pcard .gatebtns { grid-template-columns: 1fr; padding: 14px 16px 17px; }
  #left .pcard .gateanswer { padding: 14px 16px 17px; }
  #left .pcard .phints,
  #left .pcard .gatewait,
  #left .pcard .gatecd { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 480px) {
  #left summary .ftime { display: none; }
  #left details.foldline > summary { padding-top: 11px; }
  #left .pcard.face-confirm .pbody .md > :first-child,
  #left .pcard.face-gap .pbody .md > :first-child,
  #left .pcard.face-question .pbody .md > :first-child { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  #left details.foldline > summary,
  #left details.foldline > summary::before,
  #left details.foldline > summary::after,
  #left .gatebtns .gbtn,
  #left .pcard .gateanswer .gatesend { transition: none; }
}

/* Transcript typography: Latin serif with a native CJK fallback. */
#left #stream,
#left #stream * {
  font-family: "Times New Roman", "Microsoft YaHei UI", "Microsoft YaHei", serif;
  -webkit-font-smoothing: antialiased;
  font-smooth: always;
}

/* Readable transcript scale: 14px minimum, 16px primary titles. */
#stream {
  --designer-xs: 14px;
  --designer-sm: 14px;
  --designer-body: 14px;
  --designer-list: 14px;
}
#left summary .fturn,
#left summary .fwho,
#left summary .fact { font-size: 16px !important; }
#left details.foldline > summary::before,
#left details.foldline[open] > summary::before { font-size: 16px; }
#left .pcard.face-confirm .pbody .md > :first-child,
#left .pcard.face-gap .pbody .md > :first-child,
#left .pcard.face-question .pbody .md > :first-child,
#stream > .session-command { font-size: 16px; }
#left .foldbody .md .md-h,
#left .pcard .pbody .md .md-h { font-size: 15px; }
#left summary .ftime,
#left .pcard .phead .ptime,
#left .gatebtns .gbtn::before,
#left .gatebtns .gbtn::after,
#left .pcard .phints,
#left .pcard .gatewait,
#left .gatebtns .gbtn,
#left .gatebtns .gbtn.primary,
#left .pcard .gateanswer textarea,
#left .endbar,
#left .errline,
#left .render-fallback { font-size: 14px; }

/* Three-column information flow: vertical task track, narrative, outputs. */
#task-rail {
  flex: 0 0 276px; width: 276px; min-height: 0; overflow-y: auto;
  color: var(--console-text);
  background: linear-gradient(160deg, var(--stream-ghost), transparent 42%),
    var(--console-bg2);
  border-right: 1px solid var(--console-strong);
  scrollbar-gutter: stable;
}
#task-rail[hidden], #task-status[hidden] { display: none; }
#task-status {
  display: flex; flex-direction: column; width: 100%; min-height: 100%;
  margin: 0; color: var(--console-text); background: transparent; border: 0;
  font-family: "Times New Roman", "Microsoft YaHei UI", "Microsoft YaHei", serif;
}
.task-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 10px 12px; padding: 20px;
  border-top: 3px solid var(--console-accent);
  border-bottom: 1px solid var(--console-line);
}
#task-status-title {
  grid-column: 1 / -1; font-size: 14px; font-weight: 600; letter-spacing: .06em;
}
.task-state {
  display: inline-flex; align-items: center; gap: 7px; width: max-content;
  color: var(--console-accent); font-size: 13px; font-weight: 600;
}
.task-state::before {
  content: ""; width: 7px; height: 7px; flex: none;
  background: currentColor; box-shadow: 2px 2px 0 var(--block-shadow);
}
.task-state.active::before { animation: taskStatePulse 1.8s ease-in-out infinite; }
.task-state.waiting { color: var(--warn); }
.task-state.done { color: var(--ok); }
.task-state.failed { color: var(--err); }
.task-elapsed {
  margin: 0; color: var(--console-dim); font-size: 13px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.task-goal-row {
  display: grid; grid-template-columns: 1fr; gap: 7px; padding: 16px 20px;
  border-bottom: 1px solid var(--console-line); font-size: 13px; line-height: 1.7;
}
#task-goal-label {
  color: var(--console-dim); font-size: 12px; font-weight: 600; letter-spacing: .12em;
}
#task-goal {
  display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical;
  -webkit-line-clamp: 4; overflow-wrap: anywhere;
}
#task-steps {
  display: flex; flex: 1; flex-direction: column; justify-content: center;
  min-height: 300px; margin: 0; padding: 14px 20px; list-style: none;
}
#task-steps li {
  position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr);
  align-items: center; gap: 12px; min-width: 0; min-height: 52px; padding: 5px 0;
  color: var(--console-dim); border: 0; font-size: 14px; line-height: 1.4;
}
#task-steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; top: 41px; bottom: -6px;
  width: 1px; background: var(--console-line);
}
#task-steps li.done { color: var(--ok); }
#task-steps li.done::after { background: var(--console-strong); }
#task-steps li.current {
  color: var(--console-text);
  background: linear-gradient(90deg, var(--acc-soft), transparent 88%);
}
.task-step-no {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: 32px; height: 32px; margin: 0; color: var(--console-dim);
  background: var(--console-bg2); border: 1px solid var(--console-line);
  font-family: var(--font); font-size: 12px; font-variant-numeric: tabular-nums;
}
#task-steps li.done .task-step-no {
  color: var(--console-bg); background: var(--ok); border-color: var(--ok);
}
#task-steps li.current .task-step-no {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); box-shadow: 3px 3px 0 var(--block-shadow);
}
.task-step-label { position: relative; z-index: 1; display: block; overflow-wrap: anywhere; }
#task-steps li.current .task-step-label { font-weight: 700; }
.task-now {
  /* ui-opt: pins the action lane to the visible bottom when the track
     overflows -- the "needs you" cue must never scroll out of reach */
  position: sticky; bottom: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px 20px 20px; background: var(--console-block);
  border-top: 1px solid var(--console-line); font-size: 14px; line-height: 1.6;
}
#task-activity { min-width: 0; overflow-wrap: anywhere; }
#task-activity::before { content: ">"; margin-right: 8px; color: var(--console-accent); }
.task-action {
  display: inline-flex; align-items: center; min-height: 27px; padding: 3px 8px;
  color: var(--console-dim); background: var(--console-bg2);
  border: 1px solid var(--console-line); font-size: 13px; text-align: left;
}
.task-action.confirm,
.task-action.input { color: var(--warn); border-color: var(--warn); font-weight: 700; }
.task-action.stop { color: var(--ok); }
/* ui-opt: the action lane announces itself at the rail's left edge,
   echoing the right rail's .empty border-left language */
#task-status .task-now { border-left: 3px solid transparent; }
#task-status[data-status="waiting"] .task-now {
  background: var(--warn-soft); border-left-color: var(--warn);
}
#task-status[data-status="failed"] .task-now {
  background: var(--err-soft); border-left-color: var(--err);
}
/* ui-opt: light-theme done labels join the readable dark-green family
   (--ok #347a3c reads 4.22:1 on the step surface; #447330 reads 4.51) */
html[data-theme="light"] #task-steps li.done { color: #447330; }
@keyframes taskStatePulse { 50% { opacity: .35; } }

/* Decision cards keep their semantics visible before the first sentence. */
#left .pcard.face-confirm,
#left .pcard.face-gap,
#left .pcard.face-question { border-top-width: 3px; }
#left .pcard.face-confirm .ptool,
#left .pcard.face-gap .ptool,
#left .pcard.face-question .ptool {
  display: inline-flex; align-items: center; margin-right: 10px; padding: 2px 7px;
  color: var(--face); background: var(--face-soft); border: 1px solid var(--face);
  font-family: var(--font); font-size: 12px; line-height: 18px;
  letter-spacing: .08em; vertical-align: 1px;
}
#left .pcard.face-confirm[data-gid],
#left .pcard.face-gap[data-gid],
#left .pcard.face-question[data-gid] {
  box-shadow: inset 3px 0 0 var(--face), 0 10px 28px var(--stream-shadow);
}
#left .pcard.face-confirm[data-gid] .pbody,
#left .pcard.face-gap[data-gid] .pbody,
#left .pcard.face-question[data-gid] .pbody {
  background: linear-gradient(135deg, var(--face-soft), transparent 70%);
}
#left .face-confirm .gatebtns .gbtn,
#left .face-gap .gatebtns .gbtn,
#left .face-question .gatebtns .gbtn { min-height: 52px; }
#left .face-confirm .gatebtns .gbtn.primary:hover:not(:disabled),
#left .face-gap .gatebtns .gbtn.primary:hover:not(:disabled),
#left .face-question .gatebtns .gbtn.primary:hover:not(:disabled) {
  color: var(--console-bg); background: var(--face); border-color: var(--face);
  filter: brightness(1.05);
}

/* Accepted stage outcomes replace protocol-turn chapters in the main flow. */
#stream > details.stage-card {
  width: calc(100% - 32px); max-width: var(--stream-measure);
  margin: 0 0 16px; color: var(--console-text);
  background: var(--console-block); border: 1px solid var(--console-line);
  border-top: 2px solid var(--console-strong);
}
.stage-card > summary {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center; gap: 12px; min-height: 52px; padding: 10px 20px;
  cursor: pointer; list-style: none;
}
.stage-card > summary::-webkit-details-marker { display: none; }
.stage-card > summary::before {
  content: "+"; display: inline-grid; place-items: center; width: 24px; height: 24px;
  color: var(--console-dim); border: 1px solid var(--console-line); font-size: 16px;
}
.stage-card[open] > summary::before {
  content: "−"; color: var(--console-accent); border-color: var(--console-strong);
}
.stage-card[open] > summary { border-bottom: 1px solid var(--console-line); }
.stage-card-title { min-width: 0; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.stage-card-status { color: var(--ok); font-size: 14px; white-space: nowrap; }
.stage-card.retrying { border-top-color: var(--warn); }
.stage-card.retrying .stage-card-status { color: var(--warn); }
.stage-card-time { color: var(--console-dim); font-size: 13px; font-variant-numeric: tabular-nums; }
.stage-card-body { padding: 16px 20px 18px; }
.stage-conclusion {
  display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px;
  margin-bottom: 12px; font-size: 15px; line-height: 1.75;
}
.stage-conclusion-label,
.stage-field-label { color: var(--console-dim); font-size: 13px; }
.stage-conclusion-text { overflow-wrap: anywhere; }
.stage-fields { display: grid; gap: 0; margin: 0; }
.stage-field {
  display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--console-line);
  font-size: 14px; line-height: 1.65;
}
.stage-field-value { overflow-wrap: anywhere; white-space: pre-wrap; }
.stage-next {
  display: flex; gap: 12px; margin-top: 14px; padding-top: 12px;
  color: var(--console-muted); border-top: 1px solid var(--console-line);
  font-size: 14px; line-height: 1.6;
}
.stage-next-label { flex: none; color: var(--console-accent); }

@media (max-width: 1180px) {
  #task-rail { flex-basis: 248px; width: 248px; }
  .task-heading, .task-goal-row, .task-now { padding-right: 16px; padding-left: 16px; }
  #task-steps { padding-right: 16px; padding-left: 16px; }
}
@media (max-width: 940px) {
  #task-rail { flex-basis: 224px; width: 224px; }
}
@media (max-width: 700px) {
  #main {
    display: grid; grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(560px, 1fr); overflow-y: auto;
  }
  #task-rail {
    width: 100%; min-height: auto; max-height: none; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--console-strong);
  }
  #task-status { display: block; min-height: 0; }
  .task-heading { padding: 13px 16px; }
  #task-status-title { grid-column: 1; font-size: 14px; }
  .task-state { grid-column: 2; grid-row: 1; }
  .task-elapsed { grid-column: 1 / -1; }
  .task-goal-row { padding: 12px 16px; }
  #task-goal { -webkit-line-clamp: 2; }
  #task-steps {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px; min-height: 0; padding: 12px 16px;
  }
  #task-steps li {
    grid-template-columns: 28px minmax(0, 1fr); gap: 8px;
    min-height: 44px; padding: 4px 0;
  }
  #task-steps li:not(:last-child)::after { display: none; }
  .task-step-no { width: 28px; height: 28px; }
  .task-now {
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 12px 16px;
  }
  #left { min-height: 560px; }
  #right {
    width: 100%; direction: ltr; border-left: 0;
    border-top: 2px solid var(--console-accent);
  }
  #stream > details.stage-card { width: 100%; }
  .stage-card > summary {
    grid-template-columns: 30px minmax(0, 1fr) auto; gap: 8px; padding: 10px 14px;
  }
  .stage-card-time { display: none; }
  .stage-card-body { padding: 14px; }
}
@media (max-width: 480px) {
  #console-head { min-height: 48px; }
  .task-heading { gap: 8px; }
  #task-steps { gap: 6px; }
  #task-steps li { grid-template-columns: 1fr; gap: 5px; }
  .task-now { flex-direction: column; align-items: flex-start; gap: 7px; }
  .stage-card-status { font-size: 13px; }
  .stage-conclusion,
  .stage-field { grid-template-columns: 1fr; gap: 3px; }
}
#task-steps li,
.task-step-no,
.stage-card-time,
.stage-card-status,
.stage-conclusion-label,
.stage-field-label { font-size: 14px; }

@media (min-width: 1600px) {
  :root { --stream-measure: 1180px; --stream-gutter: 36px; }
  #task-rail { flex-basis: 300px; width: 300px; }
  #right { width: 400px; }
  .task-heading { padding: 24px; }
  .task-goal-row { padding: 20px 24px; font-size: 14px; }
  #task-status-title { font-size: 15px; }
  #task-steps { padding: 20px 24px; }
  #task-steps li { min-height: 58px; }
  #task-steps li:not(:last-child)::after { top: 44px; }
  .task-now { padding: 20px 24px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  #task-status,
  .stage-card { animation: none; transition: none; }
  .task-state.active::before { animation: none; }
}

/* Harness thread entries: plan, approval and execution records. */
#stream [hidden] { display: none !important; }
@keyframes flowCardIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

#task-steps li { display: block; min-height: 46px; padding: 0; }
.task-step-button {
  position: relative; z-index: 1; display: grid;
  grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 12px;
  width: 100%; min-height: 46px; padding: 4px 0;
  color: inherit; background: transparent; border: 0; text-align: left;
  cursor: pointer; transition: color .16s ease, background-color .16s ease, padding .16s ease;
}
.task-step-button:hover { padding-left: 7px; color: var(--console-text); background: var(--acc-soft); }
.task-step-button.selected {
  padding-left: 9px; color: var(--console-text);
  background: linear-gradient(90deg, var(--acc-soft), transparent 92%);
  box-shadow: inset 2px 0 0 var(--console-accent);
}
.task-step-button.selected .task-step-label { font-weight: 700; }
#task-steps li:not(:last-child)::after { z-index: 0; }

.stage-card-meta {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center; gap: 14px; padding-bottom: 16px;
  border-bottom: 1px solid var(--console-line);
}
.stage-card-meta .stage-card-title { font-size: 15px; font-weight: 600; }
.stage-card .stage-card-body { padding: 20px 0 0; }
.stage-card .stage-conclusion {
  grid-template-columns: 90px minmax(0, 1fr); margin-bottom: 20px;
  font-size: 16px; line-height: 1.75;
}
.stage-card .stage-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stage-card .stage-field {
  display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 13px 14px;
  background: var(--console-bg2); border: 1px solid var(--console-line);
}
.stage-card .stage-field-label { font-size: 14px; letter-spacing: .06em; }
.stage-card .stage-field-value { margin: 0; color: var(--console-text); font-size: 15px; }
.stage-card .stage-next { margin-top: 20px; }

#left .current-plan { border-top-color: var(--ok); }
.plan-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pplanstatus {
  display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px;
  color: var(--ok); background: var(--ok-soft); border: 1px solid var(--ok);
  font-family: var(--font); font-size: 14px; font-weight: 700; letter-spacing: .08em;
}
.plan-revision { color: var(--console-dim); font-size: 14px; font-variant-numeric: tabular-nums; }
.plan-summary {
  max-width: 780px; margin: 24px 0 22px; color: var(--console-text);
  font-size: 20px; line-height: 1.65; letter-spacing: .01em;
}
.plan-stage-note {
  margin: 0 0 18px; padding-left: 12px; color: var(--console-muted);
  border-left: 2px solid var(--block-cyan); font-size: 14px; line-height: 1.65;
}
.plan-details { margin-top: 24px; border-top: 1px solid var(--console-line); }
.plan-details-summary {
  width: max-content; padding: 13px 0; color: var(--console-muted);
  font-size: 14px; cursor: pointer;
}
.plan-details-summary::after { content: " +"; color: var(--ok); font-family: var(--font); }
.plan-details[open] .plan-details-summary::after { content: " −"; }
#left .plan-details .pbody { padding: 4px 0 0; background: transparent; }

#left .confirm-action-card { border-top-color: var(--gate-confirm); }
.confirm-action-layout {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  min-height: 150px; gap: 18px;
}
.confirm-review-copy { max-width: 620px; margin: 0; font-size: 17px; line-height: 1.75; }
.confirm-review-link {
  padding: 5px 0; color: var(--gate-confirm); background: transparent;
  border: 0; border-bottom: 1px solid currentColor; font-size: 14px; cursor: pointer;
}
.confirm-review-link:hover { color: var(--console-text); }
#left .confirm-action-card > .gatewait { margin: 0 26px; padding: 12px 0; background: transparent; }

.execution-card { border-top-color: var(--block-cyan); }
.execution-hero {
  display: flex; align-items: center; gap: 18px; min-height: 110px; padding: 20px;
  background: var(--console-bg2); border: 1px solid var(--console-line);
}
.execution-pulse {
  position: relative; width: 18px; height: 18px; flex: none;
  background: var(--block-cyan); box-shadow: 0 0 0 8px var(--question-soft);
}
.execution-card.running .execution-pulse {
  animation: executionPulse 1.8s ease-in-out infinite;
}
/* ui-opt: the run has ended -- the hero mark reads as done, no breathing */
.execution-card.settled .execution-pulse {
  background: var(--ok); box-shadow: none; animation: none;
}
@keyframes executionPulse { 50% { opacity: .4; transform: scale(.75); } }
.execution-copy { min-width: 0; }
.execution-kicker { display: block; margin-bottom: 8px; color: var(--block-cyan); font-family: var(--font); font-size: 11px; letter-spacing: .12em; }
.execution-title { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.55; overflow-wrap: anywhere; }
.execution-empty { color: var(--console-dim); font-size: 14px; }
.execution-steps { margin: 22px 0 0; padding: 0; list-style: none; }
.execution-steps li {
  display: grid; grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center; gap: 12px; min-height: 50px;
  border-bottom: 1px solid var(--console-line); font-size: 14px;
}
.execution-step-mark { width: 7px; height: 7px; background: var(--console-dim); }
.execution-steps li.done .execution-step-mark { background: var(--ok); }
.execution-steps li.active .execution-step-mark { background: var(--block-cyan); }
.execution-step-time { color: var(--console-dim); font-family: var(--font); font-size: 13px; font-variant-numeric: tabular-nums; }
/* S-472: heal-retry attempt boundary inside the execute step list */
.execution-steps li.execution-attempt {
  grid-template-columns: minmax(0, 1fr); min-height: 34px; font-size: 12px;
  letter-spacing: 0.04em; color: var(--console-dim);
}

@media (max-width: 700px) {
  .stage-card .stage-fields { grid-template-columns: 1fr; }
  .plan-summary { font-size: 18px; }
  #left .confirm-action-card > .gatewait { margin: 0 20px; }
}
@media (max-width: 480px) {
  .stage-card-meta { grid-template-columns: minmax(0, 1fr) auto; }
  .stage-card-meta .stage-card-time { display: none; }
  .execution-hero { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .execution-pulse { animation: none; }
  .task-step-button { transition: none; }
}

/* Focused worksheets: one title, one conclusion, decision-relevant details. */
:root {
  --worksheet-surface: var(--console-block);
  --worksheet-subtle: rgba(166, 255, 112, .035);
  --worksheet-hover: rgba(166, 255, 112, .075);
  --worksheet-border: var(--console-line);
  --worksheet-radius: 12px;
  --worksheet-shadow: 0 12px 30px rgba(0, 0, 0, .14);
  --worksheet-font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}
html[data-theme="light"] {
  --worksheet-subtle: rgba(52, 122, 60, .035);
  --worksheet-hover: rgba(52, 122, 60, .07);
  --worksheet-shadow: 0 12px 28px rgba(39, 75, 44, .09);
}
@keyframes worksheetIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
.stage-card.retrying { border-color: var(--warn); }
.stage-card .stage-card-body { padding: 0; }
.stage-card .stage-conclusion {
  display: block; max-width: 840px; margin: 0 0 22px;
  color: var(--console-text); font-size: 18px; font-weight: 500;
  line-height: 1.7; letter-spacing: .005em;
}
.stage-conclusion-text { overflow-wrap: anywhere; }
.stage-card .stage-fields {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; margin: 0;
}
.stage-card .stage-field {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  padding: 13px 15px; background: var(--worksheet-subtle);
  border: 1px solid var(--worksheet-border); border-radius: 8px;
}
.stage-card .stage-field-label {
  color: var(--console-dim); font-size: 12px; font-weight: 600;
  line-height: 18px; letter-spacing: .06em;
}
.stage-card .stage-field-value {
  margin: 0; color: var(--console-text); font-size: 14px;
  font-weight: 500; line-height: 1.65; overflow-wrap: anywhere;
}

#left .current-plan,
#left .confirm-action-card,
.execution-card { border-top: 1px solid var(--worksheet-border); }
.plan-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-bottom: 16px; border-bottom: 1px solid var(--worksheet-border);
}
.pplanstatus {
  min-height: 0; padding: 0; color: var(--block-cyan);
  background: transparent; border: 0; border-radius: 0;
  font-family: var(--worksheet-font); font-size: 12px; font-weight: 650;
  line-height: 20px; letter-spacing: .04em;
}
.plan-meta[data-status="final"] .pplanstatus { color: var(--ok); }
.plan-meta[data-status="repair"] .pplanstatus { color: var(--warn); }
.plan-revision {
  color: var(--console-dim); font-family: var(--font); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.plan-summary {
  max-width: 840px; margin: 20px 0 22px; color: var(--console-text);
  font-family: var(--worksheet-font); font-size: 18px; font-weight: 500;
  line-height: 1.7; letter-spacing: .005em;
}
.plan-stage-note {
  margin: -8px 0 20px; padding: 0; color: var(--console-muted);
  border: 0; font-size: 13px; line-height: 1.65;
}
.plan-details { margin-top: 22px; border-top: 1px solid var(--worksheet-border); }
.plan-details-summary {
  width: max-content; padding: 14px 0 10px; color: var(--console-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.plan-details-summary::after { color: var(--console-accent); }
#left .plan-details .pbody { padding: 8px 0 0; background: transparent; }
#left .plan-details .pbody .md { font-family: var(--worksheet-font); font-size: 14px; }

.confirm-action-layout { min-height: 0; gap: 15px; }
.confirm-review-copy {
  max-width: 720px; margin: 0; color: var(--console-text);
  font-size: 17px; font-weight: 500; line-height: 1.75;
}
.confirm-review-link {
  display: inline-flex; align-items: center; gap: 9px; min-height: 34px;
  padding: 3px 0; color: var(--console-accent); background: transparent;
  border: 0; border-radius: 0; font-size: 13px; font-weight: 600; cursor: pointer;
}
.confirm-review-link::after { content: "→"; font-family: var(--font); }
.confirm-review-link:hover { color: var(--console-text); }
#left .confirm-action-card > .gatewait {
  margin: 0 24px 16px; padding: 11px 13px; color: var(--console-muted);
  background: var(--warn-soft); border: 1px solid var(--worksheet-border);
  border-radius: 8px; font-size: 13px;
}

.execution-hero {
  display: flex; align-items: center; gap: 17px; min-height: 0;
  padding: 2px 0 20px; background: transparent;
  border: 0; border-bottom: 1px solid var(--worksheet-border);
}
.execution-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--block-cyan); box-shadow: 0 0 0 7px var(--question-soft);
}
.execution-kicker { display: none; }
.execution-title {
  margin: 0; color: var(--console-text); font-size: 17px;
  font-weight: 500; line-height: 1.65;
}
.execution-empty { margin: 18px 0 0; color: var(--console-dim); font-size: 14px; }
.execution-steps { margin: 10px 0 0; padding: 0; list-style: none; }
.execution-steps li {
  grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px;
  min-height: 46px; border-bottom: 1px solid var(--worksheet-border); font-size: 14px;
}
.execution-steps li:last-child { border-bottom: 0; }
.execution-step-mark { width: 7px; height: 7px; border-radius: 50%; }
.execution-step-time { font-size: 12px; }
#stream > .pcard { border-radius: 10px; overflow: hidden; }

@media (max-width: 700px) {
  .stage-card .stage-fields { grid-template-columns: 1fr; }
  .stage-card .stage-conclusion, .plan-summary { font-size: 17px; }
  #left .confirm-action-card > .gatewait { margin: 0 16px 14px; }
}
@media (max-width: 480px) {
  .stage-card .stage-conclusion { margin-bottom: 17px; }
}

/* ---------------------------------------------------------------------
   Harness thread (desktop agent transcript, Codex-style).
   The middle column is one centred, chronological conversation: quiet
   agent activity rows, peer stage milestones and their working details.
   The request lives only in the left rail's Goal field.
   --------------------------------------------------------------------- */
:root {
  --thread-measure: 780px;
  --thread-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}
#left #stream,
#left #stream *:not(pre):not(code):not(kbd):not(samp) { font-family: var(--thread-font); }
#left #stream pre, #left #stream code { font-family: var(--mono); }
#left #stream { padding: 18px 18px 28px; scroll-padding-top: 12px; }
#left #stream > * {
  box-sizing: border-box; width: auto; max-width: var(--thread-measure);
  margin-left: auto; margin-right: auto;
}

/* Agent activity: one quiet line per turn, details on demand. */
#left #stream details.foldline {
  margin-top: 2px; margin-bottom: 2px; padding: 0;
  background: transparent; border: 0; box-shadow: none;
}
#left #stream details.foldline > summary {
  display: flex; align-items: center; gap: 8px; min-height: 30px;
  padding: 4px 8px; margin: 0 -8px; border-radius: 8px;
  font-family: var(--worksheet-font); font-size: 13.5px;
  color: var(--console-muted);
}
#left #stream details.foldline > summary { border: 0; background: transparent; }
#left #stream details.foldline > summary::after { content: none; }
#left #stream details.foldline > summary .fwho {
  margin-right: 2px; color: var(--console-text); font-size: 13.5px;
  font-weight: 600; text-transform: none !important; letter-spacing: 0 !important;
}
#left #stream details.foldline > summary .fact {
  min-width: 0; overflow: hidden; color: var(--console-muted); font-size: 13.5px;
  font-weight: 400; text-overflow: ellipsis; white-space: nowrap;
  text-transform: none !important; letter-spacing: 0 !important;
}
#left #stream details.foldline > summary .ftime {
  margin-left: auto; color: var(--console-dim); font-size: 12px;
}
#left #stream details.foldline > summary:hover { background: var(--worksheet-hover); }
#left #stream details.foldline > summary::before {
  content: "›"; display: inline-block; width: 12px; height: auto;
  flex: none; margin: 0; color: var(--console-dim); background: none;
  border: 0; box-shadow: none; font-size: 16px; line-height: 1;
  transform: none; opacity: 1; transition: transform .15s ease;
}
#left #stream details.foldline[open] > summary::before { transform: rotate(90deg); }
#left #stream details.foldline > .foldbody {
  margin: 4px 0 10px 5px; padding: 4px 0 4px 16px;
  border-left: 1px solid var(--console-line); background: transparent;
}

/* Stage milestones: a checked step with its conclusion. */
#left #stream .stage-milestone {
  margin-top: 16px; margin-bottom: 16px; padding: 0; min-height: 0;
  background: transparent; border: 0; box-shadow: none;
}
.stage-milestone-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--worksheet-font); font-size: 13px;
}
.stage-milestone-mark {
  position: relative; flex: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--ok);
}
.stage-milestone-mark::after {
  content: ""; position: absolute; left: 5px; top: 2.5px; width: 4px;
  height: 8px; border: solid var(--console-bg); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.stage-milestone.retrying .stage-milestone-mark { background: var(--warn); }
.stage-milestone-title { color: var(--console-text); font-weight: 600; }
.stage-milestone-state { color: var(--console-dim); }
#left #stream .stage-milestone .stage-card-body { margin: 6px 0 0 30px; padding: 0; }
#left #stream .stage-milestone .stage-conclusion {
  display: block; margin: 0; padding: 0; border: 0;
  color: var(--console-text); font-family: var(--worksheet-font);
  font-size: 15px; font-weight: 400; line-height: 1.65;
}
#left #stream .stage-milestone .stage-fields {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0;
  border: 0;
}
#left #stream .stage-milestone .stage-field {
  display: inline-flex; align-items: baseline; gap: 6px; min-width: 0;
  max-width: 100%; margin: 0; padding: 3px 10px; border: 1px solid var(--console-line);
  border-radius: 999px; background: var(--worksheet-hover);
}
#left #stream .stage-milestone .stage-field-label {
  margin: 0; color: var(--console-dim); font-size: 12px; letter-spacing: 0;
  text-transform: none;
}
#left #stream .stage-milestone .stage-field-value {
  margin: 0; color: var(--console-text); font-size: 12.5px; line-height: 1.5;
}

/* Tool blocks: current plan, approval, execution. */
#left #stream .flow-block {
  margin-top: 14px; margin-bottom: 14px; padding: 0; min-height: 0;
  overflow: hidden; color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-line); border-radius: 12px; box-shadow: none;
}
#left #stream .flow-block::before,
#left #stream .flow-block::after { content: none; }
.flow-block-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--worksheet-hover); border-bottom: 1px solid var(--console-line);
  font-family: var(--worksheet-font); font-size: 13px;
}
.flow-block-icon {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--console-accent);
}
.flow-build .flow-block-icon { background: var(--ok); }
.flow-confirm .flow-block-icon { background: var(--gate-confirm); }
.flow-execute .flow-block-icon { background: var(--block-cyan); }
.flow-block-title { flex: 1; min-width: 0; font-weight: 600; }
.flow-block-state { color: var(--console-dim); font-size: 12px; }
.flow-block-state.active { color: var(--block-cyan); }
.flow-block-state.waiting { color: var(--warn); }
.flow-block-state.done { color: var(--ok); }
.flow-block-state.failed { color: var(--err); }
.flow-block-content {
  padding: 14px 16px 16px; font-family: var(--worksheet-font);
  font-size: 14px; line-height: 1.6;
}
#left #stream .flow-block .plan-meta { margin: 0 0 6px; font-size: 12px; }
#left #stream .flow-block .plan-summary {
  margin: 0; font-size: 15px; font-weight: 500; line-height: 1.6;
}
#left #stream .flow-block .plan-stage-note {
  margin-top: 10px; color: var(--console-muted); font-size: 13.5px;
}
#left #stream .flow-block .plan-details { margin-top: 14px; }
#left #stream .flow-block .plan-details-summary {
  min-height: 0; padding: 8px 0 0; font-size: 13px;
}
#left #stream .flow-block .confirm-action-layout { gap: 10px; }
#left #stream .flow-block > .gatewait {
  margin: 0; padding: 0 16px 10px; color: var(--console-muted); font-size: 13px;
}
#left #stream .flow-block .gatebtns,
#left #stream .flow-block .gateanswer { padding: 0 16px 14px; }
#left #stream .flow-block .gatebtns {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
#left #stream .flow-block .gatebtns .gbtn { border-radius: 8px; }
#left #stream .flow-block .execution-hero { gap: 10px; min-height: 0; }
#left #stream .flow-block .execution-title { font-size: 15px; }

/* Final answer reads as the agent's closing message, not a card. */
#left #stream .pcard.face-summary {
  padding: 4px 0 0; background: transparent; border: 0; box-shadow: none;
}


/* Middle-column refinement: a quiet, readable agent thread with one shared
   anatomy for narrative, milestones, tools and decisions. */
:root {
  --thread-measure: 800px;
  --thread-surface: #111712;
  --thread-raised: #161d17;
  --thread-hover: rgba(177, 204, 185, .055);
  --thread-user: rgba(143, 199, 167, .09);
  --thread-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  --thread-ease: cubic-bezier(.2, .7, .2, 1);
}
html[data-theme="light"] {
  --thread-surface: #ffffff;
  --thread-raised: #f5f8f5;
  --thread-hover: rgba(35, 65, 45, .045);
  --thread-user: rgba(31, 109, 75, .065);
  --thread-shadow: 0 2px 10px rgba(35, 65, 45, .055);
}
#left #stream {
  padding: 22px clamp(14px, 2.2vw, 32px) 36px;
  scroll-padding-top: 16px;
  scrollbar-gutter: stable;
}
#left #stream > * { max-width: var(--thread-measure); }
#left #stream .md { font-size: 14px; line-height: 1.75; }
#left #stream .md .md-p { margin-bottom: 10px; text-align: left; }
#left #stream .md .md-p:last-child { margin-bottom: 0; }
#left #stream .md .md-h { margin: 18px 0 8px; padding: 0; border: 0; }
#left #stream .md .md-ul,
#left #stream .md .md-ol { margin: 8px 0 12px 22px; }
#left #stream .md li { padding: 2px 0 2px 4px; font-size: 14px; line-height: 1.7; }
#left #stream .md li + li { border: 0; }
#left #stream .md code { border-radius: 5px; }

/* Agent turns recede to one scan line; expanded prose keeps a fine guide. */
#left #stream details.foldline { margin: 3px 0; }
#left #stream details.foldline > summary {
  min-height: 34px; padding: 5px 8px; border-radius: 7px;
  transition: background-color .16s ease, color .16s ease;
}
#left #stream details.foldline > summary .fwho,
#left #stream details.foldline > summary .fact { font-size: 13px; line-height: 20px; }
#left #stream details.foldline > summary .ftime { font-size: 11px; }
#left #stream details.foldline > summary:focus-visible {
  outline: 1px solid var(--console-accent); outline-offset: 1px;
}
#left #stream details.foldline > summary::before { width: 10px; font-size: 15px; }
#left #stream details.foldline > .foldbody {
  margin: 3px 0 12px 5px; padding: 5px 12px 6px 17px;
  color: var(--console-muted); border-left-color: var(--console-line);
}
#left #stream details.foldline > .foldbody .md { color: var(--console-muted); }
#left #stream details.foldline.flat > summary::before { opacity: .35; }

/* Accepted outcomes are compact receipts, not another card stack. */
#left #stream .stage-milestone { margin: 20px 0; }
#left #stream .stage-milestone-head { gap: 9px; min-height: 22px; }
#left #stream .stage-milestone-mark { width: 17px; height: 17px; }
#left #stream .stage-milestone-mark::after { left: 5.5px; top: 3px; }
#left #stream .stage-milestone-title { font-size: 13.5px; }
#left #stream .stage-milestone-state { margin-left: 2px; font-size: 12px; }
#left #stream .stage-milestone .stage-card-body { margin: 7px 0 0 26px; }
#left #stream .stage-milestone .stage-conclusion { font-size: 14.5px; line-height: 1.75; }
#left #stream .stage-milestone .stage-fields { gap: 7px; margin-top: 11px; }
#left #stream .stage-milestone .stage-field {
  gap: 7px; padding: 4px 16px; background: var(--thread-hover);
  border-radius: 6px;
}
#left #stream .stage-milestone .stage-field-label { font-size: 11.5px; }
#left #stream .stage-milestone .stage-field-value { font-size: 12px; }

/* Plan, approval and execution share a single restrained tool surface. */
#left #stream .flow-block {
  margin: 18px 0; background: var(--thread-surface);
  border-color: var(--console-line); border-radius: 12px;
  box-shadow: var(--thread-shadow);
}
#left #stream .flow-block-head {
  min-height: 42px; padding: 10px 15px; background: var(--thread-hover);
  font-size: 13px;
}
#left #stream .flow-block-icon {
  width: 7px; height: 7px; box-shadow: 0 0 0 3px var(--thread-hover);
}
#left #stream .flow-block-state { font-size: 11.5px; }
#left #stream .flow-block-content { padding: 16px 18px 17px; }
#left #stream .flow-block .plan-meta { padding-bottom: 10px; border: 0; }
#left #stream .flow-block .pplanstatus { font-size: 11.5px; letter-spacing: .06em; }
#left #stream .flow-block .plan-revision { font-size: 11.5px; }
#left #stream .flow-block .plan-summary { font-size: 15px; line-height: 1.75; }
#left #stream .flow-block .plan-stage-note { line-height: 1.7; }
#left #stream .flow-block .plan-details { margin-top: 14px; }
#left #stream .flow-block .plan-details-summary { padding-top: 10px; font-size: 12.5px; }
#left #stream .flow-block .plan-details .pbody .md { font-size: 13.5px; }
#left #stream .flow-block .confirm-review-copy { font-size: 14.5px; line-height: 1.75; }
#left #stream .flow-block .confirm-review-link { min-height: 30px; font-size: 12.5px; }
#left #stream .flow-block .execution-hero { padding-bottom: 15px; }
#left #stream .flow-block .execution-title { font-size: 14.5px; }
#left #stream .flow-block .execution-steps li { min-height: 42px; font-size: 13px; }
#left #stream .flow-block .execution-empty { margin-top: 14px; font-size: 13px; }

/* Question, gap, warning and error panels join the same tool anatomy. */
#left #stream .pcard:not(.flow-block):not(.face-summary) {
  --face: var(--console-accent);
  position: relative; margin: 18px auto; padding: 0;
  color: var(--console-text); background: var(--thread-surface);
  border: 1px solid var(--console-line); border-radius: 12px;
  box-shadow: var(--thread-shadow); overflow: hidden;
}
#left #stream .pcard.face-question:not(.flow-block) { --face: var(--gate-question); }
#left #stream .pcard.face-confirm:not(.flow-block) { --face: var(--gate-confirm); }
#left #stream .pcard.face-gap:not(.flow-block) { --face: var(--gate-gap); }
#left #stream .pcard.face-warning:not(.flow-block) { --face: var(--advisory); }
#left #stream .pcard.face-error:not(.flow-block) { --face: var(--err); }
#left #stream .pcard:not(.flow-block):not(.face-summary) .phead {
  position: static; display: flex; align-items: center; min-height: 42px;
  padding: 10px 15px; color: var(--face); background: var(--thread-hover);
  border-bottom: 1px solid var(--console-line);
}
#left #stream .pcard:not(.flow-block):not(.face-summary) .pface {
  display: inline-flex; padding: 0; color: var(--face); background: transparent;
  font-size: 12px; font-weight: 650; letter-spacing: .04em;
}
#left #stream .pcard:not(.flow-block):not(.face-summary) .ptime {
  margin-left: auto; color: var(--console-dim); font-size: 11px;
}
#left #stream .pcard:not(.flow-block):not(.face-summary) .pbody { padding: 16px 18px; }
#left #stream .pcard:not(.flow-block):not(.face-summary) .pbody .md > :first-child {
  max-width: none; padding: 0;
}
#left #stream .pcard:not(.flow-block) .ptool { display: none; }
#left #stream .pcard:not(.flow-block) .phints {
  margin: 0; padding: 0 18px 14px; border: 0; font-size: 12.5px;
}

/* Decisions use explicit, comfortable actions rather than terminal rows. */
#left #stream .pcard .gatebtns {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 9px; margin: 0; padding: 14px 18px 17px;
  background: var(--thread-raised); border-top: 1px solid var(--console-line);
}
#left #stream .pcard .gatebtns .gbtn,
#left #stream .pcard .gatebtns .gbtn.primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; min-height: 40px; padding: 9px 13px;
  color: var(--console-text); background: var(--thread-surface);
  border: 1px solid var(--console-strong); border-radius: 8px;
  box-shadow: none; font-size: 12.5px; font-weight: 550; line-height: 1.5;
  text-align: center; transform: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
#left #stream .pcard .gatebtns .gbtn::before,
#left #stream .pcard .gatebtns .gbtn::after { content: none; }
#left #stream .pcard .gatebtns .gbtn.primary {
  color: var(--console-bg); background: var(--face); border-color: var(--face);
  font-weight: 650;
}
#left #stream .pcard .gatebtns .gbtn:hover:not(:disabled) {
  color: var(--face); background: var(--thread-hover); border-color: var(--face);
  box-shadow: none; transform: none;
}
#left #stream .pcard .gatebtns .gbtn.primary:hover:not(:disabled) {
  color: var(--console-bg); background: var(--face); filter: brightness(1.08);
}
#left #stream .pcard .gatebtns .gbtn:active:not(:disabled) { transform: translateY(1px); }
#left #stream .pcard .gateanswer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  margin: 0; padding: 14px 18px 17px; background: var(--thread-raised);
  border-top: 1px solid var(--console-line);
}
#left #stream .pcard .gatebtns + .gateanswer { padding-top: 0; border-top: 0; }
#left #stream .pcard .gateanswer textarea {
  min-height: 72px; padding: 10px 12px; color: var(--console-text);
  background: var(--thread-surface); border: 1px solid var(--console-strong);
  border-radius: 8px; font-size: 13px; line-height: 1.65;
}
#left #stream .pcard .gateanswer .gatesend {
  align-self: stretch; min-width: 82px; min-height: 40px; padding: 9px 13px;
  color: var(--console-bg); background: var(--face); border: 1px solid var(--face);
  border-radius: 8px; font-size: 12.5px; font-weight: 650;
}
#left #stream .pcard .gateanswer .gatesend::before { content: none; }
#left #stream .pcard > .gatewait {
  margin: 0; padding: 0 18px 14px; color: var(--console-muted);
  background: transparent; border: 0; font-size: 12.5px;
}
#left #stream .pcard .autobadge {
  margin: 0; padding: 10px 18px; color: var(--console-dim);
  background: var(--thread-raised); border: 0; border-top: 1px solid var(--console-line);
  font-size: 11.5px;
}

/* The closing response returns to prose; terminal and feedback stay compact. */
#left #stream .pcard.face-summary { margin: 24px auto; padding: 0; }
#left #stream .pcard.face-summary .pbody { padding: 0 0 0 2px; }
#left #stream .pcard.face-summary .pbody .md { font-size: 15px; line-height: 1.8; }
#left #stream .pcard.face-summary .pbody .md > :first-child { max-width: none; padding: 0; }
#left #stream .pcard.face-summary .ptool { display: none; }
#left #stream .endbar {
  width: calc(100% - 27px); max-width: none; margin: 22px 0 8px 27px;
  padding: 11px 14px; border: 1px solid var(--console-line) !important;
  border-radius: 9px; background: var(--thread-hover) !important;
  font-size: 13px; font-weight: 550;
}
#left #stream .fbbar {
  display: flex; flex-wrap: wrap; gap: 9px; margin: 14px auto 0;
  padding: 14px 0; border: 0; border-top: 1px solid var(--console-line);
  background: transparent;
}
#left #stream .fbbar .fbq { font-size: 13px; }
#left #stream .fbbar .fbin { min-height: 36px; font-size: 13px; }
#left #stream .fbbar .gbtn,
#left #stream .fbbar .gbtn.primary {
  min-height: 34px; padding: 6px 10px; border: 1px solid var(--console-line);
  border-radius: 7px; background: var(--thread-surface); font-size: 12px;
}

@media (max-width: 700px) {
  #left #stream { padding: 16px 14px 28px; }
  #left #stream .flow-block-content { padding: 14px; }
  #left #stream .pcard:not(.flow-block):not(.face-summary) .pbody { padding: 14px; }
  #left #stream .pcard .gatebtns,
  #left #stream .pcard .gateanswer { grid-template-columns: 1fr; padding: 12px 14px 14px; }
  #left #stream .pcard .gateanswer .gatesend { min-height: 40px; }
  #left #stream .pcard.face-summary .pbody .md { font-size: 14.5px; }
  #left #stream .fbbar .fbq { flex-basis: 100%; }
}
@media (max-width: 420px) {
  #left #stream { padding-right: 11px; padding-left: 11px; }
  #left #stream details.foldline > summary .ftime { display: none; }
  #left #stream .stage-milestone .stage-card-body { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #left #stream details.foldline > summary,
  #left #stream .pcard .gatebtns .gbtn { transition: none; }
}

/* Six peer stages share one receipt row; only feedback breaks the measure. */
#left #stream > * {
  width: 100%; max-width: var(--thread-measure);
  margin-left: auto; margin-right: auto;
}
#left #stream .md .md-p,
#left #stream .stage-conclusion,
#left #stream .confirm-review-copy {
  text-align: justify; text-justify: inter-ideograph;
}
#left #stream .stage-milestone,
#left #stream .flow-block,
#left #stream .pcard.face-summary.stage-milestone {
  margin-top: 20px; margin-bottom: 20px; padding: 0;
  color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; box-shadow: none; overflow: visible;
}
#left #stream .stage-milestone-head,
#left #stream .flow-block-head,
#left #stream details.foldline > summary {
  display: flex; align-items: center; gap: 9px; min-height: 24px;
  margin: 0; padding: 0; color: var(--console-text); background: transparent;
  border: 0; border-radius: 0; font-family: var(--worksheet-font);
  font-size: 13.5px; line-height: 1.5;
}
#left #stream .stage-milestone-mark,
#left #stream .flow-block-icon {
  position: relative; flex: none; width: 18px; height: 18px; margin: 0;
  color: var(--console-bg); background: var(--ok); border: 0; border-radius: 50%;
  box-shadow: none; font-family: var(--worksheet-font);
}
#left #stream .stage-milestone-mark::after,
#left #stream .flow-block-icon::after {
  content: "✓"; position: static; display: block; width: auto; height: auto;
  color: inherit; border: 0; font-size: 13px; font-weight: 700;
  line-height: 18px; text-align: center; transform: none;
}
#left #stream [data-state]:not([data-state="done"]):not([data-state="failed"])
  .stage-milestone-mark {
  color: var(--console-dim); background: transparent; border-radius: 0;
}
#left #stream [data-state]:not([data-state="done"]):not([data-state="failed"])
  .stage-milestone-mark::after {
  content: "•"; font-size: 22px; font-weight: 400; line-height: 16px;
}
#left #stream [data-state="failed"] .stage-milestone-mark { background: var(--err); }
#left #stream [data-state="failed"] .stage-milestone-mark::after {
  content: "×"; font-size: 16px; font-weight: 500;
}
#left #stream details.foldline { margin: 10px 0; }
#left #stream details.foldline > summary::before,
#left #stream details.foldline[open] > summary::before,
#left #stream details.foldline.flat > summary::before {
  content: "•"; flex: none; width: 18px; height: 18px; margin: 0;
  color: var(--console-dim); background: transparent; border: 0;
  border-radius: 0; box-shadow: none; font-size: 22px; font-weight: 400;
  line-height: 16px; text-align: center; transform: none; opacity: 1;
}
#left #stream details.foldline > summary .fwho,
#left #stream details.foldline > summary .fact {
  font-size: 13.5px !important; line-height: 1.5;
}
#left #stream details.foldline > summary .fwho {
  margin-right: 0; color: var(--console-text); font-weight: 600;
}
#left #stream details.foldline > summary .fact {
  color: var(--console-muted); font-weight: 400;
}
#left #stream details.foldline > .foldbody {
  margin: 7px 0 12px 27px; padding: 0; border-left: 0;
}
#left #stream .stage-milestone-title,
#left #stream .stage-milestone-state {
  font-size: 13.5px; line-height: 1.5;
}
#left #stream .stage-milestone-title { color: var(--console-text); font-weight: 600; }
#left #stream .stage-milestone-state {
  margin-left: auto; color: var(--console-dim); font-weight: 400;
}
#left #stream .stage-milestone .stage-card-body,
#left #stream .flow-block-content,
#left #stream .pcard.face-summary .pbody {
  margin: 7px 0 0 27px; padding: 0; background: transparent; border: 0;
}
#left #stream .flow-block > .gatebtns,
#left #stream .flow-block > .gateanswer,
#left #stream .flow-block > .gatewait,
#left #stream .flow-block > .phints,
#left #stream .flow-block > .autobadge { margin-left: 27px; }
#left #stream .pcard .pface,
#left #stream .pcard .ptool {
  padding: 0; color: var(--face); background: transparent;
  border: 0; box-shadow: none;
}
#left #stream .pcard.face-summary.stage-milestone {
  margin-left: 0; margin-right: auto;
}
#left #stream .pcard:not(.flow-block):not(.face-summary) {
  position: relative; width: calc(100% - 27px);
  max-width: calc(var(--thread-measure) - 27px);
  margin: 18px 0 18px 27px; overflow: visible;
}
#left #stream .errline,
#left #stream .render-fallback {
  width: calc(100% - 27px); max-width: calc(var(--thread-measure) - 27px);
  margin: 0 0 18px 27px;
}
#left #stream .endbar { max-width: calc(var(--thread-measure) - 27px); }
#left #stream .pcard:not(.flow-block):not(.face-summary) .phead { display: none; }
#left #stream > .fbbar {
  width: 100%; max-width: calc(var(--thread-measure) + 96px);
  margin: 22px auto 0; padding: 18px 0;
  border-top: 2px solid var(--console-accent);
}
#left #stream .fbbar .fbq {
  color: var(--console-text); font-size: 18px; font-weight: 700;
  line-height: 1.6; letter-spacing: .01em;
}
#left #stream .fbbar .fbin,
#left #stream .fbbar .gbtn,
#left #stream .fbbar .gbtn.primary { font-size: 15px; }
@media (max-width: 420px) {
  #left #stream .stage-milestone .stage-card-body,
  #left #stream .flow-block-content,
  #left #stream .pcard.face-summary .pbody { margin-left: 0; }
  #left #stream .flow-block > .gatebtns,
  #left #stream .flow-block > .gateanswer,
  #left #stream .flow-block > .gatewait,
  #left #stream .flow-block > .phints,
  #left #stream .flow-block > .autobadge { margin-left: 0; }
}

#left #stream,
#left #stream * { font-size: 14px !important; }
#left #stream .fbbar .fbq { font-size: 18px !important; }
#left #stream .fbbar .fbin,
#left #stream .fbbar .gbtn,
#left #stream .fbbar .gbtn.primary { font-size: 15px !important; }

#left #stream .stage-milestone .stage-field { display: block; }
#left #stream .stage-milestone .stage-field-label {
  display: inline; color: var(--console-text); font-weight: 700;
}
#left #stream .stage-milestone .stage-field-value {
  display: inline; margin: 0; font-weight: 400; white-space: normal;
}

#left #stream .pcard.face-error .pbody .md .md-p {
  margin: 0; padding: 0; text-align: left; text-justify: auto;
  white-space: normal; word-break: normal; overflow-wrap: anywhere;
  letter-spacing: normal; line-height: 1.7;
}
#left #stream .pcard.face-error .pbody .md .md-p:first-child {
  margin-bottom: 12px; font-weight: 600;
}
#left #stream .pcard.face-error .pbody .md .md-p.md-ind1 {
  padding-top: 12px; border-top: 1px solid var(--console-line);
}

#rail-progress .session-stats { display: grid; }
#rail-progress .session-stat {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--console-line);
}
#rail-progress .session-stat:last-child { border-bottom: 0; }
#rail-progress .session-stat-label { color: var(--console-dim); }
#rail-progress .session-stat-value {
  color: var(--console-text); font-variant-numeric: tabular-nums;
  text-align: right;
}

/* the box left edge sits on the 27px text column; its own padding keeps
   the inner text inset (owner order 2026-12-01) */
#left #stream .flow-block .plan-summary {
  max-width: none; margin: 0; padding: 14px 16px;
  color: var(--console-text); background: var(--thread-hover);
  border: 1px solid var(--console-line); border-radius: 10px;
  line-height: 1.75; text-align: left;
}
#left #stream .plan-summary-label { font-weight: 700; }
#left #stream .flow-block .plan-details-summary::after,
#left #stream .flow-block .plan-details[open] .plan-details-summary::after {
  content: none;
}
/* the details chevron hangs in the marker column -- the label stays on the
   27px text column instead of riding the native <summary> triangle */
#left #stream .flow-block .plan-details-summary {
  position: relative; list-style: none; padding-left: 0;
}
#left #stream .flow-block .plan-details-summary::-webkit-details-marker {
  display: none;
}
#left #stream .flow-block .plan-details-summary::before {
  content: "▸"; position: absolute; left: -16px; top: 50%;
  transform: translateY(-50%);
  color: var(--console-dim); font-size: 11px; line-height: 1;
}
#left #stream .flow-block .plan-details[open] .plan-details-summary::before {
  content: "▾";
}

#task-artifacts {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 20px 16px;
  background: var(--console-block); border-top: 0;
}
#task-artifacts[hidden] { display: none !important; }
.artifact-btn {
  display: flex; flex: none; align-items: center; justify-content: flex-start;
  gap: 7px; width: 108px; height: 32px; min-height: 32px; padding: 5px 9px;
  box-sizing: border-box;
  color: var(--console-text); background: var(--console-bg2);
  border: 1px solid var(--console-strong); border-radius: 6px;
  font: inherit; cursor: pointer; transition: border-color .16s ease,
    background-color .16s ease;
}
.artifact-btn:hover:not(:disabled) {
  background: var(--acc-soft); border-color: var(--console-accent);
}
.artifact-btn:disabled { cursor: default; opacity: .55; }
.artifact-btn svg {
  width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round;
}
.artifact-btn svg text {
  fill: currentColor; stroke: none; font-family: inherit;
  font-size: 8px; font-weight: 700; text-anchor: middle;
}
@media (prefers-reduced-motion: reduce) {
  .artifact-btn { transition: none; }
}

#task-action.none { display: none; }

.task-heading { gap: 10px 12px; }
#task-status-title { grid-column: 1 / -1; grid-row: 1; }
.task-state { grid-column: 1; grid-row: 2; justify-self: start; }
.task-elapsed { grid-column: 2; grid-row: 2; justify-self: end; }
#task-steps { justify-content: space-evenly; }
#top { padding-bottom: 12px; }

/* ---- ui-opt 2026-11-29: web-face start guide ---------------------------- */
/* Shown once (jimsim_guide) when the signed-in console is empty and the
   Agent badge is pending. Shares the stream's card anatomy: console-block
   surface, console-strong border, brick offset shadow, brick accent mark. */
.guidecard {
  margin: 14px 14px 10px; padding: 14px 16px 15px;
  color: var(--console-text); background: var(--console-block);
  border: 1px solid var(--console-strong); border-radius: 0;
  box-shadow: 4px 4px 0 var(--block-shadow);
  animation: consoleReveal .34s cubic-bezier(.2,.7,.2,1) both;
}
.guidecard .guidehead { display: flex; align-items: center; gap: 10px; }
.guidecard .guidehead h3 {
  margin: 0 auto 0 0; font-size: 13px; font-weight: 800;
  letter-spacing: .04em; color: var(--console-accent);
}
.guidecard .guidehead button {
  flex: none; cursor: pointer; color: var(--console-dim);
  background: transparent; border: 1px solid var(--console-line);
  padding: 2px 9px; font-size: 11px;
}
.guidecard .guidehead button:hover { color: var(--console-text);
                                    border-color: var(--console-strong); }
.guidecard .guidestep {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 11px; font-size: 12.5px; line-height: 1.55;
  color: var(--console-text);
}
.guidecard .guidemark {
  flex: none; width: 26px; text-align: center; font-size: 10.5px;
  font-weight: 800; letter-spacing: .08em; color: var(--console-accent);
  background: var(--console-bg2); border: 1px solid var(--console-strong);
  padding: 1px 0 2px;
}
html[data-theme="light"] .guidecard .guidehead h3,
html[data-theme="light"] .guidecard .guidemark { color: var(--rail-title, #447330); }

/* ---- ui-opt 2026-11-29: narrow-window panel drawer (web face) ---------- */
/* Below 940px #right display:none's (S-163 era). On the web face it
   becomes an off-canvas drawer instead: same node, same IDs, app.js
   writes keep landing; the local face keeps the old hide untouched. */
.railtab, .railveil, .railclose { display: none; }
@media (max-width: 940px) {
  html.jimu-web .railtab {
    display: flex; align-items: center; position: fixed; z-index: 230;
    right: 0; top: 37%; padding: 11px 5px; writing-mode: vertical-rl;
    font-family: var(--font); font-size: 12px; letter-spacing: .14em;
    color: var(--console-text); background: var(--console-block);
    border: 1px solid var(--console-strong); border-right: 0;
    box-shadow: -3px 3px 0 var(--block-shadow); cursor: pointer;
  }
  html.jimu-web .railtab:hover {
    color: var(--console-accent); border-color: var(--console-accent);
  }
  html.jimu-web.rail-drawer-open .railveil {
    display: block; position: fixed; inset: 0; z-index: 240;
    background: rgba(0, 0, 0, .55);
  }
  html.jimu-web #right {
    display: flex; position: fixed; z-index: 250;
    top: 0; right: 0; bottom: 0; width: min(356px, 88vw); resize: none;
    transform: translateX(106%); visibility: hidden;
    transition: transform .22s cubic-bezier(.2,.75,.25,1), visibility .22s;
    border-left: 2px solid var(--console-accent);
    box-shadow: -6px 0 0 rgba(0, 0, 0, .35);
  }
  html.jimu-web.rail-drawer-open #right {
    transform: translateX(0); visibility: visible;
  }
  html.jimu-web.rail-drawer-open .railclose {
    display: block; position: fixed; z-index: 260;
    top: 10px; right: 10px;
    cursor: pointer; padding: 3px 10px; font-size: 11px;
    font-family: var(--font);
    color: var(--console-text); background: var(--console-block);
    border: 1px solid var(--console-strong);
    box-shadow: 2px 2px 0 var(--block-shadow);
  }
  html.jimu-web.rail-drawer-open .railclose:hover {
    color: var(--console-accent); border-color: var(--console-accent);
  }
}
@media (prefers-reduced-motion: reduce) {
  html.jimu-web #right { transition: none; }
}

/* ---- ui-opt: task-rail completion stamp + flow-jump flash --------------- */
/* One-shot stamp when a step newly completes (app.js adds .just-done on a
   real todo->done edge only; the panel re-renders constantly, so a pure
   CSS animation here would replay on every task event). */
#task-steps li.just-done .task-step-no {
  animation: stepStamp .5s cubic-bezier(.2,.8,.2,1);
}
#task-steps li.just-done .task-step-no::after {
  content: "\2713";
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--console-bg); background: var(--ok);
  font-family: var(--font); font-weight: 800; font-size: 15px;
  animation: checkSweep 1.15s ease .1s both;
}
@keyframes stepStamp {
  0% { transform: scale(1); }
  35% { transform: scale(1.22) rotate(-4deg); }
  70% { transform: scale(.94); }
  100% { transform: scale(1); }
}
@keyframes checkSweep {
  0% { opacity: 0; transform: scale(.4); }
  30% { opacity: 1; transform: scale(1.08); }
  60% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}
/* Target panel announces itself after a task-rail jump (_jumpToFlow). */
.flow-jump-flash { animation: flowJumpFlash .95s ease-out 1; }
@keyframes flowJumpFlash {
  0% { outline: 3px solid var(--console-accent); outline-offset: -3px; }
  100% { outline: 3px solid transparent; outline-offset: -3px; }
}
@media (prefers-reduced-motion: reduce) {
  #task-steps li.just-done .task-step-no { animation: none; }
  #task-steps li.just-done .task-step-no::after { content: none; }
  .flow-jump-flash { animation: none; }
}

/* ---- ui-opt: theme transition + step elapsed stamp ---------------------- */
/* One-shot color easing while the theme swaps: the class is added around
   the data-theme flip and removed ~240ms later, so no element carries a
   permanent global transition. */
html.theme-x, html.theme-x * {
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease;
}
@media (prefers-reduced-motion: reduce) {
  html.theme-x, html.theme-x * { transition: none; }
}

/* ---- ui-opt: agent badge semantic colors -------------------------------- */
/* paused (needs a decision: link or uninstall) joins the "cyan asks"
   family; updating/checking/repairing are in-flight, so they read as a
   muted accent green -- and the pre-console blue-gray remnant (line 687
   var(--tx2)) retires. */
#helperbtn.paused {
  color: var(--block-cyan); border-color: var(--block-cyan);
}
#helperbtn.updating {
  color: color-mix(in srgb, var(--console-accent) 70%, var(--console-bg));
  border-color: color-mix(in srgb, var(--console-accent) 45%, var(--console-bg));
}

/* ---- transcript rhythm: one marker column, no guide line -------------- */
/* Owner order 2026-12-01: the vertical progress spine retires. Every marker
   stays in flow as one 18px column, so the leading text of each hierarchy
   level (turn rows, stage receipts, bodies, plan cards) starts on one x. */
#left #stream details.foldline > summary { position: relative; }
/* a legacy turn chip is the marker for its row -- it replaces the square */
#left #stream details.foldline > summary:has(.fturn)::before { content: none; }
#left #stream details.foldline > summary::before { content: none; }

/* every fold marker is one small square in the marker column --
   plain, open, flat and opsline-only live folds share the geometry;
   flat reads muted, act-ask keeps its cyan ask tone. */
#left #stream details.foldline > summary::before,
#left #stream details.foldline[open] > summary::before,
#left #stream details.foldline.flat > summary::before,
#left #stream details.foldline.flat[open] > summary::before,
#left #stream details.foldline:has(.foldbody > .opsline:only-child):not(
  .act-read_more) > summary::before {
  content: ""; position: static; flex: none;
  width: 9px; height: 9px; margin: 0 4.5px;
  border-radius: 0; background: var(--console-accent);
  box-shadow: 2px 2px 0 var(--block-shadow);
  font-size: 0; line-height: 0; opacity: 1; transform: none;
}
#left #stream details.foldline.flat > summary::before,
#left #stream details.foldline.flat[open] > summary::before {
  background: var(--console-line); box-shadow: none;
}
#left #stream details.act-ask.foldline > summary::before {
  background: var(--block-cyan);
}
#left #stream details.foldline > summary .ftime::before {
  content: "›"; display: inline-block; margin-right: 7px;
  color: var(--console-dim); transition: transform .15s ease;
}
#left #stream details.foldline[open] > summary .ftime::before {
  transform: rotate(90deg);
}
/* legacy turn-number chip: absolute in the marker column, its number text
   kept clear of the 27px column */
#left summary .fturn {
  position: absolute; left: -5px; top: 50%; margin-top: -10px;
  display: inline-grid; place-items: center; width: 21px; height: 19px;
  color: var(--console-accent); background: var(--console-block);
  border: 1px solid var(--console-strong);
  box-shadow: 2px 2px 0 var(--block-shadow);
  font-family: var(--font); font-weight: 700;
}
/* stage receipts: brick mark in the marker column, state text as a stamp */
#left #stream .stage-milestone-mark {
  position: relative; left: auto; top: auto; transform: none;
  border-radius: 0; box-shadow: 2px 2px 0 var(--block-shadow);
}
#left #stream .stage-milestone-state {
  padding: 1px 8px; color: var(--console-dim);
  background: var(--console-bg2); border: 1px solid var(--console-line);
  font-size: 10.5px; letter-spacing: .06em;
}
/* prose chapter headings read as sections; the square marker hangs in the
   gutter so the heading text stays on the 27px text column */
#left .foldbody .md .md-h2, #left .foldbody .md .md-h3 {
  margin-top: 14px; padding-left: 9px; border-left: 3px solid var(--block-amber);
}
#left .foldbody .md .md-h::before { margin-left: -18px; }


/* brand box: logo + project controls at the top of the right rail */
#right .rail.brandbox {
  display: flex; flex-direction: column; gap: 11px; cursor: default;
  padding: 12px 12px 11px; counter-increment: none; z-index: 5;
  --rail-accent: var(--block-amber);
}
#right .rail.brandbox::after { content: none; }
#right .rail.brandbox:hover { transform: none; border-color: var(--console-strong); }
.brandbox #brand { gap: 10px; }
.brandbox-bar { display: flex; align-items: center; gap: 8px; }
.brandbox-bar #runmeta {
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.brandbox-ctrls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.brandbox-ctrls .hbtns { display: flex; align-items: center; gap: 4px; margin-left: 0; }
#brandbox .settings { margin-left: 0; }
@media (max-width: 940px) {
  #main { flex-direction: column; }
  #right {
    display: flex; order: -1; width: 100%; flex: none; direction: ltr;
    padding: 10px 12px; border-right: 0;
    border-bottom: 2px solid var(--console-accent);
    background-image: none; overflow: visible; resize: none;
  }
  #right > .rail:not(.brandbox) { display: none; }
  #task-rail {
    order: 0; flex: none; width: 100%; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--console-strong);
  }
  #right .rail.brandbox {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  }
  .brandbox-ctrls { margin-left: 0; width: 100%; }
}

@media (min-width: 941px) {
  #right .rail.brandbox { position: relative; }
  #right .rail.brandbox .settings { position: absolute; top: 9px; right: 9px; }
  #right .rail.brandbox #brand { padding-right: 34px; }
}

/* gear menu: language and theme share one radio-row control family;
   "auto" (system-follow) stays the silent default when nothing is stored */
.settings #settingsmenu { min-width: 224px; padding: 8px; }
.settings-head {
  margin-bottom: 7px; padding: 2px 6px 7px;
  color: var(--console-dim); border-bottom: 1px solid var(--console-line);
  font-size: 9px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase;
}
.settings-prefs {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 7px; padding-bottom: 9px;
  border-bottom: 1px solid var(--console-line);
}
.settings-row { display: flex; flex-direction: column; gap: 5px; }
.settings-row-label {
  color: var(--console-dim); font-size: 9.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.settings-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.settings #settingsmenu .settings-choice-btn {
  min-height: 27px; padding: 3px 7px;
  color: var(--console-muted); background: transparent;
  border: 1px solid var(--console-line); border-radius: 0; box-shadow: none;
  font: inherit; font-size: 10.5px; cursor: pointer;
  transition: color .12s ease, border-color .12s ease,
    background-color .12s ease;
}
.settings #settingsmenu .settings-choice-btn:hover {
  color: var(--console-accent); border-color: var(--console-accent);
  background: var(--acc-soft);
}
.settings #settingsmenu .settings-choice-btn[aria-checked="true"] {
  color: var(--console-bg); background: var(--console-accent);
  border-color: var(--console-accent); font-weight: 700;
}
.settings #settingsmenu #revokeagent { margin-top: 2px; }

/* The masthead gear stays a quiet icon; hover or keyboard focus reveals
   its button box so it never reads as a stray framed control. */
#brandbox .settings #settingsbtn {
  color: var(--console-dim);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
#brandbox .settings #settingsbtn:hover,
#brandbox .settings #settingsbtn:focus-visible {
  color: var(--console-accent);
  background: var(--acc-soft);
  border-color: var(--console-accent);
  box-shadow: 2px 2px 0 var(--block-shadow);
}

/* persistent task panel on the right (desktop) */
@media (min-width: 941px) {
  #right { order: 1; }
  #left { order: 2; }
  #task-rail {
    order: 3; border-right: 0;
    border-left: 1px solid var(--console-strong);
  }
}

/* ---- UI hierarchy: chrome side panels, one raised console board -------- */
/* Owner order 2026-11-30 (ninth iteration): the two side panels read as a
   quieter instrument chrome while the center console is the single primary,
   raised board; inside the left panel the brand/settings block is a masthead
   band, not a numbered output card. */
:root {
  --pane-lift: rgba(0, 0, 0, .62);
  --side-bg: #030604;
  --masthead-bg: #0a0f0b;
  --stripe-v: rgba(150, 255, 115, .035);
  --stripe-h: rgba(150, 255, 115, .035);
}
html[data-theme="light"] {
  --pane-lift: rgba(27, 37, 29, .20);
  --side-bg: #e4e4d9;
  --masthead-bg: #efeee4;
  --stripe-v: rgba(30, 55, 35, .025);
  --stripe-h: rgba(30, 55, 35, .025);
}

/* Both side panels share one recessed chrome surface: a flat darker fill
   with vertical scanlines. The center board carries horizontal scanlines,
   so the three planes read apart by texture as well as by tone. */
#right, #task-rail {
  background-color: var(--side-bg);
  background-image: repeating-linear-gradient(90deg,
    transparent 0 2px, var(--stripe-v) 2px 3px);
}
#right { border-right: 0; }
#task-rail { border-left: 0; }

#left {
  background-color: var(--console-bg);
  background-image: repeating-linear-gradient(to bottom,
    transparent 0 2px, var(--stripe-h) 2px 3px);
}

/* The console is the only raised plane on desktop: a tight frame plus a
   soft cast shadow that lands on the chrome panels on either side. */
@media (min-width: 941px) {
  #left {
    z-index: 2;
    border-left: 1px solid var(--console-strong);
    border-right: 1px solid var(--console-strong);
    background:
      repeating-linear-gradient(to bottom,
        transparent 0 2px, var(--stripe-h) 2px 3px),
      radial-gradient(1100px 340px at 50% -10%,
        color-mix(in srgb, var(--console-accent) 7%, transparent),
        transparent 64%),
      var(--console-bg);
    box-shadow:
      inset 1px 0 0 color-mix(in srgb, var(--console-accent) 20%, transparent),
      inset -1px 0 0 color-mix(in srgb, var(--console-accent) 20%, transparent),
      0 0 28px -6px var(--pane-lift);
  }
}

/* Output cards become flat outlined modules on the chrome: border and
   title rule carry the structure, the brick drop shadow is retired. */
#right .rail:not(.brandbox) {
  padding: 12px;
  background: color-mix(in srgb, var(--console-block) 45%, transparent);
  border: 1px solid var(--console-line);
  box-shadow: none;
}
#right .rail:not(.brandbox)::before { content: none; }
#right .rail:not(.brandbox):hover {
  transform: none;
  border-color: var(--rail-accent);
}
#right .rail:not(.brandbox) .rail-title {
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--console-line);
}
#right .rail:not(.brandbox) .rail-body .empty {
  background: transparent;
  border-left: 2px solid color-mix(in srgb,
    var(--rail-accent) 55%, var(--console-line));
}

/* Brand + project controls: a full-bleed masthead band divided from the
   output cards below it. Controls read as ghost toolbar buttons so they
   never compete with the card furniture. */
#right .rail.brandbox {
  margin: -17px -15px 0;
  padding: 16px 15px 12px;
  background: var(--masthead-bg);
  border: 0;
  border-bottom: 1px solid var(--console-strong);
  border-radius: 0;
  box-shadow: none;
}
#right .rail.brandbox::before { content: none; }
#brandbox .settings button {
  background: transparent;
  border-color: var(--console-line);
  box-shadow: none;
}
#brandbox .settings button:hover {
  transform: none;
  background: var(--acc-soft);
  border-color: var(--console-accent);
  box-shadow: none;
}

/* Pending install + About read as one joined toolbar segment: a soft filled
   rail, a brick state mark before each label, and a red tint when the Agent
   still needs installing. Clear as controls, not two stray boxes. */
#brandbox .brandbox-ctrls .hbtns {
  position: relative;
  display: inline-flex; align-items: stretch; gap: 0;
  border: 0; background: transparent;
}
/* three short rules bracket the pair: before the first label, between the
   two, and after the last (half the control height, never full-length) */
#brandbox .brandbox-ctrls .hbtns::before,
#brandbox .brandbox-ctrls .hbtns::after {
  content: ""; position: absolute; top: 50%; width: 1px; height: 14px;
  transform: translateY(-50%); background: var(--console-line);
}
#brandbox .brandbox-ctrls .hbtns::before { left: 0; }
#brandbox .brandbox-ctrls .hbtns::after { right: 0; }
#brandbox .hbtns button {
  position: relative;
  min-height: 28px; padding: 3px 10px;
  color: var(--console-muted); background: transparent;
  border: 0; border-radius: 0; box-shadow: none;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  transition: color .12s ease, background-color .12s ease;
}
#brandbox .hbtns button + button {
  border-left: 0;
}
#brandbox .hbtns button + button::after {
  content: ""; position: absolute; left: 0; top: 50%; width: 1px;
  height: 14px; transform: translateY(-50%);
  background: var(--console-line);
}
#brandbox .hbtns button::before {
  content: "\25A0"; margin-right: 6px; font-size: 7px;
  vertical-align: 1px; color: currentColor; opacity: .8;
}
#brandbox .hbtns button:hover,
#brandbox .hbtns button:focus-visible {
  color: var(--console-text); background: var(--acc-soft);
  transform: none; box-shadow: none;
}
#brandbox #helperbtn.pending { color: var(--err); }
#brandbox #helperbtn.pending:hover { background: var(--err-soft); }
#brandbox #helperbtn.online { color: var(--console-accent); }
#brandbox #helperbtn.update { color: var(--block-amber); }

/* Task panel sits on the same chrome and drops the raised step furniture:
   hairline step cells, no stamp shadows, opaque chrome on the sticky lane. */
#task-rail .task-heading { border-top: 0; }
#task-rail .task-step-no {
  background: transparent;
  box-shadow: none;
}
#task-rail #task-steps li.current .task-step-no { box-shadow: none; }
#task-rail .task-now { background: var(--side-bg); }
#task-rail .task-action { background: transparent; }

@media (max-width: 940px) {
  #left {
    z-index: auto;
    border-left: 0;
    border-right: 0;
    box-shadow: none;
  }
  #right .rail.brandbox {
    margin: 0;
    padding: 10px 2px 2px;
    border-bottom: 0;
  }
}

/* ---- closing disclaimer row: note + artifact buttons in one box ------- */
/* Owner order 2026-12-01: the closing disclaimer uses the same rounded text
   box as the model draft / model field boxes; a standalone warning panel
   starts on the same 27px column as the transcript. */
#left #stream .disclaimer-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin: 14px 0 0; padding: 14px 16px;
  background: var(--thread-hover);
  border: 1px solid var(--console-line);
  border-radius: 10px;
}
#left #stream > .disclaimer-row {
  width: calc(100% - 27px); max-width: calc(var(--thread-measure) - 27px);
  margin-left: 27px; margin-right: auto;
}
#left #stream .disclaimer-text {
  margin-left: 0; text-align: left;
  color: var(--console-muted);
  font-size: 15px; line-height: 1.75;
}
@media (min-width: 701px) {
  #left #stream .disclaimer-row.has-artifacts .disclaimer-text {
    margin-left: auto; text-align: right;
  }
}
#left #stream .disclaimer-row #task-artifacts {
  display: flex; flex-wrap: wrap; gap: 8px; flex: none;
  margin: 0; padding: 0; background: transparent; border: 0;
}
#left #stream .disclaimer-row .artifact-btn {
  width: 108px; margin: 0;
  font-size: 12px !important;
}
#left #stream .disclaimer-row .artifact-btn span {
  font-size: 12px !important; white-space: nowrap;
}
#left #stream .disclaimer-row .artifact-btn svg text {
  font-size: 8px !important;
}
@media (max-width: 700px) {
  #left #stream .disclaimer-row {
    flex-direction: column; align-items: flex-start; gap: 10px;
  }
  #left #stream .disclaimer-text {
    margin-left: 0; text-align: left;
  }
}

#jimu-preview-badge{position:fixed;bottom:6px;right:10px;z-index:2147483647;background:#b45309;color:#fff;font:bold 12px/1 monospace;letter-spacing:2px;padding:6px 10px;border-radius:4px;pointer-events:none;box-shadow:0 1px 4px rgba(0,0,0,.35)}
