/* Minus-AI Internal Tools — styles.css
   Lifted from mockup v0.6 (品牌蓝 #278fce). Keep tokens; trim history/video sections
   until those tabs land. */

:root {
  --brand-blue:    #278fce;
  --brand-blue-d:  #1f7fb8;
  --brand-blue-dd: #1a6ea0;
  --brand-blue-l:  #e6f3fc;
  --brand-blue-l2: #d1e8f7;
  --ink-1:         #0f172a;
  --ink-2:         #475569;
  --ink-3:         #94a3b8;
  --line:          #e2e8f0;
  --line-2:        #cbd5e1;
  --bg:            #f7f9fc;
  --bg-card:       #ffffff;
  --bg-soft:       #f1f5f9;
  --warn-ink:      #9a3412;
  --err-bg:        #fff1f0;
  --err-ink:       #b91c1c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--ink-1); font-size: 14px;
}
a { color: inherit; text-decoration: none; }

/* ============================================================
   Top nav — Linda v3 + Option B 2026-05-26 全站统一升级:
   Fraunces serif logo + italic slogan + admin 区右侧分组.
   只升级 nav 视觉, 正文 (panel/form/卡片) 完全不动.
   ============================================================ */

/* Logo wrap: 左侧 "Minus-AI Internal" + 下方 slogan */
.logo-box {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.logo-text-wrap {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-text {
  font-family: "Fraunces", Georgia, "Songti SC", serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink-1);
  font-variation-settings: "opsz" 48;
}
.logo-text em {
  font-style: italic;
  color: var(--brand-blue);
  font-weight: 400;
}
.logo-slogan {
  font-family: "Fraunces", Georgia, "Songti SC", serif;
  font-style: italic;
  font-weight: 350;
  font-size: 11px;
  letter-spacing: 0.005em;
  color: var(--brand-blue-dd);
  margin-top: 1px;
  font-variation-settings: "opsz" 18;
  white-space: nowrap;
}

.topnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex; align-items: center; height: 64px;
  gap: 6px;
  /* 标签多/窄屏装不下时: 横向滚动 (白底始终盖住可见区, 不让溢出标签漏到框外没衬底) */
  overflow-x: auto; overflow-y: hidden;
}
.topnav .logo-box { margin-right: 24px; flex-shrink: 0; }

/* tabs container (使用功能 left + admin right) */
.tabs { display: flex; gap: 4px; }
.tabs-user { /* 默认 */ }
.tabs-admin { /* 右侧 admin 区 */ }
.nav-spacer { flex: 1; }
.nav-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 6px;
}

.tab {
  padding: 8px 11px; border-radius: 6px; cursor: pointer; white-space: nowrap;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tab:hover { background: var(--bg-soft); color: var(--ink-1); }
.tab.active { background: var(--brand-blue-l); color: var(--brand-blue); }

/* Admin ▾ 下拉 (Linda 2026-07-15 feat/nav-admin-menu):
   原 6 个平铺 admin tab (Progress/Log/Showroom Label/Permission/API) 收进一个下拉, 省窄屏空间。
   面板 admin_menu.js 会 portal 到 <body> + position:fixed 定位 —— .topnav 带 backdrop-filter
   会成为 fixed 的包含块并按其 overflow 裁剪, 面板留在 nav 里会被裁掉 (肉眼看不见)。 */
.admin-menu { position: relative; flex-shrink: 0; display: inline-flex; }
/* .admin-trigger 是 <button>: 去掉原生按钮的 border/background (那个"黑框") — 其余走 .tab */
.admin-trigger {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.admin-trigger:focus { outline: none; }
.admin-trigger:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.admin-trigger .caret { font-size: 9px; color: var(--ink-3); transition: transform 0.15s; }
.admin-menu.open .admin-trigger { background: var(--bg-soft); color: var(--ink-1); }
.admin-menu.open .admin-trigger .caret { transform: rotate(180deg); color: var(--ink-2); }
/* 子项 active (当前在下拉里某页) 时 Admin 高亮; open 时叠深一档 */
.admin-trigger.has-active { background: var(--brand-blue-l); color: var(--brand-blue); }
.admin-trigger.has-active .caret { color: var(--brand-blue); }
.admin-menu.open .admin-trigger.has-active { background: var(--brand-blue-l2); }

.admin-panel {
  position: fixed;                 /* top/left 由 admin_menu.js 按 trigger 定位 */
  min-width: 168px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10), 0 2px 6px rgba(15, 23, 42, 0.05);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 60;                     /* 高于 .topnav 的 z-index:50 */
}
.admin-panel.open { display: flex; }   /* portal 到 body 后不再是 .admin-menu 后代, 用面板自身类 */
.admin-item {
  padding: 9px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; cursor: pointer;
  transition: background 0.12s, color 0.12s;
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.admin-item:hover { background: var(--bg-soft); color: var(--ink-1); }
.admin-item.active { background: var(--brand-blue-l); color: var(--brand-blue); }

.id-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--ink-2);
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.id-chip .letter-badge {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 11px;
}

.logout-form { margin-left: 4px; display: inline-block; }
.logout-btn {
  padding: 5px 12px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 99px;
  background: transparent;
  border: 1px solid var(--line);
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: all 0.15s;
}
.logout-btn:hover {
  color: var(--ink-1);
  border-color: var(--line-2);
  background: var(--bg-soft);
}

/* Pages */
.page { max-width: 1600px; margin: 0 auto; padding: 28px 32px; }

/* Two-col gen layout */
.gen-layout { display: grid; grid-template-columns: 480px 1fr; gap: 24px; }
.panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.panel-title { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 16px;
               text-transform: uppercase; letter-spacing: 1px; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-label { display: block; font-size: 13px; color: var(--ink-1);
              margin-bottom: 8px; font-weight: 500; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink-1);
  transition: border 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(39, 143, 206, 0.15);
}
.form-textarea { resize: vertical; min-height: 120px; max-height: 600px; }
.form-select option:disabled { color: var(--ink-3); background: var(--bg-soft); }
.help-text { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.help-text.warn { color: var(--warn-ink); }

/* ── 生音频页「音频 / 音乐」模式 (Mureka, mock v4 Linda 2026-07-21 拍板) ── */
/* 顶部大切换 */
.mode-top { display: inline-flex; border: 1px solid var(--line); border-radius: 10px;
            overflow: hidden; margin-bottom: 16px; background: var(--bg-soft); }
.mode-top button { border: 0; background: transparent; padding: 9px 22px; font-size: 14px;
                   font-weight: 600; color: var(--ink-2); cursor: pointer; font-family: inherit; }
.mode-top button.on { background: #fff; color: var(--brand-blue);
                      box-shadow: inset 0 -2px 0 var(--brand-blue); }
/* 三模式分段按钮 (音乐专用; TTS 的音色 seg 仍在其自己的 inline 样式) */
.mseg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line);
        border-radius: 8px; overflow: hidden; }
.mseg button { border: 0; background: transparent; padding: 7px 14px; font-size: 13px;
               color: var(--ink-2); cursor: pointer; font-family: inherit; }
.mseg button.on { background: var(--brand-blue); color: #fff; }
/* 风格 chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 13px;
        font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.chip.on { background: var(--brand-blue-l); border-color: var(--brand-blue);
           color: var(--brand-blue-d); font-weight: 600; }
/* 水印告知常驻行 (表单) */
.wm-note { font-size: 12px; line-height: 1.6; margin: -4px 0 14px; padding: 9px 11px;
           background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; color: #9a3412; }
/* 水印徽章 (结果卡) —— 只在 watermarked=true 时由 JS 加 */
.wm-badge { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
            border-radius: 4px; padding: 0 6px; font-size: 11px; white-space: nowrap; }

/* Ref thumbs */
.ref-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  padding: 6px; border-radius: 8px; border: 2px dashed transparent;
  transition: border-color 0.15s, background 0.15s;
}
.ref-grid.dragover { border-color: var(--brand-blue); background: var(--brand-blue-l); }
.ref-thumb {
  aspect-ratio: 1; border: 1px dashed var(--line-2); border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 18px; cursor: pointer; background: var(--bg-soft);
  transition: all 0.15s; overflow: hidden;
  /* B7-1 hotfix (2026-05-25 Linda): MUST be `position: relative` so the
     × button (.ref-clear-btn { position: absolute }) anchors to the slot
     instead of cascading to <body>. Without this the absolute button
     positions outside the .ref-thumb box AND gets clipped by overflow:hidden
     above — Linda hit this 2026-05-25 (× completely invisible). */
  position: relative;
}
.ref-thumb:hover { border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.ref-grid.dragover .ref-thumb:not(.has-img) { border-color: var(--brand-blue); }
.ref-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* B2-1 (Linda 2026-05-21): the HTML5 `hidden` attribute should hide the element,
 * but our `.ref-thumb { display: flex }` and `.audio-slot { display: flex }`
 * CSS rules override it. Add an !important display:none override scoped to the
 * elements we actually hide. Fixes the bug where all 10 ref slots showed at once. */
.ref-thumb[hidden], .audio-slot[hidden], [hidden] { display: none !important; }

/* B2-1 (Linda 2026-05-21): expand button — icon-only, double-down chevron.
 * Round, subtle, sits centered below the visible 5 slots. */
.ref-expand-btn {
  margin: 8px auto 0; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 28px; padding: 0;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  border-radius: 14px; cursor: pointer; font-size: 14px; line-height: 1;
  transition: all 0.15s;
}
.ref-expand-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue); background: var(--brand-blue-l); }
.ref-expand-btn::before { content: "⌄"; font-size: 18px; transform: translateY(-3px); }
.ref-expand-btn[data-expanded="true"]::before { content: "⌃"; transform: translateY(2px); }
/* 2026-08-29: 让展开按钮跟随 .audio-ref-grid 的 360px 宽度居中, 而不是在整行里居中。
 * (按钮本身的 `margin: 8px auto 0` 是相对**父容器**居中的, 父容器满宽就会飘到页面中间。) */
.ref-expand-row { max-width: 360px; }

/* B2-4 (Linda 2026-05-21): 音频参考 picker — 3 square slots, icon-only when empty.
 * Mirrors the .ref-thumb aspect 1 / dashed border / hover-blue look so they pair
 * visually with the image reference grid above. */
