:root {
  --ink: #101418;
  --ink-soft: #35434a;
  --paper: #f8f9fa;        /* 参考图冷白底：让品牌蓝成为唯一视觉重音 */
  --panel: #ffffff;
  --surface-tint: #f7fbfc;
  --gray: #eef3f5;
  --gray2: #dfe8ec;
  --line: #dde6e9;
  --line-strong: #c7d6dc;
  --muted: #66747b;
  --faint: #95a2a8;
  --rose: #a94f58;
  --brand: #479fbf;        /* 参考图主蓝：图标、描边、选中与运行状态 */
  --brand-deep: #2d7e9c;
  --brand-soft: #e8f4f8;
  --brand-rgb: 71, 159, 191;
  --blue: #479fbf;
  --good: #327c62;
  --warn: #a9702f;
  --bad: #a94f58;
  --rail: #ffffff;
  --rail-soft: #f1f7f9;
  --rail-line: #dde6e9;
  --rail-muted: #78878e;
  --shadow-sm: 0 1px 2px rgba(16, 20, 24, .04), 0 10px 28px rgba(16, 20, 24, .055);
  --shadow: 0 26px 72px rgba(16, 20, 24, 0.14);
  --display: "Avenir Next", "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.14s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.is-pressed:not(:disabled) {
  transform: translateY(1px) scale(0.985);
}

button:focus-visible {
  outline: 3px solid rgba(var(--brand-rgb), 0.24);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  height: 100vh;
  padding: 16px 8px 14px;
  overflow: hidden;
  background: var(--rail);
  border-right: 1px solid var(--rail-line);
  color: var(--ink);
  box-shadow: 8px 0 28px rgba(16, 20, 24, .035);
}

.rail-brand {
  color: var(--ink);
  user-select: none;
  cursor: pointer;
}

.rail-brand img {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(16, 20, 24, .12);
}

.nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}
.nav::-webkit-scrollbar { display: none; }

.rail-sep {
  height: 1px;
  margin: 4px 14px;
  background: var(--rail-line);
  flex: none;
}

.nav-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 13px 4px 11px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--rail-muted);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.nav-button:hover {
  background: var(--rail-soft);
  color: var(--brand-deep);
}
.nav-button.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.nav-icon {
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
}
.nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.nav-label {
  font-size: 10px;
  letter-spacing: .06em;
}

.rail-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: none;
  padding-top: 10px;
  border-top: 1px solid var(--rail-line);
  width: 100%;
}
.rail-user {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-deep);
  box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .13);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  padding: 0;
}
.rail-user:hover {
  background: var(--brand-deep);
}

