/* EFT 案例管理 · 专业浅色主题 */
:root {
  --bg: #f4f6f9;
  --bg-soft: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f1f4f8;
  --panel-3: #e8ecf2;
  --ink: #1f2733;
  --ink-2: #46505f;
  --muted: #7a8493;
  --accent: #c96f3f;
  --accent-2: #b0572a;
  --accent-soft: rgba(201, 111, 63, 0.12);
  --accent-line: rgba(201, 111, 63, 0.45);
  --line: #d8dee7;
  --line-soft: #e5e9ef;
  --user: #dbe6f7;
  --ai: #f1f3f6;
  --warm: #d9834f;
  --cool: #5b86b5;
  --danger: #cc4b38;
  --danger-soft: rgba(204, 75, 56, 0.12);
  --warn: #b07d00;
  --warn-soft: rgba(217, 163, 0, 0.18);
  --ok: #2f9e6b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(24, 40, 66, 0.14);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1320px; margin: 0 auto; height: 100vh; display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.brand h1 { font-size: 17px; margin: 0; letter-spacing: 1.5px; font-weight: 600; }
#app-version { font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 0; }

.tabs { display: flex; gap: 4px; background: var(--bg-soft); padding: 4px; border-radius: 10px; border: 1px solid var(--line-soft); }
.tabs .tab {
  border: none; background: transparent; color: var(--muted);
  padding: 7px 18px; font-size: 14px; cursor: pointer; border-radius: 7px;
  transition: background 0.15s, color 0.15s;
}
.tabs .tab:hover { color: var(--ink-2); }
.tabs .tab.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }

