:root {
  color-scheme: light;
  --navy-950: #071a36;
  --navy-900: #0b2347;
  --navy-800: #17375e;
  --blue-600: #1f5fae;
  --blue-100: #eaf1fa;
  --gold-600: #b98222;
  --gold-100: #f8f1e4;
  --ink: #172033;
  --slate-700: #46556b;
  --slate-500: #748094;
  --slate-300: #cbd3de;
  --slate-200: #dfe4eb;
  --slate-100: #edf0f4;
  --paper: #ffffff;
  --canvas: #f6f7f9;
  --success: #1f6a50;
  --success-soft: #e9f3ef;
  --warning: #91651d;
  --warning-soft: #faf4e8;
  --danger: #a43b36;
  --danger-soft: #fff1ef;
  --shadow-sm: 0 7px 22px rgba(7, 26, 54, .06);
  --shadow-lg: 0 24px 70px rgba(7, 26, 54, .16);
  --radius: 4px;
  font-family: Inter, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.62; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(31, 95, 174, .24); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.wordmark { color: var(--navy-950); font-family: Georgia, "Songti SC", "STSong", serif; font-size: 24px; font-weight: 760; letter-spacing: .08em; }
.access-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; background: linear-gradient(rgba(255, 255, 255, .88), rgba(246, 247, 249, .96)), linear-gradient(90deg, rgba(7, 26, 54, .04) 1px, transparent 1px), linear-gradient(rgba(7, 26, 54, .04) 1px, transparent 1px); background-size: auto, 32px 32px, 32px 32px; }
.access-panel { width: min(460px, 100%); padding: 44px 42px 40px; border: 1px solid var(--slate-200); border-top: 4px solid var(--gold-600); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-lg); }
.access-panel h1 { margin: 30px 0 8px; color: var(--navy-950); font-family: Georgia, "Songti SC", "STSong", serif; font-size: 30px; line-height: 1.2; }
.access-panel > p { color: var(--slate-500); }
input, textarea { width: 100%; border: 1px solid var(--slate-300); border-radius: var(--radius); background: var(--paper); color: var(--ink); }
input { min-height: 44px; padding: 8px 12px; }
textarea { resize: none; padding: 14px 16px; line-height: 1.7; }

