/* ============================================================
   ResearchCanvas 样式表
   浅色克制学术风；色板与尺寸集中在 :root 变量中
   ============================================================ */

:root {
  /* 主题色板（technical_spec 模块4 的 12 色） */
  --c1:  #4A90D9;  --c2:  #E67E22;
  --c3:  #27AE60;  --c4:  #9B59B6;
  --c5:  #E74C3C;  --c6:  #1ABC9C;
  --c7:  #F1C40F;  --c8:  #34495E;
  --c9:  #D35400;  --c10: #16A085;
  --c11: #8E44AD;  --c12: #C0392B;
  --c-noise: #CCCCCC;

  /* 语义色 */
  --accent:        #4A90D9;
  --accent-dark:   #357ABD;
  --accent-soft:   #EAF3FC;
  --ok:            #27AE60;
  --ok-soft:       #EAFAF1;
  --warn:          #E67E22;
  --warn-soft:     #FDF2E9;
  --danger:        #E74C3C;
  --danger-soft:   #FDEDEC;
  --gold:          #F39C12;
  --gold-soft:     #FEF9E7;
  --info:          #3498DB;
  --info-soft:     #EBF5FB;

  /* 中性色 */
  --bg:            #FAFAFA;
  --surface:       #FFFFFF;
  --surface-2:     #F4F6F8;
  --border:        #E3E7EB;
  --border-strong: #CBD3DA;
  --text:          #24292F;
  --text-2:        #57606A;
  --text-3:        #8B949E;

  /* 尺寸 */
  --header-h:      52px;
  --left-w:        290px;
  --right-w:       400px;
  --evidence-h:    40vh;
  --radius:        6px;
  --radius-lg:     10px;
  --gap:           12px;
  --fs-xs:         11px;
  --fs-sm:         12px;
  --fs:            13px;
  --fs-md:         14px;
  --fs-lg:         16px;
  --mono: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

/* 浮层统一用 hidden 属性控制显隐。多数浮层自带 display:flex/block，
   会盖掉浏览器默认的 [hidden]{display:none}，导致隐藏后仍拦截点击。 */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  /* 简体中文优先：系统 UI 字体在部分环境下会回退成繁体字形 */
  font-family: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC",
               "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: var(--fs);
  line-height: 1.6;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #D0D7DE; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #AFB8C1; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ Header ============================ */

#app-header {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 40;
}

.hdr-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hdr-logo {
  width: 26px; height: 26px; border-radius: var(--radius);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); letter-spacing: .5px;
}
.hdr-title {
  font-weight: 600; font-size: var(--fs-md);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}

.hdr-tabs { display: flex; gap: 2px; }
.tab-btn {
  border: none; background: transparent; color: var(--text-2);
  padding: 6px 14px; border-radius: var(--radius);
  font-size: var(--fs-md);
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; position: relative; }

.hdr-search { position: relative; }
.hdr-search input {
  width: 260px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); font-size: var(--fs);
  outline: none; transition: border-color .15s, background .15s;
}
.hdr-search input:focus { border-color: var(--accent); background: #fff; }

#config-btn {
  padding: 6px 10px; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: var(--radius);
  font-size: 16px; color: var(--text-2);
  transition: all .2s;
}
#config-btn:hover {
  background: var(--accent-soft); color: var(--accent-dark);
  border-color: var(--accent);
}

.search-dropdown {
  position: absolute; top: 34px; right: 0; width: 460px; max-height: 420px;
  overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.10); z-index: 60;
}
.search-item { padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--accent-soft); }
.search-item .si-title { font-weight: 600; font-size: var(--fs); }
.search-item .si-snippet { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.search-item .si-snippet mark { background: #FFF3B0; padding: 0 1px; }
.search-item .si-meta { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; }

.job-indicator {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 5px 10px; border-radius: 14px; color: var(--text-2);
  font-size: var(--fs-sm);
}
.job-indicator:hover { border-color: var(--border-strong); }
.job-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3);
}
.job-indicator.busy { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-soft); }
.job-indicator.busy .job-dot { background: var(--accent); animation: pulse-dot 1.2s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.job-step { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.job-popover {
  position: absolute; top: 40px; right: 0; width: 340px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.10);
  padding: 10px 12px; z-index: 60; max-height: 420px; overflow-y: auto;
}
.job-card { padding: 8px 0; border-bottom: 1px solid var(--border); }
.job-card:last-child { border-bottom: none; }
.job-card .jc-top { display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.job-card .jc-type { font-weight: 600; }
.job-steps { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.job-step-row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); }
.job-step-row .jsr-name { width: 58px; flex: 0 0 58px; }
.job-step-row .jsr-bar { flex: 1; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.job-step-row .jsr-fill { height: 100%; background: var(--accent); }
.job-step-row.current .jsr-name { color: var(--accent-dark); font-weight: 600; }

/* ============================ Main 三栏 ============================ */

#app-main {
  flex: 1 1 auto; display: flex; min-height: 0; position: relative;
}

#left-panel, #right-panel {
  background: var(--surface);
  display: flex; flex-direction: column;
  min-height: 0; flex-shrink: 0;
  transition: width .18s ease;
}
#left-panel  { width: var(--left-w);  border-right: 1px solid var(--border); }
#right-panel { width: var(--right-w); border-left:  1px solid var(--border); }
#left-panel.collapsed, #right-panel.collapsed { width: 0; overflow: hidden; border: none; }

.panel-head {
  height: 34px; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-2);
  background: var(--surface-2);
}
.panel-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px; }

.icon-btn {
  border: none; background: transparent; color: var(--text-3);
  width: 22px; height: 22px; border-radius: 4px; line-height: 1;
  font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--border); color: var(--text); }

