/* ============================================================
   短剧改编工作台 · 视觉样式（左侧导航 · 简约现代 · 浅色）
   ============================================================ */

:root {
  --bg:        #f4f5f9;
  --surface:   #ffffff;
  --surface-2: #fafbfc;
  --border:    #e7e9ef;
  --border-2:  #d7dbe4;
  --text:      #14161c;
  --text-2:    #454a55;
  --muted:     #737a88;
  --accent:    #4f46e5;
  --accent-2:  #4338ca;
  --accent-soft:#eef0ff;
  --ok:        #0f7a63;
  --ok-soft:   #e6f6f1;
  --warn:      #b45309;
  --danger:    #d92d20;
  --danger-soft:#fdecea;
  --sidebar-w: 224px;
  --radius:    14px;
  --radius-sm: 10px;
  --shadow:    0 1px 2px rgba(20,22,28,.04), 0 8px 24px -12px rgba(20,22,28,.14);
  --shadow-pop:0 12px 32px -8px rgba(20,22,28,.22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }
html { height: 100%; }
/* body 不锁 100% 高：内容撑开 body，sticky 侧栏/顶栏才能在 body 高度内吸附 */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 顶栏公告 + 主布局（侧栏 + 内容区） */
.app-main { display: flex; flex: 1 1 auto; min-width: 0; }

/* ================= 顶部公告栏 ================= */
body.has-notice { --notice-h: 38px; }

.notice-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 38px; padding: 0 18px;
  background: var(--accent-soft);
  color: var(--accent-2);
  border-bottom: 1px solid #dfe2fb;
  font-size: 13px;
  position: sticky; top: 0; z-index: 50;
}
.notice-bar[hidden] { display: none !important; }
.notice-ico { flex: 0 0 auto; font-size: 14px; }
.notice-text { flex: 0 1 auto; min-width: 0; max-width: calc(100% - 110px); overflow: hidden; white-space: nowrap; }
.notice-text:not(.marquee) { text-align: center; }
.notice-text.marquee { display: flex; }
.notice-text.marquee .notice-run { animation: notice-scroll var(--dur, 18s) linear infinite; padding-right: 90px; }
.notice-text:not(.marquee) .notice-run.dup { display: none; }
.notice-text.marquee:hover .notice-run { animation-play-state: paused; }
@keyframes notice-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.notice-close {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: inherit;
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; opacity: .7;
}
.notice-close:hover { opacity: 1; }

/* 公告栏存在时，侧栏 / 顶栏的吸附位置下移，避免被公告盖住
   （仅桌面：窄屏侧栏转为顶部横条，是 static 布局，不能被这里的高度覆盖） */
body.has-notice .topbar { top: var(--notice-h); }
@media (min-width: 861px) {
  body.has-notice .sidebar { top: var(--notice-h); height: calc(100vh - var(--notice-h)); }
}