.primary-button, .secondary-button, .danger-button { min-height: 42px; padding: 8px 17px; border-radius: var(--radius); border: 1px solid transparent; font-weight: 680; transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease; }
.primary-button { border-color: var(--navy-950); background: var(--navy-950); color: #fff; }
.primary-button:hover { border-color: var(--blue-600); background: var(--blue-600); }
.secondary-button { border-color: var(--slate-300); background: var(--paper); color: var(--navy-900); }
.secondary-button:hover { border-color: var(--navy-900); }
.danger-button { border-color: #d9aaa7; background: var(--paper); color: var(--danger); }
.form-status { color: var(--slate-500); min-height: 1.5em; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(620px, 1fr); background: var(--paper); }
.session-rail { position: relative; z-index: 5; min-height: 100vh; padding: 25px 17px 18px; display: flex; flex-direction: column; border-right: 1px solid var(--slate-200); background: #f2f4f6; }
.rail-brand { display: flex; align-items: baseline; gap: 10px; margin: 0 3px 18px; color: var(--slate-500); font-size: 11px; letter-spacing: .08em; }
.map-return { min-height: 38px; display: flex; align-items: center; gap: 9px; margin: 0 0 10px; padding: 0 11px; border: 1px solid var(--slate-200); background: var(--paper); color: var(--navy-800); text-decoration: none; font-size: 12px; font-weight: 650; }
.map-return:hover { border-color: var(--navy-800); }
.map-return span { color: var(--gold-600); font-size: 17px; }
.session-rail > .primary-button { width: 100%; margin-bottom: 25px; }
.rail-section-title, .section-label { color: var(--slate-500); font-size: 10px; font-weight: 720; letter-spacing: .12em; text-transform: uppercase; }
.conversation-list { display: grid; gap: 3px; margin-top: 8px; }
.conversation-item { width: 100%; display: grid; gap: 5px; padding: 11px 10px 11px 12px; border: 0; border-left: 3px solid transparent; background: transparent; text-align: left; color: var(--ink); }
.conversation-item:hover { background: #e8ecf1; }
.conversation-item[aria-current="page"] { border-left-color: var(--gold-600); background: var(--paper); box-shadow: var(--shadow-sm); }
.conversation-item strong { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.conversation-item span { color: var(--slate-500); font-size: 10px; }
.access-summary { margin-top: auto; display: grid; gap: 5px; padding: 14px 13px; border-top: 2px solid var(--gold-600); background: var(--paper); color: var(--navy-800); box-shadow: var(--shadow-sm); }
.access-summary strong { font-size: 12px; }
.access-summary span { color: var(--slate-500); font-size: 10px; line-height: 1.5; }

.research-workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(rgba(255,255,255,.98), rgba(255,255,255,.98)), linear-gradient(90deg, rgba(7,26,54,.025) 1px, transparent 1px), linear-gradient(rgba(7,26,54,.025) 1px, transparent 1px); background-size: auto, 40px 40px, 40px 40px; }
.workspace-header { min-height: 92px; display: flex; justify-content: space-between; gap: 28px; align-items: center; padding: 18px 34px 17px; border-bottom: 1px solid var(--slate-200); background: rgba(255,255,255,.97); }
.workspace-title { min-width: 0; padding-left: 16px; border-left: 3px solid var(--gold-600); }
.workspace-eyebrow { color: var(--gold-600); font-size: 9px; font-weight: 760; letter-spacing: .16em; }
.workspace-header h1 { max-width: 720px; overflow: hidden; margin: 1px 0 0; color: var(--navy-950); font-family: Georgia, "Songti SC", "STSong", serif; font-size: 22px; line-height: 1.28; text-overflow: ellipsis; white-space: nowrap; }
.workspace-header p { margin: 3px 0 0; color: var(--slate-500); font-size: 11px; }
.workspace-actions { display: flex; align-items: center; gap: 9px; flex: none; }
.research-mode { min-height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--slate-200); color: var(--slate-700); font-size: 11px; font-weight: 650; }
.research-mode > span, .composer-mode-copy > span { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(31,106,80,.10); }
.evidence-toggle { min-height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--navy-900); background: var(--navy-900); color: #fff; font-size: 11px; font-weight: 680; }
.evidence-toggle span { min-width: 20px; padding: 1px 5px; background: rgba(255,255,255,.16); text-align: center; }

.empty-state { width: min(800px, calc(100% - 64px)); flex: 1; align-self: center; display: grid; align-content: center; justify-items: center; padding: 54px 0 32px; text-align: center; }
.empty-mark { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid var(--navy-800); color: var(--navy-900); font-family: Georgia, "Songti SC", serif; font-size: 24px; box-shadow: 7px 7px 0 var(--gold-100); }
.empty-kicker { color: var(--gold-600); font-size: 10px; font-weight: 760; letter-spacing: .12em; }
.empty-state h2 { margin: 6px 0 9px; color: var(--navy-950); font-family: Georgia, "Songti SC", "STSong", serif; font-size: 32px; font-weight: 650; }
.empty-state > p { max-width: 620px; margin: 0; color: var(--slate-500); font-size: 13px; }
.question-starters { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 30px; }
.question-starters button { min-height: 64px; padding: 11px 14px; border: 1px solid var(--slate-200); border-top: 2px solid var(--gold-600); background: var(--paper); color: var(--navy-800); text-align: left; font-size: 11px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.question-starters button:hover { border-color: var(--blue-600); transform: translateY(-1px); }

.turn-view { width: min(900px, calc(100% - 64px)); flex: 1; align-self: center; padding: 30px 0 20px; overflow: auto; }
.message-history { width: min(900px, calc(100% - 64px)); align-self: center; }
.message-history:empty { display: none; }
.history-turn { padding: 30px 0 4px; border-bottom: 1px solid var(--slate-200); }
.history-message { margin: 0 0 20px; }
.history-message.user-message { padding-bottom: 20px; }
.history-message p { margin: 5px 0 10px; color: #27364d; font-size: 13px; line-height: 1.78; }
.history-answer-footer { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--slate-100); }
.history-answer-footer button { padding: 0; border: 0; background: transparent; color: var(--blue-600); font-size: 10px; font-weight: 650; }
.history-answer-footer button:disabled { color: var(--slate-500); }
.chat-message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; }
.message-avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--slate-300); background: #f2f4f7; color: var(--navy-800); font-family: Georgia, "Songti SC", serif; font-weight: 700; }
.assistant-avatar { border-color: var(--navy-900); background: var(--navy-900); color: #fff; }
.message-body { min-width: 0; }
.message-meta { color: var(--slate-500); font-size: 10px; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; }
.user-message { padding: 0 0 26px; border-bottom: 1px solid var(--slate-200); }
.user-message p { margin: 5px 0 0; font-size: 15px; line-height: 1.75; }
.progress-block { margin: 22px 0 10px 52px; padding: 16px 18px 15px; border-left: 3px solid var(--blue-600); background: #f5f8fc; }
.progress-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.progress-heading p { margin: 3px 0 0; color: var(--slate-500); font-size: 11px; }
.route-badge { padding: 2px 7px; border: 1px solid #cad9ec; color: var(--blue-600); font-size: 9px; font-weight: 720; }
.progress-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 0; margin: 13px 0 0; list-style: none; }
.progress-steps li { position: relative; padding: 20px 8px 0 0; color: var(--slate-500); font-size: 9px; }
.progress-steps li::before { content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 9px; border: 2px solid var(--slate-300); border-radius: 50%; background: var(--paper); }
.progress-steps li::after { content: ""; position: absolute; left: 15px; right: 6px; top: 9px; height: 1px; background: var(--slate-300); }
.progress-steps li:last-child::after { display: none; }
.progress-steps li.is-active { color: var(--navy-900); font-weight: 700; }
.progress-steps li.is-active::before { border-color: var(--blue-600); background: var(--blue-600); box-shadow: inset 0 0 0 2px var(--paper); }
.progress-steps li.is-complete { color: var(--success); }
.progress-steps li.is-complete::before { border-color: var(--success); background: var(--success); }
.progress-steps li.is-complete::after { background: var(--success); }
.binding-banner { margin: 14px 0 0 52px; padding: 11px 13px; display: flex; gap: 10px; align-items: baseline; border: 1px solid #e4cc9f; background: var(--warning-soft); color: #674713; font-size: 11px; }
.binding-banner.is-failed { border-color: #e4b0ad; background: var(--danger-soft); color: var(--danger); }

.assistant-message { margin-top: 26px; }
.answer-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 13px; border-bottom: 1px solid var(--slate-200); }
.answer-heading h2 { margin: 4px 0 0; color: var(--navy-950); font-family: Georgia, "Songti SC", serif; font-size: 23px; }
.answer-badges { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.answer-status, .evidence-support { padding: 3px 8px; border: 1px solid #bdd7cb; background: var(--success-soft); color: var(--success); font-size: 9px; font-weight: 700; }
.evidence-support { border-color: #c8d8eb; background: var(--blue-100); color: var(--blue-600); }
.answer-copy { margin-top: 18px; color: #243149; font-size: 14px; line-height: 1.88; }
.answer-copy p { margin: 0 0 15px; }
.answer-footer { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--slate-200); color: var(--slate-500); font-size: 9px; }
.answer-footer button { padding: 0; border: 0; background: transparent; color: var(--blue-600); font-size: 11px; font-weight: 650; }
.answer-footer button:hover { color: var(--navy-900); text-decoration: underline; }
.failure-region { margin: 22px 0 0 52px; padding: 18px; border-left: 3px solid var(--danger); background: var(--danger-soft); }
.failure-region h2 { margin: 0; color: var(--danger); font-size: 16px; }
.failure-region p { color: #6d403d; }
.failure-actions { display: flex; gap: 8px; }

.research-composer { position: sticky; z-index: 4; bottom: 0; width: min(900px, calc(100% - 64px)); align-self: center; padding: 12px 0 22px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 24px); }
.composer-context { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; padding: 9px 12px; border-left: 3px solid var(--gold-600); background: var(--gold-100); color: var(--navy-800); }
.composer-context > div { display: flex; align-items: baseline; gap: 8px; flex: none; }
.context-label { color: var(--gold-600); font-size: 9px; font-weight: 760; letter-spacing: .08em; }
.composer-context strong { font-size: 11px; }
.composer-context > span { color: var(--slate-700); font-size: 10px; }
.composer-box { padding: 9px 10px 8px; border: 1px solid var(--slate-300); border-top: 2px solid var(--navy-900); background: var(--paper); box-shadow: 0 14px 34px rgba(7,26,54,.11); }
.composer-box:focus-within { border-color: var(--blue-600); }
.composer-box textarea { min-height: 72px; padding: 8px 7px; border: 0; outline: 0; font-size: 13px; }
.composer-actions { display: flex; align-items: center; gap: 9px; padding-top: 7px; border-top: 1px solid var(--slate-100); }
.composer-mode-copy { display: flex; align-items: center; gap: 8px; color: var(--slate-500); font-size: 9px; }
.composer-mode-copy > span { width: 6px; height: 6px; }
.composer-actions .form-status { flex: 1; margin-left: 4px; font-size: 10px; text-align: right; }
.composer-actions .primary-button, .composer-actions .danger-button { min-height: 34px; padding: 5px 17px; font-size: 11px; }

.evidence-rail { position: fixed; z-index: 20; top: 0; right: 0; width: min(390px, 90vw); height: 100vh; overflow: auto; padding: 24px 22px 34px; border-left: 1px solid var(--slate-200); background: #f8f9fb; box-shadow: var(--shadow-lg); transform: translateX(102%); visibility: hidden; transition: transform 180ms ease, visibility 180ms step-end; }
.evidence-rail.is-open { transform: translateX(0); visibility: visible; transition: transform 180ms ease, visibility 0ms; }
.evidence-rail-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--slate-200); }
.evidence-rail-header span { color: var(--gold-600); font-size: 9px; font-weight: 760; letter-spacing: .15em; }
.evidence-rail-header h2 { margin: 2px 0 0; color: var(--navy-950); font-family: Georgia, "Songti SC", serif; font-size: 23px; }
.evidence-rail-header button { width: 32px; height: 32px; border: 1px solid var(--slate-300); background: var(--paper); color: var(--slate-700); font-size: 20px; line-height: 1; }
.evidence-rail section { padding: 20px 0; border-bottom: 1px solid var(--slate-200); }
.evidence-rail h3 { margin: 0; color: var(--navy-900); font-size: 13px; }
.identity-list { margin: 13px 0 0; display: grid; gap: 10px; }
.identity-list div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 9px; }
.identity-list dt { color: var(--slate-500); font-size: 10px; }
.identity-list dd { margin: 0; overflow-wrap: anywhere; color: var(--slate-700); font-size: 10px; }
.identity-list .technical-row dd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.rail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rail-heading > span { min-width: 22px; padding: 1px 6px; background: var(--blue-100); color: var(--blue-600); text-align: center; font-size: 9px; }
.citation-list { display: grid; gap: 0; margin-top: 10px; }
.citation-button { width: 100%; padding: 11px 3px; border: 0; border-bottom: 1px solid var(--slate-200); background: transparent; color: var(--navy-800); text-align: left; overflow-wrap: anywhere; font-size: 10px; line-height: 1.45; }
.citation-button::before { content: "资料"; margin-right: 7px; padding: 1px 4px; border: 1px solid #cbd9ea; color: var(--blue-600); font-size: 8px; }
.citation-button:hover { color: var(--blue-600); }
.limitation-list { display: grid; gap: 10px; margin: 11px 0 0; padding-left: 21px; color: var(--slate-700); font-size: 10px; }
.limitation-list li::marker { color: var(--gold-600); font-weight: 800; }
.rail-empty { color: var(--slate-500); font-size: 10px; }
.citation-detail button { border: 0; background: transparent; color: var(--slate-500); }
.citation-detail strong { display: block; margin-top: 14px; color: var(--navy-900); }
.citation-detail p { color: var(--slate-500); font-size: 10px; }
.citation-detail a { color: var(--blue-600); font-size: 11px; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 218px minmax(520px, 1fr); }
  .research-mode { display: none; }
  .turn-view, .research-composer { width: min(820px, calc(100% - 42px)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .session-rail { min-height: auto; padding: 13px 15px; border-right: 0; border-bottom: 1px solid var(--slate-200); }
  .rail-brand { margin-bottom: 10px; }
  .map-return { display: inline-flex; width: auto; margin-right: 8px; }
  .session-rail > .primary-button { width: auto; margin: 0 0 12px; }
  .rail-section-title, .conversation-list, .access-summary { display: none; }
  .workspace-header { min-height: 78px; padding: 14px 16px; }
  .workspace-title { padding-left: 11px; }
  .workspace-header h1 { font-size: 18px; }
  .workspace-header p { display: none; }
  .evidence-toggle { padding: 0 9px; }
  .empty-state, .turn-view, .message-history, .research-composer { width: calc(100% - 30px); }
  .empty-state { padding: 48px 0 28px; }
  .empty-state h2 { font-size: 26px; }
  .question-starters { grid-template-columns: 1fr; }
  .chat-message { grid-template-columns: 31px minmax(0, 1fr); gap: 10px; }
  .message-avatar { width: 30px; height: 30px; }
  .progress-block, .binding-banner, .failure-region { margin-left: 41px; }
  .progress-steps { grid-template-columns: 1fr; gap: 4px; }
  .progress-steps li { padding: 2px 0 2px 22px; }
  .progress-steps li::before { top: 4px; }
  .progress-steps li::after { left: 5px; right: auto; top: 16px; width: 1px; height: 14px; }
  .answer-heading { display: grid; }
  .answer-badges { justify-content: flex-start; }
  .composer-context { align-items: start; flex-direction: column; gap: 2px; }
  .composer-actions { flex-wrap: wrap; }
  .composer-mode-copy { width: 100%; }
  .composer-actions .form-status { order: 2; flex-basis: 100%; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
