:root {
  --bg: #0d1218; --panel: #141b24; --panel2: #18212c;
  --line: #263140; --text: #d8dee5; --dim: #8b98a5;
  --gold: #c9a227; --red: #d06a6a; --green: #7fb069; --blue: #6aa5c9;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; font-size: 14px;
}
a { color: var(--blue); }

/* 顶栏 */
.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { font-size: 17px; font-weight: bold; color: var(--gold); letter-spacing: 1px; }
.brand .sub { font-size: 12px; color: var(--dim); font-weight: normal; margin-left: 8px; }
.top-right { display: flex; gap: 10px; align-items: center; }
.chip {
  padding: 3px 10px; border-radius: 12px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
}
.chip.ok { color: var(--green); border-color: var(--green); }
.chip.bad { color: var(--red); border-color: var(--red); }

/* 布局 */
.layout { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 52px); }
.sidebar { overflow: hidden; }
.main { overflow-y: auto; }
.sidebar { border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.main { padding: 22px 28px; overflow-x: auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--gold); }

/* 上传 */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px 10px;
  text-align: center; cursor: pointer; transition: all .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: rgba(201,162,39,.05); }
.dz-icon { font-size: 26px; }
.dropzone p { margin: 6px 0 0; color: var(--text); }
.dz-hint { font-size: 12px; color: var(--dim); }
.path-import { display: flex; gap: 6px; margin-top: 10px; }
.path-import input {
  flex: 1; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; color: var(--text); font-size: 12px;
}
.mini-btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; cursor: pointer;
}
.mini-btn:hover { border-color: var(--gold); color: var(--gold); }
.import-msg { font-size: 12px; margin: 8px 0 0; min-height: 1em; }
.import-msg.ok { color: var(--green); } .import-msg.err { color: var(--red); }

/* 任务列表 */
.jobs-panel { flex: 1; overflow-y: auto; }
.job-list { display: flex; flex-direction: column; gap: 8px; }
.job-list .empty { color: var(--dim); font-size: 13px; }
.job-card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; cursor: pointer; transition: border-color .12s;
}
.job-card:hover { border-color: var(--blue); }
.job-card.active { border-color: var(--gold); }
.job-card b { display: block; margin-bottom: 5px; }
.job-card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--dim); }
.mode-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 9px;
  background: rgba(106,165,201,.15); color: var(--blue); border: 1px solid rgba(106,165,201,.4);
}
.cost { color: var(--gold); }

/* 欢迎页 */
.welcome { max-width: 880px; margin: 40px auto; text-align: center; }
.welcome h1 { font-size: 24px; color: var(--gold); font-weight: normal; }
.welcome > p { color: var(--dim); line-height: 1.8; }
.flow-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 30px; }
.flow-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.flow-card b { color: var(--gold); font-size: 15px; }
.flow-card span { color: var(--dim); font-size: 12px; line-height: 1.6; }
.flow-card.dim { opacity: .45; }

/* 任务视图 */
.job-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.job-header h2 { margin: 0 0 4px; font-size: 20px; }
.job-meta { color: var(--dim); font-size: 12px; word-break: break-all; }
.job-actions { display: flex; gap: 8px; }

.steps { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  cursor: pointer; font-size: 13px; user-select: none;
}
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.step.active { border-color: var(--gold); color: var(--text); }
.step.done .dot { background: var(--green); }
.step.done { color: var(--green); }
.step.blocked .dot, .step.failed .dot { background: var(--red); }
.step.blocked, .step.failed { color: var(--red); }
.step.running .dot { background: var(--gold); animation: pulse 1s infinite; }
.step.running { color: var(--gold); }
.step.disabled { opacity: .4; cursor: not-allowed; }
.step.locked { opacity: .45; cursor: not-allowed; }
.step.locked .lk { font-size: 11px; }
@keyframes pulse { 50% { opacity: .3; } }

/* 逐步解锁的提示气泡 */
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(16px);
  background: #262c33; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 16px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 200; max-width: 70vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 全局请求进度条（顶部细条，不定态来回滑动） */
#busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300; overflow: hidden; display: none; }
#busy-bar.on { display: block; }
#busy-bar::before {
  content: ""; display: block; height: 100%; width: 35%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: busy-slide 1.1s linear infinite;
}
@keyframes busy-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(385%); } }