.audio-ref-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px;
  max-width: 360px;  /* matches three ~120px slots; keeps audio row compact */
}
.audio-slot {
  aspect-ratio: 1; padding: 0;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px dashed var(--line-2); border-radius: 6px;
  background: var(--bg-soft); color: var(--ink-3);
  cursor: pointer; transition: all 0.15s; overflow: hidden;
  position: relative;
}
.audio-slot:hover { border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.audio-slot.has-file { border-style: solid; border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.audio-slot .audio-plus { font-size: 20px; line-height: 1; }
.audio-slot .audio-icon { font-size: 22px; line-height: 1; }
/* When a file is chosen, show its name in place of the +/♪ pair */
.audio-slot.has-file .audio-plus,
.audio-slot.has-file .audio-icon { display: none; }
.audio-slot .audio-name {
  font-size: 11px; padding: 0 6px; text-align: center;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  word-break: break-all;
}
/* has-file 时切换成竖向布局: filename 在上 + <audio controls> 在下 (Linda 2026-06-06 预览) */
.audio-slot.has-file { flex-direction: column; aspect-ratio: auto; padding: 8px 8px 6px; gap: 6px; }
.audio-slot .audio-inline-player { width: 100%; height: 32px; }

/* B2-5 (Linda 2026-05-25): 视频参考 picker — 单 slot，宽矩形（不是正方形，因为
 * 显示的是"▶ filename.mp4 · 12s" 的横向元数据 row）。视觉融入"音频参考"风格，
 * border-radius / 颜色 / hover 行为对齐。 */
.video-ref-wrap {
  max-width: 360px;
  margin-top: 4px;
}
.video-ref-slot {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line-2); border-radius: 6px;
  background: var(--bg-soft); color: var(--ink-3);
  cursor: pointer; transition: all 0.15s;
  position: relative;
  min-height: 44px;
}
.video-ref-slot:hover { border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.video-ref-slot.has-file { border-style: solid; border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.video-ref-slot .video-ref-plus { font-size: 18px; line-height: 1; }
.video-ref-slot .video-ref-icon { font-size: 16px; line-height: 1; }
.video-ref-slot.has-file .video-ref-plus { display: none; }
.video-ref-slot.has-file .video-ref-icon { display: inline; color: var(--brand-blue); }
.video-ref-slot .video-ref-name {
  font-size: 12px; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-ref-slot .video-ref-meta {
  font-size: 11px; color: var(--ink-3); flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.video-ref-slot.has-file .video-ref-meta { color: var(--brand-blue); }
.audio-slot.has-file .audio-name { display: -webkit-box; }

/* 多槽参考视频: 有缩略图时改成「画面铺满 + 名字压底」(Linda 2026-09-02 拍板 A 案)。
 * 起因: 那个槽一直是"有文件就把 ＋/▶ 换成文件名两行截断" —— 上传 abc.mp4 看不出问题,
 * 而库里的素材名是从 prompt 生成的长名字, 截断后就是一坨字 (Linda 截图)。
 * 🔴 只在 .has-thumb 时生效 —— 音频槽也用 .audio-slot, 它有内嵌播放器, 不能被这套压掉。 */
/* 🔴 选择器带**容器前缀** (codex 2026-09-02 minor): 音频槽也是 .audio-slot, 光靠
 * 「调用方只给多槽视频传 cfg.thumb」是运行时约定, CSS 自己没兑现注释说的收窄 ——
 * 哪天别处给音频槽加上 has-thumb, 这套版式就会把内嵌播放器压掉。 */
#vid-video-multi-grid .audio-slot.has-file.has-thumb {
  padding: 0; aspect-ratio: 1; flex-direction: row; gap: 0;
  background: #000; border-color: var(--brand-blue);
}
#vid-video-multi-grid .audio-slot.has-thumb .slot-thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
#vid-video-multi-grid .audio-slot.has-file.has-thumb .audio-name {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 10px 6px 4px; margin: 0; text-align: left; color: #fff;
  -webkit-line-clamp: 1; word-break: break-all;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}


/* Single-slot (首帧 / 尾帧) — inherits .ref-thumb visuals (square + dashed border),
   capped width so it looks like a thumbnail not a full-width cell.
   B7-1 hotfix (2026-05-25): position:relative so × button anchors correctly. */
.single-slot { max-width: 130px; position: relative; }
.single-slot.dragover { border-color: var(--brand-blue); background: var(--brand-blue-l); }

/* Video card extras (used on /video) */
.img-card-image.video-bg {
  background: linear-gradient(135deg, #1e3a5f, #0c1d33); position: relative;
}
.vid-badge {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-variant-numeric: tabular-nums;
}
/* B4-1: 视频标签（"原版" / "擦除版"）— 左上角，避开 vid-badge 时长右下角 */
.img-card-label {
  position: absolute; top: 8px; left: 8px;
  background: rgba(39, 143, 206, 0.92); color: #fff;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.erase-controls {
  padding: 12px 0 0 0;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
/* (old `.lightbox video` rule removed 2026-05-22 — replaced by shared
    `.lb-content video` in the lightbox component below) */
.ref-thumb.has-img {
  border: 1px solid var(--brand-blue-l2); color: #fff;
  background: linear-gradient(135deg, var(--brand-blue-l2), var(--brand-blue));
  font-size: 11px; font-weight: 600;
}
.ref-thumb.has-img img { width: 100%; height: 100%; object-fit: cover; }
.ref-thumb input[type=file] { display: none; }
.ref-thumb .x-btn {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  background: rgba(15,23,42,0.7); color: #fff; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
}

/* Buttons */
.btn-primary {
  padding: 11px 24px; background: var(--brand-blue); color: #fff;
  border: none; border-radius: 6px; font-weight: 600; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
  width: 100%;
}
.btn-primary:hover { background: var(--brand-blue-d); }
.btn-primary:active { background: var(--brand-blue-dd); }
.btn-primary:disabled { background: var(--ink-3); cursor: not-allowed; }
.btn-secondary {
  padding: 6px 14px; background: #fff; color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 5px;
  cursor: pointer; font-size: 12px; font-family: inherit;
}
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--line-2); }
.btn-outline {
  width: 100%; padding: 9px 16px; background: #fff; color: var(--brand-blue);
  border: 1px solid var(--brand-blue-l2); border-radius: 6px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit; margin-top: 14px;
}
.btn-outline:hover { background: var(--brand-blue-l); }

/* Output state */
.output-state {
  background: var(--brand-blue-l); border-radius: 8px; padding: 18px 20px;
  display: flex; gap: 14px; align-items: center; font-size: 13px;
  color: var(--ink-1); margin-bottom: 16px;
}
.output-state.error { background: var(--err-bg); color: var(--err-ink); }
.output-state.warn { background: #fef9e7; color: #6b5b18; }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--brand-blue-l2);
  border-top-color: var(--brand-blue); border-radius: 50%;
  animation: spin 0.85s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.output-state code { background: #fff; padding: 1px 6px; border-radius: 3px;
                     font-size: 12px; color: var(--ink-1); }

/* Image cards */
.output-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
/* 视频结果区: **上下一列** (Linda 2026-09-04 拍板, mock video_batch_n_layout_mock.html)。
   🔴 **不改 `.output-grid` 本身** —— 那个类 `templates/image.html:154` 也在用,
   动它会把图片页一起变成一列 (图片页 Linda 明确说不改)。共享 class 的老陷阱, 见
   CLAUDE.md「CSS 5 个 corner 元素冲突」同族: 改共用样式前先 grep 谁在用。 */
.output-grid-stack { grid-template-columns: 1fr; }
/* 卡片**不拉满整列**, 宽度取「图片页两列时那一张的宽度」(Linda 2026-09-04:
   「就是现在图片网页端显示的宽度和高度」)。写成 calc 而不是写死 px, 是为了让它
   跟着 `.output-grid` 的 gap 与容器宽度自动一致 —— 哪天改栅格, 这里不用跟着改。
   高度仍由 JS 按**真实画幅**设 `aspect-ratio`(9:16 竖版就是竖的), 不像图片页那样
   强制成 1:1 裁切 —— 视频裁掉画面比图片更伤。
   🔴 不这么限宽的话: 结果区 1032px 宽 × 默认 9:16 → 单个视频 1835px 高,
   一屏连一个都看不全 (mockup/video_batch_n_stack_width.html 按真实比例画过)。 */
.output-grid-stack > .img-card { max-width: calc((100% - 14px) / 2); }
.img-card { background: #fff; border: 1px solid var(--line); border-radius: 8px;
            overflow: hidden; }
.img-card-image {
  aspect-ratio: 1; width: 100%; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 14px;
}
.img-card-image img { width: 100%; height: 100%; object-fit: cover; display: block;
                      cursor: zoom-in; }
.img-card-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; font-size: 12px; color: var(--ink-2);
}
.img-card-meta .actions { display: flex; gap: 6px; }

/* User-id badges 1-10 (v1.6 2026-05-21: renamed from letter A-J, palette unchanged) */
.badge-1  { background: #d94f4f; }
.badge-2  { background: #e57a3c; }
.badge-3  { background: #d9a64a; }
.badge-4  { background: #5e9b40; }
.badge-5  { background: #3aa5a0; }
.badge-6  { background: var(--brand-blue); }
.badge-7  { background: #7b5ed1; }
.badge-8  { background: #c95e9e; }
.badge-9  { background: #64748b; }
.badge-10 { background: #8a5530; }

/* ============== History ============== */
.history-header { display: flex; justify-content: space-between; align-items: flex-start;
                  margin-bottom: 18px; gap: 24px; flex-wrap: wrap; }

.sub-tabs { display: flex; gap: 2px; background: #fff; padding: 4px;
            border-radius: 8px; border: 1px solid var(--line); }
.sub-tab  { padding: 7px 18px; border-radius: 6px; cursor: pointer;
            font-size: 13px; color: var(--ink-2); font-weight: 500; }
.sub-tab.active { background: var(--ink-1); color: #fff; }

.stats-panel { background: #fff; border: 1px solid var(--line); border-radius: 10px;
               padding: 14px 18px; min-width: 480px; }
.stats-row    { display: grid; grid-template-columns: 80px 1fr 1fr 1fr;
                gap: 10px; font-size: 12px; align-items: center; }
.stats-row.header { color: var(--ink-3); font-weight: 500; margin-bottom: 8px; }
.stats-row.data   { font-size: 14px; }
.stats-row .scope { font-weight: 600; color: var(--ink-1); }
.stats-row .num   { font-variant-numeric: tabular-nums; color: var(--ink-1); }
.stats-row .num .pic  { color: var(--brand-blue); font-weight: 600; }
.stats-row .num .vid  { color: #b45e2f; font-weight: 600; margin-left: 8px; }
.stats-row .num .unit { color: var(--ink-3); font-weight: 400; font-size: 12px; margin-left: 2px; }

/* 统计面板来源切档 (2026-08-19 Linda 拍板 C 案四按钮 · 拍板件
   mockup/history_stats_source_split_mock.html)。放在数字行与用户 chip 分隔线之间。 */
.src-toggle { display: inline-flex; gap: 2px; background: var(--bg-soft);
              border-radius: 999px; padding: 2px; margin-top: 10px; }
.src-btn { padding: 3px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
           color: var(--ink-2); cursor: pointer; border: none; background: transparent;
           font-family: inherit; }
.src-btn:hover { color: var(--ink-1); }
.src-btn.active { background: #fff; color: var(--ink-1); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
/* 老后端无 by_source 时禁用单档按钮 (见 history.js syncSourceToggleAvailability) */
.src-btn:disabled { opacity: .4; cursor: not-allowed; }
.src-btn:disabled:hover { color: var(--ink-2); }

.user-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px;
              padding-top: 12px; border-top: 1px solid var(--line); }
.user-chip  { padding: 4px 10px; border-radius: 999px; font-size: 12px;
              cursor: pointer; background: var(--bg-soft);
              border: 1px solid transparent; color: var(--ink-2); font-weight: 600;
              transition: all 0.15s; }
.user-chip:hover { background: var(--brand-blue-l); color: var(--brand-blue); }
.user-chip.active { background: var(--ink-1); color: #fff; }
.user-chip.all    { padding: 4px 12px; }

/* Disk usage banner (warning when > 80%) */
.disk-banner {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #92400e;
  display: flex; align-items: center; gap: 10px;
}
.disk-banner.critical { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.disk-banner .meter { display: inline-block; width: 120px; height: 8px;
                      background: #f5e6c8; border-radius: 4px; overflow: hidden; }
.disk-banner.critical .meter { background: #fee2e2; }
.disk-banner .meter-fill { height: 100%; background: #d97706; }
.disk-banner.critical .meter-fill { background: #dc2626; }

.history-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; padding: 10px 16px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.toolbar-left  { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-1); flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 12px; }
.toolbar-sep   { color: var(--line-2); margin: 0 4px; }
.page-summary  { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.checkbox-large { width: 16px; height: 16px; accent-color: var(--brand-blue); cursor: pointer; }

.btn-secondary {
  padding: 7px 14px; border: 1px solid var(--line-2); background: #fff;
  border-radius: 6px; font-size: 13px; color: var(--ink-1); cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); }
.btn-secondary:disabled { color: var(--ink-3); cursor: not-allowed; border-color: var(--line); }

.history-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.history-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; cursor: pointer; transition: all 0.15s; position: relative;
}
.history-card:hover { border-color: var(--brand-blue); box-shadow: 0 4px 12px rgba(39,143,206,0.10); }
.history-card.selected { border-color: var(--brand-blue); box-shadow: 0 0 0 2px rgba(39,143,206,0.25); }
/* B1-2 (Linda 2026-05-21): failed = red border, NO opacity overlay, NO "失败" text badge */
.history-card.failed         { border-color: #dc2626; box-shadow: inset 0 0 0 1px #dc2626; }
.history-card.failed:hover   { border-color: #b91c1c; box-shadow: 0 4px 12px rgba(220,38,38,0.12), inset 0 0 0 1px #dc2626; }
/* pending/running stays subtle */
.history-card.pending { opacity: 0.85; }

.card-checkbox { position: absolute; top: 10px; left: 10px; z-index: 2; }
/* B1-2: name chip moved from bottom-right (was covering card-meta) to TOP-RIGHT */
.card-letter {
  position: absolute; top: 10px; right: 10px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25); z-index: 2;
}
/* card-route + card-status removed (B1-2): G/L badges gone, failure indicated by red border. */
.card-status.running {
  position: absolute; top: 10px; right: 44px;   /* sit left of the user chip */
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; z-index: 2;
  background: rgba(217,119,6,0.9); color: #fff;
}
.card-status.pending {
  position: absolute; top: 10px; right: 44px;
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700; z-index: 2;
  background: rgba(100,116,139,0.9); color: #fff;
}

.card-thumb {
  aspect-ratio: 1; width: 100%;
  background: var(--bg-soft);
  background-size: cover; background-position: center;
  position: relative;
}
.card-thumb.no-thumb {
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); font-size: 11px;
}
.card-info { padding: 10px 12px; }
.card-prompt { font-size: 12px; color: var(--ink-1); overflow: hidden;
               text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.card-meta { font-size: 11px; color: var(--ink-3); margin-top: 4px;
             display: flex; align-items: center; gap: 5px; overflow: hidden; }
.card-meta .dot-sep { color: var(--line-2); }
.card-meta .name    { color: var(--ink-2); font-weight: 600; }
.card-meta .model   { color: var(--ink-2); }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center;
              gap: 6px; margin-top: 28px; padding: 16px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; cursor: pointer; font-size: 13px;
  min-width: 36px; text-align: center; color: var(--ink-1);
  transition: all 0.15s;
}
.page-btn:hover:not(.disabled):not(.active) { background: var(--bg-soft); border-color: var(--line-2); }
.page-btn.active   { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.page-btn.disabled { color: var(--ink-3); cursor: not-allowed; }
.page-jump  { margin-left: 16px; display: flex; align-items: center; gap: 6px;
              font-size: 13px; color: var(--ink-2); }
.page-jump input { width: 56px; padding: 5px 10px; border: 1px solid var(--line);
                   border-radius: 4px; text-align: center; font-size: 13px; }

.history-empty {
  text-align: center; padding: 60px 20px; color: var(--ink-3); font-size: 14px;
  background: #fff; border: 1px dashed var(--line); border-radius: 8px;
}

/* Login */
.login-shell { min-height: calc(100vh - 64px); display: flex; align-items: center;
               justify-content: center; padding: 24px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 12px;
              padding: 44px; max-width: 400px; width: 100%;
              box-shadow: 0 8px 24px rgba(15,23,42,0.04); }
.login-card .logo-box { margin-bottom: 24px; gap: 10px; }
.login-card .logo-img img { display: block; height: 30px; width: auto; max-width: 100%; }
.login-card .logo-sub { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 6px; color: var(--ink-1); }
.login-sub { font-size: 13px; color: var(--ink-2); margin-bottom: 28px; }
.login-error { background: var(--err-bg); color: var(--err-ink);
               padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }

/* ─────────── Lightbox (shared component, 2026-05-22 B4-2) ──────────────
   Namespaced `.lb-*` so it doesn't collide with the old `.lightbox` rules
   that the ad-hoc image/video page implementations used. Old `.lightbox`
   rules removed when ad-hoc DOM blocks in image.html / video.html were
   deleted in the same commit (atomic migration per Codex Q7). */

.lb-root {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.92);
  z-index: 2000;   /* 高于素材库选取弹窗 (.lap-overlay 1200), 预览始终在最前 (Linda 6-02) */
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  user-select: none;
}
.lb-root.open { display: flex; }

.lb-close {
  position: absolute; top: 16px; left: 24px;
  background: transparent; border: 0; cursor: pointer;
  color: #fff; font-size: 28px; line-height: 1; padding: 8px 12px;
  border-radius: 6px;
}
.lb-close:hover { background: rgba(255,255,255,0.12); }

.lb-counter {
  position: absolute; top: 22px; right: 24px;
  color: rgba(255,255,255,0.7); font-size: 13px; font-variant-numeric: tabular-nums;
}
/* B6-1 (2026-05-23 v2 — Linda 反馈：top-right "实在太远了"): ★ button slot
   now sits in the flow right below the media, centered horizontally — same
   spot the user is already looking after a glance at the video/image.
   Empty/hidden when current item has no star metadata. */
.lb-star-slot {
  display: flex; align-items: center; justify-content: center;
  margin-top: 14px;
  min-height: 36px;
}
/* Override the default .star-btn-lg sizing inside the lightbox row so the
   button reads more like a primary CTA than a tiny toolbar glyph. */
.lb-star-slot .star-btn-lg {
  width: 48px; height: 48px;
  font-size: 34px;
}
.lb-title {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.6); font-size: 13px;
}
/* media-fastpath P1 (2026-07-13): 「查看原图」— 预览图下方居中的次级操作,
   与 .lb-star-slot 同一竖排 flow。当前项无预览 / 已看原图时 slot 为空。 */
.lb-orig-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
.lb-orig-btn {
  margin-top: 8px;
  padding: 5px 14px;
  border: 1px solid rgba(255,255,255,0.28); border-radius: 999px;
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.85);
  font-size: 12.5px; cursor: pointer;
  transition: background 0.15s;
}
.lb-orig-btn:hover { background: rgba(255,255,255,0.18); }
.lb-orig-btn:disabled { opacity: 0.6; cursor: default; }

.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,0.1); color: #fff;
  border: 0; cursor: pointer;
  font-size: 32px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.22); }
.lb-prev { left: 24px; }
.lb-next { right: 24px; }

.lb-content {
  max-width: 90vw; max-height: 72vh;
  display: flex; align-items: center; justify-content: center;
  position: relative;   /* X 片: 承载 .lb-select-box 大图勾选框 */
}
.lb-content img, .lb-content video {
  max-width: 90vw; max-height: 72vh;
  object-fit: contain; background: #000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  border-radius: 4px;
}

.lb-label {
  margin-top: 18px;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.lb-thumbs {
  margin-top: 12px;
  display: flex; gap: 8px;
  max-width: 90vw; overflow-x: auto;
  padding: 8px;
}
.lb-thumb {
  width: 64px; height: 64px;
  border: 0; padding: 0; cursor: pointer;
  border-radius: 4px;
  background-color: #1e293b; background-size: cover; background-position: center;
  opacity: 0.55; transition: opacity 0.15s, box-shadow 0.15s;
  position: relative; flex-shrink: 0;
  color: rgba(255,255,255,0.7);
  display: flex; align-items: center; justify-content: center;
}
.lb-thumb:hover { opacity: 0.85; }
.lb-thumb.active { opacity: 1; box-shadow: 0 0 0 2px var(--brand-blue); }
.lb-thumb-fallback { font-size: 14px; font-weight: 600; }
.lb-thumb-icon {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 10px; color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

/* ============== X 片 (2026-07-15): lightbox 逐张选入库层 ==============
   仅 library 模式激活 (history 页); 图/视频结果页 lightbox 无这些元素。
   顶部动作条居中 (让位 title), 大图左上勾选框, 缩略条每张右上角标。 */
.lb-select-actions {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: none; align-items: center; gap: 8px; z-index: 3;
}
.lb-select-all, .lb-select-add {
  font-size: 12px; line-height: 1; cursor: pointer;
  border-radius: 6px; padding: 6px 12px;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background 0.15s, opacity 0.15s;
}
.lb-select-all {
  background: rgba(255,255,255,0.12); color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
}
.lb-select-all:hover { background: rgba(255,255,255,0.22); }
.lb-select-add {
  background: var(--brand-blue); color: #fff; border: 0; font-weight: 500;
}
.lb-select-add:hover { background: var(--brand-blue-hover, var(--brand-blue)); filter: brightness(1.08); }
.lb-select-add:disabled { opacity: 0.45; cursor: default; filter: none; }

/* 大图左上勾选框 (当前项) */
.lb-select-box {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  width: 26px; height: 26px; padding: 0; cursor: pointer;
  border-radius: 6px; border: 2px solid rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
}
.lb-select-box .lb-check-glyph {
  font-size: 15px; color: #fff; line-height: 1; opacity: 0;
}
.lb-select-box.checked {
  background: var(--brand-blue); border-color: var(--brand-blue);
}
.lb-select-box.checked .lb-check-glyph { opacity: 1; }

/* 缩略条每张右上角勾选角标 */
.lb-thumb-check {
  position: absolute; top: -5px; right: -5px; z-index: 2;
  width: 17px; height: 17px; cursor: pointer;
  border-radius: 50%; border: 1.5px solid rgba(255,255,255,0.85);
  background: rgba(30,41,59,0.9);
  display: flex; align-items: center; justify-content: center;
}
.lb-thumb-check .lb-check-glyph {
  font-size: 10px; color: #fff; line-height: 1; opacity: 0;
}
.lb-thumb-check.checked {
  background: var(--brand-blue); border-color: var(--brand-blue);
}
.lb-thumb-check.checked .lb-check-glyph { opacity: 1; }

/* 「已入库」标记 (本会话已成功加入, 选择⑤) — 缩略条项左下角小圆点 + 大图框弱化边 */
.lb-thumb.added::after {
  content: "已入库"; position: absolute; bottom: 2px; left: 3px;
  font-size: 8px; line-height: 1.2; padding: 1px 3px; border-radius: 3px;
  background: rgba(16,185,129,0.9); color: #fff;
}
.lb-select-box.added { box-shadow: 0 0 0 2px rgba(16,185,129,0.9); }

/* ============== Admin Logs viewer (2026-05-23 admin only) ============== */
.admin-shell { padding: 0 8px; }
.admin-header { display: flex; justify-content: space-between; align-items: baseline;
                margin: 8px 0 16px; gap: 16px; flex-wrap: wrap; }
.admin-title { margin: 0; font-size: 18px; font-weight: 600; }
.admin-fileinfo { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }

.admin-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-tab { padding: 8px 16px; cursor: pointer; font-size: 13px; color: var(--ink-2);
             border-bottom: 2px solid transparent; transition: all 0.15s; }
.admin-tab:hover { color: var(--ink-1); }
.admin-tab.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); font-weight: 600; }

.admin-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px;
                 flex-wrap: wrap; padding: 10px 14px; background: #fff;
                 border: 1px solid var(--line); border-radius: 8px; }
.admin-input  { padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px;
                font-size: 13px; min-width: 200px; }
.admin-select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px;
                font-size: 13px; background: #fff; }
.admin-autorefresh { font-size: 13px; color: var(--ink-2); display: flex;
                     align-items: center; gap: 6px; }

.log-pre {
  background: #0f172a; color: #cbd5e1;
  font-family: ui-monospace, "SF Mono", Menlo, "JetBrains Mono", Consolas, monospace;
  font-size: 12px; line-height: 1.55;
  padding: 14px 16px; border-radius: 8px; overflow: auto;
  max-height: calc(100vh - 280px); min-height: 400px;
  white-space: pre; word-break: keep-all;
}
.log-pre.error { background: #fef2f2; color: #b91c1c; }
.log-pre .log-line { display: block; padding: 0 2px; border-radius: 2px; }
.log-pre .log-line.error   { color: #f87171; background: rgba(220, 38, 38, 0.07); }
.log-pre .log-line.warning { color: #fbbf24; }
.log-pre .log-line.info    { color: #cbd5e1; }
.log-task-id {
  background: rgba(39, 143, 206, 0.18); color: #93c5fd;
  padding: 0 4px; border-radius: 3px; cursor: pointer;
  border: 1px solid transparent;
}
.log-task-id:hover { border-color: rgba(147, 197, 253, 0.5); }
.log-task-id.copied {
  background: rgba(34, 197, 94, 0.25); color: #86efac;
  border-color: rgba(134, 239, 172, 0.6);
}

/* Nav-bar "Log" 按钮 (Linda 2026-05-26: 从圆按钮升级为 .tab 风格,
   跟生图/生视频/历史记录一致, 但在右侧 admin 区). 旧 .nav-log-btn 已替换. */
/* (kept empty for grep noise — actual styles now on `.tab` + `.tabs-admin`) */

/* ============== B7-1 上传文件 × 删除按钮 (2026-05-23) ============== */
/* Applied to every uploaded reference image / first-last frame / audio slot.
   Visible only when the slot has a file (parent has .has-img class). */
.ref-clear-btn {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  display: none;             /* hidden by default; only shown on filled slots */
  align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  color: #fff; font-size: 14px; line-height: 1;
  border: 0; border-radius: 50%;
  cursor: pointer; padding: 0;
  z-index: 4;
  transition: background 0.12s, transform 0.1s;
}
.ref-thumb.has-img .ref-clear-btn,
.single-slot.has-img .ref-clear-btn,
.audio-slot.has-file .ref-clear-btn,
.video-ref-slot.has-file .ref-clear-btn {  /* B2-5 2026-05-25: 视频参考也用 .has-file */
  display: flex;
}
.ref-clear-btn:hover { background: #dc2626; transform: scale(1.1); }

/* B1-4 form-cache 恢复提示条 — 顶部黄色 3 秒淡出 */
.form-restore-hint {
  padding: 8px 14px; margin: 0 0 12px;
  background: #fef9c3; border: 1px solid #facc15; border-radius: 6px;
  color: #713f12; font-size: 12.5px;
  transition: opacity 0.4s ease-out;
}

/* B4-2: history card "N 张" 角标 (N > 1).
   2026-05-22 round 1 重叠了 .card-letter (top-right)，2026-05-23 改到缩略图
   右下角（Linda 拍板）。视频任务若 N>1 + 视频时长徽都在 bottom-right 时叠加，
   待 B5-1 视频并发上线后看实际效果再调整。 */
.card-count-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.85); color: #fff;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  pointer-events: none;
  z-index: 3;
}
/* B5-1/B5-2 (2026-05-23): partial-failure badge — bottom-left corner of thumb.
   Opposite corner from card-count-badge (bottom-right). Red so it stands out
   from the dark count badge. Pointer-events: auto so tooltip works on hover. */
.card-fail-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(220, 38, 38, 0.92); color: #fff;
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  z-index: 3;
  cursor: help;
}

/* Y 片 (2026-07-15): Agent 来源标 — 卡片左下 (fail-badge 同槽, 非失败时空闲)。
   同时有 fail badge 时 .with-fail 叠到其上方 (bottom 抬高) 防重叠 (CSS corner 铁律)。 */
.card-agent-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(37, 143, 206, 0.94); color: #fff;   /* brand-blue 系, 区别于红色 fail */
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  z-index: 3;
  cursor: help;
}
.card-agent-badge.with-fail { bottom: 32px; }   /* fail badge 在下, Agent 标叠上方 */
/* 2026-08-03 方案 B (Linda 拍板 + mock history_source_filter_mock.html): 四类来源都显角标。
   基类蓝 = API (沿用原 Agent 色, 老卡片观感不变); 网页绿 / Flow 紫 / 未知灰。 */
.card-agent-badge.web { background: rgba(22, 163, 74, 0.94); }        /* 网页 — 绿 */
.card-agent-badge.flow { background: rgba(124, 58, 237, 0.94); }      /* Flow — 紫 */
/* 未知 = source_of 的探测器档 (未登记的新提交入口), 正常恒为 0 条。给灰标而不是静默不显:
   真冒出来要一眼看见, 别让新入口被悄悄算进别的桶 (§2.9 漏的不静默吞)。 */
.card-agent-badge.unknown { background: rgba(100, 116, 139, 0.94); }

/* ============ B6-1-P4 视图切换 toggle (2026-05-23) ============
   Two-button pill switch in the history header — "显示全部" vs "仅看 ★".
   Active button gets brand-blue fill; inactive stays neutral. Used by
   bindViewToggle() in history.js. */
.view-toggle {
  display: inline-flex;
  background: var(--bg-1, #f1f5f9);
  border: 1px solid var(--bd-1, #e2e8f0);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.view-toggle-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2, #475569);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.view-toggle-btn:hover { color: var(--ink-1, #0f172a); }
.view-toggle-btn.active {
  background: var(--brand-blue, #2563eb);
  color: #fff;
  font-weight: 600;
}

/* B6-1-P4: flat-view (仅看 ★) card has an extra play icon overlay for video
   outputs so users can tell image vs video at a glance. Subtitle "T1234#3"
   is dim and monospace-tabular so source-task lookup is easy. */
.history-card.flat .flat-card-play-icon {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}
.flat-card-source {
  color: var(--ink-3, #64748b);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}

/* B6-1 (2026-05-23): history card ★ count overlay. Read-only indicator;
   actual toggling is in lightbox (Option α).
   B6-1 v3 (2026-05-24 Linda fix): the badge used to sit at top-left and
   visually covered the `.card-checkbox` (which is also top-left at 10/10).
   Shifted to `left: 40px` so the badge sits to the right of the 22-px-wide
   checkbox with a small gap. pointer-events stays `none` so the checkbox
   underneath remains clickable even when the badge overlaps slightly. */
.card-star-badge {
  position: absolute;
  top: 8px;
  left: 40px;
  background: rgba(251, 191, 36, 0.95);   /* amber-400 */
  color: #422006;                         /* deep brown for contrast */
  padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
  z-index: 3;
  pointer-events: none;
  letter-spacing: 0.5px;
}

/* ============ B6-1 ★ 收藏按钮 (2026-05-23) ============
   Two sizes:
   - .star-btn-sm — thumbnail overlay (history card, result-panel video card).
     Top-left corner so it doesn't collide with card-count-badge (bottom-right)
     or card-fail-badge (bottom-left) or ref-clear-btn (top-right on uploads).
   - .star-btn-lg — lightbox toolbar; bigger tap target, sits inline w/ other
     toolbar buttons (no absolute positioning — consumer places it).
   Unfilled state ☆ has low opacity by default; on hover it brightens so users
   discover the affordance. Filled ★ stays golden permanently. */
.star-btn {
  cursor: pointer;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fbbf24;                       /* amber-400 */
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.6),
    0 1px 2px rgba(0, 0, 0, 0.4);
  line-height: 1;
  user-select: none;
  transition: opacity 0.12s, transform 0.1s;
}
.star-btn[data-busy="1"] { pointer-events: none; opacity: 0.5; }
.star-btn:hover { transform: scale(1.12); }

/* Small overlay variant — sits on thumbnails */
.star-btn-sm {
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  font-size: 18px;
  z-index: 4;
  opacity: 0.45;                         /* unstarred is muted */
}
.star-btn-sm.starred { opacity: 1; }
.star-btn-sm:hover { opacity: 1; }       /* on hover even ☆ goes full */

/* Large variant — lightbox toolbar + result-panel card-star-row */
.star-btn-lg {
  width: 32px; height: 32px;
  font-size: 24px;
  opacity: 0.7;
}
.star-btn-lg.starred { opacity: 1; }
.star-btn-lg:hover { opacity: 1; }

/* B6-1 v2 (2026-05-23 Linda feedback): row between image/video preview and
   meta row. Hosts a centered ★ button so its placement matches the lightbox's
   below-media star spot (一致性). The dark-on-white card chrome plus the
   amber ★ keeps it clearly visible without an extra background plate. */
.card-star-row {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 4px;
}

/* ────────────────────────────────────────────────────────────────────────
   Prompt Library (📝, Linda 2026-05-26)
   - 触发按钮 (.plib-trigger-btn) 挂在 prompt textarea 旁
   - overlay 弹窗在 z-index 800, 低于 lightbox 的 1000
   - 两标签页: 浏览 (browse) + 保存当前 (save), 用 .plib-pane[hidden] 切换
   ──────────────────────────────────────────────────────────────────────── */

.plib-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 10px;
  margin: 6px 0 4px;
  font-size: 12px;
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
  border: 1px solid var(--brand-blue-l2);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.plib-trigger-btn:hover {
  background: var(--brand-blue-l2);
  border-color: var(--brand-blue);
}

.plib-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.plib-overlay[hidden] { display: none; }
body.plib-overlay-open { overflow: hidden; }

.plib-panel {
  background: var(--bg-card);
  border-radius: 12px;
  width: min(720px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.plib-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}
.plib-tabs { display: flex; gap: 8px; }
.plib-tab {
  background: transparent;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
}
.plib-tab.active {
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
  border-color: var(--brand-blue-l2);
}
.plib-tab:hover:not(.active) { background: #f1f5f9; }

.plib-close {
  background: transparent; border: 0;
  font-size: 24px; line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  width: 30px; height: 30px;
}
.plib-close:hover { color: var(--ink-1); }

.plib-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}
.plib-pane[hidden] { display: none; }

/* ─── browse pane ─── */
.plib-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.plib-search {
  flex: 1;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
}
.plib-client-filter {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: white;
}
.plib-list { display: flex; flex-direction: column; gap: 8px; }
.plib-empty { color: #94a3b8; text-align: center; padding: 40px 12px; font-size: 13px; }

.plib-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}
.plib-row:hover { border-color: var(--brand-blue-l2); }
.plib-row-main { flex: 1; min-width: 0; }
.plib-row-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-1);
  margin-bottom: 4px;
}
.plib-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.plib-shortcut {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  background: #f1f5f9;
  color: #475569;
  padding: 1px 6px;
  border-radius: 4px;
}
.plib-private {
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
}
.plib-row-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 11px;
  color: #64748b;
}
.plib-client-badge {
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.plib-row-uses { color: #64748b; }
.plib-row-preview {
  font-size: 12px;
  color: #475569;
  line-height: 1.4;
  max-height: 56px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  mask-image: linear-gradient(to bottom, black 80%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent);
}

.plib-row-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

/* ─── save pane ─── */
.plib-save-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plib-label {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-top: 8px;
}
.plib-input,
.plib-select,
.plib-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
}
.plib-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.45;
}
.plib-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.plib-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.plib-save-status {
  margin-top: 8px;
  font-size: 12px;
  min-height: 18px;
}
.plib-status-info { color: #64748b; }
.plib-status-ok   { color: #15803d; }
.plib-status-err  { color: #b91c1c; }

/* ─── overlay-local buttons (避免污染全局) ─── */
.plib-btn-primary,
.plib-btn-secondary,
.plib-btn-icon {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.plib-btn-primary {
  background: var(--brand-blue);
  color: white;
  padding: 8px 16px;
  font-size: 13px;
}
.plib-btn-primary:hover { background: var(--brand-blue-d); }
.plib-btn-primary.plib-btn-sm { padding: 5px 10px; font-size: 12px; }

.plib-btn-secondary {
  background: white;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  font-size: 13px;
}
.plib-btn-secondary:hover { background: #f1f5f9; }

.plib-btn-icon {
  background: transparent;
  width: 26px; height: 26px;
  font-size: 14px;
  color: #64748b;
}
.plib-btn-icon:hover { background: #f1f5f9; color: var(--ink-1); }
.plib-btn-danger:hover { color: #b91c1c; background: #fee2e2; }

/* History card 📝 按钮 — 一键把卡片里的 prompt 转存到库 */
.card-save-prompt-btn {
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  padding: 1px 5px;
  cursor: pointer;
  color: #64748b;
  margin-left: 6px;
  vertical-align: middle;
}
.card-save-prompt-btn:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue-l2);
  color: var(--brand-blue-dd);
}

/* ════════════════════════════════════════════════════════════════════════════
   /progress 页面 (Linda 2026-05-26) — editorial-refined 风格
   所有规则用 .progress-* 前缀, 避免跟 .panel / .form-* 撞.
   字体: 标题 Fraunces (已在 _base.html 引), 正文复用 Manrope (nav 也用)
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  /* User palette — 跟 .badge-1..10 一致 */
  --user-1:  #d94f4f;
  --user-2:  #e57a3c;
  --user-3:  #d9a64a;
  --user-4:  #5e9b40;
  --user-5:  #3aa5a0;
  --user-6:  #278fce;
  --user-7:  #7b5ed1;
  --user-8:  #c95e9e;
  --user-cc: #6b21a8;

  /* Editorial paper bg (only used on /progress page wrap) */
  --progress-paper:    #fafaf6;
  --progress-paper-2:  #f3f1eb;
  --progress-ink:      #15151f;
  --progress-ink-2:    #4a4a5c;
  --progress-ink-3:    #8e8e9d;
  --progress-line:     #e8e6e1;
  --progress-line-2:   #cfccc6;

  /* Status (sober deep tones) */
  --ok:        #15803d;
  --ok-bg:     #ecfdf5;
  --warn-d:    #b45309;
  --warn-d-bg: #fef3c7;
  --crit:      #b91c1c;
  --crit-bg:   #fef2f2;
  --discuss:   #6b21a8;
  --discuss-bg:#f5f3ff;
}

/* Page wrap — editorial paper, noise texture */
.progress-page {
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--progress-ink);
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 8px 64px;
  background-image: radial-gradient(circle at 1px 1px, rgba(21,21,31,0.012) 1px, transparent 0);
  background-size: 4px 4px;
}

/* Hero */
.progress-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  margin-bottom: 64px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--progress-line);
  animation: progressFadeUp 0.6s ease-out;
}
.progress-sub {
  font-size: 12px;
  color: var(--progress-ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  margin-bottom: 8px;
}
.progress-page-title {
  font-family: "Fraunces", Georgia, "Songti SC", serif;
  font-weight: 400;
  font-size: clamp(40px, 5.5vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--progress-ink);
  font-variation-settings: "opsz" 144;
}
.progress-stats {
  display: flex;
  gap: 40px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--progress-ink-3);
}
.progress-stat .num {
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 1;
  color: var(--progress-ink);
  letter-spacing: -0.02em;
}
.progress-stat .lbl {
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Tab bar — underline */
.progress-tabbar {
  display: flex;
  gap: 40px;
  border-bottom: 1px solid var(--progress-line);
  margin-bottom: 32px;
  position: sticky;
  top: 64px;
  background: rgba(250, 250, 246, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  padding-top: 16px;
}
.progress-tab-btn {
  background: none; border: none; padding: 0 0 14px 0;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--progress-ink-3); cursor: pointer;
  position: relative; transition: color 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.progress-tab-btn:hover { color: var(--progress-ink-2); }
.progress-tab-btn.active { color: var(--progress-ink); }
.progress-tab-btn.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--progress-ink);
}
.progress-tab-btn .icon { font-size: 16px; }
.progress-tab-btn .dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--crit); color: white;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px; font-weight: 500;
}

.progress-pane { display: none; animation: progressFadeIn 0.35s ease-out; }
.progress-pane.active { display: block; }

/* Sub-tabbar (pill) */
.progress-subtabbar {
  display: inline-flex; gap: 4px;
  padding: 4px;
  background: var(--progress-paper-2);
  border-radius: 99px;
  margin-bottom: 32px;
}
.progress-subtab-btn {
  background: none; border: none;
  padding: 8px 18px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--progress-ink-3);
  border-radius: 99px; cursor: pointer;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.progress-subtab-btn:hover { color: var(--progress-ink-2); }
.progress-subtab-btn.active {
  background: #fff;
  color: var(--progress-ink);
  box-shadow: 0 1px 3px rgba(21,21,31,0.08), 0 0 0 1px var(--progress-line);
}
.progress-subtab-btn .sub-count {
  font-family: "JetBrains Mono", monospace; font-size: 10px;
  color: var(--progress-ink-3);
  padding: 1px 6px; background: var(--progress-paper-2); border-radius: 99px;
  letter-spacing: 0.04em;
}
.progress-subtab-btn.active .sub-count {
  background: var(--brand-blue-l); color: var(--brand-blue-dd);
}
.progress-subpane { display: none; animation: progressFadeIn 0.3s ease-out; }
.progress-subpane.active { display: block; }

/* Section */
.progress-section { margin-bottom: 56px; }
.progress-section-hd {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 24px; padding-bottom: 8px;
  border-bottom: 1px solid var(--progress-line);
}
.progress-section-hd .title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 400; font-size: 24px;
  letter-spacing: -0.015em; color: var(--progress-ink);
  font-variation-settings: "opsz" 96;
}
.progress-section-hd .title em {
  font-style: italic; color: var(--brand-blue-dd); margin-left: 6px;
}
.progress-section-hd .meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3); letter-spacing: 0.04em;
}

/* Page card (按页面 sub-pane) */
.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}
.page-card {
  background: #fff;
  border: 1px solid var(--progress-line);
  border-radius: 10px;
  padding: 0 0 24px 0;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  position: relative;
}
.page-card:hover {
  border-color: var(--progress-line-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px -10px rgba(21,21,31,0.12);
}
.page-card .pc-strip {
  height: 4px; width: 100%;
  background: var(--owner, var(--user-1));
}
.page-card .pc-hd {
  padding: 16px 24px 8px;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
}
.page-card .pc-route { display: flex; flex-direction: column; gap: 4px; }
.page-card .pc-route code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  background: var(--progress-paper-2);
  padding: 2px 8px; border-radius: 4px;
  color: var(--progress-ink-2);
  align-self: flex-start; letter-spacing: 0.02em;
}
.page-card .pc-name {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500; font-size: 19px;
  color: var(--progress-ink); letter-spacing: -0.01em;
}
.page-card .pc-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3);
  letter-spacing: 0.04em; margin-top: 2px;
}
.page-card .pc-owner {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px;
  background: var(--owner, var(--user-1));
  color: white;
  border-radius: 99px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 2px 8px -2px rgba(21,21,31,0.15);
  white-space: nowrap;
}
.page-card .pc-owner .owner-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px;
}
/* page-card 内 feat-list 留 24px 左右 padding — specificity 必须 ≥ .progress-page .feat-list,
   否则被下面 padding: 0 的 shared rule 盖掉. */
.progress-page .page-card .feat-list { padding: 0 24px; margin: 0; list-style: none; }
.progress-page .page-card .feat-list li:last-child { border-bottom: none; }
.progress-page .page-card .feat-list li:hover { padding-left: 28px; }

/* Subsec block (跨页面 + 后端 sub-panes, 紧凑列表) */
.subsec-block {
  background: #fff;
  border: 1px solid var(--progress-line);
  border-radius: 8px;
  padding: 16px 24px 8px;
  margin-bottom: 12px;
}
.subsec-block .subsec-hd {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.subsec-block .subsec-hd .name {
  font-size: 15px; font-weight: 500; color: var(--progress-ink);
}
.subsec-block .subsec-hd .right {
  display: flex; gap: 8px; align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3); letter-spacing: 0.04em;
}
.subsec-block .subsec-hd .owner-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.subsec-block .subsec-hd .owner-lbl {
  font-family: inherit; color: var(--progress-ink-2); font-size: 12px;
  letter-spacing: 0;
}

/* Feature list (shared) */
.progress-page .feat-list {
  list-style: none; padding: 0; margin: 0;
  border-top: 1px solid var(--progress-line);
  display: flex; flex-direction: column;
}
.progress-page .feat-list li {
  display: grid; grid-template-columns: 1fr auto;
  gap: 16px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--progress-line);
  transition: padding-left 0.18s;
  font-size: 13px;
}
.progress-page .feat-list .ftitle { color: var(--progress-ink); }
.progress-page .feat-list .ftitle strong { font-weight: 600; }
.progress-page .feat-list .ftitle code {
  font-family: "JetBrains Mono", monospace;
  background: var(--progress-paper-2);
  padding: 1px 5px; border-radius: 3px; font-size: 11px;
}
.progress-page .feat-list .fdate {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3);
  white-space: nowrap; letter-spacing: 0.04em;
}

/* TODO cards */
.todo-cards { display: flex; flex-direction: column; gap: 16px; }
.todo-card {
  background: #fff;
  border: 1px solid var(--progress-line);
  border-radius: 8px;
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.todo-card:hover {
  border-color: var(--progress-line-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px -8px rgba(21,21,31,0.08);
}
.todo-card .hd {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 8px;
}
.todo-card .hd .title {
  font-size: 16px; font-weight: 600; color: var(--progress-ink);
  letter-spacing: -0.005em;
}
.todo-card .hd .title .ticket {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; font-weight: 500;
  background: var(--progress-paper-2);
  padding: 2px 8px; border-radius: 4px;
  color: var(--progress-ink-2);
  margin-right: 8px; letter-spacing: 0.04em;
  vertical-align: 2px;
}
.todo-card .summary {
  font-size: 14px; color: var(--progress-ink-2); margin-bottom: 8px;
}
.todo-card .summary code, .todo-card details .body code {
  font-family: "JetBrains Mono", monospace;
  background: var(--progress-paper-2);
  padding: 1px 5px; border-radius: 3px; font-size: 11px;
}
.todo-card details { margin-top: 8px; }
.todo-card details summary {
  cursor: pointer; font-size: 12px; color: var(--brand-blue-dd);
  list-style: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 0; user-select: none;
}
.todo-card details summary::-webkit-details-marker { display: none; }
.todo-card details summary::before {
  content: "›"; display: inline-block; transition: transform 0.2s; font-size: 14px;
}
.todo-card details[open] summary::before { transform: rotate(90deg); }
.todo-card details .body {
  margin-top: 8px; padding: 16px;
  background: var(--progress-paper-2);
  border-radius: 6px;
  font-size: 13px; color: var(--progress-ink-2);
  line-height: 1.6;
}
.todo-card details .body ul { margin: 0; padding-left: 1.2em; }
.todo-card details .body li { margin-bottom: 4px; }
.todo-card details .body p { margin: 4px 0; }

/* Changelog timeline */
.progress-timeline {
  position: relative; padding-left: 24px;
}
.progress-timeline::before {
  content: ""; position: absolute;
  left: 7px; top: 8px; bottom: 8px; width: 1px;
  background: var(--progress-line);
}
.tl-day { position: relative; margin-bottom: 40px; }
.tl-day::before {
  content: ""; position: absolute;
  left: -22px; top: 6px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--progress-paper); border: 2px solid var(--brand-blue);
}
.tl-day.faded::before { border-color: var(--progress-line-2); }
.tl-day .day-hd {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 16px;
}
.tl-day .day-hd .date {
  font-family: "Fraunces", Georgia, serif;
  font-size: 20px; font-weight: 500; color: var(--progress-ink);
  letter-spacing: -0.01em;
}
.tl-day .day-hd .count {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3); letter-spacing: 0.04em;
}
.tl-day .day-toggle {
  margin-left: auto;
  font-size: 12px; color: var(--progress-ink-3);
  background: none; border: 1px solid var(--progress-line);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
.tl-day .day-toggle:hover { color: var(--progress-ink); border-color: var(--progress-line-2); }
.tl-day.collapsed .tl-entries { display: none; }

.tl-entries { display: flex; flex-direction: column; gap: 8px; }
.tl-entry {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 16px; align-items: baseline;
  padding: 8px 0; border-bottom: 1px dotted var(--progress-line);
}
.tl-entry:last-child { border-bottom: none; }
.tl-entry .emoji { font-size: 14px; width: 18px; text-align: center; }
.tl-entry .desc { color: var(--progress-ink); font-size: 13px; }
.tl-entry .desc .kind { font-weight: 600; }
.tl-entry .desc .detail { color: var(--progress-ink-2); }
.tl-entry .commit {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--brand-blue-dd);
  background: var(--brand-blue-l); padding: 2px 7px; border-radius: 4px;
  letter-spacing: 0.02em;
}

/* Feedback compose */
.fb-compose {
  background: #fff; border: 1px solid var(--progress-line);
  border-radius: 10px; padding: 24px;
  margin-bottom: 24px; position: relative;
  animation: progressFadeUp 0.5s ease-out;
}
.fb-compose::before {
  content: ""; position: absolute;
  top: -8px; left: 24px;
  width: 80px; height: 8px;
  background: linear-gradient(90deg, var(--brand-blue), transparent);
  border-radius: 4px 4px 0 0; opacity: 0.6;
}
.fb-compose h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 19px; font-weight: 450;
  margin: 0 0 16px 0; color: var(--progress-ink);
  letter-spacing: -0.015em;
}
.fb-compose h3 em { font-style: italic; color: var(--brand-blue-dd); }
.fb-compose .row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 8px; flex-wrap: wrap;
}
.fb-compose .row .lbl {
  font-size: 12px; color: var(--progress-ink-3); width: 60px;
  letter-spacing: 0.02em;
}
.kind-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-chip {
  padding: 4px 12px; border-radius: 99px;
  font-size: 12px; background: transparent;
  border: 1px solid var(--progress-line); color: var(--progress-ink-2);
  cursor: pointer; transition: all 0.15s;
  font-family: inherit;
}
.kind-chip:hover { border-color: var(--progress-line-2); color: var(--progress-ink); }
.kind-chip.active { border-color: transparent; color: white; }
.kind-chip.k-crit.active { background: var(--crit); }
.kind-chip.k-test.active { background: var(--warn-d); }
.kind-chip.k-sug.active  { background: var(--brand-blue); }
.kind-chip.k-disc.active { background: var(--discuss); }
.fb-compose input[type="text"], .fb-compose textarea {
  width: 100%; font-family: inherit; font-size: 14px;
  padding: 9px 12px;
  background: var(--progress-paper);
  border: 1px solid var(--progress-line);
  border-radius: 6px; color: var(--progress-ink);
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}
.fb-compose input[type="text"]:focus, .fb-compose textarea:focus {
  outline: none; border-color: var(--brand-blue); background: white;
}
.fb-compose textarea {
  min-height: 80px; resize: vertical; line-height: 1.5;
}
.fb-compose .actions {
  margin-top: 16px; display: flex; align-items: center;
  justify-content: flex-end; gap: 8px;
}
.fb-compose-status {
  margin-right: auto; font-size: 12px;
}
.fb-compose-status.ok { color: var(--ok); }
.fb-compose-status.err { color: var(--crit); }
.fb-compose-status.info { color: var(--progress-ink-3); }

/* Progress buttons (avoid colliding with existing .btn-primary etc) */
.progress-btn-primary {
  padding: 8px 18px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  background: var(--progress-ink); color: var(--progress-paper);
  border: none; cursor: pointer; font-family: inherit;
}
.progress-btn-primary:hover { background: var(--progress-ink-2); }
.progress-btn-ghost {
  padding: 6px 14px; border-radius: 6px;
  font-size: 12px; color: var(--progress-ink-2);
  background: transparent; border: 1px solid var(--progress-line);
  cursor: pointer; font-family: inherit;
}
.progress-btn-ghost:hover {
  color: var(--progress-ink);
  border-color: var(--progress-line-2);
  background: var(--progress-paper-2);
}
.progress-btn-ghost.danger:hover { color: var(--crit); background: var(--crit-bg); border-color: #fecaca; }

/* Status strip */
.fb-status-strip {
  display: flex; gap: 24px;
  padding: 16px 0; border-bottom: 1px solid var(--progress-line);
  margin-bottom: 24px;
  font-size: 12px; letter-spacing: 0.04em;
  color: var(--progress-ink-3);
  font-family: "JetBrains Mono", monospace;
}
.fb-status-strip .ct strong {
  color: var(--progress-ink);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500; font-size: 15px;
  margin-right: 4px; letter-spacing: -0.01em;
}
.fb-status-strip .ct.crit strong { color: var(--crit); }
.fb-status-strip .ct.warn strong { color: var(--warn-d); }
.fb-status-strip .ct.ok strong   { color: var(--ok); }

/* Feedback card */
.fb-card {
  background: #fff; border: 1px solid var(--progress-line);
  border-radius: 8px; padding: 24px;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fb-card:hover { border-color: var(--progress-line-2); box-shadow: 0 4px 20px -8px rgba(21,21,31,0.06); }
.fb-card .top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 12px; color: var(--progress-ink-3);
}
.fb-card .top .by { font-weight: 600; }
.fb-card .top .ago::before { content: "· "; color: var(--progress-ink-3); }
.fb-card .top .spacer { flex: 1; }
.fb-card .top .status {
  font-size: 11px; padding: 2px 10px; border-radius: 99px;
  letter-spacing: 0.04em; font-family: "JetBrains Mono", monospace;
}
.status-pending  { background: var(--crit-bg);    color: var(--crit); }
.status-progress { background: var(--warn-d-bg);  color: var(--warn-d); }
.status-resolved { background: var(--ok-bg);      color: var(--ok); }

.fb-card .title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 18px; font-weight: 500;
  color: var(--progress-ink); margin: 4px 0 6px;
  letter-spacing: -0.015em;
}
.fb-card .content {
  font-size: 14px; color: var(--progress-ink-2);
  margin-bottom: 16px; line-height: 1.6;
  white-space: pre-wrap;
}
.fb-card .badge-kind {
  display: inline-block;
  font-size: 11px; padding: 2px 9px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.04em; vertical-align: 1px;
  margin-right: 6px;
}
.badge-crit { background: var(--crit-bg);    color: var(--crit); }
.badge-test { background: var(--warn-d-bg);  color: var(--warn-d); }
.badge-sug  { background: var(--brand-blue-l); color: var(--brand-blue-dd); }
.badge-disc { background: var(--discuss-bg); color: var(--discuss); }

/* User color (name in feedback) */
.by.u-1, .who.u-1 { color: var(--user-1); }
.by.u-2, .who.u-2 { color: var(--user-2); }
.by.u-3, .who.u-3 { color: var(--user-3); }
.by.u-4, .who.u-4 { color: var(--user-4); }
.by.u-5, .who.u-5 { color: var(--user-5); }
.by.u-6, .who.u-6 { color: var(--user-6); }
.by.u-7, .who.u-7 { color: var(--user-7); }
.by.u-8, .who.u-8 { color: var(--user-8); }
.by.u-cc, .who.u-cc { color: var(--user-cc); }

/* Comments */
.fb-comments {
  border-top: 1px dashed var(--progress-line);
  padding-top: 16px; margin-top: 16px;
}
.fb-comments .hd {
  font-size: 12px; color: var(--progress-ink-3);
  letter-spacing: 0.04em; margin-bottom: 8px;
  font-family: "JetBrains Mono", monospace;
}
.fb-comments .comment {
  padding: 8px 0;
  display: grid; grid-template-columns: 26px 1fr;
  gap: 8px; align-items: start;
}
.fb-comments .comment .avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-blue); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
}
.avatar.a-1  { background: var(--user-1); }
.avatar.a-2  { background: var(--user-2); }
.avatar.a-3  { background: var(--user-3); }
.avatar.a-4  { background: var(--user-4); }
.avatar.a-5  { background: var(--user-5); }
.avatar.a-6  { background: var(--user-6); }
.avatar.a-7  { background: var(--user-7); }
.avatar.a-8  { background: var(--user-8); }
.avatar.a-cc { background: var(--user-cc); }
.fb-comments .comment .c-body .who { font-size: 12px; font-weight: 600; }
.fb-comments .comment .c-body .when {
  font-size: 11px; color: var(--progress-ink-3); margin-left: 6px;
}
.fb-comments .comment .c-body .ctext {
  font-size: 13px; color: var(--progress-ink-2); margin-top: 2px;
  white-space: pre-wrap;
}
.fb-comments .write {
  margin-top: 8px;
  display: grid; grid-template-columns: 26px 1fr auto;
  gap: 8px;
}
.fb-comments .write .avatar { /* 复用 .avatar 上面 */ }
.fb-comments .write input {
  font-family: inherit; font-size: 13px;
  padding: 6px 10px;
  background: var(--progress-paper);
  border: 1px solid var(--progress-line); border-radius: 6px;
  color: var(--progress-ink);
  transition: border-color 0.15s;
}
.fb-comments .write input:focus {
  outline: none; border-color: var(--brand-blue); background: white;
}
.fb-comments .write button {
  font-size: 12px; padding: 6px 14px;
  border: 1px solid var(--progress-line);
  background: transparent; color: var(--progress-ink-2);
  border-radius: 6px; cursor: pointer; font-family: inherit;
}
.fb-comments .write button:hover { color: var(--progress-ink); border-color: var(--progress-line-2); }

.fb-card .footer {
  margin-top: 8px;
  display: flex; justify-content: flex-end; gap: 8px;
}

/* Resolved block */
.fb-resolved-block {
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--progress-line);
}
.fb-resolved-block .hd {
  display: flex; align-items: center; gap: 8px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 17px; font-weight: 450;
  color: var(--progress-ink-2); margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.fb-resolved-block .hd::after {
  content: ""; flex: 1; height: 1px;
  background: var(--progress-line); margin-left: 16px;
}
.fb-resolved-block .item {
  display: grid; grid-template-columns: 100px 1fr auto;
  gap: 16px; padding: 8px 0;
  border-bottom: 1px dotted var(--progress-line);
  font-size: 13px; color: var(--progress-ink-2);
}
.fb-resolved-block .item .when {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--progress-ink-3); letter-spacing: 0.04em;
}
.fb-resolved-block .item .commit {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; color: var(--brand-blue-dd);
}

/* Animations */
@keyframes progressFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes progressFadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Client + Project 两级 dropdown (Linda v2 2026-05-26)
   - /image /video form 用 .client-project-group (跟 .form-row 协调)
   - /history toolbar 嵌 inline dropdown
   - history 卡片 .card-category badge + ⟲ 改归属 modal
   ════════════════════════════════════════════════════════════════════════════ */

/* form 内 client + project 两个 dropdown 一行排 */
.client-project-group { /* 复用现有 .form-row 的 grid-template 2 列 */ }

/* history 卡片底部 row: [客户·项目 badge] [↻ 再出按钮]
   Linda v2 2026-05-26: bug3 fix (改成自占一行 + fit-content 收紧)
   Linda v3 2026-05-28 M2.14: 整框可点 (去掉 3px ⟲ icon 不可达 bug) + 同行加 rotate-cw 再出按钮 */
.card-bottom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.card-category {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  /* M2.14: 整框可点 (代替 3px ⟲ icon) */
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
.card-category:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue-l2);
}
.card-category:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}
.card-category .card-cat-client {
  font-weight: 500;
  color: var(--ink-1);
}
.card-category .card-cat-sep { color: var(--ink-3); }
.card-category .card-cat-project {
  color: var(--brand-blue-dd);
}
/* 旧 ⟲ icon — 已从 HTML 移除, 留 selector 避免缓存 mismatch */
.card-cat-edit { display: none; }

