/* ===== Design Tokens =====
 *
 * 唯一色板。任何界面颜色都必须引用本块的变量；规则里不得再出现裸色值。
 *
 * 基底是五层近黑，随抬升做极低饱和的色温漂移（深处偏冷、抬起偏暖），
 * 目的是让层级靠"厚度"而不是靠亮度阶跃来表达。
 * 强调只有两支：象牙白 = 用户此刻选中/聚焦的东西；黄铜 = 系统正在发生的事，
 * 且黄铜只允许出现在极小面积上（进度、单个主按钮、运行中卡框）。
 * 语义四色压在同一饱和度带上，所以并排出现时不会互相打架。
 */
:root {
  color-scheme: dark;

  /* Fluid scale contract: 18px is the authored baseline. Component geometry is
   * expressed in rem so type and spacing grow together. Physical hairlines,
   * optical offsets, shadow blur values, viewport-query thresholds, and the
   * literal --canvas-* values consumed by Konva intentionally remain in px. */

  /* ================= 星尘玫瑰金 · 色板唯一真源 =================
   * 设计判据是「五彩斑斓的黑」：底永远是黑的，颜色只是这块黑偏冷、那块黑偏暖，
   * 不是压在黑上的一块彩。所以饱和度一律 ≤26%，画布底色亮度 0.2%。
   *
   * ---- 色相三带（gate: tests/test_theme_token_contract.py）----
   *   暖族  玫瑰金   0°– 20°   —— 「在起作用」
   *   冷族  松石青 168°–190°   —— 「待命 / 选中 / 连线」
   *   底族  深空紫 225°–260°   —— 只许出现在亮度 < 3% 的近黑色上
   * 暖族与冷族锚点相差 172°，互为色轮正互补。底族不是第三种颜色，它是"黑"本身
   * 的色温；一旦某个深空紫的亮度超过 3%，它就变成了一块真的紫，门禁必须报红。
   *
   * ---- 状态用两条互不干扰的轴表达 ----
   *   温度      冷 → 暖      这东西在不在起作用（生成中 / 已接入 / 点了就执行）
   *   明暗+粗细 暗1px → 亮2px 你选没选中它（只跟鼠标有关，跟系统在干什么无关）
   * 四种组合各有确切含义。一张正在生成的卡可以同时是选中的，两条轴各说各的。
   *
   * ---- 同温规则 ----
   * 一个框的底和它的边框永远同族：冷底配冷框，暖底配暖框。
   * 选中只在族内把明暗提一档、把边加粗到 2px，绝不靠换温度表达。
   */

  /* ---- 面：好莱坞青橙 = 暗部往青走。画布底是独一份最深的蓝黑；
   * 一切 UI 元素的底都是冷青黑，比画布冷、比自己的边框暗。
   * 层次三档：浮层 ink-1 → 控件 ink-2 → 提亮 ink-3 ---- */
  --ink-0: #04080A;      /* H200 画布 / 页面最深底（唯一的最深蓝黑） */
  --ink-1: #0A1113;      /* H193 面板、侧栏、浮层 */
  --ink-1-hi: #0C1315;   /*      ↑ 同一块面的受光顶边 */
  --ink-2: #0F1719;      /* H192 卡体、控件、列表行 */
  --ink-2-hi: #111A1C;
  --ink-3: #151F21;      /* H190 悬停、抬升面 */
  --ink-3-hi: #172325;
  --ink-4: #070C0E;      /* H197 输入框等凹陷面 */
  --ink-4-lo: #060A0C;   /*      ↑ 凹陷面的底边（凹陷只靠内阴影表达，渐变方向不反转） */
  --ink-scrim: rgba(2, 5, 7, 0.78);

  /* ---- 线：冷青黑缝线 ---- */
  --line-1: #121A1B;  /* 同色两面相接时的缝线 */
  --line-2: #172122;  /* 分隔线 */
  --line-3: #253738;  /* 控件压在不可预测的图像上时才用的实边 */

  /* ---- 字：象牙白。全局一套，不随配色走，不许被状态色替换 ---- */
  --text-1: #D2CEC6;  /* H42 S12 L80  正文 */
  --text-2: #A6A196;  /* H40 S8  L62  次要 */
  --text-3: #7A756C;  /* H40 S6  L45  弱化 */
  --text-4: #56534E;  /* H40 S5  L32  禁用 */

  /* ---- 温度轴 · 冷（青）= 非选定 ----
   * 边框是一条竖向渐变：上沿受光、下沿背光。暗，但必须清晰可见；
   * 上下沿差 ≤1.4 倍，方向全站唯一（上亮下暗），包括凹陷面。 */
  --edge-cool-hi: #2F4C4B;
  --edge-cool-mid: #294140;
  --edge-cool-lo: #233938;
  /* 冷 · 亮：焦点/悬停一类的冷强调（输入框焦点、槽位悬停、占位图标）。
   * 不是选中态——选中只有暖橙一种样子。 */
  --edge-cool-sel-hi: #587B78;
  --edge-cool-sel-mid: #4E6C69;
  --edge-cool-sel-lo: #455F5D;

  /* ---- 温度轴 · 暖（橙）= 选中，全站唯一规则 ----
   * 非选中的暖：仅剩个别"在起作用"的弱标记（如待处理徽标），暗橙。 */
  --surface-warm: #130E08;
  --surface-warm-hi: #150F09;
  --edge-warm-hi: #6B4A28;
  --edge-warm-mid: #5D4023;
  --edge-warm-lo: #50371E;
  /* 暖 + 选中：一切选中态（画布卡片、当前标签、装填槽位、主按钮、连线）。
   * 不加粗：边保持细，亮度提级，外圈泛光（--glow-ring-warm）。 */
  --surface-warm-sel: #181209;
  --surface-warm-sel-hi: #1B140B;
  --edge-warm-sel-hi: #C4884A;
  --edge-warm-sel-mid: #AF763E;
  --edge-warm-sel-lo: #9A6633;

  /* ---- 暖色前景：选中态的文字/图标 ---- */
  --warm-1: #E2A263;  /* H30  选中控件的文字/图标 */
  --warm-2: #8A6742;  /* H31  在起作用但没被选中 */

  /* ---- 图表分类系列：四槽是分类色板，必须互不同族、两两可分辨（ΔE 与色相
       间隔由 tests/test_admin_monitor_page.py 锁定）。2026-09-28 用户法令：
       数据曲线用最高对比度显示色——白/亮紫/金/亮骚绿，饱和亮度拉满不设上
       限；色轮红橙扇区（H≥340 或 ≤50）整体保留给警戒线，数据槽禁入。
       警戒线凭亮度下限换色相豁免（tests/test_theme_token_contract.py）。---- */
  --chart-series-1: #FFFFFF;  /* 纯白，数据首槽 */
  --chart-series-2: #B26BFF;  /* H269 亮紫档，图表专用 */
  --chart-series-3: #FFD700;  /* H51 金档，图表专用 */
  --chart-series-4: #39FF14;  /* H111 亮骚绿档，图表专用 */
  --chart-limit-warn: #FF913D;  /* H30 警戒橙（虚线），图表专用 */
  --chart-limit-max: #FF333A;   /* H355 警戒红（虚线），图表专用 */

  /* ---- 光影：凸面上亮下暗，凹面上暗下亮 ---- */
  --inset-neutral: rgba(255, 255, 255, 0.045);
  --inset-cool: rgba(195, 225, 225, 0.055);
  --inset-warm: rgba(255, 214, 165, 0.06);
  --glow-cool: 0 0 10px -6px rgba(76, 148, 146, 0.22);
  --glow-warm: 0 0 10px -6px rgba(216, 130, 52, 0.22);
  /* 泛光唯一配方：近圈实 + 远圈虚，全站所有选中态共用同一强度 */
  --glow-warm-core: rgba(216, 130, 52, 0.40);
  --glow-warm-soft: rgba(216, 130, 52, 0.20);
  --glow-ring-warm: 0 0 0 1px var(--glow-warm-soft), 0 0 14px -2px var(--glow-warm-core), 0 0 30px -6px var(--glow-warm-soft);
  --lift-1: 0 1px 4px -2px rgba(0, 0, 0, 0.75);
  --sink-1: inset 0 2px 4px -3px rgba(0, 0, 0, 0.85);

  /* ---- 语义四色 ----
   * 这里是色相三带唯一的例外，理由是可核对的：四种状态必须彼此可分辨，
   * 而"可分辨"只能靠色相，不能靠明暗（明暗那条轴已经被"选没选中"占了）。
   * 代价用饱和度 ≤34%、亮度 ≤48% 兑掉，保证它们仍然是黑里透出来的颜色。 */
  --ok: #5E9186;      /* H168 */
  --ok-line: rgba(94, 145, 134, 0.40);
  --ok-wash: rgba(94, 145, 134, 0.10);
  --warn: #9A855A;    /* H42  */
  --warn-line: rgba(154, 133, 90, 0.40);
  --warn-wash: rgba(154, 133, 90, 0.10);
  --bad: #9B5D55;     /* H7   */
  --bad-line: rgba(155, 93, 85, 0.40);
  --bad-wash: rgba(155, 93, 85, 0.10);
  --info: #5E7E91;    /* H198 */
  --info-line: rgba(94, 126, 145, 0.40);
  --info-wash: rgba(94, 126, 145, 0.10);

  /* ---- 画布：参考槽位与连线 ----
   * 连线两态：非选定 = 暗青渐变 2px；选定/高亮 = 橙渐变 2.5px + 1px 高光叠线 + 泛光。
   * 泛光靠 Konva shadow（色值见 --canvas-glow-warm），不靠加粗。
   * Konva 读的 token 必须是字面量：var() 到它手里就是一个画不出来的字符串。 */
  --canvas-reference-slot-hover-border: #587B78;
  --canvas-reference-slot-hover-ring: var(--inset-cool);
  --canvas-reference-slot-group-hover-border: var(--line-3);
  --canvas-reference-slot-group-hover-wash: rgba(195, 225, 225, 0.04);
  --canvas-wire-idle-end: #37746F;      /* 非选定连线：两端 */
  --canvas-wire-idle-mid: #27524E;      /* 非选定连线：中段 */
  --canvas-wire-active-end: #D88E48;    /* 选中连线：两端（橙） */
  --canvas-wire-active-mid: #B06A34;    /* 选中连线：中段 */
  --canvas-wire-gloss: rgba(255, 225, 190, 0.35);  /* 选中连线上的 1px 高光叠线 */
  --canvas-glow-warm: #D88234;          /* Konva 泛光 shadowColor 字面量 */
  --canvas-reference-connection-default-stroke: #37746F;
  --canvas-reference-connection-muted-stroke: #27524E;
  --canvas-reference-connection-dimmed-stroke: #223836;
  --canvas-reference-label-default-back: #151F21;
  --canvas-reference-label-default-stroke: #294140;
  --canvas-reference-label-default-text: #A6A196;
  --canvas-reference-label-highlight-back: #181209;
  --canvas-reference-label-highlight-stroke: #C4884A;
  --canvas-reference-label-muted-back: #0A1113;
  --canvas-reference-label-muted-stroke: #223836;
  --canvas-reference-label-muted-text: #7A756C;

  /* ---- 画布：端口 ----
   * 端口是左上受光的渐变球，温度跟随所在连线（非选定青 / 选中橙）。
   * 空槽反过来画：底色填充 + 连线色描边，一眼分清接了和没接。 */
  --canvas-port-idle-hi: #4C8D88;
  --canvas-port-idle-mid: #30605B;
  --canvas-port-idle-lo: #1D3D3A;
  --canvas-port-active-hi: #E0A365;
  --canvas-port-active-mid: #B4753F;
  --canvas-port-active-lo: #6C4322;
  --canvas-port-fill-empty: #04080A;
  --canvas-port-ring: #04080A;
  --canvas-port-ring-empty: #30605B;

  /* ---- 画布：卡片框体（单一 Konva owner） ----
   * 卡片的框是一条从标题栏顶端贯穿卡体底端的竖向渐变。DOM 标题栏只承载
   * 文本和动作命中区，不绘制面、描边、圆角或泛光。
   * 选中 = 暖橙面 + 暖橙边 + 泛光；宽度不变（不加粗，泛光负责醒目）。 */
  --canvas-card-surface: #0F1719;
  --canvas-card-surface-hi: #111A1C;
  --canvas-card-surface-sel: #181209;
  --canvas-card-surface-sel-hi: #1B140B;
  --canvas-card-media-back: #060A0C;
  --canvas-card-seam: #121A1B;
  --canvas-card-radius: 8px;
  --canvas-port-label-radius: 10px;
  /* 卡片标题条是一层没有底色的 DOM：面和边由下面那张 Konva 画布画，它只承载
   * 文本和按钮。它的层号跟着卡在画布里的叠放序号走（序号+1），所以卡一多就
   * 会盖过按固定层号摆的浮层——用户看到的是"背景那张卡的标题和下载按钮
   * 凭空浮在操作窗上面"，像是操作窗透明。这条上限把标题条圈在一个封顶的层
   * 段里，浮层用「上限+1」站在它们全体之上：整张卡（面在画布里、字在 DOM 里）
   * 一起被浮层挡住。 */
  --canvas-card-chrome-z-ceiling: 9000;
  --canvas-card-stroke-width: 1px;
  --canvas-card-stroke-width-selected: 1px;
  /* Selected cards alone carry the emphasis: +2px blur and +0.07 opacity
   * over the former 16px / 0.55 glow remain warm rather than a white outline. */
  --canvas-card-selection-glow-blur: 18px;
  --canvas-card-selection-glow-opacity: 0.62;

  /* ---- 排版阶梯：所有非画布用户界面文字只能从这里取档 ---- */
  /* ---- 顶栏高度：恒定值，任何状态都不许改变它 ----
     状态胶囊最多两层（主句 + 细节行），令牌按两层的满高定死；空闲少一层时
     胶囊内部留白，而不是让整条顶栏缩回去。 */
  --topbar-height: 4.2778rem;
  --topbar-status-height: 3.5556rem;
  --topbar-status-primary-line: 1.15rem;
  --topbar-status-detail-line: 0.9333rem;

  --type-meta: 0.7778rem;
  --type-label: 0.8889rem;
  --type-body: 1rem;
  --type-heading: 1.1111rem;
  --type-title: 1.4444rem;
  --type-display: 2.2222rem;

  /* ---- 智能体开发页：框体留白刻度 ---- */
  --agent-frame-gap: 0.6667rem;
  --agent-frame-pad: 0.6667rem;

  /* ---- 阴影：只用来托浮层，不做装饰 ---- */
  --shadow-md: 0 6px 18px -10px rgba(0, 0, 0, 0.70);
  --shadow-lg: 0 18px 38px -16px rgba(0, 0, 0, 0.90);

  /* ---- 圆角三档 ---- */
  --radius-sm: 0.2778rem;    /* 小控件、缩略图 */
  --radius-md: 0.5rem;    /* 卡片、按钮组 */
  --radius-lg: 0.6111rem;   /* 浮层、面板 */
  --radius-xl: 0.7778rem;   /* 对话框 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* A control label is one decision, not a paragraph. Containers may wrap
   controls onto another row, but a button's own text never gets a second line. */
button,
[role="button"] {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* 文本插入光标只允许出现在真正的文本输入面；图片/视觉/按钮等一律禁止 */
/* caret-color inherits: native editable child lines must inherit the visible
   caret from their editing host. Suppress only at non-editable boundaries. */
:root, [contenteditable="false"] { caret-color: transparent; }
input, textarea, [contenteditable="true"], [contenteditable="plaintext-only"] { caret-color: auto; }

html {
  /* 基准 18px 死值，**不随分辨率变**（用户 2026-08-14 裁定）。
   * CSS 的 px 已经是设备无关单位，视网膜屏的物理密度由浏览器换算；
   * 再按视口宽度放大一次，5K 屏和带鱼屏就会劈叉——而这两者正好都是本应用的日常场景。
   * 界面大小只有一个调节杆：系统设置里的界面缩放（--ui-font-scale），
   * 配合浏览器自身的缩放足以覆盖所有显示器。 */
  font-size: calc(18px * var(--ui-font-scale, 1));
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', Roboto, sans-serif;
  background: var(--ink-0);
  color: var(--text-1);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
button:focus {
  outline: none;
  box-shadow: none;
}
button:focus-visible {
  outline: 0.1111rem solid var(--edge-warm-sel-mid);
  outline-offset: 0.1111rem;
}
input, textarea { font-family: inherit; }

/* Input substrate: one owner for every non-canvas input surface.
 * Idle reuses the canvas card's cool edge; focus reuses its selected warm edge.
 * Canvas has its own physical-pixel interaction chrome and is deliberately
 * excluded by the owner containers below. Hover is the exact 50/50 sRGB
 * interpolation between those two card states, not a hand-picked new colour.
 * 聚焦那条必须和悬停那条一样带上 :not(:disabled)：否则悬停比聚焦多一层
 * 伪类、特异性更高，鼠标停在正在输入的框上时会盖掉聚焦色。 */
html:root body :is(.app, .auth-gate, .app-dialog-backdrop) :where(input, textarea, select, [data-form-control-surface]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(:is(.canvas-card-title-input, .canvas-structure-field :is(input, textarea, select))) {
  --form-control-surface-hi: var(--ink-4);
  --form-control-surface-lo: var(--ink-4-lo);
  --form-control-edge-hi: var(--edge-cool-hi);
  --form-control-edge-mid: var(--edge-cool-mid);
  --form-control-edge-lo: var(--edge-cool-lo);
  box-sizing: border-box;
  border: var(--canvas-card-stroke-width) solid transparent;
  background:
    linear-gradient(180deg, var(--form-control-surface-hi), var(--form-control-surface-lo)) padding-box,
    linear-gradient(180deg, var(--form-control-edge-hi), var(--form-control-edge-mid) 45%, var(--form-control-edge-lo)) border-box;
  box-shadow: var(--sink-1);
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--type-body);
}
html:root body :is(.app, .auth-gate, .app-dialog-backdrop) :where(input, textarea, select, [data-form-control-surface]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(:is(.canvas-card-title-input, .canvas-structure-field :is(input, textarea, select))):not(:disabled):hover {
  --form-control-edge-hi: color-mix(in srgb, var(--edge-cool-hi) 50%, var(--edge-warm-sel-hi));
  --form-control-edge-mid: color-mix(in srgb, var(--edge-cool-mid) 50%, var(--edge-warm-sel-mid));
  --form-control-edge-lo: color-mix(in srgb, var(--edge-cool-lo) 50%, var(--edge-warm-sel-lo));
}
html:root body :is(.app, .auth-gate, .app-dialog-backdrop) :where(input, textarea, select, [data-form-control-surface]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(:is(.canvas-card-title-input, .canvas-structure-field :is(input, textarea, select))):not(:disabled):is(:focus, :focus-within) {
  --form-control-surface-hi: var(--canvas-card-surface-sel-hi);
  --form-control-surface-lo: var(--canvas-card-surface-sel);
  --form-control-edge-hi: var(--edge-warm-sel-hi);
  --form-control-edge-mid: var(--edge-warm-sel-mid);
  --form-control-edge-lo: var(--edge-warm-sel-lo);
  outline: none;
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm);
}
/* 勾选框和单选圈不是文本框：既不该套文本框的边框，也绝不能被别处的
   `width:100%` 撑成整行——那样标签会被挤成 0 宽，文字一个字一行竖着排。 */
html:root body :is(.app, .auth-gate, .app-dialog-backdrop) :where(input[type="checkbox"], input[type="radio"]) {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: auto;
  accent-color: var(--edge-cool-sel-mid);
}
::-webkit-scrollbar { width: 0.4444rem; height: 0.4444rem; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-1); border-radius: var(--radius-sm); }
::-webkit-scrollbar-thumb:hover { background: var(--line-2); }
/* 角落不上底色：有滚动条的文本域右下角若留原生白底，会把 resize 拖拽图示
   盖成一块白斑——同组控件必须是同一个样子（拖拽图示处处可见）。 */
::-webkit-scrollbar-corner { background: transparent; }

/* ===== App Layout ===== */
.app {
  display: grid;
  /* 侧栏宽随品牌区等比放大（×--topbar-height/3.1667rem），容得下放大后的品牌字组。 */
  grid-template-columns: 11.7076rem minmax(0, 1fr);
  height: 100vh;
  background: var(--ink-0);
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--ink-1);
  border-right: 1px solid var(--line-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.brand {
  padding: 1.1111rem 1.1111rem 0.8889rem;
  display: flex;
  align-items: center;
  gap: 0.5556rem;
  border-bottom: 1px solid var(--line-1);
}
/* Sidebar logo area matches the top status bar height so their divider lines meet.
   Height must track the --topbar-height token itself, never a copied number:
   the two bottom borders only coincide while both areas are the same height. */
.sidebar .brand {
  height: var(--topbar-height);
  flex-shrink: 0;
  padding: 0 1.1111rem;
}
/* The sidebar logo doubles as the way back to the marketing homepage. */
.brand-home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s;
}
.brand-home:hover { opacity: 0.75; }
.brand-logo {
  width: auto;
  /* 品牌区从 3.1667rem 长到 --topbar-height（×1.3509），鲸标按同一比例等比放大。 */
  height: 2.7018rem;
  object-fit: contain;
}
/* 品牌字组与官网页头同一构图（鲸标 + 云游鲸/whaleway 两行），随品牌区等比放大：
 * 鲸标 ×1.3509；文字受排版阶梯约束只能取整档（heading→title、meta→body，
 * ≈×1.30）。侧栏 11.7076rem 宽，字距维持 0.1rem，留出跨字体栈的安全余量不换行溢出。 */
.brand-home { gap: 0.4444rem; }
.brand-name {
  color: var(--text-1);
  font-size: var(--type-title);
  font-weight: 600;
  letter-spacing: 0.1rem;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-name small {
  display: block;
  margin-top: 0.1111rem;
  font-size: var(--type-body);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-3);
}
/* Project Selector — 当前项目全名卡。名字随侧栏宽度自动折行，逐行居中；
   底部「切换项目」指路行是可点击示意的唯一落点，任何缩放下保持单行。 */
.project-selector {
  margin: 0.6667rem 0.6667rem 0.3333rem;
  padding: 0.4444rem 0.5rem;
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3333rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.project-selector:hover { background: var(--ink-3); border-color: transparent; }
.project-info { width: 100%; min-width: 0; }
.project-info .name {
  font-size: var(--type-label);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;
}
.project-switch-hint {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3889rem;
  white-space: nowrap;
  font-size: var(--type-meta);
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.project-switch-hint svg {
  flex-shrink: 0;
  color: var(--text-4);
  transition: color 0.15s ease, transform 0.15s ease;
}
.project-selector:hover .project-switch-hint-arrow-left {
  color: var(--warn);
  transform: translateX(-0.1667rem);
}
.project-selector:hover .project-switch-hint-arrow-right {
  color: var(--warn);
  transform: translateX(0.1667rem);
}
/* Centered project picker modal */
.project-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.7778rem;
  background: var(--ink-scrim);
  backdrop-filter: blur(3px);
}
.project-modal.hidden { display: none; }
.project-modal-card {
  width: min(100%, 42.2222rem);
  max-height: min(80vh, 35.5556rem);
  display: flex;
  flex-direction: column;
  background: var(--ink-1);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.3333rem 1.3333rem 1.1111rem;
}
[data-project-modal-card] { width: min(100%, 70rem); }
.project-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.project-modal-title { font-size: var(--type-heading); font-weight: 700; color: var(--text-1); }
.project-modal-close {
  width: 1.7778rem; height: 1.7778rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-3);
  font-size: var(--type-title);
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.project-modal-close:hover { background: var(--ink-2); color: var(--text-1); }
.project-modal-hint { color: var(--text-3); font-size: var(--type-label); line-height: 1.6; padding: 1.3333rem 0; }
.project-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.1111rem 0;
}
.project-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: 0.8889rem;
  border-top: 1px solid var(--line-1);
}
.project-card {
  --project-card-row-gap: 0.3333rem;
  --project-card-inner-gap: 0.6667rem;
  --project-card-block-gap: 1.1111rem;
  display: grid;
  grid-template-columns: 15.5556rem max-content max-content 13.5rem 4.2222rem;
  align-items: center;
  column-gap: var(--project-card-block-gap);
  justify-content: space-between;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line-1);
  border-radius: 0;
  background: transparent;
  padding: 0.7778rem 0.4444rem;
  cursor: pointer;
  transition: background 0.15s;
}
.project-card:hover { background: var(--ink-2); }
.project-card.active {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel)) padding-box, linear-gradient(180deg, var(--edge-warm-sel-hi), var(--edge-warm-sel-mid) 45%, var(--edge-warm-sel-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm);
}
.project-card-identity {
  display: grid;
  grid-template-columns: 4.8889rem minmax(0, 10rem);
  align-items: center;
  column-gap: var(--project-card-inner-gap);
  min-width: 0;
}
.project-card-details { min-width: 0; }
.project-card-copy-tag {
  display: inline-block;
  margin-top: 0.2222rem;
  border-radius: var(--radius-md);
  padding: 0.1111rem 0.4444rem;
  background: var(--ink-3);
  color: var(--text-3);
  font-size: var(--type-meta);
  font-weight: 600;
  white-space: nowrap;
}
.project-card-copy-tag.production { color: var(--warm-1); }
.project-card-facts {
  display: contents;
}
.project-card-overview { display: grid; align-items: center; row-gap: var(--project-card-row-gap); font-size: var(--type-meta); color: var(--text-3); }
.project-card-overview:not(.project-card-overview-counts) { grid-template-columns: 1rem 4em 3em; column-gap: 0.4444rem; }
.project-card-overview > div { display: contents; }
.project-card-overview span { white-space: nowrap; }
.project-card-stage-icon { width: 1rem; height: 1rem; color: var(--text-3); }
.project-card-stage-icon svg { display: block; width: 100%; height: 100%; }
.project-card-stage.stage-completed .project-card-stage-icon,
.project-card-stage.stage-completed span:last-child { color: var(--ok); }
.project-card-stage.stage-planned .project-card-stage-icon,
.project-card-stage.stage-planned span:last-child { color: var(--warm-1); }
.project-card-overview-counts { grid-template-columns: 2em minmax(4ch, max-content); column-gap: 0.5rem; }
.project-card-overview-counts .stage-completed .project-card-number { color: var(--ok); }
.project-card-overview-counts .stage-planned .project-card-number { color: var(--warm-1); }
.project-card-meta { display: grid; justify-items: end; row-gap: var(--project-card-row-gap); min-width: 0; }
.project-card-head-actions { display: grid; align-items: center; row-gap: 0.4444rem; }
.project-card-action {
  min-height: 1.8889rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.3333rem 0.5556rem;
  color: var(--text-2);
  background: var(--ink-2);
  font: inherit;
  font-size: var(--type-meta);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.project-card-action:hover { color: var(--text-1); background: var(--ink-3); border-color: transparent; }
.project-card-action.danger:hover { color: var(--bad); border-color: var(--bad); }
.project-card-action:focus-visible,
.project-card-rename-input:focus-visible { outline: 0.1111rem solid var(--edge-cool-sel-hi); outline-offset: 0.1111rem; }
.project-card-rename-input { width: 100%; box-sizing: border-box; border: 0.1111rem solid transparent; border-radius: var(--radius-md); background: linear-gradient(180deg, var(--ink-4), var(--ink-4-lo)) padding-box, linear-gradient(180deg, var(--edge-cool-sel-hi), var(--edge-cool-sel-mid) 45%, var(--edge-cool-sel-lo)) border-box; box-shadow: var(--sink-1); color: var(--text-1); font: inherit; font-size: var(--type-label); font-weight: 600; padding: 0.3333rem 0.4444rem; }
.project-card-mark {
  width: 4.8889rem; height: 4.8889rem;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--ink-3);
  color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--type-label); font-weight: 700;
}
.project-card-mark img { width: 100%; height: 100%; object-fit: cover; }
.project-card-name {
  font-size: var(--type-label); font-weight: 600; color: var(--text-1);
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.project-card-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  text-align: right;
}
.project-card-time {
  display: grid;
  grid-template-columns: max-content 16ch;
  column-gap: 0.5556rem;
  font-size: var(--type-meta);
  color: var(--text-3);
  text-align: right;
  white-space: nowrap;
}
/* Viewport breakpoint, recalibrated from 620px after the 18px-based geometry
   became rem: at the 16px floor the same project-card fit needs about 551px. */
