:root { --brand:#9f2728; --brand-pale:#f5e9e7; --ink:#202226; --muted:#73777f; --canvas:#efefec; --paper:#fff; --panel:#f8f8f6; --line:#d9d9d4; --line-strong:#b9bab6; --blue:#165e88; --shadow:0 18px 52px rgba(27,28,30,.08); }
* { box-sizing:border-box; }
html { min-height:100%; scroll-behavior:smooth; }
body { min-height:100%; margin:0; color:var(--ink); background:linear-gradient(rgba(32,34,38,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(32,34,38,.025) 1px,transparent 1px),var(--canvas); background-size:32px 32px; font-family:"Noto Sans CJK SC","Source Han Sans SC","Microsoft YaHei",sans-serif; -webkit-font-smoothing:antialiased; }
button,textarea { font:inherit; } button { cursor:pointer; } button:focus-visible,textarea:focus-visible,a:focus-visible,label:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
.shell { width:min(1540px,100%); margin:0 auto; padding:0 36px 38px; }
.masthead { height:78px; display:flex; align-items:center; justify-content:space-between; gap:24px; border-bottom:1px solid #adaeaa; }
.brand-lockup,.product-lockup,.live { display:flex; align-items:center; } .brand-lockup { min-width:0; gap:18px; } .brand-logo { width:168px; height:auto; display:block; } .brand-rule { width:1px; height:32px; background:var(--line-strong); }
.product-lockup { align-items:flex-start; flex-direction:column; gap:3px; min-width:0; } .product-lockup strong { font-size:14px; letter-spacing:.04em; } .product-lockup span { color:var(--muted); font-size:10px; }
.live { gap:8px; color:#5e6268; font:600 11px/1.2 "DIN Alternate","Bahnschrift",sans-serif; } .pulse { width:7px; height:7px; border-radius:50%; background:#3a8a54; box-shadow:0 0 0 5px rgba(58,138,84,.11); }
.stats { display:grid; grid-template-columns:repeat(4,1fr); margin:18px 0; border:1px solid var(--line); background:rgba(255,255,255,.72); }
.stats article { min-height:58px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 18px; border-right:1px solid var(--line); } .stats article:last-child { border-right:0; } .stats span { color:var(--muted); font-size:11px; } .stats strong { font:700 20px/1 "DIN Alternate","Bahnschrift",sans-serif; letter-spacing:-.02em; }
.workspace { min-height:calc(100vh - 190px); display:grid; grid-template-columns:272px minmax(0,1fr); border:1px solid var(--line-strong); background:var(--paper); box-shadow:var(--shadow); }
.sidebar { min-width:0; padding:22px 16px; background:#292b2f; color:#fff; border-right:1px solid #1b1c1f; } .sidebar-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.sidebar-heading>div { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:700; } .sidebar-heading strong { min-width:22px; padding:3px 6px; text-align:center; color:#fff; background:var(--brand); border-radius:10px; font:700 10px/1.2 "Bahnschrift",sans-serif; }
.sidebar-heading button { border:0; padding:4px 0; color:#aaadb3; background:transparent; font-size:10px; } .sidebar-heading button:hover { color:#fff; }
.new-chat { width:100%; min-height:42px; display:flex; align-items:center; justify-content:space-between; border:1px solid #565960; padding:0 13px; color:#fff; background:#34373c; font-weight:700; font-size:12px; } .new-chat:hover { border-color:#8a8d93; background:#3a3d42; }
.conversation-history { display:grid; gap:6px; max-height:calc(100vh - 294px); overflow-y:auto; margin-top:16px; padding-right:3px; scrollbar-width:thin; scrollbar-color:#62656b transparent; }
.history-row { min-width:0; display:grid; grid-template-columns:minmax(0,1fr) auto; border-left:2px solid transparent; background:#32353a; } .history-row:hover { background:#383b40; } .history-row.active { border-left-color:#d65956; background:#414349; }
.history-item { min-width:0; display:grid; gap:6px; border:0; padding:11px 8px 11px 11px; text-align:left; color:#fff; background:transparent; } .history-item strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; font-weight:600; }
.history-meta { display:flex; gap:8px; color:#999ca3; font-size:9px; } .delete-history { align-self:stretch; border:0; padding:0 8px; color:#92959b; background:transparent; font-size:9px; opacity:0; transition:opacity .16s,color .16s,background .16s; }
.history-row:hover .delete-history,.delete-history:focus-visible { opacity:1; } .delete-history:hover { color:#fff; background:var(--brand); } .delete-history:disabled { opacity:.4; cursor:wait; } .history-empty { margin:10px 4px; color:#9ca0a6; font-size:11px; line-height:1.6; }
.chat-panel { min-width:0; display:flex; flex-direction:column; padding:0 28px 18px; background:var(--panel); } .panel-heading { min-height:70px; display:flex; align-items:center; justify-content:space-between; gap:20px; border-bottom:1px solid var(--line); }
.panel-heading h1 { max-width:min(68vw,820px); overflow:hidden; margin:0; text-overflow:ellipsis; white-space:nowrap; font-size:17px; letter-spacing:-.01em; } .panel-code { color:var(--muted); font:700 9px/1.2 "Bahnschrift",sans-serif; letter-spacing:.11em; text-transform:uppercase; }
.conversation { min-height:480px; flex:1; display:grid; align-content:start; gap:18px; padding:24px 0 8px; }
.welcome { min-height:138px; display:grid; grid-template-columns:72px minmax(0,1fr); align-items:center; gap:24px; padding:25px 28px; border:1px solid var(--line); background:var(--paper); } .welcome-mark { width:58px; height:58px; display:grid; place-items:center; color:#fff; background:var(--brand); font:700 18px/1 "Bahnschrift",sans-serif; }
.welcome h2 { margin:0 0 8px; font-size:18px; } .welcome p { max-width:620px; margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.message { animation:message-in .26s ease both; } .message.user { max-width:min(78%,760px); justify-self:end; padding:14px 17px; color:#fff; background:var(--brand); border-radius:8px 8px 2px 8px; font-size:14px; line-height:1.7; }
.user-text+.user-image-grid { margin-top:10px; } .user-image-grid { display:grid; grid-template-columns:repeat(2,minmax(90px,190px)); gap:7px; } .user-image-grid img { width:100%; max-height:180px; display:block; object-fit:contain; border:1px solid rgba(255,255,255,.3); background:rgba(255,255,255,.1); }
.message.assistant { position:relative; padding:24px 25px; border:1px solid var(--line); border-radius:2px 9px 9px 9px; background:var(--paper); } .message.assistant::before { content:""; position:absolute; left:-1px; top:22px; width:3px; height:40px; background:var(--brand); }
.message-meta { display:flex; justify-content:space-between; gap:16px; margin-bottom:16px; color:#898d93; font:700 9px/1.2 "Bahnschrift",sans-serif; letter-spacing:.08em; } .message-meta span:first-child { color:var(--brand); }
.answer { overflow-wrap:anywhere; color:#292c31; font-size:14px; line-height:1.85; } .answer-strong { font-weight:700; color:#202329; } .answer-ref { display:inline-flex; align-items:center; margin:0 2px; padding:2px 5px; border-radius:4px; vertical-align:1px; font:700 9px/1.2 "Bahnschrift",monospace; white-space:nowrap; }
.answer-heading { margin:20px 0 8px; color:#202329; font-size:15px; } .answer-heading:first-child { margin-top:0; } .answer-paragraph { margin:0 0 12px; white-space:pre-wrap; } .answer-list { margin:0 0 14px; padding-left:24px; } .answer-list li+li { margin-top:5px; }
.answer-table-wrap { max-width:100%; overflow-x:auto; margin:10px 0 16px; border:1px solid var(--line); } .answer-table { width:100%; border-collapse:collapse; background:#fff; font-size:12px; line-height:1.55; } .answer-table th,.answer-table td { min-width:72px; padding:8px 10px; border-right:1px solid var(--line); border-bottom:1px solid var(--line); text-align:left; vertical-align:top; } .answer-table th { position:sticky; top:0; color:#3f4349; background:#f1f1ed; font-weight:700; } .answer-table tr:last-child td { border-bottom:0; } .answer-table th:last-child,.answer-table td:last-child { border-right:0; }
.evidence-ref { color:#7d2426; background:var(--brand-pale); } .image-ref { color:#145b78; background:#e6f1f5; border:0; cursor:pointer; } .user-ref { color:#555d65; background:#eceeef; }
.answer-quote { margin:12px 0 16px; padding:10px 15px; border-left:3px solid var(--brand); background:var(--brand-pale); color:#3d4046; }
.answer-quote .answer { font-size:13.5px; line-height:1.8; }
.answer-quote .answer > :last-child { margin-bottom:0; }
.answer-quote .answer-paragraph { margin-bottom:8px; }
.answer-rule { height:0; margin:20px 0; border:0; border-top:1px solid var(--line); }
/* 行内代码：渲染器一直在产出 <code class="answer-code">（编号、文件名、字段名都走它，
   116 条真实回答里 55% 用到），而 CSS 里从来没有这个类——落到浏览器默认的等宽字体，
   在中文正文里字号偏小、基线不齐，看着就像没排过版。 */
.answer-code { padding:1px 5px; border:1px solid var(--line); border-radius:3px;
  background:#f6f6f3; color:#4a4d53; font-family:"Bahnschrift","DIN Alternate",
  "SF Mono",Consolas,monospace; font-size:.92em; word-break:break-all; }
.answer-table .answer-code { padding:0 3px; font-size:.95em; }
.answer-quote .answer-code { background:#fff; }
.answer-list li > .answer { margin-top:6px; }
.answer-list li > .answer > :last-child { margin-bottom:0; }
.answer-list .answer-list { margin:6px 0 0; padding-left:22px; }
.answer-list > li > .answer-list > li { color:#3f4349; }
.answer-details { margin:10px 0; border:1px solid var(--line); background:#fafaf7; }
.answer-details > summary { padding:10px 12px; color:#3f4349; font-weight:600; cursor:pointer; }
.answer-details > summary:hover { background:#f1f1ed; }
.answer-details > summary:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }
.answer-details[open] > summary { border-bottom:1px solid var(--line); }
.answer-details > .answer { padding:10px 12px; }
.image-card.key-image figcaption strong { white-space:normal; line-height:1.6; }
.image-card figcaption .source { display:block; margin-top:5px; color:var(--muted); font-size:10px; overflow-wrap:anywhere; }
.result-section { margin-top:24px; padding-top:17px; border-top:1px solid #e5e5e0; } .result-section-heading { min-height:28px; display:flex; align-items:center; gap:8px; margin-bottom:10px; } .result-section-heading h3 { margin:0; color:#41454b; font-size:12px; }
.result-count { min-width:21px; padding:3px 6px; text-align:center; color:var(--brand); background:var(--brand-pale); border-radius:10px; font:700 9px/1.2 "Bahnschrift",sans-serif; } .section-toggle { margin-left:auto; border:0; padding:5px 0 5px 12px; color:var(--blue); background:transparent; font-size:10px; } .section-toggle:hover { color:var(--brand); }
.result-section:not(.expanded) .collapsed-item { display:none; } .evidence-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; } .evidence { min-width:0; padding:12px 13px; border:1px solid #e1e1dc; background:#f7f7f4; }
.evidence-heading { min-width:0; display:flex; align-items:center; gap:8px; } .evidence b { flex:0 0 auto; color:var(--brand); font:700 10px/1.2 "Bahnschrift",monospace; } .evidence .source { min-width:0; overflow:hidden; color:#555a61; text-overflow:ellipsis; white-space:nowrap; font-size:10px; }
.locator { display:block; margin-top:5px; color:#8a8e94; font:600 9px/1.2 "Bahnschrift",monospace; } .evidence p { display:-webkit-box; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:3; margin:8px 0 0; color:#696d73; font-size:10px; line-height:1.55; } .evidence:hover p { -webkit-line-clamp:initial; }
.evidence-actions { display:flex; justify-content:flex-end; margin-top:9px; padding-top:8px; border-top:1px solid #e2e2dd; } .evidence-download { display:inline-flex; align-items:center; min-height:25px; padding:4px 8px; border:1px solid #c8c9c5; color:var(--blue); background:#fff; text-decoration:none; font-size:10px; font-weight:700; } .evidence-download:hover { border-color:var(--blue); background:#f2f7f9; }
.image-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; } .image-card { min-width:0; margin:0; overflow:hidden; border:1px solid var(--line); background:#ededE9; } .image-link { display:block; background:#e9e9e5; }
.image-card:only-child { grid-column:1/-1; } .image-card:only-child img { height:min(58vw,680px); } .image-card img { width:100%; height:min(34vw,360px); display:block; object-fit:contain; transition:transform .25s ease; } .image-card:hover img { transform:scale(1.01); } .image-card figcaption { padding:10px 12px; background:#fff; }
.image-card figcaption strong { display:block; overflow:hidden; color:#454950; text-overflow:ellipsis; white-space:nowrap; font-size:10px; } .image-kind { display:block; margin-top:5px; color:var(--muted); font-size:9px; } .image-open { display:inline-block; margin-top:7px; color:var(--blue); font-size:10px; font-weight:700; }
.composer { position:sticky; bottom:12px; z-index:5; display:grid; grid-template-columns:minmax(0,1fr) 104px; margin-top:20px; border:1px solid var(--line-strong); border-radius:8px; background:rgba(255,255,255,.97); box-shadow:0 14px 46px rgba(28,29,31,.13); backdrop-filter:blur(14px); overflow:hidden; }
.input-stack { min-width:0; display:grid; padding:6px 4px; } .composer textarea { width:100%; min-height:60px; max-height:190px; resize:vertical; border:0; outline:0; padding:10px 13px 3px; color:var(--ink); background:transparent; line-height:1.6; } .composer textarea::placeholder { color:#999da2; }
.upload-tools { display:flex; align-items:center; gap:11px; padding:3px 13px 7px; color:#8a8e94; font-size:9px; } .upload-button { cursor:pointer; color:var(--blue); font-weight:700; } .upload-button:hover { color:var(--brand); }
.upload-preview { display:flex; flex-wrap:wrap; gap:7px; padding:6px 12px 0; } .upload-preview:empty { display:none; } .upload-item { position:relative; width:92px; height:70px; margin:0; border:1px solid var(--line); background:#ebeae6; } .upload-item img { width:100%; height:100%; object-fit:contain; }
.remove-upload { position:absolute; top:3px; right:3px; border:0; padding:3px 5px; color:#fff; background:rgba(32,34,38,.84); font-size:9px; } .composer>button { border:0; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:0 17px; color:#fff; background:var(--brand); font-weight:700; font-size:12px; }
.composer>button:hover { background:#b33132; } .composer>button:disabled { opacity:.55; cursor:wait; } .notice { margin:9px 2px 0; text-align:right; color:#8a8e94; font-size:9px; }
.loading { display:flex; align-items:center; gap:6px; color:var(--muted); } .loading i { width:5px; height:5px; border-radius:50%; background:var(--brand); animation:blink .9s infinite alternate; } .loading i:nth-child(3) { animation-delay:.15s; } .loading i:nth-child(4) { animation-delay:.3s; }
@keyframes blink { to { opacity:.2; transform:translateY(-3px); } } @keyframes message-in { from { opacity:0; transform:translateY(8px); } }
/* Functional industrial layout: visual character without promotional copy. */
body {
  background:
    linear-gradient(90deg, transparent 0 71px, rgba(159,39,40,.11) 71px 72px, transparent 72px),
    linear-gradient(rgba(32,34,38,.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32,34,38,.032) 1px, transparent 1px),
    radial-gradient(circle at 88% 4%, rgba(159,39,40,.1), transparent 25rem),
    var(--canvas);
  background-size:auto,32px 32px,32px 32px,auto,auto;
}
.masthead { position:relative; border-bottom-color:#81837f; }
.masthead::before { content:""; position:absolute; top:0; left:0; width:96px; height:4px; background:var(--brand); }
.masthead::after { content:""; position:absolute; right:0; bottom:-1px; width:38px; height:1px; background:var(--brand); }
.brand-logo { filter:contrast(1.04) saturate(1.03); }
.stats { counter-reset:stat; position:relative; overflow:hidden; box-shadow:0 8px 25px rgba(32,34,38,.035); }
.stats::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--brand); }
.stats article { counter-increment:stat; position:relative; min-height:68px; padding-left:42px; background:linear-gradient(135deg,rgba(255,255,255,.9),rgba(249,249,246,.78)); }
.stats article::before { content:"0" counter(stat); position:absolute; left:15px; top:14px; color:rgba(159,39,40,.55); font:700 9px/1 "Bahnschrift",monospace; letter-spacing:.08em; }
.stats article::after { content:""; position:absolute; left:15px; bottom:14px; width:12px; height:1px; background:var(--brand); }
.stats strong { font-size:23px; }
.workspace { position:relative; min-height:calc(100vh - 24px); border-top:3px solid var(--ink); box-shadow:0 24px 70px rgba(27,28,30,.11); }
.workspace::before { content:""; position:absolute; z-index:4; top:-3px; left:0; width:88px; height:3px; background:var(--brand); }
.sidebar {
  position:sticky;
  top:12px;
  align-self:start;
  z-index:3;
  height:calc(100vh - 24px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:
    linear-gradient(135deg,rgba(255,255,255,.025) 25%,transparent 25%) 0 0/18px 18px,
    linear-gradient(315deg,rgba(255,255,255,.018) 25%,transparent 25%) 0 0/18px 18px,
    #292b2f;
  box-shadow:12px 0 32px rgba(25,26,28,.08);
}
.sidebar::after { content:"TH / KB"; position:absolute; right:-19px; bottom:54px; transform:rotate(-90deg); color:rgba(255,255,255,.11); font:700 9px/1 "Bahnschrift",monospace; letter-spacing:.18em; }
.sidebar-heading { padding-bottom:13px; border-bottom:1px solid rgba(255,255,255,.12); }
.sidebar-heading>div>span { letter-spacing:.08em; }
.new-chat { position:relative; margin-top:2px; border-color:#666970; background:linear-gradient(90deg,#393c41,#32353a); }
.new-chat::before { content:""; position:absolute; left:-1px; top:10px; bottom:10px; width:2px; background:#d85c58; }
.conversation-history { min-height:0; max-height:none; flex:1; }
.history-row { border-right:1px solid rgba(255,255,255,.035); }
.history-row.active { box-shadow:inset 0 0 0 1px rgba(255,255,255,.04); }
.chat-panel { position:relative; background:linear-gradient(180deg,#fafaf8 0,#f6f6f3 100%); }
.chat-panel::after { content:""; position:absolute; top:69px; right:28px; width:44px; height:5px; border-top:1px solid rgba(159,39,40,.35); border-bottom:1px solid rgba(159,39,40,.16); pointer-events:none; }
.panel-heading { position:relative; min-height:76px; }
.panel-heading::before { content:""; width:8px; height:8px; margin-right:3px; border:2px solid var(--brand); transform:rotate(45deg); }
.panel-heading h1 { margin-right:auto; font-size:18px; }
.panel-code { padding:6px 9px; border:1px solid var(--line); background:#fff; }
.conversation { padding-top:28px; }
.welcome { position:relative; min-height:172px; overflow:hidden; border-color:#cfd0cb; box-shadow:0 12px 35px rgba(32,34,38,.05); }
.welcome::before { content:""; position:absolute; right:-58px; top:-58px; width:190px; height:190px; border:1px solid rgba(159,39,40,.14); border-radius:50%; box-shadow:0 0 0 22px rgba(159,39,40,.025),0 0 0 45px rgba(32,34,38,.018); }
.welcome::after { content:"+"; position:absolute; right:34px; bottom:24px; color:rgba(159,39,40,.42); font:300 25px/1 "Bahnschrift",sans-serif; }
.welcome-mark { position:relative; box-shadow:9px 9px 0 rgba(159,39,40,.11); }
.message.user { box-shadow:7px 7px 0 rgba(159,39,40,.1); }
.message.assistant { border-top-color:#b8b9b5; box-shadow:0 11px 32px rgba(32,34,38,.045); }
.message.assistant::after { content:""; position:absolute; right:18px; top:-1px; width:34px; height:2px; background:var(--brand); opacity:.55; }
.result-section { position:relative; }
.result-section::before { content:""; position:absolute; left:0; top:-1px; width:32px; height:1px; background:var(--brand); }
.evidence { transition:border-color .18s,transform .18s,box-shadow .18s; }
.evidence:hover { transform:translateY(-2px); border-color:rgba(159,39,40,.38); box-shadow:0 7px 18px rgba(32,34,38,.06); }
.image-card { box-shadow:0 6px 18px rgba(32,34,38,.04); }
.composer { border-top:2px solid var(--ink); border-radius:3px 3px 8px 8px; }
.composer::before { content:""; position:absolute; z-index:2; top:-2px; left:0; width:70px; height:2px; background:var(--brand); }

@media (max-width:980px) { .shell { padding-inline:20px; } .workspace { grid-template-columns:238px minmax(0,1fr); } .chat-panel { padding-inline:20px; } .sidebar { padding-inline:12px; } }
@media (max-width:760px) { body { background-size:auto,28px 28px,28px 28px,auto,auto; } .shell { padding:0 12px 24px; } .masthead { height:70px; } .brand-logo { width:145px; } .brand-rule,.product-lockup { display:none; } .live { font-size:9px; } .stats { grid-template-columns:repeat(2,1fr); } .stats article:nth-child(2) { border-right:0; } .stats article:nth-child(-n+2) { border-bottom:1px solid var(--line); } .workspace { min-height:0; grid-template-columns:1fr; } .workspace::before { width:64px; } .sidebar { position:static; height:auto; display:block; border-right:0; border-bottom:1px solid #1b1c1f; box-shadow:none; } .sidebar::after { display:none; } .conversation-history { max-height:205px; } .delete-history { opacity:1; } .chat-panel { padding-inline:13px; } .chat-panel::after { right:13px; } .panel-heading { min-height:62px; } .panel-heading::before { width:6px; height:6px; } .panel-heading h1 { max-width:64vw; font-size:15px; } .conversation { min-height:420px; padding-top:16px; } .welcome { min-height:145px; grid-template-columns:52px minmax(0,1fr); gap:16px; padding:20px; } .welcome-mark { width:48px; height:48px; } .message.user { max-width:91%; } .message.assistant { padding:20px 16px; } .evidence-grid,.image-grid { grid-template-columns:1fr; } .image-card img { height:min(70vw,360px); } .composer { grid-template-columns:minmax(0,1fr) 76px; } .composer>button { padding-inline:12px; } .upload-tools>span { display:none; } }
@media (max-width:460px) { .live span:last-child { max-width:112px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .stats article { padding-inline:12px; } .stats strong { font-size:17px; } .welcome { grid-template-columns:1fr; } .message.assistant::before { top:18px; height:32px; } .composer { grid-template-columns:1fr; } .composer>button { min-height:44px; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; } }

/* Desktop app shell: only the message stream scrolls. */
@media (min-width:761px) {
  html,body { height:100%; overflow:hidden; }
  .shell { height:100dvh; display:grid; grid-template-rows:78px minmax(0,1fr); padding-bottom:20px; }
  main { min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr); }
  .stats { margin:14px 0; }
  .stats article { min-height:62px; }
  .workspace { min-height:0; height:100%; grid-template-columns:238px minmax(0,1fr); overflow:hidden; }
  .sidebar { position:relative; top:auto; height:100%; align-self:stretch; padding:19px 13px; box-shadow:9px 0 28px rgba(25,26,28,.07); }
  .conversation-history { min-height:0; max-height:none; overflow-y:auto; padding-right:2px; }
  .history-row { width:calc(100% - 5px); grid-template-columns:minmax(0,1fr) 34px; margin-right:5px; }
  .history-item { padding:10px 6px 10px 10px; }
  .delete-history { width:34px; padding:0 4px; font-size:0; }
  .delete-history::before { content:"×"; font:400 16px/1 "Bahnschrift",sans-serif; }
  .chat-panel { min-height:0; height:100%; display:grid; grid-template-rows:76px minmax(0,1fr) auto auto; }
  .conversation { min-height:0; height:auto; overflow-y:auto; overscroll-behavior:contain; padding:26px 10px 16px 0; scrollbar-width:thin; scrollbar-color:#a9aaa6 transparent; }
  .composer { position:relative; bottom:auto; margin-top:12px; }
  .notice { margin-bottom:0; }
}

@media (min-width:761px) and (max-width:980px) {
  .workspace { grid-template-columns:218px minmax(0,1fr); }
  .sidebar { padding-inline:11px; }
}

@media (max-width:760px) {
  html,body { height:auto; overflow:auto; }
  .shell { height:auto; display:block; }
  main { display:block; }
}

/* Brand-depth restoration: compact controls with a richer industrial surface. */
:root {
  --brand-ink: #151817;
  --brand-gold: #d7a82f;
  --brand-gold-soft: #f1dfae;
  --brand-paper: #f7f4ec;
  --brand-line: rgba(34, 40, 37, 0.12);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 6%, rgba(215, 168, 47, 0.12), transparent 29rem),
    linear-gradient(115deg, rgba(255, 255, 255, 0.5), transparent 42%);
  z-index: -1;
}

@media (min-width: 981px) {
  .app-shell,
  .workspace-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .sidebar {
    width: 210px;
    min-width: 210px;
    padding-inline: 12px;
    box-shadow: 10px 0 34px rgba(10, 13, 12, 0.13);
  }

  .history-list,
  .conversation-list {
    padding-inline: 5px;
  }

  .history-item,
  .history-row,
  .conversation-item {
    width: calc(100% - 8px);
    max-width: 178px;
    margin-inline: auto;
    border-radius: 12px;
  }
}

.history-item,
.history-row,
.conversation-item {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
  overflow: hidden;
}

.history-item:hover,
.history-row:hover,
.conversation-item:hover,
.history-item.active,
.history-row.active,
.conversation-item.active {
  background: linear-gradient(100deg, rgba(215, 168, 47, 0.18), rgba(255, 255, 255, 0.055));
  border-color: rgba(215, 168, 47, 0.36);
  transform: translateX(2px);
}

.history-item a,
.history-row a,
.conversation-item a,
.history-title,
.conversation-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-panel,
.chat-panel,
.chat-workspace {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 244, 236, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(28, 34, 31, 0.025) 48px);
}

.chat-header,
.workspace-header {
  position: relative;
  border-bottom: 1px solid var(--brand-line);
  box-shadow: 0 12px 30px rgba(26, 31, 28, 0.045);
}

.chat-header::after,
.workspace-header::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -1px;
  width: 72px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-gold), transparent);
}

.message.assistant .message-body,
.assistant-message .message-body,
.answer-card {
  border: 1px solid rgba(34, 40, 37, 0.1);
  box-shadow: 0 16px 40px rgba(27, 32, 29, 0.07), 0 2px 8px rgba(27, 32, 29, 0.04);
}

.evidence-section,
.image-evidence-section,
.sources-panel {
  border-color: rgba(34, 40, 37, 0.11);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(241, 223, 174, 0.13));
}

.composer,
.chat-composer {
  border-top-color: var(--brand-line);
  box-shadow: 0 -18px 40px rgba(24, 29, 26, 0.055);
  background: rgba(250, 248, 242, 0.94);
  backdrop-filter: blur(18px);
}

#sendButton,
#send-button,
.send-button,
.composer-submit,
.composer button[type="submit"],
.chat-composer button[type="submit"] {
  flex: 0 0 92px;
  width: 92px;
  min-width: 92px;
  max-width: 92px;
  padding-inline: 15px;
  border-radius: 12px;
  background: linear-gradient(135deg, #252a27, #111412);
  border: 1px solid rgba(215, 168, 47, 0.58);
  box-shadow: 0 8px 18px rgba(16, 19, 17, 0.18), inset 0 1px rgba(255, 255, 255, 0.1);
}

#sendButton:hover,
#send-button:hover,
.send-button:hover,
.composer-submit:hover,
.composer button[type="submit"]:hover,
.chat-composer button[type="submit"]:hover {
  background: linear-gradient(135deg, #353b37, #171a18);
  border-color: var(--brand-gold);
  transform: translateY(-1px);
}

@media (max-width: 980px) {
  #sendButton,
  #send-button,
  .send-button,
  .composer-submit,
  .composer button[type="submit"],
  .chat-composer button[type="submit"] {
    flex-basis: 78px;
    width: 78px;
    min-width: 78px;
    max-width: 78px;
  }
}

/* Exact layout correction after rendered-page inspection. */
:root {
  --brand-red: #a9272d;
  --brand-red-deep: #7f171d;
  --brand-canvas: #f3f3f0;
}

body::before {
  background:
    radial-gradient(circle at 82% 2%, rgba(169, 39, 45, 0.055), transparent 30rem),
    linear-gradient(115deg, rgba(255, 255, 255, 0.6), transparent 45%);
}

@media (min-width: 981px) {
  .sidebar {
    width: 184px;
    min-width: 184px;
    max-width: 184px;
    padding: 19px 10px;
    box-shadow: 8px 0 28px rgba(10, 13, 12, 0.11);
  }

  .sidebar-heading,
  .new-chat,
  .conversation-history {
    width: 100%;
    max-width: 164px;
  }

  .conversation-history {
    grid-template-columns: minmax(0, 1fr);
    padding-right: 0;
  }

  .history-card,
  .history-entry,
  .history-item,
  .history-row,
  .conversation-item {
    width: 100%;
    max-width: 158px;
    margin-inline: 0;
  }
}

.main-panel,
.chat-panel,
.chat-workspace {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 246, 242, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 47px, rgba(28, 34, 31, 0.018) 48px);
}

.chat-header::after,
.workspace-header::after {
  background: linear-gradient(90deg, var(--brand-red), rgba(169, 39, 45, 0));
}

.composer {
  grid-template-columns: minmax(0, 1fr) 78px;
  column-gap: 10px;
  align-items: end;
}

#send {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  align-self: end;
  margin: 0 4px 6px 0;
  padding: 0 12px;
  border: 1px solid var(--brand-red-deep);
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(145deg, #b12c32, #8b1d23);
  box-shadow: 0 7px 16px rgba(127, 23, 29, 0.2), inset 0 1px rgba(255, 255, 255, 0.16);
}

#send:hover {
  border-color: #6e1116;
  background: linear-gradient(145deg, #bc343a, #941e25);
  box-shadow: 0 9px 20px rgba(127, 23, 29, 0.25), inset 0 1px rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

#send:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(127, 23, 29, 0.2);
}

#send span:last-child {
  opacity: 0.72;
}

@media (max-width: 980px) {
  #send {
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    height: 46px;
    min-height: 46px;
    max-height: 46px;
    margin-right: 3px;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 70px;
    column-gap: 8px;
  }
}

/* Compact history rows: prevent CSS Grid from stretching cards to fill the sidebar. */
.conversation-history {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  align-content: flex-start;
  gap: 7px;
  overflow-y: auto;
  overflow-x: hidden;
}

.history-row {
  flex: 0 0 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  grid-template-rows: 62px;
  gap: 3px;
  width: 100%;
  max-width: 158px;
  height: 62px;
  min-height: 62px;
  max-height: 62px;
  margin: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  transform: none;
  overflow: hidden;
}

.history-row:hover {
  border: 0;
  background: transparent;
  transform: none;
}

.history-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 14px;
  gap: 3px;
  align-content: center;
  width: 100%;
  max-width: none;
  height: 62px;
  min-height: 62px;
  max-height: 62px;
  margin: 0;
  padding: 8px 7px 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  transform: none;
  overflow: hidden;
}

.history-item:hover,
.history-item.active {
  border-color: rgba(194, 62, 68, 0.48);
  background: linear-gradient(105deg, rgba(169, 39, 45, 0.2), rgba(255, 255, 255, 0.045));
  box-shadow: inset 2px 0 0 rgba(210, 65, 72, 0.92);
  transform: none;
}

.history-item strong {
  display: -webkit-box;
  min-width: 0;
  height: auto;
  max-height: 32px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: normal;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 14px;
  min-height: 14px;
  max-height: 14px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
  line-height: 14px;
  overflow: hidden;
}

.history-meta span {
  height: 14px;
  line-height: 14px;
  white-space: nowrap;
}

.delete-history {
  position: relative;
  width: 22px;
  min-width: 22px;
  max-width: 22px;
  height: 62px;
  min-height: 62px;
  max-height: 62px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: transparent;
  font-size: 0;
  background: transparent;
  opacity: 0;
  transform: none;
}

.delete-history::before {
  content: "×";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.58);
  font-size: 15px;
  line-height: 1;
}

.history-row:hover .delete-history,
.delete-history:focus-visible {
  opacity: 1;
}

.delete-history:hover {
  background: rgba(169, 39, 45, 0.28);
}

/* Unified composer: the send action belongs inside the input surface. */
.composer {
  display: block;
  position: relative;
}

.composer .input-stack {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.composer textarea {
  padding-right: 96px;
}

.composer .upload-tools {
  padding-right: 96px;
}

#send {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  height: 40px;
  min-height: 40px;
  max-height: 40px;
  margin: 0;
  padding: 0 10px;
  border-radius: 8px;
  border-color: rgba(127, 23, 29, 0.82);
  background: linear-gradient(145deg, #ad2a31, #921f25);
  box-shadow: 0 5px 12px rgba(127, 23, 29, 0.16), inset 0 1px rgba(255, 255, 255, 0.14);
}

#send:hover {
  box-shadow: 0 7px 15px rgba(127, 23, 29, 0.21), inset 0 1px rgba(255, 255, 255, 0.16);
}

@media (max-width: 980px) {
  .composer textarea,
  .composer .upload-tools {
    padding-right: 82px;
  }

  #send {
    right: 8px;
    bottom: 8px;
    width: 62px;
    min-width: 62px;
    max-width: 62px;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
  }
}

#send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

#send span {
  display: inline-block;
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

/* ── 图文对应：配图随正文就地插入 ────────────────────────────────
   甲方要求图片不能只堆在回答末尾，要和说明它的那段文字对应。
   `.answer-figure` 由 renderInlineFigure 生成，直接跟在引用它的
   段落 / 列表 / 表格之后，因此左边和正文对齐、宽度跟随正文。
   `.answer-figure-fallback` 只在正文一张图都没点名时才出现。 */
.answer-figure { max-width:min(100%,560px); margin:12px 0 18px; overflow:hidden; border:1px solid var(--line); background:#ededE9; box-shadow:0 6px 18px rgba(32,34,38,.04); }
.answer-figure .image-link { display:block; background:#e9e9e5; }
.answer-figure img { width:100%; height:auto; max-height:min(46vw,420px); display:block; object-fit:contain; transition:transform .25s ease; }
.answer-figure:hover img { transform:scale(1.01); }
.answer-figure figcaption { padding:9px 12px; background:#fff; border-top:1px solid var(--line); }
.answer-figure figcaption strong { display:block; color:#454950; font-size:11px; line-height:1.55; overflow-wrap:anywhere; }
.answer-figure figcaption .image-kind { display:inline-block; margin-top:5px; padding:1px 6px; border:1px solid var(--line); color:var(--muted); font-size:9px; }
.answer-figure figcaption .image-open { display:inline-block; margin-top:6px; margin-left:8px; color:var(--blue); font-size:10px; font-weight:700; }
.answer-figure-fallback { margin-top:20px; padding-top:16px; border-top:1px solid #e5e5e0; }
.answer-figure-fallback .result-section-heading { margin-bottom:10px; color:#41454b; font-size:12px; font-weight:700; }
@media (max-width:760px) { .answer-figure { max-width:100%; } .answer-figure img { max-height:min(70vw,360px); } }