/* 旋转图标：按钮忙碌态与运行中提示共用 */
.spin-ico {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(232, 226, 213, .25); border-top-color: var(--gold);
  animation: rot .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* 任务运行中的常驻状态横幅（任务标题下方，任何面板可见） */
.running-banner {
  display: flex; align-items: center;
  background: rgba(201, 162, 39, .08); border: 1px solid rgba(201, 162, 39, .45);
  color: var(--gold); border-radius: 8px; padding: 8px 14px;
  margin-bottom: 12px; font-size: 13px;
}
.running-banner[hidden] { display: none; }

/* 统计卡片下的术语说明 */
.stats-note { font-size: 12px; color: var(--dim); line-height: 1.8; margin: 10px 0 0; }
.stats-note b { color: var(--text); font-weight: normal; }

.step-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; margin-bottom: 16px;
}
.step-panel h3 { margin: 0 0 12px; color: var(--gold); font-size: 15px; }
.step-panel .hint { font-size: 12px; color: var(--dim); font-weight: normal; margin-left: 8px; }

.est-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.est-table th, .est-table td {
  border: 1px solid var(--line); padding: 8px 12px; text-align: left; font-size: 13px;
}
.est-table th { background: var(--panel2); color: var(--dim); font-weight: normal; }
.est-table tr.total td { color: var(--gold); font-weight: bold; }

.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.primary {
  background: var(--gold); color: #10141a; font-weight: bold; border: none;
  border-radius: 8px; padding: 9px 20px; cursor: pointer; font-size: 14px;
}
.primary:disabled { opacity: .4; cursor: not-allowed; }
.primary:not(:disabled):hover { filter: brightness(1.1); }
.ghost-btn {
  background: transparent; color: var(--blue); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 13px; text-decoration: none;
  display: inline-block;
}
.ghost-btn:hover { border-color: var(--blue); }
.ghost-btn.danger { color: var(--red); }
.ghost-btn.danger:hover { border-color: var(--red); }

.stat-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stat-chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; text-align: center;
}
.stat-chip b { display: block; font-size: 17px; color: var(--gold); }
.stat-chip span { font-size: 12px; color: var(--dim); }

.notice {
  border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.7; margin: 10px 0;
}
.notice.warn { background: rgba(201,162,39,.08); border: 1px solid rgba(201,162,39,.35); color: #e0c463; }
.notice.err { background: rgba(208,106,106,.08); border: 1px solid rgba(208,106,106,.4); color: var(--red); }
.notice.ok { background: rgba(127,176,105,.08); border: 1px solid rgba(127,176,105,.35); color: var(--green); }

.checks-table { width: 100%; border-collapse: collapse; }
.checks-table th, .checks-table td { border: 1px solid var(--line); padding: 7px 10px; font-size: 13px; }
.pass { color: var(--green); } .fail { color: var(--red); }

.preview {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; max-height: 300px; overflow: auto; white-space: pre-wrap;
  font-size: 13px; line-height: 1.8; color: var(--text);
}
.preview .src { color: var(--dim); font-size: 11px; }

.editor {
  width: 100%; min-height: 420px; margin-top: 12px; resize: vertical;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px; font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px; line-height: 1.8;
}
.editor:focus { outline: none; border-color: var(--gold); }
.save-msg { font-size: 12px; color: var(--green); }

.usage-line { color: var(--dim); font-size: 12px; padding: 6px 2px; }

.limit-input {
  width: 90px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 8px; color: var(--text); font-size: 13px;
}
label.inline { color: var(--dim); font-size: 13px; }

/* 树形审校 */
.tree { } /* 单滚动条：树随页面滚动，不再有内层滚动容器 */
.tree-node { padding-left: 18px; }
.tree-branch > .branch-head { color: var(--gold); font-weight: bold; cursor: pointer; border-radius: 6px; }
.tree-branch > .branch-head:hover { background: var(--panel2); }
.tree-arrow { display: inline-block; width: 14px; color: var(--dim); }
.tree-row {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 6px;
  font-size: 13px; cursor: default; color: var(--text);
}
.tree-row .cnt { color: var(--dim); font-size: 11px; font-weight: normal; }
.tree-row.leaf { cursor: pointer; color: var(--text); }
.tree-row.leaf:hover { background: var(--panel2); border: 1px solid var(--line); }
.tree-row .where { color: var(--dim); font-size: 11px; }
.tree-row .snippet { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-row .mark { color: var(--gold); font-size: 11px; }
.edit-next { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,8,12,.72); z-index: 50;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;  /* U-05 修复：超高弹窗在遮罩内滚动，✕ 不再被顶出视口 */
}
.modal {
  width: min(860px, 92vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px 26px 20px;
  overflow: auto;  /* U-05：内容超高时弹窗自身可滚 */
  margin: auto;    /* mask 滚动时垂直居中不裁切顶行 */
}
/* U-05 修复：弹窗打开期间锁页面滚动（防 ✕ 随页面滚出视口的困死链） */
body.modal-open { overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; align-items: center; margin-top: 14px; }
.modal .editor { min-height: 320px; margin-top: 0; }

/* 分段控件 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { background: transparent; color: var(--dim); border: none; padding: 7px 16px; cursor: pointer; font-size: 13px; }
.seg-btn.active { background: var(--panel2); color: var(--gold); }

/* 体检样本卡 */
.samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 10px; }
.sample-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; }
.sample-card b { display: block; margin-bottom: 4px; color: var(--text); }
.score { font-size: 18px; font-weight: bold; }
.score.good { color: var(--green); } .score.mid { color: var(--gold); } .score.bad { color: var(--red); }