/* ↻ 再出按钮 (icon-only rotate-cw) — Linda 5-28 M2.14 */
.card-rerun-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  cursor: pointer;
  color: var(--ink-3);
  text-decoration: none;   /* 现在是 <a> (Cmd+click 开新 tab), 去掉链接下划线 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
}
.card-rerun-btn svg {
  width: 12px;
  height: 12px;
}
.card-rerun-btn:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue-l2);
  color: var(--brand-blue-dd);
}
.card-rerun-btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}

/* 改归属 modal */
.cat-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.cat-modal-overlay[hidden] { display: none; }
.cat-modal-panel {
  background: #fff;
  border-radius: 10px;
  width: min(420px, 100%);
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.cat-modal-hd {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.cat-modal-title {
  font-weight: 600; font-size: 14px; color: var(--ink-1);
}
.cat-modal-close {
  background: transparent; border: 0; font-size: 22px;
  color: var(--ink-3); cursor: pointer; line-height: 1;
  width: 28px; height: 28px;
}
.cat-modal-close:hover { color: var(--ink-1); }
.cat-modal-body {
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.cat-modal-row {
  display: grid; grid-template-columns: 60px 1fr;
  gap: 12px; align-items: center;
}
.cat-modal-row label {
  font-size: 12px; color: var(--ink-2);
}
.cat-modal-row select {
  height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: #fff; font-size: 13px;
  font-family: inherit;
}
.cat-modal-task {
  font-family: ui-monospace, monospace;
  font-size: 11px; color: var(--ink-2);
  background: var(--bg-soft);
  padding: 4px 8px; border-radius: 4px;
}
.cat-modal-status {
  font-size: 12px; min-height: 18px;
}
.cat-modal-status.ok { color: #15803d; }
.cat-modal-status.err { color: #b91c1c; }
.cat-modal-status.info { color: var(--ink-3); }
.cat-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.cat-modal-cancel, .cat-modal-save {
  padding: 7px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; font-family: inherit;
}
.cat-modal-cancel {
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--line);
}
.cat-modal-cancel:hover { background: var(--bg-soft); color: var(--ink-1); }
.cat-modal-save {
  background: var(--brand-blue); color: #fff; border: 0;
}
.cat-modal-save:hover { background: var(--brand-blue-d); }


/* ════════════════════════════════════════════════════════════════════════════
   /viral 爆款 Agent — M1 (Linda 2026-05-27)
   - Tab 切换 (爆款库 / 品类管理 / Agent 生产)
   - 顶部添加新爆款 (URL 输入 + 扩展下载)
   - 筛选条 + 主表格
   - Drawer 详情 (右侧滑入, 含视频 / 自动字段 / STT / 10 个人工字段)
   - 装机指南 modal
   ════════════════════════════════════════════════════════════════════════════ */

.viral-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

/* ─ Tab 切换 ────────────────────────────────────────────────────── */
.viral-tabs {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.viral-tab {
  appearance: none; background: transparent; border: 0;
  padding: 10px 18px; cursor: pointer;
  font-size: 15px; color: var(--ink-2); font-weight: 500;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.viral-tab:hover { color: var(--ink-1); background: var(--bg-soft); }
.viral-tab.active {
  color: var(--brand-blue-dd); border-bottom-color: var(--brand-blue);
}
.viral-tab-hint {
  margin-left: auto; font-size: 12px; color: var(--ink-3); font-style: italic;
}

.viral-pane { display: none; }
.viral-pane.active { display: block; }
.viral-pane[hidden] { display: none !important; }

/* ─ 添加新爆款 卡片 [DEPRECATED v1] ─────────────────────────────
   Linda v8 5-27 M2.9: 已被 .viral-add-card-v2 替代, 保留兜底
*/
.viral-add-card { display: none; }
.viral-add-row, .viral-add-divider, .viral-add-label, .viral-add-input-row,
.viral-url-input, .viral-recent, .viral-recent-item, .viral-add-ext-row,
.viral-add-ext-hint { display: none; }

/* ─ v8 5-27: Stats 大字卡 (4 个 dashboard 卡片) ──────────────────── */
.viral-stats-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
}
.stat-card.stat-card-done {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue-l2);
}
.stat-num {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  font-variation-settings: "opsz" 24;
  color: var(--ink-1);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-card-done .stat-num { color: var(--brand-blue-dd); }
.stat-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
/* M5.6 5-30: stats header + 日期 picker + per-user chips ────────── */
.viral-stats-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.viral-stats-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.viral-stats-range {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.viral-stats-range select {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-card);
}
.viral-stats-custom {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.viral-stats-custom input[type=date] {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.viral-stats-range-display {
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
}
.stat-byuser {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.stat-user-chip {
  display: inline-block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.stat-user-chip.more {
  background: transparent;
  color: var(--ink-3);
  font-style: italic;
  cursor: help;
}
.stat-meta {
  font-size: 9px;
  text-transform: none;
  color: var(--ink-3);
  font-weight: 400;
  letter-spacing: 0;
}

/* ─ v8 5-27: 添加爆款 紧凑卡片 ──────────────────────────────────── */
.viral-add-card-v2 {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.viral-add-card-v2 .add-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.viral-add-card-v2 .add-label {
  flex: 0 0 38px;
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex; align-items: center; gap: 6px;
}
/* Linda v8.2 5-27: 分析 按钮极窄 (2 char 中文宽度对齐) — 之前 16px padding 把按钮撑爆了, 改 12px */
.viral-add-card-v2 .btn-analyze {
  padding: 5px 12px;
  flex: 0 0 auto;
  font-size: 12px;
}
.viral-add-card-v2 .add-url-input {
  flex: 1;
  min-width: 0;          /* Linda v8.2 5-27: 允许 input 缩小到任意宽度, 不再被 placeholder 撑住 → 让出空间给行内 button */
  padding: 7px 12px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  font-size: 13px; color: var(--ink-1);
  font-family: inherit;
  background: var(--bg-card);
}
.viral-add-card-v2 .add-url-input:focus {
  outline: 2px solid var(--brand-blue-l2);
  border-color: var(--brand-blue);
}
.viral-add-card-v2 .add-row-hint {
  margin-left: 48px;       /* label 38px + gap 10px = 48px, hint 跟 input 左对齐 */
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-3);
}
.viral-add-card-v2 .add-row-hint.inline {
  margin-left: 0;
  margin-top: 0;
  flex: 1;
}
.viral-add-card-v2 .add-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}
/* 扩展更新提醒 (Linda 2026-07-25 · v0.1.8 搜索页修复) — 全员重装后删本块 + 模板里那块.
   用品牌蓝 info 风格 (调色板无 green token, 保持 tokens). 跟按钮/hint 左对齐 (label 38 + gap 10 = 48). */
.viral-add-card-v2 .ext-update-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 0 48px;
  padding: 9px 12px;
  background: var(--brand-blue-l);
  border: 1px solid var(--brand-blue-l2);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--brand-blue-dd);
}
.viral-add-card-v2 .ext-update-note .ext-update-ic {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.35;
}
.viral-add-card-v2 .ext-update-note b {
  color: var(--brand-blue-dd);
  font-weight: 700;
}

/* ─ v8 5-27: 筛选条 (独立 1 行 + 右侧导出) ───────────────────────── */
.viral-filter-bar-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.viral-filter-bar-v2 .viral-filters {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.viral-filter-bar-v2 .viral-filters label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px;
}
.viral-filter-bar-v2 .viral-filters select {
  padding: 5px 8px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink-1);
  background: var(--bg-card);
  font-family: inherit;
}
.viral-filter-bar-v2 .viral-filters select:focus {
  outline: 2px solid var(--brand-blue-l2);
  border-color: var(--brand-blue);
}

/* ─ 主表格 ─────────────────────────────────────────────────────── */
.viral-grid-wrap {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.viral-grid {
  width: 100%; border-collapse: collapse; font-size: 14px;
}
.viral-grid thead th {
  background: var(--bg-soft); padding: 10px 12px;
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--ink-2); border-bottom: 1px solid var(--line);
}
.viral-grid tbody td {
  padding: 12px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.viral-grid tbody tr:last-child td { border-bottom: 0; }
.viral-grid tbody tr {
  cursor: pointer; transition: background .12s;
}
.viral-grid tbody tr:hover { background: var(--brand-blue-l); }
.viral-grid .col-seq { width: 40px; text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 500; }
.viral-grid .col-play { width: 50px; text-align: center; }
.viral-grid .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.viral-grid .col-num.strong { font-weight: 600; color: var(--ink-1); }
.viral-grid .col-title {
  max-width: 280px; min-width: 180px;
  font-size: 13px; color: var(--ink-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viral-grid .col-actions { white-space: nowrap; display: flex; gap: 6px; justify-content: flex-end; }

/* v8 5-27 Linda M2.9: 行内按钮 Claude 风 */
.viral-play-btn {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  width: 26px; height: 26px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background .12s, border-color .12s, color .12s;
}
.viral-play-btn:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue);
  color: var(--brand-blue-dd);
}
.viral-play-btn .lc-icon { width: 13px; height: 13px; }

/* row-retry-btn 改 Claude 风 (Lucide refresh icon, hover 蓝) */
.row-retry-btn {
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}
.row-retry-btn:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue);
  color: var(--brand-blue-dd);
}
.row-retry-btn:disabled { opacity: 0.6; cursor: wait; }

/* 平台 tag 弱化为统一灰底深字 */
.viral-platform-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2f7;
  color: #475569;
  letter-spacing: 0.02em;
}
/* 旧的彩色 douyin/xhs/bilibili/toutiao class 全部被上面覆盖, 统一灰 */
.viral-platform-tag.douyin,
.viral-platform-tag.xhs,
.viral-platform-tag.bilibili,
.viral-platform-tag.toutiao { background: #eef2f7; color: #475569; }

/* Linda v8.2 5-27: 抖音 tag 改 icon-only — 黑底白图 (官方品牌色), 圆角方块 */
.viral-platform-tag.with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 26px; height: 22px;
  background: #000;
  color: #fff;
  border-radius: 4px;
}
.viral-platform-tag.with-icon .lc-icon {
  width: 14px; height: 14px;
  stroke: none;
}

/* Linda 2026-08-06 拍板方案 B: TikTok tag — 黑底 + 音符图标 + wordmark。
   为什么不做成跟抖音一样的纯图标方块: 两家共用同一个音符 glyph, 只放图标分不出来。
   这里靠**形状**区分 — 抖音 26px 正方形只有图标, TikTok 是带 wordmark 的宽标签。
   不用 TikTok 品牌红 #FE2C55 是因为它跟小红书的 #ff2442 几乎同色, 会撞。 */
.viral-platform-tag.tiktok-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 7px;
  height: 22px;
  background: #000;
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  letter-spacing: 0.01em;
}
.viral-platform-tag.tiktok-brand .lc-icon {
  width: 12px; height: 12px;
  stroke: none;
}

/* Linda v8.4 5-27: 小红书 tag — 品牌红底 + 白色 wordmark, 跟抖音黑底音符同款风格 */
.viral-platform-tag.xhs-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  height: 22px;
  background: #ff2442;        /* 小红书品牌红 */
  color: #fff;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* 状态 pill 缩减为 3 档色 */
.viral-status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* 进行中: 蓝 */
.viral-status-pill.pending,
.viral-status-pill.analyzing {
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
}
/* 待审核: 琥珀 (等你审, Linda 6-02 拆开和已完成区分) */
.viral-status-pill.ready {
  background: #fef3c7; color: #92400e;
}
/* 已完成: 绿 (done) */
.viral-status-pill.complete {
  background: #d1fae5; color: #065f46;
}
/* 失败: 红 */
.viral-status-pill.failed {
  background: #fee2e2; color: #b91c1c;
}

.viral-empty {
  padding: 40px; text-align: center; color: var(--ink-3); font-size: 14px;
}

/* v8 5-27: 分页 Claude 风 */
.viral-pagination-v2 {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 12px;
}
.viral-pagination-v2 .page-num {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.viral-pagination-v2 .btn-flat:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* M5.6 paging Linda 5-30: 每页 X + 共 Y 条 */
.viral-pagination-v2 .page-size-label {
  font-size: 12px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.viral-pagination-v2 .page-size-label select {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-card);
}
.viral-pagination-v2 .page-total-info {
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ─ Drawer ───────────────────────────────────────────────────────── */
.viral-drawer-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
  z-index: 50;
}
.viral-drawer-overlay[hidden] { display: none; }
.viral-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 720px; max-width: 100vw;
  background: var(--bg-card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0,0,0,0.08);
  z-index: 51;
  display: flex; flex-direction: column;
  /* Linda v8.5 5-28: width transition (用 JS 拖拽时会临时关掉) */
  transition: width .2s ease;
}
.viral-drawer[hidden] { display: none; }
.viral-drawer.fullscreen { width: 100vw !important; }

/* Linda v8.5 5-28: 左边缘拖拽 splitter — 改宽度 */
.viral-drawer-splitter {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 100;
  background: transparent;
  transition: background .15s;
}
.viral-drawer-splitter:hover,
.viral-drawer-splitter.dragging {
  background: var(--brand-blue);
}
.viral-drawer-splitter::after {
  content: "";
  position: absolute;
  left: 1px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 40px;
  background: var(--line-2);
  border-radius: 2px;
  opacity: 0;
  transition: opacity .15s;
}
.viral-drawer-splitter:hover::after,
.viral-drawer-splitter.dragging::after {
  opacity: 1; background: #fff;
}

.viral-drawer-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
#viral-drawer-title {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--ink-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Linda v8.5 5-28: 全屏 toggle 按钮 (header 右上, 跟 close 同款风) */
.viral-drawer-fullscreen {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  width: 28px; height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
  padding: 0;
}
.viral-drawer-fullscreen:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue);
  color: var(--brand-blue-dd);
}
.viral-drawer-fullscreen .lc-icon { width: 14px; height: 14px; }

