/* Linshanshan — bold first impressions, quiet reading surfaces. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --sidebar: #f5f5f7;
  --ink: #1d1d1f;
  --text: #424245;
  --muted: #76767b;
  --line: #e8e8ed;
  --accent: #0071e3;
  --accent-soft: #eef5fe;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; transition: background .18s, color .18s, box-shadow .18s, transform .18s; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; outline-offset: 4px; }
:focus-visible { outline: 3px solid #0071e355; }
svg { display: block; flex-shrink: 0; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 20px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: white; }
.skip-link:focus { top: 10px; }
* { scrollbar-width: thin; scrollbar-color: #d5d5d9 transparent; }

/* Navigation stays secondary to the work. */
.app-shell { display: grid; grid-template-columns: 240px minmax(0,1fr); height: 100dvh; min-height: 440px; }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 32px 16px 20px; background: var(--sidebar); border-right: 1px solid #00000006; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px 33px; }
.brand-mark { width: 35px; height: 35px; border-radius: 11px; background: #242426; color: white; box-shadow: inset 0 1px 1px #ffffff26, 0 2px 5px #0000000a; }
.brand-mark svg { width: 22px; height: 22px; stroke-width: 1.4; }
.brand strong { display: flex; align-items: baseline; gap: 8px; font-size: 19px; font-weight: 650; letter-spacing: -.5px; line-height: 1.4; }
.brand-en { color: #86868b; font-size: 9px; font-weight: 500; letter-spacing: -.15px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: .4px; }
.new-chat { display: flex; align-items: center; gap: 9px; width: 100%; padding: 12px 14px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px #00000008, 0 0 0 1px #00000004; font-size: 13px; font-weight: 550; }
.new-chat:hover { background: #fcfcfd; box-shadow: 0 3px 12px #0000000d, 0 0 0 1px #00000009; }
.new-chat svg { width: 17px; height: 17px; }
.key-hint { margin-left: auto; color: #99999f; font-size: 10px; font-weight: 400; }
.main-nav { display: grid; gap: 4px; margin-top: 23px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 9px; color: #636366; font-size: 13px; text-align: left; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: #eaeaee; }
.nav-item.active { background: #e6e6eb; color: #1d1d1f; font-weight: 550; }
.nav-dot { width: 4px; height: 4px; margin-left: auto; border-radius: 50%; background: #808087; }
.nav-item:not(.active) .nav-dot { display: none; }
.nav-count { margin-left: auto; color: #8e8e93; font-size: 11px; font-weight: 400; font-variant-numeric: tabular-nums; }
.history-heading { display: flex; align-items: center; justify-content: space-between; padding: 32px 14px 9px; color: #86868b; font-size: 11px; font-weight: 500; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 7px; border-radius: 50%; color: #86868b; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: #ededf0; color: var(--ink); }
.history-heading .icon-button { width: 26px; height: 26px; }
.history-heading svg { width: 14px; height: 14px; }
.history-list { flex: 1; min-height: 60px; overflow: auto; }
.history-empty { padding: 10px 14px; color: #929298; font-size: 12px; line-height: 1.9; }
.history-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 14px; border-radius: 8px; color: #717176; font-size: 12px; text-align: left; }
.history-item:hover, .history-item.active { background: #eaeaee; color: #303033; }
.history-item svg { width: 14px; height: 14px; color: #98989e; }
.history-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-day { padding: 10px 14px 3px; color: #8e8e93; font-size: 10px; }
.sidebar-bottom { padding-top: 22px; }
.edition-card { display: flex; align-items: center; gap: 11px; margin: 0 10px; padding: 18px 2px; border-top: 1px solid #e1e1e6; }
.edition-card > span:first-child { color: #86868b; }
.edition-card strong { display: block; font-size: 11px; font-weight: 500; color: #59595e; }
.edition-card small { display: block; margin-top: 2px; font-size: 10px; color: #98989e; }
.edition-dot { display: none; }
.help-button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 13px 18px; color: #78787d; font-size: 11px; }
.help-button:hover { color: var(--ink); }
.help-button svg { width: 15px; height: 15px; }
.help-button span:last-child { margin-left: auto; }
.local-note { display: flex; align-items: center; justify-content: center; gap: 5px; color: #929298; font-size: 9px; }
.local-note svg { width: 10px; height: 10px; }

/* A light, translucent toolbar frames an uninterrupted canvas. */
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; outline: none; }
.topbar { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 16px; height: 72px; padding: 0 36px; background: #ffffffdf; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 13px; min-width: 0; }
.breadcrumb { color: #9b9ba0; font-size: 12px; white-space: nowrap; }
.breadcrumb-divider { color: #d2d2d7; font-size: 12px; }
.topbar h1 { margin: 0; max-width: 35vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 500; }
.service-status { display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 20px; color: #86868b; font-size: 10px; white-space: nowrap; }
.service-status:hover { background: var(--sidebar); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #be9850; }
.service-status.ready .status-dot { background: #76a685; }
.service-status.offline .status-dot { background: #ce8368; }
.avatar { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #f1f1f3; color: #9a9aa0; font-size: 11px; }
.mobile-menu { display: none; }
.view { flex: 1; min-height: 0; }
.chat-view { display: flex; flex-direction: column; }
.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; scrollbar-gutter: stable; }

/* The home composer sits at the focal point, not at the bottom edge. */
.is-welcome .chat-scroll { display: flex; }
.welcome { width: min(704px,calc(100% - 96px)); margin: auto; padding: 38px 0 48px; animation: appear .4s ease both; }
.welcome-header { text-align: center; }
.hero-emblem { position: relative; display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; margin: 0 auto 22px; border: 1px solid #dedee3; border-radius: 21px; background: linear-gradient(145deg,#fff 8%,#fbfbfc 35%,#e8e8ed 100%); box-shadow: inset 0 1px 1px white,inset 0 -2px 3px #00000003,0 8px 20px #00000006,0 2px 3px #00000004; }
.hero-emblem:after { content: ''; position: absolute; inset: 3px; border-radius: 17px; border: 1px solid #ffffffa8; pointer-events: none; }
.hero-emblem svg { width: 32px; height: 32px; stroke-width: 1.2; color: #515158; filter: drop-shadow(0 1px 0 white); }
.welcome-kicker { color: #717177; font-size: 12px; font-weight: 500; letter-spacing: .6px; }
.welcome h2 { margin: 18px 0 20px; color: #1d1d1f; font-size: clamp(38px,4vw,54px); font-weight: 650; line-height: 1.32; letter-spacing: -2px; }
.welcome h2 > span { color: #86868b; }
.welcome-description { margin: 0; color: #78787e; font-size: 14px; line-height: 1.85; letter-spacing: .1px; }
.mobile-break { display: none; }
#welcome-input { margin: 33px 0 27px; }
.welcome-suggestions { padding: 0 2px; }
.suggestion-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; color: #86868b; font-size: 11px; }
.text-button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; color: #86868b; font-size: 11px; }
.text-button svg { width: 12px; height: 12px; }
.text-button:hover { color: var(--ink); }
.suggestions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.suggestion-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 13px; min-height: 100px; padding: 17px 16px; border-radius: 13px; background: #f7f7f9; text-align: left; }
.suggestion-card:hover { background: #f0f0f3; transform: translateY(-2px); }
.suggestion-card:active { transform: translateY(0); }
.suggestion-top { display: flex; align-items: center; gap: 6px; color: #8c8c92; font-size: 10px; }
.suggestion-top svg { width: 15px; height: 15px; stroke-width: 1.5; }
.suggestion-question { padding-right: 6px; color: #515155; font-size: 12px; line-height: 1.7; font-weight: 450; }
.suggestion-arrow { position: absolute; top: 18px; right: 14px; color: #b8b8be; }
.suggestion-arrow svg { width: 11px; height: 11px; }
.browse-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 24px auto 0; padding: 5px; color: var(--accent); font-size: 12px; }
.browse-link svg { width: 13px; height: 13px; }
.browse-link:hover { text-decoration: underline; }
.welcome-trust { display: flex; align-items: center; justify-content: center; margin-top: 21px; color: #96969c; font-size: 10px; }
.welcome-trust > span { display: flex; align-items: center; gap: 5px; }
.welcome-trust svg { width: 12px; height: 12px; }

/* One input component, re-used in the welcome and conversation layouts. */
.composer-area { flex-shrink: 0; padding: 16px 48px 23px; background: linear-gradient(#ffffff00,#fff 18%); }
.composer { max-width: 760px; margin: auto; padding: 19px 20px 14px; border: 1px solid #e0e0e6; border-radius: 20px; background: #fff; box-shadow: 0 8px 28px #00000005,0 2px 5px #00000003; transition: border-color .2s,box-shadow .2s; }
.composer:focus-within { border-color: #adadba; box-shadow: 0 8px 32px #00000008,0 0 0 3px #00000002; }
.composer textarea { display: block; width: 100%; min-height: 48px; max-height: 144px; padding: 0; resize: none; outline: 0; border: 0; background: none; color: var(--ink); font-size: 15px; line-height: 1.8; }
.composer textarea::placeholder { color: #a2a2a8; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.verify-control { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; color: #75757b; font-size: 10px; cursor: pointer; }
.verify-control:hover { background: #f5f5f7; }
.verify-control svg { width: 13px; height: 13px; }
.verify-control input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.verify-control:has(input:focus-visible) { outline: 3px solid #0071e355; outline-offset: 3px; }
.switch-track { position: relative; width: 23px; height: 13px; margin-left: 2px; border-radius: 20px; background: #d2d2d7; }
.switch-track:after { content: ''; position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #00000018; transition: transform .2s; }
.verify-control input:checked ~ .switch-track { background: #444449; }
.verify-control input:checked ~ .switch-track:after { transform: translateX(10px); }
.composer-actions { display: flex; align-items: center; gap: 13px; }
.keyboard-hint { color: #a4a4aa; font-size: 10px; }
.send-button { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #242426; color: #fff; }
.send-button svg { width: 19px; height: 19px; stroke-width: 1.8; }
.send-button:hover:not(:disabled) { background: #404044; transform: scale(1.04); }
.send-button:disabled { background: #e9e9ee; color: #b5b5bc; opacity: 1; }
.send-button.stopping { background: #606068; }
.input-count { color: #929299; font-size: 10px; }
.composer-hint { margin: 12px 0 0; text-align: center; color: #9c9ca2; font-size: 10px; }
.welcome .composer-area { padding: 0; background: none; }
.welcome .composer { max-width: none; }
.welcome .composer-hint { display: none; }

/* Conversation typesetting and quiet, expandable provenance. */
.conversation { max-width: 760px; width: calc(100% - 96px); margin: 32px auto 20px; }
.turn { margin-bottom: 42px; animation: appear .25s ease; }
.question-row { display: flex; justify-content: flex-end; margin-bottom: 28px; }
.question-bubble { max-width: 85%; padding: 12px 19px; border-radius: 20px 20px 5px 20px; background: #f2f2f5; color: #3a3a3e; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; font-size: 13px; font-weight: 600; }
.assistant-mark { display: flex; align-items: center; justify-content: center; width: 27px; height: 27px; border-radius: 9px; background: #262628; color: white; }
.assistant-mark svg { width: 16px; height: 16px; }
.answer-label { margin-left: 3px; font-size: 10px; color: #8e8e95; font-weight: 400; }
.answer-body { color: #424245; font-size: 15px; line-height: 1.95; overflow-wrap: anywhere; }
.answer-body p { margin: 12px 0; }
.answer-body p:first-child { margin-top: 0; }
.answer-body h3 { margin: 26px 0 10px; font-size: 17px; font-weight: 600; color: #1d1d1f; }
.answer-body h4 { margin: 22px 0 10px; font-size: 15px; color: #1d1d1f; }
.answer-body ul, .answer-body ol { padding-left: 24px; margin: 12px 0; }
.answer-body li { margin: 8px 0; }
.answer-body strong { font-weight: 600; color: #262629; }
.answer-body blockquote { margin: 18px 0; padding: 10px 18px; border-left: 3px solid #d6d6dc; background: #f7f7f9; color: #65656b; }
.answer-body code { padding: 2px 5px; border-radius: 4px; background: #f2f2f5; font-size: .9em; }
.answer-body pre { padding: 15px; border-radius: 12px; background: #f5f5f7; white-space: pre-wrap; }
.answer-body hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.table-wrap { overflow: auto; }
.answer-body table { width: 100%; margin: 16px 0; border-collapse: collapse; font-size: 13px; }
.answer-body th, .answer-body td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.answer-body th { background: #f5f5f7; }
.citation { display: inline-flex; padding: 0 4px; margin: 0 2px; border-radius: 4px; background: #edf3fd; color: #0071e3; vertical-align: super; font-size: 9px; font-weight: 550; line-height: 1.7; }
.citation:hover { background: #daeafa; }
.pipeline { margin-bottom: 20px; border-radius: 10px; background: #f7f7f9; color: #7b7b82; font-size: 11px; }
.pipeline summary { display: flex; align-items: center; gap: 8px; padding: 11px 13px; cursor: pointer; list-style: none; }
.pipeline summary::-webkit-details-marker { display: none; }
.pipeline summary:after { content: '⌄'; margin-left: auto; color: #9b9ba1; }
.pipeline[open] summary:after { content: '⌃'; }
.pipeline svg { width: 13px; height: 13px; }
.pipeline-running { width: 6px; height: 6px; border-radius: 50%; background: #7c91ad; animation: pulse 1.4s infinite; }
.pipeline-time { margin-left: 5px; color: #98989e; font-size: 10px; font-variant-numeric: tabular-nums; }
.pipeline-steps { display: grid; gap: 7px; margin: 0 13px; padding: 11px 0 13px; border-top: 1px solid var(--line); }
.pipeline-step { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; }
.pipeline-step small { margin-left: auto; font-size: 10px; white-space: nowrap; }
.step-check { color: #7d8f83; }
.source-strip { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.source-strip-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; color: #86868b; font-size: 11px; }
.source-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.source-card { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border-radius: 11px; background: #f5f5f7; text-align: left; }
.source-card:hover { background: #ededf1; }
.source-number { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; background: #e7e7ed; color: #777780; font-size: 10px; }
.source-info { min-width: 0; }
.source-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 500; color: #55555b; }
.source-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; font-size: 10px; color: #96969c; }
.source-card > svg { align-self: center; width: 12px; height: 12px; margin-left: auto; color: #9e9ea5; }
.answer-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 14px; }
.verification { display: flex; align-items: center; gap: 5px; color: #7b8c80; font-size: 10px; }
.verification svg { width: 12px; height: 12px; }
.verification.warning { color: #a58a5a; }
.answer-actions { display: flex; gap: 3px; }
.answer-actions .icon-button { width: 29px; height: 29px; padding: 7px; }
.answer-actions svg { width: 15px; height: 15px; }
.icon-button.selected { background: #edf4fc; color: var(--accent); }
.error-box { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: #fff4ee; color: #a46d49; font-size: 12px; line-height: 1.9; }
.error-box button { margin-left: 8px; text-decoration: underline; }
.pending-hint { padding: 8px 0; color: #96969d; font-size: 13px; }
.streaming:after { content: '▍'; margin-left: 3px; color: #808089; animation: pulse 1s infinite; }
.draft-label { margin: 9px 0; font-size: 10px; color: #9d927a; }

/* Library and collection share the same spacing and material language. */
.library-view, .saved-view { padding: 46px clamp(28px,5vw,80px); overflow-y: auto; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.eyebrow { color: #86868b; font-size: 11px; font-weight: 500; letter-spacing: .3px; }
.section-heading h2 { margin: 10px 0 12px; font-size: 36px; font-weight: 600; letter-spacing: -1px; line-height: 1.4; }
.section-heading p { margin: 0; color: #86868b; font-size: 13px; }
.edition-badge { padding: 6px 12px; border-radius: 20px; background: #f5f5f7; color: #7e7e85; font-size: 11px; white-space: nowrap; }
.library-search { display: flex; align-items: center; gap: 12px; padding: 14px 17px; border: 1px solid transparent; border-radius: 13px; background: #f5f5f7; }
.library-search:focus-within { border-color: #bcc6d5; }
.library-search svg { width: 18px; height: 18px; color: #96969d; }
.library-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; color: var(--ink); }
.library-search input::placeholder { color: #99999f; }
.search-shortcut { color: #a2a2a9; font-size: 10px; }
.library-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 25px 0; }
.filter-chip { padding: 7px 13px; border-radius: 20px; color: #86868b; font-size: 12px; }
.filter-chip:hover { background: #f5f5f7; }
.filter-chip.active { background: #29292c; color: white; }
.library-summary { margin-bottom: 15px; color: #99999f; font-size: 11px; }
.document-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.document-card { display: flex; align-items: flex-start; gap: 15px; padding: 23px 21px; border: 1px solid #ededf1; border-radius: 15px; background: #fff; text-align: left; }
.document-card:hover { background: #fafafc; border-color: #d9d9e0; box-shadow: 0 5px 14px #00000004; transform: translateY(-1px); }
.document-symbol { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 35px; height: 40px; border-radius: 9px; background: #f5f5f7; color: #95959c; }
.document-symbol svg { width: 20px; height: 20px; }
.document-details { min-width: 0; }
.document-details h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; line-height: 1.8; }
.document-details p { margin: 0; color: #929299; font-size: 11px; }
.document-match { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 12px !important; color: #7c7c84 !important; font-size: 11px !important; line-height: 1.9; }
mark { background: #e5f0fd; color: #34618f; }
.missing-note { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); color: #86868b; font-size: 12px; line-height: 1.9; }
.missing-note summary { cursor: pointer; }
.missing-note ul { padding-left: 20px; }
.empty-state { grid-column: 1/-1; padding: 65px 20px; text-align: center; color: #929299; }
.empty-state > svg { width: 37px; height: 37px; margin: auto; color: #b7b7bf; stroke-width: 1.2; }
.empty-state h3 { margin: 18px 0 8px; color: #63636c; font-size: 16px; font-weight: 500; }
.empty-state p { font-size: 13px; line-height: 1.9; }
.empty-state button { margin-top: 15px; padding: 9px 19px; border-radius: 20px; background: #f1f1f5; color: #61616b; font-size: 12px; }
.saved-card { margin-bottom: 14px; padding: 23px 26px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.saved-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 550; }
.saved-card p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: #86868b; font-size: 13px; line-height: 1.9; }
.saved-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; color: #99999f; font-size: 11px; }
.saved-card-bottom > div { display: flex; gap: 17px; }
.saved-card-bottom button { color: var(--accent); font-size: 11px; }

/* Reader sheets and utility windows. */
.reader-dialog, .utility-dialog { max-height: 88dvh; padding: 0; overflow: hidden; border: 1px solid #ffffffcc; border-radius: 22px; background: #fff; color: var(--ink); box-shadow: 0 24px 90px #1c1c3024,0 2px 10px #0000000c; }
.reader-dialog::backdrop, .utility-dialog::backdrop { background: #1d1d252d; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.reader-dialog { width: min(820px,calc(100vw - 48px)); }
.reader-dialog[open] { display: flex; flex-direction: column; }
.reader-header { display: flex; flex-shrink: 0; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 27px 32px 22px; border-bottom: 1px solid var(--line); }
.reader-header h2 { margin: 7px 0 0; font-size: 19px; line-height: 1.7; font-weight: 550; }
.reader-header .icon-button, .utility-header .icon-button { flex-shrink: 0; background: #f0f0f3; width: 28px; height: 28px; }
.reader-header .icon-button svg, .utility-header .icon-button svg { width: 15px; height: 15px; }
.reader-body { flex: 1; overflow: auto; padding: 26px 32px; }
.reader-chunk { margin-bottom: 18px; padding: 22px; border: 1px solid #ebebf0; border-radius: 13px; scroll-margin-top: 16px; }
.reader-chunk.target { background: #f6f9fe; border-color: #c9dbf4; }
.reader-chunk h3 { margin: 0 0 14px; color: #7a7a82; font-size: 12px; font-weight: 500; }
.reader-chunk.target h3 { color: #547eaf; }
.reader-chunk p { margin: 0; color: #4e4e54; font-size: 14px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-note { margin: 0 0 20px; color: #8e8e96; font-size: 12px; }
.reader-footer { display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 32px; border-top: 1px solid var(--line); color: #99999f; font-size: 10px; }
.reader-footer .text-button { color: var(--accent); white-space: nowrap; }
.utility-dialog { width: min(460px,calc(100vw - 36px)); }
.utility-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 21px 25px; border-bottom: 1px solid var(--line); }
.utility-header h2 { margin: 0; font-size: 17px; font-weight: 550; }
#utility-body { max-height: 65dvh; padding: 24px 25px; overflow: auto; color: #797981; font-size: 13px; line-height: 1.9; }
.help-row { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.help-row > svg { width: 20px; height: 20px; margin-top: 4px; color: #83838c; }
.help-row h3 { margin: 0 0 5px; color: #414149; font-size: 13px; font-weight: 550; }
.help-row p { margin: 0; color: #898991; font-size: 12px; }
.dialog-input { width: 100%; padding: 11px 13px; border: 1px solid #dddde5; border-radius: 10px; background: #fafafc; color: var(--ink); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.secondary-button, .primary-button, .danger-button { padding: 8px 17px; border-radius: 9px; font-size: 12px; }
.secondary-button { background: #f0f0f4; color: #777781; }
.primary-button { background: var(--accent); color: white; }
.danger-button { background: #c85248; color: white; }
.menu-action { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px; border-radius: 10px; text-align: left; }
.menu-action:hover { background: #f5f5f7; }
.menu-action.danger { color: #c55a50; }
.menu-action svg { width: 17px; height: 17px; }
.search-result { display: block; width: 100%; padding: 12px 6px; border-bottom: 1px solid var(--line); color: #63636d; font-size: 13px; text-align: left; }
.search-result small { display: block; margin-top: 4px; color: #9898a0; font-size: 11px; }
.search-results { margin-top: 15px; }
.toast { position: fixed; z-index: 100; bottom: 28px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 30px); padding: 11px 21px; border: 1px solid #ffffff22; border-radius: 24px; background: #27272be8; backdrop-filter: blur(12px); color: #fff; font-size: 12px; text-align: center; box-shadow: 0 5px 25px #00000018; }

/* First-visit notice is a separate modal, never a dismissible toast. */
.notice-link { padding-top: 2px; }
.notice-dialog { width: min(650px,calc(100vw - 36px)); max-height: min(820px,90dvh); padding: 0; overflow: hidden; border: 1px solid #ffffffcc; border-radius: 23px; color: var(--ink); background: #fff; box-shadow: 0 24px 90px #1c1c3033; }
.notice-dialog[open] { display: flex; flex-direction: column; }
.notice-dialog::backdrop { background: #1d1d2538; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.notice-header { display: flex; flex-shrink: 0; align-items: center; gap: 15px; padding: 26px 30px 22px; border-bottom: 1px solid var(--line); }
.notice-header .eyebrow { margin: 0 0 5px; }
.notice-header h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.5px; outline: none; }
.notice-header .icon-button { margin-left: auto; flex-shrink: 0; }
.notice-symbol { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; background: #f3f3f6; color: #64646e; }
.notice-symbol svg { width: 23px; height: 23px; stroke-width: 1.5; }
.notice-body { min-height: 0; padding: 22px 30px 8px; overflow-y: auto; overscroll-behavior: contain; font-size: 13px; color: #73737c; line-height: 1.85; }
.notice-body > p:first-child { margin-top: 0; }
.notice-highlight { padding: 15px 17px; border: 1px solid #dce7f5; border-radius: 12px; background: #f5f8fd; color: #58677c; }
.notice-highlight strong { display: block; color: #2e4564; margin-bottom: 5px; font-weight: 600; }
.notice-body section { margin: 23px 0; }
.notice-body h3 { display: flex; align-items: baseline; gap: 9px; margin: 0 0 8px; color: #35353b; font-size: 14px; font-weight: 550; }
.notice-body h3 span { color: #a3a3aa; font-size: 11px; font-variant-numeric: tabular-nums; }
.notice-body section p { margin: 0; }
.notice-body section strong { color: #484851; font-weight: 550; }
.notice-version { padding-top: 12px; border-top: 1px solid var(--line); color: #96969e; font-size: 10px; }
.notice-footer { flex-shrink: 0; padding: 20px 30px 24px; border-top: 1px solid var(--line); background: #fff; }
.notice-acknowledgement { display: flex; align-items: flex-start; gap: 10px; color: #4d4d56; font-size: 12px; line-height: 1.8; cursor: pointer; }
.notice-acknowledgement input { flex-shrink: 0; width: 17px; height: 17px; margin: 3px 0 0; accent-color: #343439; cursor: pointer; }
.notice-storage { margin: 10px 0 17px; color: #9898a0; font-size: 10px; line-height: 1.7; }
.notice-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.notice-actions button { min-height: 40px; padding: 9px 19px; border-radius: 10px; font-size: 12px; }
.notice-actions .primary-button { background: #29292d; }
.notice-actions .primary-button:disabled { opacity: 1; background: #e9e9ed; color: #a0a0a8; }
.notice-paused { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100dvh; padding: 32px; text-align: center; }
.notice-paused .hero-emblem { margin-bottom: 24px; }
.notice-paused h1 { margin: 0; font-size: 28px; font-weight: 600; outline: none; }
.notice-paused p { margin: 15px 0 25px; color: #85858d; font-size: 14px; line-height: 1.9; }
.notice-paused button { padding: 11px 20px; }
.noscript-message { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 25px; background: white; color: #73737c; }
@media (max-width:600px) {
  .notice-dialog { width: calc(100vw - 24px); max-height: 92dvh; border-radius: 19px; }
  .notice-header { padding: 21px 20px 18px; gap: 11px; }
  .notice-header h2 { font-size: 19px; }
  .notice-symbol { width: 36px; height: 36px; border-radius: 11px; }
  .notice-symbol svg { width: 20px; height: 20px; }
  .notice-body { padding: 19px 20px 6px; }
  .notice-footer { padding: 17px 20px 20px; }
  .notice-acknowledgement { font-size: 11px; }
  .notice-storage { font-size: 10px; }
  .notice-actions button { flex: 1; min-height: 42px; padding: 9px 12px; }
}
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* Compact windows retain comfortable reading and touch targets. */
@media (min-width:1600px) {
  .app-shell { grid-template-columns: 260px minmax(0,1fr); }
  .sidebar { padding-left: 22px; padding-right: 22px; }
  .welcome { width: min(760px,calc(100% - 120px)); }
  .welcome h2 { font-size: 60px; }
  .welcome-description { font-size: 16px; }
  .hero-emblem { width: 72px; height: 72px; border-radius: 23px; }
  .suggestion-card { min-height: 108px; padding: 18px; }
  .suggestion-question { font-size: 13px; }
  .conversation, .composer { max-width: 820px; }
  .library-view, .saved-view { padding-left: max(64px,calc((100% - 1080px)/2)); padding-right: max(64px,calc((100% - 1080px)/2)); }
}
@media (max-width:1100px) {
  .app-shell { grid-template-columns: 216px minmax(0,1fr); }
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .brand { padding-left: 10px; gap: 9px; }
  .brand-en { display: none; }
  .topbar { height: 64px; padding: 0 26px; }
  .welcome { width: calc(100% - 64px); padding-top: 32px; }
  .welcome h2 { font-size: 43px; }
  .welcome-description { font-size: 12px; }
  .hero-emblem { width: 57px; height: 57px; border-radius: 18px; margin-bottom: 18px; }
  .hero-emblem:after { border-radius: 15px; }
  .hero-emblem svg { width: 29px; height: 29px; }
  .suggestion-card { padding: 14px 12px; min-height: 105px; gap: 10px; }
  .suggestion-question { font-size: 11px; }
  .suggestion-arrow { display: none; }
  .conversation { width: calc(100% - 64px); }
  .composer-area { padding-left: 32px; padding-right: 32px; }
  .document-grid { grid-template-columns: 1fr; }
  .library-view, .saved-view { padding: 34px; }
}
@media (max-width:760px) {
  .app-shell { display: block; min-height: 0; }
  .workspace { height: 100dvh; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 266px; padding: 30px 16px 23px; transform: translateX(-100%); transition: transform .24s ease; box-shadow: 8px 0 35px #0000000a; background: #f5f5f7f5; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: #1b1b2430; backdrop-filter: blur(3px); }
  .brand-en { display: inline; }
  .mobile-menu { display: flex; }
  .topbar { height: 62px; padding: 0 20px; }
  .topbar-left { gap: 10px; }
  .topbar-right { gap: 7px; }
  .breadcrumb, .breadcrumb-divider, .avatar { display: none; }
  .topbar h1 { max-width: 46vw; font-size: 13px; }
  .service-status { font-size: 10px; padding: 5px; }
  .welcome { width: min(560px,calc(100% - 40px)); padding: 32px 0 38px; }
  .welcome h2 { margin: 16px 0 19px; font-size: 42px; letter-spacing: -1.5px; }
  .welcome-description { font-size: 13px; }
  .welcome-kicker { font-size: 11px; }
  .hero-emblem { width: 59px; height: 59px; border-radius: 19px; margin-bottom: 19px; }
  .hero-emblem:after { border-radius: 16px; }
  .hero-emblem svg { width: 29px; height: 29px; }
  #welcome-input { margin: 29px 0 23px; }
  .suggestions { grid-template-columns: 1fr; gap: 7px; }
  .suggestion-card { flex-direction: row; align-items: center; gap: 14px; min-height: 0; padding: 14px 15px; border-radius: 11px; }
  .suggestion-top { flex-shrink: 0; font-size: 10px; }
  .suggestion-question { padding: 0; font-size: 12px; }
  .suggestion-arrow { display: flex; position: static; margin-left: auto; }
  .suggestion-heading { font-size: 11px; }
  .browse-link { margin-top: 20px; font-size: 12px; }
  .welcome-trust { margin-top: 18px; font-size: 10px; }
  .composer-area { padding: 11px 17px max(15px,env(safe-area-inset-bottom)); }
  .composer { padding: 16px 16px 12px; border-radius: 18px; }
  .composer textarea { min-height: 45px; font-size: 16px; line-height: 1.7; }
  .composer-toolbar { margin-top: 9px; }
  .keyboard-hint { display: none; }
  .verify-control { padding-left: 3px; font-size: 10px; }
  .composer-hint { font-size: 9px; margin-top: 10px; }
  .conversation { width: calc(100% - 40px); margin-top: 25px; }
  .question-bubble { font-size: 13px; max-width: 92%; padding: 11px 17px; }
  .answer-body { font-size: 14px; }
  .source-list { grid-template-columns: 1fr; }
  .answer-footer { align-items: flex-start; }
  .verification { max-width: 73%; font-size: 10px; }
  .library-view, .saved-view { padding: 32px 22px; }
  .section-heading h2 { font-size: 29px; }
  .section-heading p { font-size: 12px; }
  .edition-badge { display: none; }
  .library-search { padding: 13px; }
  .library-search input { font-size: 16px; }
  .search-shortcut { display: none; }
  .library-filters { gap: 4px; margin: 20px 0; }
  .filter-chip { padding: 6px 10px; font-size: 11px; }
  .document-card { padding: 20px 17px; }
  .reader-dialog { width: calc(100vw - 22px); max-height: 92dvh; border-radius: 19px; }
  .reader-header { padding: 21px; }
  .reader-header h2 { font-size: 16px; }
  .reader-body { padding: 21px 16px; }
  .reader-chunk { padding: 17px; }
  .reader-chunk p { font-size: 13px; }
  .reader-footer { padding: 15px 19px; }
  .reader-footer > span { font-size: 9px; }
  .reader-footer .text-button { font-size: 10px; }
  .utility-dialog { max-height: 90dvh; }
  .dialog-input { font-size: 16px; }
  .toast { bottom: 24px; }
}
@media (max-width:430px) {
  .welcome { width: calc(100% - 36px); padding: 26px 0 32px; }
  .welcome h2 { font-size: 36px; letter-spacing: -1px; }
  .mobile-break { display: block; }
  .welcome-description { line-height: 1.8; }
  .suggestion-card { gap: 10px; padding: 13px 12px; }
  .suggestion-top { font-size: 9px; gap: 5px; }
  .suggestion-question { font-size: 11px; }
  .suggestion-top svg { width: 14px; height: 14px; }
  .hero-emblem { width: 54px; height: 54px; border-radius: 17px; }
  .hero-emblem:after { border-radius: 14px; }
}
@media (max-height:800px) and (min-width:761px) {
  .welcome { padding-top: 20px; padding-bottom: 28px; }
  .hero-emblem { width: 48px; height: 48px; border-radius: 16px; margin-bottom: 15px; }
  .hero-emblem:after { border-radius: 13px; }
  .hero-emblem svg { width: 26px; height: 26px; }
  .welcome h2 { font-size: 42px; margin: 12px 0 13px; }
  #welcome-input { margin: 24px 0 20px; }
  .suggestion-card { min-height: 86px; padding-top: 13px; padding-bottom: 13px; gap: 9px; }
  .browse-link { margin-top: 17px; }
  .welcome-trust { margin-top: 15px; }
}
@media (prefers-reduced-motion:reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
