/* ==========================================================================
   DramaFlow · AI 短剧智能生产平台 — Demo 样式表
   设计原则（对应 PRD 7.1.1）：
   · 入口要浅       · 环节独立成模块   · 配置用表单
   · 结果可读       · 抽屉固定 640px   · 列表页直连操作
   · 菜单左对齐     · 一级菜单标题低对比
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f1f3f6;
  --border: #e6e8ec;
  --border-strong: #d3d7de;
  --text: #1b1e25;
  --text-2: #5a6272;
  --text-3: #8d94a3;
  --text-4: #aeb4c0;

  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-weak: #eef0ff;
  --brand-line: #c9cdfb;

  --ok: #0f9d58;
  --ok-weak: #e7f6ee;
  --warn: #c2740a;
  --warn-weak: #fdf4e5;
  --err: #d92d20;
  --err-weak: #fdeceb;
  --info: #0d74bc;
  --info-weak: #e9f4fc;
  --violet: #7c3aed;
  --violet-weak: #f4edfe;
  --pink: #c2185b;
  --pink-weak: #fdeaf2;

  --side-bg: #14161c;
  --side-bg-2: #1a1d24;
  --side-text: #c6cbd6;
  --side-text-dim: rgba(255, 255, 255, 0.32); /* 一级菜单标题：低对比 */
  --side-hover: #21252e;
  --side-active: #2a2f3a;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(16, 20, 30, 0.06);
  --shadow-2: 0 4px 14px rgba(16, 20, 30, 0.08);
  --shadow-3: 0 20px 60px rgba(16, 20, 30, 0.22);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  --sidebar-w: 238px;
  --drawer-w: 640px; /* 抽屉固定宽度，见用户偏好 */
  --topbar-h: 58px;
}

