/* 应子 · 样式表
   适配顺序：手机（默认）→ 平板（≥768px）→ 桌面（≥1100px） */

:root {
  --brand: #2563b8;
  --brand-dark: #1b4a8f;
  --brand-soft: #eaf1fb;
  --accent: #0f9b8e;
  --bg: #f0f3f9;
  --panel: #ffffff;
  --ink: #1b2130;
  --ink-2: #55617a;
  --ink-3: #8e9ab3;
  --line: #dfe5f1;
  --danger: #c94b46;
  --ok: #1a8f6a;
  --shadow: 0 4px 16px rgba(27, 58, 107, .07);
  --radius: 12px;
  --topbar-h: 52px;
  --tabbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 15px; line-height: 1.68;
  -webkit-text-size-adjust: 100%;
}
[v-cloak] { display: none; }

#app {
  /* 固定定位铺满视口：手机上不受地址栏收缩、100vh 各种兼容问题影响 */
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* 图标 */
.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico svg { width: 19px; height: 19px; display: block; }

/* ============================ 移动端顶栏 ============================ */
.topbar-mobile {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; padding-top: env(safe-area-inset-top);
  background: #1d3a6b; color: #fff; z-index: 20;
}
.topbar-mobile h1 { font-size: 16px; font-weight: 500; margin: 0; }
.icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 10px;
  background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* ============================ 底部导航 ============================ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #fff; border-top: 1px solid var(--line);
}
.tab-item {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: inherit; font-size: 11px; color: var(--ink-3);
}
.tab-item.active { color: var(--brand); }
.tab-item .ico svg { width: 21px; height: 21px; }

/* ============================ 侧边导航 ============================ */
.rail { display: none; }

/* ============================ 工作区与页面 ============================ */
.workspace { flex: 1; min-width: 0; position: relative; overflow: hidden; }

.page {
  position: absolute; inset: 0;
  padding: 14px 14px calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.page.chat-page { overflow: hidden; padding-bottom: 0; }

.page-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 8px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-2); font-size: 13.5px; font-family: inherit; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.ghost-btn .ico svg { width: 17px; height: 17px; }
.ghost-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.ghost-btn:disabled { opacity: .45; cursor: not-allowed; }
.ghost-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.ghost-btn.primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; }

.mini-btn {
  min-height: 30px; padding: 4px 10px;
  background: #f4f7fd; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2); font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.mini-btn:hover { border-color: var(--brand); color: var(--brand); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.mini-btn:disabled { opacity: .4; cursor: not-allowed; }
.mini-btn.closeOnly { display: none; }

/* ============================ 对话页 ============================ */
.chat-layout { flex: 1; min-height: 0; display: flex; gap: 14px; }

.session-panel {
  position: fixed; top: 0; bottom: 0; left: 0; width: 82vw; max-width: 320px;
  z-index: 45; background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease;
  padding-top: env(safe-area-inset-top);
}
.session-panel.open { transform: none; box-shadow: 0 0 40px rgba(16, 32, 63, .22); }
.drawer-mask { position: fixed; inset: 0; background: rgba(16, 32, 63, .38); z-index: 44; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2);
}
.panel-actions { display: flex; gap: 6px; }
.session-list { flex: 1; overflow-y: auto; padding: 8px; }
.session-item {
  display: flex; align-items: center; gap: 6px;
  padding: 10px; border-radius: 10px; cursor: pointer;
}
.session-item:hover { background: var(--brand-soft); }
.session-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.s-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.s-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-meta { font-size: 11px; color: var(--ink-3); }
.s-del {
  width: 28px; height: 28px; flex: 0 0 28px; padding: 0;
  border: none; border-radius: 8px; background: transparent;
  color: var(--ink-3); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.s-del .ico svg { width: 15px; height: 15px; }
.s-del:hover { background: #fdecec; color: var(--danger); }
.panel-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 20px 8px; margin: 0; }

.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; min-height: 0; }