/* 头像浮窗：挂 body 直下 + fixed 定位（避开侧边栏 overflow/堆叠上下文），低于 lightbox/modal(1000+) */
.user-menu {
  position: fixed;
  left: 96px;
  bottom: 14px;
  z-index: 400;
  min-width: 190px;
  max-width: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.user-menu-head {
  margin-bottom: 6px;
  padding: 6px 10px 9px;
  border-bottom: 1px solid var(--line);
}
.user-menu-email {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-membership {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}
.user-menu-membership.vip { color: var(--brand-deep); }
.user-menu-membership.expired { color: var(--rose); }
.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  text-decoration: none;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.user-menu-item:hover {
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.user-menu-danger { color: var(--rose); }
.user-menu-danger:hover {
  background: rgba(173, 93, 98, 0.1);
  color: var(--rose);
}

.main {
  min-width: 0;
  height: 100vh;
  padding: 28px 32px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  background: var(--paper);
}

.topbar {
  position: sticky;
  top: -28px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 28px 0 14px;
  background: rgba(248, 249, 250, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.context-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

h2 {
  font-family: var(--display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 模特库 / 工作流画布页：隐藏右上角项目下拉 + 检测 ComfyUI + 新建专属模特，只留页头标题 */
.topbar[data-page="modelLibrary"] .top-actions,
.topbar[data-page="canvas"] .top-actions {
  display: none;
}

/* 工作流画布页：页头右上角放画布选择器（动作迁移画布 / 图生视频画布），其它页隐藏 */
.topbar-canvas-mode { display: none; }
.topbar[data-page="canvas"] .topbar-canvas-mode {
  display: inline-flex; align-items: center;
  font-size: 12px; color: var(--muted);
}
.cmode { position: relative; }
.cmode-btn {
  display: inline-flex; align-items: center; gap: 10px; min-width: 150px;
  padding: 10px 14px; font-size: 14px; color: var(--ink); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.cmode-btn:hover { border-color: rgba(var(--brand-rgb), .5); }
.cmode.open .cmode-btn { border-color: rgba(var(--brand-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .11); }
.cmode-label { flex: 1; white-space: nowrap; text-align: left; }
.cmode-caret {
  flex: none; width: 12px; height: 8px; transition: transform .18s ease;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a7169' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cmode.open .cmode-caret { transform: rotate(180deg); }
.cmode-menu {
  position: absolute; z-index: 200; top: calc(100% + 6px); right: 0; min-width: 100%;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.cmode-menu[hidden] { display: none; }
.cmode-opt {
  white-space: nowrap; text-align: left; padding: 9px 12px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-soft); font-size: 14px; cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.cmode-opt:hover { background: var(--gray); color: var(--ink); }
.cmode-opt.sel { background: var(--brand-soft); color: var(--brand-deep); font-weight: 650; }

/* 头部模式 + 任务 两个下拉并排 */
#topbarCanvasMode { display: inline-flex; align-items: center; gap: 8px; }
/* 画布「任务」下拉 */
.ctask { position: relative; }
.ctask-btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  padding: 10px 12px; font-size: 14px; color: var(--ink); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.ctask-btn:hover { border-color: rgba(var(--brand-rgb), .5); }
.ctask.open .ctask-btn { border-color: rgba(var(--brand-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .11); }
.ctask-tag { flex: none; font-size: 11px; color: #fff; background: var(--brand-deep); border-radius: 5px; padding: 2px 6px; }
.ctask-btn-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; max-width: 150px; }
.ctask.open .ctask-btn .cmode-caret { transform: rotate(180deg); }
.ctask-menu {
  position: absolute; z-index: 200; top: calc(100% + 6px); right: 0; width: 320px;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.ctask-menu[hidden] { display: none; }
.ctask-new {
  text-align: left; padding: 9px 12px; border: 1px dashed rgba(var(--brand-rgb), .4); border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-deep); font-size: 13px; font-weight: 650; cursor: pointer;
}
.ctask-new:hover { background: color-mix(in srgb, var(--brand-soft) 78%, var(--brand) 22%); }
.ctask-list { display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.ctask-empty { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }
.ctask-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px;
  cursor: pointer; transition: background-color .12s ease;
}
.ctask-item:hover { background: var(--gray); }
.ctask-item.sel { background: var(--brand-soft); }
.ctask-thumb { flex: none; width: 40px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--gray2); }
.ctask-thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.ctask-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ctask-name { font-size: 13px; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctask-item.sel .ctask-name { color: var(--brand-deep); }
.ctask-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctask-actions { flex: none; display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; }
.ctask-item:hover .ctask-actions { opacity: 1; }
.ctask-ico {
  width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent;
  font-size: 13px; cursor: pointer; color: var(--ink-soft);
}
.ctask-ico:hover { background: rgba(0, 0, 0, .08); }

/* 基础资产页（商品衣物/背景）不属于某个模特，隐藏模特相关的页头与操作，只留页面标题 */
.topbar[data-page="clothing"] .eyebrow,
.topbar[data-page="clothing"] .context-subtitle,
.topbar[data-page="clothing"] .top-actions,
.topbar[data-page="background"] .eyebrow,
.topbar[data-page="background"] .context-subtitle,
.topbar[data-page="background"] .top-actions {
  display: none;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 11px 12px;
  border-radius: 11px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

/* 自定义下拉框：去掉原生外观，换成项目风格的箭头 */
select:not([multiple]) {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a7169' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:not([multiple]):hover {
  border-color: rgba(var(--brand-rgb), 0.42);
}

select::-ms-expand {
  display: none;
}

.form-subhead {
  padding: 9px 11px;
  color: var(--ink-soft);
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

select:focus,
input:focus,
textarea:focus {
  border-color: rgba(var(--brand-rgb), 0.72);
  background-color: var(--panel);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.11);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.top-actions select {
  width: 240px;
}

.danger,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  line-height: 1;
  white-space: nowrap;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: var(--brand-deep);
  border: 1px solid var(--brand-deep);
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(var(--brand-rgb), .22);
  transition: filter 0.15s ease, transform 0.12s ease, box-shadow .16s ease;
}

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--gray);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 20px;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.danger {
  background: #fff5f3;
  color: var(--bad);
  border-color: #e7c7c4;
}

.small-button {
  min-height: 32px;
  padding: 5px 13px;
  background: var(--gray);
  color: var(--ink);
  border-radius: 999px;
  font-size: 12.5px;
}

.primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 10px 24px rgba(var(--brand-rgb), .28);
  transform: translateY(-1px);
}

.primary:active:not(:disabled) {
  transform: translateY(1px);
}

.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.small-button.strong:hover:not(:disabled) {
  background: var(--ink);
  filter: brightness(1.18);
}

.ghost:hover:not(:disabled) {
  background: var(--gray2);
}

.small-button:hover:not(:disabled) {
  background: var(--gray2);
}

.segment:hover:not(:disabled),
.asset-preset:hover:not(:disabled),
.guide-step:hover:not(:disabled) {
  border-color: rgba(var(--brand-rgb), 0.38);
  background: var(--gray);
}

.danger:hover:not(:disabled),
.small-button.danger:hover:not(:disabled) {
  background: #ffecea;
  border-color: #d9a9a4;
  color: #883636;
  box-shadow: 0 9px 20px rgba(164, 73, 73, 0.12);
  transform: translateY(-1px);
}

/* 状态类必须压过 .ghost/.small-button 等的 :hover:not(:disabled) 规则（0,3,0），
   否则悬停时会变成"近白底 + 近白字"看起来文字消失，故补 (0,3,1) 的选择器。 */
button.is-loading,
button.is-loading:hover,
button.is-loading:hover:not(:disabled) {
  color: #fff;
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  box-shadow: 0 10px 26px rgba(var(--brand-rgb), 0.22);
}

button.is-success,
button.is-success:hover,
button.is-success:hover:not(:disabled) {
  color: #fff;
  background: var(--good);
  border-color: var(--good);
  box-shadow: 0 10px 26px rgba(50, 115, 95, 0.26);
}

button.is-error,
button.is-error:hover,
button.is-error:hover:not(:disabled) {
  color: #fff;
  background: var(--bad);
  border-color: var(--bad);
  box-shadow: 0 10px 26px rgba(164, 73, 73, 0.24);
}

.button-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 250, 243, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 0.72s linear infinite;
}

.button-status-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 250, 243, 0.18);
  font-size: 12px;
  font-weight: 900;
}

.button-ripple {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  transform: scale(0);
  animation: button-ripple 0.52s ease-out forwards;
}

.stage-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 14px 0 22px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.stage-strip-label {
  display: grid;
  align-content: center;
  flex: 0 0 128px;
  min-height: 58px;
  padding: 8px 12px 8px 8px;
  border-right: 1px solid var(--line);
}

.stage-strip-label strong {
  font-size: 13px;
}

.stage-strip-label span {
  color: var(--muted);
  font-size: 12px;
}

.stage-pill {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  flex: 1 0 158px;
  gap: 9px;
  min-height: 58px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--gray);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.stage-pill + .stage-pill {
  margin-left: 6px;
}

.stage-pill:hover {
  color: var(--ink);
  background: var(--gray2);
}

.stage-pill.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

/* 预留:未来若接入「已完成段」判定,直接落这个类即可(当前 renderStages 只区分 active/非active) */
.stage-pill.completed {
  color: #fff;
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.stage-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(22, 22, 22, 0.08);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.stage-pill.active .stage-index {
  background: var(--brand-deep);
  color: white;
}

.stage-copy {
  min-width: 0;
}

.stage-pill strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-pill span {
  font-size: 12px;
}

.content {
  min-height: 520px;
}

/* toast:白盘卡片 + 状态色圆点(旧版是整块实色,与新皮肤不符) */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px 12px 15px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(16, 20, 24, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.26s cubic-bezier(0.22, 0.9, 0.3, 1.18);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--good);
}

.toast.warn .toast-dot { background: var(--warn); }
.toast.error .toast-dot { background: var(--bad); }
.toast.info .toast-dot { background: var(--blue); }

@media (prefers-reduced-motion: reduce) {
  .toast { transform: none; transition: opacity 0.18s ease; }
}

.action-dock {
  position: fixed;
  right: 24px;
  bottom: 82px;
  z-index: 79;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 36px rgba(16, 20, 24, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.action-dock.show {
  opacity: 1;
  transform: translateY(0);
}

.action-dock .action-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(122, 113, 105, 0.12);
}

.action-dock.success .action-dot {
  background: var(--good);
  box-shadow: 0 0 0 5px rgba(50, 115, 95, 0.13);
}

.action-dock.warn .action-dot,
.action-dock.working .action-dot {
  background: var(--warn);
  box-shadow: 0 0 0 5px rgba(167, 107, 47, 0.13);
  animation: status-pulse 0.92s ease-in-out infinite;
}

.action-dock.error .action-dot {
  background: var(--bad);
  box-shadow: 0 0 0 5px rgba(164, 73, 73, 0.13);
}

.busy-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 85;
  padding: 8px 14px;
  color: #fff;
  background: var(--brand-deep);
  text-align: center;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
}

.busy-bar::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: translateX(-100%);
}

.busy-bar.show::after {
  animation: busy-shimmer 1.4s ease-in-out infinite;
}

.busy-bar.show {
  opacity: 1;
  transform: translateY(0);
}

.guide-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.guide-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}

.guide-step b {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 26px;
  height: 26px;
  color: #fff;
  background: var(--muted);
  border-radius: 50%;
  font-size: 13px;
}

.guide-step span {
  font-weight: 800;
}

.guide-step small {
  color: var(--muted);
  font-size: 12px;
}

.guide-step.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.12);
}

.guide-step.active b {
  background: var(--brand-deep);
}

.focus-panel,
.comfy-panel {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.focus-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.focus-panel h2,
.comfy-panel h2 {
  margin-bottom: 4px;
}

.focus-panel p,
.comfy-panel p,
.comfy-panel small {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -2px 0 14px;
}

.operator-card {
  position: relative;
  min-height: 104px;
  padding: 14px 14px 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.operator-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--brand);
}

.operator-card.wait::before,
.operator-card.warn::before {
  background: var(--warn);
}

.operator-card.ready::before,
.operator-card.done::before {
  background: var(--good);
}

.operator-card span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 3px 7px;
  color: var(--ink-soft);
  background: var(--gray);
  border: 1px solid var(--line);
  font-size: 12px;
  border-radius: 999px;
  font-weight: 700;
}

.operator-card.ready span,
.operator-card.done span {
  color: var(--good);
  background: #eef7f1;
  border-color: rgba(50, 115, 95, 0.18);
}

.operator-card.wait span,
.operator-card.warn span {
  color: var(--warn);
  background: #fff5e8;
  border-color: rgba(167, 107, 47, 0.2);
}

.operator-card b {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.operator-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.comfy-panel.busy {
  border-color: rgba(167, 107, 47, 0.55);
  background: #fff8ea;
}

.comfy-summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.comfy-panel h2 {
  display: inline-flex;
  align-items: center;
  margin-right: 10px;
  font-size: 16px;
}

.comfy-panel p {
  display: inline;
  font-size: 13px;
}

.comfy-panel small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.comfy-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.task-chip {
  display: inline-flex;
  max-width: 100%;
  padding: 6px 8px;
  color: var(--ink-soft);
  background: var(--gray);
  border: 1px solid var(--line);
  font-size: 12px;
  border-radius: 999px;
}

.task-chip.good {
  color: var(--good);
}

.task-chip.warn {
  color: var(--warn);
}

.task-chip.bad {
  color: var(--bad);
}

.advanced-panel {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 14px;
}

.advanced-panel summary {
  position: relative;
  cursor: pointer;
  padding: 12px 44px 12px 14px;
  color: var(--ink-soft);
  font-weight: 800;
  list-style: none;
}

.advanced-panel summary::-webkit-details-marker {
  display: none;
}

.advanced-panel summary::after {
  position: absolute;
  top: 12px;
  right: 14px;
  color: var(--muted);
  content: "展开";
  font-size: 13px;
  font-weight: 700;
}

.advanced-panel[open] summary::after {
  content: "收起";
}

.advanced-panel-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.asset-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.asset-preset {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 12px;
  text-align: left;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.asset-preset b {
  font-size: 24px;
  line-height: 1;
}

.asset-preset span {
  color: var(--muted);
  font-size: 13px;
}

.asset-preset.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.12);
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.section {
  min-width: 0;
  overflow-x: auto;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.section + .section {
  margin-top: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header p,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform 0.16s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.metric:hover {
  border-color: rgba(var(--brand-rgb), 0.26);
  box-shadow: 0 10px 24px rgba(16, 20, 24, 0.07);
  transform: translateY(-1px);
}

.metric b {
  display: block;
  font-family: var(--display);
  font-size: 38px;
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.closure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.closure-item {
  padding: 12px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: inset 3px 0 0 var(--warn);
}

.closure-item.ready {
  box-shadow: inset 3px 0 0 var(--good);
}

.closure-item b,
.closure-item span {
  display: block;
}

.closure-item b {
  margin-bottom: 4px;
  font-size: 13px;
}

.closure-item span {
  color: var(--muted);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 650;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 16px;
}

.model-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  gap: 16px;
  margin-top: 16px;
}

.model-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.model-card.active {
  border-color: rgba(var(--brand-rgb), 0.5);
  box-shadow: 0 14px 34px rgba(var(--brand-rgb), 0.12);
}

/* 库卡片＝陈列＋点击选用：整卡可点，删除收为右上小图标 */
.model-card[data-select-model] {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.18s ease, transform 0.14s ease;
}
.model-card[data-select-model]:hover {
  border-color: rgba(var(--brand-rgb), 0.35);
  transform: translateY(-2px);
}
.model-card[data-select-model]:focus-visible {
  outline: 3px solid rgba(var(--brand-rgb), 0.28);
  outline-offset: 2px;
}
.model-card-del {
  flex: none;
  opacity: 0.45;
}
.model-card-del:hover {
  opacity: 1;
  color: var(--bad);
}

.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.model-card-head h3 {
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.model-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.model-preview-triptych {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.model-preview {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--gray2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.model-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.model-preview:hover img {
  transform: scale(1.035);
  filter: contrast(1.03);
}

.model-preview.empty-thumb {
  min-height: 0;
}

.model-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.model-status-grid span {
  padding: 8px;
  color: var(--muted);
  background: var(--gray);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
}

.model-status-grid b {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
}

.model-complete-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-complete-line span {
  padding: 5px 8px;
  color: var(--muted);
  background: var(--gray2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.model-complete-line span.ready {
  color: #fff;
  background: var(--good);
  border-color: var(--good);
}

.empty-thumb {
  min-height: 210px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 5px;
}

.asset-tile {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}

.asset-tile:hover {
  border-color: var(--line-strong);
  box-shadow: 0 18px 42px rgba(16, 20, 24, .10);
  transform: translateY(-2px);
}

/* 已锁定母版：参考蓝光圈，凸显主体 */
.asset-tile.is-master {
  box-shadow: 0 0 0 2.5px var(--brand);
  border-color: transparent;
}

.asset-media {
  position: relative;
  overflow: hidden;
}

.asset-image {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: top center;
  background: var(--gray);
}

.asset-media .asset-image {
  display: block;
  width: 100%;
  transition: transform .5s cubic-bezier(.2,.6,.2,1);
}

.asset-tile:hover .asset-media .asset-image {
  transform: scale(1.03);
}

/* 母版角标（左上） */
.asset-master-flag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  background: var(--brand-deep);
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
}

/* 删除✕/下载⤓：悬停浮现的圆形图标（右上，下载在删除左侧） */
.asset-del,
.asset-dl {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(22, 22, 22, 0.5);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.88);
  backdrop-filter: blur(4px);
  transition: opacity 0.16s ease, transform 0.16s ease, background-color 0.16s ease;
}

.asset-dl {
  right: 42px;
  font-size: 14px;
  text-decoration: none;
}

.asset-tile:hover .asset-del,
.asset-tile:hover .asset-dl {
  opacity: 1;
  transform: scale(1);
}

.asset-del:hover {
  background: var(--bad);
}

.asset-dl:hover {
  background: var(--brand-deep);
}

.asset-tile.is-master .asset-del {
  display: none;
}

/* 母版卡不显示删除，下载顶到删除的位置 */
.asset-tile.is-master .asset-dl {
  right: 8px;
}

/* 视频卡片：悬停会先弹原生播放控件，✕ 藏在 hover 里不易发现 → 常显（半透明，悬停加深） */
.asset-tile.is-video .asset-del,
.asset-tile.is-video .asset-dl {
  opacity: 0.72;
  transform: scale(1);
}

/* 底部操作区 */
.asset-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}

/* 分段状态控件 */
.asset-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
}

.asset-seg .seg {
  padding: 7px 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  border-radius: 0;
}

.asset-seg .seg:last-child {
  border-right: 0;
}

.asset-seg .seg:hover:not(.on) {
  background: var(--gray);
  color: var(--ink);
}

.asset-seg .seg.on {
  font-weight: 700;
}

.asset-seg .seg.on[data-asset-status="selected"] { background: rgba(50, 115, 95, 0.14); color: var(--good); }
.asset-seg .seg.on[data-asset-status="maybe"] { background: rgba(167, 107, 47, 0.14); color: var(--warn); }
.asset-seg .seg.on[data-asset-status="reject"] { background: rgba(164, 73, 73, 0.14); color: var(--bad); }

/* 母版主按钮 */
.asset-master-btn {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--brand-deep);
  border-radius: 999px;
  background: var(--brand-deep);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(var(--brand-rgb), 0.22);
}

.asset-master-btn:hover:not(:disabled) {
  background: var(--brand-deep);
  box-shadow: 0 10px 22px rgba(var(--brand-rgb), 0.3);
  transform: translateY(-1px);
}

.asset-master-btn.locked {
  background: rgba(50, 115, 95, 0.12);
  color: var(--good);
  border-color: rgba(50, 115, 95, 0.4);
  box-shadow: none;
  opacity: 1;
  cursor: default;
}

/* 画质增强(自动洗图)被动角标:增强中/失败静默提示,无操作按钮 */
.asset-wash-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  width: fit-content;
}

.asset-wash-flag.pending {
  background: rgba(167, 107, 47, 0.12);
  color: var(--warn);
  border: 1px solid rgba(167, 107, 47, 0.3);
}

.asset-wash-flag.failed {
  background: rgba(164, 73, 73, 0.08);
  color: var(--bad);
  border: 1px solid rgba(164, 73, 73, 0.3);
}

.asset-preview-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  text-align: left;
}

.asset-preview-button:focus-visible {
  outline: 3px solid rgba(var(--brand-rgb), 0.42);
  outline-offset: -3px;
}

.preview-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 7px;
  background: rgba(22, 22, 22, 0.72);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.asset-preview-button:hover .preview-hint,
.asset-preview-button:focus-visible .preview-hint {
  opacity: 1;
}

.empty-thumb {
  display: grid;
  align-content: end;
  gap: 8px;
  padding: 12px;
  background:
    repeating-linear-gradient(90deg, rgba(var(--brand-rgb), .08) 0 1px, transparent 1px 26px),
    linear-gradient(145deg, rgba(var(--brand-rgb), 0.11), transparent 44%),
    var(--panel);
}

.thumb-line {
  height: 10px;
  background: rgba(22, 22, 22, 0.12);
}

.thumb-line.short {
  width: 62%;
}

.model-preview.empty-thumb {
  min-height: 0;
  align-content: center;
}

.small-button.strong {
  grid-column: 1 / -1;
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.asset-meta {
  padding: 2px 2px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--faint);
}

body.preview-open {
  overflow: hidden;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 13, .55);
}

.preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(98vw, 1440px);
  height: min(96vh, 1020px);
  background: var(--panel);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-header,
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #171512;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.preview-toolbar .small-button {
  min-height: 30px;
  padding: 0 9px;
  background: rgba(255, 250, 243, 0.1);
  border-color: rgba(255, 250, 243, 0.18);
  color: #fff;
}

.preview-toolbar .icon-button {
  width: 34px;
  padding: 0;
  font-size: 18px;
}

.preview-scale {
  min-width: 54px;
  color: rgba(255, 250, 243, 0.78);
  font-size: 12px;
  text-align: center;
}

.preview-header span,
.preview-footer span {
  display: block;
  color: rgba(255, 250, 243, 0.62);
  font-size: 12px;
  word-break: break-all;
}

.preview-close {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 66px;
  border: 1px solid rgba(255, 250, 243, 0.18);
  border-radius: 10px;
  background: rgba(17, 16, 14, 0.6);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 120ms ease, opacity 120ms ease;
}

.preview-nav:hover:not(:disabled) {
  background: rgba(17, 16, 14, 0.88);
}

.preview-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.preview-nav-prev {
  left: 14px;
}

.preview-nav-next {
  right: 14px;
}

.preview-count {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(17, 16, 14, 0.72);
  color: rgba(255, 250, 243, 0.86);
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
  cursor: zoom-in;
  overscroll-behavior: contain;
  user-select: none;
  touch-action: none;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%),
    #11100e;
  background-size: 20px 20px;
}

.preview-stage.is-zoomed {
  cursor: grab;
}

.preview-stage.is-dragging,
.preview-stage.is-dragging img {
  cursor: grabbing;
}

.preview-stage img {
  display: block;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
  user-select: none;
  transition: transform 80ms ease-out;
}

.preview-stage.is-dragging img {
  transition: none;
}

@media (max-width: 720px) {
  .preview-modal {
    padding: 8px;
  }

  .preview-panel {
    width: 100vw;
    height: 98vh;
  }

  .preview-header,
  .preview-footer {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .preview-toolbar {
    justify-content: flex-start;
    width: 100%;
    order: 3;
  }

  .preview-footer span:first-child {
    max-width: 100%;
  }
}

.preview-footer .small-button {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  text-decoration: none;
}

.quality-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.flow-step {
  min-height: 82px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.flow-step b {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
}

.flow-step span {
  font-size: 14px;
  line-height: 1.45;
}

.flow-step.strong {
  border-color: var(--brand);
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

/* 运行灯任务列表：作用域隔离（taskListHtml 专用，不影响 batchListHtml 等裸 .task-list 用例） */
.task-list.rec-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.rec-list .task-item { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.rec-list .task-item:last-child { border-bottom: 0; }

.task-item.selected-task {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gray);
  color: var(--muted);
  border: 1px solid transparent;
}

.badge.good {
  color: var(--good);
  background: rgba(58, 138, 112, 0.10);
}

.badge.warn {
  color: var(--warn);
  background: rgba(176, 122, 53, 0.10);
}

.badge.bad {
  color: var(--bad);
  background: rgba(179, 84, 84, 0.10);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.reference-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.reference-slot {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.reference-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reference-slot select,
select[multiple] {
  min-height: 116px;
  padding: 8px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 13px;
}

.check-card input {
  width: auto;
}

.checkbox-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.workflow-note {
  padding: 12px;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--line);
  line-height: 1.6;
}

.prompt-details {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.prompt-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.prompt-details textarea {
  margin-top: 12px;
}

.generation-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.generation-step {
  position: relative;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 168px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 10px 22px rgba(16, 20, 24, 0.05);
  overflow: hidden;
}

.generation-step::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--brand);
}

.generation-step.locked {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.generation-step.locked::before {
  background: #c7b9a8;
}

.generation-step h3 {
  margin: 0;
}

.generation-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.slot {
  display: grid;
  gap: 8px;
  min-height: 106px;
  padding: 12px;
  border: 1px dashed #cdbfae;
  background: var(--panel);
}

.slot strong {
  font-size: 14px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment {
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
}

.segment.active {
  color: white;
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  box-shadow: 0 8px 18px rgba(var(--brand-rgb), 0.18);
}

.table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
}

.table th,
.table td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.table th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.table tbody tr:hover td {
  background: var(--gray);
}

.table tr.selected-row td {
  background: var(--gray2);
}

.table tr[data-dataset-row] {
  cursor: pointer;
}

.caption-edit {
  min-width: 260px;
  min-height: 70px;
  width: 100%;
  font-size: 12px;
}

.notice {
  padding: 14px;
  border-left: 4px solid var(--brand);
  background: var(--gray);
  border-radius: 10px;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* 空状态：安静的行动指引（替代整排“待生成”占位卡） */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-tint);
  text-align: center;
}
.empty-state b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.empty-state span {
  font-size: 13px;
  color: var(--muted);
}
/* 卡片内的紧凑空态（如模特库卡片） */
.model-card .empty-state {
  padding: 24px 14px;
  margin-bottom: 12px;
}
.model-card .empty-state b {
  font-size: 16px;
}
.model-card .empty-state span {
  font-size: 12px;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes button-ripple {
  to {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes status-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.32);
  }
}

@keyframes busy-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 980px) {
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: fixed;
    z-index: 90;
    inset: auto 12px 10px;
    width: auto;
    height: 66px;
    min-height: 0;
    padding: 6px;
    overflow: hidden;
    flex-direction: row;
    border: 1px solid var(--rail-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 18px 48px rgba(16, 20, 24, .14);
    backdrop-filter: blur(16px);
  }

  .rail-brand,
  .rail-foot,
  .rail-sep { display: none; }

  .nav {
    flex-direction: row;
    align-items: stretch;
    gap: 3px;
    width: 100%;
    overflow: visible;
  }

  .nav-button {
    flex: 1;
    min-width: 0;
    padding: 8px 4px 6px;
    gap: 3px;
    border-radius: 14px;
  }

  .nav-icon { font-size: 16px; }
  .nav-label { font-size: 9px; }

  .main {
    height: auto;
    padding: 18px 16px 96px;
    overflow: visible;
  }

  .topbar {
    position: static;
    padding-top: 0;
  }

  .stage-strip-label {
    flex-basis: 112px;
  }

  .page-grid,
  .metric-grid,
  .selected-master-layout,
  .closure-grid,
  .operator-grid,
  .form-grid,
  .asset-preset-grid,
  .guide-strip,
  .stage-strip,
  .quality-flow {
    grid-template-columns: 1fr;
  }

  .focus-panel,
  .comfy-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .comfy-actions {
    justify-content: flex-start;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .top-actions select {
    width: 100%;
  }
}

/* ---- 自定义弹窗（替代原生 alert/confirm/prompt） ---- */
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 12, 13, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.app-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.app-modal {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 24px 24px 20px;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s ease;
}

.app-modal-backdrop.show .app-modal {
  transform: translateY(0) scale(1);
}

.app-modal-title {
  margin: 0 0 10px;
  font-size: 17px;
  color: var(--ink);
}

.app-modal-message {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.app-modal-field {
  margin: 0 0 18px;
}

.app-modal-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
}

.app-modal-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16);
}

.app-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-modal-actions button {
  min-width: 84px;
}

/* ---- 自定义下拉框（替代原生 select 展开列表） ---- */
.cs-native {
  /* 原生 select 保留在 DOM 里（表单提交照常），仅隐藏外观 */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  pointer-events: none;
}

.custom-select {
  position: relative;
  width: 100%;
}

.cs-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.cs-trigger:hover {
  background: var(--gray);
}

.custom-select.open .cs-trigger {
  border-color: var(--ink);
  background: var(--panel);
}

.custom-select.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.cs-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-value.placeholder {
  color: var(--muted);
}

.cs-arrow {
  flex: none;
  width: 12px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a7169' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.18s ease;
}

.custom-select.open .cs-arrow {
  transform: rotate(180deg);
}

.cs-popup {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 264px;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  gap: 2px;
}

/* 只有展开的下拉框才显示选项面板（避免每个下拉框下方都挂一个空面板） */
.custom-select.open .cs-popup {
  display: flex;
  animation: csPopIn 0.14s ease;
}

@keyframes csPopIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cs-option {
  width: 100%;
  flex: none;
  min-height: 38px;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.cs-option:hover {
  background: var(--gray);
  color: var(--ink);
}

.cs-option.selected {
  background: var(--gray);
  color: var(--ink);
  font-weight: 600;
}

.top-actions .custom-select {
  width: 240px;
}

/* ---- 模特定型页：图片为主 + 配置抽屉 ---- */
.casting-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(16, 20, 24, 0.05);
}

.casting-toolbar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
/* 详情页头部的模特名 */
.casting-model-name {
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.casting-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--gray);
  color: var(--ink-soft);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  border-color: var(--gray2);
  color: var(--ink);
}

.casting-batch-bar {
  margin-bottom: 16px;
}

.casting-batch-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.casting-gallery {
  min-height: 320px;
}

.selected-master-panel {
  margin-bottom: 18px;
  border-color: rgba(var(--brand-rgb), 0.32);
  box-shadow: 0 14px 34px rgba(var(--brand-rgb), 0.08);
}

.selected-master-layout {
  display: grid;
  /* 左列母版竖图收窄，右列拼版横图放大，两侧高度大致齐平 */
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.selected-master-layout .gallery {
  grid-template-columns: minmax(0, 1fr);
}

.selected-master-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 180px;
  padding: 18px;
  color: var(--muted);
  background: var(--brand-soft);
  border: 1px solid rgba(var(--brand-rgb), .18);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
}

.selected-master-copy b {
  color: var(--ink);
  font-family: var(--display);
  font-size: 28px;
  font-weight: 650;
}

.selected-master-copy span {
  max-width: 620px;
  line-height: 1.75;
}

/* 抽屉与帮助层共用的遮罩 */
.drawer-backdrop,
.help-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 12, 13, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer-backdrop.open,
.help-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* 右侧滑出的人设配置抽屉 */
.config-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(540px, 94vw);
  z-index: 95;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.24s ease;
}