@media (max-width: 1000px) {
  .project-modal { padding: 0.8889rem; }
  .project-modal-card { padding: 1.1111rem 0.8889rem 0.8889rem; }
  .project-card { grid-template-columns: minmax(0, 1fr) 4.2222rem; row-gap: 0.7778rem; justify-content: stretch; }
  .project-card-identity { grid-column: 1; grid-row: 1; }
  .project-card-facts { display: grid; grid-template-columns: max-content max-content; column-gap: var(--project-card-block-gap); grid-column: 1 / -1; grid-row: 2; justify-content: start; }
  .project-card-meta { grid-column: 1 / -1; grid-row: 3; justify-items: start; }
  .project-card-time { text-align: left; }
  .project-card-head-actions { grid-column: 2; grid-row: 1; }
}
.popover-title {
  font-size: var(--type-label);
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 0.5556rem;
}
.popover-hint {
  color: var(--text-3);
  font-size: var(--type-meta);
  line-height: 1.5;
  margin-bottom: 0.5556rem;
}
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.3333rem;
  overflow-y: auto;

  background: var(--ink-2);

}
body.auth-gate-open .app { display: none; }
body.auth-gate-open .auth-gate { display: flex; }
body.session-pending .auth-gate-card { visibility: hidden; }
.auth-gate-card {
  width: min(100%, 22.2222rem);
  padding: 1.7778rem;
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  background: var(--ink-1);
  box-shadow: none;
  text-align: center;
}
.auth-gate-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5556rem;
  margin-bottom: 0.5556rem;
  font-size: var(--type-title);
  font-weight: 800;
  letter-spacing: -0.6px;
}
.auth-gate-brand img {
  /* 鲸形标是竖版（425:565），按高约束才不会在标题行里撑高；
   * 视觉高度与旧横版标在标题旁的占位一致。 */
  height: 2.2222rem;
  width: auto;
}
.auth-gate-brand span {
  color: var(--text-1);
}
.auth-gate-intro {
  margin: 0 auto 1.3333rem;
  max-width: 15.5556rem;
  color: var(--text-2);
  font-size: var(--type-label);
  line-height: 1.6;
  text-align: center;
}
.login-form { display: grid; gap: 0.4444rem; }
.login-form input {
  width: 100%;
  height: 2.2222rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--ink-4);
  color: var(--text-1);
  padding: 0 0.6667rem;
  font-size: var(--type-label);
  text-align: center;
}
.login-form input:focus { outline: none; border-color: var(--edge-cool-sel-hi); }
.auth-gate-error {
  min-height: 1.1111rem;
  margin-top: 0.6667rem;
  color: var(--bad);
  font-size: var(--type-meta);
  line-height: 1.45;
}
.auth-gate .popover-actions { margin-top: 0.2222rem; }
.auth-gate .popover-actions .btn { min-height: 2.2222rem; }
.auth-gate-wechat { margin-top: 0.8889rem; }
.auth-gate-wechat[hidden] { display: none; }
.auth-gate-wechat-divider {
  display: flex;
  align-items: center;
  gap: 0.4444rem;
  margin-bottom: 0.6667rem;
  color: var(--text-3);
  font-size: var(--type-meta);
}
.auth-gate-wechat-divider::before,
.auth-gate-wechat-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ink-4);
}
.btn-wechat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3333rem;
  width: 100%;
  min-height: 2.2222rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: #07c160;
  color: #ffffff;
  font-size: var(--type-label);
  text-decoration: none;
}
.btn-wechat:hover { background: #06ad56; }
.btn-wechat svg { flex: none; }
.popover-actions { display: flex; gap: 0.4444rem; margin-top: 0.5556rem; }
.popover-actions .btn { flex: 1; justify-content: center; font-size: var(--type-label); }
/* App Dialog */
.app-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.3333rem;
  background: var(--ink-scrim);
  backdrop-filter: blur(16px);
}
.app-dialog-backdrop.hidden { display: none; }
.app-dialog {
  width: min(40rem, 100%);
  max-height: min(86vh, 45.5556rem);
  overflow: auto;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--ink-2);

  box-shadow: 0 28px 80px var(--ink-scrim);
  padding: 1rem;
}
.app-dialog.danger {
  border-color: var(--bad-line);
  box-shadow: 0 28px 80px var(--ink-scrim), 0 0 0 1px var(--bad-wash);
}
.app-dialog-head {
  display: grid;
  gap: 0.4444rem;
}
.app-dialog-title {
  color: var(--text-1);
  font-size: var(--type-heading);
  font-weight: 750;
  line-height: 1.35;
}
.app-dialog-body {
  color: var(--text-2);
  font-size: var(--type-label);
  line-height: 1.65;
  white-space: pre-line;
}
.app-dialog-form {
  display: grid;
  gap: 0.6667rem;
  margin-top: 0.8889rem;
}
.app-dialog-form.hidden,
.app-dialog-error.hidden {
  display: none;
}
.app-dialog-field {
  display: grid;
  gap: 0.3889rem;
  color: var(--text-2);
  font-size: var(--type-label);
  font-weight: 650;
}
.app-dialog-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5556rem;
}
.app-dialog-field-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.3333rem;
}
.app-dialog-field-action {
  min-height: 1.7778rem;
  padding: 0.2222rem 0.5556rem;
}
.app-dialog-field input,
.app-dialog-field select,
.app-dialog-field textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  font-size: var(--type-label);
  line-height: 1.45;
  padding: 0.5556rem 0.6111rem;
}
.app-dialog-field textarea {
  min-height: 5.7778rem;
  resize: none;
  overflow: hidden;
}
.app-dialog-field input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  padding: 0;
}
.app-dialog-field input:focus,
.app-dialog-field select:focus,
.app-dialog-field textarea:focus {
  outline: none;
  border-color: var(--edge-cool-sel-hi);
  box-shadow: 0 0 0 2px var(--inset-cool);
}
.app-dialog-error {
  margin-top: 0.6667rem;
  color: var(--text-1);
  font-size: var(--type-label);
}
.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4444rem;
  margin-top: 1rem;
}
.app-dialog-actions .asset-tool-btn {
  min-width: 4.7778rem;
  min-height: 1.8889rem;
  padding: 0.3889rem 0.6667rem;
  font-size: var(--type-label);
}
/* 未启用的次按钮槽位（app.js 以 hidden 类标记）不占位：此前没有这条规则，
   空槽一直按 min-width 占位，按钮组被它推离视觉中心。 */
.app-dialog-secondary.hidden { display: none; }
.app-dialog-actions-three .asset-tool-btn { flex:1 1 0; }
.app-dialog-actions-three .app-dialog-confirm { order:1; }
.app-dialog-actions-three .app-dialog-secondary { order:2; }
.app-dialog-actions-three .app-dialog-cancel { order:3; }
.app-dialog-cancel { background: var(--ink-2); }
/* 取消键可隐藏（cancelText 空串=与「关闭」同动作，不留两个钮）。 */
.app-dialog-cancel.hidden { display: none; }
.app-dialog.danger .app-dialog-confirm {
  background: var(--surface-warm-hi);
  border-color: var(--edge-warm-mid);
  color: var(--warm-1);
}

/* Nav */
.nav-section { padding: 0.4444rem 0.6667rem; }
.nav-label { font-size: var(--type-meta); color: var(--text-4); padding: 0.4444rem 0.6667rem 0.2222rem; text-transform: uppercase; letter-spacing: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6111rem;
  padding: 0.5rem 0.6667rem;
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: var(--type-label);
  cursor: pointer;
  margin-bottom: 0.1111rem;
  position: relative;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--ink-2); color: var(--text-1); }
.nav-item.active {
  background: linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel));
  color: var(--warm-1);
  box-shadow: var(--glow-ring-warm);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0.4444rem; bottom: 0.4444rem;
  width: 0.1667rem;
  background: var(--edge-warm-sel-hi);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.nav-item .icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: currentColor;
}
.nav-item .icon svg { display: block; }
.nav-item.done .icon { color: var(--ok); }
.nav-item.done .icon::after {
  content: '✓';
  position: absolute;
  right: -0.2222rem;
  bottom: -0.2222rem;
  width: 0.6111rem;
  height: 0.6111rem;
  border-radius: 55.5rem;
  background: var(--ok);
  color: var(--text-1);
  border: 1px solid var(--ink-0);
  font-size: var(--type-meta);
  line-height: 0.5556rem;
  text-align: center;
  font-weight: 700;
}

/* Sidebar generation queue */
.sidebar-queue {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0.4444rem 0.6667rem 0;
  border-top: 1px solid var(--line-1);
}
.sidebar-queue[hidden] { display: none; }
.sidebar-queue-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4444rem;
  padding: 0.5556rem 0 0.4444rem;
  color: var(--text-2);
  font-size: var(--type-meta);
  font-weight: 600;
}
.sidebar-queue-count {
  min-width: 1rem;
  padding: 1px 0.3333rem;
  border: 1px solid transparent;
  background: var(--ink-2);
  border-radius: 55.5rem;
  color: var(--text-3);
  font-size: var(--type-meta);
  line-height: 0.8889rem;
  text-align: center;
}
.nav-item.stage-planned .icon { color: var(--warm-1); }
.nav-item.stage-completed .icon { color: var(--ok); }
.sidebar-queue-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 0.4444rem;
}
.sidebar-queue-empty {
  margin: 0;
  padding: 0.5556rem 0;
  color: var(--text-3);
  font-size: var(--type-meta);
}
.sidebar-queue-item {
  display: grid;
  gap: 0.2778rem;
  margin-bottom: 0.4444rem;
  padding: 0.5rem;
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
}
.sidebar-queue-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3333rem;
  color: var(--text-2);
  font-size: var(--type-meta);
}
.sidebar-queue-task,
.sidebar-queue-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-queue-task { font-weight: 600; }
.sidebar-queue-title {
  color: var(--text-3);
  font-size: var(--type-meta);
}
/* 标题槽稳定骨架（2026-10-18 用户令）：空槽用零宽空格占住一行高度，
   标题到与不到卡片高度恒定，绝不先无后有。 */
.sidebar-queue-title.is-empty::before { content: "\200B"; }
.sidebar-queue-status {
  flex: none;
  padding: 1px 0.2778rem;
  border-radius: 55.5rem;
  background: linear-gradient(180deg, var(--surface-warm-hi), var(--surface-warm)) padding-box, linear-gradient(180deg, var(--edge-warm-hi), var(--edge-warm-mid) 45%, var(--edge-warm-lo)) border-box;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--lift-1);
  color: var(--warm-2);
}
.sidebar-queue-progress {
  height: 0.1667rem;
  overflow: hidden;
  background: var(--ink-1);
  border-radius: 55.5rem;
}
/* 卡片进度条统一一个亮色（2026-10-13 用户令）：计数条/真实进度条/耗时条
   同一填充，不再按条的口径换色；低置信弱化、超 p90 冻结转警示色保留。 */
.sidebar-queue-progress > span {
  display: block;
  height: 100%;
  background: var(--edge-warm-sel-hi);
  border-radius: inherit;
}
.sidebar-queue-progress.is-duration.is-weak { opacity: 0.45; }
/* 恒占条位（2026-10-17 抽搐实证）：无可画视图的拍子条位隐形但占高度，卡片
   高度不由「这一拍有没有条」决定；预估迟到由 1s tick 原地升成真条。 */
.sidebar-queue-progress.is-duration.is-empty { visibility: hidden; }
.sidebar-queue-progress.is-duration.is-frozen > span { background: var(--warn); }

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding: 0.6667rem;
  border-top: 1px solid var(--line-1);
}
.user-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "info" "balance";
  align-items: center;
  gap: 0.4444rem 0.5556rem;
  padding: 0.4444rem 0.5556rem 0.4444rem 0.6667rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}
.user-card:hover { background: var(--ink-2); }
.user-info { grid-area: info; min-width: 0; }
.user-info .name {
  display: inline-block;
  max-width: 100%;
  padding: 0.2778rem 0.6111rem;
  border-radius: var(--radius-md);
  background: var(--ink-2);

  color: var(--text-1);
  font-size: var(--type-label);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-info .plan { font-size: var(--type-meta); color: var(--text-3); padding-left: 0.6111rem; margin-top: 0.1667rem; }
.user-info .plan:empty { display: none; }
.user-quota-balance {
  grid-area: balance; justify-self: start;
  display: inline-flex; align-items: center; gap: 0.2778rem; margin-top: 0;
  padding: 0.1667rem 0.3889rem; border: 1px solid var(--bad-line); border-radius: 55.5rem;
  background: var(--bad-wash);
  color: var(--bad); font-size: var(--type-meta); line-height: 1;
}
.quota-details-section { margin-top: 0.8889rem; }
.quota-details-list { display: grid; gap: 0.4444rem; }
.quota-details-row { display: flex; justify-content: space-between; gap: 0.6667rem; padding: 0.5rem; background: var(--ink-2); border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--type-meta); }

/* Centered user modal — same centering/overlay as the project picker, narrower card */
.user-modal-card { width: min(100%, 26.6667rem); }
.user-modal-email { font-size: var(--type-label); font-weight: 600; color: var(--text-1); word-break: break-all; }
.user-modal-sub { margin-top: 0.3333rem; color: var(--text-3); font-size: var(--type-meta); }
.user-modal-balance { display: inline-flex; align-items: center; gap: 0.3333rem; margin-top: 0.7778rem; padding: 0.4444rem 0.6667rem; border-radius: var(--radius-md); background: var(--ink-2); border: 1px solid transparent; color: var(--text-1); font-size: var(--type-label); font-weight: 600; }
.user-modal-body { overflow-y: auto; padding: 0.1111rem; margin-top: 0.2222rem; }
.user-modal-body .quota-details-section:first-child { margin-top: 0.4444rem; }
/* ===== Main Area ===== */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  container-name: workspace;
  container-type: inline-size;
}

.topbar {
  /* 恒定高度，不是 min-height：状态条多一行细节、告警条弹出、窗口变窄，
     顶栏都不许跟着长高或缩短（2026-08-19 用户要求）。 */
  height: var(--topbar-height);
  background: var(--ink-1);
  border-bottom: 1px solid var(--line-1);
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(20rem, 42.2222rem) minmax(10rem, 1fr);
  align-items: center;
  padding: 0.3333rem 1.1111rem;
  gap: 0.8889rem;
  flex-shrink: 0;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4444rem;
  flex: 1 1 10rem;
  min-width: 0;
  max-width: 14.4444rem;
  overflow: hidden;
  white-space: nowrap;
  font-size: var(--type-label);
  color: var(--text-3);
  justify-self: start;
  width: 100%;
}
.breadcrumb span { white-space: nowrap; }
.breadcrumb span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb .current { color: var(--text-1); font-weight: 600; flex: 0 0 auto; }
.breadcrumb-sep { color: var(--text-4); }

.topbar-status {
  display: flex; align-items: center; gap: 0.4444rem;
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 0.2222rem 0.5556rem;
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: 55.5rem;
  font-size: var(--type-label);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.topbar-status span { position: relative; z-index: 1; }
.topbar-center {
  justify-self: center;
  width: 100%;
  max-width: 42.2222rem;
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.4444rem;
}
.topbar-transient-mode {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0.3889rem 0.7778rem;
  border: 1px solid var(--edge-cool-mid);
  border-radius: var(--radius-xl);
  background: var(--ink-2);
  color: var(--text-1);
  font-size: var(--type-label);
  font-weight: 650;
}
.topbar-transient-mode[hidden] { display: none; }
.topbar-center.is-transient-mode > .topbar-status:not(.topbar-transient-mode),
.topbar-center.is-transient-mode > .topbar-notice {
  visibility: hidden;
  pointer-events: none;
}
.topbar-transient-mode-prompt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-notice {
  /* Overlay the status pill in place (same slot as .topbar-status) instead of
     floating as a separate bar below the topbar. Mirrors .topbar-transient-mode
     positioning so the notice reads as the topbar's own status surface, not a
     detached box underneath. */
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.3889rem 0.7778rem;
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  background: var(--ink-2);
  color: var(--text-1);
  font-size: var(--type-meta);
  line-height: 1.35;
  /* 通知浮窗是被动信息面（2026-09-28 顶栏总览法）：容器点击可穿透——只有
     通知内部的交互控件（关闭/操作按钮）自己接住指针。常驻失败/降级通知
     绝不许挡住顶栏总览与页面控件的点击。 */
  pointer-events: none;
}
.topbar-notice button, .topbar-notice a { pointer-events: auto; }
.topbar-notice[hidden] {
  display: none;
}
/* Notice and pipeline progress share one visual status surface. A notice is
   an interrupt: retain the pipeline DOM, but do not show its copy through the
   single sentence that currently owns that surface. */
.topbar-center:has(> .topbar-notice:not([hidden])) > .topbar-status {
  visibility: hidden;
  pointer-events: none;
}
.topbar-notice.is-failure {
  border-color: var(--bad-line);
  background: var(--bad-wash);
}
.topbar-notice.is-warning {
  border-color: var(--warn-line);
  background: var(--warn-wash);
}
/* info 轻提醒（2026-09-20 冲突口径）：后台已自行消化的事件（自动合并/以最新
   改动为准）用中性偏「妥当」的绿色，绝不借失败/警告的红色吓人。 */
.topbar-notice.is-info {
  border-color: var(--ok-line);
  background: var(--ok-wash);
}
.topbar-notice-icon {
  flex: 0 0 1.1111rem;
  width: 1.1111rem;
  height: 1.1111rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--bad);
  font-weight: 800;
}
.topbar-notice.is-warning .topbar-notice-icon { color: var(--warn); }
.topbar-notice.is-info .topbar-notice-icon { color: var(--ok); }
.topbar-notice-reason {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-notice-pending {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0 0.3333rem;
  border-radius: var(--radius-md);
  background: var(--ink-3);
  color: var(--text-2);
  font-size: var(--type-meta);
  white-space: nowrap;
}
.topbar-notice-close {
  flex: 0 0 1.3333rem;
  width: 1.3333rem;
  height: 1.3333rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  font-size: var(--type-heading);
  line-height: 1;
}
.topbar-notice-close:hover {
  background: var(--ink-3);
  color: var(--text-1);
}
.topbar-notice-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.1111rem 0.5556rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--ink-3);
  color: var(--text-1);
  font-size: var(--type-meta);
  line-height: 1.3;
  cursor: pointer;
}
.topbar-notice-action:hover {
  background: var(--ink-3);
}
.topbar-notice.is-failure .topbar-notice-action {
  border-color: var(--bad-line);
  background: var(--bad-wash);
}
.topbar-notice.is-failure .topbar-notice-action:hover {
  background: var(--bad-wash);
}
.topbar-notice.is-warning .topbar-notice-action {
  border-color: var(--warn-line);
  background: var(--warn-wash);
}
/* 悬停全文（2026-09-16 用户定）：24 字可见句之外的完整事实。自制提示用
   display 切换即时出现（原生 title 要等一秒以上，禁止使用），不设任何
   transition 延迟；绝对定位挂在通知条自身上，不占布局、不改顶栏恒定高度，
   左右随通知条收边，窄屏不出界。pointer-events 关掉，避免提示自己抢悬停。 */
.topbar-notice-detail {
  position: absolute;
  top: calc(100% + 0.4444rem);
  left: 0.3889rem;
  right: 0.3889rem;
  z-index: 30;
  display: none;
  padding: 0.5556rem 0.7778rem;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  background: var(--ink-2);
  color: var(--text-1);
  font-size: var(--type-meta);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.topbar-notice:hover .topbar-notice-detail,
.topbar-notice:focus-within .topbar-notice-detail {
  display: block;
}
.canvas-card-notice {
  position: absolute;
  z-index: calc(var(--canvas-card-chrome-z-ceiling) + 1);
  width: min(360px, calc(100vw - 32px));
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border: 1px solid var(--bad-line);
  border-radius: var(--radius-lg);
  background: var(--bad-wash);
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.35;
  pointer-events: auto;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
}
.canvas-card-notice[hidden] { display: none; }
.canvas-card-notice.is-warning {
  border-color: var(--warn-line);
  background: var(--warn-wash);
}
.canvas-card-notice-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--bad);
  font-weight: 800;
}
.canvas-card-notice.is-warning .canvas-card-notice-icon { color: var(--warn); }
.canvas-card-notice-reason {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.canvas-card-notice-detail {
  position: absolute;
  top: calc(100% + 0.4444rem);
  left: 0;
  right: 0;
  z-index: 1;
  display: none;
  padding: 0.5556rem 0.7778rem;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  background: var(--ink-2);
  color: var(--text-1);
  font-size: var(--type-meta);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: start;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.canvas-card-notice:hover .canvas-card-notice-detail,
.canvas-card-notice:focus-within .canvas-card-notice-detail {
  display: block;
}
.canvas-card-notice-close {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
}
.canvas-card-notice-close:hover {
  background: var(--ink-3);
  color: var(--text-1);
}
/* 资产卡片通知条（2026-10-16 用户令）：这张卡所有状态与消息的唯一呈现面，
   挂在卡框上沿、世界坐标随 overlay 与卡一起移动缩放。三态一代：is-failure
   生成失败（app.js 失败通知闸唯一投稿，同卡下一次生成成功或删卡才撤）、
   is-warning 编辑期警告（弹层就绪警告的去处，随条件在撤）、is-busy 生成中
   （投影在生成/提交在途/润色在途）。每张卡各一条，与单槽的卡片通知中心分家；
   被别的卡压住时按 chrome 同款遮蔽让位。生成参数输入窗因此永远稳定——状态、
   失败、错误、警告一律不再进窗。 */
.canvas-card-notice-strip {
  position: absolute;
  z-index: 8;
  box-sizing: border-box;
  min-width: 200px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-md);
  background: var(--warn-wash);
  color: var(--text-1);
  font-size: 13px;
  line-height: 1.4;
  pointer-events: auto;
  transform: translate(-50%, -100%);
}
.canvas-card-notice-strip.is-failure {
  border-color: var(--bad-line);
  background: var(--bad-wash);
}
.canvas-card-notice-strip.is-busy {
  border-color: var(--line-1);
  background: var(--ink-2);
  color: var(--text-2);
}
.canvas-card-notice-strip-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--warn);
  font-weight: 800;
}
.canvas-card-notice-strip.is-failure .canvas-card-notice-strip-icon { color: var(--bad); }
.canvas-card-notice-strip.is-busy .canvas-card-notice-strip-icon { color: var(--text-3); }
.canvas-card-notice-strip-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
/* 顶栏总览（2026-09-28 用户定）：唯一 owner 渲染两稳态——生成中按封闭
   类别计数；就绪一字排开项目六项总览。总览胶囊随内容横向扩宽；任务身份、
   进度、结果一律不上顶栏（失败走通知浮窗）。 */
.topbar-status.topbar-overview {
  justify-self: center;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  max-width: none;
  height: var(--topbar-status-height);
  padding: 0.3889rem 0.7778rem;
  border-radius: var(--radius-xl);
  gap: 0.5556rem;
}
.topbar-overview-dot {
  flex: 0 0 auto;
  width: 0.3333rem;
  height: 0.3333rem;
  border-radius: 50%;
  background: var(--ok);
}
.topbar-status.topbar-overview.is-generating .topbar-overview-dot {
  background: var(--surface-warm-hi);
  animation: statusPulse 1s ease-in-out infinite;
}
.topbar-overview-state {
  flex: 0 0 auto;
  color: var(--text-1);
  font-weight: 650;
}
.topbar-overview-kind,
.topbar-overview-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2778rem;
  min-width: 0;
  white-space: nowrap;
}
.topbar-overview-kind-name,
.topbar-overview-item-name { color: var(--text-3); }
.topbar-overview-value { color: var(--text-1); font-weight: 650; }
.topbar-overview-separator { color: var(--text-4); }
.script-duration-percent {
  display: inline-flex;
  align-items: baseline;
  margin-left: 0.3333rem;
  font-variant-numeric: tabular-nums;
}
.script-duration-percent.is-weak { opacity: 0.55; }
.script-duration-percent.is-frozen { color: var(--warn); }
.btn {
  padding: 0.3889rem 0.7778rem;
  border-radius: var(--radius-md);
  font-size: var(--type-label);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.3333rem;
  white-space: nowrap;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--ink-2); color: var(--text-1); }
.btn-secondary {
  background: var(--ink-2);
  border-color: transparent;
  color: var(--text-1);
}
.btn-secondary:hover { background: var(--ink-3); border-color: transparent; }
.btn-primary {
  background: var(--surface-warm-hi);
  color: var(--warm-1);
  font-weight: 600;
  box-shadow: none;
}
.quota-button-price { position: relative; z-index: 1; }
.quota-insufficient .quota-button-price { color: var(--bad); }
/* 文档级浮层层序梯（docs/floating-layer-precedence-model.md）：悬停浮层 <
 * 点击弹层 < 模态 < 全屏阻断。用户点击弹出的东西优先级永远高于悬停弹出的，
 * 所以这两张悬停浮层必须站在取消菜单（2500）之下；数值只在梯子上各就各位，
 * 不要单独调整。 */
.quota-breakdown-layer {
  position: fixed;
  z-index: 2400;
  display: grid;
  min-width: 13rem;
  max-width: min(20rem, calc(100vw - 0.8889rem));
  gap: 0.4444rem;
  padding: 0.5556rem 0.6667rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--ink-1);
  box-shadow: var(--shadow-lg);
  color: var(--text-1);
  font-size: var(--type-meta);
  pointer-events: none;
}
.quota-breakdown-layer[hidden] { display: none; }
.quota-breakdown-item { display: grid; gap: 0.1667rem; }
.quota-breakdown-main,
.quota-breakdown-total { display: flex; justify-content: space-between; gap: 1rem; }
.quota-breakdown-item small { color: var(--text-3); }
.quota-breakdown-credits { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.quota-breakdown-total { padding-top: 0.4444rem; border-top: 1px solid var(--line-2); font-weight: 700; }
.quota-breakdown-shortfall { padding-top: 0.4444rem; border-top: 1px solid var(--line-2); color: var(--bad); }
/* 不可用原因并进明细浮层的首段（2026-09-18 用户定）：字号取正文档，与
 * action-reason-tooltip 同一版式（首行标题加粗），下面一条分隔线把原因与
 * 报价行分层——两者都要在同一张浮层里读得清。 */
.quota-breakdown-reason {
  display: grid;
  gap: 0.2222rem;
  padding-bottom: 0.4444rem;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--type-body);
  line-height: 1.5;
}
.quota-breakdown-reason-title { font-weight: 700; }
/* 灰按钮悬停原因浮层（action_reason_tooltip.js 渲染，全站唯一 owner）。
 * 面板语言与 quota-breakdown-layer 同一套 token：ink-1 面、line-2 边、
 * radius-md 圆角、shadow-lg 投影、text-1 文字；字号取正文档（--type-body，
 * 用户定 ≥ 正文档），比价签明细浮层大一档——原因只有一句话，读得清优先。
 * 多行版式（2026-09-17 用户定）：首行标题加粗，其余行动行逐行点名去哪个
 * 开发页生成哪张图；层与层之间只留一行距，不加边框分隔。 */
.action-reason-tooltip {
  position: fixed;
  /* 层序梯见 .quota-breakdown-layer 处注释：悬停 < 点击弹层。 */
  z-index: 2400;
  max-width: min(22rem, calc(100vw - 0.8889rem));
  padding: 0.5rem 0.6667rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--ink-1);
  box-shadow: var(--shadow-lg);
  color: var(--text-1);
  font-size: var(--type-body);
  line-height: 1.5;
  pointer-events: none;
}
.action-reason-tooltip .action-reason-title {
  font-weight: 700;
}
.action-reason-tooltip .action-reason-title:not(:last-child) {
  margin-bottom: 0.2222rem;
}
.action-reason-tooltip[hidden] { display: none; }
.btn-primary:hover { box-shadow: none; transform: translateY(-1px); }
/* ===== Page Container ===== */
.page-wrap {
  flex: 1;
  overflow-y: auto;
  background: var(--ink-0);
  position: relative;
  isolation: isolate;
  min-width: 0;
}
/* ===== Project Switch Gate（切换项目的阻塞式原子过渡）=====
   门升起期间页面内容不可交互（捕获期事件闸另在 app.js 全挡输入），
   侧栏导航一并封死，防止门内切页。 */
