/* ==========================================================
   theme.css — 深色/浅色主题变量体系（任务包 #21）
   ----------------------------------------------------------
   • :root / [data-theme="light"]  ：浅色主题（默认）
   • [data-theme="dark"]           ：深色主题
   • 主题由 <html data-theme="light|dark"> 控制，
     防闪烁脚本在各页面 <head> 最顶部提前设置。
   • 本文件在 style.css 之后引入，同优先级规则后者生效，
     深色覆盖段全部使用 [data-theme="dark"] 前缀保证优先级。
   ========================================================== */

/* ===== 浅色主题（默认） ===== */
:root,
[data-theme="light"] {
  /* —— 规格要求的 CSS 变量 —— */
  --bs-body-bg: #f5f7fb;
  --bs-body-color: #12263f;
  --bs-card-bg: #ffffff;
  --bs-card-border: #e3ebf6;
  --bs-navbar-bg: #ffffff;
  --bs-navbar-border: #e3ebf6;
  --bs-sidebar-bg: #ffffff;
  --bs-sidebar-hover: #f5f7fb;
  --bs-sidebar-active: #e3ebf6;
  --bs-sidebar-active-color: #12263f;
  --bs-input-bg: #ffffff;
  --bs-input-border: #d2ddec;
  --bs-input-color: #12263f;
  --bs-btn-primary-bg: #2c7be5;
  --bs-btn-primary-border: #2c7be5;
  --bs-code-bg: #f1f3f7;
  --bs-code-color: #e83e8c;
  --bs-table-stripe: #f5f7fb;
  --bs-modal-bg: #ffffff;
  --bs-modal-border: #e3ebf6;
  --bs-dropdown-bg: #ffffff;
  --bs-dropdown-border: #e3ebf6;
  --bs-tooltip-bg: #12263f;
  --bs-toast-bg: #ffffff;
  --bs-diff-add-bg: #d1f5e0;
  --bs-diff-remove-bg: #fdddea;
  --bs-diff-context-bg: #ffffff;
  --bs-scrollbar-thumb: #cbd5e1;
  --bs-scrollbar-track: #f1f5f9;
  --bs-border-radius: 6px;
  --bs-shadow: 0 1px 3px rgba(0,0,0,.05);
  --bs-shadow-lg: 0 4px 12px rgba(0,0,0,.1);

  /* —— 站点自有变量映射（style.css 原有 --* 变量，随主题切换） —— */
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e3ebf6;
  --text: #12263f;
  --muted: #64748b;
  --primary: #2c7be5;
  --primary-soft: #eaf2ff;
  --ai-bg: #f2f5fa;
  --ok: #16a34a;
  --err: #dc2626;
  --radius: 10px;

  color-scheme: light;
}

/* ===== 深色主题 ===== */
[data-theme="dark"] {
  /* —— 规格要求的 CSS 变量 —— */
  --bs-body-bg: #0f172a;
  --bs-body-color: #e2e8f0;
  --bs-card-bg: #1e293b;
  --bs-card-border: #334155;
  --bs-navbar-bg: #1e293b;
  --bs-navbar-border: #334155;
  --bs-sidebar-bg: #1e293b;
  --bs-sidebar-hover: #334155;
  --bs-sidebar-active: #0ea5e9;
  --bs-sidebar-active-color: #ffffff;
  --bs-input-bg: #0f172a;
  --bs-input-border: #475569;
  --bs-input-color: #e2e8f0;
  --bs-btn-primary-bg: #3b82f6;
  --bs-btn-primary-border: #3b82f6;
  --bs-code-bg: #0f172a;
  --bs-code-color: #f472b6;
  --bs-table-stripe: #172033;
  --bs-modal-bg: #1e293b;
  --bs-modal-border: #334155;
  --bs-dropdown-bg: #1e293b;
  --bs-dropdown-border: #334155;
  --bs-tooltip-bg: #e2e8f0;
  --bs-toast-bg: #1e293b;
  --bs-diff-add-bg: #064e3b;
  --bs-diff-remove-bg: #7f1d1d;
  --bs-diff-context-bg: #1e293b;
  --bs-scrollbar-thumb: #475569;
  --bs-scrollbar-track: #0f172a;
  --bs-shadow: 0 1px 3px rgba(0,0,0,.3);
  --bs-shadow-lg: 0 4px 12px rgba(0,0,0,.5);

  /* —— 站点自有变量映射（style.css 原有 --* 变量） —— */
  --bg: #0f172a;
  --panel: #1e293b;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, .18);
  --ai-bg: #1e293b;
  --ok: #4ade80;
  --err: #f87171;
  --radius: 10px;

  /* 原生控件（复选框/下拉/原生滚动条）随系统配色走深色 */
  color-scheme: dark;
}