.config-drawer.open {
  transform: translateX(0);
}

/* 人设编辑用居中大弹窗（config-modal 修饰类），首帧/视频抽屉仍是右滑 */
.config-drawer.config-modal {
  top: 50%;
  left: 50%;
  right: auto;
  height: min(88vh, 920px);
  width: min(1060px, 94vw);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translate(-50%, -50%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}
.config-drawer.config-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}
/* 弹窗更宽，人设表单排三列（窄屏回落两列/一列） */
.config-drawer.config-modal .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
  .config-drawer.config-modal .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.selected-master-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.config-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.config-drawer-head h2 {
  margin-bottom: 4px;
}

.config-drawer-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.config-drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px;
}

.config-drawer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

/* 居中弹出的帮助层 */
.help-popover {
  position: fixed;
  z-index: 95;
  top: 50%;
  left: 50%;
  width: min(580px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  padding: 0 0 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -48%) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.help-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.help-popover-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.help-popover-head h2 {
  margin: 0;
}

.help-popover-body {
  padding: 18px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* —— 工作流画布 —— */
.canvas-panel { padding: 0; overflow: hidden; position: relative; }
.canvas-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.canvas-toolbar .canvas-tip { color: var(--muted); font-size: 12px; margin-left: auto; }
.canvas-add { padding: 4px 10px; }
.canvas-empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.canvas-wrap { position: relative; height: 70vh; min-height: 480px; overflow: auto; cursor: grab; background:
  radial-gradient(circle, rgba(var(--brand-rgb), .13) 1px, transparent 1px) 0 0 / 24px 24px, var(--paper); }
/* 拖移中：抓手光标；拖动时禁止文字选中 */
.canvas-wrap.is-panning { cursor: grabbing; user-select: none; }
/* 缩放层：承载 SVG 边 + 节点，整体 transform: scale()；外层 wrap 负责滚动 */
.canvas-scene { position: relative; width: 4000px; height: 3000px; transform-origin: 0 0; }
/* 节点本身用默认光标（避免背景的 grab 抓手蔓延到节点上造成误解） */
.gnode { cursor: default; }
/* 右下角浮动缩放控件（在滚动区之外，固定不随内容滚动） */
.canvas-zoom { position: absolute; right: 16px; bottom: 16px; z-index: 6; display: flex; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
  box-shadow: 0 6px 18px rgba(16, 20, 24, .14); }
.canvas-zoom-btn, .canvas-zoom-pct { border: 0; background: transparent; cursor: pointer; color: var(--ink); }
.canvas-zoom-btn { font-size: 17px; line-height: 1; padding: 7px 12px; }
.canvas-zoom-pct { font-size: 12px; min-width: 50px; padding: 7px 6px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.canvas-zoom-btn:hover, .canvas-zoom-pct:hover { background: var(--brand-soft); color: var(--brand-deep); }
.canvas-edges { position: absolute; top: 0; left: 0; width: 4000px; height: 3000px; pointer-events: none; }
.canvas-edge { fill: none; stroke: var(--gray2); stroke-width: 2; pointer-events: none; }
.gnode { position: absolute; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 20, 24, .07); user-select: none; }
/* 内容高过预置间距时会压到下方节点：悬停/聚焦把当前节点抬到最上层，保证按钮可见可点 */
.gnode:hover, .gnode:focus-within { z-index: 5; }
.gnode.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16), 0 14px 34px rgba(16, 20, 24, .10); }
/* 运行态光圈:真实运行态修饰类是 .gnode-run.is-running(节点内运行按钮上,与 gnode-spin 动画同区，
   见下方 .gnode-run.is-running 规则)。.gnode-status.running 这条 CSS 在当前 canvas.js 逻辑下从不会
   被渲染出来——运行中状态只落在按钮上，statusHtml 只显示完成/失败(见 nodeBodyHtml 里的 running 守卫)，
   所以不用它拼 :has()，直接用真实存在的 .gnode-run.is-running。 */