body.project-switching .page-wrap { pointer-events: none; user-select: none; }
body.project-switching .sidebar .nav-section { pointer-events: none; user-select: none; }
body.project-switching .page-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--ink-0) 72%, transparent);
  backdrop-filter: blur(10px);
}
body.project-switching .page-wrap .project-load-overlay {
  pointer-events: auto;
}
.project-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 5060;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: color-mix(in srgb, var(--ink-0) 78%, transparent);
  backdrop-filter: blur(16px) saturate(115%);
}
.project-load-overlay[hidden] { display: none; }
.project-load-card {
  width: min(36rem, calc(100vw - 3rem));
  display: grid;
  gap: 1.1rem;
  padding: 2rem 2.2rem;
  border: 1px solid color-mix(in srgb, var(--line-2) 82%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--ink-1) 94%, transparent);
  box-shadow: 0 1.5rem 4rem color-mix(in srgb, #000 28%, transparent);
}
.project-load-title {
  color: var(--text-1);
  font-size: var(--type-heading);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.project-load-detail {
  color: var(--text-2);
  font-size: var(--type-body);
  line-height: 1.5;
}
.project-load-detail[hidden] { display: none; }
.project-load-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6667rem;
}
.project-load-retry {
  min-width: 8rem;
}
/* 失败态要有失败的样子：沿用 toast 失败态同款语义 token（--bad-line/--bad-wash），
 * 别让失败卡片塌缩成一个没有配色的空盒。 */
.project-load-overlay.has-failed .project-load-card {
  border-color: var(--bad-line);
  background: color-mix(in srgb, var(--bad-wash) 30%, var(--ink-1));
}
.project-load-overlay.has-failed .project-load-track { display: none; }
.project-load-track {
  position: relative;
  height: 0.5556rem;
  overflow: hidden;
  border-radius: 999rem;
  background: color-mix(in srgb, var(--line-2) 72%, transparent);
}
.project-load-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--edge-warm-mid), var(--warm-1));
  box-shadow: 0 0 1.2rem color-mix(in srgb, var(--warm-1) 45%, transparent);
  transition: width 220ms ease;
}
.project-load-overlay.is-indeterminate .project-load-fill {
  animation: projectLoadSweep 1.2s ease-in-out infinite;
}
@keyframes projectLoadSweep {
  from { transform: translateX(-115%); }
  to { transform: translateX(315%); }
}
@media (prefers-reduced-motion: reduce) {
  .project-load-fill { transition: none; }
  .project-load-overlay.is-indeterminate .project-load-fill { animation-duration: 2.4s; }
}
#asset-canvas {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background:
    linear-gradient(color-mix(in srgb, var(--line-3) 46%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line-3) 46%, transparent) 1px, transparent 1px),
    var(--ink-0);
  /* 格子跟着画布走：间距和偏移由 island.js 按 stage 的缩放和平移写进这两个变量，
     没写之前（画布还没起来）退回静态的 28px，页面不会先闪一下空白。 */
  background-size: var(--canvas-grid-size, 28px) var(--canvas-grid-size, 28px);
  background-position: var(--canvas-grid-offset-x, 0px) var(--canvas-grid-offset-y, 0px);
  /* Canvas panning belongs to Stage; editor focus must not scroll this
     surface.（自内嵌分叉收编：b420af4bd 的画布焦点修复只进了分叉） */
  overflow: clip;
  position: relative;
  touch-action: none;
}
.canvas-context-menu {
  position: fixed;
  z-index: 140;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--ink-1);
  color: var(--text-1);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}
.canvas-context-menu-item {
  width: 100%;
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-1);
  font-size: 15px;
  line-height: 1.3;
  text-align: left;
}
.canvas-context-menu-item:not(:disabled):hover,
.canvas-context-menu-item:not(:disabled):focus-visible {
  background: var(--ink-3);
  color: var(--text-1);
}
.canvas-context-menu-item:disabled {
  cursor: default;
  color: var(--text-4);
  opacity: 0.72;
}
.canvas-card-chrome {
  position: absolute;
  z-index: 8;
  height: var(--canvas-card-rail-height, 27px);
  box-sizing: border-box;
  display: flex;
  align-items: stretch;
  border: 0;
  border-radius: var(--canvas-card-radius) var(--canvas-card-radius) 0 0;
  background: none;
  box-shadow: none;
  overflow: hidden;
  pointer-events: none;
  color: var(--canvas-card-foreground, var(--text-1));
}
.canvas-card-chrome::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--canvas-card-radius) - 1px) calc(var(--canvas-card-radius) - 1px) 0 0;
  background: transparent;
  pointer-events: none;
}
.canvas-card-title-tab,
.canvas-card-action-tabs {
  display: flex;
  height: 100%;
  box-sizing: border-box;
  align-items: stretch;
}
.canvas-card-title-tab { flex: 1 1 auto; min-width: 0; }
.canvas-card-title-tab[hidden] { display: none; }
.canvas-card-title-tab[hidden] + .canvas-card-action-tabs { margin-left: auto; }
.workbench-asset-preview .canvas-card-action-tab:disabled { opacity: .48; cursor: default; pointer-events: none; }
/* Chromium ignores the non-standard `nofullscreen` controlsList token. Keep
   playback/timeline/volume, but remove its competing enlarge/PiP entries: the
   shared top-right magnifier is the only owner of media enlargement. */
video::-webkit-media-controls-fullscreen-button,
video::-webkit-media-controls-picture-in-picture-button { display:none!important; }
.canvas-card-action-tabs { flex: 0 0 var(--canvas-card-actions-width, 0px); }
.canvas-card-title-button,
.canvas-card-title-input,
.canvas-card-action-tab {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: 700 var(--canvas-card-rail-font-size, 10px)/1 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  pointer-events: auto;
}
.canvas-card-title-button,
.canvas-card-title-input {
  width: 100%;
  min-width: 0;
  padding: 0 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.canvas-card-title-text {
  position: relative;
  z-index: 1;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.canvas-card-title-input {
  outline: none;
}
.canvas-card-title-button.is-rename-unavailable { cursor: default; opacity: .72; }
.canvas-card-action-tab {
  display: grid;
  flex: 0 0 var(--canvas-card-action-width, 29px);
  padding: 0;
  place-items: center;
}
.canvas-card-title-button::before,
.canvas-card-action-tab::before {
  content: "";
  position: absolute;
  inset: 1px;
  background: transparent;
  pointer-events: none;
}
.canvas-card-action-tab:last-child::before {
  inset: 2px;
  border-radius: 0 calc(var(--canvas-card-radius) - 2px) 0 0;
}
.canvas-card-action-tab svg {
  position: relative;
  width: var(--canvas-card-action-icon-size, 14px);
  height: var(--canvas-card-action-icon-size, 14px);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.canvas-card-title-button:not(.is-rename-unavailable):hover,
.canvas-card-title-button:not(.is-rename-unavailable):focus-visible,
.canvas-card-action-tab:hover,
.canvas-card-action-tab:focus-visible {
  color: var(--text-1);
}
/* 悬停反馈走「受光面」配方：ink-3 顶光渐变 + 1px 顶光内影，与浮层/槽位
   同一套语言；图标钮再叠一圈冷边，读成一颗完整的受光小钮。不平涂横条——
   平涂 var(--ink-3) 的悬停条用户已三次点名（2026-09-28 成片左栏、
   2026-10-18 资产卡标题条），判据钉死在 tests/test_card_chrome_hover_static.py；
   本组规则与 index.html 内联分叉逐字同步，漂移即真页面回归。 */
.canvas-card-title-button:not(.is-rename-unavailable):hover::before,
.canvas-card-title-button:not(.is-rename-unavailable):focus-visible::before {
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--ink-3-hi), var(--ink-3));
  box-shadow: inset 0 1px 0 var(--inset-neutral);
}
.canvas-card-action-tab:hover::before,
.canvas-card-action-tab:focus-visible::before {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, var(--ink-3-hi), var(--ink-3)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-neutral);
}
.canvas-card-action-tab:last-child:is(:hover, :focus-visible)::before {
  border-radius: 0 calc(var(--canvas-card-radius) - 2px) 0 0;
}
/* Hover stays in this clipped DOM interaction layer. The complete card frame,
   including its rail, is owned by one Konva rect underneath. */
.canvas-card-chrome.is-hovered::before {
  background: linear-gradient(180deg, var(--ink-3-hi), var(--ink-3));
  box-shadow: inset 0 1px 0 var(--inset-neutral);
}
.canvas-card-chrome.is-selected {
  color: var(--canvas-card-foreground, var(--warm-1));
}
.canvas-card-popover {
  position: absolute;
  z-index: calc(var(--canvas-card-chrome-z-ceiling) + 1);
  box-sizing: border-box;
  display: grid;
  gap: 7px;
  padding: 8px;
  /* 浮层本身也是一块受光的面：整块一条渐变，边框上亮下暗。 */
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, var(--ink-1-hi), var(--ink-1)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-neutral), var(--shadow-lg);
  color: var(--text-1);
  pointer-events: auto;
}
.canvas-card-popover[hidden] { display: none; }
.canvas-card-popover.is-structure-workbench {
  max-height: min(82vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.canvas-card-popover.is-structure-workbench :is(
  .canvas-structure-field,
  .canvas-structure-readonly-value,
  .canvas-structure-workbench-section,
  .canvas-structure-workbench-action-reason,
  .canvas-structure-workbench-quote
) {
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: pre-wrap;
}
.canvas-card-popover-row { min-width: 0; }
/* 浮层里每个被 JS 用 hidden 切换的区域，都必须有这条配对规则。
   显式 display 会盖过 hidden 属性的浏览器默认值：没有这条，
   上一张卡留下的参考位按钮会在一张没有参考位的卡上原样露出来（跨项目也一样）。 */
.canvas-card-popover-slots[hidden] { display: none; }
.canvas-card-popover-slots {
  display: flex;
  min-height: 28px;
  gap: 12px;
  overflow: visible;
  flex-wrap: wrap;
}
.canvas-card-popover-slot-group {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  min-width: 0;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  flex-wrap: nowrap;
}
.canvas-card-popover-slot-group.is-connection-highlighted {
  border-color: var(--canvas-reference-slot-group-hover-border);
  background: var(--canvas-reference-slot-group-hover-wash);
}
.canvas-card-popover-slot {
  flex: 0 0 auto;
  position: relative;
  box-sizing: border-box;
  width: 88px;
  height: 78px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  /* lit 结构：面上一条渐变 + 边框上亮下暗 + 内侧一线受光。
     温度轴：冷=待命，暖=已接进这次生成；明暗轴：选中/可投放才提亮。 */
  --lit-surf-hi: var(--ink-2-hi); --lit-surf: var(--ink-2);
  --lit-edge-hi: var(--edge-cool-hi); --lit-edge-mid: var(--edge-cool-mid); --lit-edge-lo: var(--edge-cool-lo);
  --lit-inset: var(--inset-neutral); --lit-glow: 0 0 0 0 transparent;
  background:
    linear-gradient(180deg, var(--lit-surf-hi), var(--lit-surf)) padding-box,
    linear-gradient(180deg, var(--lit-edge-hi), var(--lit-edge-mid) 45%, var(--lit-edge-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--lit-inset), var(--lift-1), var(--lit-glow);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  overflow-wrap: normal;
  cursor: pointer;
}
.canvas-reference-slot-main {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  cursor: inherit;
}
.canvas-reference-slot-main:focus-visible {
  outline: 2px solid var(--edge-cool-sel-hi);
  outline-offset: -2px;
}
.canvas-card-popover-slot.is-compatible {
  border-width: 2px;
  --lit-surf-hi: var(--ink-3-hi); --lit-surf: var(--ink-3);
  --lit-edge-hi: var(--edge-cool-sel-hi); --lit-edge-mid: var(--edge-cool-sel-mid); --lit-edge-lo: var(--edge-cool-sel-lo);
  --lit-inset: var(--inset-cool); --lit-glow: var(--glow-cool);
  color: var(--text-1);
}
.canvas-card-popover-slot.is-incompatible,
.canvas-card-popover-slot.is-full {
  --lit-surf-hi: var(--ink-4); --lit-surf: var(--ink-4);
  --lit-edge-hi: var(--line-2); --lit-edge-mid: var(--line-2); --lit-edge-lo: var(--line-1);
  --lit-inset: transparent;
  color: var(--text-3);
}
.canvas-card-popover-slot.is-incompatible { cursor: not-allowed; }
.canvas-card-popover-slot.is-occupied {
  /* 已接进这次生成 = 在起作用 = 暖 */
  --lit-surf-hi: var(--surface-warm-hi); --lit-surf: var(--surface-warm);
  --lit-edge-hi: var(--edge-warm-hi); --lit-edge-mid: var(--edge-warm-mid); --lit-edge-lo: var(--edge-warm-lo);
  --lit-inset: var(--inset-warm);
}
.canvas-card-popover-slot.is-occupied:not(.is-incompatible):hover,
.canvas-card-popover-slot.is-occupied:not(.is-incompatible):focus-visible {
  --lit-surf-hi: var(--surface-warm-sel-hi); --lit-surf: var(--surface-warm-sel);
  --lit-edge-hi: var(--edge-warm-sel-hi); --lit-edge-mid: var(--edge-warm-sel-mid); --lit-edge-lo: var(--edge-warm-sel-lo);
}
.canvas-card-popover-slot.is-picking {
  --lit-surf-hi: var(--surface-warm-sel-hi); --lit-surf: var(--surface-warm-sel);
  --lit-edge-hi: var(--edge-warm-sel-hi); --lit-edge-mid: var(--edge-warm-sel-mid); --lit-edge-lo: var(--edge-warm-sel-lo);
  --lit-inset: var(--inset-warm); --lit-glow: var(--glow-ring-warm);
}
.canvas-card-popover-slot.is-connection-highlighted {
  border-color: var(--canvas-reference-slot-hover-border);
  box-shadow: 0 0 0 2px var(--canvas-reference-slot-hover-ring);
}
.canvas-reference-slot-content {
  position: absolute;
  z-index: 2;
  inset: 3px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  min-width: 0;
  pointer-events: none;
}
/* reference-slot-affordance:start */
.canvas-reference-slot-index,
.canvas-reference-slot-plus,
.canvas-reference-slot-remove {
  position: absolute;
  top: 3px;
  box-sizing: border-box;
  display: grid;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  /* 「边框默认透明」在这里不成立：这三个控件浮在用户上传的任意缩略图上，
     底图可能很亮也可能很暗，所以半透明底板之外还需要一条实边把自己从
     图像里切出来。这是设计法则里"控件压在不可预测的内容上"的例外。 */
  border: 1px solid var(--line-3);
  border-radius: var(--radius-sm);
  /* 86% 的底板在很亮的缩略图上会被透上来的白冲淡，图标对底板只剩 2.9:1；
     92% + 正文色图标把暗图/亮图两种极端拉到 6.7:1 / 4.7:1，观感几乎不变。 */
  background: color-mix(in srgb, var(--ink-4) 92%, transparent);
  color: var(--text-1);
  font: 700 11px/1 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  text-align: center;
  opacity: .72;
}
.canvas-reference-slot-index {
  z-index: 2;
  left: 3px;
}
/* reference-slot-affordance:end */
.canvas-reference-slot-thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--edge-warm-hi);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
  object-fit: contain;
}
.canvas-reference-slot-name {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 1px 3px 0;
  overflow: hidden;
  color: currentColor;
  font: 600 9px/13px Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.canvas-reference-slot-empty-icon {
  align-self: stretch;
  justify-self: stretch;
  color: var(--text-2);
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px dashed color-mix(in srgb, var(--edge-cool-sel-hi) 70%, transparent);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--edge-cool-sel-hi) 12%, transparent),
      color-mix(in srgb, var(--ink-4) 88%, transparent));
}
.canvas-reference-slot-representation {
  color: var(--warm-1);
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  place-items: center;
  border: 1px solid var(--edge-warm-hi);
  border-radius: var(--radius-sm);
  background: var(--surface-warm);
}
.canvas-reference-slot-empty-icon .canvas-reference-slot-media-icon {
  width: var(--canvas-reference-slot-icon-size, 26px);
  height: var(--canvas-reference-slot-icon-size, 26px);
}
.canvas-reference-slot-representation .canvas-reference-slot-media-icon {
  width: 30px;
  height: 30px;
}
.canvas-reference-slot-empty-icon.video,
.canvas-reference-slot-representation.video { color: var(--info); }
.canvas-reference-slot-empty-icon.audio,
.canvas-reference-slot-representation.audio { color: var(--ok); }
.canvas-reference-slot-media-icon {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.canvas-reference-slot-media-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}
/* reference-slot-affordance:start */
.canvas-reference-slot-plus,
.canvas-reference-slot-remove {
  right: 3px;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}
.canvas-reference-slot-affordance-icon {
  display: block;
  width: 11px;
  height: 11px;
  overflow: visible;
}
.canvas-reference-slot-affordance-icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}
.canvas-reference-slot-remove {
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
}
.canvas-reference-slot-plus {
  z-index: 3;
  pointer-events: auto;
  cursor: pointer;
}
.canvas-card-popover-slot.is-vacant:not(.is-incompatible):hover .canvas-reference-slot-plus,
.canvas-card-popover-slot.is-vacant:not(.is-incompatible):focus-within .canvas-reference-slot-plus,
.canvas-reference-slot-remove:hover,
.canvas-reference-slot-remove:focus-visible {
  opacity: 1;
}
.canvas-card-popover-slot.is-vacant:not(.is-incompatible):hover .canvas-reference-slot-plus,
.canvas-card-popover-slot.is-vacant:not(.is-incompatible):focus-within .canvas-reference-slot-plus {
  border-color: color-mix(in srgb, var(--canvas-reference-slot-hover-border) 68%, transparent);
  background: color-mix(in srgb, var(--ink-0) 64%, transparent);
  color: var(--canvas-reference-slot-hover-border);
}
.canvas-reference-slot-remove:hover,
.canvas-reference-slot-remove:focus-visible {
  border-color: color-mix(in srgb, var(--bad) 54%, var(--text-2));
  background: color-mix(in srgb, var(--bad) 24%, var(--ink-0));
  color: color-mix(in srgb, var(--bad) 45%, var(--text-2));
}
/* reference-slot-affordance:end */
.canvas-card-popover-structure-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.canvas-card-popover-structure-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}
.canvas-card-popover-structure-actions[hidden] { display: none; }
.canvas-card-popover-structure-workbench[hidden] { display: none; }
.canvas-card-popover-structure-workbench {
  display: grid;
  gap: 8px;
}
.canvas-structure-workbench-section {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-1);
}
.canvas-structure-workbench-section h4 {
  margin: 0;
  color: var(--text-2);
  font: 650 11px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-preview {
  display: grid;
  width: 100%;
  min-height: 96px;
  max-height: 260px;
  overflow: hidden;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--ink-4);
}
.canvas-structure-workbench-preview img,
.canvas-structure-workbench-preview video {
  display: block;
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}
.canvas-structure-workbench-inline-actions {
  display: flex;
  min-width: 0;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.canvas-structure-workbench-inline-actions select,
.canvas-structure-workbench-control-grid select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid var(--edge-cool-mid);
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
}
.canvas-structure-workbench-inline-actions select { width: auto; }
.canvas-structure-workbench-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.canvas-structure-workbench-control-grid label,
.canvas-structure-workbench-prompts label {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--text-3);
  font: 600 10px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-prompts {
  display: grid;
  gap: 7px;
}
.canvas-structure-workbench-facts {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-inline-start: 20px;
  color: var(--text-2);
  font: 500 11px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  white-space: normal;
}
.canvas-structure-workbench-facts .is-blocking { color: var(--bad); }
.canvas-structure-workbench-prompts textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  padding: 7px;
  resize: none;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  font: 500 11px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-project-rewrite,
.canvas-structure-workbench-project-rewrite label,
.canvas-structure-workbench-section > label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--text-3);
  font: 600 10px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-project-rewrite select,
