/* 演示窗口的样式：取自 workbench/app 的 style.css、flow.css、questions.css、notifications.css、
   execution-settings.css，只把选择器限定在 .wb 下，固定定位改为相对演示窗口定位。
   Layout ideas adapt Synara 49cae984f: apps/web/src/index.css.
   Copyright (c) 2026 T3 Tools Inc. and Emanuele Di Pietro. MIT; see workbench/LICENSE.synara.
   配色跟随本页主题；演示里的“设置 → 外观”可以单独固定演示窗口的浅色或深色。 */
.wb {
  --ink: #1d1d1f; --muted: #6b6b72; --faint: #8e8e95;
  --sheet: #ffffff; --sheet-edge: rgba(0, 0, 0, .07); --line: rgba(0, 0, 0, .08);
  --sidebar: linear-gradient(160deg, #e3e7f0 0%, #eaecf1 45%, #e5eaed 100%);
  --row-hover: rgba(0, 0, 0, .045); --row-selected: #ffffff; --row-selected-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .06);
  --control: rgba(0, 0, 0, .05); --control-hover: rgba(0, 0, 0, .09); --control-border: rgba(0, 0, 0, .1);
  --accent: #0a66d8; --needs: #b7791f; --needs-ink: #93600f; --needs-bg: rgba(214, 150, 50, .12);
  --running: #1d1d1f; --warn: #b45309; --danger: #c4302b; --ok: #1a7f37; --info: #0969da;
  --field: #ffffff; --menu: rgba(250, 250, 252, .97); --shadow: 0 12px 40px rgba(20, 24, 40, .16), 0 0 0 .5px rgba(0, 0, 0, .1);
  --mono: "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wb:not([data-theme="light"]) {
    --ink: #ececf0; --muted: #a1a1aa; --faint: #7c7c85;
    --sheet: #1c1c1f; --sheet-edge: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .08);
    --sidebar: linear-gradient(160deg, #23253a 0%, #1d1e26 50%, #1c2726 100%);
    --row-hover: rgba(255, 255, 255, .05); --row-selected: rgba(255, 255, 255, .1); --row-selected-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .06);
    --control: rgba(255, 255, 255, .07); --control-hover: rgba(255, 255, 255, .12); --control-border: rgba(255, 255, 255, .1);
    --accent: #4c9bff; --needs: #e8a948; --needs-ink: #f0bd6a; --needs-bg: rgba(232, 169, 72, .14);
    --running: #ececf0; --warn: #f0b45a; --danger: #ff7b72; --ok: #56d364; --info: #79c0ff;
    --field: rgba(0, 0, 0, .25); --menu: rgba(44, 44, 50, .97); --shadow: 0 16px 48px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .1);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] .wb:not([data-theme="light"]), .wb[data-theme="dark"] {
  --ink: #ececf0; --muted: #a1a1aa; --faint: #7c7c85;
  --sheet: #1c1c1f; --sheet-edge: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .08);
  --sidebar: linear-gradient(160deg, #23253a 0%, #1d1e26 50%, #1c2726 100%);
  --row-hover: rgba(255, 255, 255, .05); --row-selected: rgba(255, 255, 255, .1); --row-selected-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .06);
  --control: rgba(255, 255, 255, .07); --control-hover: rgba(255, 255, 255, .12); --control-border: rgba(255, 255, 255, .1);
  --accent: #4c9bff; --needs: #e8a948; --needs-ink: #f0bd6a; --needs-bg: rgba(232, 169, 72, .14);
  --running: #ececf0; --warn: #f0b45a; --danger: #ff7b72; --ok: #56d364; --info: #79c0ff;
  --field: rgba(0, 0, 0, .25); --menu: rgba(44, 44, 50, .97); --shadow: 0 16px 48px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .1);
  color-scheme: dark;
}
.wb { position: relative; display: flex; height: 760px; min-width: 1040px; overflow: hidden; text-align: left;
  font: 13px/normal -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif; color: var(--ink);
  background: var(--sidebar); border-radius: 12px; box-shadow: 0 30px 70px -30px rgba(10, 14, 30, .45), 0 0 0 .5px rgba(0, 0, 0, .18); -webkit-font-smoothing: antialiased; }