/* 主题切换时背景/文字平滑过渡，避免生硬跳变 */
body,
.col-left, .col-center, .col-right, .topbar, .card, .modal-content {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* ==========================================================
   主题切换器 UI（顶部导航栏 ☀️ 🌙 💻 三按钮）
   ========================================================== */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px;
}
.theme-switcher-btn {
  border: none;
  background: transparent;
  font-size: 14px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 14px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s, background-color .15s;
}
.theme-switcher-btn:hover {
  opacity: 1;
  background: rgba(59, 130, 246, .15);
}
.theme-switcher-btn.active {
  opacity: 1;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, .45);
}

/* ==========================================================
   滚动条（WebKit）随主题变色
   ========================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bs-scrollbar-track); }
::-webkit-scrollbar-thumb {
  background: var(--bs-scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--bs-btn-primary-bg); }

/* ==========================================================
   Bootstrap 组件深色适配（5.3，不依赖 data-bs-theme）
   ========================================================== */
[data-theme="video-studio"],[data-theme="dark"] .modal-content {
  background-color: var(--bs-modal-bg);
  border-color: var(--bs-modal-border);
  color: var(--bs-body-color);
}
[data-theme="video-studio"],[data-theme="dark"] .modal-header,
[data-theme="video-studio"],[data-theme="dark"] .modal-footer { border-color: var(--bs-modal-border); }
[data-theme="video-studio"],[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
[data-theme="video-studio"],[data-theme="dark"] .form-control,
[data-theme="video-studio"],[data-theme="dark"] .form-select {
  background-color: var(--bs-input-bg);
  border-color: var(--bs-input-border);
  color: var(--bs-input-color);
}
[data-theme="video-studio"],[data-theme="dark"] .form-control:focus,
[data-theme="video-studio"],[data-theme="dark"] .form-select:focus {
  background-color: var(--bs-input-bg);
  color: var(--bs-input-color);
  border-color: var(--bs-btn-primary-bg);
  box-shadow: 0 0 0 .2rem rgba(59, 130, 246, .25);
}
[data-theme="video-studio"],[data-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-theme="video-studio"],[data-theme="dark"] .form-control:disabled,
[data-theme="video-studio"],[data-theme="dark"] .form-select:disabled { background-color: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .dropdown-menu {
  background-color: var(--bs-dropdown-bg);
  border-color: var(--bs-dropdown-border);
}
[data-theme="video-studio"],[data-theme="dark"] .dropdown-item { color: var(--bs-body-color); }
[data-theme="video-studio"],[data-theme="dark"] .dropdown-item:hover,
[data-theme="video-studio"],[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--bs-sidebar-hover);
  color: var(--bs-body-color);
}
[data-theme="video-studio"],[data-theme="dark"] .accordion-item {
  background-color: var(--bs-card-bg);
  color: var(--bs-body-color);
}
[data-theme="video-studio"],[data-theme="dark"] .accordion-button {
  background-color: var(--bs-card-bg);
  color: var(--bs-body-color);
}
[data-theme="video-studio"],[data-theme="dark"] .accordion-button:not(.collapsed) {
  background-color: rgba(14, 165, 233, .15);
  color: #7dd3fc;
}
[data-theme="video-studio"],[data-theme="dark"] .btn-primary {
  background-color: var(--bs-btn-primary-bg);
  border-color: var(--bs-btn-primary-border);
}
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-primary { color: #93c5fd; border-color: #3b82f6; }
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-primary:focus {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-secondary { color: #cbd5e1; border-color: #64748b; }
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="video-studio"],[data-theme="dark"] .btn-outline-secondary:focus {
  background-color: #334155;
  border-color: #64748b;
  color: #e2e8f0;
}
[data-theme="video-studio"],[data-theme="dark"] .bg-light { background-color: #334155 !important; }
[data-theme="video-studio"],[data-theme="dark"] .bg-light.text-dark { color: #e2e8f0 !important; }
[data-theme="video-studio"],[data-theme="dark"] .text-muted { color: #94a3b8 !important; }
[data-theme="video-studio"],[data-theme="dark"] .alert-warning {
  background-color: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .4);
  color: #fcd34d;
}
[data-theme="video-studio"],[data-theme="dark"] .alert-danger {
  background-color: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .4);
  color: #fca5a5;
}
[data-theme="video-studio"],[data-theme="dark"] .alert-success {
  background-color: rgba(22, 163, 74, .12);
  border-color: rgba(22, 163, 74, .4);
  color: #86efac;
}
[data-theme="video-studio"],[data-theme="dark"] .table {
  --bs-table-bg: var(--bs-card-bg);
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: var(--bs-card-border);
  --bs-table-striped-bg: var(--bs-table-stripe);
  --bs-table-hover-bg: var(--bs-sidebar-hover);
}
[data-theme="video-studio"],[data-theme="dark"] .tooltip-inner { background-color: var(--bs-tooltip-bg); color: #0f172a; }
[data-theme="video-studio"],[data-theme="dark"] .nav-link { color: var(--bs-body-color); }
[data-theme="video-studio"],[data-theme="dark"] .nav-pills .nav-link.active { background-color: var(--bs-btn-primary-bg); color: #fff; }

/* ==========================================================
   工作台（index.php / style.css）硬编码颜色深色覆盖
   ========================================================== */
/* 顶栏与三栏 */
[data-theme="video-studio"],[data-theme="dark"] .badge-mode {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .4);
  color: #fbbf24;
}
[data-theme="video-studio"],[data-theme="dark"] .badge-mode.live {
  background: rgba(22, 163, 74, .12);
  border-color: rgba(22, 163, 74, .4);
  color: #4ade80;
}
[data-theme="video-studio"],[data-theme="dark"] .user-chip { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .center-head,
[data-theme="video-studio"],[data-theme="dark"] .composer { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .project-item:hover { background: #26334d; }
[data-theme="video-studio"],[data-theme="dark"] .project-item.active { border-color: rgba(59, 130, 246, .5); }

/* 对话气泡（验收 #8：深色下可读） */
[data-theme="video-studio"],[data-theme="dark"] .msg-ai .msg-avatar { background: rgba(59, 130, 246, .25); color: #93c5fd; }
[data-theme="video-studio"],[data-theme="dark"] .msg-user .msg-text {
  background: #1e3a5f;              /* 深蓝底，深色模式专用 */
  color: #e2e8f0;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-ai .msg-text {
  background: #1e293b;              /* 深灰底 */
  border-color: #334155;
  color: #e2e8f0;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-system .msg-text {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .35);
  color: #fcd34d;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-file .msg-text {
  background: rgba(16, 185, 129, .12);
  border-color: rgba(16, 185, 129, .35);
  color: #6ee7b7;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-error .msg-text {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(239, 68, 68, .35);
  color: #fca5a5;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-done .msg-text {
  background: rgba(59, 130, 246, .12);
  border-color: rgba(59, 130, 246, .35);
  color: #93c5fd;
}
[data-theme="video-studio"],[data-theme="dark"] .msg-done a { color: #60a5fa; }

/* 对话区代码块 / 文件标记 / 历史 */
[data-theme="video-studio"],[data-theme="dark"] .chat-file-mark {
  background: rgba(245, 158, 11, .12);
  border-color: rgba(245, 158, 11, .4);
  color: #fbbf24;
}
[data-theme="video-studio"],[data-theme="dark"] .chat-code {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}
[data-theme="video-studio"],[data-theme="dark"] .his-group,
[data-theme="video-studio"],[data-theme="dark"] .asset-group { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .his-item { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .his-item:hover {
  background: rgba(59, 130, 246, .12);
  border-color: rgba(59, 130, 246, .4);
}
[data-theme="video-studio"],[data-theme="dark"] .his-sum { color: #e2e8f0; }

/* 右栏面板通用 */
[data-theme="video-studio"],[data-theme="dark"] .constraint-list li { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .wizard-preview { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .wizard-confirm dd { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .tl-item:hover { border-color: rgba(59, 130, 246, .5); background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .tl-d-text,
[data-theme="video-studio"],[data-theme="dark"] .tl-d-files li { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .pi-task-text { color: #94a3b8; }

/* 任务类型徽标：半透明同色系 */
[data-theme="video-studio"],[data-theme="dark"] .t-blue   { background: rgba(59, 130, 246, .15);  color: #93c5fd; }
[data-theme="video-studio"],[data-theme="dark"] .t-yellow { background: rgba(245, 158, 11, .15); color: #fcd34d; }
[data-theme="video-studio"],[data-theme="dark"] .t-green  { background: rgba(16, 185, 129, .15);  color: #6ee7b7; }
[data-theme="video-studio"],[data-theme="dark"] .t-cyan   { background: rgba(6, 182, 212, .15);  color: #67e8f9; }
[data-theme="video-studio"],[data-theme="dark"] .t-red    { background: rgba(239, 68, 68, .15);  color: #fca5a5; }
[data-theme="video-studio"],[data-theme="dark"] .t-gray   { background: rgba(148, 163, 184, .15); color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .r-ok      { background: rgba(22, 163, 74, .2);  color: #4ade80; }
[data-theme="video-studio"],[data-theme="dark"] .r-unknown { background: rgba(148, 163, 184, .15); color: #cbd5e1; }

/* 模型行 / 备选顺序 / 映射行 */
[data-theme="video-studio"],[data-theme="dark"] .model-row .model-name { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .fb-item { background: #0f172a; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .fb-item .fb-seq { background: #334155; color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .tm-row .tm-type { color: #94a3b8; }

/* 模板库 / 审查 / 修Bug 模式 */
[data-theme="video-studio"],[data-theme="dark"] .fix-mode-tip,
[data-theme="video-studio"],[data-theme="dark"] .fix-file-area {
  background: rgba(245, 158, 11, .08);
  border-color: rgba(245, 158, 11, .4);
  color: #fbbf24;
}
[data-theme="video-studio"],[data-theme="dark"] .fix-file-list { background: #0f172a; border-color: rgba(245, 158, 11, .3); }
[data-theme="video-studio"],[data-theme="dark"] .ffa-item label,
[data-theme="video-studio"],[data-theme="dark"] .rev-file-list label { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .ffa-reason { background: rgba(245, 158, 11, .25); color: #fde68a; }
[data-theme="video-studio"],[data-theme="dark"] .tpl-item { background: #0f172a; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .tpl-item .tpl-name { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .rev-file-list { background: #0f172a; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .review-result .rv-item { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .review-result .rv-title { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .review-result .rv-chars { color: #94a3b8; }
[data-theme="video-studio"],[data-theme="dark"] .review-result .rv-summary { color: #cbd5e1; }

/* 结构树 / 文件预览 */
[data-theme="video-studio"],[data-theme="dark"] .tree-view { background: #0f172a; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .td-name,
[data-theme="video-studio"],[data-theme="dark"] .tf-name { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .td-name:hover { color: #60a5fa; }
[data-theme="video-studio"],[data-theme="dark"] .tf-php  { color: #60a5fa; }
[data-theme="video-studio"],[data-theme="dark"] .tf-css  { color: #fbbf24; }
[data-theme="video-studio"],[data-theme="dark"] .tf-js   { color: #4ade80; }
[data-theme="video-studio"],[data-theme="dark"] .tf-html { color: #a78bfa; }
[data-theme="video-studio"],[data-theme="dark"] .tf-sql  { color: #22d3ee; }

/* 待办 / 交付文档 */
[data-theme="video-studio"],[data-theme="dark"] .todo-item { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .todo-item .todo-content { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .delivery-result { background: var(--panel); border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .delivery-preview { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .delivery-preview h2 { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .delivery-preview blockquote { border-color: rgba(148, 163, 184, .4); color: #94a3b8; }
[data-theme="video-studio"],[data-theme="dark"] .dp-table th,
[data-theme="video-studio"],[data-theme="dark"] .dp-table td { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .dp-table th { background: #172033; }

/* 安全面板 */
[data-theme="video-studio"],[data-theme="dark"] .sec-code { background: #0f172a; border-color: #334155; color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .sec-log-item { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .sec-log-rules { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .sec-log-detail { border-color: #334155; color: #94a3b8; }

/* 项目删除清单 */
[data-theme="video-studio"],[data-theme="dark"] .del-warn-big { color: #f87171; }
[data-theme="video-studio"],[data-theme="dark"] .del-list-title { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .del-list { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .3); }
[data-theme="video-studio"],[data-theme="dark"] .del-row { border-color: rgba(239, 68, 68, .25); color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .del-row b { color: #e2e8f0; }

/* 素材管理 */
[data-theme="video-studio"],[data-theme="dark"] .asset-drop-zone {
  background: #0f172a;
  border-color: #475569;              /* 拖拽区虚线适配 */
}
[data-theme="video-studio"],[data-theme="dark"] .asset-drop-zone:hover,
[data-theme="video-studio"],[data-theme="dark"] .asset-drop-zone.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, .12);
}
[data-theme="video-studio"],[data-theme="dark"] .adz-text { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .asset-unimported {
  background: rgba(245, 158, 11, .1);
  border-color: rgba(245, 158, 11, .4);
  color: #fbbf24;
}
[data-theme="video-studio"],[data-theme="dark"] .asset-row:hover { background: #172033; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .asset-row.asset-lost { background: rgba(239, 68, 68, .1); }
[data-theme="video-studio"],[data-theme="dark"] .asset-thumb { border-color: #475569; }
[data-theme="video-studio"],[data-theme="dark"] .asset-thumb-icon { background: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .asset-name { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .asset-stats { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .asset-pick-item { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .asset-pick-item:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, .12);
}
[data-theme="video-studio"],[data-theme="dark"] .api-name { color: #94a3b8; }

/* 备忘面板分割线（rgba 黑色系在深色下改为白色系） */
[data-theme="video-studio"],[data-theme="dark"] .memo-switch { border-left-color: rgba(255, 255, 255, .1); }
[data-theme="video-studio"],[data-theme="dark"] .memo-history-list { border-top-color: rgba(255, 255, 255, .1); }
[data-theme="video-studio"],[data-theme="dark"] .memo-history-list .memo-hrow { border-bottom-color: rgba(255, 255, 255, .07); }

/* ==========================================================
   Diff 对比区（验收 #9：深色下新增绿 / 删除红可辨识）
   ========================================================== */
[data-theme="video-studio"],[data-theme="dark"] .changes-panel { background: #172033; border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .diff-box { background: var(--bs-diff-context-bg); border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-no { color: #64748b; border-right-color: rgba(255, 255, 255, .08); }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-code { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-ctx { background: var(--bs-diff-context-bg); }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-add { background: var(--bs-diff-add-bg); }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-add .d-code { color: #6ee7b7; }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-remove { background: var(--bs-diff-remove-bg); }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-remove .d-code { color: #fca5a5; }
[data-theme="video-studio"],[data-theme="dark"] .diff-table .d-gap { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .diff-stats { color: #94a3b8; border-bottom-color: rgba(255, 255, 255, .08); }
[data-theme="video-studio"],[data-theme="dark"] .diff-truncated {
  background: rgba(245, 158, 11, .12);
  color: #fcd34d;
  border-bottom-color: rgba(255, 255, 255, .08);
}
[data-theme="video-studio"],[data-theme="dark"] .fv-row { border-bottom-color: rgba(255, 255, 255, .08); }
[data-theme="video-studio"],[data-theme="dark"] .fix-diff-item { border-color: #334155; }

/* ==========================================================
   任务包 #18/#20 组件
   ========================================================== */
[data-theme="video-studio"],[data-theme="dark"] .chat-tpl-btn {
  background: #1e293b;
  border-color: #475569;
  color: #94a3b8;
}
[data-theme="video-studio"],[data-theme="dark"] .chat-tpl-btn:hover { color: #60a5fa; border-color: #60a5fa; }
[data-theme="video-studio"],[data-theme="dark"] .chat-saved-badge {
  background: rgba(22, 163, 74, .15);
  border-color: rgba(22, 163, 74, .4);
  color: #4ade80;
}
[data-theme="video-studio"],[data-theme="dark"] .chat-saved-badge:hover { background: rgba(22, 163, 74, .25); }
[data-theme="video-studio"],[data-theme="dark"] .batch-tpl-bar {
  background: #1e293b;
  border-color: #475569;
  color: #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
[data-theme="video-studio"],[data-theme="dark"] .chat-highlight { outline-color: #60a5fa; }
[data-theme="video-studio"],[data-theme="dark"] .tpl-src {
  color: #60a5fa;
  background: rgba(59, 130, 246, .15);
}
[data-theme="video-studio"],[data-theme="dark"] .tpl-src:hover { background: rgba(59, 130, 246, .3); }
[data-theme="video-studio"],[data-theme="dark"] .ctp-preview { background: #0f172a; color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .tpl-example-box { background: #0f172a; border-color: #475569; }
[data-theme="video-studio"],[data-theme="dark"] .tpl-example-body { color: #cbd5e1; }

/* 全局文件搜索 */
[data-theme="video-studio"],[data-theme="dark"] mark.fs-hit,
[data-theme="video-studio"],[data-theme="dark"] .fp-hit { background: #fde047; color: #1e293b; }
[data-theme="video-studio"],[data-theme="dark"] .fs-hist-item {
  background: #172033;
  border-color: #334155;
  color: #cbd5e1;
}
[data-theme="video-studio"],[data-theme="dark"] .fs-hist-item:hover { background: #1e3a5f; }
[data-theme="video-studio"],[data-theme="dark"] .fs-row { border-bottom-color: rgba(51, 65, 85, .6); }
[data-theme="video-studio"],[data-theme="dark"] .fs-row:hover { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .fs-row.fs-sel {
  background: rgba(59, 130, 246, .15);
  outline: 1px solid #60a5fa;
}
[data-theme="video-studio"],[data-theme="dark"] .fs-name { color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .fs-badge-name { background: rgba(59, 130, 246, .15); color: #93c5fd; }
[data-theme="video-studio"],[data-theme="dark"] .fs-badge-content { background: rgba(245, 158, 11, .15); color: #fcd34d; }
[data-theme="video-studio"],[data-theme="dark"] .fs-lines { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .fs-lc { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .fs-crumb-sep { color: #475569; }

/* ==========================================================
   登录页（login.php 内联样式深色覆盖）
   ========================================================== */
[data-theme="video-studio"],[data-theme="dark"] body.login-body { background: #0f172a; color: #e2e8f0; }
[data-theme="video-studio"],[data-theme="dark"] .login-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
[data-theme="video-studio"],[data-theme="dark"] .login-sub { color: #94a3b8; }
[data-theme="video-studio"],[data-theme="dark"] .login-card .form-label { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .login-card .btn-primary {
  background: #3b82f6;
  border-color: #3b82f6;
}

/* ==========================================================
   设置页（settings.php 内联样式深色覆盖）
   ========================================================== */
[data-theme="video-studio"],[data-theme="dark"] body.set-body { background: #0f172a; }
[data-theme="video-studio"],[data-theme="dark"] .set-body .card {
  background-color: #1e293b;
  color: #e2e8f0;
}
[data-theme="video-studio"],[data-theme="dark"] .set-body .card-header {
  background: #1e293b;
  border-bottom-color: #334155;
}
[data-theme="video-studio"],[data-theme="dark"] .set-body .form-label { color: #94a3b8; }
[data-theme="video-studio"],[data-theme="dark"] .set-nav .nav-link { color: #cbd5e1; }
[data-theme="video-studio"],[data-theme="dark"] .set-nav .nav-link.active { background: #3b82f6; color: #fff; }
[data-theme="video-studio"],[data-theme="dark"] .set-body .model-row,
[data-theme="video-studio"],[data-theme="dark"] .set-body .rule-row { border-color: #334155; }
[data-theme="video-studio"],[data-theme="dark"] .set-body .form-control[readonly] { background: #172033; }
[data-theme="video-studio"],[data-theme="dark"] .set-body .hint-list li { color: #fcd34d; }
[data-theme="video-studio"],[data-theme="dark"] .toast-ok { background: #15803d; color: #fff; }
[data-theme="video-studio"],[data-theme="dark"] .toast-err { background: #b91c1c; color: #fff; }

/* 维护模式横幅（index.php 内联样式） */
[data-theme="video-studio"],[data-theme="dark"] .maint-banner {
  background: rgba(245, 158, 11, .12) !important;
  color: #fbbf24 !important;
}

/* ==========================================================
   视频工作区主题 video-studio（任务包 #59）
   语义：顶部导航/底部时间线=深绿#1b5e3a；中间工作区=近黑#1a1a1a；两侧面板=浅白#f5f5f5
   ========================================================== */
[data-theme="video-studio"] {
  /* 规格语义变量 */
  --zone-top-bg: #1b5e3a;
  --zone-top-text: #ffffff;
  --zone-bottom-bg: #1b5e3a;
  --zone-bottom-text: #ffffff;
  --zone-center-bg: #1a1a1a;
  --zone-side-bg: #f5f5f5;
  --zone-side-text: #333333;

  /* Bootstrap 变量映射 */
  --bs-body-bg: #1a1a1a;
  --bs-body-color: #e5e7eb;
  --bs-card-bg: #1f1f1f;
  --bs-card-border: #3a3a3a;
  --bs-navbar-bg: #1b5e3a;
  --bs-navbar-border: #14532d;
  --bs-sidebar-bg: #f5f5f5;
  --bs-sidebar-hover: #e5e7eb;
  --bs-sidebar-active: #1b5e3a;
  --bs-sidebar-active-color: #ffffff;
  --bs-input-bg: #141414;
  --bs-input-border: #3a3a3a;
  --bs-input-color: #e5e7eb;
  --bs-btn-primary-bg: #1b5e3a;
  --bs-btn-primary-border: #1b5e3a;
  --bs-code-bg: #141414;
  --bs-code-color: #f472b6;
  --bs-table-stripe: #232323;
  --bs-modal-bg: #1f1f1f;
  --bs-modal-border: #3a3a3a;
  --bs-dropdown-bg: #1f1f1f;
  --bs-dropdown-border: #3a3a3a;
  --bs-tooltip-bg: #e5e7eb;
  --bs-toast-bg: #1f1f1f;
  --bs-diff-add-bg: #14532d;
  --bs-diff-remove-bg: #7f1d1d;
  --bs-diff-context-bg: #1f1f1f;
  --bs-scrollbar-thumb: #3a3a3a;
  --bs-scrollbar-track: #1a1a1a;
  --bs-shadow: 0 1px 3px rgba(0,0,0,.4);
  --bs-shadow-lg: 0 4px 12px rgba(0,0,0,.55);

  /* 站点自有变量 */
  --bg: #1a1a1a;
  --panel: #1f1f1f;
  --line: #3a3a3a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #1b5e3a;
  --primary-soft: rgba(27, 94, 58, .28);
  --ai-bg: #1f1f1f;
  --ok: #4ade80;
  --err: #f87171;
  --radius: 10px;

  color-scheme: dark;
}

/* 分区绑定：顶部导航 = 深绿 */
[data-theme="video-studio"] .topbar {
  background: var(--zone-top-bg);
  border-color: #14532d;
  color: var(--zone-top-text);
}
[data-theme="video-studio"] .topbar a,
[data-theme="video-studio"] .topbar .text-muted,
[data-theme="video-studio"] .topbar .topbar-hint,
[data-theme="video-studio"] .topbar .user-chip { color: var(--zone-top-text); }

/* 分区绑定：底部时间线（剧本工坊）= 深绿 */
[data-theme="video-studio"] .sw-timeline {
  background: var(--zone-bottom-bg);
  color: var(--zone-bottom-text);
}
[data-theme="video-studio"] .sw-timeline-label { color: var(--zone-bottom-text); }

/* 分区绑定：中间工作区硬编码覆盖（替代 dark 主题的蓝黑色） */
[data-theme="video-studio"] .center-head,
[data-theme="video-studio"] .composer { background: var(--zone-center-bg); color: var(--bs-body-color); }

/* 两侧浅色面板内的次要文字保持可读 */
[data-theme="video-studio"] .col-left .text-muted,
[data-theme="video-studio"] .col-right .text-muted { color: #64748b !important; }

/* ==========================================================
   任务包 #60：video-studio 全局作用域修正
   1) body 级选择器兜底（规格要求；属性挂 html 时变量已继承，此段保障属性挂 body 的场景）
   2) 四大分区显式绑定 zone 变量（顶导航/底部时间线=深绿，中间=近黑，两侧=浅白）
   ========================================================== */
body[data-theme="video-studio"] {
  /* 任务包 #64：左侧项目类型导航变量（浅白侧边区内保持清晰可读） */
  --nav-group-bg: var(--zone-side-bg);
  --nav-item-hover: rgba(27, 94, 58, 0.1);
  --nav-type-dot-size: 12px;
  --zone-center-bg: #1a1a1a;
  --zone-side-bg: #f5f5f5;
  --zone-top-bg: #1b5e3a;
  --zone-bottom-bg: #1b5e3a;
  --zone-top-text: #ffffff;
  --zone-bottom-text: #ffffff;
  --zone-side-text: #333333;
  --bs-body-bg: #1a1a1a;
  --bs-body-color: #f5f5f5;
}

/* 分区绑定：中间主内容区 = 近黑 */
[data-theme="video-studio"] .col-center { background: var(--zone-center-bg, var(--bs-body-bg)); }

/* 分区绑定：两侧面板 = 浅白 + 深色文字（保证可读） */
[data-theme="video-studio"] .col-left,
[data-theme="video-studio"] .col-right {
  background: var(--zone-side-bg);
  color: var(--zone-side-text);
}
[data-theme="video-studio"] .col-left .text-muted,
[data-theme="video-studio"] .col-right .text-muted { color: #64748b !important; }
[data-theme="video-studio"] .col-left .form-control,
[data-theme="video-studio"] .col-left .form-select,
[data-theme="video-studio"] .col-right .form-control,
[data-theme="video-studio"] .col-right .form-select {
  background: #ffffff;
  border-color: #d1d5db;
  color: #333333;
}

/* 主题切换即时生效：CSS 变量随 data-theme 属性变更自动重算，无需刷新 */