.viral-drawer-close {
  appearance: none; background: transparent; border: 0;
  font-size: 18px; cursor: pointer; color: var(--ink-3);
  width: 28px; height: 28px; border-radius: 4px;
}
.viral-drawer-close:hover { color: var(--ink-1); background: var(--bg-card); }
.viral-drawer-body {
  flex: 1; overflow-y: auto; padding: 18px;
}

/* drawer 上半 (视频 + 自动字段, 横排) */
.drawer-top {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 16px;
}
.drawer-video-box { }
.drawer-video-placeholder {
  background: var(--bg-soft); border: 1px dashed var(--line-2);
  border-radius: 8px; padding: 24px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 200px; justify-content: center;
}
.drawer-video-placeholder .video-icon { font-size: 36px; }
.drawer-video-placeholder .video-hint { font-size: 12px; color: var(--ink-3); }

.drawer-auto-box h4 {
  margin: 0 0 8px; font-size: 13px; color: var(--ink-2); font-weight: 600;
}
.drawer-auto-box h5 {
  margin: 12px 0 6px; font-size: 12px; color: var(--ink-3); font-weight: 500;
}
.drawer-auto-list {
  display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px;
  margin: 0; font-size: 12px;
}
.drawer-auto-list dt {
  color: var(--ink-3); font-weight: 400;
}
.drawer-auto-list dd {
  margin: 0; color: var(--ink-1); font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.drawer-comments {
  list-style: none; padding: 0; margin: 0;
  font-size: 12px;
}
.drawer-comments li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; border-bottom: 1px dashed var(--line);
}
.drawer-comments .comment-text { color: var(--ink-1); flex: 1; }
.drawer-comments .comment-digg { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.drawer-section { margin-bottom: 16px; }
.drawer-section h4 {
  margin: 0 0 6px; font-size: 13px; color: var(--ink-2); font-weight: 600;
}
.drawer-transcript {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 10px 12px;
  font-size: 13px; color: var(--ink-1); line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}

.drawer-divider {
  border: 0; border-top: 1px solid var(--line); margin: 16px 0;
}

/* drawer 下半 (人工字段编辑) */
.drawer-edit-box h4 {
  margin: 0 0 12px; font-size: 13px; color: var(--ink-2); font-weight: 600;
}
.edit-row {
  margin-bottom: 12px;
}
.edit-row label {
  display: block; font-size: 12px; color: var(--ink-3);
  margin-bottom: 4px;
}
.edit-input {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--line-2); border-radius: 4px;
  font-size: 13px; color: var(--ink-1); font-family: inherit;
  background: var(--bg-card);
  resize: vertical;
}
.edit-input:focus {
  outline: 2px solid var(--brand-blue-l2); border-color: var(--brand-blue);
}
textarea.edit-input { line-height: 1.5; }