.wb *, .wb *::before, .wb *::after { box-sizing: border-box; }
.wb h1, .wb h2, .wb h3, .wb p { letter-spacing: normal; }
.wb button { font: inherit; color: inherit; background: var(--control); border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; touch-action: manipulation; }
@media (hover: hover) and (pointer: fine) { .wb button:hover:not(:disabled) { background: var(--control-hover); } }
.wb button:focus-visible, .wb select:focus-visible, .wb input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wb button:disabled { opacity: .45; cursor: default; }
.wb input, .wb select { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--control-border); border-radius: 6px; padding: 5px 8px; }
.wb .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wb .icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; background: transparent; color: var(--muted); }
.wb .text-button { background: transparent; color: var(--muted); padding: 4px 8px; }
.wb .primary-button { background: var(--ink); color: var(--sheet); font-weight: 500; padding: 6px 14px; }
@media (hover: hover) and (pointer: fine) { .wb .primary-button:hover:not(:disabled) { background: var(--ink); opacity: .86; } .wb .icon-button:hover, .wb .text-button:hover { color: var(--ink); } }

/* 侧栏：真实应用里是 macOS 侧栏材质，演示用一层渐变代替。 */
.wb .sidebar { width: 272px; flex: 0 0 272px; display: flex; flex-direction: column; min-height: 0; }
.wb .sidebar-top { height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 2px; padding: 0 12px 0 18px; }
.wb .lights { display: flex; gap: 8px; margin-right: auto; }
.wb .lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.wb .lights i:nth-child(2) { background: #febc2e; } .wb .lights i:nth-child(3) { background: #28c840; }
.wb .project-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 12px; }
.wb .project-group { margin-bottom: 14px; }
.wb .project-row { width: 100%; display: flex; align-items: baseline; gap: 6px; text-align: left; background: transparent; padding: 6px 10px; }
.wb .project-row[aria-current="page"] { background: var(--row-selected); box-shadow: var(--row-selected-shadow); }
.wb .project-title { font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wb .project-row[aria-current="page"] .project-title { color: var(--ink); }
.wb .project-count { color: var(--faint); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.wb .project-needs { margin-left: auto; color: var(--needs-ink); font-size: 12px; flex-shrink: 0; }
.wb .free-terminals .project-count { font-size: 12px; }
.wb .agent-branches { list-style: none; margin: 0; padding: 0; }
.wb .agent-line { display: flex; align-items: flex-start; min-width: 0; }
.wb .agent-toggle, .wb .agent-toggle-space { flex: 0 0 18px; width: 18px; }
.wb .agent-toggle { height: 32px; padding: 0; background: transparent; color: var(--faint); display: grid; place-items: center; }
.wb .agent-row { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; column-gap: 10px;
  text-align: left; background: transparent; padding: 7px 10px 7px 6px; margin: 1px 0; border-radius: 8px; }
@media (hover: hover) and (pointer: fine) { .wb .agent-row:hover:not([aria-current]), .wb .project-row:hover:not([aria-current]) { background: var(--row-hover); } }
.wb .agent-row[aria-current="true"] { background: var(--row-selected); box-shadow: var(--row-selected-shadow); }
.wb .agent-main { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.wb .agent-role { font-size: 13.5px; white-space: nowrap; }
.wb .agent-meta { min-width: 0; color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb .agent-row[data-agent-state="ended"] .agent-role { color: var(--faint); }
.wb .agent-row[data-agent-state="waiting_user_answer"] .agent-role, .wb .agent-row[data-descendant-state="waiting_user_answer"] .agent-role { font-weight: 600; }
.wb .row-time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wb .agent-subtree { grid-column: 1 / -1; color: var(--faint); font-size: 11.5px; margin-top: 2px; overflow-wrap: anywhere; }
.wb .agent-row[data-descendant-state="waiting_user_answer"] .agent-subtree { color: var(--needs-ink); }
.wb .agent-task-label { padding: 6px 10px 2px 24px; color: var(--faint); font-size: 11.5px; }
.wb .sidebar-footer { flex-shrink: 0; padding: 6px 12px 10px; display: flex; }

/* 状态图标：转圈 = 运行中，琥珀色靶心 = 等你回答，勾 = 空闲，月亮 = 已结束。 */
.wb .status-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; flex-shrink: 0; color: var(--faint); }
.wb .status-icon svg { display: block; }
.wb .status-icon[data-glyph="running"] { color: var(--running); }
.wb .status-icon[data-glyph="waiting_user_answer"], .wb .status-icon[data-glyph="waiting_controller_answer"] { color: var(--needs); }
.wb .status-icon[data-glyph="idle"] { color: var(--muted); }
.wb .status-icon[data-glyph="unrestored"] { color: var(--danger); }
.wb .glyph-spin { transform-origin: 8px 8px; animation: wb-spin 1.1s linear infinite; }
@keyframes wb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wb .glyph-spin { animation: none; } }

/* 内容卡片 */
.wb main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--sheet); margin: 8px 8px 8px 0; border-radius: 10px;
  box-shadow: 0 0 0 .5px var(--sheet-edge), 0 1px 3px rgba(0, 0, 0, .06); overflow: hidden; }