.canvas-structure-workbench-project-rewrite textarea,
.canvas-structure-workbench-section > label textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 7px;
  border: 1px solid var(--edge-cool-mid);
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
}
.canvas-structure-workbench-project-rewrite textarea,
.canvas-structure-workbench-section > label textarea {
  min-height: 96px;
  resize: none;
  overflow: hidden;
}
.canvas-structure-workbench-action {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 4px 7px;
  align-items: center;
}
.canvas-structure-workbench-action-reason {
  grid-column: 1 / -1;
  color: var(--text-3);
  font: 500 10px/1.4 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-quote {
  justify-self: end;
  color: var(--text-2);
  font: 650 10px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-workbench-inline-actions .canvas-structure-workbench-action {
  display: contents;
}
.canvas-structure-workbench-inline-actions a.canvas-card-popover-button {
  display: inline-flex;
  min-height: 30px;
  padding: 0 10px;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.canvas-structure-operation {
  width: 100%;
  min-height: 30px;
}
.canvas-card-popover-structure-fields[hidden] { display: none; }
.canvas-structure-field {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--text-3);
  font: 600 10px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-field.full { grid-column: 1 / -1; }
.canvas-structure-field input,
.canvas-structure-field textarea {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  font: 500 11px/1.4 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-structure-field textarea { min-height: 74px; resize: none; overflow: hidden; }
.canvas-structure-field input:focus,
.canvas-structure-field textarea:focus {
  border-color: var(--edge-cool-sel-hi);
  outline: none;
}
.canvas-structure-field-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.canvas-card-popover.is-audio-generator {
  max-height: min(80vh, 720px);
  overflow-y: auto;
}
.canvas-card-popover-audio[hidden] { display: none; }
.canvas-card-popover-audio,
.canvas-card-popover-audio fieldset,
.canvas-card-popover-audio-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}
.canvas-card-popover-audio fieldset {
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
}
.canvas-card-popover-audio legend,
.canvas-card-popover-audio-field > span {
  color: var(--text-2);
  font-size: 11px;
}
.canvas-card-popover-audio :is(select, input:not([type="checkbox"]), .canvas-card-popover-audio-text) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 6px 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  font: 12px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-audio-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: visible;
}
.canvas-card-popover-prompt-editor[hidden] { display: none; }
.canvas-card-popover-prompt-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}
.canvas-card-popover-prompt-editor.has-polarity {
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px;
}
.canvas-card-popover-prompt-tabs {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
.canvas-card-popover-prompt-tabs[hidden] { display: none; }
.canvas-card-popover-controls[hidden] { display: none; }
.canvas-card-popover-text-body-editor[hidden],
.canvas-card-popover-text-body-controls[hidden] { display: none; }
.canvas-card-popover-prompt-tab {
  min-width: 42px;
  min-height: 25px;
  height: auto;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  color: var(--text-3);
  font: 11px/1 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-prompt-tab.is-active {
  background:
    linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel)) padding-box,
    linear-gradient(180deg, var(--edge-warm-sel-hi), var(--edge-warm-sel-mid) 45%, var(--edge-warm-sel-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm);
  color: var(--warm-1);
  font-weight: 600;
}
.canvas-card-popover-prompt {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  /* 凹面输入位：渐变方向与全站一致（上亮下暗），凹陷只靠内阴影表达。 */
  background:
    linear-gradient(180deg, var(--ink-4), var(--ink-4-lo)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow: var(--sink-1);
  color: var(--text-1);
  padding: 6px 7px;
  font: 12px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.canvas-card-popover-prompt:focus { outline: none; }
.canvas-card-popover-prompt:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
}
/* 正文是产物，提示词是请求：两个面各有各的身份，绝不共用类名。
   两者的输入位长得一样，所以样式照抄提示词位，只是归属不同。 */
.canvas-card-popover-text-body-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
}
.canvas-card-popover-text-body {
  box-sizing: border-box;
  width: 100%;
  min-height: 54px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, var(--ink-4), var(--ink-4-lo)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow: var(--sink-1);
  color: var(--text-1);
  padding: 6px 7px;
  font: 12px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.canvas-card-popover-text-body:focus { outline: none; }
.canvas-card-popover-text-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
}
.canvas-card-popover-prompt[data-refining="true"] {
  cursor: wait;
  opacity: .65;
}
	.canvas-prompt-mention {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 1.24em;
  max-width: 100%;
  margin: 0 .12em;
  padding: 0 .36em 0 .18em;
  gap: .22em;
  vertical-align: -0.06em;
  overflow: hidden;
  border: 1px solid var(--edge-warm-sel-mid);
  border-radius: 999px;
  background: var(--surface-warm-sel);
  color: var(--text-1);
  font: inherit;
  font-size: .86em;
  font-weight: 600;
  line-height: 1;
	  user-select: all;
	  cursor: pointer;
	}
	.canvas-prompt-mention:focus-visible {
	  outline: 2px solid var(--edge-cool-sel-hi);
	  outline-offset: 1px;
	}
.canvas-prompt-mention.is-unavailable {
  border-color: var(--bad-line);
  background: var(--bad-wash);
  color: var(--text-1);
  padding-right: 1px;
}
.canvas-prompt-mention-label {
  overflow: hidden;
  max-width: 14em;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}
.canvas-prompt-mention-thumbnail {
  display: block;
  flex: none;
  width: .92em;
  height: .92em;
  border-radius: 50%;
  object-fit: contain;
}
.canvas-prompt-mention-remove {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: .92em;
  height: .92em;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bad);
  font: inherit;
  font-size: .95em;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.canvas-prompt-mention-remove:hover,
.canvas-prompt-mention-remove:focus-visible { background: color-mix(in srgb, var(--bad-line) 22%, transparent); }
.canvas-prompt-mention-choice-thumbnail {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: contain;
}
.canvas-prompt-mention-choice {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  color: var(--text-1);
  text-align: left;
  font: 11px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-prompt-mention-choice:hover,
.canvas-prompt-mention-choice:focus-visible {
  border-color: var(--edge-cool-sel-hi);
  background: var(--ink-3);
  outline: none;
}
	.canvas-prompt-mention-empty {
	  margin: 0;
	  color: var(--text-3);
	  font: 11px/1.45 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
	}
		.agent-reference-prompt-section {
		  display: flex;
		  flex-direction: column;
		  gap: .3333rem;
		}
		.agent-reference-prompt-section > h3,
		.video-dev-prompt-section > h3 {
		  margin: 0;
		  color: var(--text-2);
		  font-size: var(--type-label);
		  font-weight: 600;
		  line-height: 1.35;
		}
		/* 滚动法条（2026-09-12）：提示词编辑器是 contenteditable，天生随内容长高；
		   旧的 max-height:12.2222rem + overflow:auto 内滚窗口废止——高度由内容
		   决定、完整显示，装不下交给所在页的唯一一级滚动区。 */
		.agent-reference-prompt-editor {
		  box-sizing: border-box;
		  width: 100%;
		  min-height: 4.8889rem;
		  border: 1px solid transparent;
		  border-radius: var(--radius-md);
	  background:
	    linear-gradient(180deg, var(--ink-4), var(--ink-4-lo)) padding-box,
	    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
		  box-shadow: var(--sink-1);
		  color: var(--text-1);
		  padding: .4444rem .5rem;
		  font-size: var(--type-label);
		  line-height: 1.45;
		  white-space: pre-wrap;
		  overflow-wrap: anywhere;
		}
	.agent-reference-prompt-editor:focus { outline: none; }
	.agent-reference-prompt-editor:empty::before {
	  content: attr(data-placeholder);
	  color: var(--text-3);
	  pointer-events: none;
	}
		.agent-reference-dialog {
		  display: grid;
		  gap: .5556rem;
		  min-width: min(30rem, 78vw);
		}
		/* [P-REFPICK] 统一引用弹窗专属尺寸：大窗尽量占满浏览器；滚动沿用
		   .app-dialog 唯一滚动区（滚动法条 2026-09-12），组网格 auto-fill 铺满。
		   普通 app-dialog 尺寸不变（同组控件同形）。 */
	.app-dialog--reference {
	  width: min(72rem, 94vw);
	  max-height: min(52rem, 90vh);
	}
	/* 参考图画面框弹窗（2026-10-12 用户令；2026-10-14 用户令改版）：弹窗纵向
	   弹性布局把余高全给舞台，图片 contain 内接完整可见、弹窗不滚动（不再上下
	   拖动找图）；舞台留白加宽给拖框/补黑边操作空间，框内=裁剪保留，框越出图片
	   的部分舞台底就是黑（补黑边），框外图片区域压暗。绿框比例一致可确认，红框
	   只能取消（确认键置灰走全站禁用钮规范：opacity 0.65 + not-allowed）。
	   拦截原因提示条置顶一开窗可见；图片解码前给加载态，失败给明示，不静默空白。 */
	.app-dialog--reference-frame {
	  width: min(64rem, 94vw);
	  max-height: min(94vh, 64rem);
	  display: flex;
	  flex-direction: column;
	}
	.app-dialog--reference-frame .app-dialog-head {
	  flex: 1 1 auto;
	  min-height: 0;
	  display: flex;
	  flex-direction: column;
	}
	.app-dialog--reference-frame .app-dialog-body {
	  flex: 1 1 auto;
	  min-height: 0;
	  display: flex;
	  flex-direction: column;
	}
	.app-dialog--reference-frame .app-dialog-form,
	.app-dialog--reference-frame .app-dialog-error,
	.app-dialog--reference-frame .app-dialog-actions {
	  flex: 0 0 auto;
	}
	.app-dialog--reference-frame .app-dialog-confirm:disabled {
	  opacity: 0.65;
	  cursor: not-allowed;
	}
	.reference-frame-dialog {
	  display: flex;
	  flex-direction: column;
	  gap: 0.5rem;
	  flex: 1 1 auto;
	  min-height: 0;
	}
	.reference-frame-reason {
	  margin: 0;
	  flex: 0 0 auto;
	  padding: 0.5556rem 0.7778rem;
	  border: 1px solid var(--bad-line);
	  background: var(--bad-wash);
	  border-radius: 0.3333rem;
	  color: var(--text-1);
	  font-size: var(--type-label);
	  font-weight: 750;
	  line-height: 1.4;
	}
	.reference-frame-stage {
	  position: relative;
	  width: 100%;
	  height: auto;
	  min-height: 12rem;
	  flex: 1 1 auto;
	  background: #000;
	  border-radius: 0.3333rem;
	  overflow: hidden;
	  touch-action: none;
	}
	.reference-frame-canvas { position: absolute; inset: 0; }
	.reference-frame-image {
	  position: absolute;
	  display: block;
	  user-select: none;
	  -webkit-user-drag: none;
	  /* 图片解码完成前不显示：既不给原尺寸闪现，也不给半张空白。 */
	  visibility: hidden;
	}
	.reference-frame-stage[data-image-state="ready"] .reference-frame-image { visibility: visible; }
	.reference-frame-loading {
	  position: absolute;
	  inset: 0;
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  gap: 0.5556rem;
	  color: #fff;
	  font-size: var(--type-label);
	}
	.reference-frame-stage[data-image-state="ready"] .reference-frame-loading { display: none; }
	.reference-frame-stage[data-image-state="failed"] .spinner { display: none; }
	.reference-frame-shade {
	  position: absolute;
	  background: rgba(0, 0, 0, 0.62);
	  pointer-events: none;
	}
	.reference-frame-box {
	  position: absolute;
	  box-sizing: border-box;
	  border: 2px solid var(--bad);
	  cursor: move;
	  touch-action: none;
	}
	.reference-frame-box.is-green { border-color: var(--ok); }
	.reference-frame-box.is-red { border-color: var(--bad); }
	.reference-frame-handle {
	  position: absolute;
	  width: 0.6rem;
	  height: 0.6rem;
	  box-sizing: border-box;
	  background: #fff;
	  border: 1px solid rgba(0, 0, 0, 0.65);
	  border-radius: 0.0833rem;
	}
	.reference-frame-handle[data-reference-frame-handle="nw"] { left: -0.3rem; top: -0.3rem; cursor: nwse-resize; }
	.reference-frame-handle[data-reference-frame-handle="n"] { left: calc(50% - 0.3rem); top: -0.3rem; cursor: ns-resize; }
	.reference-frame-handle[data-reference-frame-handle="ne"] { right: -0.3rem; top: -0.3rem; cursor: nesw-resize; }
	.reference-frame-handle[data-reference-frame-handle="e"] { right: -0.3rem; top: calc(50% - 0.3rem); cursor: ew-resize; }
	.reference-frame-handle[data-reference-frame-handle="se"] { right: -0.3rem; bottom: -0.3rem; cursor: nwse-resize; }
	.reference-frame-handle[data-reference-frame-handle="s"] { left: calc(50% - 0.3rem); bottom: -0.3rem; cursor: ns-resize; }
	.reference-frame-handle[data-reference-frame-handle="sw"] { left: -0.3rem; bottom: -0.3rem; cursor: nesw-resize; }
	.reference-frame-handle[data-reference-frame-handle="w"] { left: -0.3rem; top: calc(50% - 0.3rem); cursor: ew-resize; }
	.reference-frame-facts {
	  margin: 0;
	  color: var(--text-1);
	  font-size: var(--type-label);
	  line-height: 1.4;
	}
	.reference-frame-hint {
	  margin: 0;
	  color: var(--text-3);
	  font-size: var(--type-meta);
	  line-height: 1.4;
	}
	.agent-reference-choice-groups {
	  display: grid;
	  gap: .8889rem;
	}
	/* 两层分区框体（2026-10-13 用户令）：第一层开发流程组用粗一点亮一点的
	   框（2px 亮边 + 抬升底），第二层媒体类型用细一点暗一点的框（1px 暗边），
	   层级一眼可读，不再靠两行同字号文字标签区分。 */
	.agent-reference-group {
	  display: grid;
	  gap: .5556rem;
	  border: 2px solid var(--edge-cool-sel-mid);
	  border-radius: var(--radius-md);
	  background: var(--ink-1);
	  padding: .6667rem;
	}
	.agent-reference-group-title {
	  margin: 0;
	  color: var(--text-1);
	  font-size: var(--type-label);
	  font-weight: 700;
	  line-height: 1.35;
	}
	/* 第二层：媒体类型子分组（图片/视频/音频）。小标签轻一级，不与组标题争层级。 */
	.agent-reference-kind {
	  display: grid;
	  gap: .3333rem;
	  border: 1px solid var(--edge-cool-mid);
	  border-radius: var(--radius-sm);
	  background: var(--ink-2);
	  padding: .5rem;
	}
	.agent-reference-kind-title {
	  margin: 0;
	  color: var(--text-3);
	  font-size: var(--type-meta);
	  font-weight: 600;
	  line-height: 1.3;
	}
	/* 滚动法条（2026-09-12）：素材网格不自带滚动层，随内容长高，
	   由外层 .app-dialog 唯一滚动区整把滚。 */
	.agent-reference-choice-list {
		  display: grid;
		  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
		  gap: .4444rem;
		}
		.agent-reference-choice {
		  display: grid;
		  grid-template-columns: 2.4444rem minmax(0, 1fr);
		  align-items: center;
		  gap: .4444rem;
		  min-height: 3rem;
		  padding: .3333rem;
		  border: 1px solid var(--edge-cool-mid);
	  border-radius: var(--radius-md);
		  background: var(--ink-2);
		  color: var(--text-1);
		  text-align: left;
		  font-size: var(--type-label);
		  line-height: 1.35;
		  cursor: pointer;
		}
	.agent-reference-choice:hover,
	.agent-reference-choice:focus-visible {
	  border-color: var(--edge-cool-sel-hi);
	  background: var(--ink-3);
	  outline: none;
	}
	.agent-reference-choice:disabled {
	  cursor: not-allowed;
	  opacity: .55;
	}
	.agent-reference-choice.is-selected {
	  border-color: var(--edge-warm-sel-mid);
	  background: var(--surface-warm-sel);
	}
	.agent-reference-choice-media {
		  display: grid;
		  place-items: center;
		  width: 2.4444rem;
		  height: 2.4444rem;
		  overflow: hidden;
	  border-radius: var(--radius-sm);
	  background: var(--ink-1);
	}
	.agent-reference-choice-media img,
	.agent-reference-choice-media video {
	  width: 100%;
	  height: 100%;
	  object-fit: cover;
	}
	/* 音频没有画面：行缩略与悬停浮层都用音符占位（同组同形）。 */
	.agent-reference-choice-media-glyph {
	  color: var(--text-3);
	  font-size: var(--type-heading);
	  line-height: 1;
	}
	/* 悬停大图预览（统一引用窗口）：单例浮层常驻 body，显示只切透明度与
	   轻微缩放（约 0.16s），不抢指针事件；定宽定高让定位在媒体加载前就稳。 */
	.agent-reference-hover-preview {
	  position: fixed;
	  z-index: 3100;
	  display: grid;
	  grid-template-rows: minmax(0, 1fr) auto;
	  width: min(26rem, 42vw);
	  height: min(20rem, 44vh);
	  overflow: hidden;
	  border: 1px solid var(--edge-cool-mid);
	  border-radius: var(--radius-md);
	  background: var(--ink-1);
	  box-shadow: 0 18px 48px var(--ink-scrim);
	  opacity: 0;
	  transform: scale(.97);
	  transition: opacity .16s ease, transform .16s ease;
	  pointer-events: none;
	}
	.agent-reference-hover-preview.is-visible {
	  opacity: 1;
	  transform: scale(1);
	}
	.agent-reference-hover-preview img,
	.agent-reference-hover-preview video {
	  width: 100%;
	  height: 100%;
	  object-fit: contain;
	  min-height: 0;
	}
	.agent-reference-hover-preview-glyph {
	  display: grid;
	  place-items: center;
	  color: var(--text-3);
	  font-size: var(--type-display);
	  line-height: 1;
	}
	.agent-reference-hover-preview-title {
	  display: block;
	  overflow: hidden;
	  max-height: 2.2rem;
	  padding: .3333rem .5556rem;
	  border-top: 1px solid var(--edge-cool-mid);
	  background: var(--ink-2);
	  color: var(--text-2);
	  font-size: var(--type-meta);
	  line-height: 1.35;
	  text-overflow: ellipsis;
	  white-space: nowrap;
	}
		.agent-reference-choice-copy {
		  display: grid;
		  gap: .1111rem;
		  min-width: 0;
		}
	.agent-reference-choice-copy span,
	.agent-reference-choice-copy small {
	  overflow: hidden;
	  text-overflow: ellipsis;
	  white-space: nowrap;
	}
		.agent-reference-choice-copy small {
		  color: var(--text-3);
		  font-size: var(--type-meta);
		  line-height: 1.3;
		}
.canvas-card-popover-controls,
.canvas-card-popover-text-body-controls {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  gap: 5px;
  align-items: center;
}
.canvas-card-popover-button {
  box-sizing: border-box;
  /* 动作按钮按自己的文字取宽，且不参与压缩：被压缩的只能是上面那两个
     带 title 的标签按钮，"生成/再来一版 ⚡xxx" 必须完整可读。 */
  flex: 0 0 auto;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  --lit-surf-hi: var(--ink-2-hi); --lit-surf: var(--ink-2);
  --lit-edge-hi: var(--edge-cool-hi); --lit-edge-mid: var(--edge-cool-mid); --lit-edge-lo: var(--edge-cool-lo);
  --lit-inset: var(--inset-neutral); --lit-glow: 0 0 0 0 transparent;
  background:
    linear-gradient(180deg, var(--lit-surf-hi), var(--lit-surf)) padding-box,
    linear-gradient(180deg, var(--lit-edge-hi), var(--lit-edge-mid) 45%, var(--lit-edge-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--lit-inset), var(--lift-1), var(--lit-glow);
  color: var(--text-1);
  font: 11px Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  text-overflow: clip;
  white-space: nowrap;
}
/* 操作按钮永远是一排：换行是被禁止的状态，不是"窄了就退让"的兜底。
   这两个标签按钮的 flex-basis 是 0，所以它们的内容长度不参与"这一行放不放
   得下"的判断——四个按钮的假想宽度加起来永远小于行宽，行就永远不会拆。
   实际宽度由 JS 写的 flex-grow（=各自文字的自然宽度）按比例分配：浮层够宽
   时两个都拿到完整文字并把整行填满（右边不留豁口），浮层被封顶后两个按同一
   比例一起收窄，谁也不会独自被挤没，收窄掉的文字仍在 title 里。 */
.canvas-card-popover-model-trigger {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 30px;
  min-height: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  white-space: nowrap;
  overflow-wrap: normal;
}
.canvas-card-popover-settings-trigger {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: 30px;
  min-height: 30px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}
.canvas-card-popover-button.compact { padding-inline: 7px; }
.canvas-card-popover-button.icon-only {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  flex: 0 0 30px;
  padding: 0;
  color: var(--text-1);
}
.canvas-card-popover-button.icon-only svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.canvas-card-popover-button.icon-only:not(:disabled):hover,
.canvas-card-popover-button.icon-only:not(:disabled):focus-visible {
  --lit-surf-hi: var(--ink-3-hi); --lit-surf: var(--ink-3);
  --lit-inset: var(--inset-cool);
  color: var(--text-1);
}
.canvas-card-popover-button.icon-only.is-busy svg {
  animation: canvas-popover-icon-pulse 900ms ease-in-out infinite alternate;
}
@keyframes canvas-popover-icon-pulse {
  from { opacity: .45; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}
.canvas-card-popover-button.primary {
  /* 点下去就会执行 = 在起作用 = 暖，且始终亮框 + 泛光 */
  --lit-surf-hi: var(--surface-warm-sel-hi); --lit-surf: var(--surface-warm-sel);
  --lit-edge-hi: var(--edge-warm-sel-hi); --lit-edge-mid: var(--edge-warm-sel-mid); --lit-edge-lo: var(--edge-warm-sel-lo);
  --lit-inset: var(--inset-warm); --lit-glow: var(--glow-ring-warm);
  color: var(--warm-1);
  font-weight: 700;
}
.canvas-card-popover-button:disabled { opacity: .48; cursor: default; }
/* 就绪警告与润色状态不再进生成参数输入窗（2026-10-16 用户令）：它们的家是
   卡片上方的通知条（.canvas-card-notice-strip），这两条样式随之退役。 */
.canvas-card-popover-flyout {
  position: absolute;
  z-index: 2;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, var(--ink-1-hi), var(--ink-1)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-neutral), var(--shadow-md);
}
.canvas-card-popover-flyout[hidden] { display: none; }
.canvas-card-popover-settings { display: grid; gap: 7px; }
.canvas-card-popover-models { display: grid; gap: 7px; min-width: 0; }
.canvas-card-popover-chooser-title {
  margin: 0;
  color: var(--text-2);
  font: 600 11px/1.4 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-settings-section { display: grid; gap: 6px; }
.canvas-card-popover-settings-section + .canvas-card-popover-settings-section {
  padding-top: 7px;
  border-top: 1px solid var(--line-2);
}
.canvas-card-popover-settings-section > strong,
.canvas-card-popover-duration-header > strong {
  color: var(--text-2);
  font: 700 11px/1.2 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-resolution-section { gap: 7px; }
.canvas-card-popover-resolution-section > .canvas-card-popover-choice-grid + .canvas-card-popover-choice-grid {
  margin-top: 2px;
}
.canvas-card-popover-choice-grid {
  display: flex;
  gap: 5px;
  align-items: stretch;
  flex-wrap: wrap;
}
.canvas-card-popover-choice {
  box-sizing: border-box;
  min-width: 30px;
  min-height: 30px;
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  --lit-surf-hi: var(--ink-2-hi); --lit-surf: var(--ink-2);
  --lit-edge-hi: var(--edge-cool-hi); --lit-edge-mid: var(--edge-cool-mid); --lit-edge-lo: var(--edge-cool-lo);
  --lit-inset: var(--inset-neutral); --lit-glow: 0 0 0 0 transparent;
  background:
    linear-gradient(180deg, var(--lit-surf-hi), var(--lit-surf)) padding-box,
    linear-gradient(180deg, var(--lit-edge-hi), var(--lit-edge-mid) 45%, var(--lit-edge-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--lit-inset), var(--lift-1), var(--lit-glow);
  color: var(--text-2);
  font: 700 11px/1.3 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-choice:hover,
.canvas-card-popover-choice:focus-visible {
  --lit-surf-hi: var(--ink-3-hi); --lit-surf: var(--ink-3);
  --lit-inset: var(--inset-cool);
  color: var(--text-1);
}
.canvas-card-popover-choice.is-selected {
  --lit-surf-hi: var(--surface-warm-sel-hi); --lit-surf: var(--surface-warm-sel);
  --lit-edge-hi: var(--edge-warm-sel-hi); --lit-edge-mid: var(--edge-warm-sel-mid); --lit-edge-lo: var(--edge-warm-sel-lo);
  --lit-inset: var(--inset-warm); --lit-glow: var(--glow-ring-warm);
  color: var(--warm-1);
}
.canvas-card-popover-choice.is-currently-unavailable {
  opacity: .48;
}
.canvas-card-popover-duration-section { gap: 8px; }
.canvas-card-popover-duration-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.canvas-card-popover-duration-value {
  color: var(--warm-1);
  font: 700 11px/1.2 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
}
.canvas-card-popover-duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 180px;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.canvas-card-popover-duration-slider:focus-visible { outline: none; }
.canvas-card-popover-duration-slider::-webkit-slider-runnable-track {
  height: 6px;
  border: 1px solid var(--edge-cool-lo);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ink-2), var(--ink-2-hi));
  box-shadow: inset 0 1px 0 var(--inset-cool);
}
.canvas-card-popover-duration-slider::-moz-range-track {
  height: 6px;
  border: 1px solid var(--edge-cool-lo);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ink-2), var(--ink-2-hi));
  box-shadow: inset 0 1px 0 var(--inset-cool);
}
.canvas-card-popover-duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 1px solid var(--edge-warm-sel-mid);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel));
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm);
}
.canvas-card-popover-duration-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 1px solid var(--edge-warm-sel-mid);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel));
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm);
}
.canvas-card-popover-duration-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm), 0 0 0 2px var(--edge-warm-sel-hi);
}
.canvas-card-popover-duration-slider:focus-visible::-moz-range-thumb {
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm), 0 0 0 2px var(--edge-warm-sel-hi);
}
.canvas-card-popover-model-section .canvas-card-popover-choice-grid {
  display: grid;
  grid-template-columns: repeat(var(--canvas-model-choice-columns, 1), var(--canvas-model-choice-width, max-content));
  width: max-content;
}
.canvas-card-popover-model-section {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
.canvas-card-popover-model-section .canvas-card-popover-choice {
  width: var(--canvas-model-choice-width, max-content);
  min-width: var(--canvas-model-choice-width, max-content);
  height: auto;
  white-space: nowrap;
  overflow: visible;
  overflow-wrap: normal;
  text-align: center;
}
.canvas-candidate-tray {
  position: absolute;
  z-index: 10;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: 34px minmax(0,1fr);
  padding: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--ink-1);
  box-shadow: var(--shadow-lg);
  color: var(--text-1);
  pointer-events: auto;
}
.canvas-candidate-tray-heading {
  grid-column: 1;
  align-self: center;
  color: var(--text-1);
  font: 700 15px/20px Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  letter-spacing: .02em;
  text-align: center;
}
.canvas-candidate-tray-close {
  position: absolute;
  top: 15px;
  right: 5px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  /* Inter first as everywhere; DejaVu Sans named explicitly because the ×
     glyph's advance must not depend on engine font fallback: headless-shell
     and full Chrome resolved bare `sans-serif` differently on the gate image
     (full Chrome landed on a fullwidth CJK ×), which read as a 4px optical
     misalignment of the ink against the candidate grid.  Machines with Inter
     render exactly as before; machines without it now resolve the same
     installed glyph deterministically. */
  font: 400 22px/1 Inter,-apple-system,BlinkMacSystemFont,"DejaVu Sans","Liberation Sans",sans-serif;
  cursor: pointer;
}
.canvas-candidate-tray-close:hover,
.canvas-candidate-tray-close:focus-visible {
  background: var(--ink-3);
  color: var(--text-1);
}
.canvas-candidate-tray-body {
  grid-column: 1;
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--line-1);
  align-content: start;
  justify-content: center;
  overflow-x: hidden;
}
.canvas-candidate-choice {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-0);
  padding: 0;
  color: var(--text-1);
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
/* 高亮画在框内侧：这一格所在的容器会裁掉越界内容，往外扩的描边会被上边缘切掉。 */
.canvas-candidate-choice:not(.is-failed):hover,
.canvas-candidate-choice:not(.is-failed):focus-visible {
  border-color: var(--edge-cool-sel-hi);
  box-shadow: inset 0 0 0 1px var(--edge-cool-sel-hi);
  outline: none;
}
.canvas-candidate-choice.is-failed {
  display: grid;
  place-items: center;
  padding: 0 10px;
  border-style: dashed;
  border-color: var(--bad-line);
  color: var(--bad);
  background: var(--bad-wash);
  cursor: default;
}
.canvas-candidate-choice-status {
  font: 700 12px/1.5 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  text-align: center;
}
.canvas-candidate-choice img,
.canvas-candidate-choice video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.canvas-context-menu-item.danger:not(:disabled) {
  color: var(--bad);
  background: var(--bad-wash);
  box-shadow: inset 2px 0 0 var(--bad);
}
.canvas-context-menu-separator {
  height: 1px;
  margin: 5px 4px;
  background: var(--line-2);
}
.canvas-context-menu-submenu {
  position: relative;
}
.canvas-context-menu-submenu > .submenu-trigger::after {
  content: '›';
  color: var(--text-3);
}
.canvas-context-submenu-panel {
  position: absolute;
  top: -6px;
  left: calc(100% + 4px);
  min-width: 236px;
  padding: 6px;
  display: none;
  gap: 2px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--ink-1);
  box-shadow: var(--shadow-lg);
}
.canvas-context-menu-submenu:hover > .canvas-context-submenu-panel,
.canvas-context-menu-submenu:focus-within > .canvas-context-submenu-panel {
  display: grid;
}
.page { display: none; padding: 1.3333rem 1.5556rem 2.2222rem; min-height: 100%; }
.page.active { display: block; animation: fadeIn 0.3s ease; }
#page-canvas.page {
  height: 100%;
  box-sizing: border-box;
  /* 滚动法条：画布页不滚（弹层浮在它上面，弹层自己才是滚动层）；
     画布随视口收缩，不再用 min-height 把 page-wrap 顶出第二条滚动。 */
  overflow: hidden;
}
/* 页面本身就是滚动容器里的满高内容。给整页做位移动画会把 transform 后的
   visual overflow 算进滚动范围，短暂挤出一条竖滚动条，再在动画结束时收回；
   这会让四个工作台的可用宽度来回变化。页面切换只淡入，不改变布局几何。 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-header { margin-bottom: 1.3333rem; }
.topbar-lead { display: flex; align-items: center; gap: 0.6667rem; min-width: 0; width: 100%; justify-self: start; }
.topbar-trail { min-width: 0; }
.page-title {
  font-size: var(--type-title);
  font-weight: 700;
  letter-spacing: -0.4px;
  display: flex; align-items: center; gap: 0.5556rem;
  margin-bottom: 0.3333rem;
}
.page-title .badge {
  font-size: var(--type-meta);
  padding: 0.1667rem 0.4444rem;
  background: var(--ink-3);
  color: var(--text-1);
  border-radius: 55.5rem;
  font-weight: 600;
}
#page-storyboard {
  padding-right: 0.6667rem;
  padding-left: 0.6667rem;
}
#page-storyboard .page-header {
  margin-bottom: 0.7778rem;
  padding: 0 0.1111rem;
}
.settings-panel {
  max-width: 47.7778rem;
  display: grid;
  gap: 0.8889rem;
}
.settings-section-card {
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--ink-1);
  padding: 1rem;
}
.settings-section-card h2 {
  margin: 0 0 0.3333rem;
  font-size: var(--type-heading);
}
.settings-section-card p {
  color: var(--text-3);
  font-size: var(--type-label);
  line-height: 1.6;
}
.settings-scale { display: flex; align-items: center; gap: 0.8889rem; margin-top: 0.7778rem; }
.settings-scale input[type="range"] { flex: 1 1 auto; min-width: 0; accent-color: var(--edge-cool-sel-mid); }
.settings-scale output {
  flex: 0 0 auto;
  min-width: 3.3333rem;
  text-align: right;
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.pipeline-settings-form {
  display: grid;
  gap: 0.7778rem;
}
.pipeline-settings-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8889rem;
  margin-top: 0.7778rem;
}
.pipeline-settings-column {
  display: grid;
  align-content: start;
  gap: 0.7778rem;
  min-width: 0;
  padding: 0.8889rem;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  background: var(--ink-2);
}
.pipeline-settings-column-title {
  margin: 0;
  color: var(--text-1);
  font-size: var(--type-body);
}
.pipeline-settings-column-unavailable {
  grid-template-rows: auto 1fr auto;
}
@media (max-width: 900px) {
  .pipeline-settings-columns { grid-template-columns: 1fr; }
}
.settings-group {
  display: grid;
  gap: 0.5556rem;
  padding-top: 0.7778rem;
  border-top: 1px solid var(--line-1);
}
.settings-group:first-child {
  padding-top: 0;
  border-top: 0;
}
/* 设置项的长说明一律收进悬停气泡：设置页要能一眼扫完，解释是查阅时才要的东西。 */
#page-settings .page-title,
.settings-section-card h2,
.settings-group-head h3 { display: flex; align-items: center; gap: 0.3333rem; }
.settings-help {
  position: relative;
  flex: 0 0 auto;
  width: 1.1111rem;
  height: 1.1111rem;
  border-radius: 50%;
  border: 1px solid var(--line-1);
  background: var(--ink-3);
  color: var(--text-3);
  font-size: var(--type-meta);
  font-weight: 700;
  line-height: 1;
  padding: 0;
}
.settings-help:hover, .settings-help:focus-visible { color: var(--text-1); border-color: var(--edge-cool-sel-mid); }
.settings-help::after {
  content: attr(data-help);
  position: absolute;
  left: 0;
  /* 往下弹：页面标题就在视口顶端，往上弹会被裁掉。 */
  top: calc(100% + 0.3333rem);
  z-index: 40;
  width: max-content;
  max-width: 22.2222rem;
  padding: 0.4444rem 0.6111rem;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-md);
  background: var(--ink-2);
  box-shadow: var(--lift-1);
  color: var(--text-2);
  font-size: var(--type-meta);
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
}
.settings-help:hover::after, .settings-help:focus-visible::after { opacity: 1; }
.settings-group-head {
  display: grid;
  gap: 0.2222rem;
}
.settings-group-head h3 {
  margin: 0;
  color: var(--text-1);
  font-size: var(--type-label);
}
.settings-group-head p {
  margin: 0;
}
.settings-field {
  display: grid;
  gap: 0.3889rem;
  color: var(--text-2);
  font-size: var(--type-label);
  font-weight: 650;
}
.settings-field select,
.settings-field input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  padding: 0.5556rem;
}
.settings-choice-field { gap: 0.4444rem; }
.settings-choice-label { color: var(--text-3); font-size: var(--type-meta); font-weight: 650; }
.settings-choice-group { display: flex; flex-wrap: wrap; gap: 0.4444rem; }
/* 选择器要压过 .asset-tool-btn：那条规则在本文件里定义在后面，同特异性会赢。
   它的 --ink-2 底色恰好等于设置页分栏底色、边框又是透明的，未选中的按钮会整个隐形。 */
.settings-choice-group .settings-choice-button {
  min-width: 3.7778rem;
  padding-inline: 0.6667rem;
  background: var(--ink-3);
  border-color: var(--edge-cool-mid);
}
.settings-choice-group .settings-choice-button.is-selected {
  background: var(--surface-warm-hi);
  border-color: var(--edge-warm-mid);
  color: var(--warm-1);
}
.settings-choice-group .settings-choice-button:disabled:not(.is-selected) {
  background: var(--ink-2);
  border-color: var(--line-2);
  color: var(--text-3);
}
.settings-empty,
.settings-error {
  color: var(--text-3);
  font-size: var(--type-label);
  line-height: 1.6;
}
.settings-error { color: var(--text-1); }
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4444rem;
}

/* ===== Shared Card ===== */
.card {
  background: var(--ink-1);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 1.1111rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.8889rem; }
.card-title { font-size: var(--type-body); font-weight: 600; display: flex; align-items: center; gap: 0.4444rem; }
.card-title .dot { width: 0.2222rem; height: 0.7778rem; background: var(--line-3); border-radius: var(--radius-sm); }