.drawer-footer {
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
}
.drawer-meta { font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.drawer-btn-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: flex-end;   /* Linda v7.4 5-27: 审核段按钮靠右下 */
}

/* ─ M2 占位 (品类管理 / Agent 生产) ─────────────────────────── */
.viral-placeholder {
  background: var(--bg-card); border: 1px dashed var(--line-2);
  border-radius: 8px; padding: 40px;
  text-align: center; color: var(--ink-2);
}
.viral-placeholder h3 { color: var(--ink-1); margin: 0 0 8px; }
.viral-placeholder p { margin: 6px 0; font-size: 14px; }

/* ─ 装机指南 modal ──────────────────────────────────────────────── */
.ext-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
}
.ext-modal-overlay[hidden] { display: none; }
.ext-modal-panel {
  background: var(--bg-card); border-radius: 12px;
  max-width: 600px; width: 95%;
  max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.ext-modal-header {
  display: flex; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.ext-modal-header h3 { flex: 1; margin: 0; font-size: 16px; color: var(--ink-1); }
.ext-modal-close {
  appearance: none; background: transparent; border: 0;
  font-size: 18px; cursor: pointer; color: var(--ink-3);
  width: 28px; height: 28px; border-radius: 4px;
}
.ext-modal-close:hover { color: var(--ink-1); background: var(--bg-soft); }
.ext-modal-body {
  padding: 18px; overflow-y: auto;
  font-size: 14px; color: var(--ink-1); line-height: 1.6;
}
.ext-steps { padding-left: 22px; margin: 0 0 12px; }
.ext-steps li { margin-bottom: 8px; }
.ext-modal-body code {
  background: var(--bg-soft); padding: 1px 6px;
  border-radius: 3px; font-size: 12px;
  font-family: 'JetBrains Mono', 'Menlo', monospace;
}
.ext-modal-body kbd {
  background: var(--bg-soft); border: 1px solid var(--line-2);
  padding: 2px 6px; border-radius: 3px; font-size: 11px;
  font-family: inherit; box-shadow: 0 1px 0 var(--line);
}


/* ════════════════════════════════════════════════════════════════════════════
   /viral M2 drawer — 9 分组折叠 + AI/人双栏 + 反馈三件套 (Linda 2026-05-27)
   ════════════════════════════════════════════════════════════════════════════ */

/* ─ 9 分组折叠面板 ──────────────────────────────────────────────── */
.drawer-group {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}
.drawer-group-head {
  padding: 10px 14px;
  background: var(--bg-soft);
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  user-select: none;
  font-size: 13px;
  border-bottom: 1px solid transparent;
}
.drawer-group-head:hover { background: var(--brand-blue-l); }
.drawer-group-caret {
  display: inline-block; transition: transform .15s;
  color: var(--ink-3); font-size: 10px;
}
.drawer-group.open .drawer-group-caret { transform: rotate(90deg); color: var(--ink-1); }
.drawer-group.open .drawer-group-head { border-bottom-color: var(--line); }
.drawer-group-title {
  font-weight: 600; color: var(--ink-1);
}
.drawer-group-body {
  display: none;
  padding: 14px;
}
.drawer-group.open .drawer-group-body { display: block; }

/* ─ 自动字段块 ──────────────────────────────────────────────── */
.drawer-auto-fields { display: flex; flex-direction: column; gap: 10px; }
.drawer-title-box {
  border-top: 1px solid var(--line); padding-top: 8px;
}
.drawer-title-label {
  font-size: 11px; color: var(--ink-3); font-weight: 500;
  margin-bottom: 4px;
}
.drawer-title-content {
  font-size: 13px; color: var(--ink-1); line-height: 1.5;
}
.drawer-comments-box {
  border-top: 1px solid var(--line); padding-top: 8px;
}
/* M6 (Linda 6-03): 高赞评论 (抖音 Top 20, 默认显示 5 + 展开) */
.drawer-comments-box .tc-cnt { font-size: 11px; font-weight: 400; color: var(--ink-3); }
.tc-list { display: flex; flex-direction: column; }
.tc-row { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tc-row:last-child { border-bottom: 0; }
.tc-avatar {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-blue-l); color: var(--brand-blue-dd);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.tc-body { flex: 1; min-width: 0; }
.tc-name { font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
.tc-text { font-size: 13px; color: var(--ink-1); line-height: 1.5; word-break: break-word; }
.tc-digg {
  flex: none; display: flex; align-items: center; gap: 3px;
  color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums;
  padding-top: 1px; white-space: nowrap;
}
.tc-digg svg { width: 13px; height: 13px; }
.tc-more {
  margin-top: 8px; font-size: 12px; color: var(--brand-blue);
  cursor: pointer; user-select: none;
}
.tc-more:hover { color: var(--brand-blue-dd); text-decoration: underline; }
.tc-empty { font-size: 12px; color: var(--ink-3); padding: 6px 0; font-style: italic; }

/* ─ 口播文案 (STT) ──────────────────────────────────────────────── */
.transcript-edit {
  width: 100%;
  font-family: inherit; line-height: 1.5;
  font-size: 13px;
  background: var(--bg-soft);
}
.drawer-section-actions {
  margin-top: 8px; display: flex; gap: 6px; justify-content: flex-end;
}

/* ─ AI 字段三件套 (AI 一栏 + 人一栏 + 反馈按钮) ───────────────── */
.ai-fields-box { display: flex; flex-direction: column; gap: 14px; }

.ai-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--bg-card);
}
.ai-field-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.ai-field-label {
  flex: 1; font-size: 12px; color: var(--ink-2); font-weight: 600;
}
.ai-field-actions { display: flex; gap: 2px; }
.btn-icon {
  appearance: none; background: transparent; border: 0;
  cursor: pointer; padding: 4px 6px;
  font-size: 13px; line-height: 1;
  border-radius: 4px;
  color: var(--ink-3);
  transition: all .12s;
}
.btn-icon:hover {
  background: var(--bg-soft); color: var(--ink-1);
}
.btn-icon.active {
  background: var(--brand-blue-l); color: var(--brand-blue-dd);
}

.ai-row {
  display: flex; gap: 8px; margin-top: 4px;
  align-items: stretch;
}
.ai-row-tag {
  flex: 0 0 36px;
  font-size: 11px; font-weight: 500;
  color: var(--ink-3);
  padding-top: 6px;
}
.ai-row-value {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 13px; color: var(--ink-1);
  line-height: 1.5;
  white-space: pre-wrap;
  min-height: 28px;
}
.ai-row-value.empty { color: var(--ink-3); font-style: italic; }
.ai-row-value.has-value { color: var(--ink-1); }

.ai-row.ai-human .edit-input {
  flex: 1; margin: 0;
}
.ai-field-foot {
  margin-top: 6px; display: flex; justify-content: flex-end;
}

/* ─ 普通字段 (听觉 / 剪辑 / 创意决策 / 复用) ────────────────── */
.plain-fields-box { display: flex; flex-direction: column; gap: 10px; }
.plain-fields-box .edit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.plain-fields-box .edit-row label {
  grid-column: 1 / -1;
  font-size: 11px; color: var(--ink-3);
  margin-bottom: -2px;
}
.plain-fields-box .edit-row > .edit-input,
.plain-fields-box .edit-row > select.edit-input,
.plain-fields-box .edit-row > input.edit-input {
  width: 100%;
}

/* ─ 通用 sm/xs btn ──────────────────────────────────────────── */
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.xs { padding: 3px 8px; font-size: 11px; }

/* ─ 占位段 ─────────────────────────────────────────────────── */
.viral-placeholder-inline {
  padding: 14px; text-align: center; color: var(--ink-2);
  font-size: 13px; line-height: 1.6;
}
.viral-placeholder-inline .small {
  font-size: 11px; color: var(--ink-3);
}

/* ─ M2.5: ⚙ Prompt modal (Agent 配置) ─────────────────────────── */
.btn-icon.admin-only {
  color: var(--brand-blue-dd);
}
.btn-icon.admin-only:hover {
  background: var(--brand-blue-l);
}
.agent-prompt-panel { max-width: 720px; width: 95%; }
.agent-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.agent-section:last-child { border-bottom: 0; }
.agent-section h4 {
  margin: 0 0 6px; font-size: 14px; color: var(--ink-1);
}
.agent-section label {
  display: block;
  font-size: 11px; color: var(--ink-3); margin: 8px 0 4px;
}
.agent-stats {
  font-size: 12px; color: var(--ink-2); margin-bottom: 8px;
}
.agent-stats .stat-good { color: #15803d; font-weight: 500; }
.agent-stats .stat-bad { color: #b91c1c; font-weight: 500; }
.agent-stats .stat-partial { color: var(--brand-blue-dd); font-weight: 500; }
.agent-prompt-content {
  width: 100%; font-family: inherit;
  font-size: 13px; line-height: 1.5;
}
.agent-section-actions {
  display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.agent-history-list {
  list-style: none; padding: 0; margin: 0;
}
.agent-history-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 8px;
  background: var(--bg-soft);
}
.agent-history-title {
  font-weight: 600; font-size: 13px; color: var(--ink-1);
}
.agent-history-stats {
  font-weight: 400; font-size: 11px; color: var(--ink-3);
  margin-left: 8px;
}
.agent-history-content {
  margin: 6px 0; font-size: 12px; color: var(--ink-2);
  line-height: 1.4; white-space: pre-wrap;
}
.agent-history-actions {
  display: flex; gap: 6px;
}

/* ─ M2.6: 分镜子表 (人手填) ─────────────────────────────────────── */
.shots-container { font-size: 12px; }
.shots-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.shots-count { color: var(--ink-2); flex: 1; }

/* M4.1-hotfix3 Linda 2026-05-28: 强制重跑 checkbox label */
.shots-rerun-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--ink-2);
  cursor: pointer;
  padding: 0 6px;
  user-select: none;
}
.shots-rerun-toggle input[type="checkbox"] {
  width: 13px; height: 13px;
  cursor: pointer;
  margin: 0;
}
.shots-rerun-toggle:hover { color: var(--brand-blue-dd); }

/* M4.1 Linda 2026-05-28: ✨ AI 填写分镜按钮 (icon-only 蓝色) */
.btn-ai-fill {
  background: transparent;
  border: 1px solid var(--brand-blue-l2);
  color: var(--brand-blue);
  border-radius: 6px;
  width: 28px; height: 28px;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s;
}
.btn-ai-fill .lc-icon { width: 16px; height: 16px; }
.btn-ai-fill:hover:not(:disabled) {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue);
  color: var(--brand-blue-dd);
}
.btn-ai-fill:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}
.btn-ai-fill:disabled,
.btn-ai-fill.running {
  background: var(--brand-blue-l);
  cursor: progress;
  opacity: 0.7;
}
.btn-ai-fill.running .lc-icon {
  animation: ai-fill-spin 1.2s linear infinite;
}
@keyframes ai-fill-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.shots-empty {
  padding: 20px; text-align: center; color: var(--ink-3);
  border: 1px dashed var(--line-2); border-radius: 6px;
}
.shots-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.shots-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

/* M4.1-hotfix5 (Linda 5-28): fixed layout — width 严格按 colgroup, 不被长内容撑大 */
/* M4.1-hotfix6: 加 start/end 2 列 + 时长/景别/运镜 翻倍 → 总宽 1432px */
.shots-table-fixed {
  table-layout: fixed;
  width: auto;
  /* M6 (Linda 6-02): +首帧72 +字幕180, caption 280→240
     72+40+64+64+64+96+96+280+240+180+80+88+88+160+32 = 1644 */
  min-width: 1644px;
}

/* M6 (Linda 6-02): 首帧缩略图列 */
.shots-table td.shot-frame-cell { padding: 3px; text-align: center; vertical-align: middle; }
.shot-frame-thumb {
  width: 54px; height: 72px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line-2);
  background: var(--bg-soft); cursor: zoom-in; display: block; margin: 0 auto;
}
.shot-frame-thumb:hover { border-color: var(--brand-blue); }
.shot-frame-miss { font-size: 10px; color: var(--ink-3); padding: 10px 2px; line-height: 1.3; }
.shot-frame-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0, 0, 0, 0.82);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out; padding: 24px;
}
.shot-frame-lightbox img {
  max-width: 92vw; max-height: 92vh;
  border-radius: 8px; box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
}
.shots-table-fixed th,
.shots-table-fixed td {
  overflow: hidden;
}
.shots-table-fixed th {
  position: relative;  /* M4.1-hotfix6: 给 .col-resizer 做 absolute positioning context */
}
.shots-table-fixed textarea {
  resize: vertical;
}

/* M4.1-hotfix6: 列拖拽 handle (4px 蓝色 hover, 绝对定位 th 右边缘) */
.col-resizer {
  position: absolute;
  right: -2px;
  top: 0; bottom: 0;
  width: 4px;
  cursor: col-resize;
  user-select: none;
  background: transparent;
  transition: background 0.15s;
  z-index: 3;
}
.col-resizer:hover,
.col-resizer.dragging {
  background: var(--brand-blue);
}

/* M4.1-hotfix6: timestamp 列 mono 字体 居中 readOnly (e.g. "0:05.8") */
.shots-table td.time-stamp {
  padding: 6px 4px;
  color: var(--ink-2);
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  font-size: 11px;
  white-space: nowrap;
}

/* M4.1-hotfix5: 景别/运镜 strict select (只能选 Shawn 默认 6/9 项) */
.shots-select-strict {
  width: 100%;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  background: transparent;
  cursor: pointer;
  min-height: 28px;
}
.shots-select-strict:focus {
  outline: none;
  border-color: var(--brand-blue);
  background: var(--bg-card);
}
.shots-select-strict:hover {
  background: var(--bg-soft);
}
.shots-table th {
  background: var(--bg-soft);
  padding: 6px 8px;
  text-align: left;
  font-size: 11px; font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0;
}
.shots-table td {
  padding: 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.shots-table td.readonly {
  padding: 6px 8px;
  color: var(--ink-3);
  text-align: center;
  font-weight: 500;
}
.shots-table input, .shots-table textarea {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  background: transparent;
  resize: vertical;
  min-height: 28px;
}
.shots-table input:focus, .shots-table textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  background: var(--bg-card);
}
.shots-table textarea { line-height: 1.4; }
.shots-table input.saving, .shots-table textarea.saving {
  background: #fef3c7;
}
.shots-table input.saved, .shots-table textarea.saved {
  background: #d1fae5;
}
.shot-delete {
  color: #b91c1c;
  font-size: 12px;
  padding: 4px;
}
.shot-delete:hover { background: #fee2e2; }
.shots-op-col { width: 40px; text-align: center; }
.shots-foot {
  margin-top: 6px; font-size: 11px; color: var(--ink-3);
}

/* ─ Linda v5 5-27: drawer 视频播放器 + 大 prompt 设置按钮 + 分镜整体备注 */
.drawer-video-player {
  width: 100%;
  max-height: 360px;
  background: #000;
  border-radius: 6px;
  display: block;
}
.drawer-video-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; font-size: 11px; color: var(--ink-3);
}
.drawer-video-meta .small {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.prompt-config-btn {
  background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
  font-weight: 500;
  padding: 3px 10px;
}
.prompt-config-btn:hover {
  background: #fde68a;
}

.shots-notes-section {
  margin-bottom: 12px;
}
.shots-freetext {
  width: 100%; min-height: 80px;
  font-family: inherit; line-height: 1.5; font-size: 13px;
}

/* ════════════════════════════════════════════════════════════════════════════
   Linda v7 5-27: Claude 风 drawer — 蓝主色调 + Fraunces serif + Lucide icon
   设计语言:
     · 冷调极浅底 (#f7f9fc) + 偶数段微差底 (#f1f5f9), 无重横线
     · 段标题 Fraunces serif 18px (跟站点 logo 同字体族)
     · 必填段左 4px 蓝色高亮条 (--brand-blue)
     · 按钮: 1px solid 灰边 + 白底 + 6px 圆角, hover 浅灰; 准/不准 hover 才显绿/红
     · icon: Lucide 风 inline SVG 14px, stroke 2, currentColor
     · AI/Human 用小 chip (uppercase tracking)
   ════════════════════════════════════════════════════════════════════════════ */

/* 视频顶部独立段 (无标题)
   Linda v8.5 5-28 M2.13: sticky 固定在 drawer body 顶部 + 占视口 1/3 + 等比缩放
   Linda 5-28 M5.1: 高度可拖, --video-h CSS var 控制, JS 拖拽 handle 改 var + localStorage 记忆
   - 默认 33vh, 最小 180px, 最大 70vh (drawer body 几乎全占)
   - 视频本体 object-fit: contain, 等比缩放不变形 (竖屏两侧留白, 横屏宽撑满) */
.drawer-video-section {
  --video-h: 33vh;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-card);
  padding-bottom: 16px;          /* 留 handle 视觉空间 */
  height: var(--video-h);
  min-height: 180px;
  max-height: 70vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}
.drawer-video-section .drawer-video-box {
  max-height: calc(var(--video-h) - 16px);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.drawer-video-section .drawer-video-player {
  max-height: calc(var(--video-h) - 16px);
  max-width: 100%;
  width: auto;            /* 等比缩放 — 竖屏不强撑 100% */
  height: auto;
  object-fit: contain;    /* 不变形 / 不裁切 */
  background: #000;
}
.drawer-video-section .drawer-video-placeholder {
  max-height: calc(var(--video-h) - 16px);
}

/* M5.1 (Linda 2026-05-28): 视频框底边拖拽 handle 调高度 (跟 col-resizer 一个风格)
   60px 宽居中, 6px 高, 默认浅灰, hover/dragging 时变蓝. 鼠标 row-resize 光标. */
.drawer-video-resizer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 6px;
  cursor: row-resize;
  background: var(--line);
  border-radius: 3px;
  transition: background 0.15s, width 0.15s;
  z-index: 10;
  user-select: none;
}
.drawer-video-resizer:hover,
.drawer-video-resizer.dragging {
  background: var(--brand-blue);
  width: 80px;
}

/* 6 大段 */
/* ─ M5.6 (Linda 5-30): drawer 分 Tab ────────────────────────────── */
.drawer-tab-nav {
  display: flex;
  gap: 4px;
  margin: 12px -18px 0;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-page);
  z-index: 5;
}
.drawer-tab-nav .drawer-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.drawer-tab-nav .drawer-tab:hover {
  color: var(--brand-blue-dd);
}
.drawer-tab-nav .drawer-tab.active {
  color: var(--brand-blue-dd);
  border-bottom-color: var(--brand-blue);
}
.drawer-tab-content { /* container, no extra style */ }
.drawer-tab-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  margin: 16px -18px 0;
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  z-index: 4;
}
.drawer-tab-footer .draft-summary {
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}
.drawer-tab-footer .drawer-tab-actions {
  display: flex;
  gap: 8px;
}
.drawer-tab-footer .save-batch-btn {
  font-weight: 600;
  padding: 6px 14px;
}
.drawer-tab-footer .save-batch-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Dirty 字段 — 橙色边框 + 浅橙背景 提示未保存 */
.field-dirty {
  border-color: #f59e0b !important;
  background-color: #fffbeb !important;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
}

.drawer-section-v6 {
  margin: 0 -18px;
  padding: 22px 18px 24px;
  position: relative;
  background: var(--bg-card);
}
.drawer-section-v6:nth-of-type(even) {
  background: var(--bg-soft);
}
/* 必填段: 左侧 4px 蓝色高亮条 */
.drawer-section-v6.required::before {
  content: "";
  position: absolute;
  left: 0; top: 22px; bottom: 22px;
  width: 4px;
  background: var(--brand-blue);
  border-radius: 0 2px 2px 0;
}

.drawer-section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.drawer-section-title {
  margin: 0;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
  font-variation-settings: "opsz" 18;
  color: var(--ink-1);
  letter-spacing: -0.2px;
  line-height: 1.2;
}
.drawer-section-tag {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-weight: 600;
}
.drawer-section-v6.required .drawer-section-tag {
  color: var(--brand-blue);
  border-color: var(--brand-blue-l2);
  background: var(--brand-blue-l);
}
.drawer-section-body { }

