/* ============================================================
   教培咨询助手 — 样式
   ============================================================ */
:root {
  --primary: #3b6cf6;
  --primary-dark: #2f57d6;
  --primary-soft: #eef2ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e5e8f0;
  --text: #1f2430;
  --text-2: #6b7280;
  --danger: #e5484d;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(30, 41, 59, 0.08);
}
* { box-sizing: border-box; }
/* 关键修复：确保 hidden 属性始终生效，防止 display:flex 等规则覆盖它
   （否则设置弹窗等元素永远关不掉） */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: #f1f3f9;
  color: var(--text);
  padding: 9px 14px;
  font-size: 14px;
  transition: background .15s, color .15s, border-color .15s;
}
button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-dark); }
button:disabled { opacity: .5; cursor: not-allowed; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d8e3; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #b9c0cf; }

/* ---------- 布局 ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- 侧栏（抽屉，从左侧滑出） ---------- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 264px;
  transform: translateX(-100%);
  transition: transform .25s ease;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  z-index: 30;
  box-shadow: none;
}
body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 0 10px 40px rgba(15, 23, 42, 0.2); }
body.sidebar-open .mask { display: block; }
.mask { display: none; }

/* 电脑端：边栏打开时聊天区右移（不遮挡、无遮罩），可边看列表边对话 */
@media (min-width: 761px) {
  body.sidebar-open .mask { display: none; }
  body.sidebar-open .main { margin-left: 264px; }
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px;
  padding: 4px 6px 14px;
  cursor: pointer;
}
.brand-name { flex: 1; line-height: 1.35; word-break: break-all; }
.brand-ico {
  flex: 0 0 auto;
  background: transparent; border: none;
  color: #b6bcc9;
  padding: 5px; border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-ico svg { display: block; }
.brand-ico:hover { background: #f1f3f9; color: var(--text); }
.brand-close { margin-left: auto; }
.brand .logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b8cff, #3b6cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex: 0 0 34px;
}
.btn-new {
  width: 100%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  border: 1px solid #dbe4ff;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 14px;
  border-radius: 12px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .15s;
}
.btn-new:hover {
  background: #e2e9ff; border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(59, 108, 246, 0.18);
  transform: translateY(-1px);
}
.btn-new svg { display: block; }
.conv-list { flex: 1; overflow-y: auto; margin-top: 10px; }
.conv-empty { padding: 24px 10px; text-align: center; color: #9aa1ae; font-size: 13px; }
.conv-group { font-size: 12px; color: #9aa1ae; padding: 12px 10px 4px; user-select: none; }
#topSearch {
  width: 180px;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  outline: none;
  background: #f8f9fc;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
#topSearch:focus { border-color: var(--primary); background: #fff; }
@media (max-width: 720px) { #topSearch { width: 130px; } }
.sidebar-collapse-btn {
  margin-left: auto; flex: 0 0 auto;
  background: transparent; border: none;
  color: #b6bcc9; font-size: 13px;
  padding: 4px 8px; border-radius: 8px;
  cursor: pointer;
}
.sidebar-collapse-btn:hover { background: #f1f3f9; color: var(--text); }
/* 侧栏对话：置顶后极简左侧高亮（无 emoji） */
.conv-item.pinned { box-shadow: inset 3px 0 0 var(--primary); }
.conv-more {
  border: none; background: transparent; color: #b6bcc9;
  cursor: pointer; padding: 2px 6px; border-radius: 6px; line-height: 0;
  opacity: 0; transition: opacity .12s, background .12s; flex: 0 0 auto;
}
.conv-item:hover .conv-more, .conv-item.active .conv-more { opacity: 1; }
.conv-more:hover { background: #eceff5; color: var(--text); }
/* 右键菜单（极简，无 emoji） */
.ctx-menu {
  position: fixed; z-index: 1000;
  min-width: 132px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,24,40,.12);
  padding: 6px;
}
.ctx-item {
  display: block; width: 100%; text-align: left;
  border: none; background: transparent;
  padding: 8px 10px; border-radius: 7px;
  color: var(--text); cursor: pointer; font-size: 13px; line-height: 1;
}
.ctx-item:hover { background: var(--primary-soft); color: var(--primary-dark); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: #fdecec; color: var(--danger); }
body.sidebar-collapsed .sidebar { display: none; }
/* 窄条模式（默认：logo + 三个线条图标） */
.sidebar { width: 264px; flex: 0 0 264px; }
body.sidebar-rail .sidebar { width: 64px; flex: 0 0 64px; }
.rail { display: none; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; height: 100%; }
body.sidebar-rail .rail { display: flex; }
body.sidebar-rail .sidebar-full { display: none; }
.rail-logo {
  width: 38px; height: 38px; margin-bottom: 12px;
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.rail-logo img { width: 100%; height: 100%; object-fit: contain; }
.rail-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: transparent; border: none;
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.rail-btn:hover { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-expand {
  position: fixed; left: 14px; top: 12px; z-index: 25;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px; font-size: 13px;
  box-shadow: var(--shadow); cursor: pointer;
  display: none;
}
body.sidebar-collapsed .sidebar-expand { display: inline-flex; align-items: center; gap: 6px; }
.sidebar-expand:hover { border-color: var(--primary); color: var(--primary-dark); }
.conv-item {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 2px;
  font-size: 14px;
  color: var(--text-2);
}
.conv-item:hover { background: #f1f3f9; }
.conv-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 旧版内联按钮样式已移除，置顶/重命名/删除改到右键菜单（ctx-menu） */
.conv-rename-input {
  flex: 1; min-width: 0;
  font-size: 14px; font-family: inherit;
  border: 1px solid var(--primary); border-radius: 6px;
  padding: 2px 6px; outline: none; background: #fff; color: var(--text);
}
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 10px; }
.btn-foot { width: 100%; background: transparent; text-align: left; }
.btn-foot:hover { background: #f1f3f9; }
.ver { text-align: center; font-size: 11.5px; color: #aab0bd; margin-top: 8px; user-select: none; }
.conv-tools { display: flex; gap: 6px; }
.conv-tools button { flex: 1; padding: 7px 4px; font-size: 12px; background: #f1f3f9; }
.conv-tools button:hover { background: var(--primary-soft); color: var(--primary-dark); }
/* 消息操作按钮（悬停显示） */
.msg-acts { display: flex; gap: 2px; margin-top: 2px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-acts, .msg-acts:focus-within { opacity: 1; }
.msg-act {
  background: transparent; border: none;
  font-size: 13px; color: #b6bcc9;
  padding: 4px; border-radius: 8px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.msg-act svg { display: block; }
.msg-act:hover { background: #f1f3f9; color: var(--text); }
.msg-act.rated-good { color: #1e9e63; background: #e5f5ec; }
.msg-act.rated-bad { color: #e5484d; background: #fdecec; }

/* 轻提示 */
.toast {
  position: fixed; top: 18%; left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
}

.mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 20;
  display: none;
}

/* ---------- 主区域 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  position: relative;
}
/* 顶栏对话标题：对话模式下占据中间（☰ 与 ✕ 等宽，标题水平居中），flex 流不与按钮重叠 */
.topbar-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 14px; color: var(--text);
  text-align: center;
  display: none; /* 由 JS 控制：对话模式才显示 */
}
@media (max-width: 760px) { .topbar-title { font-size: 13.5px; } }
.topbar-logo {
  width: 36px; height: 36px;
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  margin-right: 6px;
  flex: 0 0 36px;
}
.topbar-logo img { width: 100%; height: 100%; object-fit: contain; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: transparent;
  font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.icon-btn:hover { background: #f1f3f9; }
#btnMenu { display: inline-flex; }
.key-warn {
  font-size: 12px; color: #b45309;
  background: #fef3c7;
  padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}

/* ---------- 消息区（豆包风格） ---------- */
.chat { flex: 1; overflow-y: auto; padding: 18px 16px 10px; }

/* 消息行：AI 带头像居左，用户气泡居右 */
.msg { display: flex; gap: 10px; margin-bottom: 20px; }
.msg.user { justify-content: flex-end; align-items: flex-end; max-width: 82%; margin-left: auto; }
.msg.ai { justify-content: flex-start; align-items: flex-start; }

/* AI 头像 */
.msg-avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b8cff, #3b6cf6);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(59, 108, 246, 0.25);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* 消息内容列 */
.msg-content {
  max-width: min(660px, 82%);
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0;
}

.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.8;
  font-size: 15px;
  max-width: 100%;
  word-break: break-word;
  white-space: normal;
}
/* 用户：右侧渐变气泡（豆包风格） */
.msg.user .bubble {
  background: linear-gradient(135deg, #4a7bff, #3b6cf6);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(59, 108, 246, 0.22);
}
/* AI：无气泡卡片，头像 + 纯文字（豆包风格） */
.msg.ai .bubble {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 2px 0;
  font-size: 15.5px;
}

/* Markdown 内容 */
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble pre {
  background: #0f172a; color: #e2e8f0;
  padding: 12px; border-radius: 10px;
  overflow-x: auto; font-size: 13px; line-height: 1.6;
}
.bubble code { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; }
.bubble :not(pre) > code {
  background: #eef1f6; padding: 2px 6px; border-radius: 6px; font-size: 13px;
}
.bubble ul, .bubble ol { margin: 6px 0; padding-left: 22px; }
.bubble blockquote {
  margin: 8px 0; padding: 6px 12px;
  border-left: 3px solid var(--primary);
  background: #f8faff; color: var(--text-2);
  border-radius: 0 8px 8px 0;
}
.bubble table { border-collapse: collapse; margin: 8px 0; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 6px 10px; }
.bubble h1, .bubble h2, .bubble h3 { margin: 10px 0 6px; line-height: 1.4; }
.bubble a { color: var(--primary); }

/* 图片消息 */
.msg-media {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px; margin-bottom: 6px;
  max-width: 100%;
}
.msg-img {
  max-width: 260px; max-height: 240px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: zoom-in;
}
.ocr-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-2);
  width: 100%;
}
.ocr-box summary { cursor: pointer; }
.ocr-box pre {
  margin: 8px 0 0;
  white-space: pre-wrap; word-break: break-all;
  max-height: 200px; overflow-y: auto;
  font-family: inherit; font-size: 13px;
  color: var(--text);
}

/* 思考过程（R1） */
.reasoning {
  background: #fff8e6;
  border: 1px solid #f5e3b3;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: #8a6d1f;
  margin-bottom: 6px;
  max-width: 100%;
}
.reasoning summary { cursor: pointer; }
.reasoning-body {
  white-space: pre-wrap; word-break: break-word;
  max-height: 240px; overflow-y: auto;
  margin-top: 6px; font-size: 12.5px;
  color: #7a6218;
}

.cursor { display: inline-block; animation: blink 1s steps(1) infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 空状态 ---------- */
.empty-state { max-width: 560px; margin: 7vh auto 0; text-align: center; padding: 0 16px; }
.empty-logo { font-size: 54px; }
.empty-state p { color: var(--text-2); line-height: 1.75; font-size: 14.5px; }
.chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  color: var(--primary-dark);
}
.chip:hover { background: var(--primary-soft); border-color: var(--primary); }
.hint { font-size: 12.5px; color: #9aa1ae; }

/* ---------- 图片识别草稿面板 ---------- */
.draft {
  max-width: 820px; margin: 0 auto 10px; width: calc(100% - 36px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.draft-head {
  font-weight: 600; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-bottom: 10px;
}
.draft-status { font-weight: 400; font-size: 12.5px; color: var(--text-2); text-align: right; }
.draft-body { display: flex; gap: 12px; }
.draft-body img {
  max-width: 150px; max-height: 200px;
  border-radius: 10px; object-fit: contain;
  border: 1px solid var(--border);
}
.draft-right { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.draft-right textarea, .draft-right input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.draft-right textarea { min-height: 110px; resize: vertical; }
.draft-right input:focus, .draft-right textarea:focus { border-color: var(--primary); }
.draft-actions { display: flex; justify-content: flex-end; gap: 8px; }
.progress { height: 6px; background: #eef1f6; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #5b8cff, #3b6cf6);
  border-radius: 999px;
  transition: width .2s;
}

/* ---------- 输入区 ---------- */
.composer {
  max-width: 820px; width: calc(100% - 36px);
  margin: 0 auto;
  padding: 6px 0 18px;
  display: flex; gap: 8px; align-items: flex-end;
}
.composer textarea {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  max-height: 160px;
  background: #f2f4f8;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.composer textarea:focus {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.14);
}
.composer-btn {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%;
  background: #f2f4f8;
  border: 1px solid transparent;
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.composer-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.voice-pad {
  flex: 1; height: 46px;
  border: 1px solid var(--border); border-radius: 23px;
  background: var(--card); font-size: 15px; color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  user-select: none; touch-action: none;
}
.voice-pad:hover { border-color: var(--primary); }
.voice-pad.recording { background: var(--danger); color: #fff; border-color: var(--danger); }
body.voice-mode .composer textarea,
body.voice-mode #btnUpload,
body.voice-mode #btnSend { display: none; }
@keyframes voicePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.voice-status {
  max-width: 820px; width: calc(100% - 36px);
  margin: 0 auto;
  padding: 6px 14px;
  background: #fff3e0;
  border: 1px solid #ffd591;
  border-radius: 10px;
  font-size: 13.5px;
  color: #ad6800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.send {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7bff, #3b6cf6);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 108, 246, 0.30);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.send:hover { background: linear-gradient(135deg, #3f6ef0, #2f57d6); color: #fff; box-shadow: 0 5px 16px rgba(59, 108, 246, 0.38); }
.send:disabled { background: #d9dee9; color: #fff; box-shadow: none; }
.send.stop { background: var(--danger); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(229, 72, 77, 0.30); }
.send.stop:hover { background: #cf3f44; }

/* ---------- 设置弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: var(--card);
  border-radius: 20px;
  padding: 22px 24px;
  width: 100%; max-width: 680px;
  max-height: 88vh;
  overflow: hidden; /* 滚动交给 modal-body，标题栏固定不滚 */
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.3);
  display: flex; flex-direction: column;
}
.modal-body { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -24px; padding: 0 24px; }
.modal h2 {
  margin: 0 0 16px; font-size: 18px;
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 12px;
  border-bottom: 1px solid var(--border);
  position: relative; flex: 0 0 auto; /* 标题栏固定，不随内容滚动 */
}
.modal-close {
  position: absolute; right: 0; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f4f6fb;
  color: var(--text-2);
  font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.modal-close:hover { background: #fdecec; color: var(--danger); border-color: var(--danger); }
.modal label {
  display: block; margin-bottom: 14px;
  font-size: 13.5px; color: var(--text-2); font-weight: 600;
}
.modal label > * { display: block; margin-top: 6px; width: 100%; font-weight: 400; }
.modal input, .modal select, .modal textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.12); }
.modal textarea { resize: vertical; min-height: 130px; }
.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.spacer { flex: 1; }
.key-hint { font-size: 12px; color: var(--danger); min-height: 16px; margin-top: 2px; line-height: 1.5; }
.logo-upload { margin-bottom: 14px; font-size: 13.5px; color: var(--text-2); }
.logo-upload-title { margin-bottom: 6px; }
.logo-upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.logo-upload-row input[type="file"] { font-size: 12.5px; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; max-width: 220px; }
.brand .logo img { width: 100%; height: 100%; border-radius: 10px; object-fit: contain; }
.empty-logo img { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; }
/* 访客对话日志 */
.log-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #fbfcfe; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; color: var(--text); }
.log-actions button { padding: 4px 10px; font-size: 12px; }
.log-stats { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.log-box { max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.log-empty { text-align: center; color: #9aa1ae; font-size: 13px; padding: 14px; }
.log-entry { border-bottom: 1px dashed var(--border); padding: 8px 2px; font-size: 13px; }
.log-entry:last-child { border-bottom: none; }
.log-meta { color: var(--text-2); font-size: 12px; margin-bottom: 3px; }
.log-user { margin-bottom: 3px; word-break: break-all; line-height: 1.6; }
.log-reply summary { cursor: pointer; color: var(--primary-dark); font-size: 12.5px; }
.log-reply div { white-space: pre-wrap; word-break: break-word; margin-top: 4px; max-height: 160px; overflow-y: auto; font-size: 12.5px; color: var(--text); }
.log-error { color: var(--danger); font-size: 12.5px; }
/* 技能库 */
.skills-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #fbfcfe; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.skills-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: 13.5px; color: var(--text); }
.skills-head button { padding: 4px 10px; font-size: 12px; }
.skills-list { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.skill-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; }
.skill-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.skill-enable { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.skill-enable input { width: auto; margin: 0; }
.skill-top input[data-role="name"] { flex: 1; min-width: 140px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-family: inherit; outline: none; }
.skill-top input[data-role="name"]:focus { border-color: var(--primary); }
.skill-item input.skill-desc { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; font-family: inherit; outline: none; margin-bottom: 6px; color: var(--text-2); }
.skill-item input.skill-desc:focus { border-color: var(--primary); color: var(--text); }
.skill-top button[data-role="del"] { padding: 5px 10px; font-size: 12px; background: #fdecec; color: var(--danger); }
.skill-top button[data-role="del"]:hover { background: #f8d7d7; }
.skill-item textarea[data-role="content"] { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; min-height: 70px; resize: vertical; outline: none; }
.skill-item textarea[data-role="content"]:focus { border-color: var(--primary); }
/* 知识库 */
.kb-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #fbfcfe; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.kb-head { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 8px; }
.kb-upload-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.kb-upload-row select { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font-size: 13px; font-family: inherit; background: #fff; }
.kb-upload-row button { padding: 6px 12px; font-size: 13px; }
.kb-cats { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.kb-cat { border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fff; }
.kb-cat-name { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.kb-empty { font-size: 12.5px; color: #9aa1ae; padding: 4px 2px; }
.kb-file { display: flex; align-items: center; gap: 8px; padding: 5px 2px; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kb-file:last-child { border-bottom: none; }
.kb-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-file-meta { color: #9aa1ae; font-size: 12px; }
.kb-del { padding: 3px 8px; font-size: 12px; background: #fdecec; color: var(--danger); }
.kb-del:hover { background: #f8d7d7; }
#kbEditor { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; background: #fff; }
#kbEditor input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; margin-bottom: 6px; outline: none; }
#kbEditor input:focus { border-color: var(--primary); }
#kbEditor textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; font-family: inherit; min-height: 140px; resize: vertical; outline: none; }
#kbEditor textarea:focus { border-color: var(--primary); }
/* 首页装修 */
.hp-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #fbfcfe; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.hp-head { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 8px; }
.hp-canvas {
  position: relative; height: 240px;
  background-color: #eef1f8;
  background-size: cover; background-position: center;
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 8px;
}
.hp-canvas-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9aa1ae; font-size: 13px; text-align: center; padding: 10px; }
.hp-item { position: absolute; cursor: move; border: 2px dashed transparent; border-radius: 4px; user-select: none; touch-action: none; }
.hp-item.selected { border-color: var(--primary); background: rgba(59,108,246,.08); }
.hp-controls { display: flex; flex-direction: column; gap: 8px; }
.hp-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.hp-row button { padding: 5px 10px; font-size: 12.5px; }
.hp-row input[type="range"] { flex: 1; min-width: 120px; }
/* 访客首页（DeepSeek 风格：无边框卡片，logo + 三个功能图标） */
.empty-state {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  text-align: center;
}
.ds-wrap {
  position: relative;
  width: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background-size: cover; background-position: center;
}
.empty-state .empty-logo { font-size: 84px; line-height: 1; margin-bottom: clamp(6px, 1.6vh, 14px); position: relative; z-index: 1; }
/* logo 按原图比例显示：横幅图宽度撑满 420、方形/竖版图高度不超过 320 */
.empty-state .empty-logo img {
  max-width: min(420px, 85vw);
  max-height: 320px;
  width: auto; height: auto;
  border-radius: 6%;
  object-fit: contain;
}
.empty-state h1 { font-size: 24px; margin: 0 0 12px; font-weight: 700; position: relative; z-index: 1; }
.empty-state p { color: var(--text-2); font-size: 14.5px; line-height: 1.8; max-width: 520px; margin: 0 0 clamp(8px, 1.8vh, 16px); position: relative; z-index: 1; }
.feat-chips { display: flex; gap: clamp(6px, 1.5vw, 12px); justify-content: center; flex-wrap: wrap; margin-bottom: clamp(2px, 0.8vh, 6px); position: relative; z-index: 1; }
.feat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  color: var(--text-2);
  font-size: 13.5px;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.feat-chip:hover {
  background: var(--primary-soft); color: var(--primary-dark);
  border-color: #c9d6ff;
  box-shadow: 0 4px 14px rgba(59, 108, 246, 0.16);
  transform: translateY(-1px);
}
.hero-item { position: absolute; user-select: none; pointer-events: none; max-width: none; z-index: 0; }
#testResult { font-size: 13px; margin-top: 12px; color: var(--text-2); white-space: pre-wrap; word-break: break-all; }
input[type="range"] { accent-color: var(--primary); padding: 0; }

/* 访客访问码门禁 */
.gate { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.gate-box { background: var(--card); border-radius: 20px; padding: 28px 26px 24px; width: 100%; max-width: 340px; box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3); }
.gate-mascot { font-size: 52px; line-height: 1.2; text-align: center; margin-bottom: 4px; animation: gateFloat 3s ease-in-out infinite; }
@keyframes gateFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.gate-title { font-weight: 700; font-size: 18px; margin-bottom: 4px; text-align: center; }
.gate-sub { font-size: 12.5px; color: var(--text-2); text-align: center; margin-bottom: 16px; line-height: 1.6; }
.gate-box input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: inherit; outline: none; margin-bottom: 8px; text-align: center; letter-spacing: 2px; }
.gate-box input:focus { border-color: var(--primary); }
.gate-btn { min-height: 44px; font-size: 15px; border-radius: 12px; cursor: pointer; }
.key-warn-banner { background: #fdecec; border: 1px solid #f5c6c7; color: var(--danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; line-height: 1.6; }

/* ---------- 响应式（手机自适应） ---------- */
@media (max-width: 760px) {
  .draft-body { flex-direction: column; }
  .draft-body img { max-width: 100%; max-height: 160px; }
  .topbar {
    padding: 8px 10px;
    position: sticky; top: 0; z-index: 10;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  }
  .chat { padding: 12px 10px 6px; }
  .msg { gap: 8px; margin-bottom: 16px; }
  .msg-avatar { width: 32px; height: 32px; flex: 0 0 32px; font-size: 16px; }
  .msg-content { max-width: 78%; }
  .msg.user { max-width: 88%; }
  .bubble { font-size: 15px; line-height: 1.75; padding: 10px 14px; }
  .msg.ai .bubble { font-size: 15px; padding: 2px 0; }
  .composer {
    width: 100%; padding: 8px 10px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    gap: 8px;
    align-items: flex-end;
  }
  .composer textarea {
    font-size: 16px; padding: 12px 16px; border-radius: 24px;
    background: #f2f4f8; border-color: transparent;
    box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: border-color .15s, background .15s, box-shadow .15s;
  }
  .composer textarea:focus {
    background: #fff; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 108, 246, 0.14);
  }
  .composer-btn, .send { width: 42px; height: 42px; flex: 0 0 42px; }
  .composer-btn { background: #f2f4f8; border-color: transparent; }
  .send {
    background: linear-gradient(135deg, #4a7bff, #3b6cf6);
    border: none; color: #fff;
    box-shadow: 0 4px 12px rgba(59, 108, 246, 0.30);
  }
  .send:hover { color: #fff; background: linear-gradient(135deg, #4a7bff, #3b6cf6); }
  .send:disabled { background: #d9dee9; color: #fff; box-shadow: none; }
  .send.stop { background: var(--danger); box-shadow: 0 4px 12px rgba(229, 72, 77, 0.30); }
  .voice-status { width: calc(100% - 20px); }
  .empty-state { margin-top: 0; padding: 5vh 14px 0; align-items: flex-start; justify-content: flex-start; }
  .empty-state .empty-logo { margin-bottom: 5vh; } /* 手机端：logo 与下方描述间隔拉大 */
  .empty-state .empty-logo img { max-width: min(280px, 85vw); max-height: 200px; width: auto; height: auto; border-radius: 6%; }
  .reasoning { max-width: 100%; }
  .msg-acts { opacity: 1; } /* 触屏无悬停，按钮常显 */
  /* 键盘弹起：输入条固定贴到键盘上方（顶栏与消息区保持原位，不整体上抬） */
  body.kb-up .composer {
    position: fixed; left: 0; right: 0;
    bottom: var(--kb-h, 0px);
    width: 100%; max-width: none; margin: 0;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.07);
    border-radius: 0;
    z-index: 25;
    transition: bottom .18s ease;
  }
  body.kb-up .chat { padding-bottom: 92px; } /* 最后一条消息让位，不被输入条遮挡 */
  /* 手机端门禁登录页：大触控目标 + 防 iOS 聚焦缩放(字号16px) */
  .gate { padding: 20px; }
  .gate-box { border-radius: 26px; padding: 34px 22px 30px; max-width: 400px; }
  .gate-mascot { font-size: 64px; margin-bottom: 6px; }
  .gate-title { font-size: 20px; }
  .gate-sub { font-size: 13px; margin-bottom: 20px; }
  .gate-box input { font-size: 16px; padding: 14px 12px; border-radius: 13px; margin-bottom: 10px; min-height: 50px; }
  .gate-btn { min-height: 50px; font-size: 16px; border-radius: 14px; margin-top: 4px; }
}

/* 小屏微调 */
@media (max-width: 380px) {
  .composer-btn { display: none; } /* 极小屏收起上传/语音按钮，保持输入框空间 */
}

/* ============================================================
   消息动画 / 打字指示 / 快捷提问 / 数据卡片
   ============================================================ */
/* 新消息淡入上滑 */
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg-enter { animation: msgIn .28s ease both; }

/* AI 回复前的三个跳动点 */
.dots { display: inline-flex; gap: 5px; align-items: center; padding: 6px 2px; }
.dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: #8f9bc0;
  animation: dotPulse 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes dotPulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) {
  .msg-enter { animation: none; }
  .dots span { animation: none; }
}

/* 发送按钮按压微交互 */
.send:active { transform: scale(.9); }
.composer textarea { transition: height .15s ease, border-color .15s, background .15s, box-shadow .15s; }

/* 侧栏「开启新对话」下方提示条 */
.new-chat-hint {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #fff8e6;
  border: 1px solid #ffe1a8;
  color: #9a6b00;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  animation: hintIn .25s ease;
  transition: opacity .3s;
}
.new-chat-hint.fade-out { opacity: 0; }
@keyframes hintIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* 欢迎页快捷提问卡片 */
.quick-asks {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-top: 8px; max-width: 460px; width: 100%;
  position: relative; z-index: 1;
}
.quick-ask {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px; color: var(--text);
  text-align: left; cursor: pointer;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
}
.quick-ask:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 10px 24px rgba(59, 108, 246, 0.24);
  transform: translateY(-4px);
}
.quick-ask:active { transform: scale(.97); }
.qa-icon {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.qa-text { line-height: 1.35; }
.qa-text b { display: block; font-weight: 600; font-size: 14px; }
.qa-text span { display: block; font-size: 12px; color: var(--text-2); }
@media (max-width: 760px) {
  .quick-asks { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

/* 设置页数据卡片 */
.stat-cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 14px;
}
.stat-card {
  background: linear-gradient(160deg, #f5f8ff, #fff);
  border: 1px solid #e3eaff;
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
}
.stat-num { font-size: 26px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
@media (max-width: 480px) { .stat-cards { gap: 6px; } .stat-num { font-size: 20px; } }

/* 设置页分区标题 */
.sec-divider {
  display: flex; align-items: center; gap: 8px;
  margin: 4px 0 12px; padding-top: 6px;
  font-size: 13.5px; font-weight: 700; color: var(--primary-dark);
  scroll-margin-top: 10px; /* 导航滚动定位时留出顶部间距 */
}
.sec-divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, #dfe6ff, transparent);
}

/* 设置弹窗：左侧导航 + 右侧内容（两栏布局） */
.settings-layout { display: flex; gap: 14px; align-items: flex-start; }
.settings-nav {
  flex: 0 0 132px;
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 2px;
  padding: 2px 0;
}
.nav-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px;
  background: transparent; border: none;
  color: var(--text-2); font-size: 13px; cursor: pointer;
  white-space: nowrap; line-height: 1.2;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: #f1f3f9; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.settings-main { flex: 1; min-width: 0; }
/* 切换式分区：默认只显示激活分区 */
.settings-section { display: none; }
.settings-section.active { display: block; }
@media (max-width: 640px) {
  .settings-layout { flex-direction: column; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; position: static; }
  .nav-item { width: auto; padding: 6px 10px; }
}
/* 快捷提问卡片编辑区 */
.qa-panel { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; background: #fbfcfe; }
.qa-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; font-size: 13.5px; color: var(--text); }
.qa-head button { padding: 4px 10px; font-size: 12px; }
.qa-list { display: flex; flex-direction: column; gap: 8px; }
.qa-edit { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.qa-edit-row { display: flex; gap: 8px; }
.qa-edit input {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
  outline: none; width: 100%;
}
.qa-edit input:focus { border-color: var(--primary); }
.qa-edit input.qa-icon-input { flex: 0 0 64px; text-align: center; font-size: 16px; }
.qa-action { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; outline: none; width: 100%; background: #fff; color: inherit; cursor: pointer; }
.qa-action:focus { border-color: var(--primary); }

/* ============================================================
   深色模式（晚上 19:00 - 早上 7:00 自动启用，也可在设置里手动切换）
   ============================================================ */
html[data-theme="dark"] {
  --bg: #14161b;
  --card: #1e2229;
  --border: #2c313b;
  --text: #e7e9ee;
  --text-2: #98a1b0;
  --primary: #5b8cff;
  --primary-dark: #86a8ff;
  --primary-soft: #1d2a4d;
  --danger: #ff6b70;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .gate-box { background: var(--card); }
html[data-theme="dark"] .modal-mask,
html[data-theme="dark"] .gate { background: rgba(0, 0, 0, 0.62); }
html[data-theme="dark"] .modal-body::-webkit-scrollbar-thumb,
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a4048; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a5160; }

/* 输入区 */
html[data-theme="dark"] .composer textarea,
html[data-theme="dark"] .composer-btn,
html[data-theme="dark"] .voice-pad,
html[data-theme="dark"] .modal input,
html[data-theme="dark"] .modal select,
html[data-theme="dark"] .modal textarea,
html[data-theme="dark"] .qa-edit,
html[data-theme="dark"] .skill-item,
html[data-theme="dark"] .log-box,
html[data-theme="dark"] .conv-rename-input { background: #262b34; border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .composer textarea:focus,
html[data-theme="dark"] .modal input:focus,
html[data-theme="dark"] .modal select:focus,
html[data-theme="dark"] .modal textarea:focus { background: #2a303a; }
html[data-theme="dark"] .send:disabled { background: #3a4048; }
/* 键盘弹起 / 吸顶毛玻璃 */
html[data-theme="dark"] body.kb-up .composer,
html[data-theme="dark"] .topbar { background: rgba(30, 34, 41, 0.94); }

/* 面板与卡片 */
html[data-theme="dark"] .log-panel,
html[data-theme="dark"] .skills-panel,
html[data-theme="dark"] .kb-panel,
html[data-theme="dark"] .qa-panel,
html[data-theme="dark"] .hp-canvas,
html[data-theme="dark"] .draft { background: #1a1e24; }
html[data-theme="dark"] .feat-chip,
html[data-theme="dark"] .quick-ask,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .ctx-menu { background: var(--card); border-color: var(--border); }
html[data-theme="dark"] .stat-card { background: linear-gradient(160deg, #1e2a4a, #1e2229); }
html[data-theme="dark"] .qa-edit input,
html[data-theme="dark"] .skill-top input[data-role="name"],
html[data-theme="dark"] .skill-item input.skill-desc,
html[data-theme="dark"] .skill-item textarea[data-role="content"],
html[data-theme="dark"] #kbEditor input,
html[data-theme="dark"] #kbEditor textarea { background: #262b34; border-color: var(--border); color: var(--text); }

/* 悬停与交互 */
html[data-theme="dark"] .conv-item:hover,
html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .brand-ico:hover,
html[data-theme="dark"] .icon-btn:hover,
html[data-theme="dark"] .rail-btn:hover,
html[data-theme="dark"] .modal-close { background: #262b34; }
html[data-theme="dark"] .conv-more:hover { background: #2a303a; }
html[data-theme="dark"] .key-warn-banner { background: #3a2a1a; border-color: #6b4a1a; color: #ffc966; }
html[data-theme="dark"] .new-chat-hint { background: #2a2418; border-color: #4a3a1a; color: #e6c98a; }
html[data-theme="dark"] .toast { background: #2a303a; color: var(--text); border-color: var(--border); }
html[data-theme="dark"] .empty-state p,
html[data-theme="dark"] .conv-empty,
html[data-theme="dark"] .log-empty,
html[data-theme="dark"] .kb-empty,
html[data-theme="dark"] .hp-canvas-empty,
html[data-theme="dark"] .reasoning summary { color: var(--text-2); }
html[data-theme="dark"] .sec-divider { color: var(--primary); }
html[data-theme="dark"] .sec-divider::after { background: linear-gradient(90deg, #3a4a7a, transparent); }
html[data-theme="dark"] .btn-new { background: #1a2440; border-color: #2c3a66; color: var(--primary); }
html[data-theme="dark"] .btn-new:hover { background: #22305a; }

/* ===== 闪记：谈单录音分析（钉钉闪记风格控制条） ===== */
/* ===== 闪记录音界面：仿钉钉闪记紧凑控制条（线性 SVG 图标不变） ===== */
.shanji-rec { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 6px; flex-wrap: wrap; }

/* 开始录音：柔和渐变主按钮 */
.shanji-start-btn {
  font-size: 16px; font-weight: 600; padding: 14px 32px; border-radius: 999px;
  border: none; cursor: pointer; transition: .18s ease; color: #fff;
  background: linear-gradient(135deg, #5b8bff 0%, #3f6bff 100%);
  box-shadow: 0 10px 24px rgba(63,107,255,.28);
  display: inline-flex; align-items: center; gap: 8px;
}
.shanji-start-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(63,107,255,.34); }
.shanji-start-btn:active { transform: translateY(0); }
.shanji-start-btn svg { display: block; }

/* 录音控制条：单排细长圆角胶囊（宽度自适应内容，不撑满） */
.shanji-bar {
  flex: 0 0 auto; min-width: 0; display: flex; align-items: center; gap: 16px;
  min-height: 62px; padding: 8px 16px; border-radius: 999px;
  background: #f6f7f9; border: 1px solid #e9ebf0;
}
.shanji-progress-wrap { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-width: 0; }

/* 音浪：5 条蓝色竖条 */
.shanji-bars {
  display: flex; align-items: flex-end; gap: 4px;
  height: 26px; padding-bottom: 2px; flex-shrink: 0;
}
.shanji-bars span {
  width: 4px; border-radius: 2px; background: var(--primary, #4f7cff);
  min-height: 5px; height: 60%; transform-origin: bottom;
  transition: height .12s ease;
}
/* 默认装饰动画（初始即「浪起来」，即便没有真实声音也有起伏） */
.shanji-bars:not(.is-live) span { animation: shBar 1.1s ease-in-out infinite; }
.shanji-bars.is-live span { animation: none; }
.shanji-bars span:nth-child(1) { height: 45%; animation-delay: 0s; }
.shanji-bars span:nth-child(2) { height: 75%; animation-delay: .15s; }
.shanji-bars span:nth-child(3) { height: 95%; animation-delay: .30s; }
.shanji-bars span:nth-child(4) { height: 60%; animation-delay: .45s; }
.shanji-bars span:nth-child(5) { height: 80%; animation-delay: .60s; }
@keyframes shBar { 0%,100% { transform: scaleY(.55); } 50% { transform: scaleY(1); } }
.shanji-bars.is-paused span { animation-play-state: paused !important; }

/* 实时转写（录音中显示，本地识别草稿） */
.shanji-live {
  width: 100%; margin: 8px 2px 2px; padding: 12px 14px; border-radius: 12px;
  background: #f6f7f9; border: 1px solid #e9ebf0; max-height: 220px; overflow-y: auto;
  text-align: left;
}
.shanji-live-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #6b7280; margin-bottom: 8px; font-weight: 600; letter-spacing: .3px; }
.shanji-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #21c55d; animation: shLivePulse 1.4s infinite; }
@keyframes shLivePulse { 0% { box-shadow: 0 0 0 0 rgba(33,197,93,.5); } 70% { box-shadow: 0 0 0 7px rgba(33,197,93,0); } 100% { box-shadow: 0 0 0 0 rgba(33,197,93,0); } }
.shanji-live-body { font-size: 14px; line-height: 1.7; color: #1f2430; white-space: pre-wrap; word-break: break-word; }
.shanji-live-body .live-interim { color: #9aa3b2; }
.shanji-live-empty { color: #9aa3b2; font-style: italic; }

.shanji-time {
  font-size: 16px; font-weight: 600; letter-spacing: .3px;
  font-variant-numeric: tabular-nums; color: var(--text-1, #1f2533); white-space: nowrap;
}
.shanji-divider { width: 1px; height: 32px; background: #e1e4eb; flex-shrink: 0; }
.shanji-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* 工具键：无边框线性图标 */
.shanji-tool {
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-1, #1f2533); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.shanji-tool:hover { color: var(--primary, #4f7cff); background: rgba(79,124,255,.08); }
.shanji-tool svg { display: block; }

/* 暂停：浅灰实心圆 */
.shanji-play {
  width: 50px; height: 50px; border-radius: 50%; border: none;
  background: #eceef3; color: var(--text-1, #1f2533); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: .15s;
}
.shanji-play:hover { background: #e1e4eb; }
.shanji-play.is-paused { background: #e1e4eb; }

/* 结束：浅边框胶囊 */
.shanji-end {
  font-size: 16px; font-weight: 500; padding: 12px 26px; border-radius: 999px;
  border: 1.5px solid #e1e4eb; background: transparent; color: var(--text-1, #1f2533);
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 6px;
}
.shanji-end:hover { border-color: var(--primary, #4f7cff); color: var(--primary, #4f7cff); }

/* 标记 chips */
.shanji-marks { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #f7f9fd; border: 1px dashed var(--border, #e6e9f0); }
.shanji-marks-title { font-size: 12px; color: var(--text-2, #8a93a6); margin-bottom: 4px; }
.shanji-mark { display: inline-block; font-size: 12px; color: var(--text-2, #8a93a6); background: #fff; padding: 2px 8px; border-radius: 999px; margin: 2px 6px 2px 0; border: 1px solid var(--border, #e6e9f0); }

/* 状态 / 上传提示 */
.shanji-status { font-size: 13px; color: var(--text-2, #8a93a6); min-height: 20px; margin: 6px 0; }
.shanji-uploading { font-size: 13px; color: var(--primary, #4f7cff); margin: 6px 0; display: flex; align-items: center; gap: 6px; }
.shanji-uploading::before { content: ""; width: 12px; height: 12px; border: 2px solid rgba(79,124,255,.3); border-top-color: var(--primary, #4f7cff); border-radius: 50%; animation: shSpin .8s linear infinite; }
@keyframes shSpin { to { transform: rotate(360deg); } }

.shanji-result { margin-top: 10px; }
.shanji-section { margin-bottom: 14px; }
.shanji-framework-wrap { margin-top: 8px; }
.shanji-section-title { font-weight: 600; margin-bottom: 6px; color: var(--text-1, #1f2533); }
.shanji-summary { background: var(--bg-soft, #f5f7fb); border: 1px solid var(--border, #e6e9f0); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.6; }
.shanji-transcript { white-space: pre-wrap; word-break: break-word; max-height: 280px; overflow: auto; background: var(--bg-soft, #f5f7fb); border: 1px solid var(--border, #e6e9f0); border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.7; color: var(--text-2, #8a93a6); }
.shanji-actions { display: flex; gap: 10px; margin-top: 10px; }
.shanji-actions button { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border, #e6e9f0); background: var(--bg, #fff); color: var(--text-1, #1f2533); cursor: pointer; transition: .15s; }
.shanji-actions button:hover { border-color: var(--primary, #4f7cff); color: var(--primary, #4f7cff); }
.shanji-modal { max-width: 560px; width: 92%; }

/* 暗色主题 */
html[data-theme="dark"] .shanji-start-btn { background: linear-gradient(135deg, #4f7cff 0%, #3358e0 100%); box-shadow: 0 10px 24px rgba(40,80,220,.35); }
html[data-theme="dark"] .shanji-bar { background: #161c2b; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-bars span { background: #5b8bff; }
html[data-theme="dark"] .shanji-divider { background: #2c3a66; }
html[data-theme="dark"] .shanji-tool { color: #dbe4ff; }
html[data-theme="dark"] .shanji-tool:hover { color: #9db6ff; background: rgba(91,139,255,.12); }
html[data-theme="dark"] .shanji-play { background: #2c3a66; color: #dbe4ff; }
html[data-theme="dark"] .shanji-play:hover, html[data-theme="dark"] .shanji-play.is-paused { background: #3a4a7a; }
html[data-theme="dark"] .shanji-end { color: #dbe4ff; border-color: #3a4a7a; }
html[data-theme="dark"] .shanji-end:hover { color: #9db6ff; border-color: #5b8bff; }
html[data-theme="dark"] .shanji-marks { background: #14203c; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-mark { background: #0f1830; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-summary,
html[data-theme="dark"] .shanji-transcript { background: #141c33; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-live { background: #161c2b; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-live-head { color: #9aa7c4; }
html[data-theme="dark"] .shanji-live-body { color: #dce3f5; }
html[data-theme="dark"] .shanji-live-body .live-interim { color: #6b7a99; }
html[data-theme="dark"] .shanji-live-empty { color: #6b7a99; }
html[data-theme="dark"] .shanji-actions button { background: #0f1730; }

/* 线性 SVG 图标显隐规则（图标本身不变） */
.shanji-play .ic-play { display: none; }
.shanji-play.is-paused .ic-pause { display: none; }
.shanji-play.is-paused .ic-play { display: block; }

/* ===== 闪记播放器与标签页 ===== */
.shanji-player {
  margin-bottom: 14px; padding: 14px 16px; border-radius: 18px;
  background: #f6f7f9; border: 1px solid #e9ebf0;
}
.shanji-player-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.shanji-player-time {
  font-size: 14px; font-weight: 600; color: var(--text-2, #8a93a6);
  font-variant-numeric: tabular-nums; min-width: 38px; text-align: center;
}
.shanji-player-seek {
  flex: 1; min-width: 0; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; background: #e1e4eb; cursor: pointer; outline: none;
}
.shanji-player-seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--primary, #4f7cff); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.shanji-player-seek::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: var(--primary, #4f7cff);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.shanji-player-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.shanji-player-main {
  display: flex; align-items: center; justify-content: center; gap: 16px; flex: 1;
}
.shanji-player-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent;
  color: var(--text-1, #1f2533); cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: .15s;
}
.shanji-player-btn:hover { background: rgba(79,124,255,.08); color: var(--primary, #4f7cff); }
.shanji-player-btn svg { display: block; }
.shanji-player-play { width: 52px; height: 52px; background: #eceef3; }
.shanji-player-play:hover { background: #e1e4eb; }
.shanji-player-speed {
  width: auto; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--text-2, #8a93a6);
}
.shanji-player-speed:hover { color: var(--primary, #4f7cff); background: rgba(79,124,255,.08); }

/* 播放器图标显隐 */
.shanji-player-play .ic-play { display: none; }
.shanji-player-play.is-paused .ic-pause { display: none; }
.shanji-player-play.is-paused .ic-play { display: block; }

/* 标签页 */
.shanji-tabs {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border, #e6e9f0);
}
.shanji-tab-list {
  display: flex; align-items: center; gap: 8px;
}
.shanji-tab {
  padding: 8px 14px; font-size: 14px; font-weight: 500; color: var(--text-2, #8a93a6);
  background: transparent; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; transition: .15s; margin-bottom: -1px;
}
.shanji-tab:hover { color: var(--text-1, #1f2533); }
.shanji-tab.active { color: var(--primary, #4f7cff); border-bottom-color: var(--primary, #4f7cff); }
.shanji-tab-analyze {
  flex: 0 0 auto;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--primary, #4f7cff);
  background: rgba(79,124,255,.08); color: var(--primary, #4f7cff);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.shanji-tab-analyze:hover { background: var(--primary, #4f7cff); color: #fff; }

.shanji-tab-panels { margin-bottom: 14px; }
.shanji-tab-panel { display: none; }
.shanji-tab-panel.active { display: block; }

/* AI纪要页头 */
.shanji-summary-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.shanji-summary-label {
  font-size: 14px; font-weight: 600; color: var(--text-1, #1f2533);
}
.shanji-summary-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.shanji-summary-action {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border, #e6e9f0);
  background: var(--bg, #fff); color: var(--text-2, #8a93a6); cursor: pointer;
  font-size: 13px; font-weight: 500; transition: .15s; white-space: nowrap;
}
.shanji-summary-action:hover { color: var(--primary, #4f7cff); border-color: var(--primary, #4f7cff); background: rgba(79,124,255,.08); }
.shanji-summary-action svg { display: block; flex: 0 0 auto; }
@media (max-width: 480px) {
  .shanji-summary-action { padding: 6px 10px; font-size: 12px; }
  .shanji-summary-action svg { width: 14px; height: 14px; }
}

.shanji-empty {
  padding: 24px; text-align: center; font-size: 14px; color: var(--text-2, #8a93a6);
  background: var(--bg-soft, #f5f7fb); border: 1px dashed var(--border, #e6e9f0); border-radius: 10px;
}

/* ===== 转写结果列表（仿通义听悟） ===== */
.shanji-speaker-select {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border, #e6e9f0);
  background: #fff; color: var(--text-1, #1f2533); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: .15s;
}
.shanji-speaker-select:hover { border-color: var(--primary, #4f7cff); color: var(--primary, #4f7cff); background: rgba(79,124,255,.06); }
.shanji-speaker-select svg { display: block; color: var(--primary, #4f7cff); }

.shanji-transcript-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}

.shanji-transcript-list {
  max-height: 360px; overflow: auto;
  background: var(--bg-soft, #f5f7fb); border: 1px solid var(--border, #e6e9f0); border-radius: 12px;
  padding: 12px 14px;
}
.shanji-transcript-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border, #e9ebf0);
}
.shanji-transcript-item:last-child { border-bottom: none; }
.shanji-transcript-avatar {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff;
  background: var(--primary, #4f7cff);
}
.shanji-transcript-body { flex: 1; min-width: 0; }
.shanji-transcript-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.shanji-transcript-speaker {
  font-size: 14px; font-weight: 600; color: var(--text-1, #1f2533);
}
.shanji-transcript-time {
  font-size: 12px; color: var(--text-2, #8a93a6);
  font-variant-numeric: tabular-nums;
}
.shanji-transcript-text {
  font-size: 14px; line-height: 1.7; color: var(--text-1, #1f2533);
  word-break: break-word;
}

/* 暗色主题补充 */
html[data-theme="dark"] .shanji-player { background: #161c2b; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-player-seek { background: #2c3a66; }
html[data-theme="dark"] .shanji-player-play { background: #2c3a66; color: #dbe4ff; }
html[data-theme="dark"] .shanji-player-play:hover { background: #3a4a7a; }
html[data-theme="dark"] .shanji-player-time { color: #8a93a6; }
html[data-theme="dark"] .shanji-tab { color: #8a93a6; }
html[data-theme="dark"] .shanji-tab:hover { color: #dbe4ff; }
html[data-theme="dark"] .shanji-tab.active { color: #9db6ff; border-bottom-color: #5b8bff; }
html[data-theme="dark"] .shanji-tabs { border-color: #2c3a66; }
html[data-theme="dark"] .shanji-summary-action { color: #8a93a6; background: #0f1730; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-summary-action:hover { color: #9db6ff; background: rgba(91,139,255,.12); border-color: #5b8bff; }
html[data-theme="dark"] .shanji-tab-analyze { background: rgba(91,139,255,.12); color: #9db6ff; border-color: #5b8bff; }
html[data-theme="dark"] .shanji-tab-analyze:hover { background: #5b8bff; color: #fff; }
html[data-theme="dark"] .shanji-empty { background: #141c33; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-speaker-select { background: #0f1730; border-color: #2c3a66; color: #dbe4ff; }
html[data-theme="dark"] .shanji-speaker-select:hover { border-color: #5b8bff; color: #9db6ff; background: rgba(91,139,255,.12); }
html[data-theme="dark"] .shanji-transcript-list { background: #141c33; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-transcript-item { border-color: #2c3a66; }
html[data-theme="dark"] .shanji-transcript-text { color: #dbe4ff; }
html[data-theme="dark"] .shanji-transcript-speaker { color: #dbe4ff; }
html[data-theme="dark"] .shanji-transcript-time { color: #8a93a6; }

/* ===== 录音分析：上传与参数区（仿通义听悟官方左右布局） ===== */
.ra-layout {
  display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: stretch;
  margin: 6px 0 4px;
}
.ra-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ra-drop {
  flex: 1; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 28px 24px; border-radius: 16px; cursor: pointer;
  background: #f4f6ff;
  border: 1.5px dashed #b6c2e0; color: var(--text-2, #8a93a6);
  transition: .18s; text-align: center;
}
.ra-drop:hover, .ra-drop:focus { border-color: var(--primary, #4f7cff); background: #eef3ff; outline: none; }
.ra-drop.dragover { border-color: var(--primary, #4f7cff); background: #e6eeff; color: var(--primary, #4f7cff); }
.ra-drop-icon { color: #4f7cff; }
.ra-drop-title { font-size: 15px; font-weight: 500; color: var(--text-1, #1f2533); }
.ra-drop-title .ra-accent { color: var(--primary, #4f7cff); font-weight: 600; }
.ra-drop-sub {
  list-style: disc; padding-left: 18px; text-align: left;
  font-size: 12px; color: var(--text-2, #8a93a6); line-height: 1.7; max-width: 360px;
}
.ra-drop-sub li { margin: 2px 0; }
.ra-file-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--bg-soft, #f5f7fb); border: 1px solid var(--border, #e6e9f0); color: var(--text-2, #8a93a6);
}
.ra-file-row svg { flex-shrink: 0; color: var(--primary, #4f7cff); }
.ra-file-name { font-size: 14px; font-weight: 500; color: var(--text-1, #1f2533); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.ra-file-size { font-size: 12px; color: var(--text-2, #8a93a6); flex-shrink: 0; }
.ra-file-clear {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border, #e6e9f0);
  background: transparent; color: var(--text-2, #8a93a6); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1; padding: 0; flex-shrink: 0; transition: .15s;
}
.ra-file-clear:hover { border-color: #e5484d; color: #e5484d; background: #fff0f0; }

.ra-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ra-field { display: flex; flex-direction: column; gap: 10px; }
.ra-field-label { font-size: 14px; font-weight: 500; color: var(--text-1, #1f2533); }
.ra-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ra-option {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border, #e6e9f0);
  background: var(--bg, #fff); color: var(--text-2, #8a93a6); cursor: pointer;
  font-size: 13px; transition: .15s;
}
.ra-option:hover { border-color: var(--primary, #4f7cff); color: var(--primary, #4f7cff); }
.ra-option.active {
  border-color: var(--primary, #4f7cff); background: #eef3ff; color: var(--primary, #4f7cff);
  font-weight: 500;
}
.ra-select-wrap {
  position: relative; display: flex; align-items: center;
}
.ra-select-wrap svg { position: absolute; right: 10px; color: var(--text-2, #8a93a6); pointer-events: none; }
.ra-select {
  width: 100%; appearance: none; -webkit-appearance: none;
  padding: 9px 30px 9px 12px; border-radius: 8px; border: 1px solid var(--border, #e6e9f0);
  background: var(--bg, #fff); color: var(--text-1, #1f2533); font-size: 13px; cursor: pointer;
}
.ra-select:focus { outline: none; border-color: var(--primary, #4f7cff); }

.ra-footer { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 18px; }
.ra-start {
  font-size: 14px; font-weight: 600; padding: 10px 22px; border-radius: 8px; border: none;
  color: #fff; cursor: pointer; transition: .15s;
  background: linear-gradient(135deg, #7b9aff 0%, #4f7cff 100%);
  box-shadow: 0 8px 18px rgba(79,124,255,.28);
}
.ra-start:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.ra-start:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79,124,255,.34); }
.ra-cancel {
  font-size: 14px; font-weight: 500; padding: 10px 20px; border-radius: 8px;
  border: 1px solid var(--border, #e6e9f0); background: var(--bg, #fff);
  color: var(--text-1, #1f2533); cursor: pointer; transition: .15s;
}
.ra-cancel:hover { border-color: var(--primary, #4f7cff); color: var(--primary, #4f7cff); }

@media (max-width: 600px) {
  .ra-layout { grid-template-columns: 1fr; }
  .ra-right { flex-direction: row; flex-wrap: wrap; }
  .ra-field { flex: 1; min-width: 140px; }
}

html[data-theme="dark"] .ra-drop { background: #161c2b; border-color: #2c3a66; }
html[data-theme="dark"] .ra-drop:hover, html[data-theme="dark"] .ra-drop.dragover { background: #18244a; }
html[data-theme="dark"] .ra-drop-title { color: #dbe4ff; }
html[data-theme="dark"] .ra-file-row { background: #141c33; border-color: #2c3a66; }
html[data-theme="dark"] .ra-file-name { color: #dbe4ff; }
html[data-theme="dark"] .ra-file-clear { border-color: #2c3a66; }
html[data-theme="dark"] .ra-option { background: #0f1730; border-color: #2c3a66; color: #8a93a6; }
html[data-theme="dark"] .ra-option:hover { border-color: #4f7cff; color: #9db6ff; }
html[data-theme="dark"] .ra-option.active { background: #18244a; border-color: #4f7cff; color: #9db6ff; }
html[data-theme="dark"] .ra-select { background: #0f1730; border-color: #2c3a66; color: #dbe4ff; }
html[data-theme="dark"] .ra-cancel { background: #0f1730; border-color: #2c3a66; }
html[data-theme="dark"] .ra-start { background: linear-gradient(135deg, #5b8bff 0%, #3358e0 100%); }

/* ============ 钉钉内免登遮罩 ============ */
.login-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: rgba(244, 246, 252, 0.92); backdrop-filter: blur(4px); }
.login-overlay[hidden] { display: none; }
.login-card { background: #fff; border-radius: 16px; padding: 32px 36px; max-width: 320px; width: 86%; text-align: center; box-shadow: 0 12px 40px rgba(30, 50, 120, 0.16); border: 1px solid #e6ebf5; }
.login-spinner { width: 38px; height: 38px; margin: 0 auto 16px; border: 3px solid #e3e8f5; border-top-color: #4f7cff; border-radius: 50%; animation: login-spin 0.9s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }
.login-title { font-size: 16px; font-weight: 600; color: #1f2a44; margin-bottom: 8px; }
.login-desc { font-size: 13px; color: #6b7488; line-height: 1.6; }
html[data-theme="dark"] .login-overlay { background: rgba(12, 18, 38, 0.92); }
html[data-theme="dark"] .login-card { background: #131c34; border-color: #2c3a66; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .login-spinner { border-color: #2c3a66; border-top-color: #6f9bff; }
html[data-theme="dark"] .login-title { color: #dbe4ff; }
html[data-theme="dark"] .login-desc { color: #8a93a6; }

/* ============ 本地调试登录面板（debugLogin 模式） ============ */
.debug-panel { position: fixed; inset: 0; z-index: 9998; display: flex; align-items: center; justify-content: center; background: rgba(244, 246, 252, 0.94); backdrop-filter: blur(4px); }
.debug-panel[hidden] { display: none; }
.debug-box { background: #fff; border-radius: 16px; padding: 28px 30px; max-width: 460px; width: 90%; box-shadow: 0 12px 40px rgba(30, 50, 120, 0.16); border: 1px solid #e6ebf5; max-height: 80vh; overflow: auto; }
.debug-title { font-size: 17px; font-weight: 600; color: #1f2a44; margin-bottom: 6px; }
.debug-sub { font-size: 13px; color: #6b7488; margin-bottom: 16px; line-height: 1.5; }
.debug-list { display: flex; flex-direction: column; gap: 8px; }
.debug-user { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #e6ebf5; border-radius: 10px; background: #f7f9fd; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.debug-user:hover { border-color: #4f7cff; background: #eef3ff; }
.du-name { font-weight: 600; color: #1f2a44; min-width: 64px; }
.du-role { font-size: 13px; color: #4a5468; flex: 1; }
.du-scope { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.debug-hint { margin-top: 16px; font-size: 11px; color: #9aa3b5; text-align: center; }
html[data-theme="dark"] .debug-panel { background: rgba(12, 18, 38, 0.94); }
html[data-theme="dark"] .debug-box { background: #131c34; border-color: #2c3a66; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); }
html[data-theme="dark"] .debug-title { color: #dbe4ff; }
html[data-theme="dark"] .debug-sub { color: #8a93a6; }
html[data-theme="dark"] .debug-user { background: #0f1730; border-color: #2c3a66; }
html[data-theme="dark"] .debug-user:hover { border-color: #6f9bff; background: #18244a; }
html[data-theme="dark"] .du-name { color: #dbe4ff; }
html[data-theme="dark"] .du-role { color: #9aa3b5; }
html[data-theme="dark"] .debug-hint { color: #6b7488; }

/* ============ 组织架构与权限看板 ============ */
.org-view { position: absolute; inset: 0; overflow: auto; padding: 24px 28px 40px; background: #f4f6fc; }
.org-view[hidden] { display: none; }
.org-head { margin-bottom: 20px; }
.org-me { font-size: 13px; color: #4a5468; margin-bottom: 8px; }
.scope-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.org-title { font-size: 20px; font-weight: 700; color: #1f2a44; margin: 0; }
.org-tree { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.org-campus { background: #fff; border: 1px solid #e6ebf5; border-radius: 14px; padding: 16px 18px; box-shadow: 0 4px 16px rgba(30, 50, 120, 0.06); }
.oc-name { font-size: 15px; font-weight: 600; color: #1f2a44; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.oc-count { font-size: 12px; font-weight: 400; color: #8a93a6; background: #f0f3fa; padding: 1px 8px; border-radius: 20px; }
.oc-users { display: flex; flex-direction: column; gap: 8px; }
.oc-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f7f9fd; border-radius: 9px; }
.ocu-name { font-weight: 600; color: #1f2a44; min-width: 56px; }
.ocu-role { font-size: 13px; color: #4a5468; flex: 1; }
.ocu-scope { font-size: 11px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.ocu-scope.ALL, .scope-badge.ALL, .du-scope.ALL { background: #e6f7ee; color: #1a8a4f; }
.ocu-scope.CAMPUS, .scope-badge.CAMPUS, .du-scope.CAMPUS { background: #eaf1ff; color: #2f6bff; }
.ocu-scope.SELF, .scope-badge.SELF, .du-scope.SELF { background: #fff3e6; color: #c47a14; }
.ocu-scope.NONE, .scope-badge.NONE, .du-scope.NONE { background: #f0f0f0; color: #8a8a8a; }
.org-empty, .org-loading { color: #8a93a6; font-size: 14px; padding: 40px; text-align: center; }
html[data-theme="dark"] .org-view { background: #0c1226; }
html[data-theme="dark"] .org-title { color: #dbe4ff; }
html[data-theme="dark"] .org-me { color: #9aa3b5; }
html[data-theme="dark"] .org-campus { background: #131c34; border-color: #2c3a66; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); }
html[data-theme="dark"] .oc-name { color: #dbe4ff; }
html[data-theme="dark"] .oc-count { background: #0f1730; color: #6b7488; }
html[data-theme="dark"] .oc-user { background: #0f1730; }
html[data-theme="dark"] .ocu-name { color: #dbe4ff; }
html[data-theme="dark"] .ocu-role { color: #9aa3b5; }
html[data-theme="dark"] .ocu-scope.ALL, html[data-theme="dark"] .scope-badge.ALL, html[data-theme="dark"] .du-scope.ALL { background: #11331f; color: #6fe0a0; }
html[data-theme="dark"] .ocu-scope.CAMPUS, html[data-theme="dark"] .scope-badge.CAMPUS, html[data-theme="dark"] .du-scope.CAMPUS { background: #16244a; color: #9db6ff; }
html[data-theme="dark"] .ocu-scope.SELF, html[data-theme="dark"] .scope-badge.SELF, html[data-theme="dark"] .du-scope.SELF { background: #332714; color: #ffc06b; }
html[data-theme="dark"] .ocu-scope.NONE, html[data-theme="dark"] .scope-badge.NONE, html[data-theme="dark"] .du-scope.NONE { background: #1a1a1a; color: #888; }

/* ============ 后台：闪记记录 ============ */
.shanji-admin-box { padding: 8px 2px 20px; }
.shanji-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.shanji-filters select, .shanji-filters input { padding: 7px 10px; border: 1px solid #e0e6f2; border-radius: 8px; font-size: 13px; background: #fff; color: #1f2a44; }
.shanji-filters input[type="text"] { min-width: 180px; }
.shanji-filters button { padding: 7px 14px; border: none; border-radius: 8px; background: var(--primary, #2f6bff); color: #fff; cursor: pointer; font-size: 13px; }
.shanji-count { font-size: 13px; color: #8a93a6; margin-left: auto; }
.shanji-cards { display: flex; flex-direction: column; gap: 14px; }
.shanji-card { background: #fff; border: 1px solid #e6ebf5; border-radius: 12px; padding: 14px 16px; box-shadow: 0 2px 10px rgba(30, 50, 120, 0.05); }
.sc-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.sc-date { font-weight: 600; color: #1f2a44; font-size: 14px; }
.sc-tag { font-size: 12px; padding: 2px 9px; border-radius: 20px; background: #f0f3fa; color: #4a5468; }
.sc-tag.campus { background: #eaf1ff; color: #2f6bff; }
.sc-tag.parent { background: #e6f7ee; color: #1a8a4f; }
.sc-tag.consul { background: #fff3e6; color: #c47a14; }
.sc-block { margin-top: 8px; }
.sc-label { font-size: 12px; font-weight: 600; color: #6b7488; margin-bottom: 3px; }
.sc-text { font-size: 13px; color: #2a3450; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.sc-transcript { margin-top: 8px; font-size: 13px; }
.sc-transcript summary { cursor: pointer; color: #2f6bff; font-size: 12px; user-select: none; }
.sc-transcript .sc-text { margin-top: 6px; max-height: 280px; overflow: auto; }
html[data-theme="dark"] .shanji-card { background: #131c34; border-color: #2c3a66; }
html[data-theme="dark"] .shanji-filters select, html[data-theme="dark"] .shanji-filters input { background: #0f1730; border-color: #2c3a66; color: #dbe4ff; }
html[data-theme="dark"] .sc-date, html[data-theme="dark"] .sc-text { color: #dbe4ff; }
html[data-theme="dark"] .sc-tag { background: #0f1730; color: #9aa3b5; }

/* ============ 后台：数据备份 ============ */
.backup-box { padding: 8px 2px 20px; }
.backup-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.backup-row button { padding: 8px 16px; border: none; border-radius: 8px; background: var(--primary, #2f6bff); color: #fff; cursor: pointer; font-size: 13px; }
.backup-row .key-hint { flex-basis: 100%; margin: 0; }
#backupResult { font-size: 13px; color: #1a8a4f; padding: 6px 0; }
html[data-theme="dark"] #backupResult { color: #6fe0a0; }

/* ============ 闪记目录（主界面） ============ */
.shanji-view { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--bg, #fff); }
.shanji-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border, #eee); }
.shanji-title { font-weight: 700; font-size: 16px; }
.shanji-scope { font-size: 12px; color: var(--muted, #888); margin-left: auto; }
.shanji-body { flex: 1; overflow: auto; padding: 14px 16px; }
.shanji-loading, .shanji-empty { color: var(--muted, #888); padding: 24px 0; text-align: center; }
.shanji-list { display: flex; flex-direction: column; gap: 10px; }
.shanji-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border, #eee); border-radius: 12px; cursor: pointer; transition: .15s; background: var(--card, #fafbff); }
.shanji-row:hover { border-color: var(--primary, #2f6bff); box-shadow: 0 2px 10px rgba(47,107,255,.08); }
.shanji-row-main { flex: 1; min-width: 0; }
.shanji-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shanji-meta { font-size: 12px; color: var(--muted, #888); margin-top: 3px; }
.shanji-row-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.shanji-campus { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eaf1ff; color: #2f6bff; }
.shanji-tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f1f3f7; color: #555; }
.shanji-tag-x { color: #bbb; margin-left: 2px; cursor: pointer; text-decoration: none; }
.shanji-tag-x:hover { color: #e35; }
.shanji-audio-ico { font-size: 14px; }
.shanji-detail-head { display: flex; gap: 8px; margin-bottom: 12px; }
.shanji-name-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border, #ddd); border-radius: 8px; font-size: 14px; }
.shanji-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.shanji-tag-input { padding: 6px 10px; border: 1px solid var(--border, #ddd); border-radius: 8px; font-size: 13px; width: 160px; }
.shanji-audio { margin-bottom: 14px; }
.shanji-audio audio { width: 100%; }
.shanji-audio-hint { font-size: 12px; color: var(--muted, #888); margin-top: 4px; }
.shanji-section-title { font-weight: 700; font-size: 14px; margin: 16px 0 8px; color: var(--primary, #2f6bff); }
.shanji-chapters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.shanji-chapter { padding: 8px 12px; border-left: 3px solid var(--primary, #2f6bff); background: var(--card, #fafbff); border-radius: 0 8px 8px 0; cursor: pointer; font-size: 14px; }
.shanji-chapter:hover { background: #eef3ff; }
.shanji-md { line-height: 1.7; font-size: 14px; }
.shanji-md h1, .shanji-md h2, .shanji-md h3 { margin: 10px 0 6px; }
.shanji-transcript { white-space: pre-wrap; line-height: 1.8; font-size: 13.5px; color: #333; background: var(--card, #fafbff); border: 1px solid var(--border, #eee); border-radius: 10px; padding: 14px; max-height: 420px; overflow: auto; }
html[data-theme="dark"] .shanji-view { background: #16181d; }
html[data-theme="dark"] .shanji-row, html[data-theme="dark"] .shanji-chapter, html[data-theme="dark"] .shanji-transcript { background: #1d2026; }
html[data-theme="dark"] .shanji-name, html[data-theme="dark"] .shanji-transcript { color: #e6e6e6; }
html[data-theme="dark"] .shanji-campus { background: #1e2a44; color: #7aa2ff; }
html[data-theme="dark"] .shanji-tag { background: #262a31; color: #bbb; }
.shanji-enter-btn { display: inline-block; margin: 10px 0 14px; padding: 9px 16px; border: none; border-radius: 10px; background: var(--primary, #3b6cf6); color: #fff; font-size: 14px; cursor: pointer; }
.shanji-enter-btn:hover { background: var(--primary-dark, #2f57d6); }
html[data-theme="dark"] .shanji-enter-btn { background: #3a5bbf; }
.shanji-del-btn { margin-left: 8px; border: none; background: transparent; color: var(--danger, #e5484d); font-size: 16px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.shanji-del-btn:hover { background: #fde8e9; }
html[data-theme="dark"] .shanji-del-btn:hover { background: #3a2426; }
.shanji-history { margin-top: 18px; border-top: 1px dashed var(--border, #2a2f3a); padding-top: 14px; }
.shanji-history-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.shanji-history-title { font-weight: 600; font-size: 15px; }
.shanji-history-head .shanji-scope { font-size: 12px; color: var(--muted, #8b93a7); }
.shanji-history-head .btn-sm { margin-left: auto; }
.shanji-history-body { max-height: 320px; overflow: auto; }
.shanji-detail-backrow { margin-bottom: 10px; }
.shanji-detail-meta { margin: 2px 0 10px; font-size: 13px; color: var(--muted, #8a93a2); }
html[data-theme="dark"] .shanji-detail-meta { color: #9aa4b2; }
.shanji-result-title { font-weight: 600; font-size: 15px; margin: 4px 0 10px; color: var(--text, #e8edf5); }
html[data-theme="dark"] .shanji-result-title { color: #e8edf5; }

/* ===== 数学知识点图谱（欢迎页卡片） ===== */
.kbgraph-mask { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 18px; }
.kbgraph-panel { width: min(1120px, 96vw); height: min(780px, 92vh); background: var(--bg, #fff); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.32); display: flex; flex-direction: column; overflow: hidden; }
.kbgraph-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border, #e3e8f0); }
.kbgraph-title { font-weight: 700; font-size: 17px; color: var(--text, #1f2937); }
.kbgraph-sub { font-weight: 400; font-size: 12px; color: var(--muted, #8a93a6); margin-left: 8px; }
.kbgraph-tools { display: flex; align-items: center; gap: 8px; }
.kbgraph-search { padding: 7px 10px; border: 1px solid var(--border, #e3e8f0); border-radius: 9px; font-size: 13px; background: var(--input-bg, #fff); color: var(--text, #222); width: 160px; }
.kbgraph-reset, .kbgraph-close { border: 1px solid var(--border, #e3e8f0); background: var(--bg, #fff); color: var(--text, #333); border-radius: 9px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.kbgraph-close { font-size: 15px; line-height: 1; padding: 6px 10px; }
.kbgraph-reset:hover, .kbgraph-close:hover { border-color: var(--primary, #3b6cf6); color: var(--primary, #3b6cf6); }
.kbgraph-body { flex: 1; min-height: 0; display: flex; }
.kbgraph-canvas { flex: 1 1 0%; min-width: 0; overflow: hidden; position: relative; background: var(--canvas-bg, #f7f9fc); cursor: grab; touch-action: none; -webkit-overflow-scrolling: touch; }
.kbgraph-canvas.kb-dragging { cursor: grabbing; }
.kbgraph-canvas svg { display: block; transform-origin: 0 0; }
.kbgraph-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted, #8a93a6); padding: 24px; line-height: 1.7; }
.kb-edge { fill: none; stroke: var(--edge, #c2ccdb); stroke-width: 1.6; }
.kb-edge.hl { stroke: var(--primary, #3b6cf6); stroke-width: 2.4; }
.kb-edge.dim { opacity: .15; }
.kb-edge.hide { display: none; }
.kb-node { cursor: pointer; }
.kb-node-box { fill: var(--node-bg, #fff); stroke: var(--border, #cdd6e4); stroke-width: 1.5; transition: fill .15s, stroke .15s; }
.kb-node:hover .kb-node-box { stroke: var(--primary, #3b6cf6); fill: var(--node-hover, #eef3ff); }
.kb-node.sel .kb-node-box { stroke: var(--primary, #3b6cf6); fill: var(--node-sel, #dbe7ff); stroke-width: 2.4; }
.kb-node-text { fill: var(--text, #1f2937); font-size: 13px; font-family: inherit; pointer-events: none; }
.kb-node.hide { display: none; }
/* 放射状星空图：焦点恒星高亮 + 展开徽标 */
.kb-node.root .kb-node-box { fill: #fff7e6; stroke: #e0820a; stroke-width: 3; filter: drop-shadow(0 0 8px rgba(224,130,10,.45)); }
html[data-theme="dark"] .kb-node.root .kb-node-box { fill: #3a2a10; stroke: #f0a23a; }
.kb-badge { cursor: pointer; }
.kb-badge circle { fill: #fff; stroke: #3b6cf6; stroke-width: 1.6; transition: fill .12s; }
.kb-badge:hover circle { fill: #eef3ff; }
.kb-badge text { fill: #3b6cf6; font-size: 15px; font-weight: 700; font-family: inherit; pointer-events: none; user-select: none; }
html[data-theme="dark"] .kb-badge circle { fill: #1f2839; stroke: #6b8cff; }
html[data-theme="dark"] .kb-badge text { fill: #9db4ff; }
.kbgraph-detail { flex: 1 1 0%; min-width: 0; width: auto; border-left: 1px solid var(--border, #e3e8f0); padding: 16px; overflow-y: auto; background: var(--bg, #fff); }
/* 可拖动分隔条：拖动调节两侧宽度，双击恢复 50/50 */
.kbgraph-resizer { flex: 0 0 9px; position: relative; cursor: col-resize; background: transparent; z-index: 6; touch-action: none; }
.kbgraph-resizer::before { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; background: var(--border, #e3e8f0); transition: background .15s, width .15s, left .15s; }
.kbgraph-resizer:hover::before, .kbgraph-resizer.dragging::before { background: var(--primary, #3b6cf6); width: 2px; left: 3px; }
.kbgraph-resizer::after { content: '⠿'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 13px; line-height: 1; color: var(--muted, #8a93a6); background: var(--bg, #fff); border: 1px solid var(--border, #e3e8f0); border-radius: 6px; padding: 3px 4px; transition: color .15s, border-color .15s; }
.kbgraph-resizer:hover::after, .kbgraph-resizer.dragging::after { color: var(--primary, #3b6cf6); border-color: var(--primary, #3b6cf6); }
/* 折叠：最大化某一侧时，对侧收起为 0 宽 */
.kbgraph-canvas.collapsed, .kbgraph-detail.collapsed { flex: 0 0 0 !important; width: 0 !important; min-width: 0; overflow: hidden; border-left: none; }
.kb-d-launcher.canvas { left: 16px; right: auto; }
.kbgraph-detail-empty { color: var(--muted, #8a93a6); font-size: 13px; line-height: 1.7; }
.kb-d-name { font-size: 17px; font-weight: 700; color: var(--text, #1f2937); margin-bottom: 4px; }
.kb-d-sub { font-size: 13px; color: var(--primary, #3b6cf6); font-weight: 600; margin-bottom: 10px; line-height: 1.5; }
.kb-d-sum { font-size: 13px; line-height: 1.7; color: var(--text, #394150); white-space: pre-wrap; margin-bottom: 12px; }
.kb-d-sec { font-size: 12px; font-weight: 700; color: var(--muted, #8a93a6); margin: 10px 0 6px; }
.kb-d-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-tag { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--tag-bg, #eef2f8); color: var(--text, #334); border: 1px solid var(--border, #e3e8f0); cursor: pointer; }
.kb-tag:hover { border-color: var(--primary, #3b6cf6); color: var(--primary, #3b6cf6); }
.kb-d-loc { margin-top: 16px; width: 100%; padding: 10px; border: 1px solid var(--primary, #3b6cf6); border-radius: 10px; background: transparent; color: var(--primary, #3b6cf6); font-size: 14px; font-weight: 600; cursor: pointer; }
.kb-d-loc:hover { background: rgba(59,108,246,0.08); }
.kb-d-ask { margin-top: 10px; width: 100%; padding: 10px; border: none; border-radius: 10px; background: var(--primary, #3b6cf6); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.kb-d-ask:hover { filter: brightness(1.05); }
/* 手机端详情抽屉的收起条与浮起按钮（桌面隐藏；手机端由媒体查询/JS 控制显示） */
.kb-d-collapse { display: none; }
.kb-d-launcher { display: none; position: fixed; right: 16px; bottom: 20px; z-index: 1200; padding: 12px 16px; border: none; border-radius: 999px; background: var(--primary, #3b6cf6); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 8px 22px rgba(0,0,0,.28); cursor: pointer; }
.kb-d-launcher:active { filter: brightness(1.08); }
@media (max-width: 720px) {
  .kbgraph-mask { padding: 0; }
  .kbgraph-panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; max-width: none; }
  .kbgraph-head { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .kbgraph-title { font-size: 16px; }
  .kbgraph-sub { display: none; }
  .kbgraph-tools { width: 100%; gap: 6px; }
  .kbgraph-search { flex: 1; width: auto; min-width: 0; font-size: 15px; padding: 10px 12px; }
  .kbgraph-reset, .kbgraph-close { padding: 10px 14px; font-size: 14px; }
  .kbgraph-filters { gap: 8px; padding: 8px 12px; }
  .kbgraph-filters label { display: flex; align-items: center; gap: 4px; font-size: 13px; flex: 1 1 0; min-width: 0; }
  .kbgraph-filters select { flex: 1; min-width: 0; min-height: 40px; font-size: 14px; padding: 7px 8px; }
  .kbgraph-count { width: 100%; order: 5; font-size: 12px; color: var(--muted, #8a93a6); }
  .kbgraph-legend { width: 100%; order: 6; gap: 10px; font-size: 11px; flex-wrap: wrap; }
  .kbgraph-body { flex-direction: column; }
  .kbgraph-canvas { flex: 1 1 auto; min-height: 0; touch-action: none; overscroll-behavior: contain; }
  .kbgraph-panel { overscroll-behavior: contain; }
  .kbgraph-detail { width: 100%; border-left: none; border-top: 1px solid var(--border, #e3e8f0); max-height: 42%; flex: 0 0 auto; padding: 14px; }
  .kb-d-name { font-size: 17px; }
  .kb-d-sum, .kb-d-list li, .kb-d-src { font-size: 13.5px; line-height: 1.7; }
  .kb-tag { font-size: 13px; padding: 6px 11px; }
  .kb-d-ask { padding: 12px; font-size: 15px; }
  /* 触摸目标放大：节点文字 + +/− 徽标 */
  .kb-node-text { font-size: 14px; }
  .kb-badge circle { r: 15; }
  .kb-badge text { font-size: 21px; }
  /* 详情收起：顶部「收起详情」条 + 收起后浮起「看详情」按钮 */
  .kb-d-collapse { display: flex; align-items: center; justify-content: center; width: 100%; margin: -14px -14px 10px; padding: 8px; border: none; border-bottom: 1px solid var(--border, #e3e8f0); background: transparent; color: var(--muted, #8a93a6); font-size: 13px; cursor: pointer; }
  .kb-d-collapse:active { background: var(--card, #f3f5f9); }
  .kbgraph-detail.collapsed { display: none; }
  .kb-d-launcher { display: none; }
}
@media (max-width: 420px) {
  .kbgraph-filters label { flex: 1 1 0; min-width: 0; }
  .kbgraph-filters select { min-height: 38px; }
}
html[data-theme="dark"] .kbgraph-panel { background: #1b2230; }
html[data-theme="dark"] .kbgraph-canvas { background: #141a26; }
html[data-theme="dark"] .kb-node-box { fill: #1f2839; stroke: #33405a; }
html[data-theme="dark"] .kb-node:hover .kb-node-box { fill: #243049; }
html[data-theme="dark"] .kb-node.sel .kb-node-box { fill: #2c3c5e; }
html[data-theme="dark"] .kb-node-text { fill: #e8edf5; }
html[data-theme="dark"] .kb-edge { stroke: #3a4660; }
html[data-theme="dark"] .kbgraph-detail { background: #1b2230; }
html[data-theme="dark"] .kb-d-sum { color: #c4ccd8; }
html[data-theme="dark"] .kb-tag { background: #232c3e; color: #cdd6e4; }

/* ===== 数学知识点图谱：筛选栏 / 图例 / 详情面板（v3.29） ===== */
.kbgraph-filters {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--border, #e3e8f0);
  background: var(--bg-soft, #fafbfd); font-size: 13px;
}
.kbgraph-filters label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted, #8a93a6); }
.kbgraph-filters select {
  padding: 5px 8px; border: 1px solid var(--border, #e3e8f0); border-radius: 8px;
  background: var(--input-bg, #fff); color: var(--text, #222); font-size: 13px; max-width: 220px;
}
.kbgraph-count { margin-left: auto; color: var(--muted, #8a93a6); font-size: 12px; }
.kbgraph-legend { display: inline-flex; align-items: center; gap: 10px; color: var(--muted, #8a93a6); font-size: 12px; }
.kbgraph-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }

.kb-d-src { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.kb-src {
  display: block; padding: 7px 10px; border-left: 4px solid var(--primary, #3b6cf6);
  background: var(--tag-bg, #eef2f8); border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--text, #33405a); line-height: 1.5;
}
.kb-d-list { margin: 0 0 12px; padding-left: 18px; }
.kb-d-list li { font-size: 13px; line-height: 1.75; color: var(--text, #394150); margin-bottom: 4px; }
.kb-d-how li { color: #12664f; }
.kb-d-warn li { color: #b4531a; }
.kb-d-none { font-size: 13px; color: var(--muted, #8a93a6); margin-bottom: 12px; }

html[data-theme="dark"] .kbgraph-filters { background: #171e2b; }
html[data-theme="dark"] .kbgraph-filters select { background: #232c3e; color: #cdd6e4; }
html[data-theme="dark"] .kb-src { background: #232c3e; color: #cdd6e4; }
html[data-theme="dark"] .kb-d-list li { color: #c4ccd8; }
html[data-theme="dark"] .kb-d-how li { color: #6ee7b7; }
html[data-theme="dark"] .kb-d-warn li { color: #fbbf74; }

/* ===== 跳跳咨询陪练（v3.43）：AI 扮演家长，模拟演练 + 实时打分 ===== */
.drill-mask {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.drill-panel {
  width: min(880px, 100%); height: min(740px, 100%);
  background: var(--card, #fff); border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 6px 24px rgba(30, 41, 59, 0.08));
  display: flex; flex-direction: column; overflow: hidden;
}
.drill-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e8f0);
}
.drill-title { font-size: 16px; font-weight: 700; color: var(--text, #1f2430); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drill-sub { font-size: 12px; font-weight: 400; color: var(--text-2, #6b7280); }
.drill-head-btns { display: flex; align-items: center; gap: 6px; }
.drill-btn {
  border: 1px solid var(--border, #e5e8f0); background: var(--card, #fff);
  color: var(--text, #1f2430); border-radius: 8px; padding: 7px 12px;
  font-size: 13px; cursor: pointer; font-family: inherit;
}
.drill-btn:hover { background: var(--primary-soft, #eef2ff); }
.drill-btn.primary { background: var(--primary, #3b6cf6); border-color: var(--primary, #3b6cf6); color: #fff; }
.drill-btn.primary:hover { background: var(--primary-dark, #2f57d6); }
.drill-btn.primary:disabled { opacity: .6; cursor: default; }
.drill-btn.close { padding: 7px 10px; }
.drill-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; overscroll-behavior: contain; }
.drill-tip { font-size: 13px; color: var(--text-2, #6b7280); line-height: 1.7; margin-bottom: 14px; }
.drill-tip-live { color: var(--primary, #3b6cf6); }
/* 角色选择 */
.drill-roles { display: grid; grid-template-columns: 1fr; gap: 12px; align-content: start; }
.drill-role {
  display: flex; align-items: flex-start; gap: 12px; text-align: left;
  border: 1px solid var(--border, #e5e8f0); background: var(--card, #fff);
  border-radius: 12px; padding: 14px; cursor: pointer; transition: .15s; font-family: inherit;
}
.drill-role:hover { border-color: var(--primary, #3b6cf6); background: var(--primary-soft, #eef2ff); }
.drill-role-emoji { font-size: 26px; line-height: 1.2; flex: none; }
.drill-role-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.drill-role-main b { font-size: 15px; color: var(--text, #1f2430); }
.drill-role-main span { font-size: 13px; color: var(--text-2, #6b7280); }
.drill-role-main i { font-style: normal; font-size: 12px; color: var(--primary, #3b6cf6); }
/* 对话气泡 */
.drill-msg { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; max-width: 78%; }
.drill-msg.me { margin-left: auto; align-items: flex-end; }
.drill-who { font-size: 11px; color: var(--text-2, #6b7280); }
.drill-bubble {
  padding: 10px 13px; border-radius: 12px; font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg, #f4f6fb); color: var(--text, #1f2430);
}
.drill-msg.me .drill-bubble { background: var(--primary, #3b6cf6); color: #fff; }
/* 实时评分卡 */
.drill-score {
  border: 1px solid var(--border, #e5e8f0); border-radius: 12px;
  padding: 12px 14px; margin: 4px 0 16px; background: var(--card, #fff);
}
.drill-score-head { font-size: 13px; color: var(--text-2, #6b7280); margin-bottom: 10px; }
.drill-score-head b { font-size: 20px; color: var(--primary, #3b6cf6); margin: 0 2px; }
.drill-dims { display: flex; flex-direction: column; gap: 6px; }
.drill-dim { display: flex; align-items: center; gap: 8px; }
.drill-dim-label { width: 62px; flex: none; font-size: 12px; color: var(--text-2, #6b7280); }
.drill-dim-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--bg, #f4f6fb); overflow: hidden; }
.drill-dim-bar i { display: block; height: 100%; border-radius: 4px; background: #94a3b8; }
.drill-dim-bar i.good { background: #16a34a; }
.drill-dim-bar i.mid { background: #f59e0b; }
.drill-dim-bar i.low { background: #e5484d; }
.drill-dim-val { width: 30px; flex: none; text-align: right; font-size: 12px; color: var(--text, #1f2430); font-weight: 600; }
.drill-line {
  margin-top: 10px; font-size: 13px; line-height: 1.7; color: var(--text, #1f2430);
  background: var(--bg, #f4f6fb); border-radius: 8px; padding: 8px 10px;
}
.drill-line b { display: block; font-size: 12px; color: var(--text-2, #6b7280); margin-bottom: 2px; }
.drill-line.ok b { color: #16a34a; }
.drill-line.warn b { color: #b45309; }
.drill-line.tip b, .drill-line.total b { color: var(--primary, #3b6cf6); }
.drill-line ul { margin: 0; padding-left: 18px; }
.drill-line li { margin-bottom: 3px; }
.drill-score-err, .drill-loading { font-size: 12px; color: var(--text-2, #6b7280); }
/* 复盘报告 */
.drill-report { margin-top: 6px; }
.drill-report-head {
  font-size: 16px; font-weight: 700; color: var(--text, #1f2430);
  margin-bottom: 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.drill-report-head span { font-size: 12px; font-weight: 400; color: var(--text-2, #6b7280); }
.drill-ai { margin-top: 10px; }
.drill-again { margin-top: 14px; width: 100%; padding: 11px; font-size: 14px; }
/* 输入区 */
.drill-input { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border, #e5e8f0); align-items: flex-end; }
.drill-input textarea {
  flex: 1; min-height: 42px; max-height: 140px; resize: none;
  border: 1px solid var(--border, #e5e8f0); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; line-height: 1.6; color: var(--text, #1f2430);
  background: var(--card, #fff); outline: none; font-family: inherit;
}
.drill-input textarea:focus { border-color: var(--primary, #3b6cf6); }
.drill-input .drill-btn { height: 42px; padding: 0 18px; }
/* 手机端 */
@media (max-width: 720px) {
  .drill-mask { padding: 0; }
  .drill-panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; max-width: none; }
  .drill-head { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .drill-sub { display: none; }
  .drill-body { padding: 12px; }
  .drill-msg { max-width: 88%; }
  .drill-dim-label { width: 54px; font-size: 11.5px; }
  .drill-input { padding: 10px 12px; }
  .drill-input textarea { font-size: 15px; min-height: 44px; }
  .drill-input .drill-btn { height: 44px; padding: 0 16px; }
  .drill-role { padding: 12px; }
}

/* ===== 拍题 / 拍卷分析：数学学情诊断面板（v3.45） ===== */
.scan-mask {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.scan-panel {
  width: min(920px, 100%); height: min(780px, 100%);
  background: var(--card, #fff); border-radius: var(--radius, 14px);
  box-shadow: var(--shadow, 0 6px 24px rgba(30, 41, 59, 0.08));
  display: flex; flex-direction: column; overflow: hidden;
}
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border, #e5e8f0); }
.scan-title { font-size: 16px; font-weight: 700; color: var(--text, #1f2430); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scan-sub { font-size: 12px; font-weight: 400; color: var(--text-2, #6b7280); }
.scan-head-btns { display: flex; align-items: center; gap: 6px; }
.scan-btn { border: 1px solid var(--border, #e5e8f0); background: var(--card, #fff); color: var(--text, #1f2430); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; font-family: inherit; }
.scan-btn:hover { background: var(--primary-soft, #eef2ff); }
.scan-btn.primary { background: var(--primary, #3b6cf6); border-color: var(--primary, #3b6cf6); color: #fff; }
.scan-btn.primary:hover { background: var(--primary-dark, #2f57d6); }
.scan-btn.close { padding: 7px 10px; }
.scan-body { flex: 1 1 auto; overflow-y: auto; padding: 18px; overscroll-behavior: contain; }
/* 选图 */
.scan-pick { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 12px; text-align: center; }
.scan-pick-icon { font-size: 40px; }
.scan-pick-tip { font-size: 13.5px; color: var(--text-2, #6b7280); line-height: 1.8; margin: 0; max-width: 460px; }
.scan-pick-btn { padding: 11px 26px; font-size: 14.5px; }
.scan-pick-alt { font-size: 12.5px; color: var(--text-2, #6b7280); }
.scan-grade { font-size: 12.5px; color: var(--text-2, #6b7280); display: flex; align-items: center; gap: 6px; }
.scan-grade input { border: 1px solid var(--border, #e5e8f0); border-radius: 8px; padding: 7px 10px; font-size: 13px; color: var(--text, #1f2430); background: var(--card, #fff); width: 130px; font-family: inherit; }
/* 预览 */
.scan-preview { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.scan-preview img { max-width: 100%; max-height: 46vh; border-radius: 12px; border: 1px solid var(--border, #e5e8f0); object-fit: contain; background: var(--bg, #f4f6fb); }
.scan-preview-actions { display: flex; gap: 10px; }
/* 加载 / 错误 */
.scan-loading { text-align: center; padding: 60px 12px; font-size: 14px; color: var(--text-2, #6b7280); line-height: 2; }
.scan-loading span { font-size: 12px; }
.scan-spinner { width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--border, #e5e8f0); border-top-color: var(--primary, #3b6cf6); animation: scan-spin .9s linear infinite; }
@keyframes scan-spin { to { transform: rotate(360deg); } }
.scan-error { text-align: center; padding: 40px 16px; font-size: 14px; color: var(--text, #1f2430); line-height: 1.9; }
.scan-err-hint { font-size: 12.5px; color: var(--text-2, #6b7280); margin: 8px 0 16px; }
/* 报告卡片 */
.scan-card { border: 1px solid var(--border, #e5e8f0); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--card, #fff); }
.scan-card-head { font-size: 14px; font-weight: 700; color: var(--text, #1f2430); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.scan-visual { margin: 0; padding: 12px; border-radius: 8px; background: var(--bg, #f4f6fb); font-size: 13px; line-height: 1.8; color: var(--text, #1f2430); white-space: pre-wrap; word-break: break-word; font-family: inherit; max-height: 260px; overflow: auto; }
.scan-pt { padding: 10px 0; border-top: 1px dashed var(--border, #e5e8f0); }
.scan-pt:first-child { border-top: none; padding-top: 0; }
.scan-pt-name { font-size: 14px; font-weight: 600; color: var(--text, #1f2430); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scan-tag { font-size: 11px; font-weight: 400; padding: 2px 7px; border-radius: 6px; background: var(--primary-soft, #eef2ff); color: var(--primary, #3b6cf6); }
.scan-chain { font-size: 12.5px; color: var(--text-2, #6b7280); line-height: 1.9; margin-top: 5px; }
.scan-chain-label { display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 5px; background: var(--bg, #f4f6fb); color: var(--text-2, #6b7280); font-size: 11px; }
.scan-chain b { color: var(--primary, #3b6cf6); }
.scan-pt-sum { font-size: 12.5px; color: var(--text-2, #6b7280); line-height: 1.8; margin-top: 4px; }
.scan-row { font-size: 13.5px; line-height: 1.9; color: var(--text, #1f2430); margin-bottom: 8px; }
.scan-row b { display: inline-block; min-width: 56px; margin-right: 8px; font-size: 12px; color: var(--text-2, #6b7280); font-weight: 500; }
.scan-row.hl { background: var(--primary-soft, #eef2ff); border-radius: 8px; padding: 9px 11px; color: var(--text, #1f2430); }
.scan-order { margin: 4px 0 0; padding-left: 20px; }
.scan-order li { margin-bottom: 3px; font-size: 13px; }
.scan-rec { display: flex; flex-direction: column; gap: 4px; }
.scan-rec b { font-size: 15px; color: var(--primary, #3b6cf6); }
.scan-rec span { font-size: 13px; color: var(--text-2, #6b7280); line-height: 1.7; }
.scan-none { font-size: 12.5px; color: var(--text-2, #6b7280); line-height: 1.9; }
.scan-script { font-size: 13.5px; line-height: 1.9; color: var(--text, #1f2430); background: var(--bg, #f4f6fb); border-radius: 8px; padding: 11px 13px; white-space: pre-wrap; }
.scan-next { font-size: 13.5px; line-height: 1.8; color: var(--text, #1f2430); }
.scan-copy { margin-left: auto; border: 1px solid var(--border, #e5e8f0); background: var(--card, #fff); color: var(--text-2, #6b7280); border-radius: 6px; padding: 3px 9px; font-size: 11.5px; cursor: pointer; font-family: inherit; }
.scan-copy:hover { background: var(--primary-soft, #eef2ff); color: var(--primary, #3b6cf6); }
/* 设置里的班型产品库 */
.set-block { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--border, #e5e8f0); border-radius: 10px; }
.set-block-head { font-size: 13px; font-weight: 600; color: var(--text, #1f2430); display: flex; align-items: center; gap: 10px; }
.link-btn { margin-left: auto; border: none; background: none; color: var(--primary, #3b6cf6); font-size: 12.5px; cursor: pointer; padding: 2px 4px; font-family: inherit; }
.set-block-tip { font-size: 12px; color: var(--text-2, #6b7280); line-height: 1.7; margin: 6px 0 10px; }
.prod-row { display: grid; grid-template-columns: 1.6fr 1fr 1.8fr 1fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.prod-row input { border: 1px solid var(--border, #e5e8f0); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; color: var(--text, #1f2430); background: var(--card, #fff); font-family: inherit; min-width: 0; }
.prod-del { border: 1px solid var(--border, #e5e8f0); background: var(--card, #fff); color: var(--text-2, #6b7280); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 12px; line-height: 1; }
.prod-del:hover { border-color: var(--danger, #e5484d); color: var(--danger, #e5484d); }
@media (max-width: 720px) {
  .scan-mask { padding: 0; }
  .scan-panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; max-width: none; }
  .scan-head { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .scan-sub { display: none; }
  .scan-body { padding: 12px; }
  .scan-preview img { max-height: 38vh; }
  .prod-row { grid-template-columns: 1fr 1fr; }
  .prod-row .prod-for { grid-column: 1 / -1; }
}