.gnode:has(.gnode-run.is-running) {
  border-color: rgba(var(--brand-rgb), .5);
  box-shadow: 0 0 0 1px rgba(var(--brand-rgb), .3), 0 16px 44px rgba(var(--brand-rgb), .14);
}
.gnode-head { display: flex; flex-direction: column; gap: 2px; padding: 10px 13px 8px;
  border-bottom: 1px solid var(--line); }
.gnode-scene { font-size: 9.5px; }
.gnode-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.gnode-body { padding: 14px 10px; color: var(--muted); font-size: 12px; }
.port { position: absolute; display: flex; align-items: center; gap: 4px; }
.port-in { left: -7px; }
.port-out { right: -7px; }
.port-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--faint); }
.port-out .port-dot { background: var(--brand); }
.port:hover .port-dot { border-color: var(--brand); }
.port-label { font-size: 11px; color: var(--muted); background: var(--panel); padding: 0 3px; }
.port-out .port-label { display: none; }
/* 输入标签放到节点外的左侧空隙（带底色小片），不再压住节点内的按钮/文字 */
.port-in .port-label { position: absolute; right: 100%; top: 50%; transform: translateY(-50%); margin-right: 5px;
  white-space: nowrap; border: 1px solid var(--line); border-radius: 5px; line-height: 16px; color: var(--ink-soft); }

/* —— 模块页（商品衣物/背景）—— */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.mod-head { display: flex; flex-direction: column; gap: 3px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-tint), var(--panel)); }
.mod-head strong { font-size: 16px; letter-spacing: .2px; }
.mod-head .mod-sub { font-size: 12.5px; font-weight: 400; color: var(--muted); line-height: 1.5; }
.mod-tabs { display: flex; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.mod-tab { padding: 7px 16px; border: 1px solid transparent; background: var(--gray); border-radius: 999px; cursor: pointer; color: var(--ink-soft); font-size: 13.5px; transition: background-color .15s ease, color .15s ease; }
.mod-tab:hover:not(.active) { background: var(--gray2); color: var(--ink); }
.mod-tab.active { border-color: var(--ink); color: #fff; background: var(--ink); font-weight: 600; }
.mod-body { padding: 20px; }
.mod-body > * + * { margin-top: 18px; }            /* 子块统一竖向节奏，避免挤在一起 */
.mod-body > .mod-h4 { margin-top: 26px; }          /* 区段标题留多一点空 */
.mod-h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 12px; }
.mod-h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mod-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(255, 255, 255, .4); }
.field-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

/* 拖拽上传组件 */
.uploader { display: block; }
.uploader-drop { position: relative; display: block; padding: 32px 24px; text-align: center; cursor: pointer; border: 1.5px dashed var(--gray2); border-radius: 14px; background: var(--panel); transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.uploader-drop:hover { border-color: var(--brand); background: var(--gray); }
.uploader.is-dragging .uploader-drop { border-style: solid; border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .10); }
.uploader-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.uploader-face { display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.uploader-glyph { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--gray); color: var(--brand-deep); font-size: 22px; line-height: 1; transition: transform .18s ease, background-color .18s ease, color .18s ease; }
.uploader-drop:hover .uploader-glyph { color: var(--brand-deep); background: var(--gray2); }
.uploader.is-dragging .uploader-glyph { transform: translateY(-2px) scale(1.05); background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }
.uploader-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.uploader-hint { font-size: 12.5px; color: var(--muted); }
.uploader-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.uploader-status { font-size: 13px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.uploader-status.has-files { color: var(--brand-deep); font-weight: 600; }

/* 来源图片内联选择控件（服装提取） */
.source-trigger { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 460px; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink); transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.source-trigger:hover { border-color: rgba(var(--brand-rgb), .45); background: var(--brand-soft); box-shadow: 0 8px 18px rgba(16, 20, 24, .06); }
.source-trigger.has-pick { border-color: rgba(var(--brand-rgb), .35); }
.source-glyph { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 10px; border: 1px dashed var(--line); color: var(--brand-deep); font-size: 22px; line-height: 1; }
.source-thumb { width: 46px; height: 46px; flex: none; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); }
.source-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.source-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-meta span { font-size: 12px; color: var(--muted); }
.source-action { flex: none; font-size: 12px; font-weight: 600; color: var(--brand-deep); padding: 4px 10px; border: 1px solid rgba(var(--brand-rgb), .35); border-radius: 999px; }

/* 来源图片选择弹窗 */
body.picker-open { overflow: hidden; }
.picker-modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 24px; }
.picker-backdrop { position: absolute; inset: 0; border: 0; background: rgba(12, 12, 13, .55); }
.picker-panel { position: relative; z-index: 1; display: flex; flex-direction: column; width: min(92vw, 780px); max-height: min(86vh, 720px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-tint), var(--panel)); }
.picker-head strong { display: block; font-size: 16px; }
.picker-head span { font-size: 12.5px; color: var(--muted); }
.picker-close { font-size: 22px; line-height: 1; color: var(--muted); background: none; padding: 0 6px; }
.picker-close:hover { color: var(--ink); }
.picker-body { padding: 20px; overflow-y: auto; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.picker-item { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); text-align: left; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.picker-item:hover { border-color: rgba(var(--brand-rgb), .5); box-shadow: 0 10px 22px rgba(16, 20, 24, .10); transform: translateY(-2px); }
.picker-item img,
.picker-item video { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: var(--gray2); }
/* canvas 源节点选择器：完整显示整图、不裁剪（模特全身竖图等需要看全） */
.picker-contain .picker-item img { aspect-ratio: auto; height: auto; max-height: 70vh; object-fit: contain; }
.picker-name { padding: 8px 10px; font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-item.is-selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .25); }
.picker-item.is-selected .picker-name { color: var(--brand-deep); font-weight: 600; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.mod-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.mod-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.mod-card .mod-card-img { height: auto; aspect-ratio: 9 / 16; }
.mod-card-title { padding: 10px 10px 0; font-weight: 700; font-size: 13px; color: var(--ink); }
.mod-card figcaption { padding: 6px 8px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-preset { cursor: default; }
.mod-preset figcaption { color: var(--ink-soft); }
.mod-card-body { height: 120px; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; color: var(--ink); background: linear-gradient(135deg, var(--paper), var(--panel)); font-weight: 600; }
/* 预览图竖版 contain，展示全身（不裁切）；选中预览图可点击放大 */
.gnode-thumb { width: 100%; height: 184px; object-fit: contain; background: var(--surface-tint); border-radius: 8px; display: block; margin-bottom: 6px; }
.gnode-zoomable { cursor: zoom-in; }
.gnode-pick { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 8px; margin-bottom: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-tint); cursor: pointer; text-align: left; }
.gnode-pick:hover { border-color: rgba(var(--brand-rgb), .5); box-shadow: 0 6px 16px rgba(16, 20, 24, .08); }
.gnode-pick .gnode-thumb { margin-bottom: 0; }
.gnode-pick-glyph { display: grid; place-items: center; height: 46px; font-size: 22px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 6px; }
.gnode-pick-name { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gnode-pick-cta { font-size: 11px; color: var(--brand-deep); }
.picker-head-actions { display: flex; align-items: center; gap: 8px; }
.picker-noimg { width: 100%; aspect-ratio: 1 / 1; display: grid; place-items: center; color: var(--muted); background: var(--gray2); font-size: 12px; }
.gnode-run { width: 100%; margin-top: 4px; }
.gnode-story { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); margin: 6px 0; }
.gnode-story-input { width: 100%; resize: vertical; min-height: 56px; padding: 7px 8px; font-size: 12px; line-height: 1.45;
  color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-family: inherit; }
.gnode-story-input:focus { outline: none; border-color: rgba(var(--brand-rgb), .55); }
.gnode-story-label { font-size: 11px; color: var(--muted); }
.gnode-story-polish { width: 100%; margin-top: 2px; padding: 6px 8px; font-size: 12px; cursor: pointer;
  color: var(--brand-deep); background: var(--brand-soft); border: 1px solid rgba(var(--brand-rgb), .35); border-radius: 8px;
  transition: background-color .15s ease, border-color .15s ease; }
.gnode-story-polish:hover { background: rgba(var(--brand-rgb), .15); border-color: rgba(var(--brand-rgb), .55); }
.gnode-story-polish:disabled { opacity: .6; cursor: default; }
.gnode-story-expand-hint { color: var(--brand-deep); font-size: 10px; }
/* 节点内提示词框只读 = 预览，点击弹大窗编辑 */
.gnode-story-input[readonly] { cursor: pointer; }
.gnode-story-input[readonly]:hover { border-color: rgba(var(--brand-rgb), .55); background: rgba(var(--brand-rgb), .04); }
/* 剧情提示词大编辑窗 */
.story-editor { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); }
.story-editor-panel { width: min(720px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4); padding: 18px 20px; }
.story-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.story-editor-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.story-editor-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.story-editor-close:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.story-editor-input { flex: 1; min-height: 340px; resize: vertical; padding: 12px 14px; font-size: 14px; line-height: 1.6;
  color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--surface-tint); font-family: inherit; }