.subtitle {
  font-size: 10px; color: var(--ink-3);
  font-weight: 600;
  margin: 14px 0 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.subtitle:first-child { margin-top: 0; }

.row-actions {
  margin-top: 8px;
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ─ 基础数据 grid (替代旧 drawer-auto-list 的 64px+1fr 双列) ──────────── */
.basic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px 18px;
  margin-bottom: 12px;
}
.basic-grid .cell .k {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 2px;
}
.basic-grid .cell .v {
  font-size: 14px;
  color: var(--ink-1);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.basic-grid .cell.span-2 { grid-column: span 2; }
.basic-grid .cell.span-3 { grid-column: span 3; }
.basic-grid .cell.span-all { grid-column: 1 / -1; }
.basic-grid .cell .v.long {
  font-size: 13px; font-weight: 400; line-height: 1.5;
}
.basic-grid .cell.action {
  display: flex; align-items: flex-end; justify-content: flex-start;
}

/* ─ Lucide-style inline icon ─────────────────────────────────────────── */
.lc-icon {
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ─ 平直按钮 (Claude 风: 1px 灰边 + 白底 + 6px 圆角) ─────────────────── */
.btn-flat {
  appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-family: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  line-height: 1;
}
.btn-flat:hover {
  background: var(--bg-soft);
  border-color: var(--ink-3);
  color: var(--ink-1);
}
.btn-flat.btn-approve:hover {
  background: #f0fdf4; border-color: #16a34a; color: #15803d;
}
.btn-flat.btn-reject:hover {
  background: #fef2f2; border-color: #dc2626; color: #b91c1c;
}
.btn-flat.btn-primary {
  background: var(--brand-blue);
  border-color: var(--brand-blue-d);
  color: #fff;
  width: auto;        /* Linda v8.3 5-27: 反污染老 .btn-primary 的 width: 100% (line 315) — 不然 btn 会拉满整行 */
}
.btn-flat.btn-primary:hover {
  background: var(--brand-blue-d);
  border-color: var(--brand-blue-dd);
  color: #fff;
}
.btn-flat.btn-accent {
  border-color: var(--brand-blue-l2);
  color: var(--brand-blue);
}
.btn-flat.btn-accent:hover {
  background: var(--brand-blue-l);
  border-color: var(--brand-blue);
  color: var(--brand-blue-dd);
}
/* v7.2: icon-only 准/不准 — 正方按钮 */
.btn-flat.icon-only {
  padding: 0;
  width: 28px;
  height: 28px;
  justify-content: center;
  gap: 0;
}
.btn-flat.icon-only .lc-icon {
  width: 15px; height: 15px;
}

/* AI 字段 actions: 覆盖旧规则, 使用 btn-flat */
.ai-field-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
/* 旧 .btn 在 actions 区的样式被 btn-flat 接管, 这里只保留不重要的兜底 */
.ai-field-actions .btn { /* legacy fallback, 新代码用 .btn-flat */
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-weight: 500;
}
.ai-field-actions .btn:hover {
  background: var(--bg-soft);
  color: var(--ink-1);
}

/* ─ AI / Human chip (替代旧 ai-row-tag 文字) ─────────────────────────── */
.role-chip {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 7px;
  border-radius: 999px;
  line-height: 1;
  align-self: flex-start;
  margin-top: 6px;
}
.role-chip.role-ai {
  background: #eef2f7;
  color: #475569;
}
.role-chip.role-human {
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
}

/* v7.2 Linda 5-27: AI/Human 改 icon 固定宽 28px 完美对齐 */
.role-icon {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #eef2f7;
  color: #475569;
  align-self: flex-start;
  margin-top: 4px;
}
.role-icon.role-human {
  background: var(--brand-blue-l);
  color: var(--brand-blue-dd);
}
.role-icon .lc-icon {
  width: 15px; height: 15px;
}
/* 覆盖旧 .ai-row-tag, 使其用 chip 风格 (兼容旧 dom) */
.ai-row-tag {
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f7;
  align-self: flex-start;
  margin-top: 6px;
}

/* 反馈按钮 row (口播文案 顶部用) */
.field-feedback-row {
  display: flex; gap: 6px; margin-bottom: 8px;
  justify-content: flex-end;
}
.field-feedback-row .btn { /* legacy fallback */
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
}

/* ─ ai-field 卡片微调 (淡化边框, 更轻盈) ─────────────────────────── */
.drawer-section-v6 .ai-field {
  border-color: var(--line);
  background: var(--bg-card);
  border-radius: 8px;
}
.drawer-section-v6:nth-of-type(even) .ai-field {
  background: var(--bg-card);  /* 偶数段里 ai-field 仍用纯白, 跟段底色拉差 */
}
.drawer-section-v6 .ai-field-label {
  font-size: 13px; color: var(--ink-1); font-weight: 600;
}
.drawer-section-v6 .ai-row {
  align-items: flex-start;
}

/* 原页面 按钮 (基础数据段内) */
.btn-open-source {
  /* 继承 btn-flat.btn-accent */
}

/* ─ Linda 5-27 v7.1: 紧凑保存按钮 (右下处, 小蓝) ─────────────────────
   原 [icon+保存] flatBtn 太宽, 改成纯文字 + 实蓝 + 紧凑 padding
*/
.btn-save-mini {
  appearance: none;
  display: inline-block;
  background: var(--brand-blue);
  color: #fff;
  border: 1px solid var(--brand-blue-d);
  border-radius: 6px;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  line-height: 1.4;
  transition: background .12s, border-color .12s;
}
.btn-save-mini:hover {
  background: var(--brand-blue-d);
  border-color: var(--brand-blue-dd);
}
.btn-save-mini:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* edit-row: input + 保存按钮 改成纵向, 按钮自动右下 */
.plain-fields-box .edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  grid-template-columns: none;   /* 覆盖旧 grid */
}
.plain-fields-box .edit-row label {
  grid-column: auto;
  font-size: 11px; color: var(--ink-3);
  font-weight: 500;
}
.plain-fields-box .edit-row > .edit-input,
.plain-fields-box .edit-row > select.edit-input,
.plain-fields-box .edit-row > input.edit-input {
  width: 100%;
}
.plain-fields-box .edit-row > .btn-save-mini {
  align-self: flex-end;
  margin-top: 2px;
}

/* AI field 的保存按钮 ai-field-foot 同样靠右下 */
.ai-field-foot {
  margin-top: 8px;
  display: flex; justify-content: flex-end;
}

/* row-actions 已经 justify-content: flex-end, 不动 */




/* ═══════════════════════════════════════════════════════════════════
   M5.3 (Linda 2026-05-29): 多说话人 chip + popover + 分镜 speaker preview
   详见 docs/DIARIZATION_DESIGN.md + mockup/diarization_mock.html
═══════════════════════════════════════════════════════════════════ */

/* ─── 口播文案 sentence list ─── */
.transcript-segments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px 4px;
  border-radius: 6px;
  background: #fafafa;
  max-height: 320px;
  overflow-y: auto;
}
.tx-sentence {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1.55;
}
.tx-time {
  color: #9ca3af;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  padding-top: 3px;
  flex-shrink: 0;
}
.tx-text { flex: 1; padding-top: 1px; }
/* 按段内联编辑 (方案 A, Linda 6-02): 每段 text 变可编辑 textarea, 跟着内容自动长高 */
.tx-text-edit {
  flex: 1; min-width: 0;
  font: inherit; font-size: 13px; line-height: 1.55;
  padding: 3px 8px;
  border: 1px solid var(--line-2); border-radius: 5px;
  background: #fff; color: var(--ink-1);
  resize: none; overflow: hidden;
}
.tx-text-edit:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 2px var(--brand-blue-l); }
/* 编辑态: 说话人下拉 (改这句归谁 / ＋新说话人) + 行内 ＋/× 按钮 (Linda 6-02) */
.tx-spk-select {
  flex-shrink: 0; max-width: 96px;
  font-size: 11px; padding: 2px 4px; height: 26px;
  border: 1px solid var(--line-2); border-radius: 5px; background: #fff; color: var(--ink-1);
  cursor: pointer;
}
.tx-spk-select:focus { outline: none; border-color: var(--brand-blue); }
.tx-row-btn {
  flex-shrink: 0; width: 24px; height: 24px; padding: 0; line-height: 1;
  border: 1px solid var(--line-2); border-radius: 5px; background: #fff;
  cursor: pointer; font-size: 14px; color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.tx-row-add:hover { border-color: var(--brand-blue); color: var(--brand-blue); background: var(--brand-blue-l); }
.tx-row-del:hover { border-color: #dc2626; color: #fff; background: #dc2626; }
.tx-edit-hint { font-size: 11px; color: var(--ink-3); margin-left: 8px; }
.tx-empty-hint { font-size: 12px; color: var(--ink-3); padding: 8px 4px; font-style: italic; }

/* 「本片无人声」终态 (Linda 2026-08-07 拍板方案 A)。只在 stt_outcome='no_speech' 时出现 —— */
/* 那是**实测确证**的判定, 不是"transcript 空"的猜测 (全库 545 条空, 确证的只有 17 条)。 */
.tx-no-speech {
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 16px 14px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
}
.tx-ns-ico  { font-size: 19px; display: block; margin-bottom: 6px; opacity: .75; }
.tx-ns-main { font-weight: 600; }
.tx-ns-why  { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.tx-ns-act  { margin-top: 11px; }
.tx-ns-redo {
  font-size: 11.5px;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 3px 11px;
  color: var(--ink-2);
  cursor: pointer;
}
.tx-ns-redo:hover:not(:disabled) { border-color: var(--brand-blue); color: var(--brand-blue); }
.tx-ns-redo:disabled { opacity: .55; cursor: default; }
.transcript-toolbar {
  margin-top: 4px;
  margin-bottom: 4px;
}
.transcript-edit-box { margin-top: 4px; }

/* ─── speaker chip (6 色 cycle + 编辑 hover) ─── */
.spk-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  padding: 1.5px 8px;
  border-radius: 99px;
  margin-right: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: filter 0.1s, box-shadow 0.1s;
  vertical-align: 1px;
  user-select: none;
  flex-shrink: 0;
}
.spk-chip:hover:not(.unlabeled) {
  filter: brightness(1.08);
  box-shadow: 0 0 0 1.5px rgba(37, 99, 235, 0.4);
}
.spk-chip.s0 { background: #dbeafe; color: #1e40af; }   /* 蓝 */
.spk-chip.s1 { background: #fce7f3; color: #9d174d; }   /* 粉 */
.spk-chip.s2 { background: #d1fae5; color: #065f46; }   /* 绿 */
.spk-chip.s3 { background: #fed7aa; color: #9a3412; }   /* 橙 */
.spk-chip.s4 { background: #e9d5ff; color: #6b21a8; }   /* 紫 */
.spk-chip.s5 { background: #cffafe; color: #155e75; }   /* 青 */
.spk-chip.unlabeled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: default;
}

/* ─── speaker label 编辑 popover ─── */
.spk-edit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 998;
}
.spk-edit-popover {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 18px 22px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  border: 1px solid #d1d5db;
  z-index: 999;
  min-width: 300px;
}
.spk-edit-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.spk-edit-popover input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 6px;
}
.spk-edit-popover input:focus {
  outline: none;
  border-color: #2563eb;
}
.spk-edit-hint {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 10px;
}
.spk-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── 分镜子表 caption 列 speaker preview ─── */
.shot-speakers-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 4px;
  padding: 4px 5px;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
  max-height: 90px;
  overflow-y: auto;
}
.shot-speaker-line {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.shot-speaker-text {
  flex: 1;
  color: #4b5563;
}

/* M5.3 (Linda 5-29): drawer section header action button (右上方 "重新AI分析" 等) */
.drawer-section-head { display: flex; align-items: center; gap: 8px; }
.drawer-section-action-btn {
  margin-left: auto;  /* 推到右边 */
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  transition: filter 0.1s;
}
.drawer-section-action-btn.primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}
.drawer-section-action-btn.primary:hover { background: #1d4ed8; filter: brightness(1.05); }
.drawer-section-action-btn:disabled { opacity: 0.6; cursor: wait; }

/* ─── 图文笔记 drawer (Linda 2026-05-31, 详见 docs/IMAGE_TEXT_NOTES.md) ─────────── */
/* 双列: 左 图+正文+OCR / 右 AI 分析. 窄屏堆叠. 逻辑全复用视频 drawer, 只排版+字段不同. */
.it-drawer-grid { display: grid; grid-template-columns: 340px 1fr; }
@media (max-width: 860px) { .it-drawer-grid { grid-template-columns: 1fr; } }
.it-pane { padding: 16px; min-width: 0; }
.it-pane:first-child { border-right: 1px solid var(--line); background: var(--bg-soft); }
.it-label { font-size: 11px; color: var(--ink-3); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; margin: 16px 0 8px; }
.it-pane > .it-label:first-child { margin-top: 0; }

/* 画廊: 瀑布流 (column-count), 每张按原始比例不裁剪, 点击放大 */
.it-gallery { column-count: 2; column-gap: 8px; }
.it-gimg { break-inside: avoid; margin: 0 0 8px; position: relative; border-radius: 8px;
  overflow: hidden; cursor: zoom-in; background: var(--bg-soft); }
.it-gimg img { width: 100%; height: auto; display: block; }
.it-gimg:hover { outline: 2px solid var(--brand-blue); outline-offset: 1px; }
.it-cover-badge { position: absolute; top: 5px; left: 5px; background: rgba(0,0,0,.62);
  color: #fff; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.it-gallery-empty { color: var(--ink-3); font-size: 13px; padding: 16px 0; }
.it-interact { display: flex; gap: 14px; margin: 12px 0; font-size: 13px; color: var(--ink-1); }

/* 正文 / OCR 文本框: 只读 + 可拖底边缩放 (Linda 要求两个框都能缩放) */
.it-textbox { width: 100%; box-sizing: border-box; background: var(--bg-card);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 13px;
  line-height: 1.7; color: var(--ink-1); white-space: pre-wrap; resize: vertical;
  overflow: auto; min-height: 44px; font-family: inherit; }
.it-textbox.it-ocr { background: #fbfdff; border-style: dashed; border-color: #bae6fd; height: 150px; }

/* 右栏 AI 分析头 + ✨重新分析 */
.it-ai-head { display: flex; align-items: center; margin-bottom: 8px; }
.it-ai-title { font-size: 14px; font-weight: 700; color: var(--ink-1); }
.it-ai-head .drawer-section-action-btn { margin-left: auto; }

/* 核心观点+论据: AI 分析第一个框高亮 (视频 + 图文通用) */
.ai-field.core { background: #fffaf0; border: 1px solid #fde9b8; border-left: 3px solid #e0a52e;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ai-field.core .ai-field-label::before { content: "💡 "; }

/* lightbox 点击放大. 注意: .it-lightbox 有 display:flex, 必须 [hidden] 显式 display:none 才隐藏得了 */
.it-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 9999;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.it-lightbox[hidden] { display: none; }
.it-lightbox-img { max-width: 88vw; max-height: 90vh; border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); }

/* 列表: 封面缩略图列 + 类型列 (图文 5-31) */
.col-cover { width: 48px; }
.viral-cover-thumb { width: 38px; height: 50px; object-fit: cover; border-radius: 5px;
  background: var(--bg-soft); border: 1px solid var(--line); display: block; cursor: pointer; }
.viral-cover-thumb.broken { object-fit: contain; opacity: .5; }
.col-type { width: 44px; text-align: center; }
.viral-type-icon { font-size: 15px; cursor: default; }

/* ─── 生图部分失败提示 + 手动重跑 (Linda 6-01) ─────────────────────────── */
.img-retry-notice {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 13px; margin-top: 4px;
  background: var(--warn-d-bg, #fef3c7);
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: var(--warn-ink, #9a3412);
  font-size: 13px; line-height: 1.5;
}
.img-retry-btn { white-space: nowrap; }
.spinner-sm {
  width: 14px; height: 14px; flex-shrink: 0;
  border: 2px solid rgba(0, 0, 0, .12);
  border-top-color: var(--brand-blue, #2563eb);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

/* Loading spinner overlay on a ref slot while rotate-hydrate downloads the image
   (image.js / video.js setSlotLoading). .ref-thumb is position:relative. */
.ref-loading {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .22); border-radius: inherit;
}
.ref-loading .spinner-sm {
  width: 20px; height: 20px;
  border-color: rgba(255, 255, 255, .35);
  border-top-color: #fff;
}

/* ===========================================================================
   素材库 Asset Library (Linda 2026-06-01 P2) — /library 页 + folder-picker
   用 app 现有 light 主题变量 (跟全站一致; mock 是暗色只为对齐 Linda 参考图).
   =========================================================================== */
.lib-page { max-width: 1180px; margin: 0 auto; padding: 8px 4px 40px; }
.lib-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.lib-title { font-size: 18px; font-weight: 700; color: var(--ink-1); }
.lib-proj-wrap { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.lib-project-select { font-size: 13px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-card); color: var(--ink-1); }
.lib-spacer { flex: 1; }
.lib-upload-btn { background: var(--brand-blue); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lib-upload-btn:disabled { opacity: .45; cursor: not-allowed; }

.lib-body { display: flex; gap: 18px; align-items: flex-start; }
.lib-tree-col { width: 230px; min-width: 180px; max-width: 460px; flex: none; position: relative; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-card); padding: 10px; }
/* #2 侧栏可拖拽调宽 手柄 (Linda 2026-06-14): 右缘竖条, hover/拖动变蓝 */
.lib-resizer { position: absolute; top: 0; right: -3px; width: 8px; height: 100%; cursor: col-resize; border-radius: 8px; z-index: 2; }
.lib-resizer::after { content: ""; position: absolute; top: 50%; left: 3px; transform: translateY(-50%); width: 3px; height: 34px; border-radius: 3px; background: var(--line); transition: background .15s; }
.lib-resizer:hover::after, .lib-resizer.drag::after { background: var(--brand-blue); }
.lib-scope-seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 3px; margin-bottom: 6px; }
.lib-scope-seg button { flex: 1; border: none; background: none; color: var(--ink-3); font-size: 13px; font-weight: 600; padding: 6px 0; border-radius: 7px; cursor: pointer; }
.lib-scope-seg button.on { background: var(--bg-card); color: var(--brand-blue); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lib-scope-hint { font-size: 11px; color: var(--ink-3); margin: 0 2px 10px; }
/* #1 看别人 private 的 owner picker + 只读 banner (Linda 2026-06-14). 显隐用 .show class, 不用 [hidden]+display:flex */
.lib-owner-pick { display: none; align-items: center; gap: 6px; margin: 0 2px 8px; font-size: 12px; color: var(--ink-2); }
.lib-owner-pick.show { display: flex; }
.lib-owner-pick > span { flex: none; }
.lib-owner-pick select { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 5px 7px; font-size: 12.5px; color: var(--ink-1); background: var(--bg-card); cursor: pointer; }
.lib-ro-banner { display: none; background: #fff6ec; border: 1px solid #ffd9a8; color: #8a5a12; border-radius: 8px; padding: 6px 9px; font-size: 11.5px; line-height: 1.5; margin: 0 2px 8px; }
.lib-ro-banner.show { display: block; }
/* 只读浏览别人 private 时 (Linda 6-14, codex review): 隐藏所有写入口 ···/上传/新建夹 (canManage 已隐管理项, 这里清剩余 dots) */
.lib-page.ro-view .lib-dots,
.lib-page.ro-view .lib-card-dots,
.lib-page.ro-view .lib-upload-btn,
.lib-page.ro-view .lib-new-folder { display: none; }
.lib-tree { display: flex; flex-direction: column; min-height: 200px; }
.lib-tnode { display: flex; align-items: center; gap: 7px; padding: 7px 6px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-1); position: relative; }
.lib-tnode:hover { background: var(--bg-soft); }
.lib-tnode.on { background: var(--brand-blue-l); color: var(--brand-blue-dd); }
.lib-tnode .lib-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-badge { font-size: 9px; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 4px; }
.lib-fcount { font-size: 11px; color: var(--ink-3); }
.lib-fact { opacity: 0; border: none; background: none; cursor: pointer; color: var(--ink-3); font-size: 12px; padding: 0 2px; }
.lib-tnode:hover .lib-fact { opacity: 1; }
.lib-fact:hover { color: var(--brand-blue); }
.lib-new-folder { margin-top: 8px; width: 100%; border: 1px dashed var(--line-2); background: none; color: var(--ink-2); border-radius: 8px; padding: 7px; font-size: 12px; cursor: pointer; }
.lib-new-folder:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

.lib-grid-col { flex: 1; min-width: 0; }
.lib-grid-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.lib-grid-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lib-desc-toggle { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.lib-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; }
.lib-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg-card); }
.lib-card.sel { outline: 2px solid var(--brand-blue); outline-offset: -2px; }
.lib-thumb { position: relative; aspect-ratio: 1; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-thumb-icon { font-size: 34px; opacity: .6; }
.lib-kind { position: absolute; bottom: 5px; left: 5px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; border-radius: 4px; padding: 1px 5px; }
.lib-cb { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.85); border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.lib-card.sel .lib-cb, .lib-cb.on { background: var(--brand-blue); border-color: var(--brand-blue); }
.lib-cardname { padding: 6px 8px; font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-empty, .lib-loading { color: var(--ink-3); font-size: 13px; padding: 24px 8px; text-align: center; }
.lib-actionbar { position: sticky; bottom: 0; margin-top: 14px; display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.lib-selcount { font-size: 12px; font-weight: 600; color: var(--brand-blue); }
.lib-actbtn { border: 1px solid var(--line-2); background: var(--bg-card); color: var(--ink-1); border-radius: 7px; padding: 6px 12px; font-size: 12px; cursor: pointer; }
.lib-actbtn:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

/* M-LIB-2 (Linda 2026-06-03): 统一 ··· 菜单 + 卡片管理 + 客户根节点 */
.lib-troot { display: flex; align-items: center; gap: 7px; padding: 7px 6px; margin-bottom: 2px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-1); position: relative; }
.lib-troot:hover { background: var(--bg-soft); }
.lib-troot .lib-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-dots, .lib-card-dots { opacity: 1; border: none; background: none; cursor: pointer; color: var(--ink-3); font-weight: 700; letter-spacing: 1px; padding: 0 4px; border-radius: 5px; line-height: 1; }
.lib-dots:hover, .lib-card-dots:hover { background: var(--bg-soft); color: var(--ink-1); }
.lib-card-dots { position: absolute; top: 5px; right: 5px; background: rgba(255,255,255,.92); box-shadow: 0 1px 3px rgba(0,0,0,.18); font-size: 13px; padding: 1px 6px; color: var(--ink-2); }

/* 客户/子项目 下拉旁「···」管理按钮 (Linda 6-16) — 下拉只管选/新建, ··· 管 改名/归档/删除 */
.cp-sel-row { display: inline-flex; align-items: center; gap: 6px; }
.cp-dots { flex: none; width: 28px; height: 32px; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-card); cursor: pointer; color: var(--ink-2); font-weight: 700; letter-spacing: 1px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.cp-dots:hover { background: var(--bg-soft); color: var(--ink-1); }
.cp-dots[hidden] { display: none; }   /* 显式: 避免 [hidden] 被上面 display:inline-flex 盖掉 (UI 铁律 #2) */
/* 树 v6 (mock ①): 级联「子项目」下拉链 — 只在选中节点有子项目时出现 */
.cp-subchain { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cp-subchain .cp-sub { max-width: 220px; }
.cp-subgroup .cp-sub + .cp-sub { margin-top: 6px; }
/* 🔍 预览提示: hover 缩略图居中浮现, 不拦点击 (点图本身=预览) */
.lib-eye { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); opacity: 0; pointer-events: none; background: rgba(0,0,0,.5); color: #fff; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: opacity .12s; }
.lib-thumb:hover .lib-eye { opacity: 1; }
.lib-cb { cursor: pointer; }
.lib-cb:hover { border-color: var(--brand-blue); box-shadow: 0 0 0 2px var(--brand-blue-l); }
/* ··· 上下文菜单 (folder / asset / 选目标夹 共用) */
.lib-menu { position: fixed; min-width: 180px; max-width: 280px; max-height: 62vh; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.16); padding: 5px; font-size: 13px; z-index: 9500; }
.lib-menu-title { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px 9px 4px; }
/* M-LIB-3: folderPickerAll 的 客户·项目 分组头 + 资产内联改名输入框 */
.lib-menu-group { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 6px 9px 2px; border-top: 1px solid var(--line); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-menu-group:first-child { border-top: none; margin-top: 0; }
.lib-rename-input { width: 100%; box-sizing: border-box; font-size: 11px; padding: 2px 5px; border: 1px solid var(--brand-blue); border-radius: 5px; outline: none; }
.lib-toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px); background: rgba(20,30,50,.92); color: #fff; padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 9700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 80vw; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.lib-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.lib-menu-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; color: var(--ink-1); cursor: pointer; }
.lib-menu-item:hover { background: var(--bg-soft); }
.lib-menu-item.danger { color: #b91c1c; }
.lib-menu-item.dim { color: var(--ink-3); cursor: not-allowed; }
.lib-menu-item.dim:hover { background: none; }
.lib-menu-ic { width: 16px; text-align: center; flex: none; }
.lib-menu-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-menu-hint { font-size: 10px; color: var(--ink-3); flex: none; }
.lib-menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* folder-picker 弹窗 (library_picker.js) */
.lp-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 9000; }
.lp-modal { width: 400px; max-width: 92vw; max-height: 86vh; overflow: auto; background: var(--bg-card); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.3); padding: 20px; }
.lp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.lp-title { font-size: 16px; font-weight: 700; color: var(--ink-1); }
.lp-newfolder { border: none; background: none; color: var(--ink-3); font-size: 13px; cursor: pointer; font-weight: 600; }
.lp-newfolder:hover { color: var(--brand-blue); }
.lp-projrow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.lp-proj-select { flex: 1; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-card); color: var(--ink-1); font-size: 13px; }
.lp-seg { display: flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.lp-seg button { flex: 1; border: none; background: none; color: var(--ink-3); font-size: 13px; font-weight: 600; padding: 7px 0; border-radius: 7px; cursor: pointer; }
.lp-seg button.on { background: var(--bg-card); color: var(--brand-blue); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.lp-scope-hint { font-size: 11px; color: var(--ink-3); margin: 8px 2px 10px; }
.lp-tree { min-height: 200px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; padding: 4px; }
.lp-row { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--ink-1); }
.lp-row:hover { background: var(--bg-soft); }
.lp-check { width: 18px; height: 18px; flex: none; border-radius: 5px; border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; }
.lp-check.on { background: var(--brand-blue); border-color: var(--brand-blue); }
.lp-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-count { font-size: 11px; color: var(--ink-3); }
.lp-empty { color: var(--ink-3); font-size: 12px; padding: 18px; text-align: center; }
.lp-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.lp-btn { border-radius: 8px; padding: 8px 20px; font-size: 13px; font-weight: 600; cursor: pointer; }
.lp-cancel { background: var(--bg-card); border: 1px solid var(--line-2); color: var(--ink-1); }
.lp-save { background: var(--brand-blue); border: 1px solid var(--brand-blue); color: #fff; }
.lp-save:disabled { opacity: .55; cursor: not-allowed; }
/* M-LIB-2 (Linda 6-03): 弹窗文件夹行的 ··· 管理菜单触发 (hover 显) + 客户根行 */
.lp-dots { opacity: 0; border: none; background: none; cursor: pointer; color: var(--ink-3); font-weight: 700; letter-spacing: 1px; padding: 0 4px; border-radius: 5px; line-height: 1; flex: none; }
.lp-row:hover .lp-dots { opacity: 1; }
.lp-dots:hover { background: var(--bg-soft); color: var(--ink-1); }
.lp-root { font-weight: 600; color: var(--ink-1); }
.lp-root .lp-dots { opacity: 1; }

/* P3 (Linda 6-01): 生图/生视频结果卡片左上角「加入素材库」选择框 (Add to Library 按钮在工具条) */
.img-card-image { position: relative; }
.img-libcheck {
  position: absolute; top: 8px; left: 8px; z-index: 4;
  width: 24px; height: 24px; padding: 0; border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, .9); background: rgba(0, 0, 0, .4);
  color: #fff; font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.img-libcheck:hover { background: rgba(0, 0, 0, .6); }
.img-libcheck.on { background: var(--brand-blue); border-color: var(--brand-blue); }
.img-libcheck.on::before { content: "✓"; }

/* ───────────── 素材库「从库选参考」(Linda 6-02): 📁 入口按钮 + 统一 ＋📁 加入素材库 ───────────── */
/* 纯 📁 icon 的「从素材库选」按钮 (参考槽位旁, icon-only + hover tooltip) */
.lib-pick-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--bg-card); color: var(--brand-blue);
  cursor: pointer; flex: none;
}
.lib-pick-btn:hover { background: var(--brand-blue-l); border-color: var(--brand-blue); }
/* 参考区标题 + 📁 一行 */
.ref-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ref-label-row .form-label { margin-bottom: 0; }

/* ════════════════════════════════════════════════════════════════════════
   参考图上传组件 ref_uploader.js (Linda 2026-06-02) — manifest 有序列表
   上传框 (dropzone) 在上 + 横版有序 grid 在下 (多张一行, 可拖拽换序)。
   ════════════════════════════════════════════════════════════════════════ */
.ru-root { display: block; }
/* 上传框 */
.ru-dz {
  border: 1.5px dashed var(--line-2); border-radius: 8px;
  padding: 16px; text-align: center; cursor: pointer;
  background: var(--bg-soft); color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s;
}
.ru-dz:hover { border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.ru-dz.ru-dz-over { border-color: var(--brand-blue); background: var(--brand-blue-l); color: var(--brand-blue); }
.ru-dz.ru-dz-disabled { cursor: not-allowed; opacity: .6; }
.ru-dz.ru-dz-disabled:hover { border-color: var(--line-2); background: var(--bg-soft); color: var(--ink-2); }
.ru-dz-big { font-size: 13px; }
.ru-dz-small { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.ru-file-input { display: none; }
/* 超限 / 不支持 警告条 */
.ru-warn {
  margin-top: 8px; padding: 7px 10px; border-radius: 6px;
  background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
  font-size: 12px; line-height: 1.5;
}
/* 有序列表 (横版, 多张一行) */
.ru-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ru-list.ru-list-over { outline: 2px dashed var(--brand-blue); outline-offset: 4px; border-radius: 8px; }
.ru-tile {
  position: relative; width: 104px; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden; background: var(--bg-soft);
  cursor: grab; transition: box-shadow .12s, outline .12s;
}
.ru-tile:active { cursor: grabbing; }
.ru-tile.ru-dragging { opacity: .4; }
/* 拖拽换序插入指示 (左/右蓝条) */
.ru-tile.ru-insert-before { box-shadow: -3px 0 0 0 var(--brand-blue); }
.ru-tile.ru-insert-after  { box-shadow:  3px 0 0 0 var(--brand-blue); }
.ru-tile.ru-tile-error { border-color: #dc2626; }
.ru-tile.ru-tile-loading { cursor: default; }
.ru-thumb {
  position: relative; height: 78px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-soft);
}
.ru-thumb.ru-clickable { cursor: zoom-in; }
.ru-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ru-errmark {
  width: 26px; height: 26px; border-radius: 50%; background: #fee2e2; color: #dc2626;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px;
}
/* 顺序角标 (左上) */
.ru-ord {
  position: absolute; top: 4px; left: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
/* × 删除 (右上) */
.ru-rm {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.ru-rm:hover { background: #dc2626; transform: scale(1.1); }
/* 🔍 预览 (右下) */
.ru-peek {
  position: absolute; bottom: 4px; right: 4px; width: 20px; height: 20px;
  border: none; border-radius: 5px; background: rgba(0,0,0,.5); color: #fff;
  font-size: 11px; line-height: 1; cursor: zoom-in; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.ru-peek:hover { background: rgba(0,0,0,.75); }
/* 库 角标 (左下) */
.ru-libtag {
  position: absolute; bottom: 4px; left: 4px;
  background: var(--brand-blue); color: #fff; font-size: 9px;
  padding: 1px 5px; border-radius: 4px;
}
/* 文件名 */
.ru-nm {
  font-size: 10.5px; color: var(--ink-2); padding: 4px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ru-tile-error .ru-nm { color: #dc2626; }

/* 统一的「加入素材库」按钮 ＋📁 (count) — 生图/生视频/历史三页共用 */
.lib-addbtn { display: inline-flex; align-items: center; gap: 5px; }
.lib-addbtn .lib-plus { font-size: 15px; line-height: 1; }
.lib-addbtn .lib-count {
  background: var(--brand-blue-l); color: var(--brand-blue); font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
}

/* 浏览-选取弹窗 (LibraryAssetPicker) */
.lap-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); display: flex; align-items: center; justify-content: center; z-index: 1200; }
.lap-modal { width: 760px; max-width: 94vw; height: 560px; max-height: 90vh; background: var(--bg-card); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .28); }
.lap-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.lap-title { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-1); }
.lap-title svg { color: var(--brand-blue); }
.lap-kindtag { background: var(--brand-blue-l); color: var(--brand-blue); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 6px; }
.lap-x { border: none; background: none; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.lap-top { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lap-lbl { font-size: 12px; color: var(--ink-2); }
.lap-select { height: 34px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font-size: 13px; color: var(--ink-1); background: var(--bg-card); }
.lap-body { flex: 1; display: flex; min-height: 0; }
.lap-left { width: 210px; border-right: 1px solid var(--line); padding: 12px; overflow: auto; flex: none; }
.lap-seg { display: flex; background: var(--bg-soft); border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.lap-seg button { flex: 1; border: none; background: none; height: 28px; border-radius: 6px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.lap-seg button.on { background: var(--bg-card); color: var(--brand-blue); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.lap-tree { display: flex; flex-direction: column; gap: 2px; }
.lap-trow { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; font-size: 13px; color: var(--ink-1); cursor: pointer; }
.lap-trow:hover { background: var(--bg-soft); }
.lap-trow.on { background: var(--brand-blue-l); color: var(--brand-blue); font-weight: 600; }
.lap-trow svg { color: var(--ink-3); flex: none; }
.lap-trow.on svg { color: var(--brand-blue); }
.lap-fname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lap-fcount { font-size: 11px; color: var(--ink-3); }
/* M-LIB-2 (Linda 6-03): 选取弹窗的 ··· 管理 (文件夹行 + 客户根 + 资产卡) */
.lap-dots { opacity: 1; border: none; background: none; cursor: pointer; color: var(--ink-3); font-weight: 700; letter-spacing: 1px; padding: 0 4px; border-radius: 5px; line-height: 1; flex: none; }
.lap-dots:hover { background: var(--bg-soft); color: var(--ink-1); }
.lap-troot { font-weight: 600; color: var(--ink-1); }
.lap-asset { cursor: zoom-in; }
.lap-asset-dots { position: absolute; top: 5px; right: 5px; border: none; background: rgba(255,255,255,.92); border-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.18); color: var(--ink-2); font-weight: 700; padding: 1px 6px; cursor: pointer; font-size: 13px; line-height: 1; z-index: 2; }
.lap-asset-dots:hover { color: var(--ink-1); }
/* 左上 checkbox 选择 (一直显示) + hover 🔍 居中提示 (跟素材库页一致) */
.lap-cb { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,.9); border: 1.5px solid var(--line-2); display: flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; cursor: pointer; z-index: 2; }
.lap-asset.sel .lap-cb, .lap-cb.on { background: var(--brand-blue); border-color: var(--brand-blue); }
.lap-cb:hover { border-color: var(--brand-blue); box-shadow: 0 0 0 2px var(--brand-blue-l); }
.lap-eye { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); opacity: 0; pointer-events: none; background: rgba(0,0,0,.5); color: #fff; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: opacity .12s; z-index: 1; }
.lap-asset:hover .lap-eye { opacity: 1; }
.lap-head-right { display: flex; align-items: center; gap: 10px; }
.lap-upload { background: var(--brand-blue); color: #fff; border: none; border-radius: 8px; padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lap-upload:hover { background: var(--brand-blue-d); }
.lap-upload:disabled { opacity: .45; cursor: not-allowed; }
.lap-right { flex: 1; padding: 14px; overflow: auto; }
.lap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.lap-asset { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg-soft); }
.lap-asset .lap-thumb { width: 100%; height: 92px; object-fit: cover; display: block; }
.lap-asset .lap-thumb.ph { display: flex; align-items: center; justify-content: center; color: #fff; background: #475569; font-size: 22px; }
.lap-nm { font-size: 11px; color: var(--ink-2); padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lap-tick { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid #fff; background: rgba(0, 0, 0, .35); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.lap-asset.sel { outline: 2.5px solid var(--brand-blue); outline-offset: -2px; }
.lap-asset.sel .lap-tick { background: var(--brand-blue); border-color: var(--brand-blue); }
/* 左上预览按钮 (Linda 6-02): 点卡片=选择, 这个 🔍 才是唯一预览入口 (防误触) */
.lap-peek { position: absolute; top: 6px; left: 6px; z-index: 2; width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .4); color: #fff; cursor: zoom-in; display: flex; align-items: center; justify-content: center; }
.lap-peek:hover { background: var(--brand-blue); border-color: var(--brand-blue); }
.lap-vbadge { position: absolute; left: 6px; top: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 5px; z-index: 1; }
.lap-empty { color: var(--ink-3); font-size: 13px; padding: 20px 4px; grid-column: 1 / -1; }
.lap-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line); }
.lap-cnt { font-size: 13px; color: var(--ink-2); }
.lap-cnt-hint { color: var(--ink-3); }
.lap-btn { height: 36px; padding: 0 18px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--line-2); background: var(--bg-card); color: var(--ink-1); }
.lap-btn.primary { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; margin-left: 8px; }
.lap-btn.primary:disabled { opacity: .5; cursor: not-allowed; }

/* 素材库 (Linda 6-02): 点缩略图预览的手型 + 「全部」视图的 客户·项目 标签 */
.lib-thumb-click, .lap-thumb-click { cursor: zoom-in; }
.lib-ftag { font-size: 11px; color: var(--ink-3); margin-left: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lap-ftag { flex: none; max-width: 46%; font-size: 10px; color: var(--ink-3); margin: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 「全部」视图按 客户·子项目 分组的段头 (Linda 6-02) */
.lib-tgroup, .lap-tgroup { font-size: 11px; font-weight: 600; color: var(--ink-2); padding: 8px 8px 3px; margin-top: 4px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tgroup:first-child, .lap-tgroup:first-child { border-top: none; margin-top: 0; }

/* M-LIB-3 树: 收起/展开 + 客户·项目 可点分组行 */
.lib-treebar { display: flex; gap: 6px; padding: 0 4px 7px; margin-bottom: 4px; border-bottom: 1px dashed var(--line); }
.lib-tbtn { font-size: 11px; color: var(--brand-blue-dd); cursor: pointer; border: 1px solid var(--brand-blue-l2); background: var(--brand-blue-l); border-radius: 6px; padding: 2px 8px; }
.lib-tbtn:hover { filter: brightness(0.97); }
.lib-tw { width: 14px; min-width: 14px; flex: 0 0 14px; text-align: center; font-size: 10px; color: var(--ink-3); cursor: pointer; user-select: none; }
.lib-tclient, .lib-tproj { display: flex; align-items: center; gap: 7px; padding: 6px 6px; border-radius: 7px; cursor: pointer; }
.lib-tclient { font-size: 13px; font-weight: 700; color: var(--ink-1); }
.lib-tproj { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lib-tclient:hover, .lib-tproj:hover { background: var(--bg-soft); }
.lib-tclient .lib-fname, .lib-tproj .lib-fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* M-LIB-3 P4: 树内「加」入口 (常驻 ＋) + 新建客户主色按钮 + 空夹提示 */
.lib-fadd { border: none; background: none; cursor: pointer; color: var(--brand-blue); font-weight: 700; font-size: 16px; line-height: 1; padding: 0 5px; border-radius: 5px; flex: none; }
.lib-fadd:hover { background: var(--brand-blue-l); }
.lib-fedit { border: none; background: none; cursor: pointer; color: var(--ink-3); font-size: 13px; line-height: 1; padding: 0 4px; border-radius: 5px; flex: none; }
.lib-fedit:hover { background: var(--bg-soft); color: var(--ink-1); }
/* 锚定到点击点的内联输入框 (替代原生 prompt, Linda 6-05 铁律) */
.lib-prompt { min-width: 224px; padding: 10px; }
.lib-prompt-title { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.lib-prompt-input { width: 100%; box-sizing: border-box; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line-2); border-radius: 7px; margin-bottom: 8px; }
.lib-prompt-input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 2px var(--brand-blue-l); }
.lib-prompt-row { display: flex; justify-content: flex-end; gap: 6px; }
.lib-prompt-btn { font-size: 12px; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg-card); cursor: pointer; color: var(--ink-1); }
.lib-prompt-btn.primary { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.lib-prompt-btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.lib-prompt-btn:hover { filter: brightness(0.97); }
/* P8: 锚定确认弹窗 (红色 danger) + 已归档区 */
.lib-confirm { min-width: 240px; padding: 11px; }
.lib-confirm-title { font-size: 13px; font-weight: 700; color: var(--ink-1); margin-bottom: 6px; }
.lib-confirm.danger .lib-confirm-title { color: #b91c1c; }
.lib-confirm-msg { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin-bottom: 9px; max-width: 264px; }
.lib-arch-head { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 8px 6px 3px; margin-top: 6px; border-top: 1px dashed var(--line); }
.lib-arch-row, .lib-arch-row .lib-fname { color: var(--ink-3); }
.lib-del { color: #b91c1c !important; }
.lib-del:hover { background: #fee2e2 !important; }
.lib-tbtn-pri { margin-left: auto; background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); font-weight: 600; }
.lib-tbtn-pri:hover { filter: brightness(1.05); }
.lib-thint, .lib-thint:hover { cursor: default; background: none; }
.lib-thint .lib-fname { color: var(--ink-3); font-size: 12px; }

/* M-LIB-3 P5: 音频内嵌播放器 (库页卡片 lib-audio + 选取弹窗卡片 lap-audio) */
.lib-audio, .lap-audio { display: block; width: 100%; height: 30px; margin-top: 6px; }
.lib-audio-btn, .lap-audio-btn { display: block; width: 100%; margin-top: 6px; font-size: 12px; padding: 5px 8px; border: 1px solid var(--line-2); background: var(--bg-card); color: var(--brand-blue-dd); border-radius: 6px; cursor: pointer; }
.lib-audio-btn:hover, .lap-audio-btn:hover { background: var(--brand-blue-l); }

/* M-LIB-3 P7: 移动/复制目标夹选择器 —— 可折叠树 (默认收起, 点开一层层) */
.lib-menu-tree { min-width: 232px; }
.lib-menu-trow { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink-1); white-space: nowrap; }
.lib-menu-trow:hover { background: var(--bg-soft); }
.lib-menu-tclient { font-weight: 700; }
.lib-menu-tproj { font-weight: 600; color: var(--ink-2); }
.lib-menu-tfolder.dim, .lib-menu-tfolder.dim:hover { color: var(--ink-3); cursor: not-allowed; background: none; }
.lib-menu-tlabel { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* 生图/生视频 结果区工具栏 (Linda 6-02 A 版): 下载所有+下载★ 一行靠左, ＋📁 右上角 */
.result-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.result-toolbar .rt-left { display: flex; gap: 8px; flex-wrap: wrap; }
.result-toolbar .btn-outline { width: auto; }   /* 工具栏里按内容宽, 覆盖默认的 width:100% */

/* 历史「按人筛选」分组折叠 (Linda 2026-06-21): 内部员工 / 汉口学院(老师+班组) / 外部客户 */
.user-chips { display: block; }
.user-chips > .user-chip.all { display: inline-block; margin-bottom: 6px; }
.chip-grp { margin-top: 6px; }
.chip-grp-head { cursor: pointer; font-size: 12px; color: var(--ink-2); font-weight: 600;
                 padding: 4px 0; user-select: none; display: flex; align-items: center; gap: 6px; }
.chip-grp-head:hover { color: var(--brand-blue); }
.chip-grp-head .cg-caret { font-size: 9px; color: var(--ink-3); transition: transform .15s; }
.chip-grp.open > .chip-grp-head .cg-caret { transform: rotate(90deg); }
.chip-grp-head .cg-n { color: var(--ink-3); font-weight: 400; font-size: 11px; }
.chip-grp-body { display: none; }
.chip-grp.open > .chip-grp-body { display: block; padding: 2px 0 6px 14px; }
.chip-grp-body > .user-chip { display: inline-block; margin: 0 4px 4px 0; }
.chip-sub { font-size: 11px; color: var(--ink-3); margin: 7px 0 4px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 2px; }

/* 2026-07-19: 人员分类「全部XX」chip (chip-grp-head 行内, Models/历史同款交互) */
.chip-grp-head .cat-all { margin-left: 10px; font-size: 12px; border: 1px solid var(--brand-blue);
                          color: var(--brand-blue); background: transparent; }
.chip-grp-head .cat-all.active { background: var(--brand-blue); color: #fff; }

/* ============== 音频 tab (2026-07-19, feat/audio-history-tab) ==============
   卡面播放区 (mock 定稿): 灰底(同 no-thumb) + 中央播放圆钮 + 装饰波形 +
   右下时长角标(同视频时长角标黑底) + 底部细进度条。音频恒单产出 →
   不会撞 count-badge(右下, 仅多产出卡); 圆钮居中不占 §3.2 四角。 */
.card-thumb.audio-thumb {
  flex-direction: column; gap: 8px;
  display: flex; align-items: center; justify-content: center;
}
.audio-play-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: #fff; border: 1px solid var(--line-2);
  color: var(--brand-blue); font-size: 16px; line-height: 1;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.audio-play-btn:hover:not(:disabled) { background: var(--brand-blue); color: #fff; }
.audio-play-btn:disabled { opacity: 0.5; cursor: default; }
.audio-wave { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.audio-wave span { width: 3px; background: var(--line-2); border-radius: 1px; }
.audio-wave span:nth-child(1) { height: 7px; }
.audio-wave span:nth-child(2) { height: 14px; }
.audio-wave span:nth-child(3) { height: 10px; }
.audio-wave span:nth-child(4) { height: 17px; }
.audio-wave span:nth-child(5) { height: 8px; }
.audio-wave span:nth-child(6) { height: 15px; }
.audio-wave span:nth-child(7) { height: 11px; }
.audio-wave span:nth-child(8) { height: 16px; }
.audio-wave span:nth-child(9) { height: 9px; }
.audio-wave span:nth-child(10) { height: 13px; }
.audio-dur-badge {
  position: absolute; bottom: 8px; right: 8px;
  font-size: 10px; font-weight: 700;
  background: rgba(15,23,42,0.65); color: #fff;
  padding: 2px 6px; border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.audio-progress {
  position: absolute; bottom: 0; left: 0;
  height: 3px; width: 0; background: var(--brand-blue);
  transition: width 0.2s linear;
}

/* 灯箱音频播放器面板 (壳零改动, 只换中央媒体位; RULES §3.7) */
.lb-audio-panel {
  background: #000; border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  padding: 22px 26px; width: min(460px, 84vw);
}
.lb-audio-wave { display: flex; align-items: flex-end; gap: 3px; height: 52px; margin-bottom: 16px; }
.lb-audio-wave span { width: 5px; background: #334155; border-radius: 1px; }
.lb-audio-wave span:nth-child(3n)   { height: 44px; }
.lb-audio-wave span:nth-child(3n+1) { height: 20px; }
.lb-audio-wave span:nth-child(3n+2) { height: 32px; }
.lb-audio-wave span:nth-child(5n)   { height: 14px; }
.lb-audio-row { display: flex; align-items: center; gap: 12px; }
.lb-audio-play {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--brand-blue); border: 0; color: #fff;
  font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-audio-play:hover { filter: brightness(1.1); }
.lb-audio-time { font-size: 12px; color: rgba(255,255,255,0.85); font-variant-numeric: tabular-nums; }
.lb-audio-time.dim { color: rgba(255,255,255,0.55); }
.lb-audio-seek { flex: 1; accent-color: var(--brand-blue); cursor: pointer; }
.lb-audio-side {
  background: transparent; border: 1px solid rgba(255,255,255,0.28); border-radius: 999px;
  color: rgba(255,255,255,0.75); font-size: 12px; padding: 3px 9px; cursor: pointer;
  flex-shrink: 0;
}
.lb-audio-side:hover { background: rgba(255,255,255,0.12); }
.lb-audio-panel audio { display: none; }

/* 灯箱倍速 hover 列表 + SVG 静音钮 (Linda 2026-07-19 拍, v2) */
.lb-audio-vol { display: flex; align-items: center; padding: 5px 9px; }
.lb-audio-vol svg { display: block; }
.lb-rate-wrap { position: relative; flex-shrink: 0; }
.lb-rate-menu {
  position: absolute; bottom: 100%; right: 0;
  padding-bottom: 6px;        /* hover 桥: 按钮→菜单光标不断联 */
  display: none; z-index: 5;
}
.lb-rate-wrap:hover .lb-rate-menu, .lb-rate-wrap.open .lb-rate-menu { display: block; }
.lb-rate-panel {
  background: #1e293b; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 4px;
  display: flex; flex-direction: column; min-width: 64px;
}
.lb-rate-opt {
  background: transparent; border: 0; cursor: pointer;
  color: rgba(255,255,255,0.7); font-size: 12px;
  padding: 5px 12px; border-radius: 5px; text-align: center;
  white-space: nowrap;
}
.lb-rate-opt:hover { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.9); }
.lb-rate-opt.active { background: var(--brand-blue); color: #fff; }

/* ============================================================
   历史页热更新 (2026-07-25 · feat/history-live · Linda 拍板)
   私有段: 只用 .hist-live-* 前缀, 不动任何公共 token / 既有类
   ============================================================ */

/* 「⬆ N 条新记录」胶囊 — 方案 V1: 吸顶居中浮层, 不占版面高度 (Linda 拍板)。
   z-index 40 < .topnav 的 50 → 滚上去时钻到 nav 底下, 不糊住导航;
   远低于灯箱 (9999) → 灯箱开着时它不会浮在遮罩上面。 */
.hist-live-pill {
  position: fixed; top: 78px; left: 50%; transform: translateX(-50%);
  z-index: 40;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border: none; border-radius: 999px;
  background: var(--brand-blue); color: #fff;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  box-shadow: 0 4px 14px rgba(39, 143, 206, 0.35);
  animation: histLivePillIn 0.22s ease-out;
}
.hist-live-pill:hover { background: var(--brand-blue-d); }
/* ⚠️ 必须显式声明 — 上面的 display:inline-flex 会盖掉 [hidden] 的 display:none
   (UI 铁律: HTML hidden 属性 + CSS display 规则 = CSS 赢, 历史上坑过). */
.hist-live-pill[hidden] { display: none; }
@keyframes histLivePillIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 新插入卡片的一次性高亮 — 方案 N2: 淡入 + 蓝边闪 1.8s 后褪掉, 零常驻标记
   (卡片 5 个角已被 checkbox/★/首字/数量/失败 占满, 铁律 3.2 不许再加角标)。 */
.hist-live-fresh { animation: histLiveFresh 1.8s ease-out; }
@keyframes histLiveFresh {
  0%   { opacity: 0.35; box-shadow: 0 0 0 2px rgba(39, 143, 206, 0.55); }
  25%  { opacity: 1;    box-shadow: 0 0 0 2px rgba(39, 143, 206, 0.55); }
  100% { opacity: 1;    box-shadow: 0 0 0 2px rgba(39, 143, 206, 0); }
}

/* 减少动态效果偏好 (系统级无障碍设置) → 不闪不飘, 直接是终态 */
@media (prefers-reduced-motion: reduce) {
  .hist-live-pill, .hist-live-fresh { animation: none; }
}

/* 外部客户 tab：内部预览号（片⑤ 后续）*/
.cl-pv{display:inline-block;margin-left:6px;font-size:10px;font-weight:700;color:#8a6234;
       background:#fdf1e7;border:1px solid #f0dcc6;border-radius:9px;padding:1px 6px;
       vertical-align:middle;}
/* 勾选框和它的文字必须**连在一起**：父容器是 flex + gap，label 里的 input 和文字
   会被当成两个 flex item 拉开，看着不像一组（2026-08-06 真机截图才看出来）。 */
.cl-chk{display:inline-flex!important;align-items:center;gap:6px;font-size:12px;
        color:#6f6459;white-space:nowrap;cursor:pointer;flex:none;
        border:1px solid #e3e8ef;border-radius:8px;padding:0 10px;height:38px;}
/* 🔴 `.cl-new-row input` 那条通用规则把**所有 input 当文本框**（150px 宽 + 内边距 +
   边框），复选框也被套上 ⇒ 方框和文字被撑开 150px，看着不像一组。
   定向重置：复选框就该是复选框大小。（2026-08-06 查计算样式才找到，肉眼只看得出"分开了"。） */
.cl-chk input[type="checkbox"]{margin:0;flex:none;width:auto;min-width:0;
                               padding:0;border:0;border-radius:0;}
.cl-chk:hover{background:#f7f9fc;}
.cl-batch{margin-top:14px;padding-top:12px;border-top:1px dashed #e3d9cc;}

/* ═══════════════════════════════════════════════════════════════════
   外文素材 — 译文显示 / 语言标 / 三档切换 (Linda 2026-08-06)
   全部是新增私有类, 不动任何既有选择器 → 中文素材版面零变化。
   ═══════════════════════════════════════════════════════════════════ */

/* 口播逐句译文 (对照档: 原文下方缩进一行) */
.tx-zh {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 2px;
  padding-left: 7px;
  border-left: 2px solid var(--brand-blue-l2);
}
.tx-zh.human { border-left-color: #6ee7b7; }   /* 人工校对过 — 绿边, 跟机翻一眼分开 */

/* 编辑态: 原文框 + 译文框上下叠 */
.tx-edit-pair { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tx-zh-edit { background: #fbfdff; }
.tx-zh-edit::placeholder { color: var(--ink-3); font-size: 12px; }

/* 三档切换 (对照 / 中文 / 原文) */
.seg-toggle {
  display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px;
  overflow: hidden; margin-right: 8px; vertical-align: middle;
}
.seg-toggle button {
  border: 0; background: #fff; font: inherit; font-size: 11.5px;
  padding: 3px 10px; cursor: pointer; color: var(--ink-2);
}
.seg-toggle button + button { border-left: 1px solid var(--line-2); }
.seg-toggle button:hover:not(.on) { background: var(--brand-blue-l); }
.seg-toggle button.on { background: var(--brand-blue); color: #fff; font-weight: 600; }

/* 语言标 —— 只在非中文素材上出现 */
.lang-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 1.5px 7px;
  border-radius: 999px; margin-left: 6px; white-space: nowrap;
  background: var(--bg-soft); color: var(--ink-2); border: 1px solid var(--line-2);
}
.lang-badge.mt { background: var(--brand-blue-l); color: var(--brand-blue-dd); border-color: var(--brand-blue-l2); }
.lang-badge.none { background: #fffbeb; color: #b45309; border-color: #fde68a; }

/* 列表标题: 中文在上 + 原文淡色一行 */
.viral-grid .col-title .cell-title-zh { color: var(--ink-1); line-height: 1.35; }
.viral-grid .col-title .cell-title-src {
  color: var(--ink-3); font-size: 11.5px; margin-top: 2px; line-height: 1.3;
}

/* ── 外文素材 追加 (Linda 2026-08-07): 抽屉标题中文 + 「🌐 重新翻译」 ──────── */
/* 抽屉里标题的原文那一行 —— 跟列表 .cell-title-src 同一套淡色语义 (§2.12 同族对齐) */
.drawer-title-src {
  color: var(--ink-3, #8a8f98);
  font-size: 12.5px;
  line-height: 1.5;
}
/* 段头右上角可以放不止一个 action (原来只放了「✨重新AI分析」一个) */
.drawer-section-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* 容器已经负责推到右边了; 里面的按钮各自再 margin-left:auto 会把两个按钮拆开 */
.drawer-section-actions .drawer-section-action-btn { margin-left: 0; }

/* ── 发帖地域 (Linda 2026-08-07 拍板方案 A: 如实并排, 颜色区分粒度) ─────────── */
/* 🔴 颜色是**语义**不是装饰: 红=中国 / 绿=其它国家 / 紫=中国省份(小红书 IP 属地)。
   三个平台给的粒度本来就不同, 用颜色把这件事显式画出来, 而不是抹平成一种。 */
.rg-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; line-height: 1.6;
  padding: 0 7px; border-radius: 999px;
  border: 1px solid var(--line-2, #cbd5e1);
  background: var(--bg-soft, #f1f5f9);
  color: var(--ink-2, #475569);
  white-space: nowrap;
}
.rg-badge.cn      { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.rg-badge.foreign { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.rg-badge.prov    { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
/* 列表平台列第二行 */
.cell-region { margin-top: 3px; }


/* ── 版本 tab (.mver-*) · Models 页第 4 个视图 · 2026-08-07 ─────────────────
   私有段: 只用 .mver- 前缀, 不动任何公共 token / 不改现有 .mtable 规则
   (styles.css 是多 session 高危共享文件, 见 canon/MULTI_SESSION.md §2)。 */
.mver-dot{display:inline-block;width:7px;height:7px;border-radius:50%;margin-right:6px;vertical-align:1px;}
.mver-dot.ok{background:#1a7f37;}
.mver-dot.bad{background:#d92d20;}
.mver-dot.unk{background:#b0b0b5;}  /* 判不了: 灰点, 既不是绿也不是红 */
.mver-ok{color:#1a7f37;}
.mver-old{color:#b42318;font-weight:600;}
.mver-ago{color:#888;}


/* ── 参考图合计用量条 (.ref-total-*) · banana_lzp 独有 · 2026-08-11 ──────────
   私有段: 只用 .ref-total- 前缀, 不动公共 token, 不改 .ru-* (ref_uploader 组件自己的段)。
   只有 banana_lzp 有"合计"这条限制 —— 它的参考图 base64 内联随请求发出, 请求体有天花板;
   其它三个图模型 image.js 会把整条 [hidden] 掉。
   ⚠️ [hidden] 显式写 display:none —— 本段没给 .ref-total 设 display, 但显式写死更保险
   (踩过 [hidden] 被 display:flex 覆盖导致"隐藏了却还在"的坑)。 */
.ref-total[hidden]{display:none;}
.ref-total{margin-top:6px;}
.ref-total-text{font-size:12px;color:var(--ink-3);}
.ref-total.over .ref-total-text{color:#b45309;font-weight:600;}
.ref-total-bar{height:4px;background:var(--line);border-radius:2px;overflow:hidden;margin-top:4px;}
.ref-total-bar > i{display:block;height:100%;width:0;background:#f59e0b;transition:width .15s ease;}
.ref-total.over .ref-total-bar > i{background:#dc2626;}

/* ── mj_lzp 提示词写法块 (Linda 2026-08-12 拍板 C: 页面教用户怎么写, 而不是加控件) ──
   MJ 的 vendor 请求体只有 text —— 画幅/档位/参考图全是提示词 flag, 所以生图页那套
   "下拉选参数" 对它天然失效。样式沿用 .help-text 的语气, 不新造视觉语言。 */
.mj-syntax { background: var(--bg-2, #f8fafc); border: 1px solid var(--line, #e2e8f0);
             border-radius: 6px; padding: 10px 12px; }
.mj-syntax-title { font-size: 12.5px; font-weight: 600; color: var(--ink-1); margin-bottom: 6px; }
.mj-syntax-list { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); line-height: 1.9; }
.mj-syntax-list code { background: var(--bg-3, #eef2f7); padding: 1px 5px; border-radius: 3px;
                       font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }

/* ───────────────────────────────────────────────────────────────────────────
   中文字幕叠层 (Linda 2026-08-12 拍板)
   位置=方案 C(距底 22%, JS 里算基线) · 外观=半透明底条 · 开关 icon 在右上角
   ⚠️ 右上角是播放器四角里唯一空着的: 底部整条是原生控件(播放/进度/音量/全屏),
      左下是播放键。加新 overlay 前查过 `.drawer-video-*` 无既有 absolute 元素。
   ─────────────────────────────────────────────────────────────────────────── */
.drawer-video-box { position: relative; }

.vsub-layer {
  position: absolute; left: 0; right: 0;
  transform: translateY(-100%);
  display: flex; justify-content: center; align-items: flex-end;
  /* 🔴 **不要用百分比 padding**: CSS 里百分比 padding 按**包含块宽度**解析, 而包含块是
     683px 宽的 .drawer-video-box, 不是 124px 宽的视频 —— `padding: 0 4%` 会左右各吃掉
     27px, 让字幕可用宽只剩视频宽的一半, 必然二次折行 (2026-08-12 J148 真旅程抓到的)。
     留白改由 JS 按视频矩形算成 max-width, 见 viral.js applyStyle。 */
  padding: 0;
  pointer-events: none;                 /* 不挡播放器点击 */
  /* 🔴 必须**高于拖拽把手**: 把手是整条 34px 宽的透明带, 正好压在字幕上方 ——
     层级低于它时, 字幕上那个 ✕ 会被把手吃掉点击, 用户点不动 (J148 真旅程抓到的:
     "vsub-handle intercepts pointer events")。层本身 pointer-events:none,
     所以拖拽照样能穿过去打到把手, 只有 ✕ 那 22px 圆形抢回点击。 */
  z-index: 5;
}
.vsub-cue {
  max-width: 100%;
  text-align: center;
  white-space: pre-wrap;                /* 断句已经算好了, 这里只按算好的换行渲染 */
  color: #fff; font-weight: 600; line-height: 1.35; letter-spacing: .3px;
  background: rgba(0, 0, 0, .55);       /* Linda 拍板: 半透明底条 */
  border-radius: 4px; padding: .18em .6em;
}
/* 就近关闭: 只在鼠标进播放器时出现, 不常驻挡画面 */
.vsub-x {
  position: absolute; right: 2%; bottom: 100%; margin-bottom: 4px;
  width: 22px; height: 22px; padding: 0; line-height: 22px;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px;
  opacity: 0; transition: opacity .15s; pointer-events: auto;
}
.drawer-video-box:hover .vsub-x { opacity: 1; }
.vsub-x:hover { background: rgba(0, 0, 0, .85); }

/* 拖拽把手: 覆盖字幕上方一条, 按住上下拖 */
.vsub-handle {
  position: absolute; left: 0; right: 0; height: 34px;
  cursor: grab; z-index: 4;            /* 低于 .vsub-layer, 见那边的注释 */
}
.vsub-handle.dragging { cursor: grabbing; }

/* 字幕开关 icon */
.vsub-toggle {
  position: absolute; top: 8px; right: 8px; z-index: 6;
  width: 30px; height: 30px; padding: 0; border: none; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer;
  opacity: 0; transition: opacity .15s;
}
.drawer-video-box:hover .vsub-toggle { opacity: 1; }
.vsub-toggle:hover { background: rgba(0, 0, 0, .85); }
/* 🔴 字幕关掉时**常驻可见**, 不等 hover —— 否则"关了就找不回来" = 单向门。
   这条比用哪个 icon 重要得多。 */
.vsub-toggle.off { opacity: 1; background: rgba(196, 99, 58, .92); }
.vsub-toggle.off:hover { background: rgba(196, 99, 58, 1); }
.vsub-toggle svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.vsub-label {
  position: absolute; top: 14px; right: 44px; z-index: 6;
  background: rgba(0, 0, 0, .72); color: #fff;
  border-radius: 5px; padding: 3px 8px; font-size: 11px; white-space: nowrap;
  pointer-events: none;
}