/* ============================================================ */
/* PAGE 1: PROJECT HUB                                          */
/* ============================================================ */
#page-hub.page {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.hub-dashboard {
  display: grid;
  grid-template-columns: minmax(14rem, 0.8fr) repeat(2, minmax(18rem, 1.35fr));
  gap: 1.1111rem;
  height: 100%;
  min-height: 0;
}
.progress-card,
.hub-media-panel {
  background: var(--ink-1);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  padding: 1.1111rem;
  min-width: 0;
  min-height: 0;
}
.progress-card {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.progress-stat {
  display: flex; align-items: baseline; gap: 0.4444rem;
  margin-bottom: 1.1111rem;
}
.progress-stat .num { font-size: var(--type-display); font-weight: 800; color: var(--text-1); }
.progress-stat .total { color: var(--text-3); font-size: var(--type-heading); }
.progress-stat .unit { color: var(--text-3); font-size: var(--type-label); margin-left: auto; }
.progress-bar { height: 0.3333rem; background: var(--ink-3); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 1rem; }
.progress-bar-fill { height: 100%; width: 0; background: var(--surface-warm-hi); border-radius: var(--radius-sm); }

.stage-list { display: flex; flex-direction: column; gap: 0.5556rem; }
.stage-row {
  display: flex; align-items: center; gap: 0.6667rem;
  padding: 0.5556rem 0.6667rem;
  border-radius: var(--radius-md);
  background: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s;
}
.stage-row:hover { background: var(--ink-3); }
.stage-icon {
  width: 1.3333rem; height: 1.3333rem;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--type-meta);
  font-weight: 700;
  background: var(--ink-3);
  border: 1px solid transparent;
  color: var(--text-3);
}
.stage-icon svg { width: 1rem; height: 1rem; display: block; }
.stage-row.done .stage-icon { background: var(--ok); border-color: transparent; color: var(--text-1); }
.stage-row.current .stage-icon { background: var(--surface-warm-hi); border-color: var(--edge-warm-mid); color: var(--warm-1); box-shadow: none; }
.stage-row.stage-completed .stage-icon { background: var(--ok); border-color: transparent; color: var(--text-1); }
.stage-row.stage-completed .stage-status { color: var(--ok); }
.stage-row.stage-planned .stage-icon { background: var(--surface-warm-hi); border-color: var(--edge-warm-mid); color: var(--warm-1); }
.stage-row.stage-planned .stage-status { color: var(--warm-1); }
.stage-name { font-size: var(--type-label); flex: 1; }
.stage-status { font-size: var(--type-meta); color: var(--text-3); }
.hub-asset-summary {
  margin-top: 1.1111rem;
  padding-top: 1.1111rem;
  border-top: 1px solid var(--line-1);
}
.hub-asset-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6667rem;
}
.hub-asset-total-label { color: var(--text-3); font-size: var(--type-label); }
.hub-asset-total-value { color: var(--text-1); font-size: var(--type-title); font-weight: 700; }
.hub-asset-counts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5556rem;
  margin-top: 0.6667rem;
}
.hub-asset-count {
  display: grid;
  gap: 0.1667rem;
  padding: 0.6667rem;
  border-radius: var(--radius-md);
  background: var(--ink-2);
}
.hub-asset-count span { color: var(--text-3); font-size: var(--type-meta); }
.hub-asset-count strong { color: var(--text-1); font-size: var(--type-heading); }
.hub-media-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hub-media-count { color: var(--text-3); font-size: var(--type-meta); margin-left: 0.6667rem; }
.hub-media-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 0.3333rem;
}
.hub-media-list {
  columns: 2;
  column-gap: 0.6667rem;
}
/* hub 媒体卡与各页预览卡共用 .agent-canvas-card 家族外观（标题左上、
   动作按钮右上），这里只保留排布修饰，不再自绘第二种卡片。两栏按高度
   紧凑填充：竖屏高卡旁边自然叠放矮卡，不留等高行网格的大空隙；显示
   顺序随之按列排，不做行对齐。 */
.hub-media-card { min-width: 0; break-inside: avoid; margin: 0 0 0.6667rem; }
.hub-media-preview { min-width: 0; }
.hub-media-card img,
.hub-media-card video { box-sizing:border-box; display:block; width:100%; height:auto; max-height:none; background:var(--ink-scrim); object-fit:contain; }
.hub-media-empty {
  column-span: all;
  display: grid;
  place-items: center;
  min-height: 10rem;
  color: var(--text-3);
  font-size: var(--type-label);
  text-align: center;
}
.hub-media-loading {
  column-span: all;
  padding: 0.5556rem;
  color: var(--text-3);
  font-size: var(--type-meta);
  text-align: center;
}
/* 面板头工具栏：视图切换 + 缩略图密度。小方按钮对齐画布卡动作钮家族。 */
.hub-media-toolbar { display: flex; align-items: center; gap: 0.4444rem; margin-left: auto; }
.hub-media-view-toggle,
.hub-media-zoom { display: flex; align-items: center; gap: 0.1667rem; }
.hub-media-zoom.is-inactive { visibility: hidden; }
.hub-media-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.7778rem;
  height: 1.7778rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
}
.hub-media-tool-btn svg {
  width: 0.8889rem;
  height: 0.8889rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hub-media-tool-btn:hover,
.hub-media-tool-btn:focus-visible { color: var(--text-1); background: var(--ink-3); }
.hub-media-tool-btn[aria-pressed="true"] { color: var(--text-1); background: var(--ink-3); border-color: var(--line-2); }
/* 缩略图密度：data-hub-zoom 直接映射 multicol 列数（2 = 现状）。 */
.hub-media-list[data-hub-zoom="1"] { columns: 1; }
.hub-media-list[data-hub-zoom="2"] { columns: 2; }
.hub-media-list[data-hub-zoom="3"] { columns: 3; }
.hub-media-list[data-hub-zoom="4"] { columns: 4; }
.hub-media-list[data-hub-zoom="5"] { columns: 5; }
.hub-media-list[data-hub-zoom="6"] { columns: 6; }
/* 列表模式：单列表格观感。放在 zoom 系列之后，同特异性按源序覆盖列数。 */
.hub-media-list[data-hub-view="list"] { columns: 1; }
.hub-media-list-head,
.hub-media-row {
  display: grid;
  align-items: center;
  gap: 0.5556rem;
  font-size: var(--type-meta);
}
.hub-media-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ink-1);
  color: var(--text-3);
  padding: 0.2222rem 0;
  border-bottom: 1px solid var(--line-3);
}
.hub-media-list-head .hub-media-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-media-row {
  padding: 0.3333rem 0;
  border-bottom: 1px solid var(--line-3);
  color: var(--text-2);
  break-inside: avoid;
  /* 整行都是双击/回车开预览的热区，光标要跟缩略图卡一个语义。 */
  cursor: pointer;
}
.hub-media-row:hover { background: var(--ink-3); }
.hub-media-row > .hub-media-col {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-media-list-head[data-hub-media-kind="image"],
.hub-media-row[data-hub-media-kind="image"] {
  grid-template-columns: minmax(0, 2.4fr) minmax(0, 0.9fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 1.2fr);
}
.hub-media-list-head[data-hub-media-kind="video"],
.hub-media-row[data-hub-media-kind="video"] {
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 0.9fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 1.2fr);
}
.hub-media-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.1667rem;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-media-sort:hover,
.hub-media-sort:focus-visible,
.hub-media-sort.is-active { color: var(--text-1); }
.hub-media-sort-arrow { flex: 0 0 auto; width: 0; height: 0; border-left: 0.2222rem solid transparent; border-right: 0.2222rem solid transparent; }
.hub-media-sort[data-hub-sort-dir="desc"] .hub-media-sort-arrow { border-top: 0.2778rem solid currentColor; }
.hub-media-sort[data-hub-sort-dir="asc"] .hub-media-sort-arrow { border-bottom: 0.2778rem solid currentColor; }
.hub-media-row-asset { display: flex; align-items: center; gap: 0.4444rem; min-width: 0; }
.hub-media-row-thumb {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 3.5556rem;
  height: 2.3704rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--ink-scrim);
}
.hub-media-row-thumb img,
.hub-media-row-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.hub-media-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1); }
@media (max-width: 1000px) {
  .hub-media-list-head[data-hub-media-kind] .hub-media-col[data-hub-col="head-model"],
  .hub-media-list-head[data-hub-media-kind] .hub-media-col[data-hub-col="head-resolution"],
  .hub-media-list-head[data-hub-media-kind="image"] .hub-media-col[data-hub-col="head-version"],
  .hub-media-list-head[data-hub-media-kind="video"] .hub-media-col[data-hub-col="head-duration"],
  .hub-media-row[data-hub-media-kind] .hub-media-col[data-hub-col="model"],
  .hub-media-row[data-hub-media-kind] .hub-media-col[data-hub-col="resolution"],
  .hub-media-row[data-hub-media-kind="image"] .hub-media-col[data-hub-col="version"],
  .hub-media-row[data-hub-media-kind="video"] .hub-media-col[data-hub-col="duration"] { display: none; }
  .hub-media-list-head[data-hub-media-kind="image"],
  .hub-media-row[data-hub-media-kind="image"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 5rem) minmax(0, 4rem);
  }
  .hub-media-list-head[data-hub-media-kind="video"],
  .hub-media-row[data-hub-media-kind="video"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 5rem) minmax(0, 4rem) minmax(0, 4rem);
  }
}

/* ============================================================ */
/* PAGE 2: SCRIPT DEVELOPMENT                                    */
/* ============================================================ */
.script-entity-groups { display:grid; gap:var(--agent-frame-gap); }
.script-entity-group { display:grid; gap:0.3333rem; }
.script-entity-group-title { color:var(--text-3); font-size:var(--type-meta); font-weight:700; letter-spacing:.04em; }
.script-entity-list { display:grid; gap:0.2222rem; }
.script-entity-item { position:relative; display:flex; align-items:center; gap:0.4444rem; width:100%; min-height:1.7778rem; padding:0.2778rem 0.5rem; border:1px solid transparent; border-radius:var(--radius-sm); background:transparent; color:var(--text-2); font:inherit; font-size:var(--type-label); line-height:1.35; text-align:left; cursor:pointer; }
.script-entity-item:hover { background:var(--ink-3); color:var(--text-1); }
.script-entity-item.selected { border-color:var(--edge-cool-sel-mid); background:var(--ink-3); color:var(--text-1); }
.script-entity-item-label { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.script-completion-dot { width:0.4444rem; height:0.4444rem; flex:0 0 0.4444rem; border-radius:50%; border:1px solid var(--text-4); }
.script-completion-dot.partial { border-color:transparent; background:var(--warn); box-shadow: none; }
.script-completion-dot.complete { border-color:transparent; background:var(--ok); box-shadow: none; }
.script-form { display:grid; gap:0.8889rem; align-content:start; }
.script-form[hidden] { display:none; }
.agent-panel-workbench { container-type:inline-size; }
.agent-panel-body.agent-workbench-layout { display:flex; flex-direction:column; gap:var(--agent-frame-gap); min-height:0; overflow:hidden; padding:var(--agent-frame-pad); }
/* 滚动法条（2026-09-12 用户定）：四个开发工作台各自的中列是全页唯一的
   一级滚动区。区内不许出现任何二级滚动：文本框随内容长高，预览媒体层
   只裁切，面板自身永不滚。空间不够时由这一层整把滚。 */
/* scrollbar-gutter:stable（2026-09-27）：经典滚动条出现/消失会让整棵子树
   的可用宽度抖 ~15px，把贴着列数阈值的设计（如生成设置行 auto-fit 三列）
   打进换行再放回来——负载下内容高度波动，抖动就以几十秒为周期反复。
   常驻预留列距，宽度从此与滚动条状态解耦（与 hub-media-scroll、
   canvas-card-popover 同款纪律）。 */
#page-brief .agent-panel-body.agent-workbench-layout,
#page-board .agent-panel-body.agent-workbench-layout,
#page-storyboard .agent-panel-body.agent-workbench-layout,
#page-video .agent-panel-body.agent-workbench-layout { overflow-y:auto; scrollbar-gutter:stable; }
.agent-workbench-header { flex:0 0 auto; }
.agent-workbench-text-area { display:flex; flex:1 0 auto; min-height:8.8889rem; min-width:0; }
#page-storyboard .agent-workbench-text-area,
#page-video .agent-workbench-text-area { min-height:4.4444rem; }
.agent-workbench-text-area > textarea,
.agent-workbench-text-area > label,
.agent-workbench-text-area > .agent-reference-prompt-section { flex:1 1 auto; }
.agent-workbench-text-area .agent-reference-prompt-editor { min-height:4.8889rem; }
.agent-workbench-text-area.storyboard-shared-text-rows { flex:0 0 auto; }
/* 分镜工作台的提示词编辑器收编在轴区最后一段里；只有这个段落吃剩余高度。
   链上各级不许 min-height:0（那会把提示词压进内部滚动），内容永远托底。 */
#page-storyboard [data-storyboard-axis-ui-host] { display:flex; flex:1 1 auto; flex-direction:column; }
#page-storyboard [data-storyboard-axis-ui-host] > .axis-control-region { display:flex; flex:1 1 auto; flex-direction:column; }
#page-storyboard [data-storyboard-axis-ui-host] .axis-control-region__section[data-axis-section-id="content_and_prompts"] { display:flex; flex:1 1 auto; flex-direction:column; min-height:8.8889rem; }
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-body { display:flex; flex:1 1 auto; flex-direction:column; }
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] .storyboard-image-prompt .agent-reference-prompt-editor { flex:1 1 auto; min-height:4.8889rem; }
/* 分镜吃余高链整条禁收缩（原理同成片页）：段落的指定 min-height 地板会取代
   内容最小值，矮视口下链路被压回地板、提示词溢出框外。禁收缩后装不下由
   工作台唯一滚动区整把滚。 */
#page-storyboard .storyboard-cell-property,
#page-storyboard [data-storyboard-axis-ui-host],
#page-storyboard [data-storyboard-axis-ui-host] > .axis-control-region,
#page-storyboard [data-storyboard-axis-ui-host] .axis-control-region__section[data-axis-section-id="content_and_prompts"],
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-body,
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] .storyboard-image-prompt,
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] .storyboard-image-prompt .agent-reference-prompt-editor { flex-shrink:0; }
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-title { display:none; }
/* 轴区标题上提到格标签行最左（见 .storyboard-axis-heading），投影标题在本页不再自占一行。 */
#page-storyboard [data-storyboard-axis-ui-host] [data-axis-section-id="axis_controls"] > .axis-control-region__section-title { display:none; }
.agent-panel-body[data-script-workbench] { display:flex; flex-direction:column; min-height:0; overflow-y:auto; }
.agent-panel-body[data-script-workbench] > .script-form[data-script-form="smart_parse"] { display:flex; flex:1 0 auto; flex-direction:column; gap:var(--agent-frame-gap); min-height:0; }
.agent-panel-body[data-script-workbench] > .script-form[data-script-form="smart_parse"][hidden] { display:none; }
.agent-panel-body[data-script-workbench] > .script-form[data-script-form="smart_parse"] > [data-script-requirement-form] { display:flex; flex:1 0 auto; flex-direction:column; gap:var(--agent-frame-gap); min-height:0; }
.agent-panel-body[data-script-workbench] > .script-entity-form { display:flex; flex:1 0 auto; flex-direction:column; gap:var(--agent-frame-gap); min-height:0; }
.agent-panel-body[data-script-workbench] > .script-entity-form[hidden] { display:none; }
.agent-workbench-text-area[hidden] { display:none; }
/* 撑满法条（2026-09-12 用户定，2026-09-13 扩展至场次表单）：需求描述块挪到上传条下方后独占中列剩余
   高度（grow:1），整条禁收缩（shrink:0，原理同分镜页禁收缩链）：富余时
   拉伸撑满，内容超过剩余空间时保持内容高，超出交给中列唯一滚动区整把滚，
   最终高度 = max(剩余空间, 内容高)，不出现二级内滚。剧本页吃余高者有两处：
   smart_parse 表单的需求描述区（.script-creative-main），以及 shot 表单的最后一项
   重写要求条（.script-revise-bar 链）；其他实体表单按贴顶法条不吃余高。分镜/视觉/成片
   三页各有各的吃余高条文，这句不许拿去跨页推理。 */
.agent-panel-body[data-script-workbench] .script-creative-main { flex:1 0 auto; }
.script-requirement-fixed { flex:0 0 auto; }
/* 贴顶法条（2026-09-12 用户定）：实体表单文本区不参与纵向撑满（覆盖
   .agent-workbench-text-area 的 flex:1 1 auto 遗产），多余高度不许摊进
   行里——字段组与文本框一律贴上沿顺排，框高只由内容撑出。 */
.script-requirement-text-fields { display:grid; grid-template-columns:minmax(0,1fr); grid-auto-rows:auto; align-content:start; flex:0 0 auto; gap:var(--agent-frame-gap); }
.script-requirement-text-fields > * { margin:0; }
.script-requirement-text-fields > .entity-residual-field { margin-top:0; }
.script-requirement-text-fields :is(.entity-residual-field,.script-edit-field) { display:grid; grid-template-rows:auto auto; gap:0.3333rem; }
/* 滚动法条（2026-09-12 用户定）：实体表单文本框高度由内容撑出，不设地板
   （不固定撑高）；重写要求条已从实体表单下屏，仅场次（shot）表单保留。 */
.script-requirement-text-fields :is(.entity-residual-field,.script-edit-field) > textarea { box-sizing:border-box; width:100%; resize:none; overflow:hidden; }
.script-revise-bar { display:flex; flex:1 0 auto; flex-direction:column; gap:0.4444rem; }
.script-revise-field { display:flex; flex:1 0 auto; flex-direction:column; gap:0.3333rem; }
.script-revise-field textarea { flex:1 0 auto; box-sizing:border-box; width:100%; resize:none; overflow:hidden; }
.agent-panel-body[data-script-workbench] > .script-entity-form[data-script-form="shot"] { flex-shrink:0; }
.script-entity-form[data-script-form="shot"] > :not(.script-revise-bar) { flex-shrink:0; }
.script-entity-form .script-storyboard-prompts { flex:0 0 auto; }
.script-revise-field > span { color:var(--text-2); font-size:var(--type-meta); font-weight:600; }
.script-revise-field textarea { padding:0.6667rem 0.7778rem; border:1px solid transparent; border-radius:var(--radius-md); background:var(--ink-4); color:var(--text-1); font:inherit; line-height:1.6; }
.script-page-error { margin:0 0.6667rem 0.6667rem; padding:0.5556rem 0.6667rem; border:1px solid var(--bad-wash); border-radius: var(--radius-md); background:var(--bad-wash); color:var(--bad); font-size:var(--type-meta); }
.script-page-error:empty { display:none; }
.script-empty-group { padding:0.1667rem 0.5rem; color:var(--text-4); font-size:var(--type-meta); line-height:1.45; }
/* 动作按钮一排（用户 2026-09-17 定）：换行 = 违规，降级顺序是加宽 → 按比例压
   → 裁字，不许把按钮挤到第二行。下面三条动作行统一声明 nowrap；改动当天在真机
   隔离实例上逐行做过前后对比（根字号 11.7px，容器宽压到自然宽的 45% 仍逐元素
   矩形一致、无溢出），所以这次统一是零视觉变化。判据见
   tests/test_action_row_single_line.py。 */
.agent-workbench-actions { display:flex; align-items:center; gap:0.5556rem; flex-shrink:0; flex-wrap:nowrap; padding:var(--agent-frame-pad); border-top:1px solid var(--line-1); }
.agent-workbench-actions .asset-tool-btn { width:0; flex:1 1 0; min-width:0; min-height:2.5556rem; white-space:nowrap; }
.agent-workbench-actions [hidden] { display:none; }
.script-creative-main { display:flex; flex-direction:column; gap:0.4444rem; }
/* 控件条等宽平铺契约（docs/ui-behavior-model.md 2026-09-12）：auto-fit 放得下铺满整行、
   放不下按最大可容纳列数均匀分行、全部控件严格等宽，除不尽的行尾留白不拉伸。
   不许写死多于控件数的列数（本行曾给 6 列而控件只剩 3 个，半行空白）。 */
.script-creative-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
  gap: 0.5556rem;
}
.script-analysis-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(10rem,100%),1fr)); grid-auto-rows:auto; gap:0.4444rem; flex:0 0 auto; }
.script-analysis-fields[hidden] { display:none; }
.script-analysis-field { display:flex; flex-direction:column; gap:0.1667rem; min-width:0; }
.script-analysis-field > label { flex:0 0 auto; color:var(--text-2); font-size:var(--type-meta); font-weight:600; line-height:1.1; }
/* 解析结果文本框随内容长高（2026-09-12 滚动法条）：文本框不是滚动 owner，
   高度由内容撑出、完整显示，溢出交给工作台唯一滚动区。高度像素由全局
   自动长高工具写入，这里只保留地板与版式。 */
.script-form .script-analysis-field textarea {
  flex: 0 0 auto;
  min-height: calc(1.4em + 0.5556rem + var(--canvas-card-stroke-width) + var(--canvas-card-stroke-width));
  padding: 0.2778rem 0.5rem;
  resize: none;
  line-height: 1.4;
  overflow: hidden;
}
.script-brief-field {
  display: flex;
  flex-direction: column;
  gap: 0.3333rem;
  min-width: 0;
}
.script-brief-field span {
  color: var(--text-2);
  font-size: var(--type-meta);
}
.script-brief-field input,
.script-brief-field select,
.script-brief-field output,
.script-form input,
.script-form select,
.script-form textarea {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-1);
  min-height: 2.0rem;
  padding: 0 0.5556rem;
}
.script-brief-field input:focus,
.script-brief-field select:focus,
.script-form input:focus,
.script-form select:focus,
.script-form textarea:focus {
  outline: none;
  border-color: var(--edge-cool-sel-hi);
}
.script-brief-field input:disabled,
.script-brief-field select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}
.script-brief-field output {
  display: flex;
  align-items: center;
  box-sizing: border-box;
}
.script-brief-field small {
  color: var(--text-3);
  font-size: var(--type-meta);
  line-height: 1.35;
}
.script-edit-field > span { color:var(--text-2); font-size:var(--type-meta); font-weight:600; }
.script-edit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0.5556rem; }
.script-edit-field { display:grid; gap:0.3333rem; min-width:0; }
.script-edit-field.full { grid-column:1 / -1; }
.script-edit-field textarea { min-height:5.3333rem; resize:none; overflow:hidden; }
/* 场次引用条（2026-09-13 用户定；仿 2026-08-29 adfb74be 的分镜引用条，
   原 CSS 随 4d0718fa 误删，此处按原样回填）：一行三个等宽按钮：场景/人物/
   道具，点按钮弹层勾选。三个入口跟自由画布的「选模型 / 选画幅时长」按钮
   同一副外观：ink-2 渐变面 + edge-cool 渐变描边 + 抬起阴影。 */
.storyboard-entity-band { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0.4444rem; min-width:0; overflow:hidden; }
.storyboard-entity-button {
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:0.3333rem;
  width:100%;
  min-width:0;
  max-width:100%;
  min-height:1.6667rem;
  padding:0.4444rem;
  overflow:hidden;
  border:var(--canvas-card-stroke-width) solid transparent;
  border-radius:var(--radius-md);
  background:
    linear-gradient(180deg, var(--ink-2-hi), var(--ink-2)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow:inset 0 1px 0 var(--inset-neutral), var(--lift-1);
  color:var(--text-1);
  font:inherit;
  font-size:var(--type-body);
  line-height:1.2778rem;
  white-space:nowrap;
  cursor:pointer;
}
.storyboard-entity-button:not(:disabled):hover,
.storyboard-entity-button:not(:disabled):focus-visible {
  background:
    linear-gradient(180deg, var(--ink-3-hi), var(--ink-3)) padding-box,
    linear-gradient(180deg, var(--edge-cool-hi), var(--edge-cool-mid) 45%, var(--edge-cool-lo)) border-box;
  box-shadow:inset 0 1px 0 var(--inset-cool), var(--lift-1);
}
.storyboard-entity-button-type { flex:0 0 auto; color:var(--text-3); }
.storyboard-entity-button-values { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 引用条弹层保持底层形态：场景 radio，人物/道具 checkbox。行内无缩略图
   时退成 名称+控件 两列，不留空的媒体列（剧本页与视觉开发绑定分镜弹窗
   的行都没有图）；列表纵向滚动而不改变三等分按钮的几何。 */
.storyboard-entity-dialog { display:grid; gap:0.6667rem; max-height:min(60vh,32rem); overflow-x:hidden; overflow-y:auto; }
.storyboard-entity-dialog-option { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:0.7778rem; min-width:0; padding:0.5556rem; border:1px solid var(--line-1); border-radius:var(--radius-md); background:var(--ink-4); color:var(--text-1); cursor:pointer; }
.storyboard-entity-dialog-option:has(.storyboard-entity-dialog-media) { grid-template-columns:7rem minmax(0,1fr) auto; }
.storyboard-entity-dialog-media { display:block; width:7rem; height:5.25rem; overflow:hidden; border-radius:var(--radius-sm); background:var(--canvas-card-media-back); }
.storyboard-entity-dialog-media > img { display:block; width:100%; height:100%; object-fit:cover; }
.storyboard-entity-dialog-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 勾选框宽度交还全局法条（310 行起强制 width:auto 原生尺寸，特异性更高）：
   只对齐 margin、上品牌 accent 色，不再写必输的 width/height。 */
.storyboard-entity-dialog-option > input { margin:0; accent-color:var(--edge-cool-sel-mid); }
.storyboard-entity-dialog-empty { padding:1rem 0; color:var(--text-3); text-align:center; }
/* 剧本页三框（2026-09-13 用户定）：画面描述/音效/台词与分镜开发页的场次
   三框同排同框体（.storyboard-shot-text-row 的三等分与描边由全局输入底材
   出）。字段宿主沿用剧本页 .script-edit-field，但在三框行里撤掉整行跨列、
   内里改两行网格（表头+框），与分镜页的 .video-dev-field 同构。 */
.storyboard-shot-detail .script-edit-field.full { grid-column:auto; }
.storyboard-shot-detail .script-edit-field { display:grid; grid-template-rows:auto auto; gap:0.2778rem; min-width:0; }
.storyboard-shot-detail .script-edit-field > span { white-space:nowrap; }
.storyboard-shot-detail .script-edit-field textarea { border-radius:var(--radius-md); }
.script-preview { display:grid; gap:0; }
.script-preview-shot { display:grid; gap:0.1667rem; padding:0.4444rem 0; border-bottom:1px solid var(--line-3); color:var(--text-2); font-size:var(--type-meta); line-height:1.45; }
.script-preview-shot:last-child { border-bottom:0; }
.script-preview-shot strong { color:var(--text-1); font-size:var(--type-meta); }
.upload-zone {
  position: relative;
  border: 0.1111rem solid transparent;
  border-radius: var(--radius-md);
  padding: 1.3333rem;
  text-align: center;
  margin-bottom: 0.8889rem;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--ink-2);
}
.upload-zone-input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-zone:hover { border-color: transparent; background: var(--ink-3); }
.script-fact-gaps, .storyboard-split-warning { color: var(--warn); font-size: var(--type-meta); }
.script-fact-gaps summary { cursor: pointer; }
.script-fact-gaps li { white-space: pre-wrap; overflow-wrap: anywhere; }
.video-dev-prompt-section > h3 { position:relative; display:flex; align-items:center; gap:0.4444rem; }
.storyboard-split-warning { display:inline-flex; align-items:center; gap:0.2222rem; flex-shrink:0; }
.storyboard-warning-reasons { display:none; pointer-events:none; position:absolute; z-index:10; left:0; right:0; top:100%; padding:0.6667rem; border:1px solid var(--line-1); border-radius:var(--radius-md); background:var(--ink-3); color:var(--text-1); white-space:normal; overflow-wrap:anywhere; box-shadow:var(--lift-1); }
.storyboard-warning-reasons > span { display:block; }
.storyboard-warning-reasons > span + span { margin-top:0.4444rem; }
.storyboard-split-warning:hover .storyboard-warning-reasons,
.storyboard-split-warning:focus .storyboard-warning-reasons { display:block; }
#page-brief .upload-zone {
  min-height: 4.2222rem;
  margin-bottom: 0;
  padding: 0.7778rem 0.8889rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7778rem;
  text-align: left;
  /* 上传条保持自然高度（2026-09-12 用户定）：需求描述块挪到下方吃余高后，
     上传条不吃余高也不许被压缩（列里其余子项全禁收缩，压缩赤字会全砸给它）；
     装不下由工作台唯一滚动区整把滚。 */
  flex: 0 0 auto;
}
.upload-icon {
  width: 2.4444rem; height: 2.4444rem;
  margin: 0 auto 0.5556rem;
  background: var(--ink-3);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
}
#page-brief .upload-icon {
  margin: 0;
  flex: 0 0 2.4444rem;
}
.upload-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.upload-text { font-size: var(--type-label); color: var(--text-2); margin-bottom: 0.2222rem; }
.upload-hint { font-size: var(--type-meta); color: var(--text-3); }
.upload-feedback {
  margin-top: 0.3333rem;
  color: var(--text-2);
  font-size: var(--type-meta);
  line-height: 1.45;
}
.upload-feedback-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2778rem;
}
.upload-file-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 18rem;
  padding: 0.1111rem 0.3889rem;
  border-radius: var(--radius-sm);
  background: var(--ink-4);
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-file-chip[data-upload-load-more] {
  /* The transparent upload input intentionally covers the drop zone at z=1.
     Pagination is a separate command and must remain the pointer owner. */
  position: relative;
  z-index: 2;
  border: 0;
  cursor: pointer;
}
.upload-file-remove {
  /* 同上：× 是独立命令，必须从覆盖整个上传区的透明 input 手里拿回指针。
     选择器认 app.js 里给的 upload-file-remove 类——chip 本体是 span，按钮
     不带 chip 类，写成认 chip 类的选择器会匹配不上、点击落到透明 input 上。 */
  position: relative;
  z-index: 2;
  margin-left: 0.2778rem;
  border: 0;
  padding: 0;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: var(--type-meta);
  line-height: 1;
}
.upload-file-remove:hover { color: var(--text-1); }
.upload-file-chip.upload-removed-restore {
  position: relative;
  z-index: 2;
  border: 0;
  cursor: pointer;
  font-style: italic;
}
.upload-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.upload-feedback:empty {
  display: none;
}

