:root {
  --ink: #151917;
  --ink-2: #202622;
  --paper: #f4f0e7;
  --paper-2: #ebe6db;
  --white: #fffdf8;
  --line: #d6d0c3;
  --muted: #797e77;
  --orange: #d85b32;
  --orange-soft: rgba(216, 91, 50, .1);
  --gold: #9a7738;
  --gold-soft: rgba(154, 119, 56, .12);
  --green: #668b72;
  --red: #b84a42;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "DM Sans", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { width: 100%; height: 100dvh; }
body { overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--font-body); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #aaa69c; }

.topbar {
  height: 68px; display: flex; align-items: center; gap: 34px; padding: 0 24px;
  background: var(--ink); color: #f7f3ea; border-bottom: 1px solid #333a35;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 250px; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #626961; color: var(--orange); font: italic 20px var(--font-display); }
.brand-name { font: 600 17px var(--font-display); letter-spacing: .02em; }
.brand-subtitle { margin-top: 2px; color: #8f9890; font: 9px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; }
.topbar-context { display: flex; gap: 12px; align-items: baseline; color: #d8ddd6; font-size: 12px; }
.context-label, .topbar-stat span { color: #778078; font: 9px var(--font-mono); letter-spacing: .12em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.system-pill { display: flex; gap: 8px; align-items: center; color: #aeb7af; font: 10px var(--font-mono); }
.dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(102,139,114,.12); }
.dot.off { background: var(--red); }
.topbar-stat { display: grid; gap: 2px; }
.topbar-stat strong { font: 500 11px var(--font-mono); }
.github-link { color: #f4f0e7; text-decoration: none; border-left: 1px solid #3d443f; padding-left: 18px; font: 10px var(--font-mono); }

/* ── 更多下拉菜单 ── */
.topbar-more { position: relative; }
.more-btn { padding: 8px 14px; border: 1px solid #4a514b; background: transparent; color: #aeb7af; cursor: pointer; font: 10px var(--font-mono); letter-spacing: .06em; transition: .2s; }
.more-btn:hover { border-color: #7d867f; color: #e8eee8; }
.more-dropdown { display: none; position: absolute; right: 0; top: 100%; margin-top: 8px; min-width: 180px; background: var(--ink); border: 1px solid #3d443f; box-shadow: 0 16px 48px rgba(0,0,0,.5); z-index: 50; }
.more-dropdown.open { display: block; }
.more-item { display: block; width: 100%; padding: 14px 18px; border: 0; border-bottom: 1px solid #2d332f; background: transparent; color: #c9cec9; cursor: pointer; text-align: left; font: 11px var(--font-body); transition: .15s; }
.more-item:hover { background: #272e29; color: #fff; }
.more-item:last-child { border-bottom: 0; color: var(--orange); }

.console-shell { height: calc(100dvh - 68px); display: grid; grid-template-columns: 72px minmax(0, 1fr) 320px; }
.console-rail { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; background: var(--ink-2); border-right: 1px solid #343b36; }
.rail-tab { height: 78px; color: #7d867f; background: transparent; border: 0; border-bottom: 1px solid #343b36; cursor: pointer; display: grid; place-content: center; gap: 4px; position: relative; }
.rail-tab span, .rail-version { font: 8px var(--font-mono); letter-spacing: .12em; }
.rail-tab b { font: 600 11px var(--font-mono); }
.rail-tab.active { color: #fff; background: #272e29; }
.rail-tab.active::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; background: var(--orange); }
.rail-spacer { flex: 1; }
.rail-version { color: #626b64; text-align: center; padding: 20px 0; writing-mode: vertical-rl; margin: auto; }

.content { grid-column: 2 / 4; grid-row: 1; min-width: 0; min-height: 0; overflow: hidden; }
.tab-panel { display: none; height: 100%; min-height: 0; overflow: hidden; }
.tab-panel.active { display: block; }
.chat-layout { height: 100%; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 238px minmax(420px, 1fr) 320px; }

.chat-sidebar { background: var(--paper-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head { padding: 22px 18px 16px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--orange); font: 600 9px var(--font-mono); letter-spacing: .15em; text-transform: uppercase; }
.btn-new-chat { margin-top: 13px; width: 100%; padding: 10px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; font-size: 12px; }
.conversation-list { flex: 1; overflow-y: auto; padding: 10px; }
.conv-item { width: 100%; display: flex; gap: 6px; align-items: center; padding: 10px; color: var(--ink); background: transparent; border: 1px solid transparent; cursor: pointer; text-align: left; font-size: 11px; }
.conv-item:hover, .conv-item.active { background: var(--white); border-color: var(--line); }
.conv-title { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conv-delete { opacity: 0; color: var(--red); }
.conv-item:hover .conv-delete { opacity: 1; }
.preset-block { max-height: 43%; border-top: 1px solid var(--line); padding: 14px 10px; overflow: hidden; }
.preset-heading { display: flex; justify-content: space-between; align-items: center; padding: 0 5px 10px; }
.preset-heading span { color: var(--muted); font: 8px var(--font-mono); }
.preset-list { height: calc(100% - 25px); overflow-y: auto; }
.preset-chip { width: 100%; padding: 8px; border: 0; border-top: 1px solid #d7d1c5; background: transparent; color: #555b55; cursor: pointer; text-align: left; font-size: 10px; line-height: 1.35; }
.preset-chip:hover { color: var(--orange); background: rgba(255,255,255,.5); }
.preset-tag { display: block; margin-bottom: 3px; color: #969990; font: 7px var(--font-mono); letter-spacing: .08em; }

.chat-workspace { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--paper); }
.chat-workspace::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .28; background-image: linear-gradient(rgba(21,25,23,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(21,25,23,.035) 1px, transparent 1px); background-size: 32px 32px; }
.chat-messages { position: relative; z-index: 1; flex: 1; min-height: 0; overflow-y: auto; padding: 38px clamp(28px, 5vw, 76px) 150px; display: flex; flex-direction: column; gap: 24px; }
.chat-empty { max-width: 700px; margin: auto 0; padding-bottom: 8vh; }
.hero-index { color: var(--orange); font: 600 10px var(--font-mono); letter-spacing: .16em; margin-bottom: 18px; }
.chat-empty h1, .page-header h1 { font: 600 clamp(36px, 4vw, 64px)/1.02 var(--font-display); letter-spacing: -.035em; }
.chat-empty h1 em { color: var(--orange); font-weight: 600; }
.chat-empty p { max-width: 590px; color: #626861; margin-top: 24px; font-size: 14px; line-height: 1.8; }
.hero-capabilities { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.hero-capabilities span { padding: 7px 9px; border: 1px solid #cfc9bd; background: rgba(255,255,255,.42); font: 8px var(--font-mono); letter-spacing: .08em; }
.msg { max-width: 800px; animation: rise .28s ease; }
.msg.user { align-self: flex-end; max-width: 68%; }
.msg.thinking { align-self: flex-start; }
.msg.thinking .bubble { padding: 14px 22px; background: rgba(21,25,23,.04); border: 1px dashed #c9c3b6; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 10px; letter-spacing: .02em; }
.thinking-dots { display: inline-flex; gap: 3px; }
.thinking-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--orange); animation: dot-bounce 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .2s; }
.thinking-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot-bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-6px); opacity: 1; } }
.msg.user .bubble { padding: 12px 16px; background: var(--ink); color: #fff; font-size: 13px; }
.msg.assistant { width: 100%; align-self: flex-start; }
.msg.assistant .bubble { padding: 24px 26px; background: rgba(255,253,248,.92); border: 1px solid var(--line); border-left: 3px solid var(--orange); box-shadow: 0 14px 40px rgba(39,35,29,.06); font-size: 14px; line-height: 1.85; }
.msg.assistant .bubble h1, .msg.assistant .bubble h2, .msg.assistant .bubble h3 { margin: 14px 0 7px; font-family: var(--font-display); }
.msg.assistant .bubble p { margin: 7px 0; }
.msg.assistant .bubble ul, .msg.assistant .bubble ol { padding-left: 22px; }
.msg.assistant .bubble code { padding: 2px 5px; background: var(--paper-2); color: var(--orange); font-family: var(--font-mono); }
.msg.assistant .bubble pre { margin: 12px 0; padding: 16px; overflow-x: auto; background: var(--ink); color: #e8eee8; font: 12px/1.6 var(--font-mono); }
.msg.assistant .bubble table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.msg.assistant .bubble th, .msg.assistant .bubble td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.typing-cursor { display: inline-block; width: 2px; height: 16px; margin-left: 2px; background: var(--orange); animation: blink .8s infinite; }
.sources-section { margin-top: 10px; }
.sources-label { color: var(--muted); font: 9px var(--font-mono); letter-spacing: .1em; margin-bottom: 8px; }
.sources-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.src-card { flex: 1 1 210px; max-width: 290px; padding: 12px; background: var(--white); border: 1px solid var(--line); font-size: 10px; }
.src-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); margin-top: 4px; font: 8px var(--font-mono); }
.score-bar { height: 2px; margin-top: 7px; background: #ded9ce; }
.score-bar-inner { height: 100%; background: var(--orange); }
.src-excerpt { color: var(--muted); margin-top: 7px; line-height: 1.45; }
.src-download { display: inline-block; margin-top: 7px; color: var(--orange); text-decoration: none; }

.chat-input-area { position: absolute; z-index: 3; left: clamp(22px, 4vw, 64px); right: clamp(22px, 4vw, 64px); bottom: 20px; padding: 11px 12px 12px; background: rgba(255,253,248,.96); border: 1px solid #bdb7aa; box-shadow: 0 22px 55px rgba(34,30,25,.14); backdrop-filter: blur(12px); }
.composer-meta { display: flex; justify-content: space-between; color: #8b8d86; font: 7px var(--font-mono); letter-spacing: .1em; margin: 0 3px 8px; }
.composer-row { display: flex; gap: 10px; }
.composer-row textarea { flex: 1; min-height: 44px; max-height: 120px; padding: 11px 12px; resize: none; outline: 0; border: 0; background: var(--paper); color: var(--ink); font-size: 13px; }
.btn-send { min-width: 118px; border: 0; background: var(--orange); color: #fff; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.btn-send b { font-size: 18px; }
.btn-send:disabled { opacity: .45; cursor: wait; }

.evidence-panel { background: var(--ink); color: #e7ebe5; border-left: 1px solid #303631; overflow-y: auto; }
.signal-section, .pipeline-section, .evidence-section { padding: 22px 20px; border-bottom: 1px solid #303631; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.panel-heading span { color: #737c75; font: 7px var(--font-mono); letter-spacing: .1em; }
.metric-grid { display: grid; gap: 12px; }
.metric-card { display: grid; grid-template-columns: 66px 1fr; align-items: end; gap: 7px 10px; }
.metric-card strong { color: #fff; font: 500 24px var(--font-display); }
.metric-card span { color: #9ca59e; font-size: 10px; }
.metric-card i { grid-column: 1 / -1; height: 2px; background: #333a35; }
.metric-card i::after { content: ""; display: block; width: var(--score); height: 100%; background: var(--orange); }
.pipeline-trace { list-style: none; }
.pipeline-trace li { display: grid; grid-template-columns: 25px 1fr; gap: 10px; padding: 9px 0; position: relative; opacity: .55; transition: .25s; }
.pipeline-trace li:not(:last-child)::after { content: ""; position: absolute; left: 10px; top: 31px; bottom: -5px; width: 1px; background: #424943; }
.pipeline-trace li b { display: grid; place-items: center; width: 21px; height: 21px; border: 1px solid #59615b; color: #929a93; font: 7px var(--font-mono); border-radius: 50%; z-index: 1; background: var(--ink); }
.pipeline-trace li div { display: grid; gap: 2px; }
.pipeline-trace li strong { font-size: 10px; }
.pipeline-trace li span { color: #788079; font: 8px var(--font-mono); }
.pipeline-trace li.active, .pipeline-trace li.complete { opacity: 1; }
.pipeline-trace li.active b { border-color: var(--orange); color: var(--orange); box-shadow: 0 0 0 4px rgba(216,91,50,.1); }
.pipeline-trace li.complete b { color: #dce8df; background: var(--green); border-color: var(--green); }
.evidence-list { display: grid; gap: 8px; }
.evidence-empty { color: #737c75; font-size: 10px; line-height: 1.6; }
.evidence-item { padding: 11px; border: 1px solid #3a413c; background: #1c211e; }
.evidence-item-head { display: flex; gap: 8px; justify-content: space-between; }
.evidence-item strong { max-width: 190px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 9px; }
.evidence-item b { color: var(--orange); font: 8px var(--font-mono); }
.evidence-item p { color: #818a83; margin-top: 5px; font-size: 8px; line-height: 1.45; }
.evidence-item i { display: block; height: 2px; margin-top: 8px; background: linear-gradient(90deg, var(--orange) var(--score), #363d38 var(--score)); }

.page-layout { height: 100%; overflow-y: auto; padding: 38px 44px; background: var(--paper); }
.page-header { display: flex; justify-content: space-between; align-items: end; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.page-header h1 { margin-top: 12px; font-size: clamp(36px, 4vw, 58px); }
.doc-actions { display: flex; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--white); color: var(--ink); padding: 10px 15px; cursor: pointer; text-decoration: none; font-size: 11px; }
.btn.primary { border-color: var(--orange); background: var(--orange); color: #fff; }
.btn.danger { color: var(--red); }
.btn:disabled { opacity: .5; }
.doc-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.doc-stat-card { padding: 25px 20px; border-right: 1px solid var(--line); }
.doc-stat-card span { display: block; color: var(--muted); font: 8px var(--font-mono); letter-spacing: .1em; }
.doc-stat-card strong { display: block; margin-top: 10px; color: var(--orange); font: 600 30px var(--font-display); }
.doc-table-wrap { overflow: auto; padding-top: 18px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.doc-table th { color: var(--muted); font: 8px var(--font-mono); letter-spacing: .08em; text-align: left; padding: 12px; border-bottom: 1px solid var(--ink); }
.doc-table td { padding: 12px; border-bottom: 1px solid var(--line); }
.doc-name-cell { max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { padding: 3px 6px; background: var(--paper-2); font: 8px var(--font-mono); }
.badge.ok { color: var(--green); }.badge.no { color: var(--red); }.badge.cat { color: #526d83; }
.action-cell { display: flex; gap: 5px; }.btn-sm { padding: 5px 8px; }
.about-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 24px; }
.about-card { padding: 22px; background: var(--white); border: 1px solid var(--line); }
.about-card-wide { grid-column: 1 / -1; }
.about-pipeline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; font: 10px var(--font-mono); }
.about-pipeline span { padding: 10px; border: 1px solid var(--line); }
.about-pipeline i { color: var(--orange); }
.about-card dl { margin-top: 18px; display: grid; grid-template-columns: 1fr 1.4fr; gap: 11px; font-size: 10px; }
.about-card dt { color: var(--muted); }.about-card dd { font-family: var(--font-mono); }

.modal-overlay { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(21,25,23,.7); place-items: center; }
.modal-overlay.open { display: grid; }
.modal { width: min(520px, calc(100vw - 30px)); padding: 28px; background: var(--white); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.modal h3 { margin: 8px 0 22px; font: 600 28px var(--font-display); }
.form-group { margin-bottom: 15px; }.form-group label, .form-check label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.form-group input, .form-group select { width: 100%; padding: 10px; border: 1px solid var(--line); background: var(--paper); outline: 0; }
.form-hint { color: var(--muted); font-size: 9px; margin-top: 5px; }
.form-check { display: flex; align-items: center; gap: 8px; }.form-check label { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast-container { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: grid; gap: 8px; }
.toast { padding: 12px 16px; background: var(--ink); color: #fff; border-left: 3px solid var(--orange); font-size: 11px; }
.toast.success { border-color: var(--green); }.toast.error { border-color: var(--red); }

/* ── 鉴权门禁 ── */
.auth-gate { display: none; position: absolute; inset: 0; z-index: 25; background: rgba(21,25,23,.88); backdrop-filter: blur(14px); place-items: center; }
.auth-gate.locked { display: grid; }
.auth-card { width: min(420px, calc(100vw - 40px)); padding: 44px 36px; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.35); text-align: center; }
.auth-card h2 { margin: 8px 0 14px; font: 600 36px/1.1 var(--font-display); letter-spacing: -.03em; }
.auth-card > p { color: var(--muted); margin-bottom: 28px; font-size: 14px; }
.auth-input-row { display: flex; gap: 10px; }
.auth-input-row input { flex: 1; padding: 14px 16px; border: 1px solid var(--line); background: var(--white); color: var(--ink); font-family: var(--font-mono); font-size: 15px; letter-spacing: .12em; outline: 0; }
.auth-input-row input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.auth-input-row .btn { white-space: nowrap; padding: 14px 24px; font-size: 14px; }
.auth-error { margin-top: 14px; min-height: 20px; color: var(--red); font-size: 12px; }
.auth-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--white); color: var(--muted); cursor: pointer; font-size: 16px; border-radius: 50%; transition: .2s; }
.auth-close:hover { color: var(--ink); border-color: var(--ink); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Ivory editorial edition */
body {
  background: #f7f3eb;
  background-image:
    radial-gradient(circle at 18% 10%, rgba(255,255,255,.8), transparent 28%),
    repeating-linear-gradient(0deg, rgba(107,87,55,.018) 0, rgba(107,87,55,.018) 1px, transparent 1px, transparent 4px);
}
.topbar {
  height: 72px;
  background: rgba(253,250,244,.97);
  color: var(--ink);
  border-bottom-color: #c8bfae;
  box-shadow: 0 8px 30px rgba(65,49,28,.035);
}
.brand-mark {
  width: 38px; height: 38px;
  border-color: var(--gold);
  color: var(--gold);
  background: #fffdf8;
  box-shadow: inset 0 0 0 4px #f5efe4;
}
.brand-name { font-size: 19px; }
.brand-subtitle, .context-label, .topbar-stat span { color: #948b7c; }
.topbar-context { color: #5f594f; }
.system-pill { color: #6f756d; }
.github-link { color: var(--ink); border-left-color: #d3cbbb; }
.console-shell { height: calc(100vh - 72px); }
.console-rail {
  background: #f1ece2;
  border-right-color: #cfc6b6;
}
.rail-tab {
  height: 84px;
  color: #9b9488;
  border-bottom-color: #d8d0c2;
}
.rail-tab.active {
  color: var(--ink);
  background: #fffdf8;
}
.rail-tab.active::before { background: var(--gold); }
.rail-version { color: #aaa194; }
.chat-layout { grid-template-columns: 220px minmax(460px, 1fr) 330px; }
.chat-sidebar {
  background: rgba(247,243,235,.88);
  border-right-color: #d2caba;
}
.sidebar-head { padding: 24px 17px 18px; border-bottom-color: #d8d0c2; }
.eyebrow { color: #8e682b; }
.btn-new-chat {
  background: transparent;
  color: var(--ink);
  border-color: #a98850;
  letter-spacing: .08em;
}
.btn-new-chat:hover { background: #fffdf8; box-shadow: 0 8px 24px rgba(84,62,30,.07); }
.conv-item:hover, .conv-item.active { border-color: #cbbfa9; box-shadow: 0 5px 16px rgba(72,53,28,.04); }
.preset-block { border-top-color: #d8d0c2; }
.preset-chip:hover { color: #8b572d; background: #fffdf8; }
.chat-workspace { background: rgba(249,246,239,.72); }
.chat-workspace::before {
  opacity: .4;
  background-image: linear-gradient(rgba(126,103,66,.035) 1px, transparent 1px);
  background-size: 100% 34px;
}
.chat-messages {
  padding: 42px clamp(34px, 5vw, 84px) 218px;
}
.chat-empty {
  max-width: 680px;
  margin: auto 0;
  padding-bottom: 2vh;
}
.hero-index { color: var(--gold); margin-bottom: 14px; }
.chat-empty h1, .page-header h1 {
  font-size: clamp(32px, 3.15vw, 48px);
  line-height: 1.04;
  letter-spacing: -.03em;
}
.chat-empty h1 em { color: #a34f2d; }
.chat-empty p { max-width: 560px; margin-top: 19px; line-height: 1.7; }
.hero-capabilities { margin-top: 21px; }
.hero-capabilities span {
  padding: 6px 9px;
  border-color: #d1c6b3;
  background: rgba(255,253,248,.68);
  color: #746b5e;
}
.msg.assistant .bubble {
  background: rgba(255,253,248,.96);
  border-color: #d2c7b4;
  border-left-color: var(--gold);
  box-shadow: 0 18px 48px rgba(70,49,22,.075);
}
.msg.user .bubble { background: #322d26; }
.chat-input-area {
  left: clamp(25px, 4.5vw, 74px);
  right: clamp(25px, 4.5vw, 74px);
  bottom: 24px;
  min-height: 112px;
  padding: 12px 14px 14px;
  background: rgba(255,253,248,.98);
  border-color: #b9a784;
  box-shadow: 0 24px 65px rgba(73,51,20,.16), inset 0 0 0 5px #f4eee3;
}
.composer-meta { margin-top: 10px; color: #938879; }
.composer-row textarea {
  min-height: 70px;
  max-height: 150px;
  padding: 17px 16px;
  background: #f8f3ea;
  font-family: var(--font-display);
  font-size: 16px;
}
.btn-send {
  min-width: 132px;
  background: #a3522f;
  box-shadow: 0 8px 22px rgba(137,67,38,.2);
}
.compact-trace {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  align-items: center;
  border-bottom: 1px solid #ddd3c3;
  padding: 0 2px 10px;
}
.compact-trace li {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  color: #aaa294;
  font: 7px var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: color .2s;
}
.compact-trace li:not(.trace-status)::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-left: 4px;
  background: #d8cebd;
}
.compact-trace li b { color: #b5a88f; font-weight: 500; }
.compact-trace li.active, .compact-trace li.complete { color: var(--ink); }
.compact-trace li.active b { color: #a3522f; animation: pulse-dot .6s ease-in-out infinite alternate; }
.compact-trace li.complete b { color: var(--gold); }
.compact-trace .trace-status {
  justify-content: flex-end;
  color: #8b682f;
  font-weight: 600;
}
@keyframes pulse-dot {
  from { box-shadow: 0 0 0 0 rgba(168,82,47,.35); }
  to   { box-shadow: 0 0 0 8px rgba(168,82,47,0); }
}

/* 状态文字闪烁（搜索中…） */
.trace-status.searching {
  animation: text-flicker 2s ease-in-out infinite;
}
@keyframes text-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.evidence-panel {
  height: 100%;
  min-height: 0;
  background: #f0ebe2;
  color: var(--ink);
  border-left-color: #c9bfad;
}
.signal-section, .evidence-section {
  padding: 24px 22px;
  border-bottom-color: #d0c7b8;
}
.panel-heading { padding-bottom: 12px; border-bottom: 1px solid #d5ccbd; }
.panel-heading span { color: #92897b; }
.metric-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.metric-card {
  display: block;
  padding: 0 10px;
  border-left: 1px solid #d8cfc0;
}
.metric-card:first-child { padding-left: 0; border-left: 0; }
.metric-card strong { color: var(--ink); font-size: 21px; }
.metric-card span { display: block; min-height: 28px; margin-top: 4px; color: #7f786d; font-size: 7px; line-height: 1.25; }
.metric-card i { display: block; margin-top: 8px; background: #ddd5c8; }
.metric-card i::after { background: var(--gold); }
.evidence-section { border-bottom: 0; }
.evidence-empty { color: #8c8478; }
.evidence-item {
  padding: 14px 12px;
  border: 0;
  border-bottom: 1px solid #d4cabb;
  background: transparent;
}
.evidence-item-head::before {
  content: counter(evidence, decimal-leading-zero);
  counter-increment: evidence;
  color: #a28e6b;
  font: 18px var(--font-display);
}
.evidence-list { counter-reset: evidence; }
.evidence-item-head { align-items: baseline; }
.evidence-item strong { margin-right: auto; max-width: 175px; font-family: var(--font-display); font-size: 11px; }
.evidence-item b { color: #9a542f; }
.evidence-item p { margin-left: 28px; color: #81796d; }
.evidence-item i { margin-left: 28px; background: linear-gradient(90deg, var(--gold) var(--score), #d9d0c2 var(--score)); }
.page-layout { background: #f7f3eb; }
.about-card { background: #fffdf8; border-color: #d1c6b4; }
.about-card-wide { padding: 0; overflow: hidden; }
.system-orbit {
  min-height: 480px;
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(480px, 1.2fr);
  align-items: center;
  gap: 40px;
  padding: 42px 55px;
  background:
    radial-gradient(circle at 73% 50%, rgba(190,158,99,.12), transparent 31%),
    #fffdf8;
}
.orbit-copy h2 {
  margin-top: 16px;
  font: 600 clamp(34px, 4vw, 58px)/1.02 var(--font-display);
}
.orbit-copy h2 em { color: #a3522f; }
.orbit-copy > p:last-child { max-width: 390px; margin-top: 20px; color: var(--muted); line-height: 1.75; font-size: 13px; }
.orbit-map {
  position: relative;
  width: 460px;
  height: 460px;
  margin: auto;
  border: 1px solid #cdbd9f;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 31%, #d9ccb5 31.3%, transparent 31.7%),
    radial-gradient(circle, transparent 48%, #e2d8c6 48.3%, transparent 48.7%);
}
.orbit-map::before, .orbit-map::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 88%; height: 1px;
  background: #dfd4c1;
  transform: translate(-50%, -50%);
}
.orbit-map::after { transform: translate(-50%, -50%) rotate(60deg); }
.orbit-core {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 132px; height: 132px;
  display: grid; place-content: center;
  text-align: center;
  border: 1px solid #a98952;
  border-radius: 50%;
  background: #fffdf8;
  box-shadow: 0 16px 38px rgba(94,67,28,.13), inset 0 0 0 8px #f3ecdf;
}
.orbit-core strong { font: 600 48px var(--font-display); }
.orbit-core span { color: var(--gold); font: 8px var(--font-mono); letter-spacing: .18em; }
.orbit-stage {
  position: absolute;
  z-index: 3;
  width: 116px;
  text-align: center;
  color: #5f584d;
}
.orbit-stage::before {
  content: "";
  display: block;
  width: 9px; height: 9px;
  margin: 0 auto 7px;
  border: 2px solid #fffdf8;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.orbit-stage b { display: block; color: #a3522f; font: 8px var(--font-mono); }
.orbit-stage span { display: block; margin-top: 3px; font: 10px var(--font-body); }
.orbit-1 { left: 50%; top: -16px; transform: translateX(-50%); }
.orbit-2 { right: -18px; top: 25%; }
.orbit-3 { right: 12px; bottom: 13%; }
.orbit-4 { left: 50%; bottom: -18px; transform: translateX(-50%); }
.orbit-5 { left: 12px; bottom: 13%; }
.orbit-6 { left: -18px; top: 25%; }

/* ============================================================
   Tablet — ≤1080px：隐藏证据面板，缩小侧栏
   ============================================================ */
/* === LEGACY RESPONSIVE — overridden by mobile-fix.css === */
/*
@media (max-width: 1080px) {
  .console-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .content { grid-column: 2; }
  .chat-layout { grid-template-columns: 200px minmax(0, 1fr); }
  .evidence-panel { display: none; }
  .topbar-context, .topbar-stat { display: none; }
  .system-orbit { grid-template-columns: 1fr; }
  .chat-sidebar { width: 200px; }
  .preset-chip { font-size: 9px; }
  .chat-messages { padding: 34px 32px 150px; }
}

/* ============================================================
   Mobile — ≤760px：单列布局，底栏输入，水平导航
   ============================================================ */
@media (max-width: 760px) {
  /* ── 全局 ── */
  html, body, #app { height: 100dvh; font-size: 16px; }
  body { overflow: hidden; }

  /* ── 顶栏 ── */
  .topbar {
    height: 56px; padding: 0 14px; gap: 14px;
    justify-content: space-between;
  }
  .brand-lockup { min-width: 0; gap: 10px; }
  .brand-mark { width: 34px; height: 34px; font-size: 16px; }
  .brand-name { font-size: 14px; font-weight: 600; }
  .brand-subtitle, .github-link, .topbar-stat { display: none; }
  .topbar-context { display: none; }
  .system-pill { font-size: 11px; padding: 6px 12px; }
  .system-pill .dot { width: 8px; height: 8px; }

  /* ── 主区域 ── */
  .console-shell {
    height: calc(100dvh - 56px); display: grid;
    grid-template-columns: 1fr; grid-template-rows: 52px minmax(0, 1fr);
  }

  /* ── 导航栏：水平 tabs ── */
  .console-rail {
    grid-column: 1; grid-row: 1; flex-direction: row; border-right: 0;
    border-bottom: 1px solid #343b36; overflow-x: auto;
  }
  .rail-tab {
    flex: 1; min-width: 0; height: 52px; border-right: 1px solid #343b36;
    border-bottom: 0; gap: 2px;
  }
  .rail-tab b { font-size: 12px; font-weight: 600; }
  .rail-tab span { font-size: 9px; }
  .rail-tab.active::before {
    top: auto; bottom: 0; left: 16px; right: 16px;
    width: auto; height: 3px;
  }
  .rail-spacer, .rail-version { display: none; }
  .content { grid-column: 1; grid-row: 2; }

  /* ── 聊天 ── */
  .chat-layout { grid-template-columns: 1fr; min-height: 0; }
  .chat-sidebar { display: none; }
  .chat-messages {
    padding: 20px 14px 200px; gap: 20px;
  }
  .chat-empty { padding-bottom: 4vh; }
  .chat-empty h1 { font-size: 30px; }
  .chat-empty .hero-index { font-size: 10px; margin-bottom: 12px; }
  .chat-empty p { font-size: 14px; margin-top: 16px; line-height: 1.7; }
  .hero-capabilities { gap: 8px; margin-top: 18px; }
  .hero-capabilities span { font-size: 9px; padding: 7px 9px; letter-spacing: .06em; }
  .msg { max-width: 100%; }
  .msg.user { max-width: 88%; }
  .msg.user .bubble { padding: 12px 16px; font-size: 14px; border-radius: 4px; }
  .msg.assistant .bubble { padding: 18px 16px; font-size: 14px; line-height: 1.75; border-left-width: 4px; }
  .msg.thinking .bubble { padding: 14px 18px; font-size: 13px; }
  .sources-section { margin-top: 8px; }
  .sources-label { font-size: 10px; margin-bottom: 10px; }
  .sources-grid { gap: 8px; }
  .src-card { flex: 1 1 100%; max-width: 100%; padding: 14px; font-size: 11px; }
  .src-name { font-size: 12px; }
  .src-meta { font-size: 9px; }
  .src-excerpt { font-size: 10px; }
  .src-download { font-size: 10px; padding: 8px 0; }

  /* ── 输入区：固定在底部 ── */
  .chat-input-area {
    position: fixed; z-index: 20;
    left: 0; right: 0; bottom: 0;
    padding: 12px 12px max(14px, env(safe-area-inset-bottom));
    background: rgba(244,240,231,.97); backdrop-filter: blur(16px);
    border: 0; border-top: 1px solid #d6d0c3;
    box-shadow: 0 -8px 32px rgba(34,30,25,.1);
  }
  .composer-row { gap: 10px; align-items: flex-end; }
  .composer-row textarea {
    min-height: 46px; max-height: 120px;
    padding: 12px 14px; font-size: 16px; border-radius: 6px;
    border: 1px solid #d6d0c3; background: #fffdf8;
  }
  .btn-send {
    min-width: 56px; height: 46px; padding: 0 14px; border-radius: 6px;
    font-size: 14px; font-weight: 600;
  }
  .btn-send span { display: none; }
  .btn-send b { font-size: 22px; }
  .composer-meta { font-size: 9px; margin-bottom: 6px; }
  .composer-meta span:last-child { display: none; }

  /* ── 管线 trace ── */
  .compact-trace {
    grid-template-columns: repeat(4, 1fr); gap: 6px;
    padding: 10px 0 6px; margin-bottom: 6px;
  }
  .compact-trace li { display: flex; align-items: center; gap: 5px; padding: 3px 0; }
  .compact-trace li b { width: 18px; height: 18px; font-size: 7px; }
  .compact-trace li span { font-size: 9px; }
  .compact-trace li::after, .compact-trace .trace-status { display: none; }

  /* ── 文档页 ── */
  .page-layout { height: 100%; overflow-y: auto; padding: 22px 14px; }
  .page-header {
    display: grid; gap: 16px; align-items: start;
    padding-bottom: 20px;
  }
  .page-header h1 { font-size: 26px; line-height: 1.15; }
  .doc-actions { flex-wrap: wrap; gap: 10px; }
  .btn { padding: 12px 16px; font-size: 12px; border-radius: 4px; }
  .doc-stats { grid-template-columns: repeat(2, 1fr); }
  .doc-stat-card { padding: 18px 14px; }
  .doc-stat-card span { font-size: 9px; }
  .doc-stat-card strong { font-size: 26px; margin-top: 8px; }
  .doc-table-wrap { margin: 0 -14px; padding: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .doc-table { font-size: 11px; min-width: 580px; }
  .doc-table th { font-size: 9px; }
  .doc-table th, .doc-table td { padding: 11px 10px; }
  .doc-name-cell { max-width: 140px; }

  /* ── 关于页 ── */
  .about-grid { grid-template-columns: 1fr; gap: 12px; padding-top: 18px; }
  .about-card { padding: 20px; }
  .about-card-wide { grid-column: auto; }
  .about-card .eyebrow { font-size: 9px; }
  .about-card dl { font-size: 12px; gap: 12px; }
  .about-card dt { font-size: 11px; }
  .system-orbit { min-height: auto; padding: 28px 16px 40px; }
  .orbit-map { width: 280px; height: 280px; margin: 0 auto; }
  .orbit-core { width: 88px; height: 88px; }
  .orbit-core strong { font-size: 30px; }
  .orbit-core span { font-size: 10px; }
  .orbit-stage { width: 76px; padding: 7px; }
  .orbit-stage b { font-size: 9px; width: 18px; height: 18px; }
  .orbit-stage span { font-size: 8px; }
  .orbit-copy h2 { font-size: 24px; }
  .orbit-copy p { font-size: 13px; }

  /* ── 弹窗 ── */
  .modal { width: calc(100vw - 24px); padding: 24px 18px; }
  .modal h3 { font-size: 24px; }
  .modal .eyebrow { font-size: 9px; }
  .form-group label, .form-check label { font-size: 12px; }
  .form-group input, .form-group select { padding: 12px; font-size: 15px; }
  .form-hint { font-size: 10px; }
}

/* ============================================================
   小屏手机 — ≤400px：进一步收窄
   ============================================================ */
@media (max-width: 400px) {
  .topbar { height: 50px; padding: 0 10px; }
  .brand-mark { width: 28px; height: 28px; font-size: 13px; }
  .brand-name { font-size: 12px; }
  .console-shell { height: calc(100dvh - 50px); grid-template-rows: 46px minmax(0, 1fr); }
  .rail-tab { height: 46px; }
  .rail-tab b { font-size: 11px; }
  .chat-messages { padding: 14px 10px 190px; gap: 16px; }
  .msg.user .bubble { font-size: 13px; padding: 10px 14px; }
  .msg.assistant .bubble { font-size: 13px; padding: 15px 13px; }
  .chat-input-area { padding: 10px 8px max(10px, env(safe-area-inset-bottom)); }
  .composer-row textarea { font-size: 15px; min-height: 42px; padding: 10px 12px; }
  .btn-send { min-width: 50px; height: 42px; }
  .page-layout { padding: 16px 10px; }
  .about-card { padding: 15px; }
  .orbit-map { width: 240px; height: 240px; }
}

*/