/* ================= 侧边栏 ================= */
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.logo {
  width: 36px; height: 36px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(135deg, #6366f1, #4f46e5 55%, #7c3aed);
  color: #fff; font-size: 16px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px -4px rgba(79,70,229,.6);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand h1 { font-size: 14.5px; font-weight: 650; margin: 0; letter-spacing: .01em; }
.tag { font-size: 11px; color: var(--muted); white-space: nowrap; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent; color: var(--text-2);
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13.5px; font-family: inherit; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .8; }
.nav-item:hover { background: #f2f3f8; color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot {
  margin-top: auto; padding: 14px 8px 0;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  border-top: 1px solid var(--border);
}
.foot-note { font-size: 11px; color: var(--muted); }

/* ================= 顶栏 + 主区 ================= */
.shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 32px 14px;
  background: rgba(244,245,249,.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.page-head { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: .01em; }
.page-sub { font-size: 12.5px; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.badge {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--muted); font-family: inherit; cursor: default;
}
button.badge { cursor: pointer; }
.badge-off { color: var(--muted); background: #f1f2f6; }
.badge-on  { color: var(--ok); background: var(--ok-soft); border-color: #a9dfd0; }

.workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 22px 32px 64px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.content { min-width: 0; }

/* ================= 面板 / 卡片 ================= */
.panel { display: none; }
.panel.active { display: block; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 18px; background: var(--surface);
  box-shadow: var(--shadow);
}
.card:last-child { margin-bottom: 0; }
.card .muted { margin-top: 0; }
.card > p.muted { margin-bottom: 14px; }

.step-title {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 15px; font-weight: 650; margin: 0 0 12px;
}
.step-no {
  font-style: normal; font-size: 12px; font-weight: 700;
  width: 20px; height: 20px; border-radius: 7px; flex: 0 0 auto;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ================= 表单 ================= */
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1 1 180px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.block { margin-top: 18px; }
.field > span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.hint-inline { font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); }

.field select, .field input, .field textarea, .search-input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { resize: vertical; line-height: 1.75; min-height: 64px; }
.field select { appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='%23737a88' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  padding-right: 32px;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #c3c8d4; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder, .field textarea::placeholder { color: #a6acb9; }

/* 主输入区：默认固定大尺寸，无需手动拖拽 */
.area-lg { height: 260px !important; min-height: 260px !important; }
.area-xl { height: 320px !important; min-height: 320px !important; }
textarea.area-lg, textarea.area-xl { resize: vertical; width: 100%; display: block; }

.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pill {
  font-size: 11.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: 1px 9px;
}
code { font-family: var(--mono); background: #f1f2f6; padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .btn { white-space: nowrap; }

/* ================= 自定义下拉（模型名） ================= */
.combo { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.combo > input { padding-right: 38px; }
.combo-toggle {
  position: absolute; right: 1px; top: 1px; bottom: 1px; width: 36px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.combo-toggle:hover { color: var(--text); background: #f5f6f9; }
.combo.open .combo-toggle svg { transform: rotate(180deg); }
.combo-toggle svg { transition: transform .16s ease; }
.combo-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); max-height: 280px; overflow: auto; padding: 5px;
}
.combo-menu .combo-item {
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--mono); color: var(--text-2);
}
.combo-menu .combo-item:hover, .combo-menu .combo-item.active { background: var(--accent-soft); color: var(--accent); }
.combo-menu .combo-empty { padding: 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* ================= 按钮 ================= */
.btn {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-family: inherit; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:hover { background: #f5f6f9; border-color: #c3c8d4; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-mini { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 2px 8px -3px rgba(79,70,229,.6);
}
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-primary.btn-secondary { background: #fff; color: var(--accent); border-color: #c3c7f5; box-shadow: none; }
.btn-primary.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { border-color: #d9dde8; background: #fff; color: var(--text-2); }
.btn-ghost:hover { border-color: var(--accent); background: #f7f6ff; color: var(--accent); }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover { border-color: var(--danger); background: #fff5f5; color: var(--danger); }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions-end { justify-content: flex-end; }
.status { font-size: 13px; color: var(--muted); margin-right: auto; }
.actions-end .status { margin-right: auto; }
.status.err { color: var(--danger); }

/* ================= 结果区 ================= */
.result { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.result-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.result-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.result-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.output {
  margin: 0; padding: 18px; white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.85;
  min-height: 180px; max-height: 640px; overflow: auto; color: var(--text);
}

/* ================= 审稿报告（图表化） ================= */
.review-report { display: flex; flex-direction: column; gap: 14px; }
.review-report[hidden] { display: none; }

.rr-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 18px; background: var(--surface-2);
}
.rr-banner.ok { border-color: #a9dfd0; background: var(--ok-soft); }
.rr-banner.bad { border-color: #f3c2bd; background: var(--danger-soft); }
.rr-banner-left { display: flex; align-items: center; gap: 10px; }
.rr-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rr-banner.ok .rr-dot { background: var(--ok); }
.rr-banner.bad .rr-dot { background: var(--danger); }
.rr-verdict { font-size: 15px; font-weight: 650; }
.rr-banner-sub { font-size: 12.5px; color: var(--muted); }
.rr-rate { text-align: right; }
.rr-rate-num { font-size: 24px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rr-rate-num small { font-size: 13px; font-weight: 400; color: var(--muted); }
.rr-rate-label { font-size: 12px; color: var(--muted); }

.rr-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rr-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.rr-card .num { font-size: 22px; font-weight: 650; line-height: 1.25; font-variant-numeric: tabular-nums; }
.rr-card .lbl { font-size: 12px; color: var(--muted); }
.rr-card.pass .num { color: var(--ok); }
.rr-card.fail .num { color: var(--danger); }
.rr-card.warn .num { color: var(--warn); }

.rr-cats {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; background: var(--surface);
}
.rr-cats-title, .rr-fails-title { font-size: 13.5px; font-weight: 650; margin: 0 0 10px; }
.rr-cat { display: grid; grid-template-columns: 108px 1fr 88px; align-items: center; gap: 10px; margin-bottom: 9px; }
.rr-cat:last-child { margin-bottom: 0; }
.rr-cat-label { font-size: 12.5px; color: var(--text-2); }
.rr-cat-bar { height: 8px; border-radius: 999px; background: #edeff5; overflow: hidden; display: flex; }
.rr-cat-bar .seg-pass { background: #34a884; height: 100%; }
.rr-cat-bar .seg-warn { background: #e5a54b; height: 100%; }
.rr-cat-bar .seg-fail { background: #e05a4e; height: 100%; }
.rr-cat-count { font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.rr-fails { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface); }
.rr-item {
  border: 1px solid var(--border); border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 9px; background: var(--surface-2);
}
.rr-item:last-child { margin-bottom: 0; }
.rr-item.warn-item { border-left-color: var(--warn); }
.rr-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rr-badge {
  font-size: 11.5px; font-weight: 600; border-radius: 5px; padding: 1px 8px; flex: 0 0 auto;
}
.rr-badge.fail { color: var(--danger); background: var(--danger-soft); }
.rr-badge.warn { color: var(--warn); background: #faf3e2; }
.rr-item-title { font-size: 13px; font-weight: 600; }
.rr-item-note { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.7; word-break: break-word; }
.rr-all-ok { text-align: center; color: var(--ok); font-size: 13px; padding: 8px 0 2px; }

/* ================= 历史任务（浮动抽屉，不占版面列） ================= */
.history-panel {
  position: fixed; top: 70px; right: 18px; width: 302px; z-index: 70;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 10px 36px rgba(24, 28, 80, .16);
  padding: 14px; max-height: calc(100vh - 100px);
  display: flex; flex-direction: column;
}
.history-panel[hidden] { display: none; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-head-ops { display: inline-flex; gap: 4px; }
.history-title { font-size: 13.5px; font-weight: 650; }
.history-tip { font-size: 11.5px; color: var(--muted); margin: 6px 0 10px; line-height: 1.5; }
.history-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.hist-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 11px; cursor: pointer; background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
  position: relative;
}
.hist-item:hover { border-color: #c3c7f5; background: var(--accent-soft); }
.hist-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.hist-type {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); border-radius: 5px; padding: 1px 7px;
}
.hist-item:hover .hist-type { background: #fff; }
.hist-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.hist-title {
  font-size: 12.5px; color: var(--text-2); line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-right: 18px;
}
.hist-del {
  position: absolute; right: 7px; bottom: 7px;
  border: none; background: transparent; color: #b9bec9; cursor: pointer;
  font-size: 13px; line-height: 1; padding: 3px; border-radius: 5px; font-family: inherit;
}
.hist-del:hover { color: var(--danger); background: #fff; }
.hist-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 26px 10px; }
.hist-empty .hist-empty-icon { font-size: 22px; display: block; margin-bottom: 6px; opacity: .55; }

/* ================= 订阅 / 表格 ================= */
.sub-info {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid #dcdffb;
  margin: 12px 0; color: var(--text-2); font-size: 13.5px;
}
.plan-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.plan-table td { padding: 11px 6px; border-bottom: 1px solid var(--border); }
.plan-table .price { text-align: right; font-weight: 600; color: var(--accent); }
.plan-table tr:last-child td { border-bottom: none; }

/* ================= 资产库 ================= */
.asset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 14px; }
.asset-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); }
.asset-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.asset-sel { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; margin: 0; }
.am-style-tag { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.am-style-tag.is-pencil { background: #ffe9cc; color: #d9640d; }
#assetMultiBtn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
/* 原图 / 彩铅 分段切换 */
.style-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg-btn { border: none; background: transparent; font-size: 12px; font-family: inherit; padding: 4px 12px; cursor: pointer; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; font-weight: 600; }
.asset-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.asset-card-head input { flex: 1; font-weight: 600; padding: 6px 9px; font-size: 13.5px;
  border: 1px solid transparent; background: transparent; border-radius: 7px; color: var(--text); }
.asset-card-head input:hover { border-color: var(--border); background: var(--surface); }
.asset-card-head input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.asset-field { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.asset-field > span { font-size: 11.5px; color: var(--muted); }
.asset-field textarea, .asset-field input {
  width: 100%; padding: 7px 9px; font-size: 13px; font-family: inherit; line-height: 1.6;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); resize: vertical;
}
.asset-field textarea:focus, .asset-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.asset-del { flex: 0 0 auto; }

/* 资产设计图（蝶站式：待生成 → 预览 → 自动投喂分镜） */
.asset-media { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.asset-media-label { font-size: 11.5px; color: var(--muted); }
.asset-media-box {
  position: relative; width: 100%; aspect-ratio: 9 / 14; max-height: 300px;
  border: 1px dashed var(--border-2); border-radius: 9px; overflow: hidden;
  background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 10px, #f4f5f9 10px, #f4f5f9 20px);
  display: flex; align-items: center; justify-content: center;
}
.asset-media-box.has { border-style: solid; border-color: var(--border); background: #fff; }
.asset-media-box img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }

/* 点击缩略图放大查看原图（灯箱） */
#imgLightbox {
  position: fixed; inset: 0; z-index: 999; display: none;
  align-items: center; justify-content: center; padding: 32px;
  background: rgba(15, 18, 25, .78); cursor: zoom-out;
}
#imgLightbox.open { display: flex; }
#imgLightbox img {
  max-width: min(1600px, 96vw); max-height: 92vh;
  border-radius: 10px; box-shadow: 0 24px 80px rgba(0, 0, 0, .5);
  background: #fff;
}
.asset-media-box .am-empty, .asset-media-box .am-miss { font-size: 12.5px; color: var(--muted); }
.asset-media-box .am-miss { color: var(--warn); }
.am-busy { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--accent); }
.asset-media-ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ================= 分镜 Unit（蝶站暖色线条配色） ================= */
.unit-list { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.unit {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--surface); box-shadow: 0 1px 3px rgba(20, 22, 28, .05);
}
.unit.selected {
  border-color: #f0e2cd; background: #fff9f0; box-shadow: 0 1px 3px rgba(120, 84, 30, .06);
}
.unit-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.unit.selected .unit-head { background: #fffdf9; border-bottom-color: #f0e2cd; }
.unit-badge {
  font-weight: 800; font-size: 14px; letter-spacing: .5px; color: #f56d0a;
  font-family: var(--mono);
}
.unit-dur {
  font-size: 12px; font-weight: 700; color: #d9640d;
  background: #fff; border: 1px solid #f7a04b; border-radius: 999px; padding: 1px 10px;
}
.unit-scene {
  font-size: 12px; color: #d9640d; background: #ffedd6;
  border-radius: 999px; padding: 2px 10px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.unit-meta { font-size: 12px; color: #b08968; }
.unit-head .unit-tools { margin-left: auto; display: flex; gap: 6px; }

/* 引用资产行：彩色胶囊（角色蓝 / 场景橙，与 video_prompt 高亮同套） */
.unit-refs-bar {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px dashed var(--border); background: var(--surface-2);
}
.unit.selected .unit-refs-bar { border-bottom-color: #f0e2cd; background: #fffdf9; }
.urb-label { font-size: 11.5px; color: #b08968; flex: 0 0 auto; }
.urb-note { font-size: 11.5px; color: var(--ok); margin-left: auto; }
.ref-chip {
  font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  font-family: var(--mono); border: 1px solid transparent;
}
.ref-chip.ref-char { color: #3b5bfd; background: #e6ecff; border-color: #c6d3ff; }
.ref-chip.ref-scene { color: #d9640d; background: #ffedd6; border-color: #f7c896; }

.unit-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* 左侧：暖白「文稿」面板浮在奶油卡底上（蝶站式层次） */
.unit-edit {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 6px 16px;
  box-shadow: 0 1px 2px rgba(20, 22, 28, .03);
}
.unit.selected .unit-edit { background: #fffdf9; border-color: #f0e2cd; box-shadow: 0 1px 2px rgba(120, 84, 30, .04); }
.unit-block { padding: 10px 12px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fbfcfe; margin: 0 0 9px; }
.unit.selected .unit-block { border-color: #ecdcc3; background: #fffdf8; }
.unit-block:last-child { margin-bottom: 0; }
.unit-block > label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: #d9640d; margin-bottom: 4px; }
.unit-block > label::before { content: ''; width: 3px; height: 11px; border-radius: 2px; background: #f56d0a; opacity: .75; }
.unit-block > label code { font-weight: 600; }
.unit-block textarea {
  width: 100%; padding: 5px 8px; font-size: 13px; font-family: inherit; line-height: 1.7;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); resize: vertical;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.unit-block textarea:hover:not(.unit-vp) { background: #eef0f5; }
.unit.selected .unit-block textarea:hover:not(.unit-vp) { background: #f8efdd; }
.unit-block textarea:focus { outline: none; background: #fff; border-color: #f5a54c; box-shadow: 0 0 0 3px rgba(245, 140, 30, .14); }

/* 台词行：上（说话人 + 声音标注）下（台词），无框浅底，像剧本排版 */
.unit-lines { display: flex; flex-direction: column; gap: 2px; }
.unit-line {
  display: flex; flex-direction: column; gap: 3px;
  background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 7px 8px;
}
.unit-line:hover { background: #f2f3f7; }
.unit.selected .unit-line:hover { background: #fdf4e8; }
.ul-meta { display: flex; gap: 6px; align-items: baseline; }
.ul-meta input {
  padding: 2px 6px; font-size: 12px; font-family: inherit; line-height: 1.5;
  border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--text);
  transition: background .15s, border-color .15s;
}
.ul-meta input:hover { background: #eef0f4; }
.unit.selected .ul-meta input:hover { background: #fbeed9; }
.ul-meta input:focus { outline: none; background: #fff; border-color: #f5a54c; box-shadow: 0 0 0 3px rgba(245, 140, 30, .14); }
.ul-meta .ul-speaker { flex: 0 0 auto; max-width: 120px; font-weight: 700; color: var(--accent); }
.ul-meta .ul-sound { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: #a1876a; }
.unit-line .line-text { width: 100%; padding: 2px 6px; font-size: 13.5px; font-family: inherit; line-height: 1.6;
  border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--text); resize: vertical; }
.unit-line .line-text:hover { background: #eef0f4; }
.unit.selected .unit-line .line-text:hover { background: #fbeed9; }
.unit-line .line-text:focus { outline: none; background: #fff; border-color: #f5a54c; box-shadow: 0 0 0 3px rgba(245, 140, 30, .14); }

/* video_prompt 高亮编辑器：底层 pre 按 @角色/#场景/&道具 分色，上层 textarea 透明文字叠加 */
.vp-editor { position: relative; margin-top: 5px; border: 1px dashed var(--border-2); border-radius: 8px; background: var(--surface); }
.unit.selected .vp-editor { border-color: #ecd3b4; background: #fff8ec; }
.vp-editor:focus-within { border-color: #f5a54c; box-shadow: 0 0 0 3px rgba(245, 140, 30, .14); }
.vp-hl, .vp-editor .unit-vp {
  margin: 0; padding: 7px 9px; font-size: 13px; font-family: inherit; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word; border-radius: 8px;
}
.vp-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--text); }
.vp-editor .unit-vp {
  position: relative; display: block; width: 100%;
  background: transparent; border: none; color: transparent; caret-color: #d9640d; resize: vertical;
}
.vp-editor .unit-vp:hover { background: transparent; }
.vp-editor .unit-vp:focus { outline: none; background: transparent; box-shadow: none; }
.vp-editor .unit-vp::selection { background: #f5a54c; color: #fff; }
.vp-m { border-radius: 5px; padding: 0 3px; font-weight: 600; }
.vp-m.vp-char { color: #3b5bfd; background: #e6ecff; }
.vp-m.vp-scene { color: #d9640d; background: #ffe9cc; }
.vp-m.vp-prop { color: #0d9488; background: #d3f4ee; }
.vp-legend { font-style: normal; font-weight: 500; color: #a1876a; }
.vp-legend .lg { font-style: normal; border-radius: 4px; padding: 0 4px; margin-left: 4px; font-size: 10.5px; font-weight: 600; }
.lg-c { color: #3b5bfd; background: #e6ecff; }
.lg-s { color: #d9640d; background: #ffe9cc; }
.lg-p { color: #0d9488; background: #d3f4ee; }

/* 单元：左编辑 / 右视频 双栏（空间不足时视频面板自动换行到下方） */
.unit-body { flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 16px; }
.unit-edit { flex: 1 1 320px; min-width: 260px; }
.unit-video-panel {
  flex: 0 1 300px; min-width: 260px; max-width: 320px; border: 1px solid #f0e2cd; border-radius: 10px;
  background: #fffdf9; padding: 12px; display: flex; flex-direction: column; gap: 9px;
  align-self: stretch;
}
.unit-video, .unit-video-placeholder { flex: 1 1 auto; min-height: 132px; }
.uv-head { display: flex; align-items: center; justify-content: space-between; }
.uv-model { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.uv-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.uv-state { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #eceef3; color: var(--muted); }
.uv-state.done { background: var(--ok-soft); color: var(--ok); }
.uv-state.running { background: var(--accent-soft); color: var(--accent); }
.uv-state.failed { background: var(--danger-soft); color: var(--danger); }
.unit-video { width: 100%; border-radius: 8px; background: #000; display: block; }
.unit-video-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  min-height: 158px; border: 1px dashed var(--border-2); border-radius: 8px;
  font-size: 12.5px; color: var(--muted); background: var(--surface); text-align: center; padding: 0 10px;
}
.unit-video-placeholder .uvp-ico { font-size: 22px; opacity: .55; }
.unit-video-placeholder small { font-size: 11px; color: var(--muted); opacity: .85; }
.spin {
  width: 13px; height: 13px; border-radius: 50%; display: inline-block;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.unit-video-err { margin: 0; font-size: 12px; color: var(--danger); line-height: 1.5; }
.unit-lastref { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.unit-lastref.warn { color: #c47a12; }
.uv-adv { font-size: 12px; }
.uv-adv summary { cursor: pointer; color: var(--muted); user-select: none; }
.uv-adv summary:hover { color: var(--accent); }
.uv-adv textarea {
  margin-top: 6px; width: 100%; padding: 7px 9px; font-size: 12px; font-family: inherit; line-height: 1.5;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface); color: var(--text); resize: vertical;
}
.uv-adv textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.uv-ops { display: flex; gap: 7px; }
.uv-ops .btn { flex: 1 1 0; text-align: center; }
.uv-gen { font-weight: 700; background: linear-gradient(135deg, #ff9a3d, #f56d0a) !important; border-color: #f56d0a !important; color: #fff !important; }
.uv-gen:hover { filter: brightness(1.05); }
.uv-upload { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.uv-hint { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.unit-video-hist { font-size: 12px; }
.unit-video-hist summary { cursor: pointer; color: var(--muted); }
.uvh-row { padding: 3px 0; }
.check-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check-inline input { margin: 0; }

/* ================= 资产与分镜：工作区（顶栏 + 左分类导航 + 主视图） ================= */
.ws { padding: 0; overflow: hidden; }
.ws-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 18px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ws-project { display: flex; align-items: center; gap: 8px; flex: 0 1 360px; min-width: 220px; }
.ws-project > span { font-size: 13px; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.ws-project select {
  flex: 1; min-width: 0; padding: 8px 30px 8px 11px; font-size: 13.5px; font-family: inherit;
  border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--text);
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5 10 12.5 15 7.5' fill='none' stroke='%23737a88' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ws-project select:hover { border-color: #c3c8d4; }
.ws-project select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-project-ops { display: flex; gap: 4px; }
.ws-top .status { margin-left: auto; }

.ws-body { display: grid; grid-template-columns: 192px minmax(0, 1fr); min-height: 540px; }
.ws-rail {
  border-right: 1px solid var(--border); background: var(--surface-2);
  padding: 12px 10px; display: flex; flex-direction: column; gap: 4px;
}
.ws-rail-item {
  display: flex; align-items: center; gap: 8px;
  border: none; background: transparent; color: var(--text-2);
  padding: 9px 11px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-family: inherit; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.ws-rail-item:hover { background: #f0f1f7; color: var(--text); }
.ws-rail-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.ws-rail-ico { font-size: 14px; flex: 0 0 auto; }
.ws-count {
  margin-left: auto; font-style: normal; font-weight: 600; font-size: 11.5px;
  min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px;
  background: #e8eaf1; color: var(--muted); font-variant-numeric: tabular-nums;
}
.ws-rail-item.active .ws-count { background: #dcdffb; color: var(--accent); }
.ws-rail-tip {
  font-size: 11px; color: var(--muted); line-height: 1.7;
  margin: 12px 4px 0; padding-top: 12px; border-top: 1px dashed var(--border-2);
}

.ws-main { padding: 18px 22px 24px; min-width: 0; }
.ws-view { display: none; }
.ws-view.active { display: block; animation: fade .18s ease; }
.ws-view-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.ws-view-title { font-size: 15px; font-weight: 650; }
.ws-view-tools { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

/* 蝶站式大空态：图标 + 标题 + 引导按钮 */
.asset-empty {
  border: 1px dashed var(--border-2); border-radius: var(--radius);
  background: var(--surface-2); padding: 46px 20px 42px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.asset-empty-ico { font-size: 30px; opacity: .6; }
.asset-empty-title { font-size: 14.5px; font-weight: 650; color: var(--text-2); }
.asset-empty .btn { margin-top: 8px; }

/* 项目概览（源文件视图底部） */
.project-overview { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--border); }
.po-item { font-size: 12.5px; color: var(--text-2); }
.po-item b { color: var(--accent); }
.po-item .po-ok { color: var(--ok); }
.po-item .po-bad { color: var(--danger); }

@media (max-width: 960px) {
  .ws-body { grid-template-columns: 1fr; min-height: 0; }
  .ws-rail {
    flex-direction: row; align-items: center; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--border); padding: 8px 10px;
  }
  .ws-rail-item { white-space: nowrap; }
  .ws-rail-tip { display: none; }
}

@media (max-width: 1100px) {
  .unit-body { flex-direction: column; }
  .unit-video-panel { flex: 1 1 auto; width: 100%; }
}

/* ================= 筛选 / 统计 ================= */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 4px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.chip {
  border: 1px solid var(--border-2); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer; font-family: inherit;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { background: #f5f6f9; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: #c3c7f5; color: var(--accent); font-weight: 600; }
.search-input { flex: 1 1 200px; min-width: 160px; padding: 8px 11px; font-size: 13px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================= 运营后台（沿用） ================= */
.admin-cards { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.admin-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; background: var(--surface-2); }
.admin-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-card-head strong { font-weight: 600; font-family: var(--mono); font-size: 13px; }
.admin-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.admin-card-actions .danger { color: var(--danger); }
.dev-list { list-style: none; margin: 10px 0 0; padding: 0; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.dev-list li:first-child { border-top: none; }
.dev-list li .small { margin-left: auto; }
.card-detail { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.detail-list { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 0; }
.detail-list > div { display: flex; gap: 8px; font-size: 13px; min-width: 200px; }
.detail-list dt { color: var(--muted); margin: 0; }
.detail-list dd { margin: 0; }
.gen-result { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }

/* ================= 响应式 ================= */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .history-panel { position: static; max-height: none; order: -1; }
}
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; flex: 0 0 auto; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .brand { padding: 0 6px 0 0; border-right: 1px solid var(--border); }
  .brand-text .tag, .sidebar-foot .foot-note { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item { padding: 8px 11px; white-space: nowrap; }
  .nav-item span { font-size: 13px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border-top: none; flex-direction: row; align-items: center; }
  .topbar { padding: 12px 16px; }
  .workspace { padding: 14px 16px 48px; }
  .card { padding: 16px; }
  .unit-line { grid-template-columns: 1fr; }
  .asset-list { grid-template-columns: 1fr; }
}

/* ============================================================
   提取文案（ASR）：拖拽上传 / 识别队列 / 分段时间戳
   ============================================================ */

.asr-drop {
  border: 1.5px dashed var(--border-2); border-radius: var(--radius);
  background: var(--surface-2); padding: 26px 18px; text-align: center;
  transition: border-color .15s, background .15s;
}
.asr-drop.drag { border-color: var(--accent); background: var(--accent-soft); }
.asr-drop-ico { font-size: 26px; line-height: 1; margin-bottom: 8px; }
.asr-drop-main { font-size: 14px; color: var(--text-2); display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.asr-drop-sub { margin-top: 8px; font-size: 12px; color: var(--muted); }

.asr-queue { display: flex; flex-direction: column; gap: 10px; }
.asr-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; background: var(--surface);
}
.asr-item.error { border-color: #f3c9c4; background: #fffafa; }
.asr-item-main { display: flex; align-items: baseline; gap: 8px; }
.asr-item-name { font-weight: 600; font-size: 13px; word-break: break-all; }
.asr-item-meta { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.asr-bar { margin: 7px 0 5px; height: 4px; border-radius: 999px; background: #eef0f4; overflow: hidden; }
.asr-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.asr-item.done .asr-bar > i { background: var(--ok); }
.asr-item.error .asr-bar > i { background: var(--danger); }
.asr-item-state { font-size: 11.5px; color: var(--muted); }
.asr-item-state.err { color: var(--danger); }

.asr-segments { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow: auto; padding-right: 4px; }
.asr-seg { display: grid; grid-template-columns: 52px 78px 1fr; gap: 8px; align-items: start; font-size: 13.5px; line-height: 1.7; }
.asr-time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding-top: 3px; }
.asr-spk {
  font-size: 11.5px; font-weight: 700; text-align: center; padding: 1px 0; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.asr-spk.sp0 { color: #3b5bfd; background: #e6ecff; }
.asr-spk.sp1 { color: #d9640d; background: #ffe9cc; }
.asr-spk.sp2 { color: #0d9488; background: #d3f4ee; }
.asr-spk.sp3 { color: #9333ea; background: #f3e8ff; }
.asr-spk.sp4 { color: #b45309; background: #fef3c7; }
.asr-spk.sp5 { color: #0369a1; background: #e0f2fe; }
.asr-txt { color: var(--text); word-break: break-word; }
.asr-plain { margin: 0; white-space: pre-wrap; font-family: var(--font); font-size: 13.5px; line-height: 1.8; }

.asr-hist { display: flex; flex-direction: column; gap: 8px; }
.asr-hist-item {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; background: var(--surface);
}
.asr-hist-item:hover { border-color: var(--border-2); background: var(--surface-2); }
.asr-hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asr-hist-name { font-weight: 600; font-size: 13px; word-break: break-all; }
.asr-hist-meta { font-size: 11.5px; color: var(--muted); }
.asr-hist-tools { display: flex; gap: 6px; flex: 0 0 auto; }

@media (max-width: 860px) {
  .asr-seg { grid-template-columns: 46px 1fr; }
  .asr-spk { display: none; }
  .asr-hist-item { flex-direction: column; align-items: flex-start; }
}

/* 防御：hidden 属性永远生效，不被 .panel.active 等类规则压掉 */
.panel[hidden] { display: none !important; }

/* ---------------- 统一模态弹窗（替代原生 confirm/prompt） ---------------- */
.sj-modal-mask {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(23, 26, 43, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: sjFade .15s ease;
}
.sj-modal {
  background: #fff; border-radius: 16px; width: min(460px, 100%);
  max-height: min(76vh, 640px); display: flex; flex-direction: column;
  padding: 20px 22px 16px; box-shadow: 0 24px 64px rgba(23, 26, 43, .28), 0 2px 8px rgba(23, 26, 43, .12);
  animation: sjPop .18s cubic-bezier(.2, .9, .3, 1.15);
}
.sj-modal-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex: 0 0 auto;
}
.sj-modal-title::before { content: ''; flex: 0 0 auto; width: 4px; height: 16px; border-radius: 2px; background: var(--accent); }
.sj-modal.danger .sj-modal-title::before { background: var(--danger); }
.sj-modal-body {
  font-size: 14px; line-height: 1.75; color: var(--text); overflow-y: auto;
  min-height: 0; flex: 1 1 auto; word-break: break-word;
}
.sj-modal-body .dim { color: var(--muted); }
.sj-modal-input {
  flex: 0 0 auto; margin-top: 12px; width: 100%; box-sizing: border-box;
  padding: 10px 12px; font-size: 14px; color: var(--text);
  border: 1px solid #d9dde8; border-radius: 10px; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.sj-modal-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 74, 255, .14); }
.sj-modal-foot { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.sj-modal-foot .btn { min-width: 84px; }
.sj-modal-ok.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.sj-modal-ok.danger:hover { background: #e5484d; border-color: #e5484d; }
@keyframes sjFade { from { opacity: 0; } }
@keyframes sjPop { from { opacity: 0; transform: scale(.94) translateY(10px); } }