/* ---------- 2. 基础重置 ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
table { border-collapse: collapse; width: 100%; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cdd2da; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b4bac5; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. 应用骨架 ---------- */
.app { display: flex; min-height: 100vh; min-width: 1180px; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar-thumb { background: #333a47; background-clip: content-box; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.brand__logo {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 28px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}
.brand__name { font-size: 14px; font-weight: 600; color: #fff; letter-spacing: .2px; }
.brand__sub { font-size: 10px; color: var(--side-text-dim); margin-top: -2px; }

.nav { padding: 8px 0 20px; flex: 1; }
.nav__group { margin-top: 12px; }
.nav__title {
  /* 一级菜单标题：颜色接近背景色，低对比，左对齐 */
  padding: 6px 16px 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .6px;
  color: var(--side-text-dim);
  text-align: left;
}
.nav__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--side-text);
  text-align: left;
  justify-content: flex-start;
}
.nav__item svg { flex: 0 0 15px; opacity: .75; }
.nav__item:hover { background: var(--side-hover); color: #fff; }
.nav__item.is-active { background: var(--side-active); color: #fff; font-weight: 500; }
.nav__item.is-active svg { opacity: 1; }
.nav__badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: #dfe3ea;
}
.nav__badge--alert { background: rgba(217, 45, 32, 0.75); color: #fff; }

.sidebar__foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11px;
  color: var(--side-text-dim);
}

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__title { font-size: 14px; font-weight: 600; }
.topbar__crumbs { font-size: 12px; color: var(--text-3); }
.topbar__crumbs a:hover { color: var(--brand); }
.topbar__scope {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar__user { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.topbar__user-name { font-size: 12px; line-height: 1.2; }
.topbar__user-role { font-size: 10px; color: var(--text-3); line-height: 1.2; }

.page { padding: 18px 20px 48px; }
.page__head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.page__title { font-size: 18px; font-weight: 650; letter-spacing: -.2px; }
.page__desc { font-size: 12px; color: var(--text-2); margin-top: 3px; max-width: 780px; }
.page__head-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------- 4. 工具类 ---------- */
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.faint { color: var(--text-4); }
.mono { font-family: var(--mono); font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.fs-11 { font-size: 11px; } .fs-12 { font-size: 12px; } .fs-14 { font-size: 14px; }
.fs-16 { font-size: 16px; } .fs-20 { font-size: 20px; } .fs-24 { font-size: 24px; } .fs-28 { font-size: 28px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.hide { display: none !important; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.layout-2r { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }

/* ---------- 5. 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px; font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--text-4); }
.btn svg { flex: 0 0 14px; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn--danger { color: var(--err); border-color: #f1c4c0; background: #fff; }
.btn--danger:hover { background: var(--err-weak); border-color: #e9a9a4; }
.btn--sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn--sm svg { flex: 0 0 12px; }
.btn--lg { height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn--block { width: 100%; }
.btn--icon { width: 30px; height: 30px; padding: 0; border-color: transparent; background: transparent; color: var(--text-2); }
.btn--icon:hover { background: var(--surface-3); color: var(--text); border-color: transparent; }
.btn--icon.is-on { background: var(--brand-weak); color: var(--brand); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.is-on { background: var(--brand-weak); border-color: var(--brand-line); color: var(--brand); position: relative; z-index: 1; }

/* 图标按钮组：列表页直连操作 */
.acts { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }

/* ---------- 6. 徽标 / 标签 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 4px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge--ok { background: var(--ok-weak); color: var(--ok); }
.badge--warn { background: var(--warn-weak); color: var(--warn); }
.badge--err { background: var(--err-weak); color: var(--err); }
.badge--info { background: var(--info-weak); color: var(--info); }
.badge--brand { background: var(--brand-weak); color: var(--brand); }
.badge--violet { background: var(--violet-weak); color: var(--violet); }
.badge--pink { background: var(--pink-weak); color: var(--pink); }
.badge--muted { background: var(--surface-3); color: var(--text-2); }
.badge--p0 { background: #fdeceb; color: #b42318; }
.badge--p1 { background: #fdf4e5; color: #b54708; }
.badge--p2 { background: #eef0f3; color: #4b5563; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  background: var(--surface-3); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-2);
}
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 20px; font-size: 11px; background: var(--brand-weak); color: var(--brand); }

/* ---------- 7. 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card__head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 13.5px; font-weight: 600; }
.card__desc { font-size: 11.5px; color: var(--text-3); }
.card__body { padding: 14px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card--flat { box-shadow: none; }
.card--accent { border-color: var(--brand-line); }
.section-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--brand); }

/* 统计块 */
.stat { padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stat__label { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.stat__value { font-size: 22px; font-weight: 650; letter-spacing: -.5px; margin-top: 5px; line-height: 1.2; }
.stat__unit { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat__delta { font-size: 11px; margin-top: 3px; }
.stat__delta--up { color: var(--ok); }
.stat__delta--down { color: var(--err); }
.stat__delta--flat { color: var(--text-3); }

/* ---------- 8. 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.table { font-size: 12.5px; }
.table th {
  text-align: left; font-weight: 500; color: var(--text-2);
  background: var(--surface-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table--compact th { padding: 7px 10px; font-size: 11.5px; }
.table--compact td { padding: 7px 10px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-main { font-weight: 500; }
.table .cell-sub { font-size: 11px; color: var(--text-3); }
.table .w-acts { width: 1%; white-space: nowrap; }
.table--fixed { table-layout: fixed; }

/* ---------- 9. 进度 / 评分 ---------- */
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress__bar { height: 100%; border-radius: 6px; background: var(--brand); transition: width .5s ease; }
.progress--ok .progress__bar { background: var(--ok); }
.progress--warn .progress__bar { background: var(--warn); }
.progress--err .progress__bar { background: var(--err); }
.progress--violet .progress__bar { background: var(--violet); }
.progress--lg { height: 9px; }
.progress__meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 5px; }

.score { display: flex; align-items: center; gap: 12px; }
.score__num { font-size: 22px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.score__num--ok { color: var(--ok); }
.score__num--warn { color: var(--warn); }
.score__num--err { color: var(--err); }
.score__label { font-size: 11px; color: var(--text-3); }
.score-item { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.score-item__name { width: 108px; flex: 0 0 108px; font-size: 12px; color: var(--text-2); }
.score-item__val { width: 34px; flex: 0 0 34px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- 10. 步骤条 ---------- */
.steps { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 7px; padding-right: 12px; }
.step__dot {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 20px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--text-3); font-weight: 600;
}
.step__label { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.step--done .step__dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step--done .step__label { color: var(--text-2); }
.step--active .step__dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 3px var(--brand-weak); }
.step--active .step__label { color: var(--text); font-weight: 600; }
.step__line { width: 26px; height: 1px; background: var(--border-strong); margin-right: 12px; }
.step--done .step__line { background: var(--ok); }

/* ---------- 11. 选项卡（JS 驱动，见 app.js） ---------- */
.tabs__nav { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 8px 13px; font-size: 12.5px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab__count { font-size: 10.5px; padding: 0 5px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.tab.is-active .tab__count { background: var(--brand-weak); color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* 分段控件 */
.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: 8px; }
.seg__item { padding: 5px 12px; border-radius: 6px; font-size: 12px; color: var(--text-2); }
.seg__item.is-active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

/* ---------- 12. 抽屉（固定 640px） ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(16, 20, 30, 0.42);
  opacity: 0; transition: opacity .22s ease;
}
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: var(--drawer-w);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.32, .72, 0, 1);
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
}
.drawer__title { font-size: 14px; font-weight: 600; }
.drawer__sub { font-size: 11.5px; color: var(--text-3); }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer__foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; align-items: center; }

/* ---------- 13. 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; visibility: hidden; display: flex; align-items: center; justify-content: center; }
.modal.is-open { visibility: visible; }
.modal__scrim { position: absolute; inset: 0; background: rgba(16, 20, 30, 0.45); opacity: 0; transition: opacity .2s; }
.modal.is-open .modal__scrim { opacity: 1; }
.modal__panel {
  position: relative;
  width: 560px; max-width: calc(100vw - 48px); max-height: 84vh;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(10px) scale(.98);
  transition: opacity .2s, transform .2s;
}
.modal.is-open .modal__panel { opacity: 1; transform: none; }
.modal__panel--wide { width: 880px; }
.modal__head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal__title { font-size: 14px; font-weight: 600; }
.modal__body { padding: 16px 18px; overflow-y: auto; }
.modal__foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ---------- 14. 表单 ---------- */
.form-grid { display: grid; gap: 12px 14px; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.field__label .req { color: var(--err); }
.field__hint { font-size: 11px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 12.5px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
.select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d94a3' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.input--sm { height: 28px; font-size: 12px; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group .input { flex: 1; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--brand); }
.check__text { line-height: 1.5; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track { width: 34px; height: 19px; border-radius: 20px; background: #cfd4dc; position: relative; transition: background .18s; flex: 0 0 34px; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: var(--shadow-1); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(15px); }
.switch__label { font-size: 12.5px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.range { width: 100%; accent-color: var(--brand); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button { width: 26px; height: 30px; color: var(--text-2); }
.stepper button:hover { background: var(--surface-3); }
.stepper input { width: 46px; height: 30px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font-size: 12.5px; }

/* 人员选择 */
.chip-select { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 20px;
  font-size: 12px; color: var(--text-2); background: var(--surface);
}
.chip.is-on { border-color: var(--brand); background: var(--brand-weak); color: var(--brand); font-weight: 500; }

/* ---------- 15. 人类可读摘要（替代 JSON） ---------- */
.summary { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.summary__row { display: flex; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.summary__row:last-child { border-bottom: none; }
.summary__row:nth-child(odd) { background: var(--surface-2); }
.summary__key { width: 132px; flex: 0 0 132px; color: var(--text-3); }
.summary__val { flex: 1; min-width: 0; }
.summary__val b { font-weight: 600; }
.summary--inline { display: flex; flex-wrap: wrap; gap: 6px; border: none; }
.summary--inline .summary__row { border: none; background: none; padding: 0; }

.kv { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; }
.kv__item { display: flex; gap: 6px; }
.kv__k { color: var(--text-3); }
.kv__v { font-weight: 500; }

/* 规则条目（人类可读） */
.rule-list { display: flex; flex-direction: column; gap: 8px; }
.rule {
  display: flex; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.rule--warn { border-left-color: var(--warn); background: var(--warn-weak); }
.rule--err { border-left-color: var(--err); background: var(--err-weak); }
.rule--ok { border-left-color: var(--ok); background: var(--ok-weak); }
.rule__title { font-size: 12.5px; font-weight: 600; }
.rule__desc { font-size: 11.5px; color: var(--text-2); }

/* ---------- 16. 提示 / 空态 ---------- */
.alert { display: flex; gap: 9px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; border: 1px solid; }
.alert svg { flex: 0 0 15px; margin-top: 1px; }
.alert--info { background: var(--info-weak); border-color: #c6def2; color: #0a5c95; }
.alert--warn { background: var(--warn-weak); border-color: #f2dcb6; color: #8a5b06; }
.alert--err { background: var(--err-weak); border-color: #f3c5c2; color: #a5231a; }
.alert--ok { background: var(--ok-weak); border-color: #bfe3ce; color: #0a6f3e; }
.empty { padding: 44px 20px; text-align: center; color: var(--text-3); }
.empty__title { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.empty__icon { width: 40px; height: 40px; margin: 0 auto 10px; border-radius: 12px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; color: var(--text-4); }

/* Toast */
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 22px;
  background: #1f232b; color: #fff; font-size: 12.5px;
  box-shadow: var(--shadow-3);
  animation: toast-in .22s ease;
}
.toast--ok { background: #0a6f3e; }
.toast--err { background: #a5231a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 17. 媒体缩略图 ---------- */
.thumb { position: relative; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb--16x9 { aspect-ratio: 16 / 9; }
.thumb--4x3 { aspect-ratio: 4 / 3; }
.thumb--1x1 { aspect-ratio: 1 / 1; }
.thumb--9x16 { aspect-ratio: 9 / 16; }
.thumb__tag {
  position: absolute; left: 6px; top: 6px;
  padding: 1px 7px; border-radius: 4px;
  background: rgba(12, 15, 22, 0.68); color: #fff; font-size: 10.5px;
  backdrop-filter: blur(4px);
}
.thumb__tag--right { left: auto; right: 6px; }
.thumb__tag--bottom { top: auto; bottom: 6px; }
.thumb__tag--ok { background: rgba(10, 111, 62, 0.86); }
.thumb__tag--err { background: rgba(165, 35, 26, 0.86); }
.thumb__tag--brand { background: rgba(79, 70, 229, 0.88); }

/* 头像 */
.avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--surface-3); flex: 0 0 28px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 22px; height: 22px; flex-basis: 22px; }
.avatar--lg { width: 40px; height: 40px; flex-basis: 40px; }
.avatar-group { display: flex; }
.avatar-group .avatar { margin-left: -7px; border: 2px solid var(--surface); }
.avatar-group .avatar:first-child { margin-left: 0; }

/* ---------- 18. 分镜台 ---------- */
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.sb-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); position: relative; }
.sb-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.sb-card.is-bad { border-color: #f0bdb9; background: #fffafa; }
.sb-card__no {
  position: absolute; left: 5px; top: 5px; z-index: 2;
  padding: 0 6px; height: 17px; border-radius: 4px;
  background: rgba(12, 15, 22, 0.72); color: #fff;
  font-size: 10.5px; display: flex; align-items: center; font-family: var(--mono);
}
.sb-card__meta { padding: 7px 8px; }
.sb-card__title { font-size: 11.5px; font-weight: 500; }
.sb-card__line { font-size: 10.5px; color: var(--text-3); display: flex; gap: 6px; margin-top: 3px; }
.sb-card__acts { display: flex; gap: 2px; justify-content: flex-end; padding: 0 5px 5px; }

/* 故事板（长条） */
.sb-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.sb-strip .sb-card { width: 152px; flex: 0 0 152px; }

/* 表格节点 */
.sheet { font-size: 12px; }
.sheet th { background: #eef0ff; color: #3730a3; font-weight: 600; border: 1px solid #dcdffb; padding: 6px 8px; white-space: nowrap; }
.sheet td { border: 1px solid var(--border); padding: 6px 8px; vertical-align: top; }
.sheet tbody tr:hover { background: var(--surface-2); }
.sheet .sheet__idx { width: 34px; text-align: center; color: var(--text-3); font-family: var(--mono); }
.sheet .sheet__add { color: var(--text-4); text-align: center; cursor: pointer; }
.sheet .sheet__add:hover { color: var(--brand); background: var(--brand-weak); }
.sheet .is-focus { background: var(--brand-weak); box-shadow: inset 0 0 0 1px var(--brand-line); }

/* ---------- 19. 生成画布（节点式） ---------- */
.canvas {
  position: relative; min-height: 560px; overflow: auto;
  background-color: #fbfbfd;
  background-image: radial-gradient(#dfe3ea 1px, transparent 1px);
  background-size: 18px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.canvas__toolbar {
  position: sticky; left: 0; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(6px);
}
.canvas__inner { position: relative; padding: 22px; min-width: 1080px; }
.node {
  position: absolute; width: 236px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.node--sm { width: 196px; }
.node--wide { width: 300px; }
.node.is-sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak), var(--shadow-2); }
.node__head { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.node__head .badge { margin-left: auto; }
.node__body { padding: 9px 10px; }
.node__foot { padding: 7px 10px; border-top: 1px solid var(--border); display: flex; gap: 6px; align-items: center; }
.node__port { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.node__port--in { left: -5px; top: 26px; }
.node__port--out { right: -5px; top: 26px; }
.node__port--out2 { right: -5px; top: 52px; }
.node__field { font-size: 11.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.node__field b { font-weight: 600; color: var(--text); }

/* 连线（纯装饰） */
.edge { position: absolute; height: 2px; background: linear-gradient(90deg, var(--brand-line), var(--brand)); border-radius: 2px; z-index: 1; }
.edge::after { content: ""; position: absolute; right: -1px; top: -3px; border-left: 6px solid var(--brand); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.edge--vertical { width: 2px; background: linear-gradient(180deg, var(--brand-line), var(--brand)); }
.edge--vertical::after { right: -3px; top: auto; bottom: -1px; border: none; border-top: 6px solid var(--brand); border-left: 4px solid transparent; border-right: 4px solid transparent; }

/* 小地图 / 画布侧栏 */
.canvas-side { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 20. 时间线 ---------- */
.timeline { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.timeline__head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.ruler { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 10px; color: var(--text-3); }
.ruler__tick { flex: 1; padding: 3px 0 3px 5px; border-left: 1px solid var(--border); font-family: var(--mono); }
.track { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); min-height: 46px; }
.track:last-child { border-bottom: none; }
.track__label {
  width: 78px; flex: 0 0 78px; padding: 8px;
  border-right: 1px solid var(--border); background: var(--surface-2);
  font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px;
}
.track__lane { flex: 1; display: flex; gap: 3px; padding: 6px; background-image: linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 60px 100%; align-items: center; }
.clip {
  height: 34px; border-radius: 5px; position: relative;
  display: flex; align-items: center; padding: 0 7px;
  font-size: 10.5px; color: #fff; overflow: hidden; white-space: nowrap;
}
.clip--video { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.clip--audio { background: linear-gradient(135deg, #0d74bc, #2f9be0); }
.clip--sub { background: linear-gradient(135deg, #0f9d58, #34b878); height: 24px; }
.clip--music { background: linear-gradient(135deg, #7c3aed, #a855f7); }
.clip__handle { position: absolute; top: 0; bottom: 0; width: 4px; background: rgba(255, 255, 255, 0.45); }
.clip__handle--l { left: 0; } .clip__handle--r { right: 0; }
.playhead { position: relative; }
.playhead::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1.5px; background: var(--err); z-index: 3; }
.playhead::after { content: ""; position: absolute; left: calc(50% - 5px); top: 0; border-top: 7px solid var(--err); border-left: 5px solid transparent; border-right: 5px solid transparent; }

/* 波形条 */
.wave { display: flex; align-items: center; gap: 1.5px; height: 20px; flex: 1; }
.wave span { flex: 1; background: rgba(255, 255, 255, 0.65); border-radius: 1px; }
.wave--dark span { background: var(--brand-line); }

/* ---------- 21. 图表（纯 CSS 柱状） ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 128px; padding-top: 8px; }
.chart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart__bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #818cf8, #4f46e5); min-height: 3px; }
.chart__bar--alt { background: linear-gradient(180deg, #93c5fd, #0d74bc); }
.chart__bar--muted { background: linear-gradient(180deg, #d7dbe2, #b9bfca); }
.chart__label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.chart__val { font-size: 10.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); }
.legend__i { display: flex; align-items: center; gap: 5px; }
.legend__sw { width: 9px; height: 9px; border-radius: 2px; }

/* 横向条 */
.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hbar__name { width: 96px; flex: 0 0 96px; font-size: 12px; color: var(--text-2); }
.hbar__track { flex: 1; height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.hbar__fill { height: 100%; border-radius: 6px; background: var(--brand); }
.hbar__val { width: 62px; flex: 0 0 62px; text-align: right; font-size: 11.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 22. 列表 ---------- */
.list { display: flex; flex-direction: column; }
.list__item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); align-items: center; }
.list__item:last-child { border-bottom: none; }
.list__item:hover { background: var(--surface-2); }
.list__title { font-size: 12.5px; font-weight: 500; }
.list__meta { font-size: 11px; color: var(--text-3); }
.list__icon { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--brand-weak); color: var(--brand); }

/* 资产卡 */
.asset-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.asset-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-2); }
.asset-card__views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; background: var(--border); }
.asset-card__body { padding: 9px 10px; }
.asset-card__title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.asset-card__meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }

/* 锁定/一致性标记 */
.lock-row { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ok); }
.consist { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.consist__bar { width: 42px; height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.consist__fill { height: 100%; background: var(--ok); }

/* ---------- 23. 提示词框 ---------- */
.prompt-box {
  position: relative;
  padding: 9px 10px; padding-right: 34px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}
.prompt-box__copy { position: absolute; right: 5px; top: 5px; }

/* ---------- 24. 版本 / 留痕 ---------- */
.version-row { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.version-row:last-child { border-bottom: none; }
.version-row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-top: 6px; flex: 0 0 8px; }
.version-row__dot--ok { background: var(--ok); }
.version-row__dot--warn { background: var(--warn); }
.version-row__dot--muted { background: var(--text-4); }
.version-row__body { flex: 1; min-width: 0; }
.version-row__time { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* 评论 */
.comment { display: flex; gap: 9px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.comment:last-child { border-bottom: none; }
.comment__body { flex: 1; min-width: 0; }
.comment__head { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.comment__name { font-weight: 600; }
.comment__time { color: var(--text-3); }
.comment__text { font-size: 12.5px; margin-top: 2px; }

/* ---------- 25. 模型 / 队列 ---------- */
.model-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.model-row:last-child { border-bottom: none; }
.model-row__logo { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; }
.model-row__name { font-size: 12.5px; font-weight: 500; }
.model-row__meta { font-size: 11px; color: var(--text-3); }

.queue-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.queue-item:last-child { border-bottom: none; }
.queue-item__id { font-family: var(--mono); font-size: 11px; color: var(--text-3); width: 92px; flex: 0 0 92px; }

/* ---------- 26. 权限矩阵 ---------- */
.matrix th { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix td { text-align: center; }
.matrix .yes { color: var(--ok); font-weight: 700; }
.matrix .no { color: var(--text-4); }

/* ---------- 27. 定价卡 ---------- */
.plan { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.plan--hot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.plan__name { font-size: 13.5px; font-weight: 600; }
.plan__price { font-size: 24px; font-weight: 700; letter-spacing: -1px; }
.plan__price span { font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.plan__list { font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 5px; }
.plan__list li { display: flex; gap: 6px; align-items: flex-start; }

/* ---------- 28. 打印 / 响应式兜底 ---------- */
@media (max-width: 1280px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
  .layout-2r { grid-template-columns: minmax(0, 1fr); }
}