/* ============================================================
   喷薄素材工坊 — Design System（结构重建版 · 参照 kodlo.ai）
   ------------------------------------------------------------
   编辑刊物风 / 纸墨双色：米白画布 #f4f3ee × 近黑墨色，
   品牌酸橙 #cbf990 作唯一强调色。
   三字体系统：Space Grotesk（展示标题）/ Inter（正文）/
   Geist Mono（等宽工程标注：眉题、表头、徽章、meta）。
   中文回落为本地 OPPO Sans 4.0（static/fonts-oppo.css，84 片 woff2 分片按需加载）。
   结构语言（本轮重建核心）：
   · 报头 = 2px 墨色顶规线 + 发丝底线（masthead）
   · 分区 = 无盒平铺：透明背景 + 顶部发丝线 + 角部十字定位标
   · 栏排 = 多列之间以竖向发丝栏线分隔，无槽距
   · 装置 = "01" 自动编号（导航 / 步骤）、mono 大写字距标注、
     扁平无影、近直角（0–3px）、hover 反色、1px 焦点描边
   ============================================================ */

/* ---------- 中文主字体：OPPO Sans 4.0（fonts-oppo.css 分片加载，见 base.html 引入顺序） ---------- */

/* ---------- Tokens ---------- */
:root {
  /* 墨色（文字 / 主按钮 / 强边框） */
  --ink: #0a0e0b;
  --ink-hover: #22281f;
  --ink-2: rgba(10, 14, 11, .74);
  --ink-3: rgba(10, 14, 11, .56);
  --muted: rgba(10, 14, 11, .46);
  /* 纸面层次 */
  --canvas: #f4f3ee;
  --paper: #faf9f4;
  --wash: #edebe2;
  /* 线（发丝） */
  --line: rgba(10, 14, 11, .13);
  --line-strong: rgba(10, 14, 11, .26);
  /* 品牌强调（唯一彩色） */
  --brand: #0a0e0b;
  --brand-hover: #22281f;
  --lime: #cbf990;
  --lime-hover: #baf378;
  --lime-soft: #e7f5c4;
  --lime-faint: #eff5e0;
  --lime-border: #c8dd9e;
  /* 状态（编辑部式克制） */
  --ok: #33663e;      --ok-bg: #e9efe0;   --ok-line: rgba(51, 102, 62, .30);
  --err: #96382c;     --err-bg: #f5e7e0;  --err-line: rgba(150, 56, 44, .32);
  --warn: #8a6114;    --warn-bg: #f3ecd7; --warn-line: rgba(138, 97, 20, .34);
  --teal: #2d6a5f;    --teal-bg: #e2efe7; --teal-line: rgba(45, 106, 95, .30);
  --violet: #5b4a8a;  --violet-bg: #eae6f4; --violet-line: rgba(91, 74, 138, .32);
  --apricot: #9a5a2e; --apricot-bg: #f6e8dc; --apricot-line: rgba(154, 90, 46, .32);
  --dot-ok: #3e8e52;
  --dot-err: #c94f3d;
  /* radius（刊物式近直角：控件 2 / 菜单 2 / 面层 3 / 弹窗 2 / 大面 4） */
  --r-sm: 2px;  --r-md: 2px;  --r-lg: 3px;  --r-xl: 2px;  --r-2xl: 4px;  --r-full: 9999px;
  /* shadow（扁平，仅浮层保留） */
  --shadow-sm: 0 1px 2px rgba(10, 14, 11, .04);
  --shadow-md: 0 2px 12px rgba(10, 14, 11, .06);
  --shadow-lg: 0 14px 40px -12px rgba(10, 14, 11, .16);
  /* layout */
  --container: 1440px;
  --container-narrow: 880px;
  --topbar-h: 0px; /* 顶栏已由左侧 rail（app-shell）取代，变量保留供旧 sticky 规则归零 */
  --font: 'Inter', 'OPPO Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
          'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', 'OPPO Sans', 'PingFang SC', 'Hiragino Sans GB',
          'Microsoft YaHei', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, 'JetBrains Mono', Consolas,
          'OPPO Sans', 'PingFang SC', 'Microsoft YaHei', monospace;
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-feature-settings: "ss01", "cv11";
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 {
  margin: 0; font-family: var(--font-display); font-weight: 500;
  color: var(--ink); letter-spacing: -.01em;
}
h1 { font-size: 26px; line-height: 1.18; letter-spacing: -.02em; }
h2 { font-size: 15px; line-height: 1.3; }
h3 { font-size: 13.5px; line-height: 1.35; }
p { margin: 0; }
code {
  font-family: var(--font-mono); font-size: .9em;
  background: var(--wash); border: 1px solid var(--line); border-radius: 2px; padding: 1px 5px;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
::selection { background: var(--lime); color: var(--ink); }
/* kodlo 式全局细滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(128, 128, 128, .5) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, .5); border-radius: 9999px;
  border: 2px solid transparent; background-clip: padding-box; min-height: 40px;
}
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

/* 键盘焦点：1px currentColor 描边（kodlo） */
:where(a, button):focus-visible {
  outline: 1px solid currentColor; outline-offset: 2px; border-radius: 2px;
}

/* ---------- Typography helpers ---------- */
.eyebrow {
  display: inline-block; font-family: var(--font-mono);
  font-size: 10px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); opacity: .55; margin-bottom: 5px;
}
.eyebrow::before { content: "— "; }
.lead { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.caption { font-size: 11px; color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
.err-text { color: var(--err); }

/* ---------- Layout：画布 + 报头（masthead） ---------- */
.page {
  max-width: none;
  margin: 0;
  padding: 18px 28px 64px;
}
.page-narrow { max-width: var(--container-narrow); }
.page-head {
  margin: 0 0 30px;
  padding: 16px 0 18px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 26px; }
.page-head h1 .icon { width: 20px; height: 20px; }
.page-head .lead { margin-top: 6px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Topbar：编号导航 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: rgba(244, 243, 238, .88);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent;
}
/* 滚动后导航浮现发丝底线：未滚动时让位报头墨线，全页只保留一条强横线 */
.topbar.scrolled {
  background: rgba(244, 243, 238, .94);
  border-bottom-color: var(--line);
}
.topbar-inner {
  max-width: var(--container);
  height: 100%; margin: 0 auto; padding: 0 36px;
  display: flex; align-items: center; gap: 20px;
}
.logo { display: flex; align-items: center; gap: 9px; text-decoration: none !important; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 2px;
  background: var(--ink); color: var(--lime);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0;
}
.logo-text {
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px;
  color: var(--ink); letter-spacing: -.01em;
}
.logo-text em { font-style: normal; color: var(--ink-3); font-weight: 500; }
.topnav { display: flex; align-items: center; gap: 4px; flex: 1; counter-reset: navitem; }
/* 直接子代限定：下拉面板内的链接不参与编号与顶栏样式 */
.topnav > a {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  padding: 6px 10px; border-radius: 2px; text-decoration: none !important;
  transition: color .15s, background .15s;
}
/* 编号装置：01 / 02 / 03 …（mono 微字） */
.topnav > a::before {
  counter-increment: navitem;
  content: "0" counter(navitem);
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; color: var(--ink); opacity: .45;
}
.topnav > a:hover { color: var(--ink); background: var(--wash); }
.topnav > a.active {
  color: var(--canvas); font-weight: 600; background: var(--ink);
}
.topnav > a.active::before { color: var(--lime); opacity: .95; }
.topnav-sep { width: 1px; height: 16px; background: var(--line-strong); margin: 0 8px; }
.topnav-tag {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  background: var(--ink); color: var(--lime);
  padding: 3px 7px; border-radius: 2px; margin-left: 4px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.user-chip .avatar, .user-drop-btn .avatar {
  flex: 0 0 auto; /* rail 收起态按钮内溢出时不被压缩变形，保持正圆 */
  width: 26px; height: 26px; border-radius: var(--r-full);
  background: var(--wash); color: var(--ink);
  border: 1px solid var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
}
.user-chip .avatar .icon, .user-drop-btn .avatar .icon { width: 14px; height: 14px; }

/* ---------- 顶部下拉面板：系统设置 / 用户菜单 ---------- */
.nav-drop, .user-drop { position: relative; display: inline-flex; }
.nav-drop-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  padding: 6px 10px; border: none; border-radius: 2px;
  background: transparent; cursor: pointer;
  transition: color .15s, background .15s;
  /* button 不继承行高（UA 默认 normal），导致盒高比 .topnav > a 短、顶对齐下移 */
  line-height: inherit;
}
.nav-drop-toggle::before {
  counter-increment: navitem;
  content: "0" counter(navitem);
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .08em; color: var(--ink); opacity: .45;
}
.nav-drop-toggle:hover { color: var(--ink); background: var(--wash); }
.nav-drop-toggle.active {
  color: var(--canvas); font-weight: 600; background: var(--ink);
}
.nav-drop-toggle.active::before { color: var(--lime); opacity: .95; }
.nav-drop-toggle.active .nav-caret { color: var(--canvas); }
/* svg 默认 fill 为黑色：补 icon 描边样式让 color 生效（选中态可变白） */
.nav-caret {
  width: 12px; height: 12px; color: var(--muted);
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .15s, color .15s;
}
.nav-drop.open .nav-caret { transform: rotate(180deg); }
.nav-panel, .user-panel {
  display: none; position: absolute; z-index: 1100;
  min-width: 196px; padding: 6px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 2px;
  box-shadow: var(--shadow-lg);
}
.nav-panel { top: calc(100% + 12px); left: 0; }
.user-panel { top: calc(100% + 12px); right: 0; width: 224px; }
.nav-drop.open .nav-panel, .user-drop.open .user-panel {
  display: block; animation: sel-in .13s ease;
}
.nav-panel-label {
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  padding: 7px 9px 5px;
}
.nav-panel a, .up-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 9px; border: none; border-radius: 2px;
  font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  text-align: left; text-decoration: none !important; cursor: pointer;
  background: transparent;
  transition: color .15s, background .15s;
}
.nav-panel a:hover, .up-item:hover { background: var(--wash); color: var(--ink); }
.nav-panel a.active { background: var(--lime-faint); color: var(--ink); }
.nav-panel a .icon, .up-item .icon { width: 14px; height: 14px; color: var(--ink-3); }
.nav-panel a.active .icon, .up-item:hover .icon { color: var(--ink); }
.user-drop-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: var(--r-full);
  background: transparent; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.user-drop-btn:hover, .user-drop.open .user-drop-btn {
  border-color: var(--line-strong); background: var(--wash);
}
.up-head {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 9px 10px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.up-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.up-meta {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}

/* ---------- Buttons：近直角 / hover 反色 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 15px;
  font-family: var(--font); font-size: 12.5px; font-weight: 600; letter-spacing: .05em;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--line-strong); border-radius: 2px;
  cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.btn:hover { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.btn:active { background: var(--ink-hover); }
.btn:focus-visible { outline: 1px solid currentColor; outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: var(--canvas); }
.btn.primary:disabled:hover { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.lime:hover { background: var(--lime-hover); border-color: var(--lime-hover); color: var(--ink); }
.btn.danger { color: var(--err); border-color: var(--err-line); background: transparent; }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--wash); border-color: transparent; color: var(--ink); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 13px; }
/* 表格内纯图标操作按钮：正方形、hover 提示靠 title */
.btn.sm.icon-only { width: 30px; padding: 0; gap: 0; }
.btn.sm.icon-only .icon { width: 14px; height: 14px; }
.btn.block { display: flex; width: 100%; }
.btn .spin { width: 13px; height: 13px; border-width: 2px; }

/* ---------- Forms：mono 标注 + 36px 控件 + 近直角 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
input[type="url"], input[type="email"], input[type="tel"], input[type="date"],
input[type="time"], input[type="datetime-local"], input:not([type]), select, textarea {
  font-family: var(--font); font-size: 13px; color: var(--ink); caret-color: var(--ink);
  width: 100%; min-height: 36px; padding: 6px 11px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 2px;
  outline: none; transition: border-color .15s, background .15s;
}
textarea { min-height: 68px; resize: vertical; line-height: 1.55; padding: 8px 11px; }
textarea.code { font-family: var(--font-mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); background: #fff; }
input:disabled, select:disabled, textarea:disabled { background: var(--wash); color: var(--muted); cursor: not-allowed; }
/* Chrome 自动填充时保持纸面底色与墨色文字 */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  -webkit-text-fill-color: var(--ink);
  transition: background-color 999999s ease-out 0s;
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%230a0e0b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .grow { flex: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); width: 14px; height: 14px; }
input[type="checkbox"]:not(:disabled), input[type="radio"]:not(:disabled) { cursor: pointer; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Cards：无盒平铺分区（透明 + 顶规线 + 角标） ---------- */
.card {
  position: relative;
  background: transparent; border: none; border-top: 1px solid var(--line-strong);
  border-radius: 0; padding: 16px 0 22px;
}
/* kodlo 角部十字定位标（对角两枚） */
.card::before, .card::after,
.panel::before, .panel::after {
  content: ""; position: absolute; width: 9px; height: 9px;
  pointer-events: none; color: var(--ink); opacity: .3;
  background:
    linear-gradient(currentColor, currentColor) center / 9px 1px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1px 9px no-repeat;
}
.card::before, .panel::before { top: -5px; left: -5px; }
.card::after, .panel::after { bottom: -5px; right: -5px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.card h3 { display: flex; align-items: center; gap: 8px; }
/* 卡内直连标题：与 card-head 同样的发丝下线 */
.card > h3 {
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* Studio steps："01" mono 编号（去方块） */
.step { position: relative; }
.step-head {
  display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.step-head h2 { font-size: 14.5px; }
.step-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.step-no {
  flex: 0 0 auto; min-width: 20px; width: auto; height: auto;
  border: none; background: transparent; border-radius: 0;
  color: var(--ink); opacity: .55; padding: 2px 0 0;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  display: inline-flex; align-items: flex-start; justify-content: flex-start;
}
.step-no::before { content: "0"; }
.step.done .step-no { opacity: 1; color: var(--ink); }
.step.done .step-no::after { content: " ✓"; font-size: 10px; }

/* 风格快选 / 产品图缩略 / 生成前提示 */
.style-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.style-chip {
  font-family: var(--font); font-size: 11.5px; font-weight: 500; line-height: 1;
  color: var(--ink-2); background: transparent; border: 1px solid var(--line-strong);
  border-radius: 2px; padding: 6px 10px; cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.style-chip:hover { color: var(--canvas); background: var(--ink); border-color: var(--ink); }
.style-chip.active { color: var(--ink); background: var(--lime); border-color: var(--ink); font-weight: 600; }
/* 人物替换开关（iOS 风格小拨杆） */
.char-head { display: flex; align-items: center; justify-content: space-between; }
.char-head .sf-label { margin-bottom: 0; }
.char-opt {
  font-style: normal; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .08em; color: var(--muted); margin-left: 6px;
}
.switch { position: relative; display: inline-flex; flex: none; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch-ui {
  width: 32px; height: 18px; background: var(--wash);
  border: 1px solid var(--line-strong); border-radius: 999px;
  position: relative; transition: background .15s, border-color .15s;
}
.switch-ui::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink-3); transition: transform .15s, background .15s;
}
.switch input:checked + .switch-ui { background: var(--lime); border-color: var(--ink); }
.switch input:checked + .switch-ui::after { transform: translateX(14px); background: var(--ink); }
.switch input:focus-visible + .switch-ui { outline: 1px solid var(--ink); outline-offset: 2px; }
.char-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thumb-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dz-mini { padding: 14px 12px; gap: 4px; }
.ready-hint { font-size: 12px; color: var(--warn); line-height: 1.5; margin-top: 8px; }

/* ---------- Dropzone / 上传 ---------- */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: 2px;
  background: transparent; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--ink); background: var(--paper); }
.dropzone.has-file { padding: 0; border-style: solid; }
.dropzone.uploading { pointer-events: none; opacity: .82; }
.dz-icon {
  width: 36px; height: 36px; border-radius: 2px;
  background: var(--ink); border: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--lime); font-size: 17px;
}
.dz-title { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.dz-hint { font-size: 11.5px; color: var(--muted); }

/* 上传预览：媒体在上，信息与操作在下（纵向） */
.upload-preview { display: flex; flex-direction: column; gap: 10px; }
.upload-preview > video,
.upload-preview > img {
  width: 100%; height: auto; max-height: 300px; object-fit: contain;
  border-radius: var(--r-md); border: 1px solid var(--line-strong);
  background: var(--wash);
}
.upload-preview > video { background: #000; }
.upload-meta { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; min-width: 0; }
.upload-meta b { font-size: 13px; }
.upl-info-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.upl-info-row > span { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; overflow-wrap: anywhere; }

/* 上传进度条 */
.upl-progress { width: 100%; max-width: 360px; margin-top: 12px; }
.upl-bar { height: 4px; background: var(--wash); border: 1px solid var(--line); overflow: hidden; }
.upl-fill { height: 100%; width: 0%; background: var(--ink); transition: width .15s ease; }
.upl-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11.5px; color: var(--ink-2); min-width: 0;
}
.upl-row > span { min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.upl-row > b { flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 产品图缩略卡片：图在上，文件名/大小/移除在下 */
.pthumb { display: flex; flex-direction: column; gap: 4px; width: 104px; }
.pthumb-img {
  width: 104px; height: 104px; object-fit: cover; display: block;
  border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--wash);
}
.pthumb-name {
  font-size: 10.5px; color: var(--ink-2); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pthumb-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.pthumb-size { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pthumb-del {
  border: 0; background: none; padding: 0;
  font-size: 10.5px; color: var(--err); cursor: pointer;
}
.pthumb-del:hover { text-decoration: underline; }
.pthumb.uploading .pthumb-img {
  display: flex; align-items: center; justify-content: center;
}
.pthumb.uploading .pthumb-name { color: var(--muted); }
.pthumb-pct { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.upl-bar.mini { height: 3px; margin-top: 2px; }

/* ---------- 图片叠加（bbox 可拖拽编辑） ---------- */
.analysis-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.overlay-box {
  position: relative; border-radius: 0; overflow: hidden;
  border: 1px solid var(--line-strong); background: var(--wash);
  max-width: 640px;
  touch-action: none;
}
.overlay-box img { width: 100%; height: auto; display: block; }
.bbox-rect {
  position: absolute; cursor: move;
  border: 1.5px solid #cbf990;
  background: rgba(203, 249, 144, .14);
  box-shadow: 0 0 0 1px rgba(10, 14, 11, .35) inset;
}
.bbox-center {
  position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; transform: translate(-50%, -50%);
  pointer-events: none;
}
.bbox-center::before, .bbox-center::after {
  content: ""; position: absolute; background: #01370b;
}
.bbox-center::before { left: 0; right: 0; top: 50%; height: 1.5px; margin-top: -0.75px; }
.bbox-center::after { top: 0; bottom: 0; left: 50%; width: 1.5px; margin-left: -0.75px; }
.bh {
  position: absolute; width: 12px; height: 12px;
  background: #01370b; border: 2px solid #cbf990; border-radius: 50%;
}
.bh[data-h="nw"] { left: -6px; top: -6px; cursor: nwse-resize; }
.bh[data-h="n"]  { left: 50%; top: -6px; margin-left: -6px; cursor: ns-resize; }
.bh[data-h="ne"] { right: -6px; top: -6px; cursor: nesw-resize; }
.bh[data-h="e"]  { right: -6px; top: 50%; margin-top: -6px; cursor: ew-resize; }
.bh[data-h="se"] { right: -6px; bottom: -6px; cursor: nwse-resize; }
.bh[data-h="s"]  { left: 50%; bottom: -6px; margin-left: -6px; cursor: ns-resize; }
.bh[data-h="sw"] { left: -6px; bottom: -6px; cursor: nesw-resize; }
.bh[data-h="w"]  { left: -6px; top: 50%; margin-top: -6px; cursor: ew-resize; }
.canvas-tip {
  position: absolute; left: 8px; bottom: 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .05em;
  color: var(--canvas); background: rgba(10, 14, 11, .72);
  padding: 4px 8px; border-radius: 2px; pointer-events: none;
}

/* 构图测量调整面板 */
.adj-panel {
  border: 1px solid var(--line); background: var(--paper);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
}
.adj-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adj-item { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.adj-item > label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px;
}
.adj-item > label b { font-weight: 600; color: var(--ink); letter-spacing: 0; text-transform: none; }
.adj-item input[type="range"] {
  width: 100%; height: 18px; margin: 0; padding: 0; min-height: 0;
  background: transparent; border: none; border-radius: 0;
  accent-color: var(--ink); cursor: pointer;
}
.adj-item input[type="range"]:focus { box-shadow: none; background: transparent; }
.margin-inputs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.margin-inputs input {
  width: 100%; min-height: 30px; padding: 4px 6px;
  font-family: var(--font-mono); font-size: 12px; text-align: center;
}

/* measurement chips */
.chip-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip {
  background: transparent; border: 1px solid var(--line); border-radius: 0;
  padding: 7px 10px; min-width: 0;
}
.chip .chip-label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.chip .chip-value { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-top: 2px; word-break: break-all; }

/* JSON 编辑 */
.json-fold { border: 1px solid var(--line); border-radius: 0; background: var(--paper); margin-top: 12px; }
.json-fold summary {
  cursor: pointer; padding: 9px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  user-select: none; list-style: none; display: flex; align-items: center; gap: 8px;
}
.json-fold summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.json-fold[open] summary::before { transform: rotate(90deg); }
.json-fold .fold-body { padding: 0 12px 12px; }
.code-editor {
  font-family: var(--font-mono);
  font-size: 12px; line-height: 1.6; min-height: 220px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 0;
  color-scheme: light;
  white-space: pre; overflow-x: auto;
}
.code-editor:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--lime-soft); }

/* 校验结果 */
.issue-list { display: flex; flex-direction: column; gap: 6px; }
.issue {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; padding: 8px 11px; border-radius: 0; line-height: 1.45;
}
.issue.err  { background: var(--err-bg);  border: 1px solid var(--err-line);  color: var(--err); }
.issue.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn); }
.issue.ok   { background: var(--ok-bg);   border: 1px solid var(--ok-line);   color: var(--ok); }
.issue b { font-weight: 700; }

/* ---------- Segmented / 模式卡 ---------- */
.seg {
  display: inline-flex; background: var(--wash); border: 1px solid var(--line-strong);
  border-radius: 2px; padding: 3px; gap: 3px;
}
.seg button {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: 12.5px; font-weight: 600; color: var(--muted);
  padding: 5px 13px; border-radius: 1px; transition: background .15s, color .15s;
}
.seg button.active { background: var(--ink); color: var(--canvas); }
.mode-cards { display: grid; gap: 8px; }
.mode-card {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 0; padding: 10px 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.mode-card:hover { border-color: var(--line-strong); background: var(--paper); }
.mode-card input { grid-row: span 2; }
.mode-card b { font-size: 13px; color: var(--ink); }
.mode-card span { font-size: 11.5px; color: var(--muted); grid-column: 2; line-height: 1.45; }
.mode-card.checked { border-color: var(--ink); background: var(--lime-faint); box-shadow: 0 0 0 1px var(--ink) inset; }

/* ---------- 生成状态 ---------- */
.gen-status { margin-top: 12px; font-size: 12.5px; }
.progress-note {
  display: flex; align-items: center; gap: 9px;
  background: var(--lime-faint); border: 1px solid var(--lime-border);
  color: var(--ink-2); border-radius: 0; padding: 9px 12px; font-weight: 500;
}

/* ---------- 图生视频：导演脚本 ---------- */
.script-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.script-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.script-summary {
  border: 1px solid var(--line); background: var(--wash);
  padding: 9px 12px; font-size: 12.5px; line-height: 1.6;
}
.script-summary-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.script-summary p { margin: 0; color: var(--ink); font-weight: 500; }
.prompt-preview { border: 1px solid var(--line-strong); background: var(--wash); }
.prompt-preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.prompt-preview pre {
  margin: 0; padding: 10px 12px; max-height: 180px; overflow-y: auto;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
  color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
}
/* 多段续接：逐拍编辑卡片 */
.beat-card {
  border: 1px solid var(--line); background: var(--paper);
  padding: 12px 12px 0; margin-bottom: 2px;
}
.beat-card .beat-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.beat-card .beat-no {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
}
.beat-card .field { margin-bottom: 12px; }
#beats-list { display: flex; flex-direction: column; gap: 2px; }
#beats-list[hidden] { display: none; }
.result-img {
  width: 100%; border-radius: 0; border: 1px solid var(--line-strong);
  background: repeating-conic-gradient(var(--wash) 0% 25%, var(--paper) 0% 50%) 0 0/16px 16px;
}
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ---------- 徽章 / pill ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 0; white-space: nowrap;
  background: var(--wash); border: 1px solid var(--line); color: var(--ink-2);
}
.badge.ok   { background: var(--ok-bg);   border-color: var(--ok-line);   color: var(--ok); }
.badge.err  { background: var(--err-bg);  border-color: var(--err-line);  color: var(--err); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge.info { background: var(--lime-faint); border-color: var(--lime-border); color: var(--ink-2); }
.badge.lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
/* 模型类型标签（constants.MODEL_TYPES） */
.badge.type-image   { background: var(--apricot-bg); border-color: var(--apricot-line); color: var(--apricot); }
.badge.type-video   { background: var(--violet-bg);  border-color: var(--violet-line);  color: var(--violet); }
.badge.type-video_understanding { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.badge.type-vision  { background: var(--teal-bg);    border-color: var(--teal-line);    color: var(--teal); }
.badge.type-text    { background: var(--wash);       border-color: var(--line-strong);  color: var(--ink-2); }
/* 解析缓存命中标签（虚线边框以示"复用"语义） */
.badge.cache { background: var(--teal-bg); border-color: var(--teal-line); color: var(--teal); border-style: dashed; }

/* 模型列表：名称列元数据行（model_id · Provider） */
.model-meta {
  display: flex; align-items: center; gap: 5px;
  margin-top: 3px; font-size: 11.5px; line-height: 1.2;
}
.model-meta .mi  { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.model-meta .doc-link { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); text-decoration: none; }
.model-meta .doc-link:hover { color: var(--ink); text-decoration: underline; }
.model-meta .sep { color: var(--muted); }
.model-meta .icon { width: 11px; height: 11px; color: var(--ink-3); flex: none; }
.model-meta .mp  { color: var(--ink-3); font-weight: 500; }
.model-meta .mk  { color: var(--ink-3); font-weight: 500; }
.model-meta .mk .mono { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
/* 模型表单：Key 绑定选项中的尾号小字 */
.mf-key .mono { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
/* 模型列表名称行：Probe 通过圆点 / 停用标记 */
.dot-ok {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #3fae5a; margin-left: 6px; vertical-align: middle;
  position: relative; top: -2px;
}
.mi-off {
  display: inline-flex; align-items: center; margin-left: 5px;
  color: var(--muted); vertical-align: middle;
}
.mi-off .icon { width: 12px; height: 12px; }

/* 列表分页条（模型管理等）：左侧统计、右侧页码按钮 */
.pager { display: flex; align-items: center; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pager .pg-info { font-size: 11.5px; color: var(--ink-2); margin-right: auto; }
.pager .btn { min-width: 30px; justify-content: center; }
.pager .btn.on { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.pager .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left; font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(10, 14, 11, .025); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.sel { background: var(--lime-faint) !important; }
td .btn + .btn { margin-left: 4px; }

/* ---------- Panels（admin 兼容，与 card 同为平铺分区） ---------- */
.panel {
  position: relative;
  background: transparent; border: none; border-top: 1px solid var(--line-strong);
  border-radius: 0; padding: 16px 0 22px; margin-bottom: 20px;
}
.panel > h2, .panel > h3 {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* ---------- 统计（admin 兼容，平铺） ---------- */
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 16px 0 24px; }
.stat {
  position: relative;
  background: transparent; border: none; border-top: 1px solid var(--line-strong);
  border-radius: 0; padding: 12px 0 4px;
}
.stat .num {
  font-family: var(--font-display); font-size: 30px; font-weight: 500;
  color: var(--ink); line-height: 1.1; letter-spacing: -.02em;
}
.stat .label {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-top: 5px;
}

/* ---------- 健康检查（admin 兼容） ---------- */
.check-card { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.check-card + .check-card { border-top: 1px dashed var(--line); }
.check-dot { width: 9px; height: 9px; border-radius: var(--r-full); flex: 0 0 auto; background: var(--line-strong); }
.check-dot.ok { background: var(--dot-ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.check-dot.err { background: var(--dot-err); box-shadow: 0 0 0 3px var(--err-bg); }
.check-detail { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

/* ---------- admin 表单盒（兼容旧模板 details.form-box） ---------- */
.form-box { border: 1px solid var(--line); border-radius: 0; background: var(--paper); margin-bottom: 12px; }
.form-box > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--ink);
  user-select: none; list-style: none;
}
.form-box > summary::-webkit-details-marker { display: none; }
.form-box > summary::before { content: "＋ "; }
.form-box[open] > summary::before { content: "− "; }
.form-box .inner { padding: 2px 14px 14px; border-top: 1px solid var(--line); }

/* pre.json / code */
pre.json, pre.code {
  background: var(--ink); color: var(--lime); border-radius: 0;
  padding: 14px; font-size: 12px; line-height: 1.6; overflow: auto;
  font-family: var(--font-mono);
  max-height: 420px;
}

/* 运行日志查看器（管理后台 /logs） */
pre.log-view {
  background: var(--ink); color: var(--canvas); border-radius: 0;
  padding: 14px; font-size: 12px; line-height: 1.65; overflow: auto;
  font-family: var(--font-mono);
  max-height: 60vh; margin-top: 12px;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(14px);
  background: var(--ink); color: var(--canvas);
  font-size: 12.5px; font-weight: 500; padding: 10px 18px; border-radius: 2px;
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 1000; max-width: min(560px, 90vw);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--err); border-color: var(--err); }

/* ---------- 认证页（登录 / 注册）：下划线输入框 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(203, 249, 144, .30), transparent 60%),
    var(--canvas);
}
.auth-card {
  width: 100%; max-width: 860px;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper); border: 1px solid var(--ink);
  border-radius: 0; overflow: hidden;
}
.auth-brand {
  background: var(--ink); color: var(--canvas); padding: 30px 32px 34px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.auth-brand::after {
  content: ""; position: absolute; right: -80px; bottom: -80px;
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(203, 249, 144, .22), transparent);
}
.ab-meta {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--canvas); opacity: .55;
  margin-bottom: auto; padding-bottom: 20px;
}
.auth-brand .ab-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .ab-logo .logo-mark { background: rgba(203, 249, 144, .14); border: 1px solid rgba(203, 249, 144, .45); }
.auth-brand .ab-logo span:last-child {
  color: var(--canvas); font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -.01em;
}
.auth-brand h2 {
  color: var(--canvas); font-size: 22px; font-weight: 500; line-height: 1.24;
  letter-spacing: -.01em; margin-bottom: 10px;
}
.auth-brand p { color: rgba(244, 243, 238, .62); font-size: 12.5px; line-height: 1.65; }
.auth-points { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1; }
.auth-points span { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: rgba(244, 243, 238, .88); }
.auth-points i {
  flex: 0 0 auto; width: 17px; height: 17px; border-radius: 0; font-style: normal;
  background: var(--lime); color: var(--ink); font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; margin-top: 2px;
}
.auth-form { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { font-size: 22px; margin-bottom: 5px; }
.auth-form .sub { font-size: 12.5px; color: var(--muted); margin-bottom: 22px; }
.auth-form .field { margin-bottom: 18px; }
/* 编辑刊物式下划线输入框：无盒、无圆角、仅发丝底线 */
.auth-form input, .auth-form select {
  border: 0; border-bottom: 1px solid var(--line-strong);
  border-radius: 0; background: transparent;
  padding: 6px 0; min-height: 38px;
  transition: border-color .15s;
}
.auth-form input:hover, .auth-form select:hover { border-bottom-color: var(--ink-3); background: transparent; }
.auth-form input:focus, .auth-form select:focus { border-bottom-color: var(--ink); background: transparent; }
.auth-form input:disabled, .auth-form select:disabled { background: transparent; }
.auth-form input:-webkit-autofill, .auth-form input:-webkit-autofill:hover, .auth-form input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--paper) inset;
  -webkit-text-fill-color: var(--ink);
}
.auth-error {
  background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err);
  font-size: 12.5px; border-radius: 0; padding: 8px 11px; margin-bottom: 14px;
}
.auth-foot { margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.auth-foot a { font-weight: 600; }
.form-error { color: var(--err); font-size: 12.5px; }

/* ---------- 403 ---------- */
.denied-card { max-width: 520px; margin: 48px auto; text-align: center; padding: 44px 36px; }
.denied-code {
  font-family: var(--font-display); font-size: 46px; font-weight: 500;
  color: var(--ink); letter-spacing: -.03em; line-height: 1;
}
.denied-card h1 { margin: 12px 0 8px; }
.denied-card p { color: var(--muted); }
.denied-actions { margin-top: 22px; display: flex; gap: 10px; justify-content: center; }

/* ---------- 画廊 ---------- */
.gallery-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.gallery-toolbar select, .gallery-toolbar input { width: auto; min-width: 150px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.g-card {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 0;
  overflow: hidden; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.g-card:hover { border-color: var(--ink); box-shadow: var(--shadow-md); }
.g-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--wash);
}
.g-img.failed {
  display: flex; align-items: center; justify-content: center;
  color: var(--err); font-size: 12.5px; background: var(--err-bg);
}
.g-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.g-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.g-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-time { font-size: 11px; color: var(--muted); }
.stars { display: inline-flex; gap: 2px; }
.stars button {
  border: 0; background: none; cursor: pointer; padding: 0 1px;
  font-size: 15px; color: var(--line-strong); line-height: 1;
}
.stars button.on { color: #d9a514; }
.stars button:hover { transform: scale(1.15); }
.fav-btn { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--line-strong); padding: 2px; }
.fav-btn.on { color: #c2483a; }
.empty-state {
  text-align: center; padding: 52px 20px; color: var(--muted);
  border: 1.5px dashed var(--line-strong); border-radius: 0; background: transparent;
}
.empty-state .dz-icon { margin: 0 auto 12px; }

/* ---------- 视频 ---------- */
.video-result video {
  width: 100%; max-height: 480px; border-radius: 0;
  background: #000; border: 1px solid var(--line-strong);
}
.v-list { display: flex; flex-direction: column; gap: 8px; }
.v-item {
  display: flex; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 0; padding: 9px 11px;
  cursor: pointer; background: transparent; transition: border-color .15s, background .15s;
}
.v-item:hover { border-color: var(--ink); background: var(--paper); }
.v-item .v-info { min-width: 0; flex: 1; }
.v-item .v-name { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-item .v-time { font-size: 11px; color: var(--muted); }

/* ---------- Modal（浮层保留纸面盒） ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10, 14, 11, .52); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: var(--paper); border: 1px solid var(--ink);
  border-radius: 2px;
  width: 100%; max-width: 680px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .18s ease;
}
.modal.modal-lg { max-width: 900px; }
.modal.modal-sm { max-width: 400px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}

/* ---------- 全局确认弹窗（confirmDialog，替代原生 confirm） ---------- */
.confirm-modal { max-width: 380px; }
.confirm-body {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  padding: 18px 16px 4px;
}
.confirm-ic {
  width: 34px; height: 34px; border-radius: 0;
  background: var(--err-bg); border: 1px solid var(--err-line);
  color: var(--err);
  display: inline-flex; align-items: center; justify-content: center;
}
.confirm-ic .icon { width: 16px; height: 16px; }
.confirm-body h3 { font-size: 14px; }
.confirm-msg { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.confirm-modal .modal-foot { margin-top: 14px; }
/* 新增主体：类型选择弹窗 */
.role-choice { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.role-choice .btn { width: 100%; height: 40px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-strong);
}
.modal-head h3 { font-size: 14px; }
.modal-close {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  width: 30px; height: 30px; border-radius: 0;
  color: var(--muted); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--err-bg); border-color: var(--err-line); color: var(--err); }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-body h4 {
  margin: 14px 0 6px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.modal-body h4:first-child { margin-top: 0; }
.kv-table { width: 100%; font-size: 12.5px; }
.kv-table td { padding: 6px 8px; border-bottom: 1px dashed var(--line); }
.kv-table td:first-child { color: var(--muted); width: 130px; }
.kv-table td:last-child { word-break: break-all; }
.prompt-block {
  background: var(--wash); border: 1px solid var(--line); border-radius: 0;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
}

/* ---------- 详情两栏图片 ---------- */
.detail-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-imgs figure { margin: 0; }
.detail-imgs figcaption { font-size: 11px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.detail-imgs img { width: 100%; border-radius: 0; border: 1px solid var(--line); background: var(--wash); }

/* ---------- Spinner ---------- */
.spin, .spinner {
  display: inline-block; width: 16px; height: 16px; flex: 0 0 auto;
  border: 2px solid var(--line-strong); border-top-color: var(--ink);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner.lg { width: 26px; height: 26px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 旧版布局兼容（M0 admin 类名，保持盒状纸面） ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); max-width: var(--container); margin: 0 auto; padding: 20px 36px 48px; gap: 20px; align-items: flex-start; }
.sidebar { flex: 0 0 220px; background: var(--paper); border: 1px solid var(--line); border-radius: 0; padding: 14px 12px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.brand { font-weight: 600; font-family: var(--font-display); font-size: 15px; padding: 4px 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.brand-sub { display: block; font-size: 10px; font-weight: 500; font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 8px 10px; border-radius: 2px; font-size: 13px; color: var(--ink-2); text-decoration: none !important; }
.nav a:hover { background: var(--wash); color: var(--ink); }
.nav a.active { background: var(--wash); color: var(--ink); font-weight: 600; }
.sidebar-footer { border-top: 1px solid var(--line); margin-top: 14px; padding: 12px 8px 2px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.content { flex: 1; min-width: 0; }

/* ---------- Tabs（admin 子导航，安静下划线风格） ---------- */
.tabs {
  display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 7px 10px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; text-decoration: none !important;
  transition: color .15s, border-color .15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---------- 角色绑定（双列卡片 + 迷你表格行） ---------- */
.role-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px 24px; align-items: start;
}
@media (max-width: 1100px) {
  .role-grid { grid-template-columns: repeat(2, 1fr); }
}
.bind-head, .bind-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 64px 36px;
  gap: 8px; align-items: center;
}
.bind-head {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 4px;
}
.bind-row { padding: 5px 0; }
.bind-row + .bind-row { border-top: 1px solid var(--line); }
.icon-btn { width: 36px; height: 36px; padding: 0; color: var(--muted); }
/* 修正：.btn.sm 特异性更高会压掉 .icon-btn 的 36px 高度，需三连选择器 */
.btn.sm.icon-btn { width: 36px; height: 36px; padding: 0; }
.icon-btn:hover { color: var(--err); background: var(--err-bg); border-color: var(--err-line); }

/* ---------- 注册模型表单（分组） ---------- */
.mf-template-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.mf-template-row > label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); flex: 0 0 auto;
}
.mf-section { padding: 14px 0 4px; }
.mf-section + .mf-section { border-top: 1px solid var(--line); margin-top: 12px; }
.mf-section-title {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 12px;
}

/* ---------- 工具类 ---------- */
.hidden, [hidden] { display: none !important; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-14 { margin-top: 14px; } .mt-18 { margin-top: 18px; }
.mb-8 { margin-bottom: 8px; } .mb-14 { margin-bottom: 14px; } .mb-18 { margin-bottom: 18px; }
.w-auto { width: auto; }
.right { margin-left: auto; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.loading-block { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 6px 0; }

/* ---------- Icons（内联 SVG sprite，stroke 风格） ---------- */
.icon {
  width: 16px; height: 16px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.btn .icon { width: 14px; height: 14px; }
.btn.sm .icon { width: 13px; height: 13px; }
/* 顶部导航以 mono 编号为装置，图标让位（页面标题/卡片/按钮仍保留 icon） */
.topnav > a .icon { display: none; }
.tabs a .icon { width: 14px; height: 14px; opacity: .8; }
.page-title { display: flex; align-items: center; gap: 8px; }
.page-title .icon { width: 18px; height: 18px; color: var(--ink); }
/* 标题直连图标：图标与文字左右排列（svg 全局 reset 为 block，非 flex 标题需转 flex） */
h1:has(> .icon), h2:has(> .icon), h3:has(> .icon) {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
/* 中文字形在行盒中天然偏上，按盒居中会显得文字偏高：图标上移 1px 光学校正 */
h1:has(> .icon) > .icon, h2:has(> .icon) > .icon, h3:has(> .icon) > .icon {
  transform: translateY(-1px);
}
.section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head .icon { width: 16px; height: 16px; color: var(--ink-3); }
.panel h3 { display: flex; align-items: center; gap: 8px; }
.panel h3 .icon { width: 15px; height: 15px; color: var(--ink-3); }
.dz-icon .icon { width: 18px; height: 18px; }
.modal-close .icon { width: 14px; height: 14px; }
.stat .stat-ic {
  width: 26px; height: 26px; border-radius: 0;
  background: var(--ink); border: none;
  color: var(--lime); display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}

/* ---------- 行对齐工具类 ----------
   .row-end：按钮与带 label 的输入框底部对齐（label 在上时按钮不再垂直悬空）
   .inline-check：行内 checkbox 保持 36px 控件高度，与输入框/按钮等高对齐 */
.row-end { align-items: flex-end; }
.row-end .field { margin-bottom: 0; }
.inline-check {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  margin: 0; cursor: pointer; white-space: nowrap;
}
.inline-flex { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .overlay-box { max-width: 100%; }
  .chip-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .overlay-box { max-width: 100%; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .topbar-inner { padding: 0 14px; gap: 8px; overflow-x: auto; }
  .logo-text { display: none; }
  .logo .topnav-tag { display: none; }
  /* 下拉面板改为顶栏下方通栏浮层：逃出 topbar-inner 横向滚动裁切 */
  .nav-panel, .user-panel { position: fixed; top: var(--topbar-h); left: 12px; right: 12px; width: auto; min-width: 0; }
  .user-panel { left: auto; width: min(240px, calc(100vw - 24px)); }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 56px; }
  .chip-grid { grid-template-columns: 1fr; }
  .adj-row2 { grid-template-columns: 1fr; }
  .detail-imgs { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .role-grid { grid-template-columns: 1fr; }
}

/* ---------- 自定义下拉（select 增强组件） ---------- */
.sel-wrap { position: relative; display: inline-flex; width: 100%; max-width: 100%; vertical-align: middle; }
.sel-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 36px; padding: 6px 11px;
  font-family: var(--font); font-size: 12.5px; font-weight: 500; color: var(--ink);
  text-align: left; background: var(--paper);
  border: 1px solid var(--line-strong); border-radius: 2px;
  cursor: pointer; outline: none;
  transition: border-color .15s, background .15s, color .15s;
}
.sel-btn:hover { border-color: var(--ink-3); }
.sel-btn:focus-visible, .sel-wrap.open .sel-btn { border-color: var(--ink); background: #fff; }
.sel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-caret { flex: 0 0 auto; color: var(--muted); transition: transform .15s; }
.sel-wrap.open .sel-caret { transform: rotate(180deg); }
.sel-menu {
  display: none; position: fixed; z-index: 1200;
  max-width: 360px; max-height: 280px; overflow-y: auto;
  padding: 4px; background: var(--paper); border: 1px solid var(--ink);
  border-radius: 2px; box-shadow: var(--shadow-lg);
}
.sel-wrap.open .sel-menu { display: block; animation: sel-in .13s ease; }
@keyframes sel-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sel-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 0;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; word-break: break-word;
}
.sel-opt:hover, .sel-opt.active { background: var(--wash); color: var(--ink); }
.sel-opt.selected { color: var(--ink); font-weight: 600; }
.sel-opt.selected::after { content: "✓"; margin-left: auto; font-size: 12px; }
.sel-opt.disabled { color: var(--muted); opacity: .55; cursor: not-allowed; }
.sel-opt.disabled:hover, .sel-opt.disabled.active { background: transparent; color: var(--muted); }
.sel-group {
  padding: 8px 10px 4px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.sel-wrap.disabled .sel-btn { background: var(--wash); color: var(--muted); cursor: not-allowed; }
/* 布局上下文：行内 / 工具栏 / 表格中的下拉保持自适应宽度 */
.row .sel-wrap, .gallery-toolbar .sel-wrap, td .sel-wrap { width: auto; }
.gallery-toolbar .sel-wrap { min-width: 160px; }
td .sel-btn { min-height: 30px; padding: 4px 9px; font-size: 12px; }

/* ---------- 表单输入细节打磨 ---------- */
input[type="text"]:not(:disabled):hover, input[type="password"]:not(:disabled):hover,
input[type="number"]:not(:disabled):hover, input[type="search"]:not(:disabled):hover,
input[type="url"]:not(:disabled):hover, input[type="email"]:not(:disabled):hover,
input:not([type]):not(:disabled):hover, textarea:not(:disabled):hover,
select:not(:disabled):hover { border-color: var(--ink-3); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }

/* ---------- 场景发散滑杆 ---------- */
.sf-label { display: flex; align-items: baseline; }
.sf-tier {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  font-weight: 500; letter-spacing: .06em; color: var(--ink-2);
}
.sf-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; padding: 0; margin: 0;
  background: transparent; border: none; cursor: pointer;
}
.sf-slider:focus { outline: none; }
.sf-slider:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.sf-slider::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
.sf-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -5px;
  background: var(--ink); border: none; border-radius: 0;
  transition: background .15s, box-shadow .15s;
}
.sf-slider:hover::-webkit-slider-thumb { background: var(--ink-hover); }
.sf-slider:active::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--lime-soft); }
.sf-slider::-moz-range-track { height: 2px; background: var(--line-strong); }
.sf-slider::-moz-range-thumb {
  width: 12px; height: 12px; background: var(--ink);
  border: none; border-radius: 0;
}
.sf-slider:hover::-moz-range-thumb { background: var(--ink-hover); }
.sf-scale {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-top: 2px;
}

/* ---------- 仪表盘统计（图表 + 数字） ---------- */
.stat-sub {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .04em; color: var(--muted); margin-top: 3px;
}
.dash-grid {
  display: grid; grid-template-columns: 1.45fr 1fr;
  gap: 20px 32px; align-items: start; margin-top: 20px;
}
.chart-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 0; padding: 14px 16px 12px; min-width: 0;
}
/* 通栏卡片：跨满 dash-grid 两列（如 COS 占用构成的比例条） */
.chart-card.wide { grid-column: 1 / -1; }
.chart-eyebrow {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 10px;
}
.chart-eyebrow .icon { width: 13px; height: 13px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid-line { stroke: var(--line); stroke-width: 1; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-date { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); }
.chart-val { font-family: var(--font-mono); font-size: 9.5px; fill: var(--ink-3); }
.chart-bar-ok { fill: var(--ink); }
.chart-bar-ok:hover { opacity: .82; }
.chart-bar-bad { fill: var(--err); opacity: .5; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.rank-row + .rank-row { border-top: 1px solid var(--line); }
.rank-name {
  flex: 0 0 36%; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-track { flex: 1; height: 10px; background: var(--wash); overflow: hidden; }
.rank-fill { height: 100%; background: var(--ink); }
.rank-val { flex: 0 0 auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.cos-bar { display: flex; height: 12px; background: var(--wash); overflow: hidden; }
.cos-seg { height: 100%; min-width: 2px; }
.cos-legend {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 7px 18px; margin-top: 12px;
}
.cos-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.cos-legend-item .n { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.cos-legend-item .bytes { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.cos-dot { width: 8px; height: 8px; flex: 0 0 auto; }
.chart-empty { padding: 30px 0; text-align: center; color: var(--muted); font-size: 12.5px; }
/* COS 构成分段色板：相邻段必换色相族、深浅交替（墨/亮青柠/青绿/琥珀/紫/锈红/森绿/淡青柠） */
.cos-seg.c0, .cos-dot.c0 { background: var(--ink); }
.cos-seg.c1, .cos-dot.c1 { background: var(--lime); }
.cos-seg.c2, .cos-dot.c2 { background: var(--teal); }
.cos-seg.c3, .cos-dot.c3 { background: var(--warn); }
.cos-seg.c4, .cos-dot.c4 { background: var(--violet); }
.cos-seg.c5, .cos-dot.c5 { background: var(--err); }
.cos-seg.c6, .cos-dot.c6 { background: var(--ok); }
.cos-seg.c7, .cos-dot.c7 { background: var(--lime-soft); }
@media (max-width: 1024px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- 仿视频（分镜 / 关键帧审批 / 成片） ---------- */
.refv-preview video, #video-player {
  width: 100%; max-height: 320px; background: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.shot-list { display: flex; flex-direction: column; }
.shot-item {
  border-top: 1px solid var(--line); padding: 10px 2px 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.shot-item:first-child { border-top: none; padding-top: 4px; }
.shot-item-top { display: flex; align-items: baseline; gap: 10px; }
.shot-no {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: .12em; color: var(--ink); background: var(--lime);
  padding: 2px 6px 1px;
}
.shot-time {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em;
  color: var(--ink-3);
}
.shot-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px;
  font-size: 12.5px; color: var(--ink-2); line-height: 1.55;
}
.shot-fields b {
  font-weight: 500; color: var(--ink-3); margin-right: 6px;
  font-size: 11px;
}
.analysis-summary { margin: 8px 0 10px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.kf-progress {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
  color: var(--ink-2);
}
.kf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.kf-card {
  background: var(--paper); border: 1px solid var(--line);
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 9px;
  min-width: 0;
}
.kf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kf-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kf-imgs figure { margin: 0; min-width: 0; }
.kf-imgs img {
  width: 100%; height: 130px; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--wash);
}
.kf-cap {
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  margin-top: 4px;
}
.kf-empty {
  width: 100%; height: 130px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  background: var(--wash); color: var(--muted); font-size: 12px;
}
.kf-empty.err { border-style: solid; border-color: var(--err-line); background: var(--err-bg); color: var(--err); }
.kf-actions { display: flex; gap: 8px; }
.kf-actions .btn { flex: 1; justify-content: center; }

/* ---------- 关键帧大图查看 / 任务进度条 / 转场选择 ---------- */
.kf-imgs figure.zoomable { cursor: zoom-in; }
.kf-imgs figure.zoomable:hover img { border-color: var(--ink-3); }

.lightbox-mask { z-index: 950; cursor: zoom-out; }
.lightbox {
  margin: 0; position: relative; max-width: min(1080px, 92vw);
  animation: modal-in .18s ease;
}
.lightbox img {
  display: block; max-width: 100%; max-height: 82vh;
  border: 1px solid var(--line-strong); background: var(--wash);
  box-shadow: var(--shadow-lg);
}
.lightbox figcaption {
  margin-top: 8px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em;
  color: var(--ink-2);
}
.lightbox.vlightbox video {
  display: block; max-width: 100%; max-height: 82vh;
  border: 1px solid var(--line-strong); background: #000;
  box-shadow: var(--shadow-lg);
}
.lightbox .lightbox-close { position: absolute; top: -12px; right: -12px; background: var(--paper); }

.job-progress { display: flex; align-items: center; gap: 10px; }
.job-progress-track {
  flex: 1; height: 4px; background: var(--wash); border: 1px solid var(--line);
  overflow: hidden;
}
.job-progress-track i {
  display: block; height: 100%; width: 0;
  background: var(--lime); transition: width .5s ease;
}
.job-progress.indeterminate .job-progress-track i {
  width: 100% !important;
  background: linear-gradient(90deg, var(--lime-faint) 0%, var(--lime) 50%, var(--lime-faint) 100%);
  background-size: 200% 100%;
  animation: progress-slide 1.4s linear infinite;
}
.job-progress-pct {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-2);
  min-width: 34px; text-align: right;
}
@keyframes progress-slide { from { background-position: 0 0; } to { background-position: 200% 0; } }

.tr-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.tr-field > span { white-space: nowrap; }
.direct-box summary {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); user-select: none;
  padding: 2px 0;
}
.direct-box summary .icon { width: 14px; height: 14px; }
.direct-box summary:hover { color: var(--ink); }
.direct-box[open] summary { margin-bottom: 10px; }
@media (max-width: 1280px) { .kf-grid { grid-template-columns: 1fr; } }

/* ---------- 大片库 ---------- */
.shot-actions {
  border-top: 1px solid var(--line);
  margin-top: 9px; padding-top: 9px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.shot-actions .btn { font-size: 12px; }
.up-file {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  background: var(--wash); padding: 12px 14px;
  font-size: 13px; color: var(--ink-2);
  transition: border-color .15s ease, background .15s ease;
}
.up-file:hover { border-color: var(--ink-3); background: var(--paper); }
.up-file .icon { width: 18px; height: 18px; color: var(--ink-3); flex: 0 0 auto; }
.up-preview {
  display: block; width: 100%; max-height: 220px; object-fit: contain;
  margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--wash);
}

/* ---------- 图库选择（参考图双 Tab / 产品图多选） ---------- */
.ref-alt {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 10px;
}
.ref-alt-sep {
  font-size: 10.5px; color: var(--ink-3); letter-spacing: .28em;
  text-transform: uppercase; user-select: none;
}
.picker-modal { width: min(860px, 94vw); }
.picker-tabs {
  display: flex; gap: 2px; padding: 0 18px;
  border-bottom: 1px solid var(--line-strong);
}
.picker-tabs[hidden] { display: none; }
.picker-tab {
  font-family: var(--font); font-size: 13px; font-weight: 500;
  color: var(--ink-2); background: transparent; border: none;
  padding: 10px 14px; cursor: pointer; position: relative;
  transition: color .15s;
}
.picker-tab:hover { color: var(--ink); }
.picker-tab.active { color: var(--ink); font-weight: 600; }
.picker-tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--ink);
}
.picker-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; padding: 12px 18px 0;
}
.picker-toolbar[hidden] { display: none; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-search {
  width: 220px; min-height: 30px; padding: 6px 10px; font-size: 12.5px;
}
.picker-body { overflow-y: auto; max-height: 62vh; padding: 14px 18px 18px; }
.picker-empty {
  padding: 48px 0; text-align: center; color: var(--ink-3); font-size: 13px;
}
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.pick-card {
  position: relative; background: var(--paper);
  border: 1px solid var(--line-strong); overflow: hidden; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.pick-card:hover { border-color: var(--ink); box-shadow: var(--shadow-md); }
.pick-card.checked { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.pick-card.disabled { opacity: .45; cursor: not-allowed; }
.pick-card.disabled:hover { border-color: var(--line-strong); box-shadow: none; }
.pick-thumb-wrap { display: block; position: relative; }
.pick-thumb {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
  background: var(--wash);
}
.pick-ratio {
  position: absolute; left: 6px; top: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  color: var(--ink); background: rgba(255, 255, 255, .88);
  border: 1px solid var(--line-strong); padding: 2px 6px;
}
.pick-off {
  position: absolute; right: 6px; top: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em;
  color: var(--warn); background: rgba(255, 255, 255, .88);
  border: 1px solid var(--warn-line); padding: 2px 6px;
}
.pick-check {
  position: absolute; right: 6px; top: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--lime);
  display: none; align-items: center; justify-content: center;
}
.pick-check .icon { width: 13px; height: 13px; }
.pick-card.checked .pick-check { display: inline-flex; }
.pick-meta { padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 3px; }
.pick-title {
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pick-sub { font-size: 11.5px; color: var(--ink-3); }
.picker-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line-strong); padding: 12px 18px;
}
.picker-foot[hidden] { display: none; }
.picker-count { font-size: 12.5px; color: var(--ink-2); }

/* 仿图：多主体槽位接管传统字段时，内容设定顶部的引导提示 */
.slots-notice {
  grid-column: span 2;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 12.5px; line-height: 1.45;
  color: var(--warn); background: var(--warn-bg); border: 1px dashed var(--warn-line);
}
.slots-notice .icon { width: 14px; height: 14px; flex: none; }
.slots-notice span { flex: 1; }
.card.flash { animation: card-flash 1.4s ease; }
@keyframes card-flash {
  0%, 55% { box-shadow: 0 0 0 2px var(--warn-line); }
  100% { box-shadow: none; }
}

/* ---------- 多主体槽位（仿图大师：逐主体绑定产品图/人物描述） ---------- */
#slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot-tip {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  color: var(--ink-2); background: var(--lime-faint);
  border: 1px solid var(--lime-border); border-radius: 2px;
  padding: 7px 10px; margin-bottom: 10px; line-height: 1.6;
}
.slot-card {
  border: 1px solid var(--line-strong); border-radius: 2px;
  background: var(--paper); padding: 10px 12px;
}
.slot-card.person { background: transparent; }
.slot-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.slot-no {
  flex: none; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--lime);
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  border-radius: 1px;
}
.slot-label {
  min-width: 0; font-size: 12px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot-body { display: flex; flex-direction: column; gap: 6px; }
.slot-bind { display: flex; align-items: center; gap: 8px; min-width: 0; }
.slot-bind.empty { flex-wrap: wrap; }
.slot-bind-hint { flex: 1 1 100%; font-size: 10.5px; color: var(--muted); }
.slot-thumb {
  flex: none; width: 44px; height: 44px; object-fit: cover; display: block;
  border-radius: 2px; border: 1px solid var(--line-strong); background: var(--wash);
}
.slot-bind-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
.slot-bind-name {
  font-size: 11.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot-bind-size { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot-bind-ops { display: flex; gap: 6px; flex: none; }
.slot-desc { width: 100%; font-size: 12px; min-height: 52px; }
.slot-name { width: 100%; font-size: 12px; }
.slot-legacy-hint { margin-top: 10px; }

/* 参考图上的主体框（叠加在 bbox 编辑层之上，仅展示不可交互） */
#subject-boxes { position: absolute; inset: 0; pointer-events: none; }
.subject-box {
  position: absolute;
  border: 1.5px dashed rgba(10, 14, 11, .55); border-radius: 0;
}
.subject-box.bound { border-style: solid; border-color: var(--ok); }
.subject-no {
  position: absolute; left: 0; top: 0;
  padding: 0 5px; line-height: 1.6;
  font-family: var(--font-mono); font-size: 9px; font-weight: 600;
  color: var(--lime); background: var(--ink);
}
.subject-box.bound .subject-no { color: var(--canvas); background: var(--ok); }

/* 人物槽位：动作输入 + 预设 chips + 保持/替换开关 */
.slot-action {
  width: 100%; font-size: 12px; margin-top: 8px;
  min-height: 72px; line-height: 1.6; resize: vertical;
}
.action-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.action-preset {
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  font-family: var(--font); font-size: 11px; color: var(--ink-2);
  padding: 3px 8px; border-radius: 2px; transition: border-color .15s, color .15s;
}
.action-preset:hover { border-color: var(--ink); color: var(--ink); }
.keep-seg { margin-top: 8px; }
.keep-seg button { font-size: 11.5px; padding: 4px 10px; }

/* 解析面板：主体明细行（描述 + 动作 + 重框/精析/删除） */
.subject-row {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); padding: 6px 10px; margin-top: 6px;
  font-size: 12px;
}
.subject-row-no { font-family: var(--font-mono); font-size: 10px; color: var(--muted); flex: none; }
.subject-row-label {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2);
}
.subject-row-action {
  flex: 1 1 30%; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11.5px;
}
.subject-row-ops { display: flex; gap: 4px; flex: none; }

/* 框选主体模式：光标变十字，禁用既有拖拽层，虚线矩形跟随拖拽 */
.overlay-box.draw-mode { cursor: crosshair; }
.overlay-box.draw-mode .bbox-rect,
.overlay-box.draw-mode .subject-box { pointer-events: none; }
#draw-rect {
  position: absolute; border: 1.5px dashed var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  pointer-events: none;
}

/* ---------- Prompt 管理（片段 / 模板 / 模块） ---------- */
.prompt-layout {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px; align-items: start; margin-top: 14px;
}
@media (max-width: 900px) { .prompt-layout { grid-template-columns: 1fr; } }
.prompt-list {
  border: 1px solid var(--line); background: var(--paper);
  max-height: 620px; overflow: auto;
}
.prompt-item {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
  border-left: 2px solid transparent;
}
.prompt-item:last-child { border-bottom: none; }
.prompt-item:hover { background: var(--wash); }
.prompt-item.active { background: var(--lime-faint); border-left-color: var(--ink); }
.prompt-item-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pt-key {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  color: var(--ink); word-break: break-all;
}
.pt-key.lg { font-size: 13px; }
.pt-desc {
  margin-top: 3px; font-size: 11.5px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pt-ph { margin-top: 4px; font-size: 11px; color: var(--warn); }
.pt-ph code { font-family: var(--font-mono); background: var(--wash); padding: 0 4px; }
.prompt-editor {
  border: 1px solid var(--line); background: var(--paper);
  padding: 14px 16px 16px; min-height: 320px;
}
.pt-empty { color: var(--muted); font-size: 12.5px; padding: 40px 0; text-align: center; }
.pt-editor-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prompt-editor .code-editor { width: 100%; min-height: 300px; margin-top: 4px; }
.pt-note-row input { width: 100%; margin-top: 10px; }

/* ===================== Studio 全屏工作台（app-shell 内的画布页） ===================== */
.page-studio { max-width: none; margin: 0; padding: 0; height: 100vh; overflow: hidden; }

.studio-app {
  height: 100%;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 30px;
  background: var(--canvas);
}
/* hidden 属性优先于面板内任何 display 规则（tb-menu/filmstrip/stage 层都用 flex） */
.studio-app [hidden] { display: none !important; }

/* ---- 工作区顶栏 ---- */
.app-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--line-strong);
  position: relative; z-index: 40;
}
.tb-title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-display); font-size: 15px; font-weight: 600;
}
.tb-title .icon { width: 16px; height: 16px; color: var(--ink-3); }
.tb-spacer { flex: 1; }

/* 工作台顶栏：模型集中选择（仿图/仿视频/图生视频共用） */
.tb-models { display: flex; align-items: center; gap: 6px; flex: none; }
.tb-models .tb-tag { font-size: 11.5px; color: var(--ink-3); }
.tb-models select { width: 200px; }
.tb-models .tb-cap { flex: 0 1 auto; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1280px) {
  .tb-models .tb-tag, .tb-models .tb-cap { display: none; }
  .tb-models select { width: 170px; }
}
@media (max-width: 1000px) {
  .tb-models select { width: 140px; }
}

/* ---- 三栏骨架 ---- */
.app-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 330px;
  min-height: 0;
}
.panel-left {
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0; min-width: 0;
}
.panel-right {
  border-left: 1px solid var(--line);
  overflow-y: auto; min-height: 0; min-width: 0;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.left-tabs { display: flex; border-bottom: 1px solid var(--line-strong); background: var(--paper); }
.left-tab {
  flex: 1; padding: 10px 8px;
  border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-3);
}
.left-tab:hover { color: var(--ink); }
.left-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.left-panes { flex: 1; overflow-y: auto; min-height: 0; padding: 12px; }
.left-tabpane { display: none; }
.left-tabpane.active { display: flex; flex-direction: column; gap: 10px; }
.panel-right .form-grid { grid-template-columns: 1fr; }

/* ---- 中央画布 ---- */
.app-canvas {
  min-width: 0; min-height: 0; position: relative;
  display: flex; flex-direction: column;
  background: var(--wash);
}
.canvas-stage {
  flex: 1; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 18px; overflow: hidden;
}
.stage-empty {
  position: absolute; inset: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; color: var(--ink-3);
  border: 1.5px dashed var(--line-strong);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.stage-empty:hover, .stage-empty.dragover { border-color: var(--ink); background: var(--paper); }
.stage-empty .dz-icon .icon { width: 34px; height: 34px; }
.stage-empty b { color: var(--ink); font-size: 15px; }

.stage-media {
  max-width: 100%; max-height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.canvas-stage .overlay-box {
  width: fit-content; max-width: 100%; max-height: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.10);
}
.canvas-stage .overlay-box img {
  width: auto; height: auto; display: block;
  max-width: 100%; max-height: calc(100vh - 250px);
}

.stage-result {
  position: absolute; inset: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 0;
}
.cmp-wrap { position: relative; display: flex; max-width: 100%; }
.cmp-under {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: var(--paper);
}
.stage-result .result-img {
  width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - 280px);
  box-shadow: 0 10px 40px rgba(0,0,0,.10);
}
.cmp-divider {
  display: none; position: absolute; top: 0; bottom: 0;
  left: var(--cmp-x, 50%); width: 2px;
  background: var(--lime); pointer-events: none; z-index: 3;
}
.cmp-tag {
  display: none; position: absolute; top: 8px; z-index: 3;
  font-size: 11px; padding: 2px 8px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 2px;
}
.cmp-tag.l { left: 8px; } .cmp-tag.r { right: 8px; }
.cmp-range { display: none; width: min(420px, 80%); accent-color: var(--ink); }
.stage-result.cmp-on .cmp-divider,
.stage-result.cmp-on .cmp-tag,
.stage-result.cmp-on .cmp-range { display: block; }
.stage-result.cmp-on .result-img { clip-path: inset(0 0 0 var(--cmp-x, 50%)); }

.stage-loading {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--paper); border: 1px solid var(--line-strong);
  padding: 14px 22px; z-index: 30;
  box-shadow: 0 12px 32px rgba(0,0,0,.14);
}
.stage-fab {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 25; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.canvas-stage .gen-status { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 35; max-width: 80%; }
.canvas-stage .gen-status:not(:empty) {
  background: var(--paper); border: 1px solid var(--line-strong);
  padding: 8px 16px; box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.canvas-stage.busy .stage-media,
.canvas-stage.busy .stage-result { opacity: .55; filter: saturate(.75); }

.canvas-foot {
  border-top: 1px solid var(--line); background: var(--paper);
  padding: 8px 12px; display: flex; flex-direction: column; gap: 8px;
}
.stage-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stage-toolbar .btn.active { border-color: var(--ink); background: var(--lime-faint); }
.filmstrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.fs-thumb {
  width: 64px; height: 64px; object-fit: cover; flex: 0 0 auto;
  border: 1px solid var(--line-strong); cursor: pointer; opacity: .75;
}
.fs-thumb:hover { opacity: 1; }
.fs-thumb.active { outline: 2px solid var(--lime); outline-offset: 1px; opacity: 1; }

/* ---- 状态栏 ---- */
.app-statusbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 14px; min-width: 0; overflow: hidden;
  border-top: 1px solid var(--line-strong); background: var(--paper);
  font-size: 12px; color: var(--ink-3);
}
.app-statusbar .ready-hint { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-spacer { flex: 1; }
.sb-item { white-space: nowrap; }

/* ---- 窄屏回退：退化为纵向堆叠 ---- */
@media (max-width: 1024px) {
  .page-studio { height: auto; overflow: visible; }
  .studio-app { height: auto; display: block; }
  .app-body { display: block; }
  .panel-left { border-right: none; }
  .left-panes { overflow: visible; }
  .panel-right { border-left: none; border-top: 1px solid var(--line); overflow: visible; }
  .canvas-stage .overlay-box img { max-height: 70vh; }
  .stage-result .result-img { max-height: 70vh; }
  .app-statusbar { display: none; }
  .stage-empty { position: static; margin: 0; padding: 40px 0; }
  .stage-result { position: static; }
}

/* ===================== P3：仿视频 / 图生视频工作台化 ===================== */
/* 画布上下分栏：上=媒体舞台，下=流水线面板（分镜/关键帧/导演脚本） */
.pipeline-pane {
  flex: 0 1 auto; max-height: 62%; min-height: 0; overflow-y: auto;
  border-top: 1px solid var(--line-strong);
  padding: 14px 18px 24px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--wash);
}
.pipeline-pane > .card { width: 100%; max-width: 980px; margin: 0 auto; }

/* 视频上传大拖放区（dz-video / img-empty 复用 stage-empty） */
.dropzone.stage-empty { padding: 24px; }
.dropzone.stage-empty .upl-progress { width: min(360px, 80%); }

/* 参考视频 / 底图：画布中的大图预览 */
.canvas-stage #video-preview,
.canvas-stage #img-preview {
  position: absolute; inset: 18px; align-items: center; gap: 12px;
}
.canvas-stage #video-preview video,
.canvas-stage #img-preview img {
  width: auto; max-width: 100%;
  max-height: calc(100% - 104px);
  box-shadow: 0 10px 40px rgba(0,0,0,.12);
}
.canvas-stage #video-preview video { background: #000; }

/* 成片预览（i2v card-output 的舞台态） */
.canvas-stage #card-output { background: transparent; border: none; padding: 0; }
.canvas-stage #card-output video {
  width: auto; max-width: 100%;
  max-height: calc(100% - 140px);
  background: #000; box-shadow: 0 10px 40px rgba(0,0,0,.12);
}

/* 窄屏回退：舞台子元素恢复文档流 */
@media (max-width: 1024px) {
  .canvas-stage #video-preview,
  .canvas-stage #img-preview { position: static; }
  .canvas-stage #video-preview video,
  .canvas-stage #img-preview img,
  .canvas-stage #card-output video { max-height: 70vh; }
}

/* ===================== 全局 App Shell（左 Rail + 全屏工作台） ===================== */
.app-shell { height: 100vh; }

/* 左侧图标 Rail：56px 常驻，hover/focus 展开至 208px（悬浮于内容之上，不推挤主区） */
.rail {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 300;
  width: 56px;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width .18s ease, box-shadow .18s ease;
}
.rail:hover, .rail:focus-within { width: 208px; box-shadow: 12px 0 36px rgba(0, 0, 0, .10); }
.rail-logo {
  flex: 0 0 56px; display: flex; align-items: center; gap: 10px;
  padding: 0 10px 0 15px;
  color: var(--ink); text-decoration: none !important;
  border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden;
}
.rail-logo .logo-mark { flex: 0 0 auto; }
.rail-brand { font-family: var(--font-display); font-weight: 600; font-size: 14px; line-height: 1.15; }
.rail-brand i { display: block; font-style: normal; font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: .16em; color: var(--muted); }
.rail-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px; }
.rail-group {
  padding: 16px 10px 5px; font-size: 10px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; opacity: 0; transition: opacity .15s ease;
}
.rail-group:first-child { padding-top: 6px; }
.rail-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; margin-bottom: 2px; padding: 0 10px;
  /* 收起态（rail 56px）：8(nav) + 10 + 9.5 = 图标中心 27.5 ≈ 中线 28，居中 */
  border-radius: 4px; font-size: 13px; color: var(--ink-2); text-decoration: none !important;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.rail-item .icon { width: 19px; height: 19px; flex: 0 0 19px; color: var(--ink-3); transition: color .12s ease; }
.rail-item:hover { background: var(--wash); color: var(--ink); }
.rail-item:hover .icon { color: var(--ink); }
.rail-item.active { background: var(--ink); color: var(--canvas); }
.rail-item.active .icon { color: var(--canvas); }
.rail-label { opacity: 0; transition: opacity .15s ease; overflow: hidden; text-overflow: ellipsis; }
.rail:hover .rail-label, .rail:focus-within .rail-label { opacity: 1; }
.rail-foot { flex: 0 0 auto; padding: 8px; border-top: 1px solid var(--line); }
.rail-foot .user-drop { display: flex; width: 100%; }
.rail-foot .user-drop-btn { width: 100%; justify-content: flex-start; padding-left: 7px; gap: 10px; }
.up-name-mini { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
/* 用户面板固定于左下角向上展开（rail overflow:hidden 会裁剪 absolute 子元素，用 fixed 逃出） */
.rail-foot .user-panel { position: fixed; top: auto; right: auto; left: 10px; bottom: 58px; width: 216px; }

/* 主内容区：rail 右侧的独立滚动容器 */
.app-main {
  margin-left: 56px;
  height: 100vh;
  overflow-y: auto;
}
.app-shell [hidden] { display: none !important; }

/* ===================== 画廊（Apple Photos 式媒体墙） ===================== */
.page-gallery { padding: 0 0 56px; }
.page-gallery .empty-state { margin: 56px 20px 0; }
.gbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 20px;
  background: rgba(244, 243, 238, .92);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.gbar-title { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; margin-right: 4px; }
.gb-chips { display: flex; gap: 6px; }
.gb-chip {
  height: 27px; padding: 0 12px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--paper);
  font-family: var(--font); font-size: 12.5px; color: var(--ink-2);
  transition: border-color .12s, color .12s, background .12s;
}
.gb-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.gb-chip.on { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.gb-spacer { flex: 1; }
.gb-density { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.gb-density .icon { width: 15px; height: 15px; }
.gb-density input[type="range"] { width: 110px; accent-color: var(--ink); }

.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--g-min, 220px), 1fr));
  gap: 4px; padding: 4px 20px 0;
}
.gm-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--wash); aspect-ratio: 1;
}
.gm-card img, .gm-card video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s ease;
}
.gm-card:hover img { transform: scale(1.025); }
.gm-fail {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 12px; padding: 10px; text-align: center;
}
/* hover 快速操作：右上收藏（收藏后常驻可见） */
.gm-acts { position: absolute; top: 7px; right: 7px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s ease; }
.gm-card:hover .gm-acts, .gm-card.is-fav .gm-acts { opacity: 1; }
.gm-btn {
  width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: #333; font-size: 13px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
  transition: transform .12s ease;
}
.gm-btn:hover { transform: scale(1.08); }
.gm-btn.on { color: #e0245e; }
/* hover 评分：左上五星 */
.gm-stars { position: absolute; top: 9px; left: 9px; display: flex; gap: 1px; opacity: 0; transition: opacity .15s ease; }
.gm-card:hover .gm-stars { opacity: 1; }
.gm-stars button {
  border: none; background: none; cursor: pointer; padding: 0 1px;
  font-size: 15px; line-height: 1; color: rgba(255, 255, 255, .55);
  text-shadow: 0 1px 5px rgba(0, 0, 0, .65);
}
.gm-stars button.on { color: #f5b301; }
/* 底部信息条：hover 浮现；视频卡片常驻 */
.gm-scrim {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: 26px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .58));
  color: #fff; font-size: 11.5px;
  opacity: 0; transition: opacity .15s ease; pointer-events: none;
}
.gm-card:hover .gm-scrim, .gm-card[data-kind="video"] .gm-scrim { opacity: 1; }
.gm-meta-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-badge { flex: 0 0 auto; font-size: 10.5px; padding: 1px 7px; border-radius: 9px; background: rgba(255, 255, 255, .22); }
.gm-btn .icon { width: 14px; height: 14px; }

/* 资料库：Tab 专属控件簇 + 产品图上传进度条 */
.page-library { padding: 0 0 56px; }
.page-library .empty-state { margin: 56px 20px 0; }
.gb-cluster { display: flex; align-items: center; gap: 10px; }
.lb-progress { max-width: 420px; margin: 10px 20px 0; }

/* 无限滚动哨兵与结尾提示 */
.g-sentinel { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 16px 0; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--ink);
  animation: gspin .8s linear infinite;
}
@keyframes gspin { to { transform: rotate(360deg); } }
.g-end { text-align: center; font-size: 11.5px; color: var(--muted); padding: 20px 0 4px; }