.story-editor-input:focus { outline: none; border-color: rgba(var(--brand-rgb), .55); }
.story-editor-foot { display: flex; gap: 10px; margin-top: 14px; }
.story-editor-polish { flex: 1; padding: 10px; font-size: 13px; cursor: pointer; color: var(--brand-deep);
  background: var(--brand-soft); border: 1px solid rgba(var(--brand-rgb), .35); border-radius: 10px;
  transition: background-color .15s ease; }
.story-editor-polish:hover { background: rgba(var(--brand-rgb), .15); }
.story-editor-polish:disabled { opacity: .6; cursor: default; }
.story-editor-save { padding: 10px 28px; font-size: 13px; cursor: pointer; }
/* 混剪画布：新建任务前先问片段数（M）的小窗，.story-editor 同模式克隆（自建 modal，非 window.prompt） */
.mixcut-count-modal { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); }
.mixcut-count-panel { width: min(360px, 92vw); display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4); padding: 18px 20px; }
.mixcut-count-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mixcut-count-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.mixcut-count-close { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.mixcut-count-close:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.mixcut-count-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.mixcut-count-input { padding: 9px 12px; font-size: 14px; color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); font-family: inherit; }
.mixcut-count-input:focus { outline: none; border-color: rgba(91, 74, 232, .55); }
.mixcut-count-error { font-size: 12px; color: var(--bad); margin-top: 8px; }
.mixcut-count-error[hidden] { display: none; }

/* 混剪画布创建空态：无任务时整卡引导输入片段数（renderCanvas 的 mixcut-setup 分支） */
.mixcut-setup { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; }
.mixcut-setup-title { font-size: 16px; color: var(--ink); }
.mixcut-setup-hint { font-size: 13px; color: var(--muted); max-width: 420px; text-align: center; margin: 0; }
.mixcut-setup-row { display: flex; align-items: flex-end; gap: 10px; }
.mixcut-setup-row label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.mixcut-setup-row .mixcut-count-input { width: 120px; }
.mixcut-count-foot { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* 混剪面板（P2T4）：片段池(点选入拼接轨) / 拼接轨(序号+缩略+◀▶✕) / 控件行(K版+自动混剪+导出) / 版本列表。
   跟 .picker-modal 同族（fixed 遮罩+居中面板+body.picker-open 锁滚动），宽度更大以容纳三段纵排内容。 */
.gnode-mixcut-ready { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.gnode-mixcut-open { width: 100%; margin-bottom: 6px; }
.mixcut-modal { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 24px; }
.mixcut-panel { position: relative; z-index: 1; display: flex; flex-direction: column;
  width: min(920px, 92vw); max-height: min(88vh, 800px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.mixcut-panel-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.mixcut-section { display: flex; flex-direction: column; gap: 10px; }
.mixcut-section-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
/* 片段池：网格缩略图，点击即加入拼接轨 */
.mixcut-pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.mixcut-pool-item { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: var(--panel); cursor: pointer; text-align: left;
  transition: border-color .15s ease, transform .15s ease; }
.mixcut-pool-item:hover { border-color: rgba(91, 74, 232, .5); transform: translateY(-2px); }
.mixcut-pool-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; background: #efece3; }
.mixcut-pool-label { padding: 5px 8px; font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 拼接轨：横向滚动条带，不做拖拽——序号 + 缩略 + ◀ ▶ ✕ */
.mixcut-track-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; }
.mixcut-track-item { flex: none; width: 108px; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--paper); position: relative; }
.mixcut-track-seq { position: absolute; top: 8px; left: 8px; z-index: 1; min-width: 18px; padding: 1px 5px;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--brand); border-radius: 999px; text-align: center; }
.mixcut-track-thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: #efece3; display: block; }
.mixcut-track-label { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mixcut-track-actions { display: flex; gap: 4px; }
.mixcut-track-btn { flex: 1; padding: 3px 0; font-size: 11px; color: var(--ink-soft);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.mixcut-track-btn:hover:not(:disabled) { border-color: rgba(var(--brand-rgb), .5); color: var(--brand-deep); }
.mixcut-track-del:hover:not(:disabled) { color: var(--bad); border-color: rgba(179, 84, 84, .5); }
/* 控件行：K 版本数 + 自动混剪 + 导出拼接轨 */
.mixcut-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.mixcut-k-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.mixcut-k-input { width: 60px; padding: 6px 8px; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-family: inherit; }
.mixcut-k-input:focus { outline: none; border-color: rgba(91, 74, 232, .55); }
/* 版本列表：每版一张竖版视频卡 + 配方小字 */
.mixcut-version-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.mixcut-version-item { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: var(--panel); }
.mixcut-version-item video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; background: #000; display: block; }
.mixcut-version-meta { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; }
.mixcut-version-tag { font-size: 12px; font-weight: 700; color: var(--brand-deep); }
.mixcut-version-recipe { font-size: 10.5px; color: var(--muted); line-height: 1.4; word-break: break-word; }

/* 运行中：保持高亮（不走 disabled 变灰）+ 前置转圈 */
.gnode-run.is-running, .gnode-run.is-running:disabled { opacity: 1; cursor: progress; color: #fff; }
.gnode-run.is-running::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 6px;
  vertical-align: -1px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%;
  animation: gnode-spin .8s linear infinite; }
@keyframes gnode-spin { to { transform: rotate(360deg); } }
.gnode-status { font-size: 11px; padding: 2px 0; }
.gnode-status.done { color: var(--good); }
.gnode-status.failed { color: var(--bad); }
.gnode-cands { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.gnode-cand { width: 46px; height: 64px; object-fit: contain; background: var(--paper); border-radius: 4px; cursor: pointer; border: 2px solid transparent; }
.gnode-cand.sel { border-color: var(--brand); }
/* 图片灯箱（点击预览图全屏放大） */
.img-lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  background: rgba(12, 12, 13, .55); cursor: zoom-out; padding: 24px; }
.img-lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); }
.img-lightbox-close { position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }
.img-lightbox-close:hover { background: rgba(255, 255, 255, .3); }
.img-lightbox-download { position: absolute; top: 18px; right: 74px; display: inline-flex; align-items: center;
  height: 40px; padding: 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color .18s ease; }
.img-lightbox-download:hover { background: rgba(255, 255, 255, .3); color: #fff; }
/* 定型批次 折叠/分页 */
.batch-more { margin: 10px 0 4px; }
.batch-pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* ── 首页（Agent + 快捷入口 + 最近产出）───────────────────── */
.home-hero {
  position: relative;
  max-width: 1120px;
  margin: 0 auto 22px;
  text-align: center;
  padding-top: clamp(20px, 4vh, 52px);
}
.home-hero::before {
  position: absolute;
  z-index: 0;
  inset: -50px -70px 56px;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(rgba(71, 159, 191, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 159, 191, .07) 1px, transparent 1px),
    radial-gradient(circle at 50% 38%, rgba(var(--brand-rgb), .11), transparent 48%);
  background-size: 56px 56px, 56px 56px, auto;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 0 44%, transparent 76%);
}
.home-hero::after {
  position: absolute;
  z-index: 0;
  inset: -22px -54px 92px;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 32% 42%, rgba(var(--brand-rgb), .16), transparent 30%),
    radial-gradient(circle at 68% 34%, rgba(86, 132, 238, .11), transparent 28%);
  filter: blur(18px);
  opacity: .48;
  transform: translate3d(-1.5%, 0, 0) scale(.98);
  animation: home-ambient-drift 14s cubic-bezier(.45, 0, .55, 1) infinite alternate;
}
@keyframes home-ambient-drift {
  0% { transform: translate3d(-1.5%, 0, 0) scale(.98); opacity: .4; }
  55% { transform: translate3d(1%, -1.5%, 0) scale(1.025); opacity: .54; }
  100% { transform: translate3d(1.8%, .8%, 0) scale(1.01); opacity: .46; }
}
.home-hero > * {
  position: relative;
  z-index: 1;
}
.home-kicker {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--faint);
  margin-bottom: 15px;
}
.home-title {
  max-width: 1020px;
  margin: 0 auto 16px;
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(34px, 4.25vw, 58px);
  letter-spacing: -0.045em;
  line-height: 1.08;
}
/* 「Agent」微光扫过：品牌词上一道 7s 一轮的高光,相位由 app.js 用墙钟负 delay 锚定(重绘不跳) */
.home-title em {
  font-style: normal;
  color: var(--brand);
  background: linear-gradient(100deg, var(--brand) 40%, color-mix(in srgb, var(--brand) 45%, #fff) 50%, var(--brand) 60%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: agent-shine 7s linear infinite;
}
@keyframes agent-shine {
  from { background-position: 190% 0; }
  to { background-position: -60% 0; }
}
/* 数字滚动行：motion.js 对 [data-count] 计数进场 */
.home-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}
.home-stats span { display: inline-flex; align-items: baseline; font-size: 12px; color: var(--muted); }
.home-stats b {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-right: 6px;
}
.home-stats i { width: 1px; height: 18px; background: var(--line); }
.home-agent {
  position: relative;
  z-index: 4;
  text-align: left;
  background: rgba(255, 255, 255, .97);
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(16, 20, 24, .10);
  padding: 18px 22px 17px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.home-agent.is-dragging {
  border-color: var(--brand);
  background: rgba(247, 251, 252, .98);
  box-shadow: 0 30px 88px rgba(16, 20, 24, .12), 0 0 0 4px rgba(var(--brand-rgb), .1);
}
.home-agent:focus-within {
  border-color: rgba(var(--brand-rgb), .54);
  box-shadow: 0 30px 88px rgba(16, 20, 24, .12), 0 0 0 3px rgba(var(--brand-rgb), .07);
}
.home-agent-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.home-agent-label span {
  color: var(--brand-deep);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .17em;
}
.home-agent-label small {
  color: var(--faint);
  font-size: 10.5px;
}
.home-agent-body {
  display: flex;
  align-items: stretch;
  gap: 18px;
  min-height: 96px;
}
.home-agent-entry {
  position: relative;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-agent textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  background: transparent;
  resize: none;
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  min-height: 92px;
  padding: 8px 2px 12px;
  line-height: 1.65;
  outline: none;
}
/* 压掉全局 textarea:focus 的光圈和底色,与会话页输入框一致(整卡已有 hover/focus 态,内框不再画线) */
.home-agent textarea:focus {
  background: transparent;
  box-shadow: none;
}
.home-agent.is-dragging .agent-drop-hint { display: grid; }
.home-agent-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 14px;
}
.home-agent-output-controls { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.home-agent-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.home-agent-buttons .ghost {
  min-height: 40px;
  padding-inline: 14px;
  border-radius: 12px;
}
.home-agent-send {
  min-width: 168px;
  min-height: 42px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-deep);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(var(--brand-rgb), .24);
}
.home-agent-send > span {
  position: relative;
  z-index: 3;
}
.home-agent-send::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  opacity: 0;
  background: linear-gradient(105deg, #2859e8 0%, #6248ee 34%, #a45cf4 67%, #3e63ee 100%);
  background-size: 240% 100%;
  transition: opacity .22s ease;
}
.home-agent-send::after {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: -46%;
  width: 44%;
  content: "✦  ·   ·  ✦";
  color: rgba(255, 255, 255, .84);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .45em;
  opacity: 0;
  transform: translateY(-50%);
  white-space: nowrap;
}
.home-agent-send:hover:not(:disabled) {
  color: #fff;
  box-shadow: 0 12px 26px rgba(91, 74, 232, .28);
  transform: translateY(-1px);
}
.home-agent-send:hover:not(:disabled)::before,
.home-agent-send:focus-visible::before {
  opacity: 1;
  animation: home-send-gradient 2.2s linear infinite;
}
.home-agent-send:hover:not(:disabled)::after,
.home-agent-send:focus-visible::after {
  opacity: .85;
  animation: home-send-sparkles 1.8s ease-in-out infinite;
}
@keyframes home-send-gradient {
  from { background-position: 0% 50%; }
  to { background-position: 240% 50%; }
}
@keyframes home-send-sparkles {
  0% { left: -46%; opacity: 0; }
  18% { opacity: .82; }
  82% { opacity: .82; }
  100% { left: 106%; opacity: 0; }
}
.home-polished {
  margin-top: 14px;
  border: 1px dashed rgba(var(--brand-rgb), 0.42);
  background: var(--brand-soft);
  border-radius: 12px;
  padding: 12px 14px;
}
.home-polished-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.home-polished-head b { color: var(--brand-deep); font-size: 13px; letter-spacing: 0.08em; }
.home-polished p { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-soft); }