.panel-reopen {
  position: absolute; top: 8px; z-index: 20;
  width: 18px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-left: none;
  background: var(--surface); color: var(--text-3);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.panel-reopen.right { right: 0; border: 1px solid var(--border); border-right: none;
  border-radius: var(--radius) 0 0 var(--radius); }
.panel-reopen:not(.right) { left: 0; }
.panel-reopen:hover { color: var(--text); }

#main-view { flex: 1 1 auto; min-width: 0; position: relative; overflow: hidden; }

.view-container { position: absolute; inset: 0; display: none; overflow: hidden; }
.view-container.active { display: block; }

/* ============================ 通用组件 ============================ */

.btn {
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 5px 12px; border-radius: var(--radius);
  font-size: var(--fs); transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ok      { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover:not(:disabled) { filter: brightness(.93); background: var(--ok); }
.btn-danger  { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-ghost   { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 3px 8px; font-size: var(--fs-sm); }

.badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: var(--fs-xs); line-height: 17px; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--accent-dark); border-color: #C5DDF5; }
.badge-ok     { background: var(--ok-soft);   color: #1E8449; border-color: #BFE8CF; }
.badge-warn   { background: var(--warn-soft); color: #B9600F; border-color: #F6D6B8; }
.badge-danger { background: var(--danger-soft); color: #B33A2C; border-color: #F4C4BE; }
.badge-gold   { background: var(--gold-soft); color: #9A6100; border-color: #F3E0A8; }
.badge-muted  { background: var(--surface-2); color: var(--text-3); }

.chip {
  display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0;
  border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text-2);
  font-size: var(--fs-xs); cursor: default;
}
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { background: var(--accent-soft); border-color: #C5DDF5; color: var(--accent-dark); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.card-title { font-weight: 600; font-size: var(--fs-md); margin: 0 0 6px; }

.section-title {
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .6px;
  margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.section-title:first-child { margin-top: 0; }

.empty-hint {
  color: var(--text-3); font-size: var(--fs); text-align: center;
  padding: 36px 16px; line-height: 1.8;
}
.error-hint {
  color: #B33A2C; background: var(--danger-soft);
  border: 1px solid #F4C4BE; border-radius: var(--radius);
  padding: 10px 12px; font-size: var(--fs); margin: 10px 0;
}
.loading-hint { color: var(--text-3); text-align: center; padding: 30px; font-size: var(--fs); }

.kv-list { display: grid; grid-template-columns: 74px 1fr; gap: 4px 10px; font-size: var(--fs); }
.kv-list dt { color: var(--text-3); }
.kv-list dd { margin: 0; word-break: break-word; }

.progress-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width .3s; }

/* ============================ 左侧面板内容 ============================ */

.filter-box { margin-bottom: 12px; }
.filter-row { margin-bottom: 8px; }
.filter-row > label {
  display: block; font-size: var(--fs-xs); color: var(--text-3);
  margin-bottom: 3px; font-weight: 600;
}
.filter-row select, .filter-row input {
  width: 100%; padding: 4px 6px; font-size: var(--fs);
  border: 1px solid var(--border); border-radius: 4px; background: var(--surface);
  outline: none;
}
.filter-row select:focus, .filter-row input:focus { border-color: var(--accent); }
.filter-inline { display: flex; gap: 6px; }
.filter-inline > * { flex: 1; min-width: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 4px; }
.checks label {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: var(--fs-xs); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1px 7px; cursor: pointer; background: var(--surface);
}
.checks label:hover { background: var(--surface-2); }
.checks input { margin: 0; }

.doc-list { display: flex; flex-direction: column; gap: 1px; }
.doc-item {
  padding: 7px 8px; border-radius: 4px; cursor: pointer;
  border: 1px solid transparent;
}
.doc-item:hover { background: var(--surface-2); }
.doc-item.selected { background: var(--accent-soft); border-color: #C5DDF5; }
.doc-item .di-title {
  font-size: var(--fs); line-height: 1.45; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-item .di-meta {
  font-size: var(--fs-xs); color: var(--text-3);
  margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.dot-topic { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 7px; }

.list-footer { padding: 8px 0; text-align: center; }

.selection-bar {
  position: sticky; top: -10px; z-index: 5;
  background: var(--accent-soft); border: 1px solid #C5DDF5;
  border-radius: var(--radius); padding: 8px 10px; margin-bottom: 10px;
}
.selection-bar .sb-count { font-weight: 600; color: var(--accent-dark); font-size: var(--fs-md); }
.selection-bar .sb-actions { display: flex; gap: 6px; margin-top: 6px; }

.legend { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); }
.legend-row { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.legend-swatch { width: 11px; height: 11px; border-radius: 2px; flex: 0 0 11px; }

/* ============================ 概览视图 ============================ */

.ov-wrap { height: 100%; overflow-y: auto; padding: 16px; }
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.stat-card .sc-label { font-size: var(--fs-sm); color: var(--text-3); }
.stat-card .sc-value { font-size: 26px; font-weight: 700; line-height: 1.25; margin-top: 2px; }
.stat-card .sc-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.stat-card.accent .sc-value { color: var(--accent); }
.stat-card.ok     .sc-value { color: var(--ok); }
.stat-card.gold   .sc-value { color: var(--gold); }

/* R0·§1.3 演示健康状态卡片（概览页 stats 行下方） */
.ov-health-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px 14px;
  margin-bottom: 16px;
}
.ov-health-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.ov-health-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-1); }
.ov-health-sub   { font-size: var(--fs-xs); color: var(--text-3); }
.ov-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.ov-health-loading { color: var(--text-3); font-size: var(--fs-sm); padding: 8px 0; }
.ov-health-err {
  margin-top: 8px; padding: 6px 10px;
  font-size: var(--fs-xs); color: var(--danger, #c0392b);
  background: rgba(192,57,43,.06); border-radius: var(--radius);
}
body.screen-mode .ov-health-card { background: transparent; border-color: rgba(255,255,255,.12); }
body.screen-mode .ov-health-title { color: #fff; }
body.screen-mode .ov-health-sub   { color: #8B97AC; }

.ov-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px;
}
.chart-card > h3 { margin: 0 0 8px; font-size: var(--fs-md); font-weight: 600; }
.chart-box { width: 100%; height: 250px; }
.chart-box.tall { height: 300px; }

/* 卡片标题栏 + 右上按钮组 */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 0 0 8px;
}
.card-head .card-title { margin: 0; }
.card-btn-group { display: flex; gap: 4px; flex-shrink: 0; }
.card-icon-btn {
  border: none; background: transparent; color: var(--text-3);
  width: 24px; height: 24px; border-radius: 4px; line-height: 1;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.card-icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* 主图大区域 */
.ov-focus-card {
  background: var(--surface); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 14px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.ov-focus-card .card-title { font-size: var(--fs-md); font-weight: 600; color: var(--text-1); }
#ov-focus-chart-box { width: 100%; height: 480px; }

.rank-list { display: flex; flex-direction: column; gap: 5px; max-height: 300px; overflow-y: auto; }
.rank-row { display: flex; align-items: center; gap: 8px; font-size: var(--fs); }
.rank-row .rr-name { flex: 0 0 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .rr-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rank-row .rr-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.rank-row .rr-num { flex: 0 0 38px; text-align: right; color: var(--text-3); font-size: var(--fs-sm); }

/* ============================ 语义地图 ============================ */

.map-wrap { height: 100%; display: flex; flex-direction: column; }
.map-toolbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface);
  flex-wrap: wrap;
}
.map-toolbar .spacer { flex: 1; }
.map-toolbar .tb-hint { color: var(--text-3); font-size: var(--fs-sm); }
.map-canvas { flex: 1 1 auto; min-height: 0; position: relative; }
.map-float-btn {
  position: absolute; right: 20px; bottom: 20px; z-index: 10;
  box-shadow: 0 3px 10px rgba(0,0,0,.14);
}

/* ============================ 研究树 ============================ */

.tree-wrap { height: 100%; display: flex; flex-direction: column; }
.tree-toolbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.tree-toolbar .spacer { flex: 1; }
.tree-canvas { flex: 1 1 auto; min-height: 0; background: var(--bg); }

/* ============================ R5 报告健康摘要 ============================ */
/* 报告顶部"4 类问题"横幅，每项带精准跳转。
   关键：与全局浅色主题一致，避免与暗色语义地图混淆。 */
.rpt-health-bar {
  margin: 0 0 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(74,144,217,0.08) 0%, var(--surface) 100%);
  border: 1px solid rgba(74,144,217,0.32);
  border-left: 4px solid #4A90D9;
  border-radius: 4px;
  font-size: var(--fs);
}
.rpt-health-bar[hidden] { display: none !important; }
.rpt-health-bar .rpt-health-head {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs);
  color: var(--text);
  margin-bottom: 8px;
}
.rpt-health-bar .rpt-health-icon {
  display: inline-flex; width: 20px; height: 20px;
  align-items: center; justify-content: center;
  background: rgba(250,173,20,0.18); color: #D48806;
  border-radius: 50%; font-weight: 700;
  font-size: var(--fs-sm);
}
.rpt-health-bar .rpt-health-head b { color: #D48806; }

.rpt-health-bar .rpt-health-list {
  display: flex; flex-direction: column;
  gap: 8px;
}
.rpt-health-bar .rpt-health-group {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.rpt-health-bar .hg-title {
  font-size: var(--fs-sm); font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.rpt-health-bar .hg-figures .hg-title  { color: #4A90D9; }
.rpt-health-bar .hg-failed .hg-title   { color: #F5222D; }
.rpt-health-bar .hg-needmore .hg-title { color: #D48806; }
.rpt-health-bar .hg-weak .hg-title     { color: #722ED1; }

.rpt-health-bar .hg-items {
  display: flex; flex-direction: column;
  gap: 4px;
}
.rpt-health-bar .hg-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px;
  font-size: var(--fs-sm);
  border-left: 2px solid var(--border);
}
.rpt-health-bar .hg-label {
  flex: 1 1 auto;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rpt-health-bar .hg-err {
  color: var(--text-3); font-size: var(--fs-xs);
  flex: 0 1 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rpt-health-bar .hg-go {
  flex: 0 0 auto;
  padding: 2px 8px !important;
  font-size: var(--fs-xs) !important;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #4A90D9;
  cursor: pointer;
}
.rpt-health-bar .hg-go:hover {
  background: rgba(74,144,217,0.12);
  border-color: rgba(74,144,217,0.45);
}
.rpt-health-bar .hg-more {
  font-size: var(--fs-xs); color: var(--text-3);
  padding-left: 6px;
}

/* R5 §6.1 章节状态徽章 */
.section-block .rpt-sec-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: 10px;
  vertical-align: middle;
}
.rpt-sec-ok      { background: rgba(82,196,26,0.12);  color: #389E0D; border: 1px solid rgba(82,196,26,0.45); }
.rpt-sec-failed  { background: rgba(245,34,45,0.1);   color: #CF1322; border: 1px solid rgba(245,34,45,0.45); }
.rpt-sec-pending { background: var(--surface-2);       color: var(--text-3); border: 1px solid var(--border); }
.rpt-sec-gen     { background: rgba(74,144,217,0.1);   color: #4A90D9; border: 1px solid rgba(74,144,217,0.4); }

/* R5 §6.1 章节骨架审计 mini 行：字数/引用/图表/来源节点/依赖状态 */
.rpt-sec-stats {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
  margin-left: 10px;
  vertical-align: middle;
}
.rpt-sec-stats .rpt-stat {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  font-size: var(--fs-xs);
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 2px;
  white-space: nowrap;
}
.rpt-sec-stats .rpt-stat-fig  { color: #4A90D9; border-color: rgba(74,144,217,0.32); background: rgba(74,144,217,0.06); }
.rpt-sec-stats .rpt-stat-node { color: #722ED1; border-color: rgba(114,46,209,0.32); background: rgba(114,46,209,0.06); }
.rpt-sec-stats .rpt-stat-warn { color: #D48806; border-color: rgba(212,136,6,0.4);  background: rgba(250,173,20,0.1); }

/* R5 §6.6 报告正文内联引用 [doc_NN] 可点 */
a.rpt-inline-cite, .rpt-bluf-judgment a {
  color: #4A90D9;
  text-decoration: none;
  border-bottom: 1px dashed rgba(74,144,217,0.5);
  cursor: pointer;
  padding: 0 1px;
  transition: background 120ms, color 120ms;
}
a.rpt-inline-cite:hover, .rpt-bluf-judgment a:hover {
  color: #2C6CB5;
  background: rgba(74,144,217,0.1);
  border-bottom-style: solid;
}

/* R5 §6.6 学术引用上标 [1][1-3][1,5] */
sup.rpt-cite {
  display: inline;
  vertical-align: super;
  font-size: 0.72em;
  line-height: 0;
  margin: 0 1px;
}
sup.rpt-cite a {
  color: #2C6CB5;
  text-decoration: none;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
sup.rpt-cite a:hover {
  color: #fff;
  background: #4A90D9;
}

/* R5 §6.6 章节底部引用 chip 区 */
.rpt-sec-cites .rsc-label {
  margin-right: 4px;
}
.rpt-cite-chip {
  font-weight: 600 !important;
  letter-spacing: 0.3px;
}
.rpt-cite-chip:hover {
  background: rgba(74,144,217,0.18) !important;
  border-color: #4A90D9 !important;
  color: #2C6CB5 !important;
}

/* R5 §6.6 参考文献行（编号 + 整行可点） */
.rpt-bib-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 120ms;
}
.rpt-bib-row:hover {
  background: rgba(74,144,217,0.08);
}
.rpt-bib-row:last-child {
  border-bottom: none;
}
.rpt-bib-row .rpt-bib-num {
  flex: 0 0 auto;
  font-weight: 700;
  color: #2C6CB5;
  font-size: var(--fs-sm);
  min-width: 32px;
}
.rpt-bib-row .rpt-bib-text {
  flex: 1 1 auto;
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

/* ============================ R4 研究树回放 ============================ */
/* 关键：必须给 .replay-panel / .rp-charts / .rp-chart 显式尺寸，
   否则 ECharts.init 在 width=0/height=0 容器上会渲染但不可见。
   R4 配色：与全局浅色主题一致（--bg/--surface/--border），
   主色 #4A90D9，避免与暗色语义地图（nebula-wrap）混淆。 */
.replay-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.replay-bar[hidden] { display: none !important; }
.replay-bar .btn-icon {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; transition: all 160ms;
}
.replay-bar .btn-icon:hover {
  background: rgba(74,144,217,0.1); color: #4A90D9;
  border-color: rgba(74,144,217,0.45);
}
.replay-bar .rp-seek {
  flex: 0 1 240px;
  accent-color: #4A90D9;
}
.replay-bar .rp-step {
  font-size: var(--fs-sm); color: var(--text-2);
  white-space: nowrap;
}
.replay-bar .rp-step b {
  color: #4A90D9; font-weight: 600;
}
.replay-bar .sel-sm {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 6px; font-size: var(--fs-sm);
  cursor: pointer;
}

.replay-panel {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: row;
  background: var(--bg);
  overflow: hidden;
}
.replay-panel[hidden] { display: none !important; }

.replay-panel .rp-narration {
  flex: 1 1 48%; min-width: 0;
  overflow-y: auto;
  padding: 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.replay-panel .rp-narration::-webkit-scrollbar { width: 8px; }
.replay-panel .rp-narration::-webkit-scrollbar-track {
  background: var(--surface-2); border-radius: 4px;
}
.replay-panel .rp-narration::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}

.replay-panel .rp-charts {
  flex: 1 1 52%; min-width: 0;
  display: flex; flex-direction: column;
  padding: 14px;
  overflow-y: auto;
  gap: 14px;
  background: var(--bg);
}
.replay-panel .rp-charts::-webkit-scrollbar { width: 8px; }
.replay-panel .rp-charts::-webkit-scrollbar-track {
  background: var(--surface-2); border-radius: 4px;
}
.replay-panel .rp-charts::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 4px;
}

.replay-panel .rp-chart {
  /* 必须有显式高度，ECharts 才会渲染可见像素 */
  flex: 0 0 auto;
  width: 100%;
  height: 260px;
  min-height: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.replay-panel .rp-chart::before {
  content: attr(data-caption);
  display: block;
  font-size: var(--fs-sm); color: var(--text-2);
  font-weight: 600;
  padding: 4px 6px 4px;
  margin-bottom: 2px;
  border-bottom: 1px dashed var(--border);
}

/* 步骤卡片：浅色 + 主蓝左边框 */
.rp-step-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #4A90D9;
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 10px;
  animation: rpFadeIn 420ms cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 200ms, box-shadow 200ms, border-color 200ms;
}
.rp-step-card:hover {
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(74,144,217,0.12);
  border-color: rgba(74,144,217,0.4);
}
.rp-step-card.rp-step-intro {
  border-left-color: var(--text-3);
  background: var(--surface-2);
  color: var(--text-2); font-style: italic;
  padding: 8px 14px;
}
.rp-step-card .rps-head {
  display: flex; gap: 10px; align-items: baseline;
  font-size: var(--fs-sm); color: var(--text-3);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.rp-step-card .rps-seq {
  font-weight: 700; color: #4A90D9;
  font-size: var(--fs);
}
.rp-step-card .rps-time {
  color: var(--text-3);
}
.rp-step-card .rps-reason {
  font-size: var(--fs-sm); color: var(--text-2);
  margin-bottom: 6px;
  line-height: 1.5;
}
.rp-step-card .badge-reason {
  display: inline-block;
  background: rgba(74,144,217,0.1);
  color: #2C6CB5;
  border: 1px solid rgba(74,144,217,0.32);
  padding: 2px 8px; border-radius: 3px;
  font-size: var(--fs-sm); font-weight: 600;
  margin-right: 6px;
}
.rp-step-card .rps-title {
  font-weight: 600; color: var(--text);
  margin-bottom: 8px;
  font-size: var(--fs);
  line-height: 1.4;
}
.rp-step-card .rps-stats {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: var(--fs-sm); color: var(--text-2);
  margin-bottom: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.rp-step-card .strength-mini {
  display: inline-flex;
  width: 80px; height: 6px;
  border-radius: 3px; overflow: hidden;
  background: var(--surface-2);
  vertical-align: middle;
}
.rp-step-card .strength-mini i { display: inline-block; height: 100%; }
.rp-step-card .strength-mini .sm-strong   { background: #52C41A; }
.rp-step-card .strength-mini .sm-moderate { background: #FAAD14; }
.rp-step-card .strength-mini .sm-weak     { background: #F5222D; }
.rp-step-card .rps-human {
  font-size: var(--fs-sm); color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
}
.rp-step-card .rps-coverage {
  font-size: var(--fs-sm); color: #52C41A;
  margin-top: 4px;
  font-weight: 600;
}
@keyframes rpFadeIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ctx-menu {
  position: fixed; z-index: 200; min-width: 156px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 6px 22px rgba(0,0,0,.15);
  padding: 4px 0; font-size: var(--fs);
}
.ctx-item { padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.ctx-item:hover:not(.disabled) { background: var(--accent-soft); color: var(--accent-dark); }
.ctx-item.disabled { color: var(--text-3); cursor: not-allowed; }
.ctx-item.danger:not(.disabled) { color: var(--danger); }
.ctx-item.danger:hover:not(.disabled) { background: var(--danger-soft); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

.node-list-item {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 6px 8px; border-radius: 4px; cursor: pointer;
  border-left: 3px solid transparent;
}
.node-list-item:hover { background: var(--surface-2); }
.node-list-item.selected { background: var(--accent-soft); border-left-color: var(--accent); }
.node-list-item .nli-title { font-size: var(--fs); font-weight: 500; }
.node-list-item .nli-meta { font-size: var(--fs-xs); color: var(--text-3); }

/* ============================ 右侧详情面板 ============================ */

.dp-header {
  padding: 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); position: sticky; top: -10px; z-index: 5;
  margin: -10px -10px 10px;
}
.dp-header h2 { margin: 0 0 6px; font-size: var(--fs-lg); line-height: 1.4; font-weight: 600; }
.dp-header .dp-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.dp-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ============================ R1 节点审计摘要 ============================ */
.r1-audit-card {
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #FAFBFC 0%, var(--surface) 100%);
}
.r1-title {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-3);
  letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.r1-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  font-size: var(--fs-sm); padding: 4px 0;
}
.r1-row + .r1-row { border-top: 1px dotted rgba(0,0,0,.04); }
.r1-label {
  flex: 0 0 80px; color: var(--text-3); font-size: var(--fs-xs);
}
.r1-line { font-weight: 600; color: var(--text-1); }
.r1-flag {
  font-size: var(--fs-xs); color: var(--text-3);
  padding: 1px 6px; background: var(--surface-2);
  border-radius: var(--radius);
}
.r1-flag-warn {
  color: #B7791F; background: #FFF8E1; border: 1px solid #FFE082;
}
.r1-note {
  flex-basis: 100%; margin-top: 4px; padding: 6px 10px;
  font-style: italic; color: var(--text-2);
  background: var(--surface-2); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.r1-usage-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; cursor: pointer;
  background: var(--accent); color: #fff;
  border: none; border-radius: 12px;
  font-size: var(--fs-xs); font-family: inherit;
  transition: background .15s;
}
.r1-usage-chip:hover { background: var(--accent-strong, #1F4E9C); }
.r1-usage-count { opacity: .8; }

/* R1 §3 报告跳转：目标章节闪一下背景 */
@keyframes r1-jump-flash {
  0%   { background-color: rgba(255, 215, 0, 0); }
  20%  { background-color: rgba(255, 215, 0, 0.32); }
  100% { background-color: rgba(255, 215, 0, 0); }
}
.r1-jump-flash {
  animation: r1-jump-flash 1.8s ease;
  border-radius: var(--radius-lg);
}
@media (prefers-reduced-motion: reduce) {
  .r1-jump-flash { animation: none; background-color: rgba(255, 215, 0, 0.18); }
}

/* R1 §2.2 历史节点理由补录对话框 */
.r1-reason-modal { max-width: 480px; }
.r1-reason-tip {
  font-size: var(--fs-xs); color: var(--text-3);
  padding: 8px 10px; margin-bottom: 12px;
  background: #FFF8E1; border: 1px solid #FFE082;
  border-radius: var(--radius);
}
.r1-reason-select {
  width: 100%; padding: 8px 10px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: var(--fs-sm);
}
.r1-reason-note {
  width: 100%; padding: 8px 10px; resize: vertical;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: var(--fs-sm); line-height: 1.5;
}
.r1-reason-counter {
  text-align: right; font-size: var(--fs-xs); color: var(--text-3);
  margin-top: 4px;
}
.r1-reason-err {
  margin-top: 8px; padding: 6px 10px; font-size: var(--fs-xs);
  color: #C0392B; background: rgba(192,57,43,.08);
  border-radius: var(--radius);
}

/* ============================ R2 §3 R2.3 原文核对对话框 ============================ */
.r2-verify-modal { max-width: 560px; }
.r2-verify-body { padding: 0 4px; }
.r2-verify-quote {
  margin: 10px 0; padding: 10px 14px;
  background: var(--surface-2); border-left: 3px solid var(--accent);
  font-style: italic; color: var(--text-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  max-height: 200px; overflow-y: auto;
}
.r2-verify-label {
  margin-top: 12px; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-1);
}
.r2-verify-radios {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 6px;
}
.r2-verify-radio {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: var(--fs-sm);
  transition: background .12s, border-color .12s;
}
.r2-verify-radio:hover { background: var(--surface-2); }
.r2-verify-radio input[type=radio] {
  accent-color: var(--accent); transform: scale(1.15);
}
.r2-verify-note {
  width: 100%; margin-top: 6px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: var(--fs-sm); line-height: 1.5;
  resize: vertical;
}
.r2-verify-err {
  margin-top: 8px; padding: 6px 10px; font-size: var(--fs-xs);
  color: #C0392B; background: rgba(192,57,43,.08);
  border-radius: var(--radius);
}

.prose { font-size: var(--fs); line-height: 1.75; color: var(--text); }
.prose p { margin: 0 0 8px; }
.prose ul, .prose ol { margin: 0 0 8px; padding-left: 20px; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 12px 0 6px; font-size: var(--fs-md); font-weight: 600; }
.prose code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; font-family: var(--mono); font-size: 12px; }
.prose pre { background: var(--surface-2); padding: 8px; border-radius: 4px; overflow-x: auto; }
.prose blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.prose th, .prose td { border: 1px solid var(--border); padding: 4px 7px; }

.text-block { font-size: var(--fs); line-height: 1.75; white-space: pre-wrap; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }

/* 发现列表 */
.finding-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; overflow: hidden; background: var(--surface);
}
.finding-item.confirmed { border-left: 3px solid var(--ok); }
.finding-item.rejected  { border-left: 3px solid var(--danger); opacity: .72; }
.finding-item.needs_revision { border-left: 3px solid var(--warn); }
.finding-item.unreviewed { border-left: 3px solid var(--border-strong); }
.finding-head { padding: 8px 10px; cursor: pointer; display: flex; gap: 8px; align-items: flex-start; }
.finding-head:hover { background: var(--surface-2); }
.finding-head .fh-caret { color: var(--text-3); flex: 0 0 12px; transition: transform .15s; user-select: none; }
.finding-item.open .fh-caret { transform: rotate(90deg); }
.finding-head .fh-main { flex: 1; min-width: 0; }
.finding-head .fh-title { font-weight: 600; font-size: var(--fs); }
.finding-head .fh-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.finding-body { padding: 0 10px 10px; border-top: 1px solid var(--border); display: none; }
.finding-item.open .finding-body { display: block; }
.conf-bar { width: 54px; height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; display: inline-block; vertical-align: middle; }
.conf-fill { height: 100%; background: var(--accent); }

.evidence-item {
  border: 1px solid var(--border); border-left: 3px solid var(--border-strong);
  border-radius: 4px; padding: 7px 9px; margin-bottom: 6px;
  background: var(--surface-2); font-size: var(--fs-sm); cursor: pointer;
}
.evidence-item:hover { border-left-color: var(--accent); background: var(--accent-soft); }
.evidence-item.weak { border-left-color: var(--warn); }
.evidence-item.not_found { border-left-color: var(--danger); }
.evidence-item .ei-quote {
  font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.evidence-item .ei-meta { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  font-size: var(--fs-xs); color: var(--text-3); }

.suggest-item {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 8px 10px; margin-bottom: 6px; background: #FCFDFE;
}
.suggest-item .sg-q { font-weight: 600; font-size: var(--fs); }
.suggest-item .sg-r { font-size: var(--fs-sm); color: var(--text-2); margin: 3px 0 6px; }

/* 方向归纳渲染器 */
.direction-card {
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 10px; margin-bottom: 8px; background: var(--surface);
}
.direction-card .dc-head { display: flex; align-items: center; gap: 8px; }
.direction-card .dc-name { font-weight: 600; font-size: var(--fs-md); flex: 1; }
.direction-card .dc-desc { font-size: var(--fs); color: var(--text-2); margin: 5px 0; line-height: 1.65; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.theme-tag {
  border: 1px solid #C5DDF5; background: var(--accent-soft); color: var(--accent-dark);
  border-radius: 12px; padding: 3px 10px; font-size: var(--fs-sm); cursor: pointer;
}
.theme-tag:hover { background: #DCEBFA; }
.outlier-box {
  background: var(--warn-soft); border: 1px solid #F6D6B8;
  border-radius: var(--radius); padding: 9px 11px; font-size: var(--fs);
}
.outlier-row { padding: 3px 0; }
.outlier-row + .outlier-row { border-top: 1px dashed #F0CFAC; }

/* 自由提问渲染器 */
.direct-answer {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px; font-size: var(--fs-lg); line-height: 1.7; font-weight: 500;
  color: #1F4E79;
}
.conf-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.conf-row .cr-label { flex: 0 0 auto; font-size: var(--fs-sm); color: var(--text-3); }
.conf-row .cr-bar { flex: 1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.conf-row .cr-fill { height: 100%; border-radius: 4px; transition: width .4s; }
.conf-row .cr-val { flex: 0 0 auto; font-weight: 600; font-size: var(--fs); }

/* ============================ 证据面板 ============================ */

#evidence-panel {
  flex: 0 0 auto; height: 0; overflow: hidden;
  background: var(--surface); border-top: 1px solid var(--border);
  transition: height .22s ease;
  display: flex; flex-direction: column;
}
#evidence-panel.open { height: var(--evidence-h); }

.ev-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 7px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ev-meta { font-size: var(--fs-sm); color: var(--text-2); min-width: 0;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ev-meta .em-title { font-weight: 600; color: var(--text); max-width: 420px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.ev-warn {
  flex: 0 0 auto; background: #FFF8E1; border-bottom: 1px solid #F3E0A8;
  color: #8A6100; padding: 6px 14px; font-size: var(--fs-sm);
}
.ev-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }

.ev-chunk { margin-bottom: 16px; }
.ev-chunk-head {
  font-size: var(--fs-xs); color: var(--text-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
  padding-bottom: 3px; border-bottom: 1px dashed var(--border);
}
.ev-chunk-body { font-size: var(--fs); line-height: 1.8; }
.ev-chunk.target { background: #FFFDF5; border-radius: var(--radius); padding: 10px 12px;
  border: 1px solid #F3E0A8; }
mark.ev-hl { background: #FFE58F; padding: 1px 0; border-radius: 2px; box-shadow: 0 0 0 2px #FFE58F; }

/* ============================ 报告视图 ============================ */

.rpt-wrap { height: 100%; display: flex; }
.rpt-side { width: 250px; flex: 0 0 250px; border-right: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; }
.rpt-side .panel-body { padding: 10px; }
.rpt-main { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 24px 32px; }
.rpt-doc { max-width: 780px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 34px 40px; }
.rpt-doc h1 { font-size: 22px; text-align: center; margin: 0 0 20px; }
.rpt-doc h2 { font-size: var(--fs-lg); margin: 22px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border); }
.rpt-doc .rpt-abstract { background: var(--surface-2); border-radius: var(--radius);
  padding: 12px 16px; font-size: var(--fs); line-height: 1.85; }
.rpt-item {
  padding: 7px 9px; border-radius: 4px; cursor: pointer; border: 1px solid transparent;
}
.rpt-item:hover { background: var(--surface-2); }
.rpt-item.selected { background: var(--accent-soft); border-color: #C5DDF5; }
.rpt-bib { font-size: var(--fs-sm); line-height: 1.8; color: var(--text-2); }
.rpt-bib li { margin-bottom: 4px; }

/* ============================ 模态框 ============================ */

.modal-mask {
  position: fixed; inset: 0; background: rgba(20,25,30,.36);
  z-index: 300; display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  width: 560px; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column;
}
.modal.wide { width: 820px; }
.modal-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: var(--fs-md);
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; }

.form-row { margin-bottom: 12px; }
.form-row > label { display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-2); margin-bottom: 4px; }
/* 控件既可以放在 .form-row 容器里，也可以自己带 .form-row 类 */
.form-row input[type=text], .form-row input[type=number],
.form-row input[type=search], .form-row textarea, .form-row select,
input.form-row, textarea.form-row, select.form-row {
  width: 100%; padding: 6px 9px; font-size: var(--fs);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; outline: none; background: var(--surface);
}
.form-row textarea, textarea.form-row { resize: vertical; min-height: 66px; line-height: 1.6; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus,
input.form-row:focus, textarea.form-row:focus { border-color: var(--accent); }
.form-hint { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; }
.form-error { font-size: var(--fs-sm); color: var(--danger); margin-top: 4px; }

/* scope 切换器：概览页和语义地图共用。
   之前只有 body.screen-mode 下有样式，普通模式按钮是裸的——视觉异常。 */
.scope-tabs { display: inline-flex; gap: 0; padding: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); }
.scope-tab { background: transparent; color: var(--text-2);
  border: 1px solid transparent; padding: 4px 12px;
  border-radius: calc(var(--radius) - 1px); font-size: var(--fs-xs);
  cursor: pointer; transition: background .15s, color .15s;
  font-family: inherit; }
.scope-tab:hover { color: var(--accent); }
.scope-tab.active { background: var(--accent); color: #fff;
  border-color: var(--accent); }
/* 工具栏分组分隔符 */
.nebula-bar-sep { width: 1px; align-self: stretch; margin: 4px 4px;
  background: rgba(255,255,255,0.08); }

.tpl-option {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 11px; margin-bottom: 6px; cursor: pointer;
}
.tpl-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tpl-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.tpl-option .to-name { font-weight: 600; font-size: var(--fs-md); }
.tpl-option .to-desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.tpl-option .to-meta { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; }

.pick-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px; }
.pick-row { display: flex; gap: 7px; align-items: flex-start; padding: 4px 5px; border-radius: 4px; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { margin-top: 3px; }
.pick-row .pr-title { font-size: var(--fs); line-height: 1.45; }
.pick-row .pr-meta { font-size: var(--fs-xs); color: var(--text-3); }

/* ============================ Toast ============================ */

.toast-stack {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
  max-width: 90vw;
}
.toast {
  background: #24292F; color: #fff; padding: 8px 12px 8px 16px;
  border-radius: 18px; font-size: var(--fs); box-shadow: 0 4px 14px rgba(0,0,0,.2);
  animation: toast-in .2s ease;
  pointer-events: auto;
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
  display: flex; align-items: center; gap: 10px;
  max-width: 80vw;
}
.toast-text {
  white-space: pre-wrap; word-break: break-word;
}
.toast-close {
  background: transparent; border: 0; color: #fff;
  font-size: 18px; cursor: pointer; padding: 0 4px;
  opacity: .65; line-height: 1; user-select: none;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }
.toast.ok     { background: #1E8449; }
.toast.warn   { background: #B9600F; }
.toast.error  { background: #B33A2C; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============================ 表单样式 ============================ */

.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block; font-weight: 600; font-size: var(--fs);
  margin-bottom: 6px; color: var(--text);
}
.form-group input, .form-group select {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: var(--fs); background: var(--surface-2);
  outline: none; transition: all .2s;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--accent); background: #fff;
}
.form-group small {
  display: block; margin-top: 4px;
  font-size: var(--fs-xs); color: var(--text-3);
}

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: var(--fs-sm); margin-top: 12px;
  border: 1px solid;
}
.alert-info {
  background: #EBF5FB; color: #1F618D; border-color: #AED6F1;
}
.alert-success {
  background: #E8F8F5; color: #117864; border-color: #A3E4D7;
}
.alert-error {
  background: #FDEDEC; color: #A93226; border-color: #F5B7B1;
}

/* ============================ 库缺失降级提示 ============================ */

.lib-missing {
  display: flex; align-items: center; justify-content: center; height: 100%;
  padding: 30px; text-align: center; color: var(--text-2); font-size: var(--fs);
  line-height: 1.9;
}
.lib-missing code { background: var(--surface-2); padding: 1px 5px; border-radius: 3px;
  font-family: var(--mono); }

/* ============================ 配置对话框 ============================ */

.form-group {
  margin-bottom: 16px;
}
.config-section-title {
  font-weight: 700; font-size: var(--fs-md);
  margin: 20px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 11px;
  font-size: var(--fs);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-group small {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.form-actions .btn {
  flex: 1;
}

#config-status {
  margin-top: 16px;
}
#config-status .alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* ============================ 管线视图 ============================ */

.pipeline-view { padding: 24px 28px; overflow-y: auto; height: 100%; }

.pipeline-header h2 { font-size: 22px; margin: 0 0 4px; }
.pipeline-subtitle { color: var(--text-2); font-size: var(--fs); margin: 0 0 20px; }

.pipeline-corpus { margin-bottom: 24px; }
.corpus-stats { display: flex; gap: 16px; }
.corpus-stats .stat-item {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 24px; min-width: 100px;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-num.ok { color: var(--ok); }
.stat-num.warn { color: var(--warn); }
.stat-num.err { color: var(--danger); }
.stat-label { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

.pipeline-stages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.stage-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.stage-card.running { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stage-card.done { opacity: .75; }
.stage-card.failed { border-color: var(--danger); }

.stage-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-sm); flex-shrink: 0;
}
.stage-card.done .stage-icon { background: var(--ok-soft); color: var(--ok); }
.stage-card.running .stage-icon { background: var(--accent-soft); color: var(--accent); }
.stage-card.failed .stage-icon { background: var(--danger-soft); color: var(--danger); }

.stage-info { flex: 1; }
.stage-name { font-weight: 600; font-size: var(--fs-md); }
.stage-desc { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.stage-cost { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 3px; margin-top: 4px; }
.cost-free { background: var(--ok-soft); color: var(--ok); }
.cost-llm { background: var(--warn-soft); color: var(--warn); }

/* 实时操作文本 */
.stage-action {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 8px;
  background: var(--accent-soft); border-radius: 3px;
  max-width: 280px;
}
.action-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}
.action-text {
  font-size: var(--fs-xs); color: var(--accent-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--mono);
}
.ctrl-live {
  display: flex; align-items: center; gap: 8px;
  flex: 1; overflow: hidden;
}
.ctrl-action {
  font-size: var(--fs-sm); color: var(--text);
  font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.stage-status { min-width: 120px; text-align: right; }
.status-text { font-size: var(--fs-sm); }
.status-text.running { color: var(--accent); font-weight: 600; }
.status-text.done { color: var(--ok); }
.status-text.failed { color: var(--danger); }
.status-text.skipped { color: var(--text-3); }
.status-text.idle { color: var(--text-3); }

.stage-actions { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.force-toggle { font-size: var(--fs-xs); color: var(--text-3); cursor: pointer; display: flex; align-items: center; gap: 4px; }
.force-toggle input { margin: 0; }
.btn-sm { padding: 4px 12px; font-size: var(--fs-xs); }
.control-right { display: flex; align-items: center; gap: 12px; }

.pipeline-controls { margin-bottom: 16px; }
/* R7c：pipeline 视图快照块与图表容器必须显式高度，
   否则 ECharts 在 0×0 容器中 init 后 getDataURL 返回空 dataURL，
   上传后图片解码失败、报告页图挂。 */
.pipe-snapshots {
  display: flex; flex-direction: column; gap: 16px;
  margin: 20px 0;
}
.pipe-snap-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px;
}
.snap-chart {
  width: 100%; height: 320px;
}
.snap-chart-lg {
  height: 380px;
}
.snap-foot {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-2);
}
.control-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 18px;
}
.control-bar.running { border-color: var(--accent); background: var(--accent-soft); }
.ctrl-status { font-size: var(--fs); color: var(--text-2); }
.ctrl-status.idle { color: var(--text-3); }

.btn-danger {
  background: var(--danger); color: #fff; border: none;
  padding: 8px 18px; border-radius: var(--radius); cursor: pointer;
  font-size: var(--fs); font-weight: 600;
}
.btn-danger:hover { background: var(--danger); opacity: .9; }

/* 任务历史 */
.pipe-history { padding: 6px; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
}
.history-item.completed { border-left: 3px solid var(--ok); }
.history-item.failed { border-left: 3px solid var(--danger); }
.history-item.running { border-left: 3px solid var(--accent); }
.history-item.cancelled { border-left: 3px solid var(--text-3); }
.hist-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.hist-status { font-size: var(--fs-xs); font-weight: 600; }
.hist-completed { color: var(--ok); }
.hist-failed { color: var(--danger); }
.hist-cancelled { color: var(--text-3); }
.hist-running { color: var(--accent); }
.hist-queued { color: var(--accent); }
.hist-time { font-size: var(--fs-xs); color: var(--text-3); }
.hist-steps { font-size: var(--fs-xs); color: var(--text-2); }
.hist-error {
  font-size: 10px; color: var(--danger); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================ 响应式 ============================ */

@media (max-width: 1280px) {
  :root { --right-w: 340px; --left-w: 250px; }
  .hdr-search input { width: 180px; }
}
@media (max-width: 1024px) {
  .hdr-title { display: none; }
  .hdr-search input { width: 130px; }
}

/* ============================ 星云地图 ============================ */

.nebula-wrap {
  height: 100%; min-height: 0; display: flex; flex-direction: column;
  background: #050810;
}
.nebula-toolbar {
  display: flex; gap: 6px; padding: 8px 12px; align-items: center; flex-wrap: wrap;
  background: rgba(10,14,26,0.8); border-bottom: 1px solid rgba(74,144,217,0.15);
  min-height: 44px;
}
.nebula-toolbar .btn { background: rgba(255,255,255,0.05); color: #b0bccc; border: 1px solid rgba(255,255,255,0.1); }
.nebula-toolbar .btn:hover { background: rgba(74,144,217,0.2); color: #fff; }
.nebula-toolbar .btn-primary { background: rgba(74,144,217,0.3); color: #fff; border-color: rgba(74,144,217,0.5); }
/* 着色维度下拉：暗底高对比，避免浏览器默认白底方块被误以为没渲染 */
.nebula-color-group {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(74,144,217,0.18);
  border: 1px solid rgba(74,144,217,0.45);
}
.nebula-color-label {
  font-size: var(--fs-sm); color: #d6deeb; font-weight: 600;
  user-select: none; white-space: nowrap;
}
.nebula-color-dim {
  background: #0f1422; color: #e6ebf5;
  border: 1px solid rgba(74,144,217,0.55);
  border-radius: 3px;
  padding: 3px 6px; font-size: var(--fs-sm);
  cursor: pointer; outline: none;
  min-width: 90px;
}
.nebula-color-dim:hover { border-color: rgba(74,144,217,0.85); }
.nebula-color-dim:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,0.25); }
.nebula-search-input {
  background: #0f1422; color: #e6ebf5;
  border: 1px solid rgba(74,144,217,0.35);
  border-radius: 3px;
  padding: 4px 8px; font-size: var(--fs-sm);
  width: 180px; outline: none;
}
.nebula-search-input::placeholder { color: #6c7a93; }
.nebula-search-input:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,0.25); }
/* 覆盖率横幅：在画布上方提示未覆盖簇数量 */
.nebula-coverage-banner {
  padding: 8px 12px;
  background: rgba(217,119,87,0.15);
  border-bottom: 1px solid rgba(217,119,87,0.55);
  color: #f0c4a8; font-size: var(--fs-sm);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.nebula-coverage-banner[hidden] { display: none !important; }
.nebula-coverage-banner .cb-title { font-weight: 600; color: #ffd0b8; }
.nebula-coverage-banner .cb-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; background: rgba(217,119,87,0.25);
  border-radius: 3px; color: #fff;
}
.nebula-coverage-banner .cb-item button {
  background: transparent; border: 0; color: #ffd0b8;
  cursor: pointer; text-decoration: underline; padding: 0; font: inherit;
}
.nebula-coverage-banner .cb-item button:hover { color: #fff; }
.nebula-canvas {
  flex: 1 1 auto; min-height: 0; width: 100%; display: block; cursor: grab;
  background: #050810;
}
.nebula-selbar {
  padding: 6px 12px; background: rgba(10,14,26,0.8);
  border-top: 1px solid rgba(74,144,217,0.15);
  display: flex; align-items: center; gap: 10px;
}
.nebula-selbar .sb-count { color: #b0bccc; font-size: var(--fs-sm); }
.nebula-selbar .sb-actions { margin-left: auto; display: flex; gap: 6px; }

.nebula-legend {
  flex: 0 0 auto; max-height: 180px; overflow-y: auto;
  padding: 8px 12px;
  background: rgba(10,14,26,0.8);
  border-top: 1px solid rgba(74,144,217,0.15);
}
.nebula-legend .legend-title {
  font-size: var(--fs-sm); color: #8892b0; margin-bottom: 6px; font-weight: 600;
}
.nebula-legend .legend-items {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
}
.nebula-legend .legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: var(--fs-xs); color: #8892b0;
}
.nebula-legend .legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.nebula-legend .legend-label { cursor: pointer; }
.nebula-legend .legend-label:hover { color: #fff; }

/* 星云图筛选面板：明确限定在浅色左侧栏，避免深色地图样式泄漏。 */
#left-panel .filter-section { margin-bottom: 12px; color: #24292f; }
#left-panel .filter-title { font-size: var(--fs-sm); font-weight: 600; color: #24292f !important; margin-bottom: 6px; }
#left-panel .filter-list { max-height: 300px; overflow-y: auto; }
#left-panel .semantic-filter-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; }
#left-panel .semantic-filter-panel .filter-topic-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#left-panel .semantic-filter-panel .filter-list { flex: 1 1 auto; min-height: 0; max-height: none; }
#left-panel .semantic-filter-panel .filter-actions { flex: 0 0 auto; margin: 0; padding-top: 10px; border-top: 1px solid var(--border); }
#left-panel .filter-row { display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; font-size: var(--fs-xs); color: #57606a !important; }
#left-panel .filter-row:hover { background: var(--surface-2); }
#left-panel .filter-row input[type="checkbox"] { width: 14px; min-width: 14px; height: 14px; margin: 0; padding: 0; flex: 0 0 14px; accent-color: var(--accent); }
#left-panel .filter-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
#left-panel .filter-label-text { color: #57606a !important; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#left-panel .filter-more { font-size: var(--fs-xs); color: #8b949e !important; padding: 4px 2px; }
.filter-row-inline { display: flex; align-items: center; gap: 6px; }
.filter-input { width: 60px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 3px; font-size: var(--fs-xs); color: var(--text); }

/* 概览主题规模：紧凑的可点击排行，名称、比例和篇数同时可见。 */
.topic-scale-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; padding: 3px 1px; }
.topic-scale-row { width: 100%; min-width: 0; border: 0; background: transparent; display: flex; align-items: center; gap: 7px; padding: 4px 3px; text-align: left; color: var(--text); cursor: pointer; border-radius: 4px; }
.topic-scale-row:hover, .topic-scale-row:focus-visible { background: var(--surface-2); outline: none; }
.topic-scale-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.topic-scale-name { flex: 0 1 46%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.topic-scale-bar { flex: 1 1 auto; min-width: 42px; height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.topic-scale-fill { display: block; height: 100%; border-radius: inherit; }
.topic-scale-count { flex: 0 0 36px; text-align: right; color: var(--text-2); font-size: var(--fs-xs); }

/* ============================ E1: 报告目录 sticky 与阅读进度 ============================ */

/* sticky 行为与现有 width/flex 共存；align-self 让 flex 子项不被拉伸。 */
.rpt-wrap { display: flex; align-items: stretch; }
.rpt-side { position: sticky; top: var(--header-h, 56px); align-self: flex-start;
  max-height: calc(100vh - var(--header-h, 56px)); overflow: auto; }

/* 目录项当前章节高亮 */
.rpt-toc-list { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; }
.rpt-toc-item { padding: 5px 10px; border-left: 3px solid transparent;
  cursor: pointer; font-size: var(--fs-sm); color: var(--text-2);
  border-radius: 0 4px 4px 0; transition: background .1s, color .1s; }
.rpt-toc-item:hover { background: var(--surface-2); color: var(--text); }
.rpt-toc-item.active { background: #EAF3FC; border-left-color: var(--accent);
  font-weight: 600; color: var(--text); }

/* 顶部固定阅读进度条：贴在主滚动容器顶端，z-index 低于 modal 但高于内容。 */
.rpt-progress { position: sticky; top: 0; left: 0; height: 2px;
  background: var(--accent); z-index: 40; transition: width .12s ease-out;
  width: 0; pointer-events: none; }
/* 兜底：当 .rpt-progress 走 fixed 时（页面级滚动）也可见 */
.rpt-progress.is-fixed { position: fixed; top: var(--header-h, 56px); z-index: 60; }

/* ============================ E2: 报告图表内嵌 ============================ */

.rpt-figure { margin: 16px 0; text-align: center; }
.rpt-figure img { max-width: 100%; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); }
.rpt-figure figcaption { margin-top: 6px; font-size: var(--fs-sm); }
.rpt-figure figcaption { margin-top: 6px; font-size: 12px; color: var(--text-2); }
p.fig-missing { background: #FFF7E6; border-left: 3px solid #F3D398;
  padding: 6px 10px; color: #9A6206; font-size: var(--fs-sm); }

.rpt-missing-bar { background: #FFF7E6; border: 1px solid #F3D398;
  border-radius: var(--radius); padding: 8px 14px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px; color: #6A4506; font-size: var(--fs-sm); }
.rpt-missing-bar b { color: #9A6206; }

/* ============================ E4: BLUF 与性质标注 ============================ */

.badge-conf-high { background: #E8F6EE; color: #1E7E45; border: 1px solid #A8DCC0; }
.badge-conf-mid  { background: #FEF6E7; color: #9A6206; border: 1px solid #F3D398; }
.badge-conf-low  { background: #F4F6F8; color: #57606A; border: 1px solid #D7DDE4; }

.nature { font-size: 11px; padding: 1px 6px; border-radius: 9px;
  margin-left: 4px; display: inline-block; line-height: 1.6;
  font-weight: 500; vertical-align: baseline; }
.nature-fact   { background: #EAF3FC; color: #1B5A9E; }
.nature-infer  { background: #FDF2E9; color: #9A5B10; }
.nature-assess { background: #F5EEF8; color: #6C3483; }

/* BLUF 判断卡片：左侧色条按置信度。 */
.rpt-bluf-judgment { border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin: 10px 0; background: var(--surface); }
.rpt-bluf-judgment.conf-high { border-left: 4px solid #1E7E45; }
.rpt-bluf-judgment.conf-mid  { border-left: 4px solid #9A6206; }
.rpt-bluf-judgment.conf-low  { border-left: 4px solid #8b949e; }
.rpt-bluf-judgment .bj-head { display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px; flex-wrap: wrap; }
.rpt-bluf-judgment .bj-title { font-weight: 600; font-size: var(--fs); }
.rpt-bluf-judgment .bj-body { font-size: var(--fs-sm); color: var(--text-2);
  line-height: 1.75; }
.rpt-bluf-judgment .bj-trace { font-size: var(--fs-xs); color: var(--text-2);
  margin-top: 4px; }
.rpt-bluf-judgment .bj-trace a { color: var(--accent); cursor: pointer;
  text-decoration: none; }

/* ============================ E3: 研究树 → 报告 反向锚定 ============================ */

.dp-used-in { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--radius);
  background: var(--surface-2); font-size: var(--fs-sm); color: var(--text-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dp-used-in .dp-label { color: var(--text-2); margin-right: 4px; }
.dp-used-in a { color: var(--accent); cursor: pointer; text-decoration: none; }
.dp-used-in a:hover { text-decoration: underline; }

/* 单章重生成按钮：紧贴章节标题右侧，弱化样式不抢眼。 */
.section-title .rpt-sec-regen { margin-left: auto; }
.rpt-item-head { display: flex; align-items: center; gap: 8px; }
.rpt-item-head .rpt-heading { flex: 1 1 auto; min-width: 0; }
.rpt-item-head .rpt-sec-tools { flex: 0 0 auto; display: flex; gap: 6px; }

/* ============================ maturity_scan 渲染器（01 文档 5.5） ============================ */

.ms-profile { background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin: 6px 0 14px; }

.ms-bars { display: flex; align-items: flex-end; gap: 18px;
  height: 130px; padding: 6px 4px 0; }
.ms-cell { flex: 1 1 0; display: flex; flex-direction: column;
  align-items: center; gap: 4px; height: 100%; min-width: 0; }
.ms-bar-track { flex: 1 1 auto; width: 38px; max-width: 60px;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border); border-bottom: none; overflow: hidden; }
.ms-bar-fill { width: 100%; min-height: 2px; background: var(--muted);
  transition: height .25s ease; border-radius: var(--radius) var(--radius) 0 0; }
.ms-bar-fill.is-cog { background: var(--accent);
  box-shadow: 0 0 0 1px rgba(74,144,217,.35) inset; }
.ms-bar-num { font-size: var(--fs-sm); font-weight: 600; color: var(--text-1); }
.ms-bar-lab { font-size: var(--fs-xs); color: var(--text-2);
  letter-spacing: .04em; }
.ms-meta { display: flex; align-items: center; gap: 10px;
  margin-top: 8px; flex-wrap: wrap; }

.ms-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin: 8px 0; }
.ms-frontier { border-left: 3px solid var(--accent); }
.ms-mil { border-left: 3px solid var(--warn); }
.ms-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 4px; }
.ms-title { font-weight: 600; color: var(--text-1); cursor: pointer;
  text-decoration: none; flex: 1 1 auto; min-width: 0; }
.ms-title:hover { color: var(--accent); text-decoration: underline; }
.ms-cap { font-weight: 600; color: var(--text-1); flex: 1 1 auto; min-width: 0; }
.ms-body { font-size: var(--fs-sm); color: var(--text-2); line-height: 1.7;
  margin: 2px 0 4px; }
.ms-quote { color: var(--text-2); font-style: italic; margin-top: 4px;
  border-left: 2px solid var(--border); padding-left: 8px; }
.ms-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ms-links .chip { display: inline-block; padding: 2px 8px; font-size: var(--fs-xs);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--accent); cursor: pointer;
  text-decoration: none; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.ms-links .chip:hover { background: var(--accent); color: #fff; }

.ms-anomaly { background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--warn); border-radius: var(--radius);
  padding: 10px 12px; margin: 6px 0; }
.ms-anomaly-obs { font-size: var(--fs-sm); color: var(--text-1);
  line-height: 1.7; }
.ms-anomaly-interp { font-size: var(--fs-sm); color: var(--text-2);
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border);
  display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; }
.ms-anomaly-interp .nature { flex: 0 0 auto; }

/* ============================ 演示导览（03 文档 G 节） ============================ */

/* 演示导览：遮罩 + 中央卡片。原先卡片在右下角，叙述稍长就被底部 toast 遮挡、
   且「出现在底部」视觉上像被截断，看起来渲染异常。改为屏幕右侧居中浮窗，
   与模态框观感一致，加 max-height + 滚动防止溢出。
   注意 backdrop-filter 在某些浏览器版本下会让整个元素不渲染，
   这里直接用纯 rgba 半透明黑底，不依赖 backdrop-filter。 */
.tour-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: block;
  background: rgba(10,14,24,.6);
  z-index: 80; pointer-events: none; }

/* 高亮目标：z-index 提到遮罩之上，外发光提示 */
.tour-spot { position: relative; z-index: 81;
  box-shadow: 0 0 0 3px var(--accent), 0 0 26px rgba(74,144,217,.55);
  border-radius: var(--radius-lg);
  transition: box-shadow .25s ease; }

/* 导览卡片：屏幕右侧居中浮窗，不挡被高亮的目标元素，
   也不像原先那样停在底部边缘看起来「渲染异常」。
   注意：移除了 @media (max-width: 720px) 的小屏贴底 fallback，
   它在某些桌面浏览器窗口宽度下被误触发，导致卡片占满底部全宽。 */
.tour-card { position: fixed; top: 50%; right: 24px;
  transform: translateY(-50%);
  width: 420px; max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px); overflow-y: auto;
  z-index: 82;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0,0,0,.32);
  padding: 18px 20px; pointer-events: auto;
  animation: tour-pop .22s ease; }
@keyframes tour-pop {
  from { opacity: 0; transform: translate(0, -46%); }
  to   { opacity: 1; transform: translate(0, -50%); }
}
@media (prefers-reduced-motion: reduce) {
  .tour-card { animation: none; }
}
.tour-card .tc-step { font-size: var(--fs-xs); color: var(--text-2);
  letter-spacing: .03em; margin-bottom: 6px; }
.tour-card .tc-step b { color: var(--accent); font-weight: 600; }
.tour-card .tc-title { margin: 0 0 8px; font-size: var(--fs-md);
  font-weight: 600; color: var(--text-1); line-height: 1.4; }
.tour-card .tc-narration { margin: 0 0 12px; font-size: var(--fs-sm);
  color: var(--text-2); line-height: 1.8; }
.tour-card .tc-actions { display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 10px; }
.tour-card .tc-actions button { min-width: 64px; }
.tour-card .tc-actions button:disabled { opacity: .45; cursor: not-allowed; }
.tour-card .tc-progress { height: 3px; background: var(--surface-2);
  border-radius: 2px; overflow: hidden; }
.tour-card .tc-progress i { display: block; height: 100%; width: 0;
  background: var(--accent); transition: width .35s ease; }

/* 头部「演示导览」按钮：弱化样式不抢眼 */
.tour-launch-btn { background: transparent; color: var(--text-2);
  border: 1px solid var(--border); padding: 4px 10px;
  border-radius: var(--radius); font-size: var(--fs-xs); cursor: pointer; }
.tour-launch-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ============================ 大屏模式（概览全屏） ============================ */
body.screen-mode { background: #0E141B; }
body.screen-mode #app-header { display: none; }
body.screen-mode #app-main { background: #0E141B; }
body.screen-mode #left-panel,
body.screen-mode #right-panel { display: none; }
body.screen-mode .ov-wrap { padding: 24px; }
body.screen-mode .ov-stats { gap: 16px; }
body.screen-mode .stat-card {
  background: #161D29; border-color: #232C3D; color: #E6EDF5;
}
body.screen-mode .stat-card .sc-label,
body.screen-mode .stat-card .sc-sub { color: #8B97AC; }
body.screen-mode .chart-card {
  background: #161D29; border-color: #232C3D; color: #E6EDF5;
}
body.screen-mode .chart-card > h3 { color: #E6EDF5; }
body.screen-mode .ov-charts {
  grid-template-columns: repeat(auto-fit, minmax(560px, 1fr));
  gap: 16px;
}
body.screen-mode .chart-box { height: 420px; }
body.screen-mode .chart-box.tall { height: 500px; }
body.screen-mode .ov-toolbar { margin-bottom: 16px; }
body.screen-mode .scope-tab { background: #1A2333; color: #C7D2E0; border-color: #2A3548; }
body.screen-mode .scope-tab.active { background: var(--accent); color: #fff; }
body.screen-mode .ov-focus-card { background: #161D29; border-color: var(--accent); }
body.screen-mode .ov-focus-card .card-title { color: #E6EDF5; }
body.screen-mode #ov-focus-chart-box { height: 620px; }
body.screen-mode .card-icon-btn { color: #9CA9C0; }
body.screen-mode .card-icon-btn:hover { background: #232C3D; color: #fff; }


/* 退出登录按钮 */
#logout-btn { color: var(--text-2); }
#logout-btn:hover { color: var(--danger, #E74C3C); }

/* ============================ 右侧停靠区：AI 与详情同一位置互相覆盖 ============================ */

#right-dock {
  position: relative; display: flex; flex-direction: column;
  flex-shrink: 0; align-self: stretch; min-height: 0;
}

/* 两个栏都绝对铺满停靠区，同一时间只显示一个 */
#right-dock > #ai-panel,
#right-dock > #right-panel {
  position: absolute; inset: 0;
  width: var(--right-w);
}
#right-dock > #right-panel.collapsed { display: none; }
#right-dock:has(> #right-panel:not(.collapsed)) > #ai-panel { display: none; }

#ai-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
#ai-panel.collapsed { display: none; }

#right-dock { width: var(--right-w); }
#right-dock:has(> #ai-panel.collapsed):has(> #right-panel.collapsed) { width: 0; }

#ai-panel .panel-head { gap: 4px; }
.ai-head-title { display: flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; margin-right: auto; }
.ai-mark {
  font-style: normal; font-weight: 700; font-size: 10px; letter-spacing: .4px;
  color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 5px;
}
#ai-panel .icon-btn svg {
  width: 15px; height: 15px; fill: none;
  stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
#ai-panel .icon-btn svg circle { fill: none; }

/* 对话区占满标题与输入框之间的全部空间 */
.ai-log {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 16px 14px;
  background:
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 90px);
}
.ai-empty { color: var(--text-3); font-size: var(--fs-sm); text-align: center; margin-top: 28%; }

.ai-msg { display: flex; flex-direction: column; margin-bottom: 14px; max-width: 86%; }
.ai-msg.ai-user { margin-left: auto; align-items: flex-end; }
.ai-role { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 3px; padding: 0 4px; }
.ai-bubble {
  white-space: pre-wrap; word-break: break-word;
  padding: 9px 13px; border-radius: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  font-size: var(--fs); line-height: 1.7;
}
.ai-msg.ai-user .ai-bubble {
  background: var(--accent); color: #fff; border-color: transparent;
  border-bottom-right-radius: 4px;
}
.ai-msg.ai-assistant .ai-bubble { border-bottom-left-radius: 4px; }
.ai-msg.ai-error .ai-bubble { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* AI 回复的 Markdown 排版：紧凑，贴合气泡 */
.ai-bubble p { margin: 0 0 6px; }
.ai-bubble p:last-child { margin-bottom: 0; }
.ai-bubble ul, .ai-bubble ol { margin: 2px 0 6px; padding-left: 18px; }
.ai-bubble li { margin: 1px 0; }
.ai-bubble h1, .ai-bubble h2, .ai-bubble h3,
.ai-bubble h4, .ai-bubble h5, .ai-bubble h6 {
  font-size: var(--fs-md); margin: 8px 0 4px; line-height: 1.4;
}
.ai-bubble strong { font-weight: 650; }
.ai-bubble code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface-2); padding: 1px 4px; border-radius: 4px;
}
.ai-bubble pre {
  background: var(--surface-2); border-radius: var(--radius);
  padding: 8px 10px; overflow-x: auto; margin: 6px 0;
}
.ai-bubble pre code { background: none; padding: 0; }
.ai-bubble blockquote {
  margin: 6px 0; padding-left: 10px;
  border-left: 3px solid var(--border-strong); color: var(--text-2);
}
.ai-bubble table { border-collapse: collapse; margin: 6px 0; }
.ai-bubble th, .ai-bubble td { border: 1px solid var(--border); padding: 3px 8px; }


/* 输入区固定在栏的最底部 */
.ai-composer {
  flex: 0 0 auto; position: relative;
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: var(--surface);
}
.ai-composer textarea {
  display: block; width: 100%; resize: none;
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 10px 46px 10px 14px; margin: 0;
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: var(--fs); line-height: 1.55;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
}
.ai-composer textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
.ai-send {
  position: absolute; right: 20px; bottom: 20px;
  width: 30px; height: 30px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.ai-send:hover { background: var(--accent-dark); }
.ai-send:disabled { background: var(--border-strong); cursor: default; }

/* 悬浮按钮：脱离文档流的固定小方块 */
#right-dock > .ai-fab,
#right-dock > .panel-reopen.right {
  position: absolute; z-index: 30;
  width: 42px; height: 42px; padding: 0;
  border: none; border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
#right-dock > .ai-fab {
  top: 72px; right: 14px;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
#right-dock > .ai-fab:hover { background: var(--accent-dark); }
#right-dock > .panel-reopen.right {
  top: 124px; right: 14px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-strong); font-size: 18px;
}
#right-dock > .panel-reopen.right:hover { color: var(--accent-dark); border-color: var(--accent); }
