/* ============================================================
   sd-earn 共享设计系统（提炼自 happytokens-web）
   被 index.html(工作台) / doc.html 复用（admin.html 保持自有旧样式）
   ============================================================ */

:root {
  /* ===== 深色金主题（T.C.H 演示版）=====
     语义化变量名沿用旧的 --green* 系列（避免改动全站引用），仅替换取值为琥珀金。
     设计基调：深色页面底 + 浅色悬浮大卡，故 --card / --ink 仍为浅卡+深字。 */

  /* 主色：琥珀金（原绿色主色位）*/
  --green: #e0a83e;          /* gold 琥珀金主色 */
  --green-dark: #c8902a;     /* gold-dark 深金：hover / 强调文字 */
  --green-soft: #faf1dc;     /* gold-soft 浅金底：chip 选中、徽章 */
  --green-soft2: #fdf8ee;    /* gold-soft2 更浅金底：次级按钮、估价条 */
  --green-border: #ecd9a6;   /* gold-border 金边 */

  /* 金色渐变（立即生成按钮 / 高亮块）*/
  --gold-grad: linear-gradient(135deg, #f4cf6a 0%, #e0a83e 100%);
  --gold-glow: 0 8px 24px rgba(224, 168, 62, 0.35);

  /* 卡内文字（浅卡上仍用深字，保持可读）*/
  --ink: #23282f;
  --muted: #5d6b82;
  --faint: #9aa5b4;

  /* 页面深色底 + 顶栏纯黑（背景图接入前的纯色兜底）*/
  --bg: #17161a;             /* 页面深色底（背景图未到时的兜底色）*/
  --topbar-bg: #0d0d0f;      /* 顶栏纯黑 */
  --backdrop: #17161a;       /* 背景图容器兜底 */

  /* 浅色悬浮卡 */
  --card: #faf9f6;           /* 略暖的浅色卡（贴合设计稿）*/
  --border: #e9e4d8;         /* 暖色边框 */
  --input-bg: #f4f1ea;       /* 输入 / 次级底 */

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  /* 全站页面底图：bg.jpeg 铺满视口固定不动 */
  background: var(--bg) url("/bg.jpeg") center center / cover no-repeat fixed;
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0; }
.faint { color: var(--faint); font-size: 12px; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 72px;
  /* 顶部状态栏背景切片 bqbj；深黑兜底防图未加载。放大到 110% 让纹理更清晰 */
  background: var(--topbar-bg) url("/ui/bqbj.png") center center / 100% 100% no-repeat;
  border-bottom: 1px solid rgba(224, 168, 62, 0.18);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; color: #f4e9d0; }
.brand-logo { height: 54px; width: auto; display: block; object-fit: contain; }

/* 顶栏右侧：API 手册按钮（两行：主标题 + 版本小字）*/
.topbar-doc {
  flex-direction: column; align-items: center; gap: 1px;
  line-height: 1.15; padding: 6px 14px; text-align: center;
}
.topbar-doc .doc-sub { font-size: 11px; font-weight: 500; opacity: 0.92; }
/* 竖直分隔线 */
.topbar-divider { width: 1px; height: 26px; background: rgba(224, 168, 62, 0.25); margin: 0 4px; }
/* 用户区：小圆 logo + 用户名 */
.topbar-user { display: inline-flex; align-items: center; gap: 8px; }
.topbar-user-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(224, 168, 62, 0.4); }
.brand-mark {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px;
  border-radius: 10px; color: #fff; background: var(--green);
  font-size: 15px; font-weight: 900; letter-spacing: .2px; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-username { font-size: 14px; font-weight: 600; color: #f4e9d0; }

/* ===== Container ===== */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 60px; }
/* 始终占视口 92% 宽度，最多 1800px：大屏更饱满、少留白，超宽屏不发散 */
.container-wide { max-width: min(92vw, 1800px); }

/* ===== Tab bar ===== */
.tab-bar {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 24px;
}
.tab-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 22px; border: 0; border-radius: var(--radius-sm); background: none;
  font-size: 14px; font-weight: 600; color: rgba(244, 233, 208, 0.95);
  cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap;
}
.tab-btn:hover { color: #f4e9d0; background: rgba(224, 168, 62, 0.1); }
/* 选中态：金色渐变高亮块 + 深色文字 + 光晕（贴合设计稿）*/
.tab-btn-active,
.tab-btn-active:hover { background: var(--gold-grad) !important; color: #1a1408 !important; font-weight: 700; box-shadow: var(--gold-glow); }

/* 顶栏主导航：铺满顶栏高度的方块，选中项金色高光块（贴合原型图）*/
.topbar-tabs {
  display: flex;
  align-self: stretch;
  gap: 0;
  height: 100%;
}
.topbar-tabs .tab-btn {
  position: relative;
  height: 100%;
  padding: 0 40px;
  border-radius: 0;
  font-size: 15px;
  color: rgba(244, 233, 208, 0.95);
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, text-shadow 0.35s ease;
}
.topbar-tabs .tab-btn:hover { background: rgba(224, 168, 62, 0.12); color: #f4e9d0; }
/* 选中态：用设计切片 bqxz 作高光背景（贴合效果图）*/
.topbar-tabs .tab-btn-active,
.topbar-tabs .tab-btn-active:hover {
  background: url("/ui/bqxz.png") center center / 100% 100% no-repeat !important;
  color: #5a4212 !important;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255,255,255,0.55);
}

/* ===== 卡片外标题栏（浮在深色背景上，浅色文字）===== */
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.panel-title { margin: 0 0 8px; font-size: 30px; font-weight: 800; color: #f5ead0; line-height: 1.2; }
.panel-desc { margin: 0; font-size: 14px; line-height: 1.7; color: rgba(245, 234, 208, 0.7); }
/* 卡外「重置」文字按钮：浅色描边，贴深色背景 */
.panel-head-btn {
  flex-shrink: 0; margin-top: 10px;
  background: transparent !important; color: rgba(180,168,140,0.75) !important;
  border: 1px solid rgba(224,168,62,0.45);
}
.panel-head-btn:hover:not(:disabled) { background: rgba(224,168,62,0.12) !important; color: rgba(210,196,160,0.9) !important; }
/* 顶栏「退出」：无边框无底，仅暗色文字 */
.btn-logout {
  background: transparent !important; color: rgba(180,168,140,0.7) !important;
  border: none !important; box-shadow: none !important; padding: 6px 4px !important;
}
.btn-logout:hover:not(:disabled) { background: transparent !important; color: rgba(210,196,160,0.9) !important; }

/* ===== Cards ===== */
.page-card {
  width: 100%; padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.6); border-radius: var(--radius-lg);
  background: var(--card); box-shadow: var(--shadow);
}
.auth-card { max-width: 440px; margin: 72px auto; }
/* 创作区卡片：按需求去掉卡片背景，回归纯卡片底色 */
#tab-create .page-card {
  /* 排查灰边：暂时去掉 bj_2 背景图，只留纯底色 */
  background: var(--card);
  /* 去掉边框与阴影：卡片与深色背景完全平接，四周不再显灰边/投影 */
  border: none;
  box-shadow: none;
  /* 两列内容仅 1304px，卡片收窄到贴合内容并居中，消除左右过多留白 */
  max-width: 1400px; margin-left: auto; margin-right: auto;
}
/* 标题栏（视频Agent + 描述句）与卡片同宽同居中，左侧对齐 */
#tab-create .panel-head {
  max-width: 1400px; margin-left: auto; margin-right: auto;
}
.page-card h1 { margin: 0 0 8px; font-size: 24px; font-weight: 800; line-height: 1.2; }
.page-card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--ink); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 12px; padding: 3px 10px;
  border: 1px solid #d1d5db; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.eyebrow::before {
  content: ""; display: inline-block; width: 7px; height: 7px;
  border-radius: 2px; background: var(--green);
}
.eyebrow:has(.eyebrow-logo)::before { display: none; }
.eyebrow-logo { height: 16px; width: auto; display: block; object-fit: contain; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 0; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
/* 主按钮：金色渐变 + 深色文字 + 金色光晕 */
.btn-primary { background: var(--gold-grad); color: #1a1408; box-shadow: var(--gold-glow); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-secondary { background: var(--green-soft2); color: var(--green-dark); border: 1px solid var(--green-border); }
.btn-secondary:hover:not(:disabled) { background: var(--green-soft); }
.btn-ghost { background: var(--input-bg); color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--border); }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ===== Forms ===== */
.form-stack { display: grid; gap: 18px; }

/* 生成页两列：左①-④（更宽），右⑤ */
/* 两列各按内容宽度、整体居中：左右边距对称，中间间隙固定，不再有超宽空白带 */
.create-grid { display: grid; grid-template-columns: 680px 560px; justify-content: center; gap: 64px; align-items: stretch; }
.create-col { display: grid; gap: 18px; align-content: start; min-width: 0; }
/* 右栏改用弹性纵向布局：参考素材在上，生成动作区靠 margin-top:auto 顶到底，与左栏画面比例齐平 */
.create-col:last-child { display: flex; flex-direction: column; gap: 18px; }
/* ②描述画面、③视频时长 收窄到与①④卡片群相近宽度，不再满宽撑满整列 */
.narrow-field { max-width: 640px; }
/* 中等偏窄屏就回退单列，避免两列硬挤（参考素材列被压窄） */
@media (max-width: 960px) { .create-grid { grid-template-columns: 1fr; } }
.form-field { display: grid; gap: 6px; }
.form-label { font-size: 13px; font-weight: 700; color: #3a4250; }
/* 生成页一级字段标题放大（不影响参考素材内的子标签）*/
.create-col > .form-field > .form-label,
.create-col > .form-field > .model-head > .form-label { font-size: 17px; font-weight: 800; color: var(--ink); }
.form-input, .form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--ink); background: var(--input-bg); font-size: 14px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.form-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
/* 「描述你想要的画面」输入框底色：淡灰 */
#prompt { background: #f0f0f2; }
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(224, 168, 62, 0.15); }
.form-hint { margin: 4px 0 0; font-size: 12px; color: var(--faint); }
.form-error { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: #c0392b; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3a4250; cursor: pointer; }

/* ===== Choice chips (model / duration / ratio) ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; color: #3a4250; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--green-border); }
.chip-active { border-color: var(--green) !important; background: var(--green-soft) !important; color: var(--green-dark) !important; box-shadow: 0 0 0 1px var(--green) inset; }
.chip:disabled, .chip[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* model card chip: 文字卡（切片拼写有误，弃用切片方案，还原文字样式） */
.model-chip { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 130px; padding: 11px 14px; }
.model-chip .model-title { font-size: 14px; font-weight: 800; }
.model-chip .model-sub { font-size: 12px; font-weight: 500; color: var(--faint); }

/* 版本切换（face版 / 官方版）：分段控件样式 */
.version-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.version-tab {
  padding: 7px 20px; border: none; background: transparent; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.version-tab:hover { color: var(--green-dark); }
.version-tab-active { background: var(--gold-grad) !important; color: #1a1408 !important; }
.model-chip.chip-active .model-sub { color: var(--green-dark); }

/* “① 选择模型”标题行：label 左对齐，版本切换居中，右侧留空平衡 */
.model-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  margin-bottom: 10px;
}
.model-head .form-label { margin: 0; }
.model-head .version-tabs { grid-column: 2; margin: 0; justify-self: center; }

/* duration slider */
.slider-row { display: flex; align-items: center; gap: 16px; }
.slider-row input[type="range"] {
  flex: 1; height: 6px; border-radius: 999px; appearance: none; -webkit-appearance: none;
  /* 已拖过区域用橙→金渐变，右侧未拖区域灰底；--fill 由 JS 按当前值百分比更新 */
  background:
    linear-gradient(90deg, #ff7a1a 0%, #e0a83e 100%) 0 / var(--fill, 0%) 100% no-repeat,
    var(--border);
  outline: none; cursor: pointer;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 26px; height: 26px;
  background: url("/ui/spsc.png") center center / contain no-repeat; border: none; cursor: pointer;
}
.slider-row input[type="range"]::-moz-range-thumb {
  width: 26px; height: 26px;
  background: url("/ui/spsc.png") center center / contain no-repeat; border: none; cursor: pointer;
}
.slider-num { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.slider-num .form-input { width: 68px; text-align: center; font-size: 16px; font-weight: 700; padding: 8px 6px; }
.slider-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--faint); margin-top: 2px; }

/* ratio chip with visual icon */
.ratio-chip { flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; min-width: 76px; }
.ratio-glyph-box { display: flex; align-items: flex-end; justify-content: center; height: 24px; }
.ratio-glyph { border: 2px solid currentColor; border-radius: 3px; opacity: 0.7; }
.ratio-chip.chip-active .ratio-glyph { opacity: 1; }

/* ===== Form section (collapsible advanced) ===== */
.form-section {
  padding: 16px; border: none; border-radius: 12px;
  /* 透明+无边框，与卡片 bj_2 背景连成一体 */
  background: transparent; display: grid; gap: 12px;
}
.form-section-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; background: none; border: none; cursor: pointer; padding: 0;
  font-size: 13px; font-weight: 700; color: #314057;
}
.section-chevron { font-size: 10px; color: var(--faint); transition: transform 0.15s; }
.section-open .section-chevron { transform: rotate(90deg); }

/* url input rows */
.url-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.url-row .form-input { flex: 1; }
.url-add { align-self: flex-start; }
/* 参考素材：两个添加按钮并排（链接 / 上传本地） */
.media-add-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 参考素材容器：允许一行横向排多个文件 */
.url-list { display: flex; flex-wrap: wrap; gap: 12px; }
.url-list .url-row { margin-bottom: 0; }
/* 输入态整行独占（换行占满一行） */
.url-list .url-row:not(.url-row-preview) { flex: 1 1 100%; }

/* 预览态：紧凑卡片，媒体 + 下方红色小叉，可多个并排 */
.url-row-preview {
  flex: 0 0 auto; flex-direction: column; align-items: center; gap: 4px;
}
.media-preview {
  width: 120px; height: 90px; border-radius: 8px; overflow: hidden;
  background: #0f1115; display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-size: 18px; text-align: center;
}
.media-preview { position: relative; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }
.media-play {
  position: absolute; inset: 0; margin: auto;
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding-left: 2px;
}
.media-play:hover { background: rgba(0,0,0,0.75); }
.media-preview.media-audio { background: var(--green-soft); }
.media-preview .audio-icon {
  border: none; background: none; cursor: pointer;
  color: var(--green-dark); font-size: 34px; line-height: 1; padding: 0;
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
}
.media-preview .audio-icon:hover { color: var(--green); }
.media-preview.media-broken { background: #fff0f0; color: #b42318; }
.media-del {
  border: none; background: none; cursor: pointer; padding: 2px;
  color: #dc2626; font-size: 15px; line-height: 1; font-weight: 700;
}
.media-del:hover { color: #b42318; }

/* ✂ 裁剪按钮（预览卡右上角） */
.media-trim {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.55); color: #fff;
  border: none; border-radius: 4px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.media-trim:hover { background: rgba(0,0,0,0.8); }

/* 上传中态：柔和底色 + spinner + 文件名截断 */
.media-preview.uploading { background: #f4f6fb; color: var(--muted); }
.uploading-inner {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 100%; padding: 0 6px; box-sizing: border-box;
}
.upload-name {
  font-size: 11px; color: var(--muted); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 待处理态：本地预览 + 文件名 + [裁剪][直接上传] 按钮 */
.url-row-pending { min-width: 160px; }
.pending-name {
  font-size: 11px; color: var(--muted); max-width: 140px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.pending-actions {
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
}
/* 时长超限警告（视频 pending 卡） */
.pending-duration-warn {
  font-size: 11px; color: #b42318; max-width: 160px;
  text-align: center; line-height: 1.3;
  display: none;
}
.pending-duration-warn.show { display: block; }

/* 上传进度遮罩（覆盖在 media 元素上） */
.upload-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
}

/* ===== 生成动作区（右栏底部：花费/余额 + 立即生成小按钮，右对齐）===== */
.submit-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-top: auto;
  padding-top: 18px; border-top: 1px solid var(--border);
}
.submit-cost { display: grid; gap: 4px; }
.submit-cost-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.submit-cost-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.submit-cost-main .v { font-size: 32px; font-weight: 800; color: var(--green-dark); line-height: 1; }
.submit-cost-main .v.warn { color: #b45309; }
.submit-cost-bal { font-size: 13px; color: var(--muted); font-weight: 600; }
/* 立即生成：金色小按钮（非满宽），贴合原型图右下角 */
.submit-btn { padding: 12px 34px; font-size: 15px; border-radius: 999px; flex-shrink: 0; }
/* 立即生成按钮：用设计切片 ljsc（成品图含文字），覆盖 .btn-primary 的金色渐变 */
#submitBtn.submit-btn {
  width: 158px; height: 67px; padding: 0; border: none; border-radius: 0;
  background: url("/ui/ljsc.png") center center / contain no-repeat !important;
  box-shadow: none !important; font-size: 0; color: transparent;
  /* 按钮单独下移一点 */
  position: relative; top: 12px;
}
#submitBtn.submit-btn:hover:not(:disabled) { filter: brightness(1.05); }

/* ===== Estimate bar ===== */
.estimate-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
  margin-top: 8px; padding: 14px 18px;
  border: 1px solid var(--green-border); border-radius: var(--radius-md);
  background: var(--green-soft2);
}
.estimate-item { display: flex; align-items: center; gap: 10px; }
.estimate-item .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.estimate-item .v { font-size: 20px; font-weight: 800; color: var(--green-dark); line-height: 1.1; }
.estimate-item .v.warn { color: #b45309; }

/* ===== Stat row (balance page) ===== */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-card {
  padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--input-bg); display: grid; gap: 4px;
}
.stat-card .label { font-size: 12px; color: var(--faint); font-weight: 600; }
.stat-card .value { font-size: 26px; font-weight: 900; color: var(--ink); line-height: 1.1; }
.stat-card.accent .value { color: var(--green-dark); }

/* ===== Work grid (my creations) ===== */
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.work-card {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: #fff; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 2px 8px rgba(23,32,51,0.04);
  max-width: 420px; width: 100%;
}
.work-media {
  position: relative; width: 100%; height: 200px; flex-shrink: 0;
  background: #0f1115; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.work-media video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
.work-media-placeholder { color: var(--faint); font-size: 13px; text-align: center; padding: 12px; }
.work-body { padding: 14px 16px; display: grid; gap: 8px; }
.work-title { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.4; word-break: break-word; }
.work-id { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-meta { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--faint); }
.work-actions { display: flex; gap: 8px; margin-top: 2px; }

/* ===== Badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-green { background: var(--green-soft); color: var(--green-dark); }
.badge-red { background: #fff0f0; color: #b42318; }
.badge-gray { background: var(--bg); color: var(--muted); }
.badge-yellow { background: #fffbeb; color: #b45309; }
.badge-blue { background: #e3f2fd; color: #1565c0; }

/* ===== Spinner ===== */
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--green); border-radius: 50%;
  display: inline-block; animation: spin 0.7s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  z-index: 300; padding: 12px 22px; border-radius: var(--radius-sm);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25); animation: toast-in 0.2s ease;
}
.toast-error { background: #b42318; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== 圆形图标按钮（顶栏） ===== */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--green-border);
  border-radius: 50%; background: var(--green-soft2); color: var(--green-dark);
  font-size: 17px; line-height: 1; cursor: pointer;
  transition: background 0.15s, transform 0.3s;
}
.icon-btn:hover { background: var(--green-soft); }
.icon-btn:active { transform: rotate(180deg); }

/* ===== 弹框 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(23, 32, 51, 0.45); animation: overlay-in 0.15s ease;
}
.modal-card {
  width: 100%; max-width: 420px; background: var(--card);
  border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow);
  animation: modal-in 0.2s ease;
}
.modal-card h2 { margin: 0 0 10px; font-size: 19px; font-weight: 800; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.key-box {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--input-bg); border: 1px dashed var(--green-border);
}
.key-box code {
  font-family: ui-monospace, Consolas, monospace; font-size: 14px;
  color: var(--ink); word-break: break-all; line-height: 1.6;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Empty / loading ===== */
.empty { text-align: center; padding: 60px 20px; color: var(--faint); font-size: 14px; }

/* ===== Data table ===== */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table th { background: var(--input-bg); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table td { color: #314057; font-size: 14px; }
.data-table tbody tr:hover td { background: var(--input-bg); }
.nowrap { white-space: nowrap; }

/* ===== Stat inline (overview): 标签在左、数值在右 ===== */
.stat { display: inline-flex; align-items: center; gap: 8px; margin-right: 32px; }
.stat .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 800; color: var(--green-dark); line-height: 1.1; }

/* ===== Row helper ===== */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ===== Pagination ===== */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 20px; }
.pagination .info { font-size: 13px; color: var(--muted); }

/* ===== Trim panel (裁剪面板) ===== */
.url-row-trimming {
  flex: 0 0 auto; flex-direction: column; align-items: stretch;
  min-width: 360px; max-width: 420px;
}
.trim-panel {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px; border: 1px solid var(--green-border);
  border-radius: var(--radius-md); background: var(--green-soft2);
}
.trim-preview {
  width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden;
  background: #0f1115; display: flex; align-items: center; justify-content: center;
}
.trim-player { width: 100%; height: 100%; object-fit: contain; background: #000; }

.trim-timeline { position: relative; }
.trim-strip {
  position: relative; width: 100%; height: 60px; border-radius: 4px;
  overflow: hidden; background: #e5e7eb;
}
.trim-strip-inner {
  position: absolute; inset: 0; display: flex; gap: 1px;
}
.trim-strip-inner img {
  flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover;
}
.trim-waveform { width: 100%; height: 100%; display: block; }

.trim-dim {
  position: absolute; top: 0; bottom: 0; background: rgba(0, 0, 0, 0.45);
  pointer-events: none; transition: width 0.05s linear;
}
.trim-dim-left  { left: 0; }
.trim-dim-right { right: 0; }

.trim-handles { position: absolute; inset: 0; pointer-events: none; }
.trim-handle {
  position: absolute; top: 0; bottom: 0; width: 10px;
  background: var(--green); border: 2px solid #fff; border-radius: 3px;
  cursor: ew-resize; pointer-events: auto;
  transform: translateX(-50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.trim-handle:hover { background: var(--green-dark); }

.trim-times {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.trim-field { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.trim-input {
  width: 70px !important; padding: 4px 6px !important;
  font-size: 12px !important; text-align: center;
}
.trim-duration { margin-left: auto; font-weight: 600; color: var(--green-dark); }
.trim-duration.over { color: #b42318; }

.trim-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.trim-progress {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.trim-progress-bar {
  flex: 1; height: 4px; background: #e5e7eb; border-radius: 2px; overflow: hidden;
}
.trim-progress-bar::before {
  content: ''; display: block; height: 100%;
  width: 30%; background: var(--green);
  animation: trim-progress-indeterminate 1.2s infinite ease-in-out;
}
.trim-progress-text { white-space: nowrap; }
@keyframes trim-progress-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .container { padding: 20px 14px 48px; }
  .page-card { padding: 20px; border-radius: 16px; }
  .stat-cards { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
}