.brief-textarea {
  width: 100%;
  height: auto;
  min-height: 11.1111rem;
  background: var(--ink-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.6667rem;
  color: var(--text-1);
  font-size: var(--type-label);
  line-height: 1.6;
  resize: none;
  overflow: hidden;
}
/* 吃余高法条（2026-09-12 用户定）：需求描述框挪到上传条下方后参与吃余高，
   用 (0,2,1)（两个类 + textarea 一个类型）特异性显式钉死 flex:1 1 auto
   （与 .agent-workbench-text-area > textarea 的通用规则同值，防未来通用
   规则变动悄悄改掉本框语义）。自动长高工具写入的内容像素在 basis:auto 下
   只是基准尺寸：有富余时被拉伸撑满、不足时保持内容高，框内永不出现第二条
   滚动。 */
.agent-workbench-text-area > textarea.brief-textarea { flex:1 1 auto; }
.brief-textarea:focus { outline: none; border-color: var(--edge-cool-sel-hi); }

.agent-workbench-actions .asset-tool-btn {
  padding: 0 0.8889rem;
  position: relative;
  overflow: hidden;
  font-size: var(--type-body);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 0.4444rem;
}
.agent-workbench-actions .asset-tool-btn.is-running::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink-2);

  transform: translateX(-120%);
  animation: actionButtonSweep 1.45s linear infinite;
}
.agent-workbench-actions .asset-tool-btn > * {
  position: relative;
  z-index: 1;
}
.agent-workbench-actions .asset-tool-btn[hidden] { display:none; }

/* Asset cards */
.output-card {
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.7778rem;
  overflow: visible;
}
.output-card.wide { grid-column: span 2; }
.output-label {
  font-size: var(--type-meta);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.3333rem;
  display: flex; align-items: center; gap: 0.3333rem;
}
.output-label::before {
  content: ''; width: 0.1667rem; height: 0.5556rem;
  background: var(--line-3);
  border-radius: var(--radius-sm);
}
.output-card[data-asset-kind] .output-label {
  justify-content: space-between;
  margin-bottom: 0.6667rem;
}
.asset-title-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-media-topbar {
  position: absolute;
  top: 0.5556rem;
  left: 0.5556rem;
  right: 0.5556rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.4444rem;
  pointer-events: none;
}
.asset-media-topbar .asset-title-text {
  width: fit-content;
  max-width: calc(100% - 14rem);
  padding: 0.2222rem 0.4444rem;
  border-radius: var(--radius-sm);
  background: var(--ink-scrim);
  color: var(--text-1);
  font-size: var(--type-meta);
  font-weight: 600;
  backdrop-filter: blur(8px);
}
.asset-media-topbar .asset-tool-btn {
  pointer-events: auto;
  background: var(--ink-3);
  color: var(--text-1);
}
.asset-media-topbar .asset-media-upload { margin-left: auto; }
.asset-media-topbar .asset-media-edit { margin-left: 0; }
.output-content { font-size: var(--type-label); line-height: 1.6; color: var(--text-1); }
.output-card.asset-card-editing {
  border-color: var(--edge-cool-sel-mid);
  box-shadow: none;
}
.asset-toolbar {
  margin-bottom: 0.5556rem;
  padding: 0.4444rem;
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.asset-toolbar-row { display: flex; align-items: center; gap: 0.3333rem; flex-wrap: wrap; }
.asset-toolbar-title {
  flex: 1;
  min-width: 6.6667rem;
  font-size: var(--type-meta);
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-tool-btn {
  padding: 0.2222rem 0.4444rem;
  border-radius: var(--radius-md);
  background: var(--ink-2);
  border: 1px solid transparent;
  color: var(--text-1);
  font-size: var(--type-meta);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3333rem;
  min-height: 1.5556rem;
  min-width: 4.8889rem;
  white-space: nowrap;
}
.asset-tool-btn.primary {
  background: var(--surface-warm-hi);
  border-color: var(--edge-warm-mid);
  color: var(--warm-1);
}
.asset-delete-btn {
  color: var(--text-1);
  border-color: transparent;
}
.asset-clear-btn {
  color: var(--text-1);
  border-color: transparent;
}
.asset-clear-btn:hover {
  background: var(--ink-3);
  border-color: transparent;
  color: var(--text-1);
}
.asset-delete-btn:hover {
  background: var(--ink-3);
  border-color: transparent;
  color: var(--text-1);
}
.asset-tool-btn:disabled,
.asset-prompt-input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}
.asset-mini-progress {
  display: block;
  width: min(10rem, 72%);
  height: 0.2222rem;
  overflow: hidden;
  border-radius: 55.5rem;
  background: var(--ink-3);
}
.asset-mini-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--surface-warm-hi);
  animation: progressIndeterminate 1.05s ease-in-out infinite;
}
.asset-toolbar.is-generating {
  border-color: var(--edge-warm-mid);
  box-shadow: none;
}
.asset-toolbar.is-generating::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink-2);

  transform: translate3d(-120%,0,0);
  animation: statusSweep 1.4s ease-in-out infinite;
  will-change: transform;
  pointer-events: none;
}
.asset-toolbar > * {
  position: relative;
  z-index: 1;
}
.asset-prompt-panel { margin-top: 0.4444rem; }
.asset-prompt-panel.hidden { display: none; }
.asset-prompt-dock {
  margin-top: 0.7778rem;
  padding-top: 0.6667rem;
  border-top: 1px solid var(--line-1);
}
.asset-prompt-input {
  width: 100%;
  min-height: 4rem;
  resize: none;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--ink-4);
  color: var(--text-1);
  padding: 0.4444rem 0.5556rem;
  font-size: var(--type-label);
  line-height: 1.5;
}
.asset-prompt-input:focus { outline: none; border-color: var(--edge-cool-sel-hi); }
.asset-toolbar-actions { display: flex; gap: 0.3333rem; justify-content: flex-end; margin-top: 0.3333rem; }
.asset-body-input {
  width: 100%;
  min-height: 7.7778rem;
  resize: vertical;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: var(--ink-4);
  color: var(--text-1);
  padding: 0.6667rem 0.7778rem;
  font-size: var(--type-body);
  line-height: 1.72;
}
.asset-body-input:focus {
  outline: none;
  border-color: var(--edge-cool-sel-hi);
  box-shadow: none;
}
.asset-toolbar-status {
  display: flex;
  align-items: center;
  gap: 0.3889rem;
  margin-top: 0.4444rem;
  color: var(--text-2);
  font-size: var(--type-meta);
}
/* ============================================================ */
/* PAGE 3: VISUAL BOARD                                         */
/* ============================================================ */
#page-brief.page.active,#page-board.page.active,#page-storyboard.page.active,#page-video.page.active { display:flex; flex-direction:column; height:100%; min-height:0; overflow:hidden; }
/* 两根侧栏对称：最小宽度必须同值。这两个值今天都绑不上——三栏布局只存在于
   1180px 以上，那里两栏早已双双顶到 24rem 上限、中栏吃掉全部伸缩，实测
   1181/1200/1300/1400/1600/1920 六档左右差恒为 0；再窄就进 @media 换两栏了。
   所以这里写成两个值不是"当前有 bug"，是一颗哑雷：谁哪天调了断点或上限，
   不对称就当场显形。改成同值，等宽这条规矩在声明层面就成立。 */
.agent-workspace { display:grid; grid-template-columns:minmax(15.5556rem,24rem) minmax(28.8889rem,64rem) minmax(15.5556rem,24rem); justify-content:center; width:100%; max-width:112rem; margin-inline:auto; gap:0.7778rem; flex:1 1 auto; min-height:0; overflow:hidden; }
.agent-panel { min-width:0; min-height:0; display:flex; flex-direction:column; overflow:hidden; background:var(--ink-1); border:1px solid transparent; border-radius: var(--radius-md); }
.agent-panel-head { display:flex; align-items:center; justify-content:space-between; gap:0.5556rem; min-height:calc(2.7778rem + 1px); padding:var(--agent-frame-pad); border-bottom:1px solid var(--line-1); }
.agent-panel-head:has(> .workbench-asset-title) { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr) minmax(0,1fr); column-gap:1rem; }
.agent-panel-head h2 { min-width:0; margin:0; overflow:hidden; color:var(--text-1); font-size:var(--type-label); text-overflow:ellipsis; white-space:nowrap; }
.workbench-asset-title { min-width:0; overflow:hidden; color:var(--text-2); font-size:var(--type-label); font-weight:600; text-align:center; text-overflow:ellipsis; white-space:nowrap; }
.agent-panel-body { flex:1; min-height:0; overflow:auto; padding:var(--agent-frame-pad); }
.agent-panel-foot { flex-shrink:0; padding:var(--agent-frame-pad); border-top:1px solid var(--line-1); }
.agent-panel-source > .agent-panel-foot .btn { width:100%; }
.visual-dev-matrix-table { width:100%; min-width:0; table-layout:fixed; border-collapse:collapse; font-size:var(--type-meta); }
.visual-dev-matrix-table th,.visual-dev-matrix-table td { padding:0.5rem 0.2222rem; border-bottom:1px solid var(--line-3); text-align:left; vertical-align:top; overflow:hidden; }
.visual-dev-matrix-table th { position:sticky; top:-0.6667rem; z-index:1; background:var(--ink-2); color:var(--text-3); font-weight:600; white-space:nowrap; }
.visual-dev-matrix-table th:first-child,.visual-dev-matrix-shot { width:26%; }  /* 镜号列别占太宽，否则资产名会被省略号截掉 */
.visual-dev-matrix-shot { color:var(--text-2); line-height:1.5556rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.visual-dev-matrix-cell { min-width:0; }
.visual-dev-matrix-assets { display:grid; gap:0.2222rem; min-width:0; }
.visual-dev-matrix-asset { display:grid; grid-template-columns:1.1667rem minmax(0,1fr); align-items:center; width:100%; min-width:0; min-height:1.5556rem; padding:0.1111rem 0.1667rem; border:0; border-radius:var(--radius-sm); background:transparent; color:var(--text-2); cursor:pointer; text-align:left; }
.visual-dev-matrix-asset:hover { background:var(--ink-3); }
/* 选中态只许换底色/字色，不许换字重：省略号落在西文字体里，加粗会变宽，
 * 同一名称的截断点随选中漂移一格（2026-09-24 用户令：禁止选中抽动）。 */
.visual-dev-matrix-asset.is-selected { background:var(--surface-warm); color:var(--warm-1); }
.visual-dev-matrix-asset.is-selected-reference { color:var(--warm-2); }
.visual-dev-matrix-asset:focus-visible { outline:0.1111rem solid var(--warm-2); outline-offset:-0.1111rem; }
.visual-dev-matrix-asset-name { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.visual-dev-status-point { display:inline-grid; place-items:center; width:1.0556rem; height:1.0556rem; border-radius:50%; font-size:var(--type-meta); font-weight:800; line-height:1; }
.visual-dev-status-point.pending { color:var(--warm-2); border:1px solid var(--edge-warm-mid); background:transparent; }
.visual-dev-status-point.generating { color:var(--warm-1); border:0.1111rem dashed var(--warm-1); background:var(--surface-warm); animation:visual-dev-status-spin 1.2s linear infinite; }
.visual-dev-status-point.generated { color:var(--ok); border:0; background:var(--ok-wash); }
.visual-dev-status-point.failed { color:var(--bad); border:1px solid var(--bad); background:var(--bad-wash); }
.visual-dev-status-point.canceled { color:var(--text-3); border:1px solid var(--text-3); background:transparent; }
@keyframes visual-dev-status-spin { to { transform:rotate(360deg); } }
.agent-panel-body[data-visual-dev-workbench] > .visual-dev-workbench { flex:1 1 auto; }
.visual-dev-workbench { display:flex; flex-direction:column; gap:var(--agent-frame-gap); }
.visual-dev-workbench .agent-workbench-header { display:grid; gap:var(--agent-frame-gap); }
/* 预览画幅律令（2026-09-12 用户定）：三个工作台顶部预览永远是 2.35:1，
   高度由宽度按比例唯一决定；旧「min(16.6667rem,28vh) 定高槽」与轴面挂上
   后的压低规则一并废止。媒体在框内 contain 完整显示，框自身只裁切不滚动。 */
.workbench-preview-host { display:flex; flex:0 0 auto; flex-direction:column; min-width:0; width:100%; min-height:0; max-height:none; height:auto; aspect-ratio:2.35 / 1; }
[data-workbench-preview] { display:flex; flex:1 1 auto; flex-direction:column; width:100%; min-width:0; min-height:0; }
/* 画幅由预览槽锁定；卡片填满槽位，body 用 0 基准接收工具栏后的剩余高度。 */
[data-workbench-preview] .agent-canvas-card-body { display:flex; flex:1 1 0; min-height:0; height:0; overflow:hidden; }
[data-workbench-preview-media] { display:grid; flex:1 1 0; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr); place-items:center; width:100%; min-width:0; min-height:0; height:100%; max-height:100%; overflow:hidden; }
[data-workbench-preview-media] > :is(img,video),
[data-workbench-preview-media] .storyboard-group-image-page img { display:block; width:100%; max-width:100%; max-height:100%; object-fit:contain; }
/* 宫格预览整体等比缩进 2.35:1 框内（contain 到宫格层，而不是让宫格滚）：
   列数决定整层宽高比，1/2/3 列分别是 16:9、32:9、48:9。 */
[data-workbench-preview-media] > .storyboard-group-image-pages { box-sizing:border-box; width:auto; height:100%; max-width:100%; max-height:100%; min-height:0; padding-bottom:0; border-bottom:0; grid-template-columns:repeat(1,minmax(0,1fr)); grid-auto-rows:minmax(0,1fr); aspect-ratio:16 / 9; }
[data-workbench-preview-media] > .storyboard-group-image-pages:has(> :nth-child(2)) { width:100%; height:auto; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0.2222rem; aspect-ratio:32 / 9; }
[data-workbench-preview-media] > .storyboard-group-image-pages:has(> :nth-child(5)) { grid-template-columns:repeat(3,minmax(0,1fr)); aspect-ratio:16 / 3; }
[data-workbench-preview-media] .storyboard-group-image-page { display:grid; grid-template-rows:minmax(0,1fr) auto; min-width:0; min-height:0; height:100%; }
[data-workbench-preview-media] .storyboard-group-image-page:has(.storyboard-cell-preview-grid) { position:relative; }
[data-workbench-preview-media] .storyboard-cell-preview-grid { position:absolute; z-index:2; display:grid; padding:0; overflow:hidden; border:1px solid var(--edge-cool-sel-mid); border-radius:var(--radius-sm); }
[data-workbench-preview-media] .storyboard-cell-preview-grid[hidden] { display:none; }
[data-workbench-preview-media] .storyboard-cell-preview-grid > button { min-width:0; min-height:0; padding:0; border:1px solid color-mix(in srgb, var(--text-1) 55%, transparent); background:transparent; cursor:pointer; }
[data-workbench-preview-media] .storyboard-cell-preview-grid > button:hover,[data-workbench-preview-media] .storyboard-cell-preview-grid > button:focus-visible { background:color-mix(in srgb, var(--warm-1) 16%, transparent); outline:2px solid var(--warm-1); outline-offset:-2px; }
[data-workbench-preview-media] .storyboard-cell-preview-grid > button.is-selected { background:color-mix(in srgb, var(--warm-1) 11%, transparent); outline:2px solid var(--warm-1); outline-offset:-2px; }
[data-workbench-preview-media] > .storyboard-group-image-pages:has(> :nth-child(2)) figcaption { margin-top:0; line-height:1.2; }
[data-workbench-preview-media] > .empty-state { padding:1.3333rem; text-align:center; }
.visual-dev-preview { min-width:0; }
.visual-dev-structure-fields { display:grid; gap:0.4444rem; }
.visual-dev-header-fields { grid-template-columns:repeat(auto-fit,minmax(min(8rem,100%),1fr)); align-items:start; overflow:hidden; }
.visual-dev-header-fields .visual-dev-structure-field { min-width:0; overflow:hidden; }
.visual-dev-header-fields .visual-dev-structure-field > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.visual-dev-workbench .agent-workbench-text-area.visual-dev-structure-fields { flex:0 1 auto; overflow:visible; }
/* 提示词条吃满工作台剩余高度（2026-09-06 用户定；2026-09-12 并入滚动法条）：
   从轴宿主到提示词框逐级放行 flex，且链上各级不许 min-height:0——内容永远
   托底，装不下时由工作台唯一滚动区整把滚，提示词框绝不内部滚动。空间有余
   时 flex-grow 把提示词框正好拉满剩余高度。选择器全部咬住视觉开发页自己的
   轴区结构（data-axis-ui-*），剧本/分镜/成片页与画布弹层共用的区域基础样式、
   以及布局锁夹具里的简化 DOM 都不经过这里。段落 [hidden] 的 display:none
   在区域基础样式里声明得更晚，同特异性下压过这里的 flex，空段落照旧收起；
   轴宿主自身的 hidden 兜底照剧本页先例补一条，免得 display:flex 盖过 UA 的
   [hidden]。 */
.visual-dev-workbench > [data-axis-ui-host] { display:flex; flex:1 1 auto; flex-direction:column; }
.visual-dev-workbench > [data-axis-ui-host][hidden] { display:none; }
.visual-dev-workbench [data-axis-ui-host] > .axis-control-region { display:flex; flex:1 1 auto; flex-direction:column; }
.visual-dev-workbench [data-axis-section-id="content_and_prompts"] { display:flex; flex:1 1 auto; flex-direction:column; }
.visual-dev-workbench [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-body { display:flex; flex:1 1 auto; flex-direction:column; }
.visual-dev-workbench [data-axis-ui-content-prompts].agent-workbench-text-area.visual-dev-structure-fields { display:flex; flex:1 1 auto; flex-direction:column; align-items:stretch; overflow:visible; }
.visual-dev-workbench [data-axis-ui-content-prompts] > .agent-reference-prompt-section { flex:1 1 auto; }
.visual-dev-workbench [data-axis-ui-content-prompts] .agent-reference-prompt-editor { flex:1 1 auto; min-height:4.8889rem; }
/* 视觉开发吃余高链整条禁收缩（原理同分镜/成片页）：内容永远托底。 */
.visual-dev-workbench > [data-axis-ui-host],
.visual-dev-workbench [data-axis-ui-host] > .axis-control-region,
.visual-dev-workbench [data-axis-section-id="content_and_prompts"],
.visual-dev-workbench [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-body,
.visual-dev-workbench [data-axis-ui-content-prompts] .agent-reference-prompt-editor { flex-shrink:0; }
.visual-dev-structure-field { display:grid; gap:0.2778rem; min-height:0; color:var(--text-3); font-size:var(--type-meta); }
.visual-dev-structure-field input,.visual-dev-structure-field textarea,.visual-dev-structure-field select { box-sizing:border-box; width:100%; min-width:0; min-height:1.6667rem; padding:0.3333rem 0.4444rem; border:1px solid transparent; border-radius:var(--radius-md); background:var(--ink-4); color:var(--text-1); font:inherit; }
.visual-dev-structure-field input:disabled { color:var(--text-3); opacity:.8; }
/* 成片页预览走统一画幅槽（2.35:1），不再有页面专属覆写；
   场次提示词独立于宫格资产属性，是本页唯一的吃余高链条。 */
#page-video [data-video-dev-prompt] { flex:1 1 auto; height:auto; min-height:8.8889rem; }
/* 成片页宫格属性块按内容排：吃余高的一级只许是提示词条。 */
#page-video .video-dev-cell-property { flex:0 0 auto; }
/* 实体轴编辑器（布局锁夹具沿用的轴区替身样式）：按滚动法条自身不滚，
   高度随内容交给所在工作台的唯一滚动区。 */
.entity-axis-editor { display:grid; gap:0.6667rem; padding:0.8889rem; border:1px solid var(--line-2); border-radius:var(--radius-lg); background:var(--ink-2); }
.entity-axis-editor-title { color:var(--text-1); font-size:var(--type-label); font-weight:700; }
.entity-axis-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(7.7778rem,1fr)); gap:0.6667rem; }
.entity-axis-field { display:grid; gap:0.3333rem; min-width:0; color:var(--text-3); font-size:var(--type-meta); }
.entity-axis-field select,.entity-axis-field input { width:100%; min-width:0; }
/* 一级标签（名称/设定说明/细节描述）统一 text-2：细节描述此前整卡继承
   text-3，比另外两格暗一档（2026-09-12 用户定：三标签同色）。 */
.entity-residual-field { display:grid; gap:0.3333rem; margin-top:0.6667rem; color:var(--text-2); font-size:var(--type-meta); }
.entity-residual-field > span { font-weight:600; }
.entity-residual-field textarea { box-sizing:border-box; width:100%; padding:0.6667rem 0.7778rem; border:1px solid transparent; border-radius:var(--radius-md); background:var(--ink-4); color:var(--text-1); font:inherit; line-height:1.6; resize:none; overflow:hidden; }
.script-axis-conclusion { padding:0.6667rem 0.7778rem; border:1px solid var(--line-2); border-radius:var(--radius-md); color:var(--text-1); background:var(--ink-2); line-height:1.6; white-space:pre-wrap; }
.visual-dev-assets-body .entity-grid { grid-template-columns:minmax(0,1fr); }
.visual-dev-assets-body .entity-card,
.agent-canvas-card,
.video-dev-asset-card {
  box-sizing:border-box;
  min-width:0;
  max-width:100%;
  overflow:visible;
}

.entity-preview.generated {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--ink-3);
}
.entity-preview.generated::after {
  display: none;
}

