:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --sidebar: #fafbfd;
  --text: #1f2329;
  --text-soft: #4b5563;
  --muted: #8b919c;
  --line: #e3e7ee;
  --accent: #4d6bfe;
  --accent-soft: #eef2ff;
  --accent-deep: #3452e6;
  --green: #12a37a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 8px 30px rgba(20, 28, 50, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
textarea { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6d9e0; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局 ---------- */
.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.app.with-evidence { grid-template-columns: 268px minmax(0, 1fr) 360px; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 8px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #4d6bfe, #7c5cfc);
  color: #fff; font-weight: 700; font-size: 18px;
  display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(77, 107, 254, .3);
}
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px;
  object-fit: cover; flex: 0 0 36px;
  box-shadow: 0 6px 14px rgba(20, 28, 50, .18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .5px; }
.brand-text small { color: var(--muted); font-size: 11px; }

.sidebar-actions { padding: 10px 14px; }
.btn-new {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  transition: .18s;
}
.btn-new:hover { border-color: #c9d2ff; color: var(--accent); box-shadow: 0 4px 14px rgba(77,107,254,.12); }

.nav-links { padding: 4px 14px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--text-soft); font-size: 13.5px;
}
.nav-links a:hover { background: #eef0f5; text-decoration: none; }
.nav-links a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 8px 12px; }
.section-label {
  padding: 12px 10px 6px;
  font-size: 11.5px; color: var(--muted);
  letter-spacing: .5px;
}
.session-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; margin: 1px 4px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 13.5px;
  cursor: pointer;
  position: relative;
}
.session-item:hover { background: #eef0f5; }
.session-item.active { background: #e7ecff; color: var(--accent-deep); font-weight: 600; }
.session-item .s-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-item .s-del {
  opacity: 0; border: 0; background: transparent; color: var(--muted);
  padding: 2px 4px; border-radius: 6px; font-size: 12px;
}
.session-item:hover .s-del { opacity: 1; }
.session-item .s-del:hover { background: #ffe4e6; color: var(--red); }

.sidebar-footer { border-top: 1px solid var(--line); padding: 12px 14px; }
.kb-mini { display: flex; gap: 8px; margin-bottom: 10px; }
.kb-mini div {
  flex: 1; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 7px 9px; text-align: center;
}
.kb-mini strong { display: block; font-size: 15px; }
.kb-mini span { font-size: 10.5px; color: var(--muted); }
.user-row { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #4d6bfe, #8f7bff);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.user-row .u-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .u-role { font-size: 10.5px; color: var(--muted); }
.logout-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.logout-btn:hover { color: var(--red); }

/* ---------- 主区 ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; background: var(--bg); overflow: hidden; }
.topbar {
  height: 58px; flex: 0 0 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  position: relative; z-index: 20;
}
.topbar .title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.topbar .title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.topbar .sub { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff;
  padding: 5px 10px; border-radius: 999px;
  font-size: 12px; color: var(--text-soft);
}
.chip-back {
  background: #d5dae1;
  border-color: #c4cad3;
  color: #111111;
  font-weight: 600;
}
.chip-back:hover { background: #c8ced7; color: #000000; }
.chip.blue { background: var(--accent-soft); border-color: #dbe3ff; color: var(--accent-deep); }

.messages { flex: 1; overflow-y: auto; padding: 26px 0 10px; }
.messages-inner { max-width: 860px; margin: 0 auto; padding: 0 26px; }

/* 欢迎页 */
.welcome { padding: 40px 0 20px; text-align: center; }
.welcome .hero-mark {
  width: 62px; height: 62px; margin: 0 auto 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #4d6bfe, #7c5cfc);
  color: #fff; font-size: 30px; font-weight: 700;
  display: grid; place-items: center;
  box-shadow: 0 14px 34px rgba(77,107,254,.28);
}
.welcome .hero-logo {
  width: 76px; height: 76px; margin: 0 auto 18px;
  border-radius: 20px; object-fit: cover; display: block;
  box-shadow: 0 14px 34px rgba(20, 28, 50, .18);
}
.welcome h1 { font-size: 25px; margin: 0 0 8px; letter-spacing: 1px; }
.welcome p { color: var(--muted); margin: 0 auto 26px; max-width: 560px; font-size: 14px; }
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; text-align: left; }
.prompt-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: .18s;
}
.prompt-card:hover { border-color: #c9d2ff; box-shadow: 0 8px 22px rgba(77,107,254,.10); transform: translateY(-1px); }
.prompt-card b { display: block; font-size: 14px; margin-bottom: 3px; }
.prompt-card span { color: var(--muted); font-size: 12.5px; }

/* 消息 */
.msg { display: flex; gap: 12px; margin-bottom: 24px; }
.msg.user { flex-direction: row-reverse; }
.msg .bubble-wrap { max-width: 100%; min-width: 0; }
.msg .msg-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
  background: #fff; border: 1px solid var(--line); color: var(--accent);
}
.msg.assistant .msg-avatar { background: linear-gradient(135deg, #4d6bfe, #7c5cfc); color: #fff; border: 0; }
.msg.user .msg-avatar { background: #e8ebf2; color: var(--text-soft); border: 0; }
.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--accent);
  color: #fff; border-color: transparent;
  border-top-right-radius: 4px;
}
.msg.assistant .bubble { border-top-left-radius: 4px; }
.msg .time { font-size: 11px; color: var(--muted); margin-top: 6px; }
.msg.user .time { text-align: right; }

.bubble h2 { font-size: 17px; margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.bubble h2:first-child { margin-top: 0; }
.bubble h3 { font-size: 15.5px; margin: 14px 0 6px; }
.bubble h4 { font-size: 14.5px; margin: 12px 0 4px; }
.bubble p { margin: 8px 0; }
.bubble ul, .bubble ol { padding-left: 22px; margin: 8px 0; }
.bubble li { margin: 3px 0; }
.bubble blockquote {
  margin: 10px 0; padding: 6px 14px;
  border-left: 3px solid #c9d2ff; background: #f8f9ff; color: var(--text-soft);
  border-radius: 0 8px 8px 0;
}
.bubble code {
  background: #f1f2f6; padding: 1px 5px; border-radius: 5px;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: .88em;
}
.bubble pre { background: #f6f7f9; border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; }
.bubble pre code { background: transparent; padding: 0; }
.bubble table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.bubble th { background: #f7f8fb; }
.msg.user .bubble a { color: #eaf0ff; text-decoration: underline; }

.cite {
  display: inline-block; padding: 0 5px; margin: 0 1px;
  border-radius: 5px; background: var(--accent-soft); color: var(--accent-deep);
  font-size: 11.5px; font-weight: 700; cursor: pointer; line-height: 1.5;
  vertical-align: 1px;
}
.cite.web { background: #e8f7f0; color: #0f8a66; }

/* 图片 */
.msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; justify-content: flex-end; }
.msg-images img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; }

/* 状态与思考 */
.stage { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #d7dcf0; border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.thinking {
  font-size: 12.5px; color: var(--muted);
  background: #f8f9fc; border: 1px dashed var(--line);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 10px;
  max-height: 140px; overflow-y: auto; white-space: pre-wrap;
}
.analysis-card {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px; margin-bottom: 10px;
  background: #f8f9ff; border: 1px solid #e2e8ff; border-radius: 10px;
}
.analysis-card .ac-title { width: 100%; font-size: 12px; color: var(--accent-deep); font-weight: 600; margin-bottom: 2px; }
.tag { font-size: 12px; background: #fff; border: 1px solid #e2e6f5; border-radius: 999px; padding: 2px 9px; color: var(--text-soft); }

/* 来源 */
.sources { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.sources-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.sources-head b { color: var(--text-soft); }
.sources-list { margin-top: 8px; display: none; flex-direction: column; gap: 8px; }
.sources.open .sources-list { display: flex; }
.source-item {
  background: #fafbfe; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; font-size: 12.5px;
}
.source-item .si-top { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; }
.source-item .si-ref {
  font-size: 11px; font-weight: 700; color: var(--accent-deep);
  background: var(--accent-soft); border-radius: 5px; padding: 1px 6px;
}
.source-item .si-title { font-weight: 600; color: var(--text-soft); }
.source-item .si-meta { color: var(--muted); font-size: 11.5px; }
.source-item .si-excerpt { color: var(--muted); margin-top: 3px; line-height: 1.55; }

/* 输入区 */
.composer-wrap { padding: 10px 26px 18px; background: linear-gradient(to top, var(--bg) 60%, rgba(238,241,245,0)); }
.composer {
  max-width: 860px; margin: 0 auto;
  background: var(--surface); border: 1px solid #dfe3ec; border-radius: 18px;
  box-shadow: 0 10px 28px rgba(20,28,50,.07);
  padding: 10px 12px 8px;
  transition: border-color .18s, box-shadow .18s;
}
.composer:focus-within { border-color: #b9c5ff; box-shadow: 0 12px 32px rgba(77,107,254,.14); }
.composer-preview { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 2px 8px; }
.preview-item { position: relative; }
.preview-item img { width: 58px; height: 58px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.preview-item .rm {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #1f2329; color: #fff; border: 0; font-size: 11px; line-height: 1;
}
.composer textarea {
  width: 100%; border: 0; outline: 0; resize: none;
  font-size: 15px; line-height: 1.6; padding: 4px 6px;
  background: transparent; color: var(--text);
  max-height: 180px;
}
.composer-toolbar { display: flex; align-items: center; gap: 8px; padding: 4px 2px 2px; }
.tool {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px;
  transition: .15s;
}
.tool:hover { border-color: #c9d2ff; color: var(--accent); }
.tool.on { background: var(--accent-soft); border-color: #c9d2ff; color: var(--accent-deep); font-weight: 600; }
.tool svg { width: 14px; height: 14px; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.hint { font-size: 11.5px; color: var(--muted); }
.btn-send {
  width: 38px; height: 38px; border-radius: 12px; border: 0;
  background: var(--accent); color: #fff; font-size: 16px;
  display: grid; place-items: center;
  transition: .15s;
}
.btn-send:disabled { background: #c9d0e3; cursor: not-allowed; }
.btn-send:not(:disabled):hover { background: var(--accent-deep); }

/* 右侧证据面板 */
.evidence {
  border-left: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; min-height: 0;
}
.evidence-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.evidence-head b { font-size: 14px; }
.evidence-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }
.evidence-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 40px 10px; }
.evidence-group-title { font-size: 11.5px; color: var(--muted); letter-spacing: .6px; margin: 14px 0 8px; }
.ev-card { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 9px; background: #fcfdff; }
.ev-card .ev-top { display: flex; gap: 7px; align-items: center; margin-bottom: 4px; }
.ev-card .ev-title { font-size: 13px; font-weight: 600; }
.ev-card .ev-meta { font-size: 11.5px; color: var(--muted); }
.ev-card .ev-text { font-size: 12.5px; color: var(--text-soft); margin-top: 4px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.icon-btn:hover { background: #f0f2f7; color: var(--text); }

/* 知识库页 */
.page { flex: 1 1 auto; min-height: 0; overflow-y: auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 26px; box-sizing: border-box; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; }
.stat-card strong { display: block; font-size: 22px; letter-spacing: .5px; }
.stat-card span { font-size: 12px; color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.dropzone {
  border: 1.5px dashed #c9d2e6; border-radius: 12px; padding: 26px;
  text-align: center; color: var(--muted); background: #fafbff; cursor: pointer;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone b { color: var(--accent); }
.upload-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.upload-list .ok { color: var(--green); }
.upload-list .err { color: var(--red); }
table.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.doc-table th, table.doc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.doc-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.doc-table tr:hover td { background: #fafbff; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #eef2ff; color: var(--accent-deep); }
.badge.ok { background: #e8f7f0; color: var(--green); }
.badge.fail { background: #fdecec; color: var(--red); }
.search-row { display: flex; gap: 8px; }
.input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font-size: 13.5px; outline: none; background: #fff;
}
.input:focus { border-color: #b9c5ff; box-shadow: 0 0 0 3px rgba(77,107,254,.1); }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  border-radius: 10px; padding: 8px 14px; font-size: 13.5px;
}
.btn:hover { border-color: #c9d2ff; color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: #f3b6b6; background: #fff5f5; }
.hit { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; background: #fcfdff; }
.hit .hit-title { font-weight: 600; font-size: 13px; }
.hit .hit-meta { color: var(--muted); font-size: 11.5px; }
.hit p { margin: 5px 0 0; font-size: 12.5px; color: var(--text-soft); }
.muted { color: var(--muted); }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 16px; }
.scan-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.scan-card a { display: block; }
.scan-card img { width: 100%; display: block; background: #f4f5f8; }
.scan-card .scan-meta { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 12px; color: var(--muted); }

/* ---------- 文档内容查看 ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.breadcrumb a { color: var(--text-soft); }
.breadcrumb .sep { color: #c3c8d0; }
.doc-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.doc-hero h1 { margin: 0 0 6px; font-size: 21px; line-height: 1.4; }
.doc-hero .doc-file { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.doc-meta .pill { background: #f4f6fa; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--text-soft); }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.doc-chunk { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 12px; }
.doc-chunk-h { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; gap: 8px; }
.doc-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.95; color: var(--text); }
.doc-empty { color: var(--muted); font-size: 13px; padding: 24px; text-align: center; }
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 30px; flex-wrap: wrap; }
.pager a, .pager span { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--text-soft); }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 本草图谱 ---------- */
.herb-hero { border-left: 4px solid var(--green); }
.herb-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.herb-row:last-child { border-bottom: 0; padding-bottom: 0; }
.herb-label { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.herb-value { font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.herb-formula { border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; margin-bottom: 10px; background: #fcfdff; }
.herb-formula:last-child { margin-bottom: 0; }
.herb-formula-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.herb-formula-line { font-size: 13px; line-height: 1.8; color: var(--text-soft); }
.herb-sources { margin: 8px 0 14px; padding-left: 18px; font-size: 12.5px; color: var(--text-soft); line-height: 1.9; }

/* 本草配图 */
.herb-photo-wrap { margin: 0 0 16px; }
.herb-photo { display: block; width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #f7f8fb; }
.herb-photo-wrap figcaption { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.herb-photo-wrap figcaption a { color: var(--text-soft); }
.herb-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f7f8fb; flex: 0 0 44px; }

/* ---------- 后台管理紧凑表单 ---------- */
.admin-page .field > input { width: 50%; max-width: 520px; min-width: 240px; }
.admin-page .field > select { width: 50%; max-width: 520px; min-width: 240px; }
.admin-page .search-row > .input { flex: 0 1 240px; max-width: 240px; }
.admin-page .price-input { width: 88px !important; min-width: 0 !important; padding: 6px 8px; font-size: 12.5px; }
.admin-page .doc-table th { white-space: nowrap; }

/* ---------- 回答反馈 ---------- */
.feedback { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.fb-btn {
  border: 1px solid var(--line); background: #fff; color: var(--text-soft);
  border-radius: 8px; padding: 3px 9px; font-size: 11.5px; cursor: pointer;
}
.fb-btn:hover { border-color: #b9c5ff; color: var(--text); }
.fb-btn.active { background: #eef1ff; border-color: #b9c5ff; color: var(--accent); }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
}
.toast.show { opacity: .95; }

/* 登录 */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #e9edff 0%, transparent 60%), var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; padding: 32px 30px;
  box-shadow: var(--shadow);
}
.login-card .brand { padding: 0 0 18px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--text-soft); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; transition: .15s;
}
.field input:focus { border-color: #b9c5ff; box-shadow: 0 0 0 3px rgba(77,107,254,.12); }
.login-btn {
  width: 100%; padding: 11px; border: 0; border-radius: 11px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
}
.login-btn:hover { background: var(--accent-deep); }
.login-err { background: #fdecec; color: var(--red); border-radius: 9px; padding: 8px 12px; font-size: 12.5px; margin-bottom: 14px; }
.flash { border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; }
.flash-success { background: #e8f7f0; color: #0f8a66; }
.flash-info { background: var(--accent-soft); color: var(--accent-deep); }
.security-question {
  background: #f7f8fb; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--text);
}
.login-tip a { color: var(--accent); }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }

/* 响应式 */
@media (max-width: 1100px) {
  .app.with-evidence { grid-template-columns: 240px minmax(0,1fr); }
  .evidence { display: none; }
}
@media (max-width: 860px) {
  .app, .app.with-evidence { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .messages-inner, .composer { padding-left: 16px; padding-right: 16px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