.wb .task-header { flex-shrink: 0; height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.wb .header-title { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 12px; }
.wb h1 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; max-width: 55%; }
.wb .eyebrow { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.wb .workspace-pages { display: flex; gap: 2px; padding: 2px; background: var(--control); border-radius: 8px; }
.wb .workspace-pages button { background: transparent; padding: 3px 12px; border-radius: 6px; color: var(--muted); }
.wb .workspace-pages button[aria-current="page"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.wb .connection { color: var(--faint); font-size: 12px; white-space: nowrap; }
.wb .dock-badge { display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 4px; border-radius: 9px; background: #e5484d; color: #fff; font-weight: 600; font-size: 11px; text-align: center; }
.wb .terminal-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wb .terminal-page[hidden] { display: none; }
.wb .task-strip { flex-shrink: 0; display: flex; align-items: center; gap: 4px; padding: 6px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.wb .task-strip-label { color: var(--faint); font-size: 12px; padding: 0 6px 0 4px; flex-shrink: 0; }
.wb .task-row { flex-shrink: 0; max-width: 280px; display: flex; align-items: baseline; gap: 8px; background: transparent; padding: 4px 10px; border-radius: 6px; }
.wb .task-row[aria-current="page"] { background: var(--control-hover); }
.wb .task-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb .task-meta { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.wb .pane-layout { position: relative; flex: 1; min-height: 0; min-width: 0; }
.wb .pane-slot { position: absolute; }
.wb .pane-slot[hidden] { display: none; }
.wb .pane-slot[data-edge-right="true"] { border-right: 1px solid var(--line); }
.wb .pane-slot[data-edge-bottom="true"] { border-bottom: 1px solid var(--line); }
.wb .pane { position: relative; height: 100%; min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.wb .pane-header { flex-shrink: 0; height: 34px; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 14px; }
.wb .pane-header strong { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.wb .pane-focused .pane-header strong { color: var(--accent); }
.wb .pane-role { color: var(--muted); font-size: 12px; white-space: nowrap; }
.wb .pane-identity { min-width: 0; flex: 1; color: var(--faint); font: 11.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb .pane-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 11.5px; color: var(--faint); }
.wb .readonly { border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.wb .pane-actions { display: flex; flex-shrink: 0; opacity: .6; }
.wb .pane:hover .pane-actions, .wb .pane:focus-within .pane-actions { opacity: 1; }
.wb .connection-error { padding: 7px 14px; background: var(--needs-bg); color: var(--warn); overflow-wrap: anywhere; font-size: 12px; }
.wb .terminal-scroll { flex: 1; min-height: 0; padding: 4px 14px 8px; overflow: auto; }
.wb .terminal-lines { margin: 0; font: 11.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.wb .terminal-lines .dim { color: var(--faint); }
.wb .terminal-lines .ok { color: var(--ok); }
.wb .terminal-lines .info { color: var(--info); }
.wb .terminal-lines .warn { color: var(--needs-ink); }
.wb .pane-footer { flex-shrink: 0; color: var(--faint); font-size: 11px; padding: 3px 14px 7px; display: flex; justify-content: space-between; gap: 8px; }
.wb .pane-menu { position: absolute; z-index: 40; width: 210px; padding: 5px; background: var(--menu); border-radius: 10px; box-shadow: var(--shadow); }
.wb .pane-menu button { display: block; width: 100%; background: transparent; text-align: left; padding: 6px 10px; border-radius: 6px; }
.wb .pane-menu button:focus, .wb .pane-menu button:hover { background: var(--accent); color: #fff; outline: none; }
.wb .pane-rename { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.wb .pane-rename label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.wb .selection-hint { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; color: var(--muted); line-height: 1.7; text-align: center; margin: 0; }
.wb .selection-hint h2 { color: var(--ink); font-size: 17px; font-weight: 600; margin: 0; }
.wb .selection-hint p { margin: 0 0 12px; max-width: 440px; }
.wb .gate { flex-shrink: 0; display: flex; align-items: center; gap: 24px; padding: 8px 16px; border-top: 1px solid var(--line); }
.wb .gate > div { display: flex; align-items: baseline; gap: 8px; }
.wb .gate-label, .wb .gate dt { color: var(--faint); font-size: 11.5px; }
.wb .gate strong { font-size: 13px; font-weight: 600; }
.wb .gate dl { flex: 1; margin: 0; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 20px; }
.wb .gate dl > div { display: flex; align-items: baseline; gap: 6px; }
.wb .gate dd { margin: 0; font: 12px var(--mono); }

/* 原生提问（questions.css） */
.wb .questions-panel { flex: none; max-height: 55%; overflow: auto; }
.wb .questions-panel:empty { display: none; }
.wb .native-question { padding: 10px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--needs); background: var(--needs-bg); font-size: 12px; }
.wb .question-heading { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.wb .question-heading span, .wb .native-question p { color: var(--muted); margin: 4px 0; }
.wb .native-question fieldset { border: 0; margin: 9px 0; padding: 0; min-width: 0; }
.wb .native-question legend { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0 0 6px; }
.wb .question-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.wb .question-options button { text-align: left; white-space: normal; background: var(--sheet); }
.wb .question-options button[aria-pressed="true"] { box-shadow: inset 0 0 0 1.5px var(--needs); }
.wb .question-options small { display: block; color: var(--muted); margin-top: 3px; }
.wb .native-question label { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wb .native-question input[type="text"] { flex: 1; min-width: 100px; }
.wb .native-question > button { margin-top: 4px; }

/* 应用内通知（notifications.css） */
.wb .app-notifications { position: absolute; right: 20px; top: 64px; z-index: 30; display: grid; gap: 8px; width: 300px; max-height: 42%; overflow-y: auto; }
.wb .app-notifications:empty { display: none; }
.wb .app-notifications button { display: grid; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; background: var(--menu); border-radius: 12px; box-shadow: var(--shadow); color: var(--ink); overflow-wrap: anywhere; }
.wb .app-notifications button strong { color: var(--needs-ink); }
.wb .app-notifications button span { font-size: 12px; color: var(--muted); }

/* 设置（单独弹出） */
.wb .settings-backdrop { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, .28); }
.wb .settings-dialog { width: 520px; max-height: 92%; overflow-y: auto; border-radius: 14px; background: var(--sheet); box-shadow: var(--shadow); padding: 18px 22px 20px; }
.wb .settings-dialog > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.wb .settings-dialog h2 { margin: 0; font-size: 17px; font-weight: 600; }
.wb .settings-dialog section { padding: 12px 0; border-top: 1px solid var(--line); }
.wb .settings-dialog section:first-of-type { border-top: 0; }
.wb .settings-dialog h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.wb .settings-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.wb .segmented { display: inline-flex; gap: 2px; padding: 2px; background: var(--control); border-radius: 8px; }
.wb .segmented button { background: transparent; padding: 4px 14px; border-radius: 6px; color: var(--muted); }
.wb .segmented button[aria-pressed="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.wb .notification-settings { margin: 0; border: 0; padding: 0; display: grid; gap: 8px; }
.wb .notification-settings label { display: flex; align-items: center; gap: 8px; }
.wb .execution-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.wb .execution-settings label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
.wb .execution-settings label:first-of-type { grid-column: 1 / -1; }
.wb .execution-settings input, .wb .execution-settings select { min-width: 0; width: 100%; font-size: 13px; }
.wb .execution-settings .execution-fast { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.wb .execution-settings input[type=checkbox] { width: auto; }
.wb .execution-settings p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.wb .execution-settings button { justify-self: end; grid-column: 2; }
.wb .status-legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.wb .status-legend li { display: flex; align-items: center; gap: 8px; color: var(--muted); }

/* 流程页（flow.css） */
.wb .flow-page { flex: 1; min-height: 0; overflow: auto; padding: 18px 24px; }
.wb .flow-intro h2 { font-size: 18px; margin: 0 0 8px; }
.wb .flow-intro p, .wb .flow-unassigned p, .wb .flow-legend { color: var(--muted); line-height: 1.7; margin: 6px 0; }
.wb .flow-scroll { overflow-x: auto; padding-bottom: 16px; margin-top: 18px; }
.wb .flow-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wb .flow-lane { border-top: 1px solid var(--line); padding: 16px 0 24px; min-width: 1150px; }
.wb .flow-lane-heading { display: flex; gap: 20px; align-items: baseline; padding-bottom: 12px; }
.wb .flow-lane-heading button { background: transparent; text-align: left; max-width: 650px; overflow-wrap: anywhere; font-weight: 600; }
.wb .flow-lane-heading > span { color: var(--muted); }
.wb .flow-stages { display: grid; grid-template-columns: repeat(5, 230px); position: relative; padding-top: 66px; }
.wb .flow-stage { min-width: 0; }
.wb .flow-stage h3 { font-size: 14px; font-weight: 550; margin: 16px 0; }
.wb .flow-stage.complete h3 { color: var(--muted); }
.wb .flow-stage.current h3 { color: var(--accent); }
.wb .flow-track { height: 16px; position: relative; display: flex; align-items: center; }
.wb .flow-track::before { content: ''; position: absolute; left: 10px; right: 0; height: 1px; background: var(--line); }
.wb .flow-stage:last-child .flow-track::before { display: none; }
.wb .flow-track i { position: relative; width: 16px; height: 16px; background: var(--sheet); border: 2px solid var(--faint); border-radius: 50%; }
.wb .flow-stage.current .flow-track i { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(10, 102, 216, .15); }
.wb .flow-track > span { position: absolute; right: 18px; padding: 0 6px; background: var(--sheet); color: var(--faint); font-size: 20px; }
.wb .flow-agents { display: flex; flex-direction: column; gap: 8px; padding-right: 16px; }
.wb .flow-agent { display: flex; align-items: center; gap: 9px; background: var(--control); border-radius: 24px; padding: 9px 12px; min-width: 0; }
.wb .flow-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.wb .flow-agent > span:last-child { min-width: 0; }
.wb .flow-agent strong { display: block; font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
.wb .flow-agent small { display: block; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.wb .flow-agent[data-flow-state="waiting_user_answer"] { box-shadow: inset 0 0 0 1px var(--needs); }
.wb .flow-more { border-radius: 22px; text-align: left; }
.wb .flow-monitors { display: flex; align-items: baseline; gap: 20px; color: var(--muted); }
.wb .flow-monitors .flow-agents { max-width: 600px; }
.wb .flow-returns { position: absolute; top: 0; left: 7px; right: 0; height: 66px; pointer-events: none; }
.wb .flow-return { position: absolute; bottom: 0; left: 0; border: 1px solid var(--needs); border-bottom: 0; border-radius: 14px 14px 0 0; height: 32px; }
.wb .flow-return::before { content: '↓'; position: absolute; bottom: -10px; left: -5px; color: var(--needs-ink); }
.wb .flow-return span { position: absolute; top: -17px; left: 16px; background: var(--sheet); color: var(--needs-ink); padding: 0 6px; font-size: 12px; white-space: nowrap; }
.wb .flow-return.from-checks { width: 460px; }
.wb .flow-return.from-review { width: 690px; height: 60px; }
.wb .flow-unassigned { margin-top: 20px; max-width: 700px; }
.wb .flow-unassigned h3 { font-size: 14px; margin: 0; }
.wb .flow-unassigned .flow-agents { max-width: 360px; }

.wb .wb-note { position: absolute; left: 290px; bottom: 16px; z-index: 45; margin: 0; max-width: 540px; padding: 8px 12px; border-radius: 10px; background: var(--menu); box-shadow: var(--shadow); color: var(--ink); font-size: 12px; line-height: 1.6; }
.wb .wb-note:empty { display: none; }
.wb .flow-legend span { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; }


/* 问题、记录、指标、Reflect（records.css）与角色申请、项目行分支行（style.css），选择器限定在 .wb 下。 */
.wb .records-page { flex: 1; min-height: 0; overflow: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
.wb .records-intro { max-width: 720px; }
.wb .records-intro h2 { font-size: 20px; margin: 0 0 8px; }
.wb .records-intro p, .wb .records-empty { color: var(--muted); line-height: 1.7; margin: 6px 0; }
.wb .record-card { max-width: 760px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--sheet); }
.wb .record-card[data-issue-state="等你决定"] { border-color: var(--needs); }
.wb .record-heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.wb .record-heading strong { font-weight: 600; overflow-wrap: anywhere; }
.wb .record-state { font-size: 12px; color: var(--ink); background: var(--control); border-radius: 10px; padding: 1px 8px; }
.wb .record-state[data-tone="needs"] { color: var(--needs-ink); background: var(--needs-bg); }
.wb .record-state[data-tone="quiet"] { color: var(--muted); }
.wb .record-badge { font-size: 12px; color: var(--danger); border: 1px solid currentColor; border-radius: 10px; padding: 0 7px; }
.wb .record-meta { color: var(--muted); font-size: 12px; margin: 6px 0; }
.wb .record-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin: 8px 0; }
.wb .record-reply { display: flex; gap: 8px; color: var(--muted); margin: 6px 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.wb .record-reply span { flex: 0 0 auto; color: var(--ink); font-weight: 500; }
.wb .record-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.wb .record-actions label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.wb .record-actions textarea, .wb .record-actions input { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--control-border); border-radius: 8px; padding: 6px 8px; }
.wb .record-actions textarea:focus-visible, .wb .record-actions input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wb .record-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.wb .record-table { width: 100%; max-width: 1000px; border-collapse: collapse; font-size: 13px; }
.wb .record-table th { text-align: left; font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.wb .record-table td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; overflow-wrap: anywhere; }
.wb .record-table td.record-text { white-space: pre-wrap; max-width: 420px; }
.wb .record-table tr[data-intervention] td:first-child { box-shadow: inset 3px 0 0 var(--needs); }
.wb .record-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.wb .record-filter label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.wb .record-filter select, .wb .record-filter input { font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--control-border); border-radius: 8px; padding: 3px 6px; }
.wb .record-filter select:focus-visible, .wb .record-filter input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.wb .record-intervention { color: var(--needs-ink); margin-left: 6px; }
.wb .metric-section { max-width: 1000px; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.wb .metric-section h3 { font-size: 15px; margin: 4px 0; }
.wb .metric-section h4 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 4px 0 0; }
.wb .metric-figure { font-size: 24px; font-weight: 600; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.wb .metric-none { color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { .wb .records-page { padding: 16px 12px; } }

/* T-137: the Reflect page's session tree. */
.wb .reflect-branch { list-style: none; margin: 0; padding: 0; }
.wb .reflect-node { padding: 6px 0; border-bottom: 1px solid var(--line); }
.wb .reflect-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.wb .reflect-score { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 2px 16px; margin: 4px 0 0; font-size: 12.5px; }
.wb .reflect-score div { display: flex; gap: 4px; }
.wb .reflect-score dt { color: var(--muted); }
.wb .reflect-score dd { margin: 0; font: inherit; }
.wb .reflect-loose { margin-top: 10px; }
.wb .retrospective-page { margin-top: 18px; }
.wb .project-heading { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.wb .project-git { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb .role-request-parent { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.wb .role-request-parent select { min-width: 0; max-width: 100%; font: inherit; }
.wb .role-requests { flex-shrink: 0; display: flex; flex-direction: column; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.wb .role-request { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--needs-bg); color: var(--needs-ink); font-size: 13px; }
.wb .role-request p { flex: 1; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.wb .role-request button { flex-shrink: 0; }
.wb .role-request-hint { color: var(--muted); }
.wb .role-requests .catalog-error { margin: 0; border-radius: 0; }
.wb .pane-slot[data-role-request-pending="true"] { outline: 2px solid var(--needs); outline-offset: -2px; z-index: 1; }
.wb .role-request-number { flex-shrink: 0; display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--needs); color: #1f1400; font-weight: 600; font-size: 12px; }
.wb .role-request-tag { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 2px 8px; border-radius: 10px; background: var(--needs); color: #1f1400; font-size: 12px; font-weight: 600; pointer-events: none; }
.wb .tab-needs { margin-left: 6px; font-size: 11px; color: var(--needs-ink); background: var(--needs-bg); border-radius: 8px; padding: 0 6px; }
.wb .project-row { align-items: center; }
.wb .records-page textarea { resize: vertical; }
.wb .catalog-error { color: var(--danger); }
/* 导览高亮：当前这一步讲到的区域。 */
.wb .wb-spot { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 6px; }
/* 贴着窗口边缘的区域往里画，免得被裁掉。 */
.wb .pane-layout.wb-spot, .wb .project-list.wb-spot, .wb .role-requests.wb-spot, .wb .gate.wb-spot { outline-offset: -3px; border-radius: 0; }
/* 演示与真实应用的一处差别：有角色申请时，通知移到窗口右下，免得盖住申请条上的“批准”。 */
.wb:has(.role-requests) .app-notifications { top: auto; bottom: 64px; }
/* 通知、菜单项悬停时保留自己的底色：通用的按钮悬停底色是半透明的，会让下面的窗格文字透出来。 */
@media (hover: hover) and (pointer: fine) { .wb .app-notifications button:hover:not(:disabled) { background: var(--menu); box-shadow: var(--shadow), inset 0 0 0 1px var(--needs); } }

/* 项目的任务分屏：取自 workbench/app/style.css 的 .project-task-grid、.project-task-tile。 */
.wb .project-task-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); grid-auto-rows: minmax(180px, 1fr); overflow: auto; }
.wb .project-task-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 24px; border: 0; border-radius: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--sheet); color: inherit; text-align: left; min-width: 0; }
.wb .project-task-tile strong { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.wb .project-task-tile .task-meta { color: var(--muted); font-size: 12px; }
.wb .task-agents { margin-top: auto; color: var(--muted); font-size: 12px; }
@media (hover: hover) and (pointer: fine) { .wb .project-task-tile:hover:not(:disabled) { background: var(--row-hover); } }
.wb .project-task-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.wb .project-task-tile.wb-spot { outline-offset: -3px; border-radius: 0; }

/* 换场景：主区域淡入，窗格和任务格依次出现；只动 opacity 与 transform，减弱动效时不动。 */
@media (prefers-reduced-motion: no-preference) {
  .wb.wb-enter main > :not(.task-header) { animation: wb-fade .36s cubic-bezier(.16, 1, .3, 1) both; }
  .wb.wb-enter .pane-slot, .wb.wb-enter .project-task-tile { animation: wb-rise .42s cubic-bezier(.16, 1, .3, 1) both; }
  .wb.wb-enter .pane-slot:nth-child(2), .wb.wb-enter .project-task-tile:nth-child(2) { animation-delay: 60ms; }
  .wb.wb-enter .pane-slot:nth-child(3), .wb.wb-enter .project-task-tile:nth-child(3) { animation-delay: 120ms; }
  .wb.wb-enter .pane-slot:nth-child(n+4), .wb.wb-enter .project-task-tile:nth-child(n+4) { animation-delay: 180ms; }
  .wb.wb-enter .app-notifications button { animation: wb-toast .4s cubic-bezier(.16, 1, .3, 1) both .2s; }
  .wb.wb-enter .wb-spot { animation: wb-spot .9s cubic-bezier(.16, 1, .3, 1) both; }
}
@keyframes wb-fade { from { opacity: 0; } }
@keyframes wb-rise { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes wb-toast { from { opacity: 0; transform: translateX(12px); } }
@keyframes wb-spot { from { outline-color: transparent; } }
