/* 发拍报 · AI 智能问答 —— 莫兰迪灰主题 */

:root {
  --bg-window: #ECEAE6;
  --bg-side: #E5E2DC;
  --bg-chat: #F1F0EC;
  --bg-card: #F9F8F5;
  --bg-input: #F8F7F4;
  --bg-hover: rgba(62, 57, 49, 0.055);
  --border: #DEDBD4;
  --border-soft: #E9E6E0;
  --ink: #3E3B37;
  --ink-2: #6E6A63;
  --ink-3: #8F8A80;
  --accent: #7E8273;
  --accent-strong: #6E7263;
  --accent-soft: #EAEEE3;
  --link: #5F6B7A;
  --danger: #A9776F;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
/* 页面真正的滚动容器是 html（documentElement），不是 body；
   同时隐藏两者的滚动条，避免外层出现可见滚动条。 */
html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
html::-webkit-scrollbar { display: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-window);
  /* 聊天区固定一屏（.app 为 100vh），页脚在其下方，靠页面纵向滚动查看。
     页面滚动条视觉隐藏（html 与 body 两处都隐藏）：只保留 .chat-scroll
     一个可见滚动条，滚轮到底后自然把页面带到页脚。 */
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* 旧 Edge */
}
body::-webkit-scrollbar { display: none; }  /* Chrome / Safari / Edge */