/* Character/Scene Grid */
.entity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--agent-frame-gap);
  align-items: start;
}
.entity-group {
  display: grid;
  gap: var(--agent-frame-gap);
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.entity-group-head {
  display: flex;
  align-items: flex-start;
  gap: 0.5556rem;
  justify-content: space-between;
}
.entity-group-title {
  color: var(--text-1);
  font-size: var(--type-label);
  font-weight: 700;
}
.entity-group-meta {
  margin-top: 0.1667rem;
  color: var(--text-4);
  font-size: var(--type-meta);
  line-height: 1.45;
}
.entity-group-list {
  display: grid;
  gap: var(--agent-frame-gap);
}
.entity-group-empty {
  padding: 0.4444rem 0 0.1111rem;
  border-top: 1px solid var(--line-3);
  color: var(--text-4);
  font-size: var(--type-meta);
}
.entity-add-btn {
  flex: 0 0 auto;
}
.entity-card {
  display: grid;
  gap: var(--agent-frame-gap);
  padding: var(--agent-frame-pad);
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  overflow: visible;
  transition: all 0.2s;
}
.entity-card:not(.agent-canvas-card):hover { border-color: transparent; background: var(--ink-3); transform: translateY(-0.1111rem); }
.entity-card.is-new {
  border: 0.1111rem solid transparent;
  background: linear-gradient(180deg, var(--ink-3-hi), var(--ink-3)) padding-box, linear-gradient(180deg, var(--edge-cool-sel-hi), var(--edge-cool-sel-mid) 45%, var(--edge-cool-sel-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-cool), var(--lift-1);
  animation: entityCardFlash 1.4s ease-out;
}
.entity-card.is-generating {
  border-color: var(--edge-warm-mid);
  box-shadow: none;
}
.entity-preview {
  position: relative;
  background: var(--ink-3);
  min-width:0;
  overflow:visible;
}
.entity-preview.generated {
  display:block;
  background-image:none !important;
}
.entity-preview.generated img {
  display:block;
  width:100%;
  height:auto;
  object-fit:contain;
}
.entity-preview.is-generating {
  aspect-ratio:16 / 9;
  display:flex;
  align-items:center;
  justify-content:center;
}
.entity-preview.is-generating {
  background: var(--surface-warm);
}
.entity-preview svg { color: var(--text-4); }
.media-availability-placeholder {
  min-height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.4444rem;
  box-sizing: border-box;
  color: var(--text-4);
}
.media-availability-placeholder.is-not-generated .media-availability-placeholder-icon {
  font-size: var(--type-title);
  color: var(--text-4);
}
.media-availability-placeholder.is-missing-file {
  padding: 0.7778rem;
  color: var(--bad);
  background: var(--bad-wash);
  border: 1px dashed var(--bad);
}
.media-availability-placeholder.is-missing-file .media-availability-placeholder-icon {
  display: grid;
  place-items: center;
  width: 1.3889rem;
  height: 1.3889rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}
.media-availability-placeholder-fact {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--type-meta);
  font-weight: 650;
}
.entity-card.agent-canvas-card { gap:0; padding:0; }
.entity-card.agent-canvas-card:hover { transform:translateY(-0.1111rem); }
.entity-artifact-id {
  margin-top: 0.3889rem;
  color: var(--text-2);
  font-size: var(--type-meta);
  font-weight: 700;
  letter-spacing: 0;
}
.entity-status {
  margin-top: 0.3889rem;
  font-size: var(--type-meta);
  color: var(--text-2);
}
.artifact-ref-row {
  margin-top: 0.3889rem;
  display: grid;
  gap: 0.2222rem;
}
.artifact-ref-row > span {
  color: var(--text-4);
  font-size: var(--type-meta);
  text-transform: uppercase;
  letter-spacing: 0;
}
.artifact-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2222rem;
  min-width: 0;
}
.artifact-chip {
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-3);
  color: var(--text-2);
  cursor: pointer;
  font-size: var(--type-meta);
  line-height: 1.25;
  padding: 0.1667rem 0.3333rem;
  text-align: left;
}
.artifact-chip.compact {
  font-size: var(--type-meta);
  padding: 0.1111rem 0.2778rem;
}
.artifact-chip:hover {
  border-color: transparent;
  background: var(--ink-3);
  color: var(--text-1);
}
.entity-sheet-placeholder {
  background-color: var(--ink-3);
  color: var(--text-4);
}
.entity-sheet-lines {
  position: absolute;
  inset: 1.1111rem;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  grid-template-rows: 1fr 0.72fr;
  gap: 0.4444rem;
}
.entity-sheet-lines span {
  border: 1px solid transparent;

  background: var(--ink-2);

}
.entity-sheet-title {
  position: absolute;
  left: 1rem;
  bottom: 0.7778rem;
  right: 1rem;
  font-size: var(--type-label);
  color: var(--text-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entity-add {
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  aspect-ratio: 1;
  cursor: pointer;
  font-size: var(--type-title);
  transition: all 0.2s;
}
.entity-add:hover { border-color: var(--edge-cool-mid); color: var(--text-1); background: var(--ink-3); }

/* ============================================================ */
/* PAGE 4: STORYBOARD                                           */
/* ============================================================ */
.asset-ref-count {
  width: 100%;
  color: var(--text-4);
  font-size: var(--type-meta);
  line-height: 1.35;
}
[data-media-preview-source] {
  cursor: zoom-in;
}
.image-preview {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: grid;
  place-items: center;
  padding: 3vh 3vw;
  padding-block: 3dvh;
  background: var(--ink-scrim);
}
.image-preview[hidden] {
  display: none;
}
.image-preview-content {
  position: relative;
  /* flex 而非 grid：bar/versions 的百分比 max-height 只有作为定高容器的 flex
     子项才按灯箱框高解析；grid auto 行里百分比按行内容高解析，限高会裁切
     内容却挡不住行占位。 */
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(88.8889rem, 94vw);
  height: 94vh;
  height: 94dvh;
  max-height: 94vh;
  max-height: 94dvh;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  background: var(--ink-1);
  box-shadow: var(--shadow-lg);
}
/* 媒体区与下方文本区之间是可拖动分割线（2026-09-22 用户定）：媒体区高度 =
   框高 × --image-preview-split，默认 2/3，拖动范围限在框高 1/5～4/5；文本区
   吃满剩余高度，超出部分只在文本区内滚动，媒体区不跟着滚。 */
.image-preview-main { position: relative; display: grid; flex: 0 0 calc(100% * var(--image-preview-split, 0.6667)); min-height: 0; overflow: hidden; padding: 0.8889rem 3.5556rem; }
.image-preview-divider {
  position: relative;
  flex: 0 0 auto;
  height: 0.4444rem;
  margin: -0.2222rem 0;
  z-index: 2;
  cursor: row-resize;
  touch-action: none;
}
.image-preview-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.6667rem;
  height: 0.2222rem;
  border-radius: 999px;
  background: var(--line-2);
  transform: translate(-50%, -50%);
}
.image-preview-divider:hover::after,
.image-preview-divider:focus-visible::after,
.image-preview-divider.is-dragging::after { background: var(--warm-1); }
.image-preview-divider:focus-visible { outline: none; }
.image-preview-content.is-resizing { cursor: row-resize; user-select: none; }
.image-preview-content.is-resizing .image-preview-media { pointer-events: none; }
/* Flex, not grid: a grid area sizes itself to the item, so the media's own
   max-height:100% resolved against its overflowing height and the box grew
   past the frame — the clipped strip carried the native player controls. */
.image-preview-main [data-media-preview-host] { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; width: 100%; height: 100%; overflow: hidden; }
.image-preview-media {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.image-preview-media.is-preview-zoomable {
  transform-origin: 0 0;
  cursor: zoom-in;
  will-change: transform;
}
.image-preview-media-status { margin: 0; padding: 0.6667rem; color: var(--text-3); font-size: var(--type-label); line-height: 1.5; text-align: center; }
/* 滚动法条（2026-09-12）：灯箱框体本身不滚，底部信息栏是框内唯一的
   纵向滚动层；提示词随内容完整显示，版本条换行、不再横向滚。flex:0 1 auto
   让超长内容顶到自身限高后在栏内滚，正常内容按自然高占位、不裁切。 */
.image-preview-bar {
  display: grid;
  flex: 1 1 0;
  align-content: start;
  gap: 0.5556rem;
  justify-items: center;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0.6667rem 0.8889rem;
  border-top: 1px solid var(--line-2);
  background: var(--ink-2);
}
.image-preview-actions { display: flex; flex-wrap: nowrap; gap: 0.5556rem; align-items: center; justify-content: center; }
/* 提示词按原文格式自然左对齐（2026-09-22 用户定），不居中。 */
.image-preview-prompt {
  display: grid;
  justify-self: stretch;
  max-width: 100%;
  min-width: 0;
  color: var(--text-2);
  font-size: var(--type-meta);
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Every version's block shares one grid cell, so the reserved height always
   matches the longest prompt and switching versions never shifts the layout. */
.image-preview-prompt-block { grid-area: 1 / 1; display: grid; gap: 0.2222rem; align-content: start; min-width: 0; }
.image-preview-prompt-block.is-reserved { visibility: hidden; pointer-events: none; }
.image-preview-prompt[hidden] { display: none; }
/* 生成模型一行居中、暖色粗体（2026-09-22 用户定），与下方左对齐的提示词区分。 */
.image-preview-prompt-model { margin: 0; justify-self: center; text-align: center; color: var(--warm-1); font-weight: 700; }
.image-preview-close,
.image-preview-download {
  display: inline-flex;
  align-items: center;
  min-height: 2.0rem;
  padding: 0.3889rem 0.8889rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-3);
  color: var(--text-1);
  font: 700 var(--type-meta)/1.2 Inter,-apple-system,BlinkMacSystemFont,sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.image-preview-close:hover,
.image-preview-download:hover { border-color: var(--edge-cool-hi); }
.image-preview-download[hidden] { display: none; }
.image-preview-nav {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 2.3333rem;
  height: 2.3333rem;
  transform: translateY(-50%);
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--ink-scrim);
  color: var(--text-1);
  font: 700 var(--type-title)/1 sans-serif;
  cursor: pointer;
}
.image-preview-nav:hover:not(:disabled) { background: var(--ink-3); }
.image-preview-nav:disabled { opacity: .36; cursor: default; }
.image-preview-nav.previous { left: 0.7778rem; }
.image-preview-nav.next { right: 0.7778rem; }
.image-preview-use { display: inline-flex; align-items: center; min-height: 2.0rem; padding: 0.3889rem 0.8889rem; border: 1px solid var(--edge-warm-mid); border-radius: var(--radius-sm); background: var(--surface-warm-hi); color: var(--warm-1); font: 700 var(--type-meta)/1.2 Inter,-apple-system,BlinkMacSystemFont,sans-serif; cursor: pointer; }
.image-preview-use:hover:not(:disabled) { filter: brightness(1.08); }
.image-preview-use:disabled { border-color: var(--line-2); background: var(--ink-3); color: var(--text-3); filter: none; cursor: default; }
.image-preview-use[hidden] { display: none; }
.image-preview-versions { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 0.5556rem; min-width: 0; min-height: 0; max-height: 25%; overflow-y: auto; padding: 0.6667rem; border-top: 1px solid var(--line-2); background: var(--ink-2); }
.image-preview-versions[hidden] { display: none; }
.image-preview-version { position: relative; flex: 0 0 8.3333rem; display: grid; grid-template-rows: 4.6667rem auto; min-width: 0; overflow: hidden; padding: 0; border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--ink-3); color: var(--text-2); text-align: left; cursor: pointer; }
.image-preview-version:hover, .image-preview-version:focus-visible { border-color: var(--edge-cool-hi); }
.image-preview-version.is-viewing { border-color: var(--edge-warm-sel-mid); box-shadow: var(--glow-ring-warm); }
.image-preview-version.is-media-unavailable { cursor: default; opacity: .55; }
.image-preview-version.is-media-unavailable .image-preview-version-media { display: grid; place-items: center; padding: 0.3333rem; color: var(--text-3); font-size: var(--type-meta); line-height: 1.35; text-align: center; }
.image-preview-version.is-media-unavailable .image-preview-version-copy .image-preview-version-status { color: var(--text-3); font-style: normal; }
.image-preview-version-media, .image-preview-version-media img, .image-preview-version-media video { display: block; width: 100%; height: 4.6667rem; object-fit: contain; background: var(--ink-4); }
.image-preview-version-copy { display: grid; gap: 0.2222rem; padding: 0.3889rem; }
.image-preview-version-copy span { display: block; overflow: hidden; color: var(--text-3); font-size: var(--type-meta); line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-version-copy .image-preview-version-model { color: var(--text-2); font-weight: 700; }
.image-preview-version-info { min-height: 0; }
.image-preview-current { position: absolute; top: 0.3333rem; left: 0.3333rem; z-index: 1; padding: 0.1667rem 0.2778rem; border-radius: var(--radius-sm); background: var(--surface-warm-hi); color: var(--warm-1); font-size: var(--type-meta); font-weight: 700; }
.empty-state {
  color: var(--text-3);
  font-size: var(--type-label);
  line-height: 1.6;
  padding: 0.8889rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-2);
}
.issue-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.0rem;
  margin-top: 0.2222rem;
  padding: 0.1111rem 0.3333rem;
  border-radius: var(--radius-sm);
  background: var(--bad-wash);
  color: var(--bad);
  border: 1px solid var(--bad-line);
  font-size: var(--type-meta);
  font-weight: 700;
}
.issue-status.failed {
  color: var(--text-1);
  border-color: var(--bad-line);
  background: var(--bad-wash);
}
.asset-text-excerpt {
  color: var(--text-2);
  font-size: var(--type-label);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.artifact-summary-thumb {
  aspect-ratio: 16 / 9;
  margin-bottom: 0.4444rem;
  border-radius: var(--radius-sm);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: var(--ink-3);
  border: 1px solid transparent;
}
.entity-card.selected,
.output-card.selected {
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--surface-warm-sel-hi), var(--surface-warm-sel)) padding-box, linear-gradient(180deg, var(--edge-warm-sel-hi), var(--edge-warm-sel-mid) 45%, var(--edge-warm-sel-lo)) border-box;
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--glow-ring-warm), var(--lift-1);
}
.shot-plan-label {
  padding: 0.2778rem 0.3889rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--info);
  font-size: var(--type-meta);
  background: var(--info-wash);
  line-height: 1.5;
  text-align: center;
}
.shot-plan-label span {
  color: var(--text-4);
}
.shot-video-badge {
  position: absolute;
  right: 0.4444rem;
  top: 0.4444rem;
  padding: 0.1111rem 0.3889rem;
  border-radius: var(--radius-sm);
  background: var(--ok-wash);
  color: var(--ok);
  font-size: var(--type-meta);
}
.storyboard-video-thumb video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.shot-meta { padding: 0.5556rem 0.6667rem; }
.shot-tags { display: flex; gap: 0.2222rem; margin-bottom: 0.3333rem; flex-wrap: wrap; }
.shot-mini-tag {
  font-size: var(--type-meta);
  padding: 1px 0.3333rem;
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  color: var(--text-3);
}
.shot-mini-tag.shot-type { background: var(--ink-3); color: var(--text-1); }
.shot-mini-tag.movement { background: var(--ink-3); color: var(--text-1); }
.shot-desc {
  font-size: var(--type-label);
  color: var(--text-2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.shot-asset-summary {
  display: flex;
  gap: 0.3333rem;
  margin-top: 0.4444rem;
  color: var(--text-3);
  font-size: var(--type-meta);
}
.shot-asset-summary span {
  padding: 0.1111rem 0.3333rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink-3);
}
.storyboard-media-tools {
  display: grid;
  gap: 0.3333rem;
  align-self: stretch;
}
.storyboard-media-tools .asset-title-text {
  min-width: 4.5556rem;
  font-size: var(--type-meta);
}
.storyboard-media-tools .asset-tool-btn {
  min-height: 1.2222rem;
  padding: 0.1111rem 0.3333rem;
  font-size: var(--type-meta);
}

/* Storyboard-specific content inside the shared agent workspace. */
.storyboard-empty { padding:1rem; color:var(--text-3); font-size:var(--type-meta); }
.field-label-hidden > span { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.storyboard-selection-summary { margin:0 0 0.7778rem; color:var(--text-3); font-size:var(--type-meta); }
.storyboard-operation-error { min-height:0; margin:0 0 0.5556rem; color:var(--bad); font-size:var(--type-meta); }
.storyboard-operation-error:empty { display:none; }
.storyboard-group-list { display:grid; gap:var(--agent-frame-gap); align-content:start; }
/* 多宫格一次拆定后，左栏一场次一张卡：卡就是列表项，不再有编组外框与连接符。 */
/* 场次工作台自上而下：预览（紧邻其下是生成设置）→ 场次共用三框 → 多宫格属性页。 */
/* 地板 8.8889rem（2026-09-27）：与 5184 行 grid 变体同 token。9.5rem 地板下
   三列阈值贴着滚动条预留列距，gutter 预留后放得下三列的宽度余量不足。 */
.storyboard-generation-settings { display:grid; margin:0.5556rem 0; gap:0.4444rem; grid-template-columns:repeat(auto-fit,minmax(8.8889rem,1fr)); }
.storyboard-generation-settings .storyboard-card-settings { display:contents; }
.storyboard-shared-fields { margin:0 0 0.5556rem; display:grid; gap:var(--agent-frame-gap); }
/* 滚动法条（2026-09-12）：三框按内容排，不再与属性页瓜分余高；吃余高的
   唯一一级是属性页轴区末段的提示词条。三框 textarea 随内容长高、完整显示，
   装不下由工作台唯一滚动区整把滚。成片页共用本节名但布局不同，弹性只给
   分镜页。 */
#page-storyboard .storyboard-shared-fields { display:flex; flex:0 0 auto; flex-direction:column; }
.storyboard-shared-frame > h3 { margin:0 0 0.2222rem; font-size:var(--type-meta); color:var(--text-3); font-weight:500; }
#page-storyboard .storyboard-shared-frame { display:flex; flex-direction:column; min-width:0; }
#page-storyboard .storyboard-shared-frame .video-dev-field { flex:0 0 auto; }
#page-storyboard .storyboard-shared-frame .video-dev-field > textarea { min-height:5rem; }
/* 多宫格属性页是一只静态外框：边框围出「这些内容属于属性页」的边界。
   框自身和它的内部都不滚（滚动法条）：工作台唯一滚动区整把滚，属性页
   保留内容高度，绝不能先缩成零再裁掉提示词。 */
.storyboard-cell-property { display:flex; flex:1 1 auto; flex-direction:column; padding:0.5556rem; border:1px solid var(--line-1); border-radius:var(--radius-md); background:var(--ink-3); }
.storyboard-cell-tabbar { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:0.3333rem; align-items:center; margin:0 0 0.5556rem; }
.storyboard-cell-tabbar[hidden] { display:none; }
.storyboard-cell-tab {
  padding:0.2222rem 0.6667rem;
  border:1px solid var(--line-1);
  border-radius:var(--radius-sm);
  background:var(--ink-3);
  color:var(--text-2);
  font-size:var(--type-meta);
  white-space:nowrap;
  cursor:pointer;
}
.storyboard-cell-tab.active { border-color:var(--warm-1); color:var(--text-1); background:var(--surface-warm-sel); }
/* 两侧轨道严格等宽，格页标签相对整个面板居中，不受标题宽度或右侧按钮有无影响。
   窄工作台将标签移到独占整行，仍以面板为中心，并允许多格标签换行。 */
.storyboard-axis-heading { grid-column:1; grid-row:1; min-width:0; overflow-wrap:anywhere; color:var(--text-2); font-size:var(--type-label); font-weight:650; line-height:1.3; }
/* 格页标签只在多宫格渲染（单宫格没有可切的格页）；包一层居中容器。 */
.storyboard-cell-tabs { display:flex; grid-column:2; grid-row:1; justify-self:center; min-width:0; max-width:100%; flex-wrap:wrap; justify-content:center; gap:0.3333rem; }
.storyboard-grid-switch { display:inline-flex; grid-column:3; grid-row:1; justify-self:end; align-items:center; gap:0.3333rem; min-width:0; white-space:normal; padding:0.2222rem 0.6667rem; border:1px solid var(--edge-warm-mid); border-radius:var(--radius-sm); background:var(--surface-warm-sel); color:var(--text-2); font-size:var(--type-meta); cursor:pointer; }
@container (max-width:48rem) {
  .storyboard-cell-tabbar { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  .storyboard-cell-tabs { grid-column:1 / -1; grid-row:2; }
  .storyboard-grid-switch { grid-column:2; }
}
.storyboard-grid-switch:hover,.storyboard-grid-switch:focus-visible { border-color:var(--warm-1); color:var(--text-1); outline:none; }
.storyboard-grid-switch[disabled] { cursor:default; opacity:0.6; }
.storyboard-grid-choice-list { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(8rem, 100%), 1fr)); gap:0.4444rem; }
.storyboard-grid-choice { display:flex; flex-direction:column; align-items:center; gap:0.2222rem; padding:0.5556rem 0.4444rem; border:1px solid var(--line-1); border-radius:var(--radius-md); background:var(--ink-3); color:var(--text-2); font-size:var(--type-label); cursor:pointer; }
.storyboard-grid-choice:hover,.storyboard-grid-choice:focus-visible { border-color:var(--edge-cool-sel-mid); color:var(--text-1); outline:none; }
.storyboard-grid-choice.active { border-color:var(--warm-1); color:var(--text-1); background:var(--surface-warm-sel); }
.storyboard-grid-choice-current { font-size:var(--type-meta); color:var(--warm-1); }
.storyboard-grid-choice-hint { margin:0.5556rem 0 0; color:var(--text-3); font-size:var(--type-meta); }
/* 调整分镜方案弹窗固定为三个输入：宫格、预估时长、重写要求。 */
.storyboard-plan-fields { display:flex; flex-direction:column; gap:0.7778rem; }
.storyboard-cell-property-body { display:flex; flex:1 1 auto; flex-direction:column; }
.storyboard-script-item {
  position:relative;
  box-sizing:border-box;
  min-width:0;
  padding:var(--agent-frame-pad);
  border:1px solid var(--line-1);
  border-radius:var(--radius-md);
  background:var(--ink-3);
  color:var(--text-1);
  cursor:pointer;
}
.storyboard-script-item:hover,.storyboard-script-item:focus-visible { border-color:var(--edge-cool-sel-mid); outline:none; }
.storyboard-script-item.selected { border-color:var(--edge-warm-sel-mid); background:var(--surface-warm-sel); }
.storyboard-script-item-head { display:flex; align-items:center; gap:0.4444rem; min-width:0; }
.storyboard-script-item-head h3 {
  flex:1 1 auto;
  min-width:0;
  margin:0;
  overflow:hidden;
  color:inherit;
  font-size:var(--type-label);
  font-weight:600;
  line-height:1.7778rem;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.storyboard-script-item > p {
  min-width:0;
  max-width:100%;
  margin:0.3333rem 0 0;
  color:var(--text-2);
  font-size:var(--type-meta);
  line-height:1.5;
  overflow-wrap:anywhere;
  white-space:normal;
}
/* 开发页左栏状态圆圈（统一语义，2026-09-27 用户定；配色 2026-09-28 用户改判：
   颜色心智收敛为 绿=行、黄=等）：✓绿=已生成（双✓重叠=已生成多版）；双粗绿
   ○=可生成（输入齐备，只差点「生成」，与 ✓ 靠字形区分两种「行」）；双细黄
   ○=缺必要输入；◌=生成中。橄榄灰档整条退役——--text-4 在深底上读作绿，撞
   「绿=好」的颜色心智。渲染唯一出口 developmentRailStatusBadgeHtml；可生成
   判据与该页生成按钮同一份（分镜 storyboardGroupGenerationAvailability /
   成片 videoDevelopmentGroupAvailability）。左栏专属：右栏资产即状态，不挂
   圈；失败态不进圈，沿用既有警示徽章。颜色只在这里定，页内只定位置。 */
.dev-rail-status {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  width:1.3333rem;
  height:1.3333rem;
  border-radius:50%;
  font-size:var(--type-meta);
  font-weight:800;
  line-height:1;
}
.dev-rail-status--generated { color:var(--text-1); background:var(--ok); }
.dev-rail-status--generated-multi { color:var(--text-1); background:var(--ok); }
.dev-rail-status--ready { color:var(--ok); border:0.1481rem solid var(--ok); background:transparent; }
.dev-rail-status--missing { color:var(--warn); border:1px solid var(--warn-line); background:transparent; }
.dev-rail-status--generating { color:var(--warm-1); border:0.1111rem dashed var(--warm-1); background:var(--surface-warm); animation:visual-dev-status-spin 1.2s linear infinite; }
.dev-rail-status-glyph { position:relative; }
.dev-rail-status-glyph--ghost { position:absolute; transform:translate(-0.18em,-0.18em); opacity:.4; }
/* 分镜页左栏：圆圈在卡头行首（左上角，标题之前）——与成片栏同侧同读序
   （2026-09-28 统一心智模型：绿=行/黄=等的圈恒在左上角）。行尾推挤
   （margin-left:auto）已退役。 */
/* 成片页左栏：卡片是通用多模态卡（右上角下载/放大），圆圈走消费方的独立
   槽位通道（videoDevelopmentShotHtml 包一层 slot），叠在卡左上角，不进卡片
   实现，别的复用场景不受影响。 */
.video-dev-rail-slot { position:relative; min-width:0; }
/* 圆圈对齐卡 chrome 标题条垂直居中（条高 2.1111rem，圈 1.3333rem：
   top=(2.1111-1.3333)/2≈0.3889rem）；z 抬过卡 chrome 的 8，悬停高亮条
   （::before，z:8）不许盖住圆圈。 */
.video-dev-rail-slot .dev-rail-status { position:absolute; top:0.3889rem; left:0.4444rem; z-index:9; box-shadow:0 0 0 0.1111rem var(--ink-2); }
/* 标题在成片栏辖域内让出圆圈宽度（左距 0.4444rem + 圈 1.3333rem + 光环
   0.1111rem×2 + 呼吸 0.3333rem = 2.2222rem），标题不再被圆圈叠压；通用
   多模态卡实现零改动，只在消费方槽位辖域内让位。 */
.video-dev-rail-slot .canvas-card-title-button { padding-left:2.2222rem; }
/* 悬停横条退役（2026-09-28 用户报）：卡 chrome 的标题悬停高亮（ink-3
   ::before）是画布岛的交互习惯，在 web 左栏的只读标题上被圆圈光环咬掉
   左端后读成「漂着的横条」。左栏悬停反馈交给卡片自身的描边高亮；消费方
   辖域内退役，且源序在 chrome 规则之后（同特异性靠后者胜）。 */
.video-dev-rail-slot .canvas-card-title-button:hover::before,
.video-dev-rail-slot .canvas-card-title-button:focus-visible::before { background:transparent; }
.storyboard-group-controls { display:flex; align-items:center; gap:0.3333rem; }
.storyboard-shot-row select,.storyboard-shot-row textarea { border:1px solid transparent; border-radius: var(--radius-md); background:var(--ink-4); color:var(--text-1); }
.storyboard-shot-row select { min-height: 1.6667rem; padding:0 0.3889rem; }
.storyboard-set-control { width:1.4444rem; height:1.4444rem; border:1px solid transparent; border-radius: var(--radius-md); background:var(--ink-2); color:var(--text-1); font-size:var(--type-label); cursor:pointer; }
.storyboard-set-control:disabled { background:var(--ink-2); color:var(--text-4); opacity:.36; cursor:not-allowed; }
.storyboard-shot-rows { display:grid; gap:0.4444rem; padding:0 0.1111rem; }
.storyboard-shot-row { display:grid; gap:var(--agent-frame-gap); min-width:0; padding:0; border:0; background:transparent; }
.storyboard-generation-settings-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(8.8889rem,1fr)); gap:0.5556rem; align-items:start; min-width:0; }
.storyboard-generation-settings-grid .storyboard-card-settings,.storyboard-shot-compact { display:contents; }
.storyboard-generation-settings-grid :is(.storyboard-card-setting,.video-dev-field) { min-width:0; }
.storyboard-generation-settings-grid :is(.storyboard-card-setting,.video-dev-field) > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.storyboard-generation-settings-grid :is(select,input,textarea,output) { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.storyboard-card-settings :is(select,input,textarea,output) { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.storyboard-shot-compact .video-dev-field.full { grid-column:auto; }
/* 场次共用三框：宿主只铺一行，唯一的孩子 .storyboard-shot-text-row 自身
   就是三等分列。行高按内容 auto 排列、宽度吃满整行——不许再落进多列
   宿主的第 1 列缩成角落。 */
.storyboard-shared-text-rows { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto; }
/* 三框等宽等高平摊整行：画面内容 | 音效音乐 | 台词旁白。 */
.storyboard-shot-text-row { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0.5556rem; min-height:5.6667rem; min-width:0; }
/* 三根 shot 文本字段的宿主不自成一层网格：display:contents 让三根字段
   成为三框网格的直接子项，三格才可能真的等宽等高。
   宿主自身的 padding/gap 因此失效——它本来也没有。 */
.storyboard-shot-detail { display:contents; }
.storyboard-shot-detail .video-dev-field { display:grid; grid-template-rows:auto auto; gap:0.2778rem; min-width:0; }
/* 表头一律单行，不换行也不裁字：三分之一列仍远宽于最长表头「场次台词旁白」。 */
.storyboard-shot-detail .video-dev-field > span { white-space:nowrap; }
/* 三等分里没有整行字段：撤掉通用的 .full 跨列，三格才等宽。 */
.storyboard-shot-detail .video-dev-field.full { grid-column:auto; }
/* 三框 textarea 随内容长高（滚动法条）：高度像素由全局自动长高工具写入，
   这里只留地板与版式；框内永不滚动。 */
.storyboard-shot-text-row textarea { box-sizing:border-box; width:100%; min-height:5rem; padding:0.4444rem; resize:none; overflow:hidden; font:inherit; line-height:1.35; }
.storyboard-generation-actions { display:flex; align-items:center; flex-wrap:nowrap; gap:0.5556rem; margin-top:auto; padding:0.7778rem; }
.storyboard-image-prompt { display:flex; flex:1 1 auto; flex-direction:column; gap:0.2778rem; min-width:0; color:var(--text-3); font-size:var(--type-meta); position:relative; }
/* 「按轴值对齐格词」悬浮在编辑器右上角：不参与流内布局，编辑器仍是区块
   底边齐平的唯一收口元素（奇偶校验锁按编辑器底边量 bottomGap）。 */
.storyboard-image-prompt .storyboard-cell-align { position:absolute; top:0.3333rem; right:0.3333rem; z-index:2; }
.storyboard-generated-assets { display:grid; grid-template-columns:minmax(0,1fr); align-content:start; gap:var(--agent-frame-gap); min-width:0; }
.agent-canvas-card {
  --agent-card-rail-inset:var(--agent-frame-pad);
  box-sizing:border-box;
  width:100%;
  min-width:0;
  overflow:visible;
  border:var(--canvas-card-stroke-width) solid transparent;
  border-radius:var(--canvas-card-radius);
  background:linear-gradient(180deg,var(--canvas-card-surface-hi),var(--canvas-card-surface)) padding-box,linear-gradient(180deg,var(--edge-cool-hi),var(--edge-cool-mid) 45%,var(--edge-cool-lo)) border-box;
  box-shadow:0 8px 14px var(--ink-scrim);
  color:var(--text-1);
}
.agent-canvas-card.selected {
  border-width:var(--canvas-card-stroke-width-selected);
  background:linear-gradient(180deg,var(--canvas-card-surface-sel-hi),var(--canvas-card-surface-sel)) padding-box,linear-gradient(180deg,var(--edge-warm-sel-hi),var(--edge-warm-sel-mid) 45%,var(--edge-warm-sel-lo)) border-box;
  box-shadow:0 0 0.5556rem var(--canvas-glow-warm);
  /* 选中反馈只落在框体（描边+辉光+底色），文字不跟随翻暖色：文字变暖会被
     读成第二个「文字焦点」，与框体焦点两处指示互相打架（2026-09-13 用户定）。 */
}
.agent-canvas-card [data-agent-card-chrome-host] { height:calc(var(--type-meta) + var(--agent-card-rail-inset) + var(--agent-card-rail-inset)); }
.agent-card-chrome {
  --canvas-card-rail-height:calc(var(--type-meta) + var(--agent-card-rail-inset) + var(--agent-card-rail-inset));
  --canvas-card-action-width:1.7778rem;
  --canvas-card-rail-font-size:var(--type-meta);
  --canvas-card-action-icon-size:0.8889rem;
  position:relative;
  width:100%;
  padding:var(--agent-card-rail-inset);
  pointer-events:none;
}
/* 画布卡的 chrome 选中态会把标题翻暖（.canvas-card-chrome.is-selected），
   agent 卡不跟：选中文字指示已按框体统一（2026-09-13 用户定），标题保持正文色。 */
.agent-card-chrome.is-selected { color:inherit; }
.agent-canvas-card-body { display:grid; gap:var(--agent-frame-gap); min-width:0; padding:var(--agent-frame-pad); border-top:1px solid var(--canvas-card-seam); }
.storyboard-projection-card { cursor:pointer; }
.storyboard-projection-segment { display:grid; gap:0.4444rem; min-width:0; }
.storyboard-group-image-pages { display:grid; gap:0.4444rem; min-width:0; padding-bottom:0.4444rem; border-bottom:1px solid var(--canvas-card-seam); }
.storyboard-group-image-page { min-width:0; margin:0; }
.storyboard-group-image-page img { display:block; width:100%; aspect-ratio:16/9; object-fit:contain; border-radius:var(--radius-sm); background:var(--canvas-card-media-back); cursor:zoom-in; }
.storyboard-group-image-page figcaption { margin-top:0.2222rem; color:var(--text-3); font-size:var(--type-meta); line-height:1.4; text-align:center; }
.storyboard-group-image-page-empty { padding:1rem 0.4444rem; border-radius:var(--radius-sm); background:var(--canvas-card-media-back); color:var(--text-3); font-size:var(--type-meta); line-height:1.4; text-align:center; }
.storyboard-projection-card-content { margin:0; color:var(--text-2); font-size:var(--type-meta); line-height:1.5; overflow-wrap:anywhere; white-space:normal; }
.storyboard-projection-segment + .storyboard-projection-segment { padding-top:0.4444rem; border-top:1px solid var(--canvas-card-seam); }
.storyboard-projection-segment h4 { margin:0; color:var(--text-1); font-size:var(--type-meta); line-height:1.4; overflow-wrap:anywhere; }
.storyboard-projection-references { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0.4444rem; min-width:0; }
.storyboard-projection-references figure { min-width:0; margin:0; }
.storyboard-projection-references img { display:block; width:100%; aspect-ratio:16/9; object-fit:contain; border-radius:var(--radius-sm); background:var(--canvas-card-media-back); cursor:zoom-in; }
[data-media-preview-card-id], [data-media-preview-asset-id] { cursor:zoom-in; }
.storyboard-projection-references figcaption { margin-top:0.2222rem; overflow:hidden; color:var(--text-3); font-size:var(--type-meta); line-height:1.4; text-overflow:ellipsis; white-space:nowrap; }
.storyboard-projection-reference-empty { padding:0.4444rem; border-radius:var(--radius-sm); background:var(--canvas-card-media-back); color:var(--text-3); font-size:var(--type-meta); line-height:1.4; text-align:center; }
.storyboard-projection-prompt { box-sizing:border-box; width:100%; min-height:3.5556rem; padding:0.4444rem; border:0.0556rem solid var(--canvas-card-seam); border-radius:var(--radius-sm); background:var(--canvas-card-media-back); color:var(--text-1); font-size:var(--type-meta); line-height:1.4; white-space:pre-wrap; overflow-wrap:anywhere; cursor:default; user-select:text; }
.storyboard-projection-prompt:empty::before { content:attr(data-placeholder); color:var(--text-3); pointer-events:none; }
.storyboard-card-settings { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(10rem,100%),1fr)); gap:0.4444rem; padding-top:0.4444rem; border-top:1px solid var(--canvas-card-seam); }
.storyboard-card-setting { display:grid; gap:0.2222rem; min-width:0; color:var(--text-3); font-size:var(--type-meta); line-height:1.4; cursor:default; }
.storyboard-cell-aspect-setting { align-items:center; }
.storyboard-cell-aspect-setting[hidden] { display:none; }
.storyboard-card-setting > span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.storyboard-card-setting select,.storyboard-card-setting input { box-sizing:border-box; width:100%; min-width:0; min-height:1.7778rem; padding:0 0.3889rem; border:1px solid transparent; border-radius:var(--radius-md); background:var(--ink-4); color:var(--text-1); font:inherit; }
/* These remain viewport-pixel queries by design. The old 1250/820 thresholds
   assumed fixed 18px components; 1180/880 match the new 16px floor and the
   actual three-column/two-column minimum track sums including the sidebar. */