.mode-bar {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none;
}
.mode-bar::-webkit-scrollbar { display: none; }
.mode-bar-label { display: none; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.mode-pill {
  flex: 0 0 auto; min-height: 34px; padding: 6px 13px;
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink-2); font-size: 13px; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.mode-pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill-tag { font-size: 10.5px; background: #fdf0e0; color: #a8620d; padding: 0 6px; border-radius: 20px; }
.mode-pill.active .pill-tag { background: rgba(255, 255, 255, .22); color: #fff; }

.chat {
  flex: 1; min-height: 0; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px 4px; box-shadow: var(--shadow);
}

.welcome { max-width: 720px; margin: 18px auto; text-align: center; }
.welcome-icon {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 15px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff; font-size: 25px; font-weight: 600;
  display: grid; place-items: center;
}
.welcome h3 { margin: 0 0 6px; font-size: 17px; }
.welcome p { margin: 0 auto 16px; color: var(--ink-2); font-size: 13.5px; max-width: 560px; }
.suggest-grid { display: grid; grid-template-columns: 1fr; gap: 8px; text-align: left; }
.suggest-card {
  background: #fafcff; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 13.5px; color: var(--ink-2);
  font-family: inherit; cursor: pointer; text-align: left; line-height: 1.5;
}
.suggest-card:hover { border-color: var(--brand); color: var(--brand); }

.msg { display: flex; gap: 10px; max-width: 900px; margin: 0 auto 16px; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 13.5px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.msg.user .avatar { background: #5b6b8c; }
.bubble-wrap { min-width: 0; max-width: 88%; }
.bubble {
  background: #fafcff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; overflow-wrap: anywhere;
}
.msg.user .bubble { background: var(--brand); border-color: var(--brand); color: #fff; }
.plain { white-space: pre-wrap; }
.msg-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }

.caret { display: inline-block; width: 6px; height: 14px; margin-left: 3px; background: var(--brand); vertical-align: -2px; animation: blink .9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.think { background: #f5f8fd; border: 1px solid #dde6f4; border-radius: 10px; padding: 8px 11px; margin-bottom: 9px; font-size: 12.5px; color: var(--ink-2); }
.think summary { cursor: pointer; font-size: 12.5px; }
.think-body { margin-top: 7px; padding-top: 7px; border-top: 1px solid #e6ecf7; white-space: pre-wrap; max-height: 220px; overflow-y: auto; font-size: 12.5px; color: #6b7893; }

.sources { margin-top: 8px; }
.src-label { font-size: 12px; color: var(--ink-3); }
.src-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.src-item { background: #f7faff; border: 1px solid #dce7f7; border-radius: 10px; padding: 8px 11px; font-size: 12.5px; color: var(--ink-2); }
.src-head { color: var(--ink); margin-bottom: 3px; }
.src-score { float: right; color: var(--accent); font-size: 11.5px; }
.src-snippet { font-size: 12.5px; }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 14px 0 6px; line-height: 1.4; }
.md h2 { font-size: 16px; } .md h3 { font-size: 15px; } .md h4 { font-size: 14.5px; }
.md p { margin: 7px 0; }
.md ul, .md ol { margin: 7px 0; padding-left: 20px; }
.md li { margin: 3px 0; }
.md code { background: #eef3fc; color: #a83a5c; padding: 1px 5px; border-radius: 5px; font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.md pre { background: #16233a; color: #e8eef8; padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 9px 0; }
.md pre code { background: none; color: inherit; padding: 0; font-size: 12.5px; line-height: 1.6; }
.md blockquote { margin: 9px 0; padding: 7px 12px; border-left: 3px solid var(--brand); background: #f4f8ff; color: var(--ink-2); border-radius: 0 8px 8px 0; }
.md table { border-collapse: collapse; margin: 9px 0; width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.md th { background: #f4f7fd; }
.md strong { color: var(--brand-dark); }
.msg.user .md strong { color: #fff; }

.composer {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 0 calc(10px + var(--tabbar-h) + env(safe-area-inset-bottom));
  background: var(--bg);
}
.composer textarea {
  flex: 1; min-height: 44px; max-height: 140px; resize: none;
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-size: 15px; font-family: inherit; line-height: 1.55; outline: none;
  background: #fff; color: var(--ink);
}
.composer textarea:focus { border-color: var(--brand); }
.send-btn {
  flex: 0 0 auto; min-width: 52px; height: 44px; padding: 0 16px;
  border: none; border-radius: 12px; background: var(--brand); color: #fff;
  font-size: 14.5px; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.send-btn:disabled { opacity: .5; cursor: not-allowed; }
.send-btn.stop { background: var(--danger); }
.send-btn .btn-text { display: none; }

/* ============================ 卡片与面板 ============================ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card-label { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.card-value { margin: 3px 0 2px; font-size: 23px; font-weight: 600; color: var(--brand-dark); line-height: 1.25; }
.card-value.small { font-size: 16px; }
.card-value small { font-size: 12px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.card-foot { margin: 0; font-size: 11.5px; color: var(--ink-3); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 14px; }
.panel-title { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; margin-bottom: 10px; flex-wrap: wrap; }
.panel-title.sub { margin-top: 18px; }
.panel-tip { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.panel-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.note { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }

/* 表格：手机端改为卡片式 */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { padding: 8px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { font-size: 12.5px; font-weight: 500; color: var(--ink-3); background: #f7f9fd; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table.clickable tbody tr { cursor: pointer; }
.q-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.mono { font-family: Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--ink-3); font-size: 12.5px; }
.empty-row { text-align: center; color: var(--ink-3); padding: 18px 0; }
.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; }

/* 柱状图 */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 14px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.bar-count { font-size: 10.5px; color: var(--ink-3); height: 13px; }
.bar { width: 70%; min-height: 4px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, #6f9fe0, var(--brand)); }
.bar-label { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }

.mode-dist { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.dist-name { flex: 0 0 116px; color: var(--ink-2); }
.dist-bar { flex: 1; height: 8px; background: #eef2f9; border-radius: 6px; overflow: hidden; }
.dist-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--brand)); }
.dist-count { flex: 0 0 30px; text-align: right; color: var(--ink-3); }

/* ============================ 知识库 ============================ */
.dropzone { border: 1.5px dashed #c3d3ea; border-radius: var(--radius); background: #f8fbff; padding: 20px 16px; text-align: center; margin-bottom: 14px; }
.dropzone.dragging { border-color: var(--accent); background: #effaf8; }
.dropzone.disabled { opacity: .75; border-style: solid; background: #f7f9fd; }
.dz-title { margin: 0 0 4px; font-size: 14.5px; color: var(--ink-2); }
.dz-sub { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.probe-row { display: flex; gap: 8px; margin-bottom: 10px; }
.probe-row input, .search-input {
  flex: 1; min-height: 38px; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13.5px; font-family: inherit; outline: none; background: #fbfcff; color: var(--ink);
}
.probe-row input:focus, .search-input:focus { border-color: var(--brand); }
.search-input { flex: 0 0 auto; width: 100%; max-width: 240px; }
.probe-results { display: flex; flex-direction: column; gap: 8px; }
.probe-item { background: #f7faff; border: 1px solid #dce7f7; border-radius: 10px; padding: 9px 11px; font-size: 12.5px; }

/* 学习小结 */
.summary-panel { border-color: #cfe0f7; }
.summary-body { font-size: 14px; line-height: 1.75; }
.summary-body h3 { font-size: 15px; margin: 14px 0 6px; }
.summary-body h3:first-child { margin-top: 0; }

.tips { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.tips li { margin: 6px 0; }

/* ============================ 标签与弹窗 ============================ */
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 20px; background: #eef2f9; color: var(--ink-2); }
.tag.admin { background: #fdf0e0; color: #a8620d; }
.tag.ok { background: #e9f7f1; color: var(--ok); }
.tag.off { background: #fdecec; color: var(--danger); }

.modal-mask { position: fixed; inset: 0; z-index: 60; background: rgba(16, 32, 63, .42); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 480px;
  /* vh 在手机上按最大视口算，含被地址栏挡住的那块，结果弹窗底部
     落到屏幕外够不着。dvh 按当前实际可见高度算。 */
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; background: var(--panel); border-radius: 14px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .icon-btn { color: var(--ink-2); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.modal-body hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.modal-body h4 { margin: 0; font-size: 14.5px; }
.modal-body label, .auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.modal-body input, .auth-form input {
  min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 15px; font-family: inherit; outline: none; background: #fbfcff; color: var(--ink);
}
.modal-body input:focus, .auth-form input:focus { border-color: var(--brand); }
.modal-body input:disabled, .auth-form input:disabled { background: #f3f5fa; color: var(--ink-3); }
.grid-2col { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* ============================ 登录 / 注册 ============================ */
.auth-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: #eef2f9;
}
.auth-card { width: 100%; max-width: 430px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 24px 22px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; color: #fff; font-size: 20px; font-weight: 600; }
.auth-brand h1 { margin: 0; font-size: 19px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.auth-tabs { display: flex; gap: 4px; background: #f0f4fb; border-radius: 10px; padding: 4px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; border: none; background: none; padding: 9px 0; border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.auth-tabs button.active { background: #fff; color: var(--brand); font-weight: 500; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.primary-btn {
  min-height: 46px; margin-top: 4px; border: none; border-radius: 11px;
  background: var(--brand); color: #fff; font-size: 15px; font-family: inherit; cursor: pointer;
}
.primary-btn:hover:not(:disabled) { background: var(--brand-dark); }
.primary-btn:disabled { opacity: .55; cursor: not-allowed; }
.auth-msg { margin: 12px 0 0; font-size: 13px; color: var(--ok); }
.auth-msg.error { color: var(--danger); }
.auth-tip { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }

/* ============================ 平板 ≥768px ============================ */
@media (min-width: 768px) {
  body { font-size: 14.5px; }
  .topbar-mobile, .tabbar { display: none; }

  #app { flex-direction: row; }
  .rail {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    /* 导航改成两列之后要更宽：原来 78px 只够一列。
       150px 下每列约 68px，四个字的标签放得下。 */
    width: 150px; flex: 0 0 150px; padding: 16px 10px;
    background: #1d3a6b; color: #dce6f5;
  }
  .rail-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .rail-name { font-size: 13.5px; color: #a9bfdd; }
  .rail-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
  }
  .rail-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 9px 2px; border: none; border-radius: 11px;
    background: transparent; color: #c2d3ea; font-family: inherit; font-size: 11.5px;
    cursor: pointer; min-width: 0; line-height: 1.25;
  }
  .rail-item:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .rail-item.active { background: rgba(255, 255, 255, .16); color: #fff; }
  .rail-foot { margin-top: auto; width: 100%; text-align: center; }
  .rail-user { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px; border: none; border-radius: 10px; background: rgba(255, 255, 255, .07); color: #dce6f5; font-family: inherit; cursor: pointer; }
  .rail-user:hover { background: rgba(255, 255, 255, .15); }
  .avatar-sm { width: 26px; height: 26px; border-radius: 9px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 12.5px; }
  .rail-uname { font-size: 13px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail-role { font-size: 11.5px; color: #8fb4e0; }
  .rail-role.admin { color: #f3c07b; }
  .rail-kb { font-size: 12px; color: #8fa8c8; margin: 4px 0 0; }
  .mini-btn.logout { width: 100%; margin-top: 6px; background: rgba(255, 255, 255, .1); border-color: transparent; color: #dce6f5; }
  .mini-btn.logout:hover { background: rgba(255, 255, 255, .2); color: #fff; }

  .page { padding: 16px 18px; }
  .page.chat-page { padding-bottom: 16px; }
  .page-head { flex-direction: row; align-items: flex-start; justify-content: space-between; }
  .page-head h2 { font-size: 19px; }
  .grid-2col { grid-template-columns: 1fr 1fr; }
  .suggest-grid { grid-template-columns: 1fr 1fr; }
  .send-btn .btn-text { display: inline; }
  .composer { padding-bottom: 12px; }
  .mode-bar-label { display: inline; }
}

/* ============================ 桌面 ≥1100px ============================ */
@media (min-width: 1100px) {
  .page { padding: 18px 22px; }
  .grid-2 { grid-template-columns: 1.1fr .9fr; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
  .ghost-btn.inlineOnly { display: none; }

  /* 会话列表回到左侧栏内，不再用抽屉 */
  .chat-layout { position: relative; }
  .session-panel {
    position: static; transform: none; width: 232px; flex: 0 0 232px; max-width: none;
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    padding-top: 0; z-index: auto;
  }
  .session-panel.open { box-shadow: var(--shadow); }
  .drawer-mask { display: none; }
  .mini-btn.closeOnly { display: none; }
  .chat-main { gap: 12px; }
}

/* ============================ 手机端：对话页布局 ============================ */
@media (max-width: 767px) {
  /* 手机上标题已由顶栏显示，这里只收标题；动作按钮必须保留，
     否则朗读、提示词、示例提问、导出记录、清空在手机上全都点不到 */
  .page.chat-page > .page-head { padding: 8px 12px 0; }
  .page.chat-page > .page-head > div:first-child { display: none; }

  .page.chat-page { padding: 0; height: 100%; min-height: 0; overflow: hidden; }

  .chat-layout {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column; gap: 0;
  }
  .chat-main {
    flex: 1 1 auto; min-height: 0;
    display: flex; flex-direction: column; gap: 8px;
    padding: 8px 10px 0;
  }
  .mode-bar { flex: 0 0 auto; padding: 0 2px; }

  /* 关键：明确 flex 基准为 0 并允许压缩，对话区才能自己滚动 */
  .chat {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 12px 4px;
  }
  .composer {
    flex: 0 0 auto;
    padding: 8px 0 calc(8px + var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  .composer textarea { min-height: 42px; font-size: 16px; }   /* 16px 可防止 iOS 聚焦时自动放大 */
  .welcome { margin: 8px auto; }
  .welcome-icon { width: 46px; height: 46px; font-size: 22px; margin-bottom: 10px; }
  .welcome h3 { font-size: 16px; }
  .suggest-card { padding: 10px 12px; font-size: 13px; }
  .msg { gap: 8px; margin-bottom: 14px; }
  .bubble-wrap { max-width: 92%; }
  .bubble { padding: 10px 12px; }
}

/* ============================ 手机端表格改为卡片 ============================ */
@media (max-width: 767px) {
  .table-wrap { overflow-x: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 8px 12px; margin-bottom: 10px; background: #fff;
  }
  .data-table tbody tr:hover { background: #fff; }
  .data-table td {
    border: none; padding: 4px 0;
    display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px;
  }
  .data-table td::before {
    content: attr(data-label);
    flex: 0 0 80px; color: var(--ink-3); font-size: 12.5px;
  }
  .data-table td:not([data-label])::before { content: none; }
  .data-table td:not([data-label]) { justify-content: flex-end; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
  .data-table td.empty-row { display: block; text-align: center; padding: 16px 0; }
  .data-table td.empty-row::before { content: none; }
  .data-table .q-cell { white-space: normal; max-width: none; }
  .rank { width: 18px; height: 18px; }
}

/* 触屏设备微调 */
@media (hover: none) {
  .data-table tbody tr:hover { background: transparent; }
  .s-del { opacity: 1; }
}

/* ============================ 主题切换按钮 ============================ */
.topbar-right { display: inline-flex; align-items: center; gap: 2px; }
.rail-theme {
  width: 100%; margin-top: 8px; padding: 7px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: none; border-radius: 10px; cursor: pointer; font-family: inherit;
  background: rgba(255, 255, 255, .07); color: #dce6f5; font-size: 11px;
}
.rail-theme:hover { background: rgba(255, 255, 255, .16); }
.rail-theme .ico svg { width: 17px; height: 17px; }
.rail-clock { font-size: 12px; color: #8fa8c8; }
.rail-link {
  display: block; width: 100%; margin-top: 6px; padding: 5px 0;
  font-size: 11.5px; color: #8fa8c8; text-decoration: none;
  border-radius: 8px; text-align: center;
}
.rail-link:hover { background: rgba(255, 255, 255, .1); color: #dce6f5; }

/* ============================ 夜间深色主题（22 点后自动启用） ============================ */
[data-theme="dark"] {
  --brand: #5b93e0;
  --brand-dark: #85b1ec;
  --brand-soft: #1c2942;
  --accent: #3fc0b0;
  --bg: #0f1319;
  --panel: #171c24;
  --ink: #e6ebf3;
  --ink-2: #a9b4c6;
  --ink-3: #7b8798;
  --line: #262d38;
  --danger: #e0736c;
  --ok: #4fc79c;
  --shadow: 0 4px 18px rgba(0, 0, 0, .45);
}
[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
[data-theme="dark"] .topbar-mobile,
[data-theme="dark"] .rail { background: #0b0f14; }
[data-theme="dark"] .tabbar { background: #12171e; border-top-color: var(--line); }
[data-theme="dark"] .ghost-btn,
[data-theme="dark"] .mode-pill,
[data-theme="dark"] .composer textarea,
[data-theme="dark"] .probe-row input,
[data-theme="dark"] .search-input,
[data-theme="dark"] .modal-body input,
[data-theme="dark"] .auth-form input { background: #1b212a; border-color: var(--line); color: var(--ink); }
[data-theme="dark"] .mini-btn { background: #1b212a; border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .mini-btn.logout { background: rgba(255, 255, 255, .08); color: #dce6f5; }
[data-theme="dark"] .session-item:hover,
[data-theme="dark"] .session-item.active { background: #1c2942; }
[data-theme="dark"] .bubble,
[data-theme="dark"] .suggest-card,
[data-theme="dark"] .dropzone { background: #1b212a; border-color: var(--line); }
[data-theme="dark"] .msg.user .bubble { background: #2a5aa8; border-color: #2a5aa8; color: #fff; }
[data-theme="dark"] .dropzone.disabled { background: #141920; }
[data-theme="dark"] .think { background: #161c26; border-color: #26313f; }
[data-theme="dark"] .think-body { border-top-color: #26313f; color: var(--ink-2); }
[data-theme="dark"] .src-item,
[data-theme="dark"] .probe-item { background: #161c26; border-color: #26313f; }
[data-theme="dark"] .summary-panel { border-color: #2b3a52; }
[data-theme="dark"] .md code { background: #1f2833; color: #f0a7c0; }
[data-theme="dark"] .md pre { background: #0b0f14; border: 1px solid var(--line); }
[data-theme="dark"] .md blockquote { background: #161c26; }
[data-theme="dark"] .md th,
[data-theme="dark"] .data-table th { background: #1b212a; }
[data-theme="dark"] .md strong { color: #9dc0f0; }
[data-theme="dark"] .data-table tbody tr:hover { background: #1b212a; }
[data-theme="dark"] .auth-wrap { background: var(--bg); }
[data-theme="dark"] .auth-tabs { background: #1b212a; }
[data-theme="dark"] .auth-tabs button.active { background: #232b36; color: var(--ink); }
[data-theme="dark"] .tag { background: #1f2731; color: var(--ink-2); }
[data-theme="dark"] .tag.admin { background: #3a2c15; color: #e8bb7a; }
[data-theme="dark"] .tag.ok { background: #16302a; color: var(--ok); }
[data-theme="dark"] .tag.off { background: #38201f; color: var(--danger); }
[data-theme="dark"] .rank { background: #1c2942; color: #8fb6ec; }
[data-theme="dark"] .dist-bar { background: #232b36; }
[data-theme="dark"] .bar { background: linear-gradient(180deg, #4b7cc0, #2c5ea8); }
[data-theme="dark"] .bar-count,
[data-theme="dark"] .bar-label { color: var(--ink-3); }
[data-theme="dark"] .pill-tag { background: #3a2c15; color: #e8bb7a; }
[data-theme="dark"] .modal-mask { background: rgba(0, 0, 0, .62); }
[data-theme="dark"] .welcome-icon { box-shadow: none; }
[data-theme="dark"] .send-btn { background: #3b7ad0; }
[data-theme="dark"] .send-btn.stop { background: #b0504a; }

/* 推荐学习内容 */
.link-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.link-card {
  background: #f7faff; border: 1px solid #dce7f7; border-radius: 12px;
  padding: 12px 14px;
}
.link-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; color: var(--ink); }
.link-heading { color: var(--ink-2); font-size: 13px; }
.link-why { margin: 6px 0 4px; font-size: 12.5px; color: var(--accent); }
.link-snippet { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-2); }
.link-actions { display: flex; gap: 6px; flex-wrap: wrap; }
[data-theme="dark"] .link-card { background: #161c26; border-color: #26313f; }
@media (min-width: 700px) {
  .link-cards { grid-template-columns: 1fr 1fr; }
}

/* 班级 */
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.inline-form .text-input { flex: 1 1 160px; min-width: 0; }
.code-input { max-width: 160px; letter-spacing: 2px; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.class-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.class-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  background: #f7faff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.class-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.class-main .muted { color: var(--ink-3); font-size: 12.5px; }
.code-chip {
  font-family: Consolas, monospace; font-size: 13px; letter-spacing: 2px;
  background: #e8f1ff; color: var(--brand); border-radius: 8px; padding: 2px 10px; cursor: pointer;
}
.ok-tip { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #e9f7f1; color: #1a8f6a; font-size: 13px; }
.err-tip { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #fdeceb; color: #c0392b; font-size: 13px; }

/* 模型用量 */
.usage-bars { display: flex; align-items: flex-end; gap: 6px; height: 92px; margin: 10px 0 4px; }
.usage-bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.usage-bar .bar { width: 100%; max-width: 26px; min-height: 3px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, var(--brand), #7fb0ea); }
.usage-bar em { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-top: 4px; }

/* 候选知识 */
.growth-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.growth-item { background: #f7faff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.growth-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.growth-head b { font-weight: 500; }
.growth-meta { margin: 5px 0 8px; font-size: 12.5px; color: var(--ink-3); }
.src-score.pending { background: #fff5e6; color: #b7791f; }
.src-score.adopted { background: #e9f7f1; color: #1a8f6a; }
.src-score.rejected { background: #f1f2f5; color: var(--ink-3); }
.growth-content {
  margin: 10px 0 0; padding: 10px 12px; max-height: 320px; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.mini-select {
  height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--ink-2); font-size: 12.5px; padding: 0 6px;
}
[data-theme="dark"] .class-card, [data-theme="dark"] .growth-item { background: #161c26; }
[data-theme="dark"] .growth-content { background: #121821; }
[data-theme="dark"] .code-chip { background: #1b2942; }
@media (min-width: 700px) {
  .growth-list { grid-template-columns: 1fr 1fr; }
}

/* 侧边栏图标与品牌 */
.rail-item svg { width: 26px; height: 26px; }
.rail-brand .mark, .rail-brand > span:first-child { width: 46px; height: 46px; font-size: 22px; }
.rail-item.active { background: rgba(255, 255, 255, .16); color: #fff; }
.rail-item:hover { background: rgba(255, 255, 255, .1); }

/* 知识网络入口（管理员） */
.graph-link {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 10px;
  border-radius: 10px; background: rgba(255, 255, 255, .09); color: #dce6f5;
  font-size: 12.5px; text-decoration: none;
}
.graph-link:hover { background: rgba(255, 255, 255, .16); }
.graph-link svg { width: 18px; height: 18px; }

/* 班级页 */
.class-hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.class-hero-icon {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 15px;
  background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff;
  display: grid; place-items: center;
}
.class-hero-icon svg { width: 28px; height: 28px; }
.class-hero-text { flex: 1 1 auto; min-width: 0; }
.class-hero-text h2 { margin: 0 0 2px; font-size: 19px; }
.class-hero-text p { margin: 0; font-size: 13px; color: var(--ink-2); }

.join-panel .join-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.code-input {
  width: 180px; height: 46px; padding: 0 14px; text-align: center;
  font-family: Consolas, monospace; font-size: 22px; letter-spacing: 6px; text-transform: uppercase;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--ink);
}
.code-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 184, .12); }

.class-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #f7faff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.class-avatar {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff;
  font-size: 19px; display: grid; place-items: center;
}
.class-avatar.small { width: 34px; height: 34px; flex: 0 0 34px; font-size: 16px; border-radius: 10px; }
.class-main { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.class-main b { font-size: 15px; }
.class-main .muted { color: var(--ink-3); font-size: 12.5px; }
.code-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: Consolas, monospace; font-size: 14px; letter-spacing: 3px;
  background: #e8f1ff; color: var(--brand); border-radius: 9px; padding: 3px 10px;
}
.code-chip em { font-style: normal; font-size: 10.5px; letter-spacing: 0; opacity: .7; }
.code-chip:hover { background: #dbe9ff; }
.empty-state { text-align: center; padding: 22px 10px; color: var(--ink-3); }
.empty-state svg { width: 38px; height: 38px; opacity: .45; }
.empty-state p { margin: 8px 0 2px; font-size: 14px; color: var(--ink-2); }
.empty-state small { font-size: 12.5px; }
.btn-ico { display: inline-flex; margin-right: 4px; }
.btn-ico svg { width: 15px; height: 15px; }
[data-theme="dark"] .class-card { background: #161c26; }
[data-theme="dark"] .code-chip { background: #1b2942; }
[data-theme="dark"] .code-input { background: #161c26; color: var(--ink); }

/* 班级页输入区 */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 4px 0 16px; }
.field { display: block; }
.field-label { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .2px; }
.field-input {
  display: flex; align-items: center; gap: 9px; height: 48px; padding: 0 14px;
  background: #f7faff; border: 1.5px solid var(--line); border-radius: 13px; transition: .18s;
}
.field-input:focus-within {
  background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 184, .1);
}
.field-input input {
  flex: 1 1 auto; min-width: 0; height: 100%; border: none; outline: none;
  background: transparent; font-family: inherit; font-size: 14.5px; color: var(--ink);
}
.field-input input::placeholder { color: var(--ink-3); }
.field-ico { display: inline-flex; color: var(--ink-3); transition: .18s; }
.field-ico svg { width: 18px; height: 18px; }
.field-input:focus-within .field-ico { color: var(--brand); }

/* 加入码：6 格 */
.code-box { position: relative; margin: 10px 0 16px; }
.code-cells { display: flex; gap: 10px; justify-content: center; }
.code-cell {
  position: relative; width: 52px; height: 64px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: Consolas, "Courier New", monospace; font-size: 27px; font-weight: 600;
  text-transform: uppercase; color: var(--ink);
  background: #f4f8ff; border: 1.5px solid var(--line);
  transition: transform .16s, border-color .16s, box-shadow .16s, background .16s;
}
.code-cell.filled {
  background: #fff; border-color: var(--brand);
  box-shadow: 0 5px 16px rgba(37, 99, 184, .16);
  transform: translateY(-2px);
}
.code-cell.active { border-color: rgba(37, 99, 184, .55); }
.code-cell.active::after {
  content: ""; position: absolute; width: 2px; height: 26px; border-radius: 1px;
  background: var(--brand); animation: caret 1.05s steps(1) infinite;
}
@keyframes caret { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.code-hidden {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; background: transparent; opacity: 0; cursor: text;
}
.code-box:hover .code-cell { border-color: rgba(37, 99, 184, .4); }

/* 主按钮：渐变 + 悬停浮起 */
.primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--brand), #3f86d8);
  box-shadow: 0 6px 18px rgba(37, 99, 184, .26);
  transition: transform .16s, box-shadow .16s, opacity .16s;
}
.primary-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 99, 184, .32); }
.primary-btn:active:not(:disabled) { transform: translateY(0); }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }
.primary-btn.wide { width: 100%; }
.primary-btn .btn-ico { display: inline-flex; }
.primary-btn .btn-ico svg { width: 16px; height: 16px; }

.class-card { transition: transform .16s, box-shadow .16s, border-color .16s; }
.class-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(27, 58, 107, .1); border-color: #cfdff5; }
.class-card.joined { margin-top: 14px; border-color: #cfe6dd; background: #f4fbf8; }
[data-theme="dark"] .field-input { background: #161c26; }
[data-theme="dark"] .field-input:focus-within { background: #1b2330; }
[data-theme="dark"] .code-cell { background: #161c26; }
[data-theme="dark"] .code-cell.filled { background: #1b2330; }
[data-theme="dark"] .class-card.joined { background: #16241f; border-color: #24483c; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } }

/* 在线标记：一个会呼吸的绿点 */
.online-dot {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px;
  font-size: 11px; color: #1a8f6a;
}
.online-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: #25b37f;
  box-shadow: 0 0 0 0 rgba(37, 179, 127, .6); animation: onlinePulse 1.8s infinite;
}
@keyframes onlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 179, 127, .55); }
  70% { box-shadow: 0 0 0 6px rgba(37, 179, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 179, 127, 0); }
}
.data-table small { color: var(--ink-3); font-size: 11.5px; }

/* 班级卡片折叠与成员面板 */
.class-block { display: flex; flex-direction: column; gap: 0; }
.class-card { cursor: pointer; }
.class-card.open { border-color: #cfdff5; box-shadow: 0 8px 22px rgba(27, 58, 107, .1); }
.chevron { display: inline-flex; margin-left: 5px; transition: transform .22s ease; }
.chevron svg { width: 13px; height: 13px; }
.chevron.up { transform: rotate(180deg); }
.member-panel {
  margin-top: -6px; padding: 14px 16px 16px;
  border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 14px 14px; background: #fbfdff;
  animation: panelOpen .22s ease;
}
@keyframes panelOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.member-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.member-tools .muted { font-size: 12.5px; color: var(--ink-3); }
.field-input.compact { height: 38px; flex: 1 1 220px; max-width: 320px; border-radius: 10px; }
.field-input.compact input { font-size: 13.5px; }
[data-theme="dark"] .member-panel { background: #131922; }

/* AI 提炼进度 */
.distill-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  padding: 12px 16px; border-radius: 12px;
  background: linear-gradient(135deg, #eaf2ff, #eef8f6); border: 1px solid #cfe0f7;
  font-size: 13.5px; color: var(--ink-2);
}
.distill-bar em { display: block; font-style: normal; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.spin {
  width: 15px; height: 15px; flex: 0 0 15px; border-radius: 50%;
  border: 2px solid rgba(37, 99, 184, .25); border-top-color: var(--brand);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
[data-theme="dark"] .distill-bar { background: #16202e; border-color: #26364a; }

/* 批量操作条 */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 70, 229, .08), rgba(20, 184, 166, .08));
  border: 1px solid rgba(79, 70, 229, .22);
  font-size: 13px; color: var(--ink-2);
}
.batch-bar b { color: var(--brand); font-size: 14px; }
.batch-bar button:last-child { margin-left: auto; }
.growth-pick { margin-bottom: 10px; font-size: 12.5px; color: var(--ink-3); }
.growth-pick label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.growth-item { position: relative; transition: border-color .16s, box-shadow .16s; }
.growth-item.picked { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.pick-line { position: absolute; top: 12px; right: 12px; }
.data-table tr.picked { background: rgba(79, 70, 229, .07); }
input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--brand);
  border-radius: 5px; cursor: pointer; margin: 0;
}
.data-table th input[type="checkbox"] { vertical-align: middle; }

/* 提炼模型选择条 */
.distill-picker {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 60%, var(--panel));
}
.dp-label { font-size: 12.5px; color: var(--ink-3); }
.dp-tabs { display: flex; gap: 6px; }
.dp-tabs button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 14px; border-radius: 10px; cursor: pointer; font-family: inherit;
  border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-2);
  font-size: 13.5px; transition: all .16s;
}
.dp-tabs button em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.dp-tabs button.active {
  border-color: var(--brand); color: var(--brand);
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--panel));
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}
.dp-tabs button:disabled { opacity: .5; cursor: not-allowed; }
.dp-status { font-size: 12.5px; color: var(--ink-3); margin-left: auto; }
.dp-status.ok { color: var(--ok); }

/* 提问模板弹窗 */
.tpl-modal { width: min(680px, 92vw); max-height: 80vh; display: flex; flex-direction: column; }
.tpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 14px; }
.tpl-tabs button {
  padding: 7px 16px; border-radius: 999px; cursor: pointer; font-family: inherit;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 13.5px;
  transition: all .16s;
}
.tpl-tabs button.active {
  background: var(--grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .25);
}
.tpl-list {
  display: grid; grid-template-columns: 1fr; gap: 8px;
  overflow-y: auto; padding-right: 4px; margin-bottom: 12px;
}
.tpl-item {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 11px 14px; border-radius: 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); background: var(--panel); font-family: inherit;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.tpl-item:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  transform: translateY(-1px); box-shadow: 0 8px 20px rgba(79, 70, 229, .1);
}
.tpl-item b { font-size: 14px; color: var(--ink); font-weight: 600; }
.tpl-item span { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
@media (min-width: 700px) { .tpl-list { grid-template-columns: 1fr 1fr; } }