/* ---------- 画廊 Lightbox：黑底大图 + 右侧信息面板 + ←→ 翻页 ---------- */
.glb-mask { z-index: 600; background: #0b0b0b; padding: 0; }
.glb { margin: 0; width: 100%; height: 100%; display: flex; }
.glb-stage {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 44px 52px;
}
.glb-media { flex: 1; height: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; }
.glb-media img, .glb-media video {
  max-width: 100%; max-height: 100%; object-fit: contain;
  box-shadow: 0 10px 60px rgba(0, 0, 0, .55);
}
.glb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .09); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.glb-nav .icon { width: 19px; height: 19px; }
.glb-nav:hover { background: rgba(255, 255, 255, .22); }
.glb-nav[disabled] { opacity: .22; cursor: default; }
.glb-prev { left: 14px; }
.glb-next { right: 14px; }
.glb-next .icon { transform: scaleX(-1); }
.glb-close {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .09); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.glb-close .icon { width: 16px; height: 16px; }
.glb-close:hover { background: rgba(255, 255, 255, .22); }
.glb-side {
  flex: 0 0 330px; overflow-y: auto;
  padding: 20px 18px 30px;
  background: #151515; color: #e9e7e2;
  border-left: 1px solid #272727;
}
.glb-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: #fff; }
.glb-sub { font-size: 11.5px; color: #8f8c85; margin: 3px 0 10px; }
.glb-side h4 { margin: 20px 0 8px; font-size: 12.5px; letter-spacing: .05em; color: #b9b6ae; }
.glb-side .kv-table td { border-color: #2a2a2a; }
.glb-side .kv-table td:first-child { color: #96938b; }
.glb-side .prompt-block { background: #1e1e1e; color: #cfcdc7; border-color: #2a2a2a; }
.glb-side .issue.err { background: #2a1616; border-color: #552a2a; color: #e8b9b9; }
@media (max-width: 900px) {
  .glb { flex-direction: column; }
  .glb-side { flex: 0 0 auto; max-height: 46vh; border-left: none; border-top: 1px solid #272727; }
  .glb-stage { padding: 40px 14px; }
}

/* ---------- 全局右侧抽屉（P5：providers/models 详情与表单） ---------- */
.drawer-mask {
  position: fixed; inset: 0; z-index: 880;
  background: rgba(10, 14, 11, .38);
  display: flex; justify-content: flex-end;
  opacity: 0; transition: opacity .22s ease;
}
.drawer-mask.open { opacity: 1; }
.drawer {
  width: min(560px, 100%); height: 100%;
  display: flex; flex-direction: column;
  background: var(--paper);
  border-left: 1px solid var(--line-strong);
  box-shadow: -18px 0 48px rgba(0, 0, 0, .16);
  transform: translateX(100%);
  transition: transform .22s ease;
}
/* 打开态用 none 而非 translateX(0)：transform 残留会创建包含块，
   select.js 增强下拉的 .sel-menu 是 position:fixed（按视口坐标定位），
   在 transform 祖先内会改相对抽屉定位，整体偏移到屏幕外 */
.drawer-mask.open .drawer { transform: none; }
.drawer-lg { width: min(760px, 94vw); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--line-strong);
  background: var(--canvas);
}
.drawer-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; min-width: 0; }
.drawer-head .icon { width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 auto; }
.drawer-close {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 30px; height: 30px; padding: 0;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  cursor: pointer;
}
.drawer-close:hover { border-color: var(--ink); color: var(--ink); }
.drawer-close .icon { width: 14px; height: 14px; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 28px; }
.drawer-body .panel { margin-bottom: 14px; }
/* 抽屉内的表单盒：去外框，与抽屉融为一体 */
.drawer-body .form-box { border: none; background: transparent; margin-bottom: 0; }
.drawer-body .form-box .inner { padding: 0; border-top: none; }
@media (max-width: 760px) {
  .drawer, .drawer-lg { width: 100vw; border-left: none; }
}

/* ===== 图生视频（i2v）：左栏三 Tab + 画布 + 右侧参数栏 ===== */
.page-i2v .app-body { grid-template-columns: 400px minmax(0, 1fr) 330px; }

/* 右栏：生成设置（两列紧凑排布） + 生成按钮吸底 */
.page-i2v .panel-right .form-grid { grid-template-columns: 1fr 1fr; }
.page-i2v .panel-right .seg-toggle { display: flex; }
.page-i2v .panel-right .seg-toggle button { flex: 1; }
.page-i2v .gen-card { margin-top: auto; }
.page-i2v .gen-card .btn { width: 100%; }
.page-i2v .gen-card .ready-hint { display: block; }

/* 段落开关（保真/创意 + 运镜幅度） */
.seg-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; flex: none; }
.seg-toggle button { border: none; background: transparent; padding: 5px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-3); }
.seg-toggle button + button { border-left: 1px solid var(--line-strong); }
.seg-toggle button.on { background: var(--ink); color: var(--paper); }

/* 画布悬浮工具条 + 提示词抽屉 + 段 chips（仅 i2v：.stage-toolbar 与 studio 页画布底栏同名，必须限定作用域） */
.page-i2v .stage-toolbar { position: absolute; top: 14px; right: 14px; z-index: 30; display: flex; gap: 6px; }
.page-i2v .prompt-drawer {
  position: absolute; top: 52px; right: 14px; z-index: 29;
  width: min(560px, 62%); max-height: 72%; overflow: auto;
}
.page-i2v .tl-chips {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 90%;
}
.tl-chip {
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px;
  font-size: 12.5px; cursor: pointer; background: var(--paper); color: var(--ink-2);
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.tl-chip:hover { color: var(--ink); }

/* 运镜选择器：按组分行（每组独立一行） + 幅度 + 自定义 */
.cam-picker { display: flex; flex-direction: column; gap: 8px; }
.cam-chips { display: flex; flex-direction: column; gap: 7px; }
.cam-row { display: flex; align-items: center; gap: 8px; }
.cam-row-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cam-group { flex: none; min-width: 2.5em; font-size: 11px; color: var(--ink-3); }
.cam-chip {
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; cursor: pointer; background: var(--paper); color: var(--ink-2); line-height: 1.4;
}
.cam-chip:hover { color: var(--ink); }
.cam-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cam-chip .amp-warn { color: var(--warn, #c08a2d); font-weight: 700; }
.cam-chip.on .amp-warn { color: inherit; }
.cam-extra { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cam-extra .cam-custom { flex: 1; min-width: 160px; }

/* 主体参考图缩略图 */
.refs-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.refs-thumb {
  position: relative; width: 64px; height: 64px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--line-strong);
}
.refs-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.refs-thumb .x {
  position: absolute; top: 0; right: 0; width: 18px; height: 18px;
  border: none; border-radius: 0 0 0 6px; background: rgba(0,0,0,.55);
  color: #fff; font-size: 13px; line-height: 17px; cursor: pointer; padding: 0;
}

/* 产品库弹窗底栏 */
.prod-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--line-strong);
}

@media (max-width: 1024px) {
  .page-i2v .app-body { grid-template-columns: 1fr; }
}