@media (max-width: 1180px) { .agent-workspace { grid-template-columns:minmax(15.5556rem,1fr) minmax(28.8889rem,1.8fr); max-width:none; } .agent-panel-assets { grid-column:1 / -1; } .storyboard-generated-assets { grid-template-columns:minmax(0,1fr); } }
@media (max-width: 880px) { .agent-workspace { grid-template-columns:1fr; } .agent-workbench-actions > .asset-tool-btn { flex-basis:100%; } .storyboard-shot-text-row { grid-template-columns:minmax(0,1fr); grid-template-rows:repeat(3,auto); } }
.field-label { font-size: var(--type-meta); color: var(--text-3); margin-bottom: 0.3333rem; text-transform: uppercase; letter-spacing: 1px; }

/* ============================================================ */
/* PAGE 6: VIDEO GENERATION                                     */
/* ============================================================ */
.video-layout {
  display: flex;
  flex-direction: column;
  gap: 0.8889rem;
}
.gen-toolbar {
  background: var(--ink-1);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  padding: 0.8889rem 1.1111rem;
  display: flex; align-items: center; gap: 0.7778rem;
  flex-wrap: wrap;
}
.gen-toolbar .label { font-size: var(--type-label); color: var(--text-3); }
.select-mini {
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.3333rem 0.5556rem;
  font-size: var(--type-label);
  color: var(--text-1);
  cursor: pointer;
  display: flex; align-items: center; gap: 0.3333rem;
}
.select-mini svg { color: var(--text-3); }
.gen-toolbar .credits {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.4444rem;
  padding: 0.3333rem 0.6667rem;
  background: var(--bad-wash);
  border: 1px solid var(--bad-line);
  border-radius: 55.5rem;
  font-size: var(--type-label);
  color: var(--bad);
}

.video-dev-asset-card { width:100%; text-align:left; margin:0; cursor:pointer; }
.video-dev-asset-title { display:block; min-width:0; overflow-wrap:anywhere; font-size:var(--type-meta); font-weight:600; }
.video-dev-asset-meta { display:block; min-width:0; overflow-wrap:anywhere; margin-top:0.2222rem; color:var(--text-3); font-size:var(--type-meta); line-height:1.4; }
.video-dev-asset-copy { min-width:0; padding:0; }
.agent-panel-body[data-video-dev-storyboard],.agent-panel-body[data-video-dev-assets] { display:grid; gap:var(--agent-frame-gap); align-content:start; }
.video-dev-layer { flex:0 0 auto; }
/* 成片提示词条是本页唯一吃余高的一级；框身随内容长高，绝不内部滚动。 */
.video-dev-prompt-section { flex:1 1 auto; flex-direction:column; gap:0.2778rem; }
/* 指定 min-height 地板会取代弹性布局的自动内容最小值：不禁收缩的话，内容
   一旦超过工作台剩余高度，链条会被压回地板、长提示词溢出框外。禁收缩后
   装不下由工作台唯一滚动区整把滚（min-height 只留空态防塌缩）。 */
#page-video .video-dev-prompt-section,
#page-video [data-video-dev-prompt] { flex-shrink:0; }
.video-dev-layer > h3, .video-dev-prompt-section > h3 { margin:0; font-size:var(--type-label); color:var(--text-2); font-weight:650; }
.video-dev-layer .storyboard-card-settings { grid-template-columns:repeat(4,minmax(0,1fr)); }
.video-dev-field { display:flex; flex-direction:column; gap:0.2778rem; font-size:var(--type-meta); color:var(--text-3); }
.video-dev-field.full { grid-column:1 / -1; }
.video-dev-field input, .video-dev-field textarea, .video-dev-field select { width:100%; box-sizing:border-box; color:var(--text-1); background:var(--ink-4); border:1px solid transparent; border-radius: var(--radius-md); padding:0.4444rem; font:inherit; }
.video-dev-field textarea { min-height:2.5rem; resize:none; overflow:hidden; }
.video-dev-prompt-editor { display:flex; flex-direction:column; box-sizing:border-box; width:100%; min-height:4.8889rem; border-radius:var(--radius-md); line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.video-dev-prompt-segment { display:flex; flex:1 0 auto; flex-direction:column; }
.video-dev-prompt-segment-editor { flex:1 0 auto; min-height:1.45em; outline:none; }
.video-dev-prompt-segment-editor:empty::before { content:attr(data-placeholder); color:var(--text-3); pointer-events:none; }
.video-dev-prompt-segment + .video-dev-prompt-segment { margin-top:.6667rem; padding-top:.6667rem; border-top:0.0556rem solid var(--line-1); }
.video-dev-page-error { flex:0 0 auto; color:var(--bad); font-size:var(--type-meta); line-height:1.45; padding:0 0.7778rem; }
.video-dev-page-error:empty { display:none; }
.video-dev-asset-card video { box-sizing:border-box; display:block; width:100%; height:auto; max-height:none; background:var(--ink-scrim); object-fit:contain; }
.video-dev-dialog[hidden] { display:none; }
.video-dev-dialog { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:1.1111rem; background:var(--ink-scrim); }
.video-dev-dialog-panel { width:min(28.8889rem,100%); max-height:80vh; overflow:auto; padding:1.1111rem; border:1px solid transparent; border-radius: var(--radius-lg); background:var(--ink-1); }
.video-dev-dialog-panel h2 { margin:0 0 0.4444rem; }
.video-dev-batch-row { display:flex; justify-content:space-between; gap:0.6667rem; padding:0.5rem 0; border-top:1px solid var(--line-1); font-size:var(--type-meta); }
.video-dev-dialog-actions { display:flex; justify-content:flex-end; gap:0.4444rem; margin-top:0.8889rem; }
.video-card {
  background: var(--ink-1);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.video-thumb-area {
  aspect-ratio: 16/9;
  position: relative;
  background: var(--ink-3);
}
.video-status-overlay {
  position: absolute; inset: 0;
  background: var(--ink-scrim);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 0.4444rem;
}
.spinner {
  width: 1.7778rem; height: 1.7778rem;
  border: 0.1667rem solid var(--edge-warm-lo);
  border-top-color: var(--edge-warm-sel-hi);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner.mini {
  width: 0.8889rem;
  height: 0.8889rem;
  border-width: 0.1111rem;
  border-color: var(--line-3);
  border-top-color: var(--text-1);
}
.loading-dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: loadingDots 1.1s steps(4, end) infinite;
}
.generation-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5556rem;
  overflow: hidden;
  background: var(--surface-warm);
  contain: paint;
}
.generation-loader::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 46%;
  background: var(--surface-warm-hi);

  transform: translate3d(-130%,0,0);
  animation: surfaceSweep 1.8s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  will-change: transform;
  pointer-events: none;
}
.generation-loader.compact { gap: 0.4444rem; }
.generation-loader > * {
  position: relative;
  z-index: 1;
}
.generation-loader-title {
  color: var(--text-2);
  font-size: var(--type-meta);
  font-weight: 700;
}
.generation-loader .spinner,
.generation-loader-title {
  display: none;
}
.generation-loader-bar {
  width: min(10rem, 70%);
  height: 0.1667rem;
  overflow: hidden;
  border-radius: 55.5rem;
  background: var(--ink-3);
}
.generation-loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--surface-warm-hi);

  animation: progressIndeterminate 1.05s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* 2026-09-16 取消产品化裁决：生成取消锚定小菜单（转圈点开后出现） */
.gen-cancel-menu {
  position: fixed;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 13rem;
  max-width: 16rem;
  padding: 0.6667rem;
  background: var(--surface-warm);
  border: 1px solid var(--edge-warm-mid);
  border-radius: 0.6111rem;
  box-shadow: 0 18px 48px var(--ink-scrim);
}
.gen-cancel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6667rem;
  font-size: var(--type-meta);
  color: var(--text-2);
}
/* 行/键用 hidden 属性切换可见性：flex/inline-flex 会盖过 UA 的 [hidden]。 */
.gen-cancel-menu [hidden] {
  display: none !important;
}
.gen-cancel-row-value {
  color: var(--text-1);
  font-weight: 700;
}
.gen-cancel-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3889rem;
  padding: 0.3889rem 0.6111rem;
  border: 1px solid var(--bad-line);
  border-radius: 0.5556rem;
  background: var(--bad-wash);
  color: var(--bad);
  font-size: var(--type-meta);
  font-weight: 700;
  cursor: pointer;
}
.gen-cancel-button:not(:disabled):hover {
  border-color: var(--bad);
}
.gen-cancel-button:disabled {
  opacity: 0.62;
  cursor: default;
}
.gen-cancel-icon {
  display: inline-flex;
}
.gen-cancel-error {
  font-size: var(--type-meta);
  color: var(--bad);
}
@keyframes statusPulse {
  0%, 100% { transform: scale(0.9); opacity: 0.75; }
  50% { transform: scale(1.35); opacity: 1; }
}
@keyframes statusSweep {
  to { transform: translate3d(120%,0,0); }
}
@keyframes surfaceSweep {
  0% { transform: translate3d(-130%,0,0); }
  100% { transform: translate3d(240%,0,0); }
}
@keyframes progressIndeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}
@keyframes progressSweep {
  0% { background-position: -60% 0, 0 0; }
  100% { background-position: 160% 0, 0 0; }
}
@keyframes actionButtonSweep {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(130%); }
}
@keyframes actionButtonPending {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes actionButtonSuccess {
  0% { box-shadow: none; }
  34% { box-shadow: none; transform: translateY(-1px) scale(1.018); }
  100% { box-shadow: none; transform: translateY(0) scale(1); }
}
@keyframes actionButtonFail {
  0%, 100% { box-shadow: none; filter: saturate(1); }
  50% { box-shadow: none; filter: saturate(1.16); }
}
@keyframes entityCardFlash {
  0% { transform: translateY(-0.1111rem); box-shadow: none; }
  100% { transform: translateY(0); box-shadow: none; }
}
@keyframes loadingDots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75%, 100% { content: '...'; }
}
.video-status-text { font-size: var(--type-meta); color: var(--text-2); }
.video-progress-mini {
  width: 80%;
  height: 0.1667rem;
  background: var(--ink-3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.video-progress-mini div {
  height: 100%;
  background: var(--surface-warm-hi);

  animation: progressBreath 1.2s ease-in-out infinite;
}
.video-status-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--surface-warm);

  transform: translateX(-120%);
  animation: statusSweep 1.4s ease-in-out infinite;
}
.video-status-overlay > * {
  position: relative;
  z-index: 1;
}
@keyframes progressBreath {
  0%, 100% { filter: brightness(0.85); }
  50% { filter: brightness(1.35); }
}

.video-meta { padding: 0.6667rem 0.7778rem; }
.video-actions { display: flex; gap: 0.3333rem; margin-top: 0.5556rem; }
.video-act-btn {
  flex: 1;
  padding: 0.3333rem;
  background: var(--ink-2);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--type-meta);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center; gap: 0.2222rem;
}
.video-act-btn:hover { background: var(--ink-3); color: var(--text-1); }
.video-act-btn.primary { background: var(--surface-warm-hi); border-color: var(--edge-warm-mid); color: var(--warm-1); }

.storyboard-media-tools .asset-tool-btn {
  min-width: 4rem;
}

/* Shared bound action button system */
.asset-tool-btn,
.btn-secondary,
.btn-ghost,
.video-act-btn,
.select-mini {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid transparent;
  color: var(--text-1);
  box-shadow: none;
  transform: translateY(0) scale(1);
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease,
    border-color 0.18s ease;
}
.asset-tool-btn.primary,
.btn-primary,
.video-act-btn.primary,
.app-dialog.danger .app-dialog-confirm {
  background: linear-gradient(180deg, var(--surface-warm-hi), var(--surface-warm)) padding-box, linear-gradient(180deg, var(--edge-warm-hi), var(--edge-warm-mid) 45%, var(--edge-warm-lo)) border-box;
  border-color: transparent;
  color: var(--warm-1);
  box-shadow: inset 0 1px 0 var(--inset-warm), var(--lift-1);
}
.asset-tool-btn::after,
.btn-primary::after,
.btn-secondary::after,
.btn-ghost::after,
.video-act-btn::after,
.select-mini::after {
  content: '';
  position: absolute;
  inset: -1px;
  z-index: 0;
  background: var(--ink-2);

  opacity: 0;
  transform: translateX(-130%);
  pointer-events: none;
}
.asset-tool-btn:not(:disabled):hover,
.btn-primary:not(:disabled):hover,
.btn-secondary:not(:disabled):hover,
.btn-ghost:not(:disabled):hover,
.video-act-btn:not(:disabled):hover,
.select-mini:not(:disabled):hover {
  border-color: transparent;
  background: var(--ink-3);
  box-shadow: none;
  filter: brightness(1.06);
  transform: translateY(-0.1111rem) scale(1.01);
}
.asset-tool-btn:not(:disabled):hover::after,
.btn-primary:not(:disabled):hover::after,
.btn-secondary:not(:disabled):hover::after,
.btn-ghost:not(:disabled):hover::after,
.video-act-btn:not(:disabled):hover::after,
.select-mini:not(:disabled):hover::after {
  opacity: 1;
  transform: translateX(130%);
  transition: transform 0.62s ease, opacity 0.18s ease;
}
.asset-tool-btn:not(:disabled):active,
.asset-tool-btn.action-feedback-press,
.btn-primary:not(:disabled):active,
.btn-primary.action-feedback-press,
.btn-secondary:not(:disabled):active,
.btn-secondary.action-feedback-press,
.btn-ghost:not(:disabled):active,
.btn-ghost.action-feedback-press,
.video-act-btn:not(:disabled):active,
.video-act-btn.action-feedback-press,
.select-mini:not(:disabled):active,
.select-mini.action-feedback-press {
  transform: translateY(1px) scale(0.985);
  box-shadow: none;
  filter: brightness(0.98);
}
/* 2026-09-16 取消产品化裁决：busy 片段本身是取消菜单触发器（转圈可点），
   原 pointer-events:none 退役——否则 busy 期间指针事件全被吞掉，菜单开不出来。 */
.is-action-busy,
.is-running[data-generation-cancel-trigger],
.generation-loader[data-generation-cancel-trigger] {
  cursor: pointer;
}
.action-feedback-pending {
  background: linear-gradient(90deg, var(--surface-warm) 0%, var(--edge-warm-hi) 50%, var(--surface-warm) 100%);
  background-size: 200% 100%;
  box-shadow: none;
  animation: actionButtonPending 1.45s linear infinite;
}
.action-feedback-pending::after {
  opacity: 1;
  animation: actionButtonSweep 1.45s linear infinite;
}
.action-feedback-success {
  background: var(--ok-wash);
  color: var(--ok);
  animation: actionButtonSuccess 0.56s ease both;
}
.action-feedback-fail {
  background: var(--bad-wash);
  color: var(--bad);
  animation: actionButtonFail 0.42s ease both;
}

.video-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink-0);
  opacity: 0;
  transition: opacity 0.2s;
}
.video-thumb-area:hover .video-play-overlay { opacity: 1; }
.play-circle {
  width: 2.4444rem; height: 2.4444rem;
  background: var(--text-1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  /* contrast-token-exempt: deep text on a solid light background. */
  color: var(--ink-0);
}

/* Viewport queries are deliberately px-based. Their values were recalibrated
   against the 16px clamp floor after all owned component dimensions became rem. */
@media (max-width: 1180px) {
  .entity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #page-storyboard {
    padding-right: 0.5556rem;
    padding-left: 0.5556rem;
  }
}
@media (max-width: 1000px) {
  #page-hub.page { height: auto; overflow: visible; }
  .hub-dashboard { grid-template-columns: 1fr; height: auto; }
  /* 滚动法条：窄屏下 page-wrap 是唯一一级滚动区，两张卡随内容排高，
     不许自带滚动层叠在它里面。 */
  .progress-card { overflow: visible; }
  .hub-media-panel { height: auto; }
  .hub-media-scroll { flex: 0 0 auto; min-height: 0; overflow: visible; overscroll-behavior: auto; scrollbar-gutter: auto; }
}

/* Adapt the topbar to the width of the workspace it actually owns. */
@container workspace (max-width: 780px) {
  /* Stay a single row so the top bar height is stable and its bottom edge lines
     up with the sidebar logo area; the breadcrumb truncates and the status pill
     shrinks instead of wrapping to a second row. */
  .topbar {
    grid-template-areas: "lead status trail";
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto;
    gap: 0.4444rem 0.5556rem;
    padding: 0.3333rem 0.8889rem;
  }
  .topbar-lead { grid-area: lead; width: auto; min-width: 0; }
  .topbar-trail { grid-area: trail; }
  .breadcrumb { max-width: 8.8889rem; }
  .topbar-center {
    grid-area: status;
    max-width: none;
  }
  .topbar-status.topbar-overview {
    grid-area: status;
    max-width: none;
  }
}

@container workspace (max-width: 520px) {
  /* 窄窗口同样保持单行（面包屑 | 状态条）。上下堆叠会让顶栏再高一截，
     那就不叫恒定高度了。 */
  .topbar {
    grid-template-areas: "lead status";
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    padding: 0.3333rem 0.6667rem;
  }
  .breadcrumb { max-width: 5.5556rem; }
  .topbar-trail { display: none; }
}

@media (max-width: 680px) {
  .entity-grid { grid-template-columns: 1fr; }
}

/* Development workbench section owner: settings first, attributes next, prompt last.
   A single rhythm applies before and after the asynchronous axis mount. */
:is(#page-board, #page-storyboard, #page-video) .agent-workbench-layout {
  --workbench-section-space: 0.6667rem;
  gap: var(--workbench-section-space);
}
:is([data-axis-ui-generation-settings], [data-storyboard-generation-settings], [data-video-dev-generation-settings],
    .visual-dev-workbench > [data-axis-ui-host], [data-storyboard-shared-fields],
    .video-dev-prompt-section) {
  margin: 0;
  padding-top: var(--workbench-section-space);
  border-top: 1px solid var(--line-1);
}
.visual-dev-workbench { gap: var(--workbench-section-space); }
:is(#page-board, #page-storyboard, #page-video) [data-axis-section-id="axis_controls"] > .axis-control-region__section-title,
:is(#page-board, #page-storyboard, #page-video) [data-axis-section-id="generation_settings"] > .axis-control-region__section-title { display:none; }
/* 成片页分镜专属区（格页标签 + 轴区下拉）沿用 .storyboard-cell-property 的
   带边框面板原形，与分镜开发页属性框同构；此前把区域剥成上分割线的覆写
   已随区域面板化移除（2026-09-14 用户定）。 */

/* Axis UI Bundle projection.  Every development surface receives this same
   four-section shell; page code supplies only the existing section bodies. */
.axis-control-region {
  display: grid;
  gap: 0.7778rem;
  min-width: 0;
}
.axis-control-region__section {
  display: grid;
  gap: 0.5rem;
  min-width: 0;
  padding-top: 0.6667rem;
  border-top: 1px solid var(--line-1);
}
.axis-control-region__section:first-child { padding-top: 0; border-top: 0; }
.axis-control-region__section[hidden] { display: none; }
.axis-control-region__section-title {
  margin: 0;
  color: var(--text-2);
  font-size: var(--type-label);
  font-weight: 650;
  line-height: 1.3;
}
.axis-control-region__section-body,
.axis-ui-external,
.canvas-card-popover-generation-settings,
.canvas-card-popover-reference-assets,
.canvas-card-popover-content-prompts {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
/* 工作台都是窄列，轴字段行按 8.8889rem 地板宽度换行铺开——单行加横向
   滚动会把尾部控件切在外框后面、细滚动条又几乎不可见。渲染器按容器宽度
   算「最少行数下尽量平均」的整除列宽写进 --axis-field-basis（列数 =
   ceil(标准 ÷ ceil(标准 ÷ 可容轨数)) 再以本次控件数封顶；变体组以组内
   最大轴数为标准，见 docs/ui-behavior-model.md 2026-09-12 分行数学）；
   余数行复用同一列宽并留空，不再平分自己的空余空间。量不出时退回地板宽度自然换行。
   画布卡弹层是唯一不按此列宽的宿主，由它自己的覆写声明（固定 112px 基宽）。 */
.axis-control-region__section-body[data-axis-fields] {
  --axis-field-floor: 8.8889rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5556rem;
}
.axis-control-region__field {
  display: grid;
  flex: 0 1 var(--axis-field-basis, var(--axis-field-floor, 8.8889rem));
  gap: 0.2778rem;
  min-width: 0;
}
.axis-control-region__field-label { color: var(--text-3); font-size: var(--type-meta); }
.axis-control-region__select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 2rem;
  padding: 0.3889rem 0.5556rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  color: var(--text-1);
  font: inherit;
}
.axis-control-region__select:focus-visible { outline: 1px solid var(--warm-1); outline-offset: 1px; }
.axis-control-region__select:disabled { color: var(--text-3); cursor: not-allowed; opacity: 0.72; }
/* 未设置态（2026-09-21 用户裁决）：控件显示「未设置」时文字置灰，与已设置项
   一眼区分；选中任意真实值后数据位翻转为 selected，颜色自动恢复正文色。 */
.axis-control-region__field .axis-control-region__select[data-axis-value-state="unset"] { color: var(--text-3) !important; }
.axis-control-region__loading,
.axis-control-region__error {
  padding: 0.6667rem;
  border: 1px solid var(--line-1);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: var(--type-meta);
}
.axis-control-region__error { color: var(--bad); border-color: var(--bad-line); }
.canvas-card-popover-generation-controls {
  display: flex;
  min-width: 0;
  gap: 5px;
  flex-wrap: wrap;
}
.canvas-card-popover .axis-control-region { gap: 7px; }
.canvas-card-popover .axis-control-region__section { gap: 5px; padding-top: 6px; }
/* 弹层是紧凑浮层：这里才保留单行横向滚动，契约自持、不再继承基座行为。 */
/* 滚动法条（2026-09-12）：弹层自身是唯一滚动层，轴字段行改换行，
   不再保留单行横向滚动（那是嵌在弹层滚动里的第二层）。 */
.canvas-card-popover .axis-control-region__section-body[data-axis-fields] {
  gap: 5px;
  flex-wrap: wrap;
}
.canvas-card-popover .axis-control-region__field { flex: 1 0 112px; }
.canvas-card-popover .axis-control-region__select { min-height: 30px; padding: 4px 7px; font-size: 11px; }
/* ===== 页面没装全时的兜底条 =====
 * 这个页面靠四十个独立请求装起来，网络抖一下掉掉其中任何一个脚本，后面的脚本
 * 就全部崩在同一个未定义的名字上，用户看到的是一整块黑屏、没有任何说明。这条
 * 是那种时刻唯一还活着的界面，所以它的样式必须写在这里、不许依赖任何外部文件。
 * 冷族：底 ink-1、边 line-3，同温。 */
.boot-incomplete {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--ink-1);
  border-top: 1px solid var(--line-3);
  color: var(--text-1);
  font-size: var(--type-label);
  line-height: 1.35;
}
.boot-incomplete[hidden] { display: none; }
.boot-incomplete-line { margin: 0; }
.boot-incomplete-reload {
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--line-3);
  border-radius: 0.35rem;
  background: var(--ink-2);
  color: var(--text-1);
  font: inherit;
  cursor: pointer;
}
.boot-incomplete-reload[hidden] { display: none; }
.boot-incomplete-reload:hover { background: var(--ink-3); }

/* ==== 自 index.html 内嵌样式分叉收编（2026-10-19 退役内嵌分叉）====
   这些选择器此前只存在于内嵌分叉（分叉后加载、同特异性覆盖本文件），
   逐字搬运，改动前先读 tests/test_card_chrome_hover_static.py 的对账锁。 */
.api-token-actions {display: flex; flex-wrap: nowrap; align-items: stretch; gap: 0.5556rem;}
.api-token-actions > form {display: contents;}
.api-token-issued {display: grid; gap: 0.5556rem; margin-top: 0.7778rem; padding: 0.7778rem; border: 1px solid var(--edge-cool-sel-mid); border-radius: var(--radius-md); background: var(--ink-2);}
.api-token-issued code {display: block; overflow-wrap: anywhere; padding: 0.5556rem 0.6667rem; border: 1px solid var(--line-1); border-radius: var(--radius-sm); background: var(--ink-1); font-size: var(--type-label); color: var(--text-1);}
.api-token-issued p {margin: 0;}
.api-token-issued-actions {display: flex; gap: 0.5556rem;}
.api-token-list {display: grid; gap: 0.5556rem; margin-top: 0.7778rem;}
.api-token-row {display: flex; align-items: center; gap: 0.6667rem; padding: 0.5556rem 0.6667rem; border: 1px solid var(--line-1); border-radius: var(--radius-md); background: var(--ink-2);}
.api-token-row-meta {display: flex; align-items: center; gap: 0.6667rem; margin-left: auto; flex: 0 1 auto; min-width: 0; color: var(--text-3); font-size: var(--type-label); white-space: nowrap;}
.api-token-row-meta code {font-size: var(--type-label); color: var(--text-2);}
.api-token-row-name {min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--type-body); color: var(--text-1);}
.canvas-card-popover-mock-label {color: var(--warm-1); font: 11px/1.4 Inter,-apple-system,BlinkMacSystemFont,sans-serif; padding: 0 2px 4px;}
.canvas-card-popover-mock-label[hidden] {display: none;}
.project-load-actions button[hidden] {display: none;}
.settings-section-card[hidden] {display: none;}
.visual-dev-workbench > [data-axis-ui-host], .visual-dev-workbench [data-axis-ui-host] > .axis-control-region, .visual-dev-workbench [data-axis-section-id="content_and_prompts"], .visual-dev-workbench [data-axis-section-id="content_and_prompts"] > .axis-control-region__section-body, .visual-dev-workbench [data-axis-ui-content-prompts] > .agent-reference-prompt-section, .visual-dev-workbench [data-axis-ui-content-prompts] .agent-reference-prompt-editor {flex-shrink:0;}
:is(#page-board, #page-storyboard, #page-video) .agent-workbench-layout > * {flex-shrink: 0;}
body.script-text-upload-paused #page-brief .upload-zone {display: none;}
#page-video [data-video-dev-prompt] {flex-shrink: 0;}
