/* QQ 聊天记录工作台 — 浅色主题 */

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e4e7ec;
  --text: #1f2329;
  --text-sub: #8a919f;
  --primary: #2f7cf6;
  --primary-dark: #1f66d8;
  --mine: #2f7cf6;
  --other-bg: #f0f2f5;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 58px; padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  z-index: 10; position: relative;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3a8dff, #1f66d8);
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(47, 124, 246, .35);
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-sub); margin-top: 1px; }

.topbar-center { flex: 1; max-width: 560px; margin: 0 20px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; transition: border .2s, box-shadow .2s;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 124, 246, .12); }
.search-icon { width: 18px; height: 18px; color: var(--text-sub); flex-shrink: 0; }
#global-search { border: none; outline: none; background: transparent; flex: 1; font-size: 14px; color: var(--text); }

.topbar-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 8px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; background: transparent; color: var(--text);
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { border: 1px solid var(--border); background: var(--panel); }
.btn-ghost:hover { background: var(--bg); border-color: #c9ced6; }
.btn-sm { padding: 6px 10px; font-size: 12px; }

/* ---------- 布局 ---------- */
.layout { display: flex; height: calc(100vh - 58px); }

.sidebar {
  width: 280px; min-width: 240px; background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.conv-filter { padding: 12px; border-bottom: 1px solid var(--border); }
.conv-filter input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  outline: none; font-size: 13px; background: var(--bg);
}
.conv-filter input:focus { border-color: var(--primary); }
.conv-list { flex: 1; overflow-y: auto; padding: 8px; }

.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s; margin-bottom: 2px; position: relative;
}
.conv-item:hover { background: var(--bg); }
.conv-item:hover .conv-delete-btn { opacity: 1; }
.conv-item.active { background: #e8f1fe; }
.conv-item.active .conv-delete-btn { opacity: .6; }
.conv-item.active:hover .conv-delete-btn { opacity: 1; }
.conv-delete-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 6px; border: none;
  background: rgba(255,91,91,.12); color: #e5484d;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: all .15s; flex-shrink: 0;
}
.conv-delete-btn:hover { background: #e5484d; color: #fff; opacity: 1; }
.conv-delete-btn svg { width: 14px; height: 14px; }
.conv-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #6aa9ff, #3a7bfd);
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last { font-size: 11px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { text-align: right; flex-shrink: 0; }
.conv-count { font-size: 11px; background: #ff5b5b; color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.conv-group-tag { font-size: 10px; color: var(--text-sub); margin-top: 2px; }

.empty-hint, .stats-empty, .ai-empty { color: var(--text-sub); font-size: 13px; padding: 20px 16px; line-height: 1.7; text-align: center; }

/* ---------- 聊天视图 ---------- */
.chat-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #fbfcfe; position: relative; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-sub); }
.chat-empty .ce-icon { width: 72px; height: 72px; border-radius: 20px; background: #eef2f7; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.chat-empty .ce-icon svg { width: 36px; height: 36px; color: #b8c1cc; }
.chat-empty p { font-size: 15px; }
.chat-empty .sub { font-size: 12px; margin-top: 6px; }

.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.chat-title { font-weight: 700; font-size: 15px; }
.chat-sub { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.chat-actions { margin-left: auto; display: flex; gap: 6px; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 22px; }
.chat-msgs { max-width: 860px; margin: 0 auto; }

.date-sep {
  text-align: center; margin: 18px 0 10px;
}
.date-sep span {
  background: #e8ebf0; color: var(--text-sub); font-size: 11px;
  padding: 3px 12px; border-radius: 12px;
}
.msg-row { display: flex; margin: 8px 0; }
.msg-row.mine { justify-content: flex-end; }
.msg-row.other { justify-content: flex-start; }
.msg-bubble {
  max-width: 68%; padding: 8px 13px; border-radius: 12px;
  line-height: 1.65; font-size: 14px; word-break: break-word; white-space: pre-wrap;
  position: relative;
}
.mine .msg-bubble { background: var(--mine); color: #fff; border-top-right-radius: 3px; }
.other .msg-bubble { background: var(--other-bg); color: var(--text); border-top-left-radius: 3px; }
.msg-sender { font-size: 11px; color: var(--text-sub); margin-bottom: 2px; }
.msg-time { font-size: 10px; color: var(--text-sub); margin-top: 3px; text-align: right; }
.mine .msg-time { color: rgba(255,255,255,.75); }
.msg-sys { text-align: center; font-size: 12px; color: var(--text-sub); margin: 12px 0; }
.msg-load-more { text-align: center; padding: 8px 0 4px; }
.msg-load-more button { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 5px 14px; font-size: 12px; color: var(--text-sub); cursor: pointer; }
.msg-load-more button:hover { color: var(--primary); border-color: var(--primary); }
.hl { background: #ffe08a; border-radius: 3px; padding: 0 1px; }

/* ---------- 右侧面板 ---------- */
.right-panel {
  width: 400px; min-width: 340px; background: var(--panel);
  border-left: 1px solid var(--border); display: flex; flex-direction: column;
}
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab {
  flex: 1; padding: 12px 0; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-sub); cursor: pointer;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.panel-body { flex: 1; overflow-y: auto; }
.tab-page { display: none; height: 100%; }
.tab-page.active { display: block; }

.stats-wrap, .ai-wrap, .search-results { padding: 14px; }
.stat-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat-card { background: var(--bg); border-radius: var(--radius); padding: 12px; }
.stat-card .v { font-size: 20px; font-weight: 800; color: var(--primary); }
.stat-card .k { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.chart-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.chart-box h4 { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; font-weight: 600; }
.chart-row { display: flex; gap: 12px; }
.chart-row .half { flex: 1; min-width: 0; }
.chart-box canvas { width: 100% !important; height: 180px !important; }

/* AI 面板 */
.ai-chat { height: calc(100% - 100px); min-height: 280px; overflow-y: auto; padding: 4px 2px 10px; }
.ai-msg { margin-bottom: 10px; padding: 9px 12px; border-radius: 10px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.ai-user { background: #e8f1fe; color: var(--text); margin-left: 24px; border-top-right-radius: 3px; }
.ai-bot { background: var(--bg); color: var(--text); margin-right: 24px; border-top-left-radius: 3px; }
.ai-tip { background: #fff8e6; color: #8a6d1a; font-size: 12px; }
.ai-input-row { display: flex; gap: 8px; margin-top: 4px; }
.ai-input-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none;
}
.ai-input-row input:focus { border-color: var(--primary); }
.ai-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 16px;
  padding: 4px 12px; font-size: 12px; cursor: pointer; color: var(--text-sub);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }

/* 搜索结果 */
.sr-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: border .15s; }
.sr-item:hover { border-color: var(--primary); }
.sr-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.sr-head b { color: var(--primary); }
.sr-content { font-size: 13px; color: var(--text); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-count { font-size: 12px; color: var(--text-sub); margin-bottom: 10px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  width: 520px; max-width: 92vw; background: var(--panel); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18); padding: 20px 22px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 16px; }
.modal-close { border: none; background: transparent; font-size: 16px; color: var(--text-sub); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }

.dropzone {
  border: 2px dashed #c9d2de; border-radius: 12px; padding: 34px 20px;
  text-align: center; cursor: pointer; transition: all .15s; background: #fafbfd;
}
.dropzone.dragover { border-color: var(--primary); background: #eef4ff; }
.dropzone svg { width: 42px; height: 42px; color: #9aa5b1; margin-bottom: 10px; }
.dropzone p { font-size: 14px; }
.dropzone .link { color: var(--primary); font-weight: 600; }
.dropzone .sub { font-size: 12px; color: var(--text-sub); margin-top: 6px; }

.import-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; background: var(--bg); border-radius: 10px; font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid #d4dae2; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.import-result { margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.7; }
.import-result.ok { background: #e8f8ee; color: #1a7f4b; }
.import-result.warn { background: #fff4e5; color: #9a5b13; }

.format-help { margin-top: 14px; font-size: 12.5px; color: var(--text-sub); }
.format-help summary { cursor: pointer; font-weight: 600; }
.format-help ul { margin: 8px 0 0 18px; line-height: 1.8; }
.format-help .sub { margin-top: 8px; font-size: 11.5px; }

.form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.form input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none;
}
.form input:focus { border-color: var(--primary); }
.form .sub { font-size: 12px; color: var(--text-sub); margin-top: 10px; line-height: 1.7; }
.modal-foot { text-align: right; margin-top: 18px; }

.hidden { display: none !important; }
.sub { color: var(--text-sub); }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d2d8e0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b8c0ca; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 删除按钮 / 危险按钮 ---------- */
.btn-danger { background: #e5484d; color: #fff; }
.btn-danger:hover { background: #c93a3f; }

/* ---------- 弹窗尺寸变体 ---------- */
.modal-sm { width: 400px; max-width: 92vw; }
.modal-lg { width: 680px; max-width: 92vw; }

/* ---------- 删除确认 ---------- */
.delete-warn { text-align: center; padding: 10px 0 6px; }
.delete-warn-icon {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 50%; background: #fff0f0;
  display: flex; align-items: center; justify-content: center;
}
.delete-warn-icon svg { width: 28px; height: 28px; color: #e5484d; }
.delete-warn p { font-size: 14px; }
.delete-warn b { color: var(--text); }

/* ---------- 人格设定弹窗 ---------- */
.persona-info { padding: 0 0 4px; }
.persona-tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.persona-tag {
  background: var(--bg); border: 1px solid var(--border); border-radius: 16px;
  padding: 4px 12px; font-size: 12px; color: var(--text-sub);
}
.persona-tag b { color: var(--text); font-weight: 600; }
.persona-tag#pp-mode { color: var(--primary); border-color: var(--primary); background: #e8f1fe; }
.persona-prompt {
  background: #1e2329; color: #d4d7de; border-radius: 10px;
  padding: 14px 16px; font-size: 12.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word; max-height: 400px;
  overflow-y: auto; font-family: "SF Mono", "Consolas", "Monaco", monospace;
}
.persona-prompt::-webkit-scrollbar-thumb { background: #4a4f5a; }
.persona-prompt::-webkit-scrollbar-track { background: transparent; }

/* ---------- 提取人设弹窗 ---------- */
.extract-body { max-height: 60vh; overflow-y: auto; }
.extract-loading { display: flex; align-items: center; gap: 12px; padding: 30px 0; justify-content: center; color: var(--text-sub); font-size: 14px; }
.extract-mode-tag { display: inline-block; font-size: 11px; padding: 2px 10px; border-radius: 12px; margin-bottom: 14px; }
.extract-mode-tag.llm { background: #e8f1fe; color: #1f66d8; }
.extract-mode-tag.local { background: #f0f2f5; color: #8a919f; }
.extract-note { font-size: 12px; color: var(--text-sub); line-height: 1.6; margin-bottom: 16px; }

/* ---------- 提取方式选择器 ---------- */
.extract-chooser { display: flex; gap: 12px; padding: 6px 0 10px; }
.extract-choice { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--panel); cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; text-align: center; font-family: inherit; }
.extract-choice:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 14px rgba(47, 124, 246, .12); }
.extract-choice.disabled { opacity: .5; cursor: not-allowed; }
.extract-choice.disabled:hover { transform: none; box-shadow: none; border-color: var(--border); }
.ec-icon { font-size: 30px; line-height: 1; }
.ec-title { font-weight: 700; font-size: 15px; color: var(--text); }
.ec-desc { font-size: 12px; color: var(--text-sub); line-height: 1.6; }

/* ---------- 深度提取进度 ---------- */
.extract-progress { margin-top: 6px; }
.extract-progress-bar { height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.extract-progress-fill { height: 100%; background: linear-gradient(90deg, #2f7cf6, #6aa9ff); border-radius: 5px; transition: width .4s ease; }
.extract-progress-meta { margin-top: 7px; font-size: 12px; color: var(--text-sub); text-align: center; }
.extract-deep-meta { font-size: 12px; color: #1f66d8; background: #e8f1fe; border-radius: 8px; padding: 5px 10px; margin-bottom: 10px; display: inline-block; }

.persona-card { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.persona-card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.persona-card-head .pc-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; color: #fff; }
.persona-card-head .pc-avatar.a { background: linear-gradient(135deg, #6aa9ff, #3a7bfd); }
.persona-card-head .pc-avatar.b { background: linear-gradient(135deg, #f5a623, #e8830f); }
.persona-card-head .pc-name { font-weight: 700; font-size: 15px; }
.persona-card-head .pc-stat { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.persona-card-body { padding: 14px 16px; }
.pc-section { margin-bottom: 12px; }
.pc-section-title { font-size: 12px; font-weight: 600; color: var(--text-sub); margin-bottom: 6px; }
.pc-trait-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-trait { background: #f0f4ff; color: #2f6bd8; border-radius: 8px; padding: 3px 10px; font-size: 12px; }
.pc-style-list { list-style: none; padding: 0; }
.pc-style-list li { font-size: 12.5px; color: var(--text); line-height: 1.7; padding-left: 14px; position: relative; }
.pc-style-list li::before { content: '·'; position: absolute; left: 4px; color: var(--text-sub); }
.pc-words { display: flex; flex-wrap: wrap; gap: 5px; }
.pc-word { background: #fff4e5; color: #9a5b13; border-radius: 6px; padding: 2px 8px; font-size: 12px; }
.pc-prompt-toggle { width: 100%; border: 1px dashed var(--border); background: #fafbfd; border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--primary); cursor: pointer; margin-top: 6px; text-align: left; font-weight: 600; }
.pc-prompt-toggle:hover { background: #eef4ff; border-color: var(--primary); }
.pc-prompt-box { background: #1e2329; color: #d4d7de; border-radius: 8px; padding: 12px 14px; font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; max-height: 300px; overflow-y: auto; font-family: "SF Mono", "Consolas", "Monaco", monospace; margin-top: 8px; }
.pc-prompt-box::-webkit-scrollbar-thumb { background: #4a4f5a; }
.pc-prompt-actions { display: flex; gap: 8px; margin-top: 8px; }
.pc-copy-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 4px 12px; font-size: 12px; cursor: pointer; color: var(--text-sub); }
.pc-copy-btn:hover { border-color: var(--primary); color: var(--primary); }

.extract-divider { text-align: center; color: var(--text-sub); font-size: 12px; margin: 16px 0; position: relative; }
.extract-divider::before, .extract-divider::after { content: ''; position: absolute; top: 50%; width: calc(50% - 40px); height: 1px; background: var(--border); }
.extract-divider::before { left: 0; }
.extract-divider::after { right: 0; }

.extract-combined { margin-top: 8px; }
.extract-combined-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }

/* ---------- 登录/注册页 ---------- */
.auth-view {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f0fe 0%, #f4f6f9 50%, #eef2f7 100%);
}
.auth-card {
  width: 400px; max-width: 92vw; background: #fff; border-radius: 16px;
  padding: 36px 32px; box-shadow: 0 8px 32px rgba(16,24,40,.12);
}
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo { margin: 0 auto 12px; }
.auth-logo h1 { font-size: 20px; font-weight: 700; }
.auth-logo p { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.auth-tabs { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 10px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text-sub); cursor: pointer; transition: all .15s;
}
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.auth-form input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,124,246,.12); }
.auth-error { background: #fff0f0; color: #e5484d; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 12px 0; }
.auth-submit { width: 100%; margin-top: 16px; padding: 11px; font-size: 15px; justify-content: center; }
.auth-hint { font-size: 12px; color: var(--text-sub); margin-top: 14px; line-height: 1.6; text-align: center; }

/* ---------- 用户菜单 ---------- */
.user-menu { position: relative; }
.user-btn { gap: 8px; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6aa9ff, #3a7bfd);
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1); min-width: 120px; z-index: 20;
}
.user-dropdown button {
  width: 100%; padding: 10px 16px; border: none; background: transparent;
  font-size: 13px; cursor: pointer; text-align: left; color: var(--text);
}
.user-dropdown button:hover { background: var(--bg); border-radius: 8px; }

/* ---------- 管理员 ---------- */
.admin-badge {
  font-size: 9px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(135deg, #f6a821, #e8860a); color: #fff;
  padding: 2px 5px; border-radius: 4px; margin-left: 2px;
}
.as-user-banner {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: linear-gradient(90deg, #fff7e8, #ffe9c7); color: #7a4a00;
  font-size: 13px; padding: 6px 12px; border-bottom: 1px solid #f3d9a8;
}
.as-user-banner .btn { background: #fff; border: 1px solid #e8c98f; color: #7a4a00; font-size: 12px; padding: 3px 10px; }
.as-user-banner .btn:hover { background: #fff3de; }

.am-body { padding: 4px 2px; max-height: 62vh; overflow-y: auto; }
.am-hint {
  font-size: 12px; color: var(--text-sub); background: var(--bg);
  border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px;
}
.am-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.am-table th, .am-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.am-table th { color: var(--text-sub); font-weight: 600; font-size: 12px; background: #fafbfc; }
.am-table tr:hover td { background: #f7f9fc; }
.am-actions { white-space: nowrap; }
.am-actions .pl-btn { margin-right: 6px; }
.am-me { color: var(--text-sub); font-size: 11px; margin-left: 4px; font-weight: 400; }
.am-none { color: #c0c6cf; font-size: 12px; }

/* ---------- 人格对话面板 ---------- */
.persona-chat-wrap { display: flex; flex-direction: column; height: 100%; }
.pc-session-bar { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.pc-session-select {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
.pc-session-select:focus { border-color: var(--primary); }
.pc-chat-area { flex: 1; overflow-y: auto; padding: 14px; }
.pc-chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-sub); text-align: center; }
.pc-chat-empty p { font-size: 15px; }
.pc-chat-empty .sub { font-size: 12px; margin-top: 6px; line-height: 1.6; max-width: 260px; }
.pc-chat-welcome { text-align: center; color: var(--primary); font-size: 13px; padding: 20px; background: #e8f1fe; border-radius: 10px; margin-bottom: 12px; }
.pc-msg { margin-bottom: 10px; }
.pc-msg.user { text-align: right; }
.pc-msg-name { font-size: 11px; color: var(--text-sub); margin-bottom: 3px; }
.pc-msg-bubble {
  display: inline-block; max-width: 80%; padding: 8px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; text-align: left;
}
.pc-msg.user .pc-msg-bubble { background: var(--mine); color: #fff; border-top-right-radius: 3px; }
.pc-msg.bot .pc-msg-bubble { background: var(--other-bg); color: var(--text); border-top-left-radius: 3px; }
.pc-msg-bubble.pc-thinking { color: var(--text-sub); font-style: italic; }
.pc-input-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }
.pc-input-row input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none;
}
.pc-input-row input:focus { border-color: var(--primary); }

/* ---------- 人设库弹窗 ---------- */
.pl-body { max-height: 60vh; overflow-y: auto; }
.pl-empty { color: var(--text-sub); font-size: 13px; text-align: center; padding: 40px 20px; }
.pl-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; transition: border .15s;
}
.pl-item:hover { border-color: var(--primary); }
.pl-item-info { flex: 1; min-width: 0; }
.pl-item-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.pl-mode { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; }
.pl-mode.llm { background: #e8f1fe; color: #1f66d8; }
.pl-mode.local { background: #f0f2f5; color: #8a919f; }
.pl-item-sub { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.pl-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pl-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--text-sub); }
.pl-btn:hover { border-color: var(--primary); color: var(--primary); }
.pl-btn-danger:hover { border-color: #e5484d; color: #e5484d; }

/* ---------- 可编辑提示词文本框 ---------- */
.pc-edit-area {
  width: 100%; background: #1e2329; color: #d4d7de; border: 1px solid #3a3f4a; border-radius: 8px;
  padding: 12px 14px; font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  font-family: "SF Mono", "Consolas", "Monaco", monospace; resize: vertical; margin-top: 8px; outline: none;
}
.pc-edit-area:focus { border-color: var(--primary); }
.pc-edit-btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 4px 12px; font-size: 12px; cursor: pointer; color: var(--primary); }
.pc-edit-btn:hover { background: #eef4ff; }
.pc-save-btn { border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: 6px; padding: 5px 14px; font-size: 12px; cursor: pointer; font-weight: 600; }
.pc-save-btn:hover { background: var(--primary-dark); }

/* ---------- 新建对话会话弹窗 ---------- */
.ns-select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; outline: none; background: #fff;
}
.ns-select:focus { border-color: var(--primary); }
.ns-role-row { display: flex; gap: 16px; margin-top: 4px; }
.ns-role { display: flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; font-weight: normal; margin: 0; }
.ns-role input { margin: 0; }
