/* ===== 知汇 · 全局样式 ===== */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --text: #1e293b;
  --text-2: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef2ff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 8px 24px rgba(15,23,42,.06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ===== 登录页 ===== */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.auth-bg { position: fixed; inset: 0; z-index: 0; }
.auth-orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; }
.orb-1 { width: 420px; height: 420px; background: #818cf8; top: -120px; left: -100px; }
.orb-2 { width: 380px; height: 380px; background: #22d3ee; bottom: -100px; right: -80px; opacity: .3; }
.orb-3 { width: 300px; height: 300px; background: #c084fc; top: 40%; left: 60%; opacity: .25; }
.auth-wrap { position: relative; z-index: 1; width: 100%; max-width: 400px; padding: 24px; }
.auth-card {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(15,23,42,.12);
  border: 1px solid rgba(255,255,255,.6);
  padding: 36px 32px 28px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(79,70,229,.35);
}
.auth-brand h1 { font-size: 26px; letter-spacing: 2px; }
.auth-slogan { color: var(--text-2); font-size: 13px; margin-top: 4px; }
.auth-tabs { display: flex; background: var(--panel-2); border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 9px 0; border: none; background: transparent;
  border-radius: 8px; font-size: 14px; color: var(--text-2);
  transition: all .18s;
}
.auth-tab.active { background: var(--panel); color: var(--primary); font-weight: 600; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; outline: none; transition: border-color .15s;
  background: #fbfcfe;
}
.field input:focus { border-color: var(--primary); background: var(--panel); }
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 11px 20px; border-radius: 10px; font-size: 15px; font-weight: 600;
  transition: all .15s;
}
.btn-primary:hover { background: var(--primary-2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; transform: none; }
.btn-block { width: 100%; margin-top: 6px; }
.auth-tip { text-align: center; font-size: 13px; color: var(--red); margin-top: 12px; min-height: 18px; }
.auth-tip.ok { color: var(--green); }
.auth-note { text-align: center; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.auth-footer { text-align: center; color: rgba(100,116,139,.8); font-size: 12px; margin-top: 18px; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--panel); color: var(--text);
  padding: 10px 22px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 4px 20px rgba(15,23,42,.15); border: 1px solid var(--border);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 300; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); color: var(--green); }

/* ===== 主平台布局 ===== */
.app { display: flex; height: 100vh; overflow: hidden; }
.app-side {
  width: 232px; flex-shrink: 0; background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.app-logo { display: flex; align-items: center; gap: 10px; padding: 2px 6px 16px; }
.app-logo .logo-box {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #4f46e5, #8b5cf6);
  color: #fff; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.app-logo .logo-txt { font-size: 16px; font-weight: 700; }
.app-logo .logo-sub { font-size: 11px; color: var(--text-2); }

/* 新建对话按钮 */
.btn-new {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; margin-bottom: 10px;
}
.btn-new:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 侧边栏分区标签 */
.side-sec-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .5px; padding: 8px 6px 4px;
}
.side-sec-label .sec-action {
  border: none; background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.side-sec-label .sec-action:hover { background: var(--panel-2); color: var(--text); }

/* 对话搜索 */
.sess-search { padding: 0 2px 6px; }
.sess-search input {
  width: 100%; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 12px; outline: none; background: var(--panel-2);
  color: var(--text);
}
.sess-search input:focus { border-color: var(--primary); background: var(--panel); }

/* 对话列表 */
.sess-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px;
  max-height: 30vh; min-height: 60px;
}
.sess-item {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text); transition: background .12s;
}
.sess-item:hover { background: var(--panel-2); }
.sess-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.sess-item .sess-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sess-ops { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.sess-item:hover .sess-ops { opacity: 1; }
.sess-op {
  width: 20px; height: 20px; border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 12px; cursor: pointer;
}
.sess-op:hover { background: var(--primary); color: #fff; }
.sess-op.del:hover { background: var(--red); color: #fff; }
.sess-empty { font-size: 12px; color: var(--text-2); text-align: center; padding: 14px 8px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px; border: none;
  background: transparent; color: var(--text-2); font-size: 14px;
  transition: all .15s; text-align: left;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; }
.nav-item .badge {
  margin-left: auto; background: var(--primary); color: #fff;
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
}
.side-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px; cursor: pointer; border-radius: 10px; transition: background .15s; }
.side-user:hover { background: var(--panel-2); }
.side-user-arrow { margin-left: auto; font-size: 10px; color: var(--text-2); transition: transform .15s; }
.side-user:hover .side-user-arrow { transform: translateX(2px); color: var(--primary); }
.side-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.side-user .uname { font-size: 13px; font-weight: 600; }
.side-user .urole { font-size: 11px; color: var(--text-2); }
.btn-logout {
  width: 100%; margin-top: 6px; padding: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-2); font-size: 12px;
  transition: all .15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

.app-main { flex: 1; overflow-y: auto; background: var(--bg); }
.page { display: none; padding: 24px 28px; max-width: 1080px; margin: 0 auto; }
.page.active { display: block !important; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; }
.page-head .sub { color: var(--text-2); font-size: 13px; }

/* ===== 卡片 ===== */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* ===== 按钮 ===== */
.btn {
  padding: 8px 16px; border-radius: 9px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: all .13s; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); color: #fff; }
.btn.small { padding: 5px 12px; font-size: 12px; border-radius: 7px; }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.green:hover { opacity: .9; color: #fff; }
.btn.red { color: var(--red); border-color: var(--red); background: transparent; }
.btn.red:hover { background: var(--red); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 表格 ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 10px 12px; color: var(--text-2); font-weight: 500;
  border-bottom: 1.5px solid var(--border); background: #fafbfd; font-size: 12px;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.tbl tr:hover td { background: #fafbfe; }
.empty-tip { text-align: center; color: var(--text-2); padding: 32px 0; font-size: 13px; }

/* ===== 状态徽章 ===== */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.tag.green { background: #dcfce7; color: #15803d; }
.tag.amber { background: #fef3c7; color: #b45309; }
.tag.red { background: #fee2e2; color: #b91c1c; }
.tag.blue { background: #dbeafe; color: #1d4ed8; }
.tag.gray { background: #f1f5f9; color: #64748b; }

/* ===== 弹窗 ===== */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(3px);
}
.overlay.show { display: flex; }
.modal {
  background: var(--panel); border-radius: 16px; width: 520px; max-width: 92vw;
  max-height: 86vh; overflow-y: auto; padding: 26px;
  box-shadow: 0 20px 60px rgba(15,23,42,.2); animation: fadeIn .2s ease;
}
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-group label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.modal .form-group input, .modal .form-group textarea, .modal .form-group select {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border);
  border-radius: 9px; font-size: 13px; outline: none; background: #fbfcfe;
}
.modal .form-group input:focus, .modal .form-group textarea:focus { border-color: var(--primary); background: var(--panel); }
.modal .form-group textarea { min-height: 110px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ===== 文件上传 ===== */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; color: var(--text-2);
  cursor: pointer; transition: all .18s; background: #fafbfd;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone .dz-ic { font-size: 30px; margin-bottom: 8px; }
.dropzone p { font-size: 13px; }
.dropzone .dz-sub { font-size: 12px; margin-top: 4px; opacity: .8; }

/* ===== AI 对话 ===== */
.chat-page.active { display: flex !important; flex-direction: column; height: calc(100vh - 48px); padding-bottom: 0; }
.chat-page.active .page-head { flex-shrink: 0; }
.chat-box {
  flex: 1; overflow-y: auto; padding: 6px 0 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-inner {
  display: flex; flex-direction: column; gap: 18px;
  max-width: 860px; margin: 0 auto; width: 100%;
  padding: 8px 24px;
}
.chat-msg { display: flex; gap: 10px; }
.chat-msg .av {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; margin-top: 2px;
}
.chat-msg.user .av { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.chat-msg.ai .av { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.chat-msg .bubble {
  flex: 1; min-width: 0; padding: 12px 16px;
  border-radius: 14px; font-size: 14px; line-height: 1.75; word-break: break-word;
}
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap; max-width: 80%; box-shadow: 0 2px 8px rgba(79,70,229,.25); }
.chat-msg.ai .bubble { background: #f8fafc; border: 1px solid var(--border); border-top-left-radius: 4px; box-shadow: var(--shadow); }
.chat-msg .kb-note {
  font-size: 11px; color: var(--text-2); margin-top: 6px;
  background: var(--primary-soft); color: var(--primary);
  display: inline-block; padding: 3px 10px; border-radius: 12px;
}

/* 欢迎界面 */
.welcome {
  text-align: center; padding: 48px 20px 24px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); margin: 20px auto;
  max-width: 560px;
}
.welcome h2 { font-size: 20px; color: var(--text); margin-bottom: 10px; }
.welcome p { color: var(--text-2); font-size: 13px; line-height: 1.8; }
.welcome .chip-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.welcome .chip {
  padding: 8px 16px; border-radius: 20px; font-size: 13px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s;
}
.welcome .chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.chat-input-area { flex-shrink: 0; padding: 14px 0 0; }
.chat-input-box {
  background: var(--panel); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 10px 12px; display: flex; align-items: flex-end; gap: 10px;
  transition: border-color .15s; box-shadow: var(--shadow);
}
.chat-input-box:focus-within { border-color: var(--primary); }
.chat-input-box textarea {
  flex: 1; border: none; outline: none; resize: none; background: transparent;
  font-size: 14px; line-height: 1.6; max-height: 140px; min-height: 26px; color: var(--text);
}
.chat-send {
  width: 42px; height: 42px; flex-shrink: 0; border: none; border-radius: 11px;
  background: var(--primary); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.chat-send:hover { background: var(--primary-2); }
.chat-send.stop { background: var(--red); }
.chat-tools { display: flex; align-items: center; gap: 14px; padding: 8px 4px 0; flex-wrap: wrap; }
.chat-tools label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chat-tools select {
  padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 12px; background: var(--panel); color: var(--text); outline: none;
}
.kb-toggle { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.kb-toggle input { display: none; }
.kb-toggle .switch {
  width: 34px; height: 19px; border-radius: 12px; background: #cbd5e1;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.kb-toggle .switch::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  background: var(--panel); top: 2px; left: 2px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.kb-toggle input:checked + .switch { background: var(--primary); }
.kb-toggle input:checked + .switch::after { left: 17px; }

/* Markdown */
.md h1 { font-size: 1.35em; margin: .6em 0 .4em; }
.md h2 { font-size: 1.2em; margin: .6em 0 .4em; }
.md h3 { font-size: 1.08em; margin: .5em 0 .35em; }
.md p { margin: .35em 0; }
.md ul, .md ol { margin: .35em 0; padding-left: 1.5em; }
.md li { margin: .2em 0; }
.md code {
  font-family: "SF Mono", Consolas, monospace; font-size: .9em;
  background: var(--panel-2); padding: 2px 5px; border-radius: 4px; color: var(--primary);
}
.md pre {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px;
  overflow-x: auto; margin: .6em 0; font-size: 13px; line-height: 1.6; position: relative;
}
.md pre code { background: none; padding: 0; color: inherit; }
.md blockquote {
  border-left: 3px solid var(--primary); background: var(--panel-2);
  margin: .5em 0; padding: .4em .9em; border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md table { border-collapse: collapse; margin: .6em 0; font-size: 13px; width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--panel-2); }
.md hr { border: none; border-top: 1px solid var(--border); margin: .8em 0; }
.md a { color: var(--primary); }

/* reasoning */
.reason-block {
  background: var(--panel-2); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px;
  border-left: 3px solid var(--amber);
}
.reason-toggle { font-size: 11px; color: var(--text-2); cursor: pointer; user-select: none; display: flex; align-items: center; gap: 5px; }
.reason-toggle .thinking-dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.reason-toggle .thinking-dots span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--amber);
  animation: tbounce 1.2s infinite;
}
.reason-toggle .thinking-dots span:nth-child(2) { animation-delay: .15s; }
.reason-toggle .thinking-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes tbounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-3px); opacity: 1; } }
.reason-content { display: none; font-size: 12.5px; color: var(--text-2); margin-top: 6px; line-height: 1.7; white-space: pre-wrap; max-height: 240px; overflow-y: auto; }
.reason-content.open { display: block; }

/* 知识库卡片 */
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.kb-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: all .18s; position: relative;
}
.kb-card:hover { border-color: var(--primary); box-shadow: 0 6px 20px rgba(79,70,229,.12); transform: translateY(-2px); }
.kb-card .kb-ic {
  width: 40px; height: 40px; border-radius: 11px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.kb-card .kb-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.kb-card .kb-desc { font-size: 12px; color: var(--text-2); min-height: 34px; }
.kb-card .kb-stats { font-size: 11px; color: var(--text-2); margin-top: 10px; display: flex; gap: 12px; }
.kb-card .kb-actions {
  position: absolute; top: 12px; right: 12px; display: flex; gap: 4px;
  opacity: 0; transition: all .15s;
}
.kb-card:hover .kb-actions { opacity: 1; }
.kb-card .kb-act {
  width: 24px; height: 24px; border-radius: 6px; border: none; cursor: pointer;
  background: transparent; color: var(--text-2); font-size: 13px; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.kb-card .kb-act:hover { background: var(--primary); color: #fff; }
.kb-card .kb-act.kb-del:hover { background: var(--red); color: #fff; }

/* 响应式 */
/* ===== 深色模式 ===== */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #263449;
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --border: #334155;
  --primary: #818cf8;
  --primary-2: #6366f1;
  --primary-soft: #312e81;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}
:root[data-theme="dark"] .auth-card { background: rgba(30,41,59,.92); }
:root[data-theme="dark"] .chat-msg.user .bubble { background: #312e81; }
:root[data-theme="dark"] .reason-block { background: #16213a; }
:root[data-theme="dark"] .md code { background: #0f172a; }
:root[data-theme="dark"] .mobile-menu-btn { background: var(--panel); color: var(--text); }

/* ===== 移动端适配(≤760px) ===== */
.mobile-menu-btn { display: none; }
.side-mask { display: none; }
@media (max-width: 760px) {
  .mobile-menu-btn {
    display: flex; position: fixed; top: 10px; left: 10px; z-index: 180;
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--panel); box-shadow: 0 1px 6px rgba(0,0,0,.08);
    align-items: center; justify-content: center; font-size: 20px; color: var(--text-1);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .side-mask {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 170; -webkit-tap-highlight-color: transparent;
  }
  .side-mask.show { display: block; }
  .app-side {
    display: flex !important; position: fixed; top: 0; left: 0; bottom: 0; width: 250px;
    z-index: 200; transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.18);
  }
  .app-side.open { transform: translateX(0); }
  .app-main { margin-left: 0 !important; }
  .page { padding: 14px; padding-top: 58px; } /* 给汉堡按钮留位置 */
  .page-head { padding-top: 0; }
  .chat-page { padding-top: 0 !important; }
  .chat-head { padding-left: 56px; padding-top: 8px; } /* 聊天标题让出汉堡按钮 */
  .chat-input-box textarea { font-size: 16px; } /* 防 iOS 聚焦自动缩放 */
  .chat-input-box { padding-left: 4px; }
  .img-btn { margin-left: 4px; }
  .kb-toggle, .chat-tools label { font-size: 13px; }
  .chat-tools { flex-wrap: wrap; gap: 4px 10px; }
  .chat-msg .bubble { max-width: 82%; }
  .card { padding: 12px; }
  .tbl { font-size: 12px; }
  .btn { font-size: 12px; padding: 5px 9px; }
}

/* ===== 消息复制按钮 ===== */
.msg-copy {
  position: absolute; top: 8px; right: 10px;
  font-size: 11px; color: var(--text-2); background: transparent;
  border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
  opacity: 0; transition: opacity .15s, background .15s; cursor: pointer;
}
.chat-msg.ai .bubble:hover .msg-copy { opacity: 1; }
.msg-copy:hover { background: var(--panel-2); color: var(--text); }
@media (max-width: 760px) { .msg-copy { opacity: 1; } }

/* ===== 推理速度统计 ===== */
.gen-stat {
  font-size: 11px; color: var(--text-2); margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--border);
}