.user-switch { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.user-label { font-size: 12px; color: var(--muted); }
.user-switch select {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  font-size: 14px; background: var(--panel-2); color: var(--ink); cursor: pointer;
}

/* ---------- 布局 ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar, .cases-sidebar {
  width: 260px; flex-shrink: 0;
  border-right: 1px solid var(--line); background: var(--bg-soft);
  padding: 14px; overflow-y: auto;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sidebar-head-actions { display: flex; align-items: center; gap: 8px; }
/* 手机端个案列表抽屉（2026-10-25）：开关/关闭钮/遮罩默认隐藏，窄屏媒体查询里启用 */
.cases-toggle, .cases-close, .sidebar-backdrop { display: none; }
.sidebar-title { font-size: 12px; color: var(--muted); letter-spacing: 1.5px; font-weight: 600; }
.case-filter { margin-bottom: 10px; }
.case-filter select {
  width: 100%; padding: 6px 8px; font-size: 13px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}

.case-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; margin-bottom: 6px;
  font-size: 14px; border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.case-item:hover { background: var(--panel-2); }
.case-item.active { background: var(--accent-soft); border-color: var(--accent-line); }
.case-item .tag { font-size: 11px; color: var(--muted); display: inline-block; margin-top: 3px; margin-right: 6px; }
.case-item .tag.src { color: var(--accent); }

.main-view { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.empty { color: var(--muted); text-align: center; margin: 80px 20px; font-size: 14px; }

/* ---------- 个案档案 ---------- */
.case-detail { flex: 1; overflow-y: auto; padding: 22px 26px 60px; }
.case-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.case-head h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.3; }
.case-head .badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.case-head .badge {
  font-size: 12px; padding: 3px 11px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.case-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* 「案例讨论」按钮角标：对话窗口有待处理提示（识别到基本信息等待确认）时显示条数 */
.case-head .actions #start-session-btn { position: relative; }
.chat-notice {
  position: absolute; top: -7px; right: -7px;
  min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  background: #e5484d; color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

/* 分区导航 */
.segmented {
  display: flex; gap: 4px; background: var(--panel); padding: 4px;
  border-radius: 11px; border: 1px solid var(--line); margin-bottom: 18px;
  overflow-x: auto;
}
.segmented button {
  border: none; background: transparent; color: var(--muted); white-space: nowrap;
  padding: 8px 16px; border-radius: 8px; font-size: 13.5px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--ink-2); background: var(--panel-2); }
.segmented button.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.segmented .cnt { color: var(--muted); font-weight: 400; margin-left: 2px; }

.sec-panel { display: none; }
.sec-panel.active { display: block; }

/* 分区标题（面板内） */
.panel-title {
  font-size: 15px; font-weight: 600; color: var(--ink);
  margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.panel-title .hint-inline { font-size: 12px; color: var(--muted); font-weight: 400; }
.panel-title .spacer { margin-left: auto; }
.panel-empty { color: var(--muted); font-size: 13.5px; padding: 8px 0; }

/* 概念化存档：实时保存常驻线性提示（2026-10-23 用户口径：页面所有修改实时保存） */
.autosave-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted);
  background: var(--bg, #faf9f7); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent, #b0713e); border-radius: 6px;
  padding: 7px 12px; margin: 0 0 10px;
}
.autosave-hint::before { content: "●"; font-size: 8px; color: var(--accent, #b0713e); }

/* 通用分区卡（个案档案、录音解读结果） */
.section {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 14px;
}
.section h3 {
  margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--ink);
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* 概览 */
.ov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 4px; }
.ov-card {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 14px 16px;
}
.ov-card .k { font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.ov-card .v { font-size: 15px; color: var(--ink); font-weight: 500; word-break: break-word; }
.ov-card .v.big { font-size: 24px; font-weight: 700; color: var(--accent-2); line-height: 1.2; }
.ov-card .v .unit { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }

.risk-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.risk-tag {
  font-size: 12.5px; padding: 4px 12px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-soft);
}
.risk-tag.high { background: var(--danger-soft); color: var(--danger); border-color: rgba(204, 75, 56, 0.35); }

/* ---------- 卡片 ---------- */
.item-card {
  border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 13px 15px;
  margin-bottom: 10px; font-size: 13.5px; background: var(--panel);
}
.item-card h4 { margin: 0 0 6px; font-size: 13.5px; }
.item-card .row { margin: 4px 0; color: var(--ink-2); }
.item-card .row b { color: var(--ink); }

/* overflow 用 clip 而非 hidden：hidden 会产生滚动容器、令卡内概念化表头 position:sticky 失效 */
.item-card.fold { padding: 0; overflow: hidden; overflow: clip; }
.item-card.fold > summary {
  margin: 0; padding: 12px 15px; cursor: pointer; user-select: none; list-style: none;
  display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; min-width: 0;
  transition: background 0.15s;
}
.item-card.fold > summary:hover { background: var(--panel-2); }
.item-card.fold > summary::-webkit-details-marker { display: none; }
.item-card.fold > summary::marker { content: ""; }
.item-card.fold > summary::before {
  content: "▸"; color: var(--muted); font-size: 11px;
  transition: transform 0.15s; display: inline-block; flex-shrink: 0;
}
.item-card.fold[open] > summary::before { transform: rotate(90deg); }
.item-card.fold > summary .card-title { font-weight: 600; color: var(--ink); flex-shrink: 0; }
.item-card.fold > summary .card-sub {
  color: var(--muted); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.item-card.fold > summary .card-title-row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0;
}
.item-card.fold > summary .card-title-col {
  display: flex; flex-direction: column; gap: 2px;
  flex: 1 1 auto; min-width: 0;
  padding-right: 6px;
}
.item-card.fold > summary .card-actions {
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.badge.sm { padding: 2px 8px; font-size: 12px; border-radius: 999px; }
.badge.soft {
  background: var(--bg-soft); color: var(--accent-2);
  border: 1px solid var(--line-soft);
}
.item-card.fold[open] > summary { border-bottom: 1px solid var(--line-soft); }
.item-card.fold > .card-body { padding: 12px 15px; line-height: 1.7; }
.card-body .row { margin: 5px 0; }

/* ③ 归位固定条（2026-11-04 五十二）：常驻显示存疑 / 不明确句数与「下一项」按钮。
   .case-detail 是滚动容器、.item-card.fold 用 overflow:clip（不产生滚动容器），
   因此这里的 position:sticky 可以正常吸顶，长转写下滑时按钮始终可点。 */
.place-bar {
  position: sticky; top: 0; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  margin: 8px 0 4px; padding: 6px 8px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 2px 6px rgba(24, 40, 66, 0.08);
}
.place-bar .place-bar-counts { font-size: 12.5px; color: var(--ink-2); }
.place-bar .place-bar-counts b { color: var(--accent-2); }
.place-bar button { margin: 0; white-space: nowrap; }

/* 字段分组小标题 */
.sub-head {
  font-size: 12px; font-weight: 600; color: var(--accent-2); margin: 20px 0 8px;
  letter-spacing: 1px; text-transform: none;
}
.sub-head:first-child { margin-top: 4px; }

/* EFT 概念化表格 */
.concept-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 2px 0 6px; }
.concept-table td { border-bottom: 1px solid var(--line-soft); padding: 9px 10px; vertical-align: top; text-align: left; }
.concept-table tr:last-child td { border-bottom: none; }
.concept-table td:first-child {
  width: 30%; font-weight: 600; color: var(--accent-2); white-space: nowrap;
  background: var(--bg-soft);
}
.concept-table td:last-child { color: var(--ink-2); }

/* 概念化：伴侣案三列（维度｜关系角色一｜关系角色二）+ 精简摘要 / 详情层 */
.concept-table th {
  text-align: left; padding: 8px 10px; font-size: 12.5px; color: var(--accent-2);
  border-bottom: 1px solid var(--line); background: var(--bg-soft);
}
.concept-table.cp-couple { table-layout: fixed; }
.concept-table.cp-couple th:first-child,
.concept-table.cp-couple td:first-child { width: 20%; white-space: normal; }
/* 2026-10-18 两侧（关系角色一/二）中间竖线分隔：太太列左缘画线；
   跨两角色列的合并行（colspan=2）不匹配 nth-child(3)，自动无分隔 */
.concept-table.cp-couple td:nth-child(3),
.concept-table.cp-couple th:nth-child(3) { border-left: 1px solid var(--line-soft); }
.concept-table td.cp-empty { color: var(--muted); text-align: center; }

/* 表头两行固定：.case-detail 滚动、表头不动。
   sticky 需不透明底色；border-collapse 下边框不随 sticky 滚动，用 box-shadow 画底线 */
.concept-table thead th,
.concept-table thead td {
  position: sticky; z-index: 4; background: var(--bg-soft);
}
.concept-table thead tr.cp-head th { top: 0; height: 34px; box-shadow: 0 1px 0 var(--line); }
.concept-table thead tr.cp-who-row th,
.concept-table thead tr.cp-who-row td { top: 34px; height: 38px; box-shadow: 0 1px 0 var(--line); }
/* 第三行身份（先生/太太等）：接在称呼行下方，sticky 位置 = 表头 34px + 称呼行 38px */
.concept-table thead tr.cp-id-row th,
.concept-table thead tr.cp-id-row td { top: 72px; }
/* 称呼/身份行：按上传材料自动带出、可修改（存 cases.intake.role_names / role_identities） */
.cp-who-input {
  width: 100%; max-width: 180px; padding: 2px 8px; font-size: 12.5px;
  border: 1px dashed var(--line-soft); border-radius: 8px; background: var(--panel);
  color: var(--ink-2);
}
.cp-who-input:focus { border-color: var(--accent-2); border-style: solid; outline: none; }
/* 2026-10-18 说明列移除：字段级通用说明改为维度名右侧问号弹层（只读）。
   两侧角色列放宽（原 27% + 说明列 26% 收回） */
.concept-table.cp-couple thead th:nth-child(2),
.concept-table.cp-couple thead th:nth-child(3) { width: 40%; }
/* 问号按钮：维度名右侧小圆钮 */
.cp-q {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 5px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 10.5px; line-height: 1; font-weight: 600;
  cursor: pointer; vertical-align: middle;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.cp-q:hover, .cp-q[aria-expanded="true"] {
  color: var(--accent-2); border-color: var(--accent-2); background: var(--accent-soft);
}
/* 说明弹层：维度列内绝对定位浮层，盖在表格上方 */
.cp-dim { position: relative; }
.cp-q-pop {
  position: absolute; left: 0; top: 100%; z-index: 6;
  min-width: 260px; max-width: 380px; max-height: 300px; overflow-y: auto;
  margin-top: 4px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--accent-line);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 12px; color: var(--ink-2); line-height: 1.7; text-align: left;
}
/* 二级分类组标题条（basic 13 / session 12 / 迁移项）：高亮色条，与普通条目明确区分 */
.concept-table tr.cp-head td {
  background: var(--accent-soft); color: var(--accent-2);
  font-weight: 600; font-size: 12.5px; letter-spacing: 0.02em;
  padding: 5px 10px;
}
/* 二级分类头（手卡分区：核心 / 灰环 / 中环 / 两侧序列 / 其他）：比一级组头轻量 */
.concept-table tr.cp-subhead td {
  background: rgba(0, 0, 0, 0.025); color: var(--muted);
  font-weight: 600; font-size: 11.5px; letter-spacing: 0.03em;
  padding: 3px 10px; border-left: 3px solid var(--accent-soft);
}
/* 概念化每项的证据等级三态开关（推断/同意/原话，默认推断）：小尺寸，浮在内容右上角 */
/* z-index:1 置顶：同格 .cp-cell 是 position:relative 的整宽盒子，不置顶会截走开关的点击 */
/* 2026-10-18 起纵排：开关在上、「展开查看详情」图标在开关下方 */
.ev-wrap { float: right; margin: 0 0 3px 6px; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ev-seg {
  display: inline-flex; align-items: stretch; padding: 1px;
  border: 1px solid var(--line-soft); border-radius: 9px; background: var(--panel);
  font-size: 11px; line-height: 1.5; color: var(--ink-2);
}
.ev-opt {
  padding: 0 7px; border: none; border-radius: 7px; background: none;
  font-size: 11px; line-height: 1.6; color: var(--ink-2); cursor: pointer;
}
.ev-opt + .ev-opt { margin-left: 1px; }
.ev-opt:hover { color: var(--accent-2); }
.ev-opt.on { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
/* 两层显示：简介（可点编辑）在上方；详情在折叠块里 */
.cp-cell { position: relative; }
.cp-brief .cp-sum { display: inline; }
.cp-brief { margin-bottom: 0; }
.cp-full {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-soft);
  color: var(--ink-2);
}
/* 「展开查看详情」图标：位于证据开关下方（ev-wrap 纵排），点击展开该格详情；展开后箭头翻转 */
.cp-toggle-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; margin: 0; padding: 0;
  border: 1px solid var(--line-soft); border-radius: 50%;
  background: var(--panel); color: var(--ink-2); cursor: pointer; vertical-align: middle;
}
.cp-toggle-icon svg { transition: transform 0.15s; }
.cp-toggle-icon.open svg { transform: rotate(180deg); }
.cp-toggle-icon:hover { color: var(--accent-2); border-color: var(--accent-2); }
/* 二级分类折叠钮：收起/展开该分类下的条目 */
.cp-fold {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-right: 6px; padding: 0;
  border: none; background: none; color: var(--accent-2); cursor: pointer;
}
.cp-fold-arrow { display: inline-block; font-size: 10px; line-height: 1; }
tr.cp-fold-row td { cursor: pointer; }
tbody.cp-group[data-open="0"] tr:not(.cp-fold-row) { display: none; }
/* 伴侣案中：对象额外字段（「说明」「循环步骤」等）或无法拆分的合并叙述，单独跨两列 */
tr.cp-merged-row td { background: rgba(238, 241, 245, 0.5); }
.cp-merged-label {
  display: inline-block; font-size: 12px; color: var(--accent-2);
  padding: 2px 8px; margin: 0 0 4px 0; border-radius: 10px;
  background: var(--accent-soft);
}
/* 概念化条目列表（2026-10-24）：概念化全部多值字段每项一列条目；每条
   左侧正文（核心，解释折叠、点箭头展开）+ 右侧操作列（箭头/证据三态/高亮/删除） */
.cp-items { display: flow-root; }
.cp-item {
  display: flex; align-items: flex-start; gap: 8px;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--panel); padding: 6px 8px; margin-bottom: 6px;
}
/* 重点条目（高亮开）：浅绿底；AI 生成新版时原样保留，仅可手动关闭或删除 */
.cp-item.hl { background: #e9f6ea; border-color: #b7dfba; }
.cp-item-body { flex: 1 1 auto; min-width: 0; }
.cp-item-core { white-space: pre-wrap; word-break: break-word; }
.cp-item-note { margin-top: 3px; font-size: 12px; color: var(--muted); white-space: pre-wrap; }
/* 条目右侧操作列（2026-10-24 用户口径：核心在左，开关/重点/展开在右）：
   覆盖 .ev-wrap 的浮动纵排，固定右侧不占正文宽度 */
.cp-item .ev-wrap.cp-item-ops {
  float: none; flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: flex-end; gap: 4px; margin: 0;
}
/* 操作区第二行（2026-10-24 用户定版）：重点、删除、展开箭头横向一排 */
.cp-item-ops .cp-item-row {
  display: flex; flex-direction: row; align-items: center;
  justify-content: flex-end; gap: 4px;
}
/* 高亮开关（证据开关下方）：重点条目标记 */
.cp-hl {
  padding: 0 8px; border: 1px solid var(--line-soft); border-radius: 9px;
  background: var(--panel); font-size: 11px; line-height: 1.6;
  color: var(--ink-2); cursor: pointer;
}
.cp-hl:hover { color: #2e7d43; border-color: #66bb6a; }
.cp-hl.on { background: #d7ecd9; color: #2e7d43; border-color: #8ecda0; font-weight: 600; }
/* 条目删除 / 添加按钮 */
.cp-item-del {
  padding: 0 8px; border: 1px solid var(--line-soft); border-radius: 9px;
  background: var(--panel); font-size: 11px; line-height: 1.6;
  color: var(--ink-2); cursor: pointer;
}
.cp-item-del:hover { color: #c0392b; border-color: #e0867a; }
.cp-item-add {
  display: block; width: 100%; margin-top: 2px; padding: 3px 0;
  border: 1px dashed var(--line-soft); border-radius: 8px;
  background: none; font-size: 11.5px; color: var(--muted); cursor: pointer;
}
.cp-item-add:hover { color: var(--accent-2); border-color: var(--accent-2); }
/* 概览卡中常用操作提示条（自定义模板入口） */
.panel-hint {
  margin: 10px 0 4px; padding: 8px 12px; border-radius: 10px;
  background: rgba(91, 134, 181, 0.08); border: 1px solid rgba(91, 134, 181, 0.25);
  font-size: 13px; color: var(--ink-2);
}
.panel-hint .hint-inline { margin-left: 8px; font-size: 12px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv b { color: var(--muted); font-weight: 500; text-align: right; }

/* 证据/原话折叠 */
.ev { margin: 5px 0 2px; }
.ev summary { cursor: pointer; font-size: 12.5px; color: var(--accent-2); user-select: none; }
.ev summary:hover { text-decoration: underline; }
.ev[open] summary { margin-bottom: 5px; }
.ev .ev-body {
  margin: 2px 0 4px 10px; padding-left: 12px; border-left: 2px solid var(--line);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.75;
}
.ev-type { color: var(--muted); margin-right: 2px; }

/* 引文列表与数组缩进块 */
.q-list {
  margin: 3px 0 5px; padding-left: 12px; border-left: 2px solid var(--line);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.75;
}
.q-list > div { margin: 3px 0; }
.row-block { margin: 2px 0 5px 10px; }

/* ---------- 对话视图 ---------- */
.chat-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.chat-head .chat-title { font-size: 15px; font-weight: 600; min-width: 0; }
.chat-head .chat-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.chat-head .chat-actions .btn-hint { font-size: 11px; color: var(--muted); align-self: center; }

.steps {
  display: flex; gap: 6px; padding: 10px 18px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft); background: var(--bg-soft);
}
.steps .step {
  font-size: 12px; color: var(--muted); padding: 4px 11px; border-radius: 999px;
  background: var(--panel-2); white-space: nowrap;
}
.steps .step.active { background: var(--accent-soft); color: var(--accent-2); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-line); }

.messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.msg {
  max-width: 74%; padding: 11px 15px; border-radius: 14px; line-height: 1.65;
  font-size: 14.5px; white-space: pre-wrap; word-break: break-word;
}
.msg .msg-time {
  display: block; margin-top: 4px; font-size: 11px; color: var(--muted);
  opacity: 0.8; line-height: 1.2;
}
.msg.user { align-self: flex-end; background: var(--user); color: var(--ink); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--ai); color: var(--ink); border-bottom-left-radius: 4px; }
.msg .retry-reply {
  display: block; margin-top: 8px; padding: 6px 10px; font-size: 12px;
  background: var(--panel-2); color: var(--ink-2);
}

.voice-status { min-height: 20px; padding: 4px 18px; font-size: 13px; color: var(--muted); }
.voice-status[data-error="true"] { color: var(--danger); }

.voice-volume {
  display: flex; align-items: center; gap: 8px; padding: 0 18px 8px;
  font-size: 12px; color: var(--muted);
}
.voice-volume input { width: 130px; accent-color: var(--accent); }

.composer {
  display: flex; gap: 8px; padding: 14px 18px; background: var(--panel);
  border-top: 1px solid var(--line); align-items: center;
}
.composer textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px;
  font-size: 14.5px; resize: none; font-family: inherit;
  background: var(--panel-2); color: var(--ink);
}
.composer textarea::placeholder { color: var(--muted); }
.composer textarea:focus, .form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus, .user-switch select:focus {
  outline: none; border-color: var(--accent-line);
}

/* ---------- 按钮 ---------- */
button {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 10px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
button:hover { border-color: var(--accent-line); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.ghost { background: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--panel-2); }
button.recording { background: var(--danger); color: #fff; border-color: var(--danger); }
button.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 波形 ---------- */
.waveform { display: none; align-items: center; gap: 3px; height: 40px; padding: 0 8px; }
.waveform.busy { display: flex; }
.waveform .bar {
  width: 4px; height: 12px; border-radius: 2px; background: var(--cool);
  animation: wave 1s ease-in-out infinite;
}
.waveform .bar:nth-child(1) { animation-delay: 0s; }
.waveform .bar:nth-child(2) { animation-delay: 0.15s; }
.waveform .bar:nth-child(3) { animation-delay: 0.3s; }
.waveform .bar:nth-child(4) { animation-delay: 0.45s; }
.waveform .bar:nth-child(5) { animation-delay: 0.6s; }
.waveform.user .bar { background: var(--warm); }
.waveform.ai .bar { background: var(--cool); }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.6); }
}

/* ---------- 弹窗与表单 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(24, 40, 66, 0.38);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: 20px; backdrop-filter: blur(2px);
}
.modal-box {
  width: 680px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 26px; box-shadow: var(--shadow);
}
.modal-box h2 { margin: 0 0 8px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
  font-size: 14px; color: var(--ink); font-family: inherit; background: var(--panel-2);
}
.form-grid textarea { resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* AI 补全归位进度条（2026-11-05 六十二）：弹窗内进度条，宽度随「第 k/N 组」推进 */
.inc-progress-track {
  width: 100%; height: 10px; margin: 16px 0 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.inc-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #4c9aff, #7fc98a);
  border-radius: 999px; transition: width .35s ease;
}

/* ---------- 建档 AI 助理（弹窗右侧对话窗） ---------- */
.intake-box { width: 1120px; }
.intake-layout { display: flex; gap: 20px; align-items: stretch; }
.intake-form { flex: 1; min-width: 0; }
.intake-ai {
  width: 330px; flex-shrink: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel-2); overflow: hidden;
}
.intake-ai-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--line-soft); background: var(--panel);
}
.ai-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--line);
  flex-shrink: 0; transition: background 0.2s;
}
.ai-dot[data-state="ok"] { background: var(--ok); animation: ai-dot-pulse 1.6s ease-in-out infinite; }
.ai-dot[data-state="warn"] { background: #d9a13f; }
.ai-dot[data-state="err"] { background: var(--danger); }
@keyframes ai-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 107, 0.35); }
  50% { box-shadow: 0 0 0 5px rgba(47, 158, 107, 0); }
}
.ai-status { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted); }
.intake-ai-chat {
  flex: 1; min-height: 220px; max-height: 46vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
}
.intake-ai-chat .ai-empty { margin: auto; font-size: 13px; color: var(--muted); text-align: center; padding: 0 12px; }
.ai-bub {
  max-width: 88%; padding: 7px 11px; border-radius: 12px;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.ai-bub.ai { align-self: flex-start; background: var(--ai); color: var(--ink); border-bottom-left-radius: 4px; }
.ai-bub.user { align-self: flex-end; background: var(--user); color: var(--ink); border-bottom-right-radius: 4px; }
.ai-bub.user.live { opacity: 0.6; }
.ai-bub.sys {
  align-self: center; max-width: 96%; background: transparent; color: var(--muted);
  font-size: 12px; padding: 2px 6px; text-align: center;
}
.intake-ai-ctrl { display: flex; gap: 8px; padding: 10px 12px 4px; }
.intake-ai-ctrl button { flex: 1; }
.intake-ai-hint { padding: 6px 12px 12px; font-size: 12px; color: var(--muted); }
/* AI 填入字段的高亮闪烁 */
.form-grid input.ai-flash, .form-grid select.ai-flash, .form-grid textarea.ai-flash {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transition: box-shadow 0.4s, border-color 0.4s;
}

/* ---------- 评估维度（保留样式） ---------- */
.dims { display: flex; flex-direction: column; gap: 12px; }
.dim-row { display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.dim-label { width: 130px; color: var(--ink-2); flex-shrink: 0; }
.dim-bar { flex: 1; height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.dim-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width 0.4s; }
.dim-score { width: 34px; text-align: right; font-weight: 700; color: var(--accent-2); }

.trend-chart { display: block; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---------- 列表 ---------- */
.list { margin: 0; padding-left: 20px; font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }
.list li { margin: 3px 0; }

/* ---------- 录音解读 ---------- */
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 14px; line-height: 1.65; }
.interpret-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#interp-url {
  flex: 1; min-width: 200px; padding: 8px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-size: 13.5px; font-family: inherit;
}
.full-select {
  width: 100%; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-size: 14px; font-family: inherit;
}
.sm-select {
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font-size: 14px; font-family: inherit; cursor: pointer;
}
.interp-transcript {
  min-height: 70px; border: 1px solid var(--line); border-radius: 9px;
  padding: 11px 13px; font-size: 14px; margin-top: 12px; white-space: pre-wrap;
  background: var(--bg-soft); color: var(--ink-2);
}

/* ---------- 就地编辑 ---------- */
.editable {
  cursor: text; border-radius: 4px; padding: 1px 3px; margin: -1px -3px;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.editable:hover { background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-line); }
.editable:focus { outline: none; }
.editable.ed-block { display: block; }
.editable.editing { display: block; padding: 0; margin: 0; background: transparent; box-shadow: none; }
/* 编辑器包装：textarea + 保存/取消按钮，底部有 action 条 */
.ed-wrap { display: flex; flex-direction: column; gap: 6px; }
.ed-input {
  width: 100%; box-sizing: border-box; min-height: 2.2em;
  border: 1px solid var(--accent-line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink);
  padding: 8px 10px; font-size: inherit; font-family: inherit; line-height: 1.6;
  resize: vertical;
}
.ed-input.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.ed-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding-top: 2px;
}
.ed-actions button.sm {
  padding: 4px 12px; font-size: 12.5px; border-radius: 8px; cursor: pointer;
}
.ed-actions button.sm.primary {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.ed-actions button.sm.primary:disabled { opacity: 0.6; cursor: not-allowed; }
.ed-actions button.sm.ghost {
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--line);
}
.ed-actions button.sm.primary:hover:not(:disabled) { background: var(--accent-2); border-color: var(--accent-2); }
.ed-actions button.sm.ghost:hover { background: var(--panel-2); }

