:root {
  color-scheme: light;
  --ink: #20252a; --muted: #687078; --line: #d8dcdf; --paper: #f3f5f4; --surface: #fff;
  --forest: #184d40; --forest-dark: #0e392f; --gold: #c38a2e; --rust: #a64b35; --blue: #315f78;
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin-top: 0; }
.topbar { height: 76px; padding: 0 clamp(18px, 4vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: white; background: #17342e; border-bottom: 4px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #d6b36f; color: #f4d897; font: 700 20px Georgia, serif; }
.brand p { margin: 0 0 1px; color: #b9cbc5; font-size: 11px; }
.brand h1 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: 0; }
.status { display: flex; align-items: center; gap: 8px; color: #d7e1dd; font-size: 12px; white-space: nowrap; }
.status b { font-weight: 500; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #a88442; }
.status.online span { background: #69b693; }
.topbar-actions, .user-controls { display: flex; align-items: center; gap: 14px; }
.user-controls { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.2); color: #d7e1dd; font-size: 12px; }
.user-controls button { padding: 5px 8px; border: 1px solid rgba(255,255,255,.35); color: white; background: transparent; border-radius: 4px; }
.login-shell { min-height: calc(100vh - 76px); display: grid; place-items: center; padding: 24px; background: #e9edeb; }
.login-form { width: min(380px, 100%); padding: 30px; background: white; border: 1px solid var(--line); border-top: 4px solid var(--gold); }
.login-kicker { margin-bottom: 6px; color: var(--rust); font-size: 12px; font-weight: 700; }
.login-form h2 { margin-bottom: 24px; font-size: 23px; }
.login-form label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 12px; font-weight: 650; }
.login-form input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #adb6b2; border-radius: 4px; }
.login-form input:focus { outline: 3px solid rgba(24, 77, 64, .15); border-color: var(--forest); }
.login-form > button { width: 100%; min-height: 42px; margin-top: 20px; border: 0; border-radius: 4px; color: white; background: var(--forest); font-weight: 650; }
.login-form > button:disabled { cursor: wait; opacity: .6; }
.login-error { margin: 14px 0 0; padding: 9px 10px; color: #793728; background: #fff0ec; font-size: 12px; }
.app-shell { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.scope-panel { padding: 30px 22px; background: #e9edeb; border-right: 1px solid var(--line); }
.scope-title p { margin-bottom: 5px; color: var(--rust); font-size: 11px; font-weight: 700; }
.scope-title h2 { margin-bottom: 22px; font-size: 18px; letter-spacing: 0; }
.module-list { display: grid; gap: 9px; }
.module-control { min-height: 56px; padding: 9px 11px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid #cdd3d0; border-radius: 5px; }
.module-control input { width: 18px; height: 18px; accent-color: var(--forest); flex: 0 0 auto; }
.module-control span { font-size: 14px; font-weight: 650; }
.module-control small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.scope-readout { margin-top: 20px; padding-top: 17px; border-top: 1px solid #cbd2cf; }
.scope-readout span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.scope-readout strong { font-size: 13px; }
.scope-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.test-questions { margin-top: 24px; font-size: 12px; }
.test-questions summary { color: var(--forest-dark); font-weight: 650; cursor: pointer; }
#sample-queries { display: grid; gap: 6px; margin-top: 9px; }
#sample-queries button { padding: 7px 0; border: 0; color: #44524e; background: transparent; text-align: left; line-height: 1.4; }
#sample-queries button:hover { color: var(--rust); }
.chat-panel { min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.messages { width: min(860px, 100%); flex: 1; margin: 0 auto; padding: 42px 28px 24px; }
.welcome { max-width: 610px; padding: 22px 0 36px; border-bottom: 1px solid var(--line); }
.welcome-kicker { margin-bottom: 8px; color: var(--rust); font-size: 12px; font-weight: 700; }
.welcome h2 { margin-bottom: 10px; font-size: 26px; letter-spacing: 0; }
.welcome > p:last-child { color: var(--muted); line-height: 1.65; }
.message { margin-top: 28px; }
.user-message { width: min(620px, 88%); margin-left: auto; padding: 13px 16px; color: white; background: var(--forest); border-radius: 6px 6px 1px 6px; }
.user-message small { display: block; margin-bottom: 4px; color: #bcd1ca; font-size: 10px; }
.user-message p { margin: 0; line-height: 1.55; white-space: pre-wrap; }
.assistant-message { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.answer-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 11px; color: var(--muted); font-size: 11px; }
.answer-type { padding: 3px 7px; color: white; background: var(--blue); border-radius: 3px; font-weight: 650; }
.retrieval-notice { margin: 0 0 12px; padding: 9px 11px; color: #6d352b; background: #fff7e8; border-left: 3px solid var(--gold); font-size: 12px; line-height: 1.55; }
.conclusion { margin-bottom: 19px; font-size: 20px; line-height: 1.45; letter-spacing: 0; }
.answer-section { padding: 14px 0; }
.answer-section h4, .visual-section h4 { margin-bottom: 7px; font-size: 13px; }
.answer-section p { margin-bottom: 0; line-height: 1.68; white-space: pre-wrap; }
.strategy-section { padding: 14px 16px; background: #fff7e8; border-left: 4px solid var(--gold); }
.strategy-notice { color: #75541f; font-size: 12px; font-weight: 650; }
.visual-section { margin-top: 16px; }
.visual-note { margin-bottom: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.visual-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.visual-item { min-width: 0; margin: 0; border: 1px solid var(--line); background: #f8f9f8; }
.visual-item > a { display: block; overflow: hidden; background: #e7ebe9; }
.visual-item img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; }
.visual-item figcaption { padding: 9px 11px 10px; }
.visual-item figcaption strong, .visual-item figcaption span { display: block; }
.visual-item figcaption strong { font-size: 12px; line-height: 1.4; }
.visual-item figcaption span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.visual-item figcaption a { display: inline-block; margin-top: 7px; color: var(--forest-dark); font-size: 12px; font-weight: 650; text-underline-offset: 3px; }
.scope-marker { margin: 24px 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.scope-marker::before, .scope-marker::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.error-message { padding: 13px 15px; color: #793728; background: #fff0ec; border-left: 4px solid var(--rust); }
.job-status { min-height: 48px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #28443b; background: #edf4f1; border-left: 4px solid var(--forest); }
.job-status span { line-height: 1.45; }
.job-status button { flex: 0 0 auto; padding: 6px 9px; border: 1px solid #81978f; border-radius: 4px; color: var(--forest-dark); background: transparent; }
.composer { width: min(860px, calc(100% - 56px)); margin: 0 auto; padding-top: 10px; border-top: 1px solid var(--line); }
.answer-mode { width: fit-content; margin: 0 0 8px; padding: 2px; display: flex; border: 1px solid #9aa8a2; border-radius: 5px; background: #edf1ef; }
.answer-mode label { position: relative; cursor: pointer; }
.answer-mode input { position: absolute; opacity: 0; pointer-events: none; }
.answer-mode span { min-height: 30px; padding: 5px 10px; display: grid; place-items: center; border-radius: 3px; color: #50605a; font-size: 12px; font-weight: 650; }
.answer-mode input:checked + span { color: white; background: var(--forest); }
.answer-mode input:focus-visible + span { outline: 3px solid rgba(24, 77, 64, .2); }
.attachment-bar { min-height: 34px; display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.attach-button { min-height: 30px; padding: 4px 9px; border: 1px solid #81978f; border-radius: 4px; color: var(--forest-dark); background: white; font-size: 12px; font-weight: 650; }
.attach-button:hover { background: #edf4f1; }
.attach-button:disabled { cursor: wait; opacity: .55; }
.attachment-bar span { color: var(--muted); font-size: 11px; }
.attachment-previews { display: flex; gap: 8px; margin: 0 0 9px; overflow-x: auto; }
.attachment-preview { position: relative; flex: 0 0 76px; width: 76px; height: 76px; border: 1px solid var(--line); background: #eef1ef; }
.attachment-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.attachment-preview button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; color: white; background: rgba(32,37,42,.82); font-size: 18px; line-height: 22px; }
.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; }
.composer textarea { width: 100%; min-height: 64px; max-height: 180px; padding: 11px 13px; resize: vertical; border: 1px solid #adb6b2; border-radius: 5px; color: var(--ink); background: white; line-height: 1.5; }
.composer textarea:focus { outline: 3px solid rgba(24, 77, 64, .15); border-color: var(--forest); }
.composer-row > button { border: 0; border-radius: 5px; color: white; background: var(--forest); font-weight: 650; }
.composer-row > button:hover { background: var(--forest-dark); }
.composer-row > button:disabled { cursor: wait; opacity: .6; }
.user-image-strip { display: flex; gap: 7px; margin-top: 10px; overflow-x: auto; }
.user-image-strip img { width: 92px; height: 92px; flex: 0 0 92px; object-fit: cover; border: 1px solid rgba(255,255,255,.45); }
.composer-hint { width: min(860px, calc(100% - 56px)); margin: 7px auto 18px; color: var(--muted); font-size: 11px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand h1 { font-size: 18px; }
  .status { max-width: 120px; white-space: normal; text-align: right; }
  .user-controls span { display: none; }
  .login-shell { min-height: calc(100vh - 68px); }
  .app-shell { min-height: calc(100vh - 68px); grid-template-columns: 1fr; }
  .scope-panel { padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .scope-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
  .scope-title h2, .scope-title p { margin-bottom: 10px; }
  .scope-title h2 { font-size: 15px; }
  .module-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope-readout { margin-top: 11px; padding-top: 10px; }
  .scope-note { display: none; }
  .test-questions { margin-top: 12px; }
  .messages { padding: 22px 16px 18px; }
  .welcome { padding-top: 4px; }
  .welcome h2 { font-size: 22px; }
  .user-message { width: 92%; }
  .composer { width: calc(100% - 32px); }
  .composer-row { grid-template-columns: minmax(0, 1fr) 72px; }
  .composer-hint { width: calc(100% - 32px); }
  .visual-list { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .module-list { grid-template-columns: 1fr; }
  .brand p { display: none; }
  .status { font-size: 10px; }
}