button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; font-size: inherit; line-height: inherit; }
input, textarea { font-family: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid #9AA08D; outline-offset: 2px; }
::selection { background: #D6D9CB; }

.chat-scroll, .session-list { scrollbar-width: thin; scrollbar-color: #CDC8BF transparent; }
.chat-scroll::-webkit-scrollbar, .session-list::-webkit-scrollbar { width: 8px; }
.chat-scroll::-webkit-scrollbar-thumb, .session-list::-webkit-scrollbar-thumb { background: #CDC8BF; border-radius: 8px; }
.chat-scroll::-webkit-scrollbar-thumb:hover, .session-list::-webkit-scrollbar-thumb:hover { background: #BBB5AB; }
.chat-scroll::-webkit-scrollbar-track, .session-list::-webkit-scrollbar-track { background: transparent; }

.app svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- 悬停功能提示（tooltip） ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  right: -4px;
  background: #4A4740;
  color: #F5F4EF;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(30, 28, 24, 0.22);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity 0.15s ease 0s;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transition: opacity 0.15s ease 0.35s; }

.app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ---------- top bar ---------- */
/* 头部结构与样式由 js/head.js 统一注入（.hd-*），此处只保留头部内的通用按钮 */
.btn-primary { height: 32px; padding: 0 16px; border-radius: 9px; background: var(--accent); color: #FBFAF6; font-size: 13px; transition: background 0.15s; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { height: 32px; padding: 0 14px; border-radius: 9px; color: var(--ink-2); font-size: 13px; transition: background 0.15s, color 0.15s; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--ink); }
.user-menu-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 9px; transition: background 0.15s; }
.user-btn:hover { background: var(--bg-hover); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #98A08D, #7E8273); color: #FBFAF6; display: grid; place-items: center; font-size: 13px; }
.user-name { font-size: 13.5px; color: var(--ink); }
.user-btn > svg { width: 14px; height: 14px; color: var(--ink-3); }
.user-dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: 172px; background: #F8F7F4; border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(40, 36, 30, 0.16); z-index: 60; }
.dd-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); transition: background 0.12s; }
.dd-item:hover { background: var(--bg-hover); }
.dd-item svg { width: 15px; height: 15px; }
.dd-danger { color: var(--danger); }
.dd-sep { height: 1px; background: var(--border-soft); margin: 5px 8px; }

/* ---------- body / sidebar ---------- */
.app-body { flex: 1; display: flex; min-height: 0; }
.app { --sidebar-w: 268px; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; background: var(--bg-side); border-right: 1px solid var(--border); padding: 14px 12px 10px; display: flex; flex-direction: column; transition: margin-left 0.22s ease; }
.app.side-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); border-right-color: transparent; }
.new-chat { width: 100%; height: 38px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; border: 1px solid var(--border); background: #F2F0EB; font-size: 13.5px; color: var(--ink-2); transition: all 0.15s; }
.new-chat:hover { border-color: #C9C4BA; background: #F7F5F1; color: var(--ink); }
.side-search { position: relative; margin-top: 10px; }
.side-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: #A5A096; pointer-events: none; }
.side-search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border-radius: 9px; border: 1px solid transparent; background: #F2F0EB; font-size: 13px; color: var(--ink); transition: all 0.15s; }
.side-search input::placeholder { color: #A9A399; }
.side-search input:focus { outline: none; background: #FDFCFA; border-color: #A8AC9A; box-shadow: 0 0 0 3px rgba(126, 130, 115, 0.12); }
.search-empty { text-align: center; font-size: 12.5px; color: var(--ink-3); padding: 26px 8px; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.status-tab { height: 25px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; color: var(--ink-2); transition: all 0.13s; }
.status-tab:hover { background: var(--bg-hover); }
.status-tab.active { background: var(--accent); color: #FBFAF6; }
.session-list { flex: 1; overflow-y: auto; margin-top: 8px; padding-bottom: 10px; }
.group-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; margin: 16px 8px 6px; }
.group-label:first-child { margin-top: 8px; }
.group-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.session-item { display: block; width: 100%; text-align: left; padding: 9px 10px 8px; border-radius: 10px; position: relative; transition: background 0.12s; }
.session-item:hover { background: var(--bg-hover); }
.session-item.active { background: #F3F1EC; }
.session-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.group-sep { height: 1px; background: var(--border); margin: 8px 8px 2px; opacity: 0.6; }
.s-pin-mark { display: inline-block; vertical-align: -1px; margin-right: 4px; color: #8A9080; }
.app svg.s-pin-mark { width: 11px; height: 11px; }
/* 会话名前状态指示：生成中转圈（s-spin）/ 完成未见小圆点（s-newdot） */
.s-spin { display: inline-block; width: 11px; height: 11px; margin-right: 5px; vertical-align: -1px; border: 2px solid #C9C4BA; border-top-color: #6C7460; border-radius: 50%; animation: s-spin-rot 0.8s linear infinite; }
@keyframes s-spin-rot { to { transform: rotate(360deg); } }
.s-newdot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; vertical-align: 1px; border-radius: 50%; background: #55A05E; }
.s-edit { width: 100%; height: 30px; font-size: 13px; padding: 0 8px; border-radius: 8px; border: 1px solid #A8AC9A; background: #FDFCFA; color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(126, 130, 115, 0.12); }
.s-title { display: block; font-size: 13.5px; color: #4A473F; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 4px; }
.s-meta { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.s-actions { position: absolute; top: 6px; right: 8px; display: flex; gap: 2px; padding: 2px; background: #EFEBE2; border: 1px solid #D8D4CC; border-radius: 8px; box-shadow: 0 3px 10px rgba(40, 36, 30, 0.18); opacity: 0; transition: opacity 0.12s; z-index: 3; }
.session-item:hover .s-actions, .session-item:focus-within .s-actions, .arch-item:hover .s-actions, .arch-item:focus-within .s-actions { opacity: 1; }
.s-act { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; color: #6F6A60; transition: all 0.12s; }
.s-act:hover { background: #E2DED4; color: #3F3C36; }
.s-act.danger:hover { background: #F1E5E1; color: var(--danger); }
.s-act svg { width: 14px; height: 14px; stroke-width: 2.4; }
@media (pointer: coarse) { .s-actions { opacity: 1; } }

/* ---------- 归档抽屉 ---------- */
.archive-drawer { flex-shrink: 0; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
/* 归档入口单独成行：与状态筛选选中态同款深橄榄底 + 近白字，风格统一 */
.archive-head { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: #FBFAF6; background: var(--accent); transition: background 0.12s; }
.archive-head:hover { background: var(--accent-strong); }
.archive-head svg { width: 14px; height: 14px; }
.archive-head .chev { margin-left: auto; transition: transform 0.15s; }
.archive-drawer.open .chev { transform: rotate(180deg); }
.archive-count { font-size: 11px; background: rgba(255, 255, 255, 0.18); color: #FBFAF6; border-radius: 999px; padding: 0 7px; line-height: 17px; }
.archive-list { max-height: 26vh; overflow-y: auto; margin: 4px 0 4px; padding: 0 2px; }
/* 抽屉条目贴近列表顶部时，默认向上弹的 tooltip 会被列表 overflow 裁剪：
   改为在按钮左侧、竖直居中弹出（横向落在条目行内，纵向不越界，任何位置都不被裁） */
.archive-list [data-tooltip]::after {
  bottom: auto;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
}
.arch-item { display: block; width: 100%; text-align: left; padding: 7px 8px; border-radius: 9px; position: relative; transition: background 0.12s; }
.arch-item:hover { background: var(--bg-hover); }
.arch-item .s-title { font-size: 12.5px; color: #6E6A63; }
.arch-empty { font-size: 11.5px; color: var(--ink-3); text-align: center; padding: 10px 0 6px; }

/* ---------- 侧栏拖拽分割线 ---------- */
.resizer { width: 7px; flex-shrink: 0; cursor: col-resize; position: relative; z-index: 5; margin-left: -4px; margin-right: -3px; touch-action: none; }
.resizer::after { content: ""; position: absolute; left: 2px; top: 0; bottom: 0; width: 2px; border-radius: 2px; background: transparent; transition: background 0.15s; }
.resizer:hover::after, .resizer:focus-visible::after, body.resizing .resizer::after { background: var(--accent); opacity: 0.55; }
body.resizing { cursor: col-resize; user-select: none; }

/* ---------- chat ---------- */
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-chat); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px 24px 8px; display: flex; flex-direction: column; }
.chat-inner { width: 100%; max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; padding-bottom: 12px; }
.chat-crumb { text-align: center; font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.msg-user { align-self: flex-end; max-width: 76%; background: var(--accent); color: #F8F7F2; padding: 10px 14px; border-radius: 16px 16px 4px 16px; line-height: 1.65; }
.msg-ai { align-self: flex-start; max-width: 88%; width: fit-content; }
.ai-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-avatar { width: 22px; height: 22px; border-radius: 7px; overflow: hidden; display: grid; place-items: center; background: var(--accent); }
.ai-avatar img { width: 100%; height: 100%; display: block; }
.ai-name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.ai-card { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 220px; }
.b-text { line-height: 1.75; color: #46433D; }
.b-text b { font-weight: 600; color: #3A3833; }
.b-list { list-style: none; display: flex; flex-direction: column; gap: 8px; line-height: 1.7; color: #46433D; }
.b-list li { padding-left: 16px; position: relative; }
.b-list li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: #A9AD9E; }
.b-list b { font-weight: 600; color: #3A3833; }
/* 阶梯放宽提示条：检索触发条件放宽时展示 */
.match-hint {
  margin: 10px 0 8px;
  padding: 8px 12px;
  border: 1px solid #E4D9C3;
  border-left: 3px solid #B39B7D;
  border-radius: 8px;
  background: #FAF6EE;
  color: #8A7A5C;
  font-size: 12.5px;
  line-height: 1.6;
}
/* 查询结果统计条：表格上方展示命中数/展示数/排序 + 放宽说明 + 合理化建议 */
.result-summary {
  margin: 10px 0 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 12.5px;
  line-height: 1.65;
}
.result-summary .rs-stats { color: var(--ink-2); }
.result-summary .rs-stats b { color: var(--ink); font-weight: 600; }
.result-summary .rs-metrics { margin-top: 4px; color: var(--ink-2); }
.result-summary .rs-metrics b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.result-summary .rs-sep { margin: 0 8px; color: #C9C4BA; }
.result-summary .rs-dist { margin-top: 3px; color: var(--ink-3); }
/* 低折亮点行（≤8 折计数 + 前 5 套 chips，序号对应表格行号） */
.result-summary .rs-low { margin-top: 4px; color: var(--ink-2); }
.result-summary .rs-low b { color: var(--danger); font-weight: 600; }
.result-summary .rs-low-chip { display: inline-block; margin: 2px 6px 0 0; padding: 1px 8px; border-radius: 999px; background: #F7ECE8; color: #A05A48; font-size: 11.5px; white-space: nowrap; }
/* 口径声明：分源折价率口径与实时源字段边界，小字防误读 */
.result-summary .rs-caliber { margin-top: 3px; color: var(--ink-3); font-size: 11.5px; }
.result-summary .rs-relaxed { margin-top: 3px; color: #8A7A5C; }
.result-summary .rs-tip { margin-top: 5px; padding-top: 6px; border-top: 1px dashed var(--border-soft); color: var(--ink-3); }
/* 客户话术：置顶为统计卡首段（虚线下分隔）——流式期间话术就在消息顶部，finish 后原位
   不动（数据行填充在其下方），消除"流式→跳到卡中部"的跳变；整卡内容可直接转发 */
.result-summary .rs-script { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--border-soft); font-size: 13px; line-height: 1.7; color: #46433D; }
/* 话术纯段落：仅流式期间与旧持久化 script 块使用（正式渲染并进统计卡） */
.script-plain { font-size: 13px; line-height: 1.7; color: #46433D; }
/* 数据表格：列宽按内容自适应，超出容器时横向滚动（避免列挤压） */
.b-table { border: 1px solid var(--border-soft); border-radius: 10px; overflow-x: auto; overflow-y: hidden; }
/* separate 而非 collapse：sticky 列的边框在 collapse 下不会跟着单元格滚动 */
.b-table table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.b-table th, .b-table td { box-sizing: border-box; }
/* 斑马线：行背景走变量，让 sticky 前三列与数据行同色，滚动时不透出下层文字 */
.b-table tbody tr { --row-bg: #FFFFFF; }
.b-table tbody tr:nth-child(even) { --row-bg: #F7F6F2; }
.b-table tbody tr:hover { --row-bg: #F1EFEA; }
.b-table th { background: #F1EFEA; color: #847F76; font-weight: 500; text-align: left; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.b-table td { background: var(--row-bg); padding: 8px 12px; border-top: 1px solid #EDEBE5; color: #4A473F; white-space: nowrap; }
/* 前三列固定：序号 / 来源 / 标的，left 依次累加列宽 */
.b-table th:nth-child(1), .b-table td:nth-child(1) {
  position: sticky; left: 0; width: 40px; min-width: 40px; max-width: 40px; z-index: 2; }
.b-table th:nth-child(2), .b-table td:nth-child(2) {
  position: sticky; left: 40px; width: 104px; min-width: 104px; max-width: 104px; z-index: 2; }
.b-table th:nth-child(3), .b-table td:nth-child(3) {
  position: sticky; left: 144px; width: 240px; min-width: 240px; max-width: 240px; z-index: 2; }
/* 固定列的层级要高于普通表头，否则横向滚动时第 4 列起会把前三列表头盖住 */
.b-table th:nth-child(1), .b-table th:nth-child(2), .b-table th:nth-child(3) { z-index: 4; }
/* 第三列右缘加一条淡分隔线，滚动时一眼分辨固定区与滚动区 */
.b-table th:nth-child(3), .b-table td:nth-child(3) { box-shadow: 1px 0 0 var(--border-soft); }
/* 标题列允许换行但限宽，防止整表过宽 */
.b-table td a.lot-link { white-space: normal; display: inline-block; max-width: 100%; vertical-align: top; }
.b-table::-webkit-scrollbar { height: 8px; }
.b-table::-webkit-scrollbar-thumb { background: #D8D4CC; border-radius: 4px; }
.b-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.b-table .ctr { text-align: center; }
/* 来源每源一色（fapai-report 规范，最多六源）：阿里橙/京东红/法院诉讼资产网蓝/公拍网绿/
   北交所紫/中拍协金棕，未知源灰兜底；表格标签与统计卡圆点共用同色 */
.src-ali { background: #e07f2e; }
.src-jd { background: #d4574e; }
.src-court { background: #1a5cb0; }
.src-gongpai { background: #0a9d6c; }
.src-bj { background: #6f42c1; }
.src-caa { background: #a16207; }
.src-other { background: #6b7280; }
.b-table .src-tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; color: #fff; white-space: nowrap; }
.result-summary .rs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 4px; vertical-align: 1px; }
.pos { color: #72805E; }
.neg { color: var(--danger); }
.tag { display: inline-block; font-size: 11px; padding: 2px 9px; border-radius: 999px; background: #EBEEE2; color: #6C7460; }
.tag.warn { background: #F1E5E1; color: #A9776F; }
.b-media { border: 1px solid var(--border-soft); border-radius: 12px; background: #FBFAF7; padding: 12px 12px 10px; }
.b-media .chart-svg { display: block; width: 100%; height: auto; }
.b-media figcaption { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); text-align: center; }
.photo-slot { height: 150px; border-radius: 9px; background: linear-gradient(160deg, #C7CCBD 0%, #ADB3A2 52%, #8F9683 100%); display: grid; place-items: center; color: #F6F6F1; }
.ps-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; opacity: 0.92; }
.ps-inner svg { width: 20px; height: 20px; }
.b-links { display: flex; flex-direction: column; gap: 6px; border-top: 1px dashed var(--border-soft); padding-top: 10px; }
.b-links-label { font-size: 11.5px; color: var(--ink-3); }
.b-links a { display: flex; align-items: center; gap: 5px; width: fit-content; font-size: 13px; color: var(--link); text-decoration: none; }
.b-links a:hover { text-decoration: underline; }
.b-links a svg { width: 13px; height: 13px; }
.b-report { margin-top: 10px; border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; background: var(--bg-hover); display: flex; flex-direction: column; gap: 4px; }
.b-report-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.b-report-label svg { width: 14px; height: 14px; color: var(--accent-strong); }
.b-report a.b-report-link { display: flex; align-items: center; gap: 6px; width: fit-content; font-size: 13px; color: var(--link); text-decoration: none; }
.b-report a.b-report-link:hover { text-decoration: underline; }
.b-report a.b-report-link svg { width: 13px; height: 13px; }
.b-report-note { font-size: 11px; color: var(--ink-3); }
.msg-actions { display: flex; gap: 2px; margin-top: 2px; }
.act-btn { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #A9A399; transition: all 0.12s; }
.act-btn:hover { background: var(--bg-hover); color: #6B675F; }
.act-btn.active { color: var(--accent-strong); background: var(--accent-soft); }
.act-btn svg { width: 13.5px; height: 13.5px; }
.typing { display: flex; gap: 5px; padding: 6px 2px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #B4AFA5; animation: blink 1.2s infinite; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }
/* 技能调用加载标识：打字点右侧的进行时文案（“正在解读公告…”，弱化灰同次级文字色系） */
.typing-label { align-self: center; margin-left: 6px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- empty state ---------- */
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; }
.empty-logo { width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; }
.empty-logo img { width: 100%; height: 100%; display: block; }
.empty-title { font-size: 19px; font-weight: 600; color: var(--ink); margin: 16px 0 6px; }
.empty-sub { font-size: 13.5px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; max-width: 470px; }
.chip { padding: 8px 15px; border-radius: 999px; border: 1px solid var(--border); background: #F5F3EF; font-size: 13px; color: var(--ink-2); transition: all 0.15s; }
.chip:hover { border-color: #B9B4A9; background: #F9F7F3; color: var(--ink); }
.chip .chip-token { font-weight: 600; color: var(--accent-strong); margin-right: 3px; }

/* ---------- composer ---------- */
.composer { flex-shrink: 0; position: relative; padding: 10px 24px 13px; }
.input-wrap { max-width: 780px; margin: 0 auto; background: var(--bg-input); border: 1px solid var(--border); border-radius: 14px; padding: 9px 9px 9px 16px; display: flex; align-items: flex-end; gap: 10px; transition: border 0.15s, box-shadow 0.15s; }
.input-wrap:focus-within { border-color: #A8AC9A; box-shadow: 0 0 0 3px rgba(126, 130, 115, 0.13); }
.iptrow { display: flex; align-items: flex-end; gap: 10px; flex: 1; min-width: 0; }
/* 预置能力菜单：输入 # 时浮出，锚在输入框上方 */
.skill-menu { position: absolute; bottom: calc(100% - 14px); left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 48px)); background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(62, 59, 55, 0.14); padding: 6px; z-index: 30; }
.skill-menu-head { font-size: 11px; color: var(--ink-3); padding: 7px 10px 5px; letter-spacing: 0.04em; }
.skill-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-align: left; transition: background 0.12s; }
.skill-item:hover, .skill-item.active { background: var(--bg-hover); }
.skill-token { flex: none; font-size: 12.5px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.skill-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.skill-label { font-size: 13.5px; color: var(--ink); }
.skill-desc { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 用户消息里的 #token 高亮胶囊 */
.msg-user .skill-ref { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 999px; padding: 1px 8px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.input-wrap textarea { flex: 1; border: none; background: none; resize: none; font-size: 14px; line-height: 1.6; color: var(--ink); max-height: 140px; padding: 6px 0; }
.input-wrap textarea:focus { outline: none; }
.input-wrap textarea::placeholder { color: #A9A399; }
.send-btn { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #FBFAF6; display: grid; place-items: center; transition: background 0.15s; }
.send-btn:hover:not(:disabled) { background: var(--accent-strong); }
.send-btn:disabled { background: #CBC7BE; cursor: default; }
.send-btn svg { width: 17px; height: 17px; }
/* 左缘与输入框内第一个字符对齐：输入框左边框 1px + 内边距 16px */
.composer-hint { max-width: 780px; margin: 8px auto 0; padding-left: 17px; text-align: left; font-size: 11.5px; color: #A6A198; }

/* ---------- 问题导航条（参照 ZCode 会话左缘的小进度条） ----------
 * 每条用户提问在对话区左缘对应一根小横线，竖排成列：
 * 悬停时小横线放大、右侧弹出该问题的预览；点击平滑跳到该提问；
 * 当前读到的一问常亮（滚动跟随）；生成中的一问做流光进度动画 */
.qnav {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  max-height: min(64vh, 560px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 4px 2px;
  scrollbar-width: none;
  z-index: 6;
}
.qnav::-webkit-scrollbar { display: none; }
.qnav[hidden] { display: none; }
.qnav-tick { display: flex; align-items: center; height: 16px; padding: 0 7px 0 5px; border-radius: 999px; position: relative; }
.qnav-line { width: 13px; height: 3px; border-radius: 999px; background: #C6C1B7; transition: width 0.16s ease, height 0.16s ease, background-color 0.16s ease; }
.qnav-tick:hover .qnav-line, .qnav-tick:focus-visible .qnav-line { width: 24px; height: 4px; background: var(--accent-strong); }
.qnav-tick.active .qnav-line { width: 19px; background: var(--accent); }
.qnav-tick.active:hover .qnav-line { width: 24px; height: 4px; }
/* 生成中的一问：横线流光循环（进度条质感） */
.qnav-tick.loading .qnav-line {
  width: 24px; height: 4px;
  background: linear-gradient(90deg, #C6C1B7 0%, var(--accent) 50%, #C6C1B7 100%);
  background-size: 200% 100%;
  animation: qnav-flow 1.2s linear infinite;
}
@keyframes qnav-flow { from { background-position: 200% 0; } to { background-position: 0% 0; } }
/* 问题预览气泡：JS 定位的共享元素（position: fixed，不受 .qnav overflow 裁剪），
 * 视觉沿用项目深色 tooltip（#4A4740 底、浅字、圆角、投影），单行截断 */
.qnav-tip {
  position: fixed;
  left: -9999px;
  top: 0;
  max-width: min(320px, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #4A4740;
  color: #F5F4EF;
  font-size: 12px;
  line-height: 1.5;
  padding: 6px 11px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(30, 28, 24, 0.22);
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  z-index: 80;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.qnav-tip.show { opacity: 1; transform: translateX(0); }

/* ---------- auth modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(64, 60, 54, 0.32); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.overlay[hidden] { display: none; }
.modal { width: 380px; max-width: calc(100vw - 40px); background: #F8F7F4; border-radius: 16px; padding: 26px 26px 20px; box-shadow: 0 24px 64px rgba(40, 36, 30, 0.28); position: relative; animation: pop 0.18s ease; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.modal-close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-3); transition: all 0.12s; }
.modal-close:hover { background: var(--bg-hover); color: var(--ink); }
.auth-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; }
.auth-tab { padding: 6px 2px 10px; font-size: 15px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.15s; }
.auth-tab.active { color: var(--ink); font-weight: 500; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row label { margin-bottom: 0; }
.label-link { font-size: 12px; color: var(--link); transition: color 0.12s; }
.label-link:hover { text-decoration: underline; }
.label-links { display: flex; align-items: center; gap: 12px; }
.field input { width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: #FDFCFA; font-size: 14px; color: var(--ink); transition: border 0.15s, box-shadow 0.15s; }
.field input::placeholder { color: #B3AEA5; }
.field input:focus { outline: none; border-color: #9BA08C; box-shadow: 0 0 0 3px rgba(126, 130, 115, 0.15); }
.field input.invalid { border-color: var(--danger); }
.code-row, .pwd-row { display: flex; gap: 8px; }
.code-row input, .pwd-row input { flex: 1; min-width: 0; }
.code-btn { height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: #F2F0EB; color: var(--ink-2); font-size: 13px; white-space: nowrap; flex-shrink: 0; transition: all 0.15s; }
.code-btn:hover:not(:disabled) { border-color: #C9C4BA; color: var(--ink); }
.code-btn:disabled { color: #B3AEA5; cursor: default; }
.form-err { font-size: 12px; color: var(--danger); min-height: 18px; margin: -4px 0 6px; }
.auth-submit { width: 100%; height: 40px; border-radius: 9px; background: var(--accent); color: #FBFAF6; font-size: 14px; font-weight: 500; letter-spacing: 0.2em; transition: background 0.15s; }
.auth-submit:hover { background: var(--accent-strong); }
.auth-switch { text-align: center; font-size: 13px; color: var(--ink-2); margin-top: 14px; }
.link-btn { color: var(--link); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.reset-head { display: flex; align-items: center; gap: 10px; }
.reset-back { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); transition: background 0.12s; }
.reset-back:hover { background: var(--bg-hover); }
.reset-title { font-size: 16px; font-weight: 500; color: var(--ink); }
.reset-sub { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 18px; }
/* 微信扫码登录：入口保留原版图标样式（qr-code 图标框 + 标题/副标题），点击切换出真实二维码面板 */
.qr-section { margin-top: 16px; }
.qr-divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 11.5px; margin-bottom: 12px; }
.qr-divider::before, .qr-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.qr-row { display: flex; align-items: center; gap: 14px; justify-content: center; width: 100%; border: 0; background: transparent; padding: 0; font: inherit; cursor: pointer; text-align: left; }
.qr-row:hover .qr-slot { border-color: #8A9080; }
.qr-slot { width: 76px; height: 76px; border: 1px solid var(--border); border-radius: 10px; background: #FDFCFA; display: grid; place-items: center; color: var(--ink-2); transition: border-color 0.12s; }
.qr-slot svg { width: 30px; height: 30px; }
.qr-title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.qr-sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.qr-panel { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* display:flex 会覆盖 [hidden] 的浏览器默认 display:none，必须显式恢复隐藏语义 */
.qr-panel[hidden] { display: none; }
.qr-frame-wrap { position: relative; width: 260px; height: 300px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #FDFCFA; }
.qr-frame-wrap iframe { width: 100%; height: 100%; border: 0; }
.qr-frame-loading { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--ink-3); background: #FDFCFA; }
.qr-hint { font-size: 12px; color: var(--ink-3); }
.qr-back { font-size: 12px; }
.auth-hint { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--ink-3); text-align: center; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(6px); background: #4A4740; color: #F5F4EF; font-size: 13px; padding: 9px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(30, 28, 24, 0.25); opacity: 0; transition: all 0.22s; pointer-events: none; z-index: 70; max-width: min(80vw, 520px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.has-action { pointer-events: auto; }
.toast-btn { margin-left: 12px; color: #D9DFCB; font-size: 12.5px; text-decoration: underline; flex-shrink: 0; }
.toast-btn:hover { color: #F5F4EF; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .app { --sidebar-w: 218px; }
  .sidebar { width: var(--sidebar-w); }
  .msg-user { max-width: 88%; }
  .msg-ai { max-width: 94%; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .qnav { display: none; }
  .chat-scroll { padding: 16px 14px 6px; }
  .composer { padding: 8px 14px 11px; }
}
/* 宽屏适配：会话列/输入框/提示行随视口逐步放宽（气泡按百分比、表格按内容自适应，随之利用更多横向空间） */
@media (min-width: 1280px) {
  .chat-inner, .input-wrap, .composer-hint { max-width: 860px; }
}
@media (min-width: 1536px) {
  .chat-inner, .input-wrap, .composer-hint { max-width: 960px; }
  .chips { max-width: 560px; }
  /* 宽屏下会话列更宽；表格标的列固定 240px，不随宽屏放宽 */
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* 表格内链接不换行（避免"查看"竖排） */
.b-table td a, .b-table th a { white-space: nowrap; }
.b-table td a.lot-link { white-space: normal; }