/* ---------- 概念化引导卡片（案例讨论内） ---------- */
.guide-card {
  max-width: 92%;
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--panel-2, #f6f8fb);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.guide-head { font-weight: 700; display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.guide-time { font-weight: 400; font-size: 11px; color: var(--muted); }
.guide-sec { margin-top: 8px; }
.guide-sec-title { font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.guide-unspoken { padding: 6px 8px; border-left: 3px solid var(--accent-2, #4a7dbd); background: rgba(0,0,0,0.02); border-radius: 0 8px 8px 0; margin-bottom: 6px; }
.guide-unspoken-text { white-space: pre-wrap; }
.guide-basis { color: var(--muted); font-size: 12px; margin-top: 2px; }
.guide-cat { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; overflow: hidden; }
.guide-cat summary { cursor: pointer; padding: 6px 10px; font-weight: 600; user-select: none; }
.guide-cat summary:hover { background: rgba(0,0,0,0.03); }
.guide-qs { padding: 2px 10px 8px; }
.guide-q { padding: 5px 8px; margin-top: 4px; border-radius: 6px; cursor: pointer; border: 1px dashed transparent; }
.guide-q:hover { background: var(--panel, #eef2f8); border-color: var(--line); }
.guide-loading { color: var(--muted); font-style: italic; }

/* 基本信息识别卡（2026-10-25）：对话窗口内询问是否把识别结果填入接案基本信息 */
.intake-card {
  max-width: 92%;
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--panel-2, #f6f8fb);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
}
.intake-tip { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.intake-field { margin-bottom: 8px; }
.intake-field-head { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.intake-current { color: var(--muted); font-size: 12px; margin: 2px 0 0 22px; white-space: pre-wrap; }
.intake-val {
  width: 100%; box-sizing: border-box; margin-top: 4px;
  padding: 6px 8px; font: inherit; line-height: 1.5; color: var(--ink);
  background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 8px;
  resize: vertical;
}
.intake-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.intake-actions button.sm { padding: 4px 12px; font-size: 12.5px; border-radius: 8px; cursor: pointer; }
.intake-actions button.sm.primary { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.intake-actions button.sm.primary:disabled { opacity: 0.6; cursor: not-allowed; }
.intake-actions button.sm.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  .topbar { gap: 12px; padding: 10px 14px; }
  .user-switch .user-label { display: none; }
  .sidebar, .cases-sidebar { width: 200px; padding: 10px; }
  .case-detail { padding: 16px 14px 50px; }
  .case-head .actions { margin-left: 0; width: 100%; }
  .msg { max-width: 88%; }
  .form-grid { grid-template-columns: 1fr; }
  /* 建档弹窗窄屏：AI 对话窗下移到表单下方 */
  .intake-box { width: 680px; }
  .intake-layout { flex-direction: column; }
  .intake-ai { width: 100%; }
}

/* 生成任务状态浮条（2026-10-24）：任务名 + 转圈 + 已用秒数；成功绿/失败红，自动淡出 */
.task-toast { position: fixed; right: 18px; bottom: 18px; z-index: 900; display: flex; align-items: center; gap: 10px; max-width: 460px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.14); padding: 10px 14px; font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.task-toast.show { opacity: 1; transform: none; }
.task-toast.run { border-color: #8ab4e8; }
.task-toast.ok { border-color: #7fc98a; }
.task-toast.bad { border-color: #e08a8a; }
.tt-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c9d8ec; border-top-color: #3b74c4; animation: tt-rot .8s linear infinite; flex: 0 0 auto; }
@keyframes tt-rot { to { transform: rotate(360deg); } }
.tt-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.tt-dot.ok { background: #3f9e57; }
.tt-dot.bad { background: #d05252; }
.tt-sec { color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.tt-msg { line-height: 1.45; word-break: break-all; }

/* ---------- 手机端个案列表抽屉（2026-10-25）----------
   窄屏（≤1080px，覆盖手机竖屏/横屏/平板/「桌面版网站」模式）侧栏默认收起、整屏只显示
   右侧内容；☰ 展开为左侧抽屉 + 半透明遮罩，✕ / 点遮罩 / 选中个案后收起。
   桌面端（>1080px）不受影响（开关与遮罩 display:none）。
   断点 820→1080：实测手机横屏 844-926px、桌面模式 980px、iPad 竖屏 834px 均超 820 导致不触发。 */
@media (max-width: 1080px) {
  .cases-toggle {
    display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; padding: 6px 10px;
  }
  .cases-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 640;
    width: min(80vw, 300px); padding: 14px;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(15, 30, 55, .25);
  }
  .cases-sidebar.open { transform: none; }
  .cases-close { display: inline-flex; align-items: center; padding: 6px 10px; }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 630; background: rgba(18, 30, 50, .38);
  }
  .sidebar-backdrop.show { display: block; }
}

/* 概念化生成进行中占位卡（2026-10-31 四十四） */
.concept-gen-pending { display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; color: var(--muted); font-size: 13px; }
.concept-gen-pending .gen-sec { margin-left: auto; font-size: 12px; flex: 0 0 auto; }

/* 案例后台任务面板（八十四 2026-11-07） */
.case-tasks-panel { margin: 10px 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft, rgba(128,128,128,.04)); }
.case-tasks-panel .panel-title { margin: 0 0 4px; }
.case-task-row:last-child { border-bottom: none !important; }