.home-apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto 34px;
}
.home-app {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 108px;
  text-align: left;
  padding: 14px 40px 14px 14px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(.985);
}
.home-app::after {
  position: absolute;
  top: 50%;
  right: 16px;
  content: "↗";
  color: var(--faint);
  font-size: 13px;
  opacity: 0;
  transform: translate(-5px, -50%);
  transition: opacity .18s ease, transform .18s ease;
}
.home-app {
  transition:
    opacity .52s cubic-bezier(.2,.6,.2,1) calc(var(--home-app-order, 0) * 55ms),
    transform .52s cubic-bezier(.2,.6,.2,1) calc(var(--home-app-order, 0) * 55ms),
    border-color .2s ease,
    box-shadow .24s ease,
    background-color .2s ease;
}
.home-apps.in .home-app { opacity: 1; transform: none; }
/* 后台重绘(motion.js instant 模式)会整页重建 DOM：错峰入场过渡不得重播，瞬时到位。
   此规则必须在 reduced-motion 媒体查询之外——之前只写在里面，导致每次 render 卡片闪烁重播入场 */
.home-apps.no-anim .home-app { transition: none; }
.home-apps.in .home-app:is(:hover, :focus-visible) {
  border-color: rgba(var(--brand-rgb), .46);
  background: #fff;
  box-shadow: 0 16px 38px rgba(16, 20, 24,.08), 0 8px 26px rgba(var(--brand-rgb), .12);
  transform: translateY(-4px);
}
.home-apps.in .home-app:is(:hover, :focus-visible)::after { opacity: 1; transform: translate(0, -50%); }
.home-app-visual {
  width: 72px;
  height: 72px;
  border: 1px solid rgba(var(--brand-rgb), .2);
  border-radius: 17px;
  overflow: hidden;
  background: #eef4f7;
  box-shadow: 0 8px 18px rgba(31, 72, 88, .12);
  flex: none;
  transition: transform .22s ease, box-shadow .22s ease;
}
.home-app-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.015);
  transition: transform .35s cubic-bezier(.2,.75,.25,1), filter .22s ease;
}
.home-apps.in .home-app:is(:hover, :focus-visible) .home-app-visual {
  box-shadow: 0 12px 26px rgba(var(--brand-rgb), .22), 0 0 0 4px rgba(var(--brand-rgb), .08);
  transform: translateY(-1px);
}
.home-apps.in .home-app:is(:hover, :focus-visible) .home-app-art { filter: saturate(1.05) contrast(1.02); transform: scale(1.05); }
.home-app-text { display: flex; flex-direction: column; gap: 2px; }
.home-app-text b { font-size: 14px; }
.home-app-text span { font-size: 11.5px; line-height: 1.45; color: var(--muted); }

@media (max-width: 980px) {
  .app-shell.home-mode-shell { display: block; height: auto; min-height: 100dvh; overflow-x: clip; overflow-y: visible; }
  .home-mode-shell > .sidebar {
    position: fixed;
    z-index: 90;
    inset: auto 12px 10px;
    width: auto;
    height: 66px;
    min-height: 0;
    padding: 6px;
    flex-direction: row;
    border: 1px solid var(--rail-line);
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 18px 48px rgba(16,20,24,.14);
    backdrop-filter: blur(16px);
  }
  .home-mode-shell .rail-brand,
  .home-mode-shell .rail-foot,
  .home-mode-shell .rail-sep { display: none; }
  .home-mode-shell .nav { flex-direction: row; align-items: stretch; gap: 3px; width: 100%; overflow: visible; }
  .home-mode-shell .nav-button { flex: 1; min-width: 0; padding: 8px 4px 6px; gap: 3px; border-radius: 14px; }
  .home-mode-shell .nav-icon { font-size: 16px; }
  .home-mode-shell .nav-label { font-size: 9px; }
  .home-mode-shell .main { height: auto; padding: 18px 16px 96px; overflow: visible; }
  .home-mode-shell .topbar { position: static; min-height: 44px; margin-bottom: 6px; padding: 0 0 12px; align-items: center; flex-direction: row; }
  .home-mode-shell .topbar-right { min-width: 0; }
}

@media (max-width: 760px) {
  .home-hero { padding-top: 18px; }
  .home-hero::before { inset-inline: -20px; }
  .home-title { font-size: 32px; line-height: 1.12; }
  .home-stats { margin-bottom: 22px; }
  .home-agent { padding: 15px; border-radius: 20px; }
  .home-agent-label small { display: none; }
  .home-agent-body { gap: 12px; }
  .home-agent textarea { min-height: 118px; font-size: 14px; }
  .home-agent-actions { align-items: stretch; flex-direction: column; }
  .home-agent-output-controls { width: 100%; }
  .home-agent-buttons { justify-content: flex-start; }
  .home-agent-send { margin-left: auto; }
  .home-apps { grid-template-columns: 1fr; }
  .home-app { min-height: 100px; }
  .home-app-visual { width: 64px; height: 64px; border-radius: 15px; }
}

/* ── 日期分组密集网格（资产库 / 最近产出）──────────────────── */
.day-head {
  margin: 18px 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.04em;
}
.asset-daygrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}
.day-tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: var(--panel);
  cursor: zoom-in;
}
.day-tile img, .day-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}
.day-tile:hover img, .day-tile:hover video { transform: scale(1.04); }
/* 场记标注层：底部渐晕 + mono 小字（CASTING/KEYFRAME/TAKE · 日期），视频卡右上 ▶ 角标 */
.day-scrim {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  pointer-events: none;
}
.day-label {
  position: absolute;
  left: 9px; right: 9px; bottom: 7px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.day-chip {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  font-size: 9px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
/* 首页胶片带：内容双份 + translateX(-50%) 无缝循环;逐块 margin-right(含末块)保证 -50% 恰为一整份宽度 */
.home-strip {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.home-belt {
  display: flex;
  width: max-content;
  animation: home-marquee linear infinite;
}
.home-strip:hover .home-belt { animation-play-state: paused; }
.home-strip .day-tile {
  width: 152px;
  aspect-ratio: 3 / 4;
  flex: none;
  margin-right: 10px;
}
@keyframes home-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .day-tile img, .day-tile video, .home-app, .home-app-visual, .home-app-art { transition: none; }
  .home-hero::after { animation: none; transform: none; opacity: .42; }
  .home-app { opacity: 1; transform: none; }
  .home-apps.no-anim .home-app { transition: none; }
  .home-belt { animation: none; }
  .home-strip { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .home-agent-send:hover:not(:disabled)::before,
  .home-agent-send:focus-visible::before { animation: none; background-position: 50% 50%; }
  .home-agent-send::after { display: none; }
  .home-title em {
    animation: none;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

/* 资产库顶部 tag 行（即梦式：左筛选 tab、右操作） */
.assets-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.assets-topbar .mod-tabs { padding: 0; border-bottom: 0; }
.assets-actions { display: flex; align-items: center; gap: 10px; }

/* 资产页壳 tab 行（生成历史/模特/商品/背景/动作） */
.assets-shell-tabs { margin-bottom: 14px; }
.assets-shell-tabs .mod-tabs { padding: 0; border-bottom: 0; }
.assets-shell-tabs .mod-tab { font-size: 14.5px; padding: 8px 18px; }

/* 首次登录引导横幅：落在设置页顶部，提示先完成经营画像 */
.onboarding-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--brand);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--brand-soft);
}
.onboarding-banner b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--brand-deep);
}
.onboarding-banner span {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* 会员只读模式横幅：资产库顶部，暖色警示 */
.readonly-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid rgba(176, 122, 53, .25);
  border-radius: 12px;
  background: rgba(176, 122, 53, .08);
}
.readonly-banner b {
  font-family: var(--display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--warn);
}
.readonly-banner span {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

/* 经营画像常用选项 chips */
.profile-chips { margin: 2px 0 8px; }
.profile-chips .segment { font-size: 12.5px; padding: 5px 12px; }

/* 经营画像：宽幅 2×2 卡片网格 */
.profile-section { max-width: none; }
.profile-section .section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.profile-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 18px;
}
.profile-brand-row label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  flex: none;
}
.profile-brand-row input { max-width: 380px; }
.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 1180px) {
  .profile-grid { grid-template-columns: 1fr; }
}
.profile-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.profile-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.profile-block-head label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.profile-block-head .muted { font-size: 12px; }
.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.profile-chips .segment {
  font-size: 12.5px;
  padding: 5px 13px;
  border-radius: 999px;
}
.profile-section textarea {
  min-height: 52px;
  resize: vertical;
  margin-top: auto;
}

/* 修复：选中态 chip 悬停被全局 hover 洗成白底白字 */
.segment.active:hover:not(:disabled) {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
}