/* 解析问题清单 */
.issues-box { max-height: 220px; overflow: auto; margin-top: 8px; }
.issue-row { display: flex; gap: 8px; padding: 5px 8px; font-size: 12.5px; border-bottom: 1px dashed var(--line); }
.issue-row .lv { flex: none; padding: 0 6px; border-radius: 4px; font-size: 11px; }
.issue-row .lv.blocking { color: var(--red); border: 1px solid var(--red); }
.issue-row .lv.warning { color: var(--gold); border: 1px solid var(--gold); }
.issue-row .code { color: var(--blue); flex: none; }

/* 资产面板 */
.asset-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.asset-target {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.asset-target b { font-size: 13px; }
.asset-target .done { color: var(--green); font-size: 12px; }
.gen-btn {
  background: rgba(201,162,39,.12); color: var(--gold); border: 1px solid rgba(201,162,39,.4);
  border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.gen-btn:disabled { opacity: .4; cursor: wait; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 14px; }
.gallery .g-item { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.gallery img { width: 100%; border-radius: 6px; display: block; background: #fff; }
.gallery .g-cap { font-size: 11px; color: var(--dim); margin-top: 6px; word-break: break-all; }

/* 纸片人预览 */
.puppet-preview { display: flex; gap: 16px; align-items: flex-start; margin-top: 12px; flex-wrap: wrap; }
.puppet-preview canvas {
  background: repeating-conic-gradient(#1a222c 0 25%, #141b24 0 50%) 0 0/24px 24px;
  border: 1px solid var(--line); border-radius: 8px;
}
.puppet-ctl { display: flex; flex-direction: column; gap: 8px; }

.g-head { color: var(--blue); font-size: 13px; margin: 14px 0 2px; }

/* 关键修复：作者样式 display:flex 会压过 UA 的 [hidden]{display:none}，
   必须显式声明 hidden 状态，否则弹窗常驻无法关闭 */
.modal-mask[hidden] { display: none; }

/* P1-6 修复（2026-11-16）：全局兜底——任何带 hidden 的元素一律不可见。
   此前 .ghost-btn{display:inline-block} 等作者样式会压过 hidden 属性，
   典型受害者：#btn-discard-edits（审校页"撤销修改"按钮常显）。 */
[hidden] { display: none !important; }
.modal-mask:not([hidden]) { display: flex; }  /* 上一条 !important 的配套：弹窗开态恢复 flex */

/* ---- 洗文：主题卡 / 方向chips / 样章 ---- */
.rw-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 8px 0 4px; }
.rw-theme { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; background: var(--panel2); }
.rw-theme:hover { border-color: var(--gold); }
.rw-theme.picked { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.rw-theme b { display: block; margin-bottom: 4px; }
.rw-theme span { font-size: 12px; color: var(--dim); line-height: 1.6; }
.rw-dirs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.rw-dir { border: 1px solid var(--line); border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; background: var(--panel2); }
.rw-dir.picked { border-color: var(--green); color: var(--green); }
.rw-sample { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.rw-sample b { color: var(--gold); font-size: 13px; }
.rw-sample div { margin-top: 8px; font-size: 13px; line-height: 1.8; border-radius: 6px; padding: 8px 10px; }
.rw-before { background: rgba(122,46,46,.12); color: var(--dim); }
.rw-after { background: rgba(122,180,105,.10); color: var(--text); }
.rw-sample span { font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin-right: 8px; }

/* ---- 素材：进度条 / 实体行 / 向导 ---- */
.progress-bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; margin: 6px 0 14px; }
.progress-bar div { height: 100%; background: var(--green); transition: width .4s; }
.asset-target.dim { opacity: .55; }
/* 素材向导：宽松间距（2026-10-22 用户反馈"太紧凑"） */
.modal.wizard { width: min(800px, 94vw); max-height: 90vh; overflow-y: auto; padding: 28px 32px 24px; }
.modal.wizard .modal-head { margin-bottom: 18px; }
.modal.wizard .modal-head b { font-size: 16px; }
.wiz-steps { display: flex; gap: 8px; font-size: 13px; color: var(--dim); margin-bottom: 20px; flex-wrap: wrap; }
.wiz-steps .on { color: var(--gold); }
.wiz-preview { min-height: 200px; display: flex; justify-content: center; padding: 16px 0; }
.modal.wizard .row-actions { margin-top: 18px; gap: 12px; }
.modal.wizard .stats-note { margin-top: 14px; }
.modal.wizard textarea.editor { margin-top: 8px; }
.modal.wizard .rw-themes { margin-top: 14px; gap: 14px; }

/* 解析/洗文运行中的大进度条 */
.progress-bar.big { height: 10px; margin: 12px 0 8px; }
.progress-bar.big div { background: linear-gradient(90deg, var(--gold), #e0be5a); }

/* 任务卡片删除按钮 */
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-del {
  background: transparent; border: none; color: var(--dim); font-size: 13px;
  cursor: pointer; padding: 2px 6px; border-radius: 5px; line-height: 1; flex: none;
}
.card-del:hover { color: var(--red); background: rgba(208,106,106,.12); }

/* 审校工具栏：置顶吸附 + 右侧金色进入解析按钮 */
.edit-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 8px 2px; margin-bottom: 10px;
}
.edit-toolbar .edit-next-top { margin-left: auto; padding: 8px 16px; }
#tree-search { flex: 1; min-width: 140px; max-width: 280px; }

/* 步骤条 issues/partial/skipped 状态配色（此前无样式显示成灰色，被误读为未执行） */
.step.issues .dot { background: #e0a63c; }
.step.issues { color: #e0c463; }
.step.partial .dot { background: #e0a63c; }
.step.partial { color: #e0c463; }
.step.skipped .dot { background: var(--blue); }
.step.skipped { color: var(--blue); }

/* 章节管理 / 相似归并 弹窗 */
.ch-row { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ch-row .cnt { color: var(--dim); font-size: 12px; margin-left: auto; }
.dd-row { display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.dd-row .cnt { color: var(--dim); font-size: 12px; margin-left: 6px; }
.dd-row .snippet { color: var(--dim); font-size: 12px; margin-top: 3px; }

/* 解析仪表盘 / 实体编辑 / 体检发现 */
.dash-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.stat-chip.truth { flex: 1; min-width: 260px; text-align: left; }
.stat-chip.truth b { display: inline; margin-right: 8px; }
.stat-chip.truth span { color: var(--text); font-size: 12.5px; }
.ent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ent-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .12s; }
.ent-card:hover { border-color: var(--gold); }
.ent-card b { font-size: 14px; }
.ent-card .cnt { color: var(--dim); font-size: 11.5px; }
.ent-avatar { width: 40px; height: 40px; border-radius: 50%; background: rgba(201,162,39,.15);
  color: var(--gold); font-size: 18px; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.ent-card.mini { flex-direction: row; align-items: center; gap: 8px; }
.ent-list { display: flex; flex-direction: column; gap: 6px; }
.ent-row { display: flex; gap: 12px; align-items: baseline; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px; }
.ent-row:hover { border-color: var(--gold); }
.ent-row .cnt { color: var(--dim); font-size: 12px; }
.issue-row .how { color: var(--blue); font-size: 12px; }
.f-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.f-row > span { flex: none; width: 130px; color: var(--dim); font-size: 13px; padding-top: 7px; text-align: right; }
.f-row .editor { min-height: 60px; }
.check-issue { display: flex; align-items: center; gap: 10px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; font-size: 13px; }
.check-issue .cnt { color: var(--dim); flex: 1; }
.adv-summary { cursor: pointer; color: var(--dim); font-size: 13px; margin: 14px 0 8px; user-select: none; }
.adv-summary:hover { color: var(--blue); }

/* ---- 解析仪表盘 v2（2026-10-22 需求） ---- */
.modal { overflow-y: auto; }                    /* 弹窗单滚动条：内层不再各自滚 */
/* 场景/线索卡：纵向布局，名称独占一行 */
.ent-card.place, .ent-card.clue { flex-direction: column; align-items: flex-start; gap: 4px; }
.ent-card.place b { font-size: 14px; line-height: 1.4; }
.ent-card .clamp2 {
  color: var(--dim); font-size: 11.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ent-card.clue { position: relative; min-height: 88px; }
.ent-card.clue .loc { color: var(--gold); font-size: 11px; }
.ent-card.clue .idx { position: absolute; top: 8px; right: 10px; color: var(--dim); font-size: 10px; }
.clue-pager { display: flex; align-items: center; gap: 14px; justify-content: center; margin: 12px 0; }
.stat-chip.synopsis { flex: 2; min-width: 220px; text-align: left; }
.stat-chip.synopsis span { white-space: normal; line-height: 1.5; }
.truth-box .f-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.truth-box .f-row span { color: var(--dim); min-width: 64px; }
.step.cancelled .dot { background: #5b8dd6; }
.step.cancelled { color: #5b8dd6; }

/* ---- 全局自定义滚动条（覆盖系统默认，深色细圆角） ---- */
* { scrollbar-width: thin; scrollbar-color: #2c3640 transparent; }   /* Firefox */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3640; border-radius: 6px; border: 2px solid #10161c; }
::-webkit-scrollbar-thumb:hover { background: #3a4750; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---- 模型设置：平台卡片 v2 ---- */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin: 8px 0; }
.prov-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--panel2);
  display: flex; flex-direction: column; gap: 8px; }
.prov-card.add { border-style: dashed; cursor: pointer; }
.prov-card.add .prov-head { cursor: pointer; }
.prov-head { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.prov-head b { flex: 0 0 auto; }
.prov-head .cnt { color: var(--dim); font-size: 12px; }
.prov-key { font-family: Consolas, monospace; font-size: 11.5px; color: var(--dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-input { width: 100%; }
.dot-ok, .dot-bad { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--green); }
.dot-bad { background: var(--red); }
.prov-head { color: var(--dim); font-size: 12.5px; }
.prov-head b { color: var(--text); font-size: 15px; }

/* ---- 自绘确认弹窗 ---- */
.modal.confirm { width: min(440px, 92vw); }
.modal.confirm #confirm-text { margin: 4px 0 8px; }
button.primary.danger { background: var(--red); border-color: #a04444; }

/* ---- 改编工作台：版本条 / 档案 / 指令卡 / 彩排 ---- */
.ver-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; }
.ver-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--panel2);
  display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.ver-card:hover { border-color: var(--gold); }
.ver-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; cursor: default; }
.ver-card b { font-size: 13.5px; }
.ver-card .chip { font-size: 10px; color: var(--gold); border: 1px solid var(--gold); border-radius: 8px; padding: 0 6px; }
.ghost-btn.mini { padding: 2px 8px; font-size: 11px; }
.rw-dossier { display: grid; grid-template-columns: 1.7fr 1fr; gap: 12px; margin: 8px 0; }
.rw-dossier .dossier-main, .rw-dossier .dossier-side > div {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.rw-dossier .dossier-side { display: flex; flex-direction: column; gap: 8px; }
.rw-tone { display: inline-block; border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; margin: 2px 4px 2px 0; font-size: 11.5px; }
.rw-freebox textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-size: 13.5px; line-height: 1.8; padding: 12px 14px; min-height: 70px; resize: vertical; font-family: inherit; }
.rw-menubox { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: rgba(255,255,255,.015); }
.rw-themes.mini .rw-theme { padding: 6px 10px; }
.rw-kind { font-size: 12.5px; color: var(--gold); margin: 10px 0 4px; }
.rw-dir-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.rw-dir-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 12.5px; display: inline-flex; gap: 8px; align-items: center; }
.rw-dir-card i { font-style: normal; color: var(--dim); cursor: pointer; }
.rw-dir-card i:hover { color: var(--red); }
.rw-impact .will { color: var(--green); font-size: 12.5px; line-height: 2; }
.rw-impact .keep { color: var(--gold); font-size: 12.5px; line-height: 2; }
.rh-line { display: flex; gap: 12px; padding: 7px 4px; border-bottom: 1px dashed var(--line); font-size: 14px; animation: rh-in .4s ease; }
.rh-line b { min-width: 64px; flex: 0 0 auto; }
.rh-line span { line-height: 1.7; }
@keyframes rh-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
@media (max-width: 760px) { .rw-dossier { grid-template-columns: 1fr; } }

/* 素材页：缩略图卡片 */
.asset-targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.thumb-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column; transition: border-color .12s; }
.thumb-card:hover { border-color: var(--gold); }
.thumb-card.empty { border-style: dashed; opacity: .85; }
.thumb-card.empty:hover { opacity: 1; }
/* 未生成占位：暗色虚线框 + 淡图标，融入主题（2026-10-22 用户反馈"白底黄图标丑"） */
.thumb { position: relative; height: 170px; background: var(--panel); display: flex; align-items: center; justify-content: center; }
.thumb-card.empty .thumb { border-bottom: 1px dashed var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { font-size: 52px; font-weight: 300; opacity: .12; color: var(--text);
  width: 100%; height: 100%; align-items: center; justify-content: center; display: flex;
  background: repeating-linear-gradient(135deg, transparent 0 12px, rgba(255,255,255,.015) 12px 24px);
  font-family: 'Noto Serif SC', 'Songti SC', serif; }
.done-badge, .todo-badge { position: absolute; top: 8px; left: 8px; font-size: 11px;
  padding: 2px 8px; border-radius: 10px; backdrop-filter: blur(2px); }
.done-badge { background: rgba(127,176,105,.9); color: #10240f; }
.todo-badge { background: rgba(20,26,34,.75); color: var(--dim); }
.thumb-info { padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.thumb-info b { font-size: 14px; }
.thumb-info .cnt { color: var(--dim); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-card .gen-btn { margin: 8px 10px 10px; }

/* 实体详情弹窗 */
.em-split { display: flex; gap: 18px; align-items: flex-start; }
.em-visual { flex: none; }
.em-img { max-height: 420px; max-width: 320px; border-radius: 10px; background: #fff; }
.em-img.wide { max-width: 560px; }
.em-info { flex: 1; min-width: 240px; }
.parts-box { margin-top: 12px; }
.parts-box summary { cursor: pointer; color: var(--dim); font-size: 12.5px; }
.parts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 8px; }
.parts-grid figure { margin: 0; text-align: center; }
.parts-grid img { width: 100%; height: 76px; object-fit: contain; background: #fff; border-radius: 6px; }
.parts-grid figcaption { font-size: 10.5px; color: var(--dim); margin-top: 2px; }

/* 弹窗行距与内容密度（用户反馈：行间距偏小） */
.modal { line-height: 1.9; }
.modal .stats-note, .modal p { line-height: 1.95; }
.f-row { margin-bottom: 14px; }
.f-row > span { line-height: 1.8; }
.issue-row { line-height: 1.85; padding: 8px 10px; }
.ch-row, .dd-row { padding: 9px 6px; line-height: 1.8; }
.notice { line-height: 2; }

/* 翻页条 */
.pager { display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 10px 0 2px; color: var(--dim); font-size: 12.5px; }
.pager .ghost-btn { padding: 5px 12px; }
.pager .ghost-btn[disabled] { opacity: .35; cursor: default; }
.wiz-prompt-box { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; background: rgba(255,255,255,.02); }
.wiz-prompt-box summary { cursor: pointer; color: var(--dim); font-size: 12px; margin-bottom: 8px; user-select: none; }
.wiz-prompt-box[open] summary { color: var(--gold); margin-bottom: 10px; }

/* ============ 统一剧场平台门户（portal.js）============ */
#portal-nav{display:flex;gap:4px;margin-left:18px}
#portal-nav .pnav{background:none;border:1px solid transparent;border-radius:8px;color:var(--ink,#e8e4da);
  padding:6px 12px;cursor:pointer;font-size:14px}
#portal-nav .pnav.on{border-color:var(--line,#3a3e46);background:rgba(255,255,255,.06);color:#d8b878}
.portal-page{max-width:1100px;margin:0 auto;padding:18px 20px 60px}
.pp-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:14px}
.pp-head h2{font-size:20px;margin:0}
.pp-head h3{font-size:16px;margin:0}
.pp-actions{display:flex;gap:8px;align-items:center}
.primary-btn{display:inline-block;background:#2e6f40;color:#fff;border:none;border-radius:8px;padding:7px 14px;cursor:pointer;font-size:13px}
.primary-btn:hover{background:#38854e}
.portal-tip{font-size:13px;padding:6px 10px;border-radius:6px;margin:8px 0}
.portal-tip.ok{background:rgba(72,199,142,.12);color:#54c78f}
.portal-tip.err{background:rgba(224,82,82,.12);color:#e05252}
/* 书库 */
.lib-drop{border:2px dashed var(--line,#3a3e46);border-radius:12px;padding:18px;text-align:center;color:#8a91a0;margin-bottom:14px;font-size:14px}
.lib-drop.on{border-color:#d8b878;color:#d8b878}
.lib-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(310px,1fr));gap:14px}
.lib-card,.th-card{background:#1b1e24;border:1px solid var(--line,#3a3e46);border-radius:12px;padding:14px}
.lc-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.lc-title{font-size:15px}
.badge{font-size:11px;padding:2px 8px;border-radius:10px;background:#2a2e35;color:#9aa2ad;white-space:nowrap}
.badge.ok{background:rgba(72,199,142,.15);color:#54c78f}
.badge.run{background:rgba(216,184,120,.15);color:#d8b878}
.badge.bad{background:rgba(224,82,82,.15);color:#e05252}
.lc-meta{font-size:12px;color:#8a91a0;margin:6px 0 4px}
.lc-syn{font-size:13px;color:#c6c0b4;margin:6px 0;min-height:36px;line-height:1.7}
.lc-roles{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:8px}
.chip-role{font-size:11px;background:#26303c;color:#8fb3d9;border-radius:8px;padding:2px 8px}
.lc-actions{display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.lc-err{color:#e05252;font-size:12px;margin-top:6px}
.lc-actions select,.th-gen select{background:#14161a;color:#e8e4da;border:1px solid var(--line,#3a3e46);border-radius:6px;padding:3px 6px;font-size:12px}
.lib-table{width:100%;border-collapse:collapse;font-size:13px;margin:10px 0}
.lib-table td,.lib-table th{border:1px solid var(--line,#3a3e46);padding:5px 8px;text-align:left}
.lib-detail{background:#1b1e24;border:1px solid var(--line,#3a3e46);border-radius:12px;padding:14px;margin-top:16px}
/* 剧场 */
.stage-url{background:#14161a;color:#e8e4da;border:1px solid var(--line,#3a3e46);border-radius:8px;padding:6px 10px;width:250px;font-size:13px}
.stage-wrap{border:1px solid var(--line,#3a3e46);border-radius:12px;overflow:hidden;height:calc(100vh - 150px)}
.stage-wrap iframe{width:100%;height:100%;border:0;background:#fff}
/* 演出工场 */
.th-import{background:#1b1e24;border:1px solid var(--line,#3a3e46);border-radius:12px;padding:12px 14px;margin-bottom:14px}
.th-import summary{cursor:pointer;color:#d8b878;font-size:14px}
.th-import textarea{width:100%;margin:10px 0;background:#14161a;color:#e8e4da;border:1px solid var(--line,#3a3e46);border-radius:8px;padding:8px;font-size:12px;font-family:monospace}
.th-import .row{display:flex;gap:8px;align-items:center}
.th-list{display:grid;gap:14px}
.th-gen{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:8px 0;font-size:13px}
.th-gen label{color:#8a91a0}
.th-links a{color:#54c78f;font-size:13px;text-decoration:none;margin-left:8px}
/* 素材提示词档案 */
.ap-list{display:grid;gap:8px}
.ap-item{background:#1b1e24;border:1px solid var(--line,#3a3e46);border-radius:10px;padding:8px 12px}
.ap-item summary{cursor:pointer;font-size:13px;color:#c6c0b4}
.ap-item textarea{width:100%;margin:8px 0;background:#14161a;color:#e8e4da;border:1px solid var(--line,#3a3e46);border-radius:8px;padding:8px;font-size:12px}