/* ── 热点商品卡片（商品池 → 热点商品 tab）───────────────── */
.hot-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.hot-filter { display: inline-flex; gap: 4px; }
.hot-filter button { padding: 4px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft); cursor: pointer; }
.hot-filter button.is-active { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.hot-filter button.is-active:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.hot-meta { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.hot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.hot-card { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.hot-card.is-matched { border-color: var(--brand); }
.hot-img { aspect-ratio: 1; background: var(--paper); }
.hot-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hot-card figcaption { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.hot-badges { display: flex; gap: 6px; }
.hot-badge { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--faint); }
.hot-badge-match { border-color: var(--brand); color: var(--brand-deep); }
.hot-title { font-size: 13px; line-height: 1.4; min-height: 2.8em; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hot-facts { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.hot-facts strong { font-size: 15px; color: var(--rose); }
.hot-import[disabled] { opacity: .5; }

/* ── 顶栏项目切换器（右上角，「新建项目」并入下拉） ───────── */
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-project { display: inline-flex; align-items: center; gap: 8px; }
.topbar-project-label { font-size: 12px; color: var(--faint); white-space: nowrap; }
.topbar-project select { max-width: 220px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 12px; cursor: pointer; }

/* ── 编辑人设：按账号定位推荐 ─────────────── */
.persona-reco-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.persona-reco-row .persona-reco-notice { margin: 0; }
.persona-reco-row #recommendPersonaBtn { align-self: flex-start; }

/* ── 画布衣服节点：建议提取角标 ───────────────
   按钮横排收高度：节点坐标是预置的，内容太高会盖住下方节点 */
.gnode-extract { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.gnode-extract .gnode-extract-badge { flex: 1 1 100%; }
.gnode-extract .gnode-extract-btn { flex: 1 1 auto; min-width: 0; padding: 4px 6px; font-size: 11px; }
.gnode-extract-badge { font-size: 11px; padding: 3px 8px; border-radius: 6px; line-height: 1.4; }
.gnode-extract-badge.warn { background: rgba(167, 107, 47, 0.12); color: var(--warn); border: 1px solid rgba(167, 107, 47, 0.35); }
.gnode-extract-badge.running { background: rgba(var(--brand-rgb), 0.10); color: var(--brand-deep); border: 1px solid rgba(var(--brand-rgb), 0.3); }
.gnode-extract-btn { padding: 4px 10px; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink-soft); cursor: pointer; }
.gnode-extract-btn:hover { border-color: var(--brand); color: var(--brand-deep); }

/* ── 上传素材卡片：悬停显示删除 ─────────────── */
.mod-card { position: relative; }
.mod-card-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  display: none; align-items: center; justify-content: center;
  border: none; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1;
  background: rgba(12, 12, 13, 0.55); color: #fff;
}
.mod-card:hover .mod-card-del { display: inline-flex; }
.mod-card-del:hover { background: var(--bad); }

/* 点击放大的图片给放大镜光标 */
[data-zoom-src] { cursor: zoom-in; }

/* 商品图卡片「提取」动作（左上，删除在右上） */
.mod-card-extract, .mod-card-extracting {
  position: absolute; top: 6px; left: 6px; padding: 3px 10px;
  border: none; border-radius: 999px; font-size: 11px; line-height: 1.4;
}
.mod-card-extract { display: none; cursor: pointer; background: rgba(12, 12, 13, 0.55); color: #fff; }
.mod-card:hover .mod-card-extract { display: inline-flex; }
.mod-card-extract:hover { background: var(--brand-deep); }
.mod-card-extracting { display: inline-flex; background: rgba(var(--brand-rgb), 0.85); color: #fff; }
.mod-hint { font-size: 12px; color: var(--muted); margin: -4px 0 10px; }

/* ── 人设弹窗：提示词区 ─────────────────────── */
.label-hint { font-weight: normal; font-size: 12px; color: var(--muted); margin-left: 8px; }
details.prompt-negative summary { cursor: pointer; font-size: 13px; color: var(--ink-soft); padding: 4px 0; }
details.prompt-negative[open] summary { margin-bottom: 6px; }

/* 提示词框标题行：label + AI 生成按钮同排 */
.prompt-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.prompt-label-row label { margin: 0; }
.prompt-label-row button { white-space: nowrap; padding: 5px 12px; font-size: 13px; }

/* ── 首页 Agent 会话 ─────────────────────────────── */
.main.agent-mode { height: 100vh; padding: 0; overflow: hidden; }
.main.agent-mode .topbar { display: none; }
.main.agent-mode .content { height: 100vh; min-height: 0; }
.agent-chat { display: grid; grid-template-columns: 312px minmax(0, 1fr); width: 100%; height: 100vh; overflow: hidden; background: var(--paper); }
.agent-stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--paper); }
.agent-chat-head { flex: none; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: rgba(248, 249, 250, .9); backdrop-filter: blur(14px); }
.agent-chat-head-main, .agent-chat-head-actions { display: flex; align-items: center; gap: 10px; }
.agent-chat-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.agent-chat-title b { max-width: min(46vw, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 650; }
.agent-chat-title span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.agent-chat-title i, .agent-history-meta i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.agent-chat-title i.running, .agent-history-meta i.running { background: var(--brand); box-shadow: 0 0 0 4px rgba(var(--brand-rgb), .13); }
.agent-chat-title i.waiting, .agent-history-meta i.waiting { background: var(--warn); }
.agent-chat-title i.done, .agent-history-meta i.done { background: var(--good); }
.agent-chat-title i.failed, .agent-history-meta i.failed { background: var(--bad); }
.agent-chat-title i.archived, .agent-history-meta i.archived { background: var(--faint); }
.agent-top-action, .agent-mobile-history { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.78); color: var(--ink-soft); font-size: 12px; font-weight: 600; }
.agent-top-action:hover, .agent-mobile-history:hover { border-color: rgba(var(--brand-rgb),.35); background: var(--brand-soft); color: var(--brand-deep); }
.agent-mobile-history { display: none; }
.agent-conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 18px; padding: 28px clamp(24px, 5vw, 78px) 26px; }
.agent-msgs { width: min(940px, 100%); min-height: 0; margin: 0 auto; overflow-y: auto; display: flex; flex: 1; flex-direction: column; gap: 18px; padding: 12px 8px 28px; scrollbar-width: thin; scrollbar-color: var(--gray2) transparent; }
.agent-chat.is-empty .agent-conversation { justify-content: center; padding-bottom: clamp(80px, 14vh, 160px); }
.agent-chat.is-empty .agent-msgs { flex: 0 0 auto; overflow: visible; padding: 0; }
.agent-welcome { width: min(780px, 100%); margin: 0 auto; text-align: center; }
.agent-welcome > span { display: block; margin-bottom: 13px; color: var(--brand-deep); font-family: var(--mono); font-size: 10px; letter-spacing: .18em; }
.agent-welcome h2 { margin: 0; color: var(--ink); font-size: clamp(28px, 3vw, 42px); font-weight: 590; letter-spacing: -.04em; }
.agent-welcome p { margin: 13px auto 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.agent-history { position: relative; z-index: 4; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 22px 14px 14px; border-right: 1px solid var(--line); background: var(--panel); }
.agent-history-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 8px 18px; }
.agent-history-head div { display: flex; flex-direction: column; gap: 1px; }
.agent-history-head span { font-family: var(--mono); font-size: 9px; letter-spacing: .16em; color: var(--brand-deep); }
.agent-history-head b { margin-top: 4px; font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.agent-history-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }
.agent-history-close:hover { background: var(--gray); color: var(--ink); }
.agent-history-close { display: none; }
.agent-new-session { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 50px; padding: 6px 10px; border-radius: 12px; background: var(--gray); color: var(--ink); text-align: left; }
.agent-new-session:hover { background: var(--gray2); }
.agent-new-session span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #fff; border: 1px solid var(--line); color: var(--ink); font-size: 20px; font-weight: 400; }
.agent-new-session b { font-size: 13px; font-weight: 650; }
.agent-history-label { padding: 24px 9px 8px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.agent-history-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding: 0 0 10px; }
.agent-history-item { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; width: 100%; padding: 10px 9px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.agent-history-item:hover { background: var(--gray); }
.agent-history-item.active { border-color: rgba(var(--brand-rgb), .22); background: var(--brand-soft); }
.agent-history-item.active::before { content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--brand); }
.agent-history-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--brand-deep); font-size: 12px; }
.agent-history-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.agent-history-del { position: absolute; top: 7px; right: 7px; z-index: 2; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel); color: var(--muted); font-size: 15px; line-height: 1; opacity: 0; box-shadow: 0 1px 4px rgba(12, 12, 13, .1); }
.agent-history-item:hover .agent-history-del,
.agent-history-del:focus-visible { opacity: 1; }
.agent-history-del:hover { background: var(--ink); color: #fff; }
.agent-history-item:hover .agent-history-item-top time { opacity: 0; }
.agent-history-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.agent-history-item-top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.agent-history-item-top time { flex: none; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.agent-history-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.agent-history-meta { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 10.5px; }
.agent-history-meta em { margin-left: auto; color: var(--faint); font-style: normal; }
.agent-history-empty { margin: auto; padding: 24px 18px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.agent-history-empty.error { color: var(--bad); }
.agent-history-empty .small-button { display: block; margin: 10px auto 0; }
.agent-history-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 14px 9px 2px; border-top: 1px solid var(--line); }
.agent-history-foot span { color: var(--faint); font-size: 10px; }
.agent-history-foot b { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.agent-msg { display: flex; flex-direction: column; gap: 8px; max-width: 82%; }
.agent-msg.from-user { align-self: flex-end; align-items: flex-end; }
.agent-msg.from-agent { align-self: flex-start; align-items: flex-start; }
.agent-bubble { padding: 11px 15px; border-radius: 17px; line-height: 1.65; white-space: normal; box-shadow: 0 1px 0 rgba(12,12,13,.02); }
.from-user .agent-bubble { background: var(--brand-soft); color: var(--ink); border: 1px solid rgba(var(--brand-rgb), .12); border-bottom-right-radius: 5px; }
.from-agent .agent-bubble { background: var(--panel); border: 1px solid rgba(12,12,13,.08); border-bottom-left-radius: 5px; }
.agent-thinking { color: var(--muted); font-style: italic; }
.agent-atts { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-att { max-width: 180px; max-height: 180px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.agent-att-missing { color: var(--muted); font-size: 12px; }
.agent-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 260px; box-shadow: inset 3px 0 0 var(--brand), var(--shadow-sm); }
.agent-card.resolved { border-color: var(--line); opacity: 0.75; }
.agent-card-title { font-weight: 700; margin-bottom: 8px; }
.agent-card-steps { margin: 0 0 10px 18px; padding: 0; color: var(--ink-soft); line-height: 1.8; }
.agent-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-card-btn { padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: var(--gray); color: var(--ink); cursor: pointer; }
.agent-card-btn:hover:not(:disabled) { background: var(--gray2); }
.agent-card-btn:disabled { cursor: default; opacity: 0.6; }
.agent-card-btn.chosen { background: var(--brand-deep); color: #fff; opacity: 1; }
.agent-composer { position: relative; width: min(940px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 16px; border: 1px solid var(--line-strong); border-radius: 24px; background: rgba(255,255,255,.97); box-shadow: 0 20px 56px rgba(16, 20, 24,.08); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.agent-composer:focus-within { border-color: rgba(var(--brand-rgb),.52); box-shadow: 0 24px 64px rgba(16, 20, 24,.11), 0 0 0 3px rgba(var(--brand-rgb),.07); }
.agent-composer.is-dragging { border-color: var(--brand); background: rgba(247,251,252,.98); box-shadow: 0 24px 64px rgba(16,20,24,.11), 0 0 0 4px rgba(var(--brand-rgb),.1); }
.agent-composer-body { display: flex; align-items: stretch; gap: 18px; min-height: 82px; }
.agent-upload-tile { flex: 0 0 68px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid rgba(var(--brand-rgb),.20); border-radius: 10px; background: repeating-linear-gradient(135deg, var(--brand-soft) 0 8px, var(--surface-tint) 8px 16px); color: var(--muted); cursor: pointer; transform: rotate(-3.5deg); transition: transform .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease; }
.agent-upload-tile b { font-size: 24px; line-height: 1; font-weight: 350; color: var(--brand-deep); }
.agent-upload-tile span { font-size: 10.5px; font-weight: 650; letter-spacing: .02em; }
.agent-upload-tile:hover, .agent-media-drop-zone.is-dragging .agent-upload-tile { transform: rotate(0) translateY(-2px); border-color: rgba(var(--brand-rgb),.55); color: var(--brand-deep); box-shadow: 0 8px 20px rgba(var(--brand-rgb),.12); }
.agent-composer-entry { position: relative; min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.agent-composer textarea { position: relative; z-index: 1; width: 100%; min-height: 52px; max-height: 180px; resize: none; border: none; background: transparent; padding: 0; font-size: 14px; line-height: 1.65; }
.agent-chat.is-empty .agent-composer textarea { min-height: 92px; font-size: 15px; }
.agent-composer textarea:focus { box-shadow: none; }
.agent-drop-hint { position: absolute; z-index: 2; inset: 0; display: none; place-items: center; align-content: center; gap: 3px; border: 1px dashed rgba(var(--brand-rgb),.55); border-radius: 14px; background: rgba(232,244,248,.97); color: var(--brand-deep); pointer-events: none; }
.agent-drop-hint b { font-size: 14px; }
.agent-drop-hint span { color: var(--muted); font-size: 11px; }
.agent-composer.is-dragging .agent-drop-hint { display: grid; }
.agent-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.agent-composer-tools { min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-mode-chip { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }
.agent-mode-chip { color: var(--brand-deep); }
.agent-mode-chip.muted { color: var(--muted); font-weight: 500; }
.agent-auto-toggle { min-height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 4px 9px 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); cursor: pointer; user-select: none; }
.agent-auto-toggle:hover { border-color: rgba(var(--brand-rgb),.34); background: var(--surface-tint); }
.agent-auto-toggle.active { border-color: rgba(var(--brand-rgb),.42); background: var(--brand-soft); color: var(--ink); }
.agent-auto-toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.agent-auto-switch { position: relative; flex: 0 0 30px; width: 30px; height: 18px; border-radius: 999px; background: #cbd2d6; box-shadow: inset 0 0 0 1px rgba(12,12,13,.06); }
.agent-auto-switch i { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(12,12,13,.22); transform: translateX(0); }
.agent-auto-toggle input:checked + .agent-auto-switch { background: var(--brand); }
.agent-auto-toggle input:checked + .agent-auto-switch i { transform: translateX(12px); }
.agent-auto-toggle input:focus-visible + .agent-auto-switch { outline: 2px solid var(--brand-deep); outline-offset: 2px; }
.agent-auto-toggle:has(input:disabled) { cursor: wait; opacity: .58; }
.agent-auto-label { font-size: 11.5px; font-weight: 650; line-height: 1; }
.agent-control-scrim { position: fixed; z-index: 36; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: transparent; cursor: default; }
.agent-control-shell { position: relative; z-index: 37; flex: none; }
.agent-control-shell.open { z-index: 38; }
.agent-control-trigger { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-soft); font-size: 11.5px; font-weight: 650; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.agent-control-trigger:hover, .agent-control-shell.open .agent-control-trigger { border-color: rgba(var(--brand-rgb),.34); background: var(--brand-soft); color: var(--ink); }
.agent-control-shell.open .agent-control-trigger { box-shadow: inset 0 0 0 1px rgba(var(--brand-rgb),.08); }
.agent-control-trigger b { min-width: 28px; font: inherit; color: inherit; }
.agent-control-chevron { margin-left: 1px; color: var(--faint); font-size: 12px; transform: translateY(-1px); }
.agent-control-shell.open .agent-control-chevron { transform: rotate(180deg) translateY(1px); }
.agent-ratio-icon { width: 14px; height: 9px; display: inline-block; border: 1.6px solid currentColor; border-radius: 3px; }
.agent-ratio-icon.vertical { width: 8px; height: 14px; }
.agent-clock-icon { position: relative; width: 14px; height: 14px; display: inline-block; border: 1.6px solid currentColor; border-radius: 50%; }
.agent-clock-icon::before { position: absolute; left: 5.2px; top: 2.4px; width: 1.4px; height: 4px; content: ""; border-radius: 2px; background: currentColor; transform-origin: 50% 100%; transform: rotate(28deg); }
.agent-clock-icon::after { position: absolute; left: 5.2px; top: 6px; width: 3.4px; height: 1.4px; content: ""; border-radius: 2px; background: currentColor; transform: rotate(18deg); transform-origin: 0 50%; }
.agent-control-popover { position: absolute; z-index: 40; top: calc(100% + 10px); left: 0; padding: 18px; border: 1px solid rgba(12,12,13,.08); border-radius: 20px; background: rgba(255,255,255,.98); box-shadow: 0 24px 70px rgba(16, 20, 24,.17); backdrop-filter: blur(16px); }
.agent-chat.has-conversation .agent-control-popover { top: auto; bottom: calc(100% + 10px); }
.agent-control-title { min-height: 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; color: #98a1ad; font-size: 12px; font-weight: 650; }
.agent-control-title b { color: var(--ink); font-size: 12px; }
.agent-ratio-popover { width: 268px; }
.agent-ratio-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 7px; border-radius: 16px; background: #f5f6f6; }
.agent-ratio-option { min-height: 82px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-soft); font-size: 13px; }
.agent-ratio-option:hover { color: var(--brand-deep); }
.agent-ratio-option.active { background: #fff; color: var(--ink); box-shadow: 0 5px 18px rgba(16, 20, 24,.08); }
.agent-ratio-option .agent-ratio-icon { width: 23px; height: 14px; border-width: 2px; border-radius: 4px; }
.agent-ratio-option .agent-ratio-icon.vertical { width: 12px; height: 23px; }
.agent-control-shell.duration .agent-control-popover { left: auto; right: 0; }
.agent-duration-popover { width: 360px; }
.agent-duration-range { width: 100%; height: 22px; margin: 2px 0 3px; padding: 0; appearance: none; border: 0; border-radius: 0; background: transparent; box-shadow: none; cursor: pointer; }
.agent-duration-range:focus { border: 0; background: transparent; box-shadow: none; }
.agent-duration-range::-webkit-slider-runnable-track { height: 9px; border-radius: 999px; background: linear-gradient(90deg, var(--brand) 0 var(--range-progress), var(--gray2) var(--range-progress) 100%); }
.agent-duration-range::-webkit-slider-thumb { width: 17px; height: 25px; margin-top: -8px; appearance: none; border: 3px solid #dbe0e2; border-radius: 7px; background: #fff; box-shadow: 0 1px 4px rgba(12,12,13,.12); }
.agent-duration-range::-moz-range-track { height: 9px; border-radius: 999px; background: #edf0f0; }
.agent-duration-range::-moz-range-progress { height: 9px; border-radius: 999px; background: var(--brand); }
.agent-duration-range::-moz-range-thumb { width: 12px; height: 20px; border: 3px solid #dbe0e2; border-radius: 7px; background: #fff; }
.agent-duration-scale { display: flex; align-items: center; justify-content: space-between; color: #4d5561; font-size: 11px; font-variant-numeric: tabular-nums; }
/* 聊天发送按钮 = 首页 home-agent-send 同款（品牌蓝胶囊 + hover 彩色渐变流光），这里只补 flex 布局 */
.agent-send-button { flex: none; }
.agent-ended { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--gray); }
.agent-ended div { display: flex; flex-direction: column; gap: 2px; }
.agent-ended b { font-size: 13px; }
.agent-ended span { color: var(--muted); font-size: 11.5px; }
.agent-ended .primary { flex: none; }
.agent-file-chips { position: relative; z-index: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.agent-file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; }
.agent-file-chip button { border: none; background: none; cursor: pointer; color: var(--muted); }

/* ── Agent 二期卡片 ── */
.agent-opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-bottom: 4px; }
.agent-opt { display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.agent-opt:hover:not(:disabled) { border-color: var(--brand); }
.agent-opt:disabled { opacity: 0.6; cursor: default; }
.agent-opt img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 6px; }
.agent-opt span { font-size: 12px; color: var(--ink-soft); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-preview-img { max-width: 280px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 10px; display: block; }
.agent-delivery-video { max-width: 320px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 10px; display: block; }
.agent-card-failure { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad), var(--shadow-sm); }
.agent-failure-error { color: var(--bad); font-size: 12px; margin-bottom: 10px; word-break: break-all; }
a.agent-card-btn { text-decoration: none; display: inline-flex; align-items: center; }
.agent-card-pending { border-style: dashed; }
.agent-pending-hint { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
@media (max-width: 980px) {
  .app-shell.agent-mode-shell { display: block; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; }
  .agent-mode-shell > .sidebar { display: none; }
  .main.agent-mode, .main.agent-mode .content { height: 100dvh; }
}

@media (max-width: 760px) {
  .agent-chat { position: relative; grid-template-columns: minmax(0, 1fr); height: 100dvh; }
  .agent-stage { grid-column: 1; grid-row: 1; }
  .agent-chat-head { min-height: 66px; padding: 11px 14px; }
  .agent-chat-head-main { min-width: 0; }
  .agent-chat-head-actions { gap: 6px; }
  .agent-top-action { padding-inline: 10px; }
  .agent-mobile-history { display: inline-flex; padding-inline: 10px; }
  .agent-chat-title b { max-width: 31vw; }
  .agent-conversation { padding: 18px 12px 14px; }
  .agent-chat.is-empty .agent-conversation { padding-bottom: 56px; }
  .agent-welcome h2 { font-size: 29px; }
  .agent-welcome p { max-width: 300px; }
  .agent-composer { padding: 15px; border-radius: 20px; }
  .agent-composer-body { gap: 12px; }
  .agent-upload-tile { flex-basis: 58px; min-height: 76px; }
  .agent-chat.is-empty .agent-composer textarea { min-height: 108px; }
  .agent-composer-actions { align-items: flex-end; }
  .agent-composer-tools { gap: 6px; }
  .agent-control-trigger { padding-inline: 8px; }
  .agent-control-popover,
  .agent-chat.has-conversation .agent-control-popover,
  .agent-control-shell.duration .agent-control-popover {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 84px;
    left: 16px;
    width: auto;
  }
  .agent-mode-chip.muted { display: none; }
  .agent-send-button { min-width: 0; min-height: 38px; padding: 0 14px; }
  .agent-history { position: absolute; inset: 0; z-index: 60; width: min(326px, calc(100% - 32px)); padding-top: 18px; border-right: 1px solid var(--line); box-shadow: 26px 0 70px rgba(12,12,13,.14); transform: translateX(-105%); transition: transform .22s ease; }
  .agent-chat.history-open .agent-history { transform: translateX(0); }
  .agent-history-close { display: grid; place-items: center; }
  .agent-chat.history-open .agent-stage { pointer-events: none; user-select: none; }
  .agent-chat.history-open::after { content: ""; position: absolute; inset: 0; z-index: 55; background: rgba(12,12,13,.22); }
  .agent-ended { align-items: flex-start; flex-direction: column; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .agent-chat { grid-template-columns: 270px minmax(0, 1fr); }
  .agent-conversation { padding-inline: 28px; }
}

/* ── 设置页左侧栏(页内二级导航,每项一个独立子页)── */
.settings-layout { display: flex; gap: 20px; align-items: flex-start; }
/* top 要吸在 sticky 顶栏(.topbar, 吸附后可视底边≈45px)之下，16px 会钻到顶栏底下被盖住 */
.settings-nav { flex: 0 0 200px; position: sticky; top: 64px; display: flex; flex-direction: column; gap: 6px; }
.settings-nav-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; }
.settings-nav-item b { font-size: 14px; color: var(--ink); }
.settings-nav-item span { font-size: 12px; color: var(--muted); }
.settings-nav-item:hover { background: var(--gray); }
.settings-nav-item.active { background: var(--gray); color: var(--ink); }
.settings-nav-item.active b { color: var(--ink); }
.settings-content { flex: 1; min-width: 0; }
@media (max-width: 900px) {
  .settings-layout { flex-direction: column; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; width: 100%; }
  .settings-nav-item span { display: none; }
}

/* ── 动效系统(样张V2):进场显现/场记标注/运行灯/流光 ─────────────── */
.reveal { opacity: 0; transform: translateY(22px);
  transition: opacity .7s cubic-bezier(.2,.6,.2,1), transform .7s cubic-bezier(.2,.6,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.no-anim { transition: none; }

.slate { font-family: var(--mono); font-size: 11px; letter-spacing: .12em;
  color: var(--faint); text-transform: uppercase; }

.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  animation: rec-pulse 1.6s ease-in-out infinite; flex: none; }
.rec-dot.idle { background: var(--gray2); animation: none; }
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--brand-rgb), .4); }
  55% { box-shadow: 0 0 0 6px rgba(var(--brand-rgb), 0); }
}
@keyframes flow-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .rec-dot { animation: none; }
  .asset-media .asset-image { transition: none; }
}
