/* Workspace presentation. Source data and inference policy are independent. */
:root {
  --paper: #0d1117;
  --ink: #eef2f6;
  --muted: #a6b1c0;
  --green: #a0dec8;
  --line: #29323e;
  --surface: #141b24;
  --surface-raised: #1a2430;
  --surface-input: #101720;
  --surface-sidebar: #10161e;
  --surface-selected: #1b3832;
  --surface-viewer: #0f161e;
  --control-border: #536678;
  --on-accent: #102a22;
}

body { font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font-family: inherit; }
.page { width: min(1600px, 100%); }
.site-header { min-height: 76px; gap: 20px; padding: 0 32px; }
.brand { font-size: 20px; letter-spacing: -.6px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; font-family: inherit; font-size: 21px; }
.header-context { display: flex; align-items: center; gap: 30px; color: var(--muted); font-size: 13px; }
.header-link { color: var(--ink); text-decoration: none; }
.header-link:hover { color: var(--green); }
.workspace-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 0; align-items: start; }
.workspace-sidebar { position: sticky; top: 0; min-height: calc(100vh - 76px); padding: 34px 16px 28px; min-width: 0; border-right: 1px solid var(--line); background: var(--surface-sidebar); }
.sidebar-label { margin: 0 14px 12px; color: var(--muted); font-size: 10px; letter-spacing: .12em; font-weight: 650; text-transform: uppercase; }
.workspace-sidebar nav { display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.workspace-sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); text-decoration: none; }
.workspace-sidebar nav a:hover { color: var(--ink); background: var(--surface-raised); }
.workspace-sidebar nav a[aria-current="page"] { color: var(--green); background: var(--surface-selected); font-weight: 600; }
.nav-symbol { display: inline-flex; width: 18px; height: 20px; flex: 0 0 18px; }
.nav-symbol svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-group-label { margin-top: 30px; margin-bottom: 10px; }
.sidebar-note { display: flex; align-items: center; gap: 10px; margin: 64px 12px 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink); font-size: 11px; line-height: 1.8; }
.sidebar-note p { margin: 0; }
.sidebar-note p span { color: var(--muted); }
.sidebar-note-mark { display: grid; place-items: center; width: 30px; height: 34px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--green); font-size: 16px; }
main { width: 100%; max-width: 1220px; min-width: 0; margin: 0 auto; padding: 0 44px 32px; }
.intro { padding: 30px 0 24px; }
.eyebrow { font-size: 10px; letter-spacing: .12em; margin-bottom: 9px; }
h1, h2, .region-detail > h3, .search-result h3, .thesis-model-summary h3, .comparison-results h3, .mri-results h3 { font-family: inherit; font-weight: 600; }
h1 { font-size: clamp(26px, 3vw, 32px); line-height: 1.2; letter-spacing: -.9px; }
h2 { font-size: 22px; line-height: 1.35; letter-spacing: -.5px; }
.intro-copy { max-width: 65ch; margin: 7px 0 0; font-size: 14px; line-height: 1.75; }
[data-app-view] { margin-top: 0; margin-bottom: 0; scroll-margin-top: 24px; }
.chat-panel, .search-panel, .thesis-panel, .comparison-panel, .mri-panel { padding: 28px; border-radius: 14px; border-color: var(--line); }
.chat-panel { padding: 20px 26px; }
.chat-heading { align-items: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.chat-heading h2 { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; letter-spacing: 0; }
.conversation-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
#clear-chat { min-height: 34px; padding: 6px 10px; border-color: transparent; color: var(--muted); font-size: 12px; }
.primary-button, .secondary-button, .reset-button, .explore-result, .retry-button { font-size: 14px; min-height: 44px; }
.primary-button:hover:not(:disabled) { background: #b8e6cd; }
.model-setup { gap: 14px; margin-top: 16px; padding: 14px 16px; border: 0; background: var(--surface-raised); }
.model-setup h3 { margin-bottom: 3px; font-size: 14px; }
.model-setup p { font-size: 12px; line-height: 1.7; }
.setup-details { margin-top: 4px; }
.setup-details summary { width: fit-content; color: var(--muted); cursor: pointer; font-size: 11px; }
.setup-details p { max-width: 65ch; margin-top: 10px; }
.semantic-options { margin: 8px 0 0; padding: 6px 0; border: 0; }
.semantic-options > summary { width: fit-content; color: var(--muted); font-size: 12px; cursor: pointer; }
.semantic-options[open] { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.semantic-options[open] > summary { color: var(--green); }
.semantic-setup { padding: 6px 0 0; }
.semantic-setup > p { max-width: 72ch; color: var(--muted); font-size: 14px; line-height: 1.75; }
.semantic-actions { flex-direction: row; flex-wrap: wrap; margin: 16px 0 0; }
#semantic-progress { width: 100%; height: 9px; margin-top: 15px; accent-color: var(--green); }
#semantic-status[data-state="error"] { color: var(--error); }
.related-questions { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0; }
.related-questions > p { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 14px; }
.related-question { max-width: 100%; white-space: normal; text-align: left; }
.model-status, .chat-status { margin: 7px 0; font-size: 12px; }
.model-status[data-state="ready"] { color: var(--green); }
.chat-welcome { padding: 26px 0 28px; text-align: center; }
.welcome-symbol { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 15px; border: 1px solid #335248; border-radius: 18px; background: #1a332f; color: var(--green); }
.welcome-symbol svg { width: 38px; height: 38px; fill: var(--surface-selected); stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.welcome-symbol svg circle { fill: var(--green); stroke: none; }
.chat-welcome h3 { margin: 0; font-size: clamp(21px, 2.1vw, 29px); font-weight: 550; letter-spacing: -.8px; line-height: 1.3; }
.chat-welcome > p { margin: 11px 0 23px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.starter-questions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 820px; margin: 0 auto; }
.starter-questions button { position: relative; min-height: 84px; padding: 15px 28px 15px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-input); color: var(--muted); text-align: left; font-size: 12px; line-height: 1.6; transition: border-color .15s, background-color .15s; }
.starter-questions button:hover:not(:disabled) { border-color: #54796b; background: #192a2a; }
.starter-topic { display: block; margin-bottom: 5px; color: var(--ink); font-size: 13px; font-weight: 550; }
.starter-arrow { position: absolute; top: 14px; right: 12px; color: var(--green); font-size: 15px; }
.chat-messages { min-height: 220px; max-height: min(520px, calc(100dvh - 460px)); padding: 22px 6px 22px 0; margin-top: 0; gap: 24px; }
#chat-welcome ~ .chat-messages > .assistant-message:first-child:not([data-mode]) { display: none; }
.chat-message { width: min(94%, 800px); padding: 18px 20px; max-width: 76ch; border-color: var(--line); border-radius: 12px; }
.assistant-message { background: var(--surface-input); }
.user-message { width: fit-content; max-width: 85%; border-color: #33564b; }
.message-author { font-size: 13px; margin-bottom: 9px; }
.message-body { font-size: 16px; line-height: 1.8; }
.message-kind { font-size: 12px; margin-top: 14px; }
.inline-citation { font-size: 12px; }
.chat-evidence summary, .chat-evidence h4, .chat-evidence p { font-size: 14px; }
.chat-form { margin-top: 4px; padding-top: 0; border: 0; }
.chat-form label, .search-form label { font-size: 15px; }
.chat-input-row { gap: 4px; align-items: center; padding: 7px; border: 1px solid var(--control-border); border-radius: 13px; background: var(--surface-input); }
.chat-input-row:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #a0dec814; }
#chat-question { min-height: 68px; padding: 13px 12px; border: 0; background: transparent; font-size: 16px; }
#chat-question:focus-visible { outline: 0; }
#chat-question:disabled { opacity: .7; }
.chat-send-actions { padding-right: 4px; }
.chat-send-actions .primary-button { min-height: 40px; font-size: 13px; }
#search-query { font-size: 16px; padding: 14px 16px; }
.chat-help { display: flex; justify-content: space-between; gap: 14px; margin-top: 10px; font-size: 11px; line-height: 1.75; }
.keyboard-hint { white-space: nowrap; }
.atlas-layout { grid-template-columns: minmax(0, 1.15fr) minmax(310px, 1fr); }
.atlas-header { padding: 24px 28px; }
.view-label { font-size: 12px; }
.viewer-help, .marker-help, .orientation, .anatomy-note { font-size: 13px; }
.region-panel { padding: 26px; }
.corpus-status { font-size: 14px; }
.region-button { font-size: 14px; min-height: 52px; padding: 10px; }
.region-number { font-size: 12px; }
.region-detail > h3 { font-size: 26px; }
.anatomy-passage h4 { font-size: 15px; }
.anatomy-passage > p { font-size: 15px; line-height: 1.8; }
.anatomy-passage .passage-source { font-size: 13px; line-height: 1.75; }
.search-heading > p:last-child, .comparison-heading > p:last-child, .mri-heading > p:last-child { max-width: 65ch; font-size: 16px; line-height: 1.75; }
.search-help, .search-status, .search-match, .search-result-sources { font-size: 14px; }
.search-result { padding: 24px; }
.search-result h3 { font-size: 20px; line-height: 1.4; }
.search-result-text { max-width: 70ch; font-size: 16px; line-height: 1.8; color: var(--ink); }
#search-submit { font-size: 15px; }
.thesis-status, .thesis-help, .thesis-model-summary > p, #thesis-caption, .thesis-notes summary, .thesis-notes p { font-size: 14px; line-height: 1.8; }
.thesis-model-summary > p { max-width: 70ch; }
.thesis-facts dt { font-size: 13px; }
.thesis-facts dd { font-size: 16px; }
.comparison-scope, .mri-scope { font-size: 14px; line-height: 1.75; border-radius: 0 8px 8px 0; }
.comparison-status, .comparison-image-status, .comparison-sample-note, .comparison-metric-context,
.comparison-help, .comparison-legend li, .comparison-limitations p, .comparison-attribution,
.mri-help, .mri-status, .mri-channel-note, .mri-image-status, .mri-guide p, .mri-limitations p { font-size: 14px; line-height: 1.8; }
.comparison-field > label, .mri-field > label { font-size: 14px; }
.comparison-field > select, .mri-field > select, .mri-field > input[type="file"] { font-size: 15px; min-height: 48px; }
.comparison-layers legend, .mri-layers legend, .comparison-opacity label, .mri-opacity label,
.comparison-opacity output, .mri-opacity output { font-size: 13px; }
.comparison-layers > label, .mri-layers > label, .mri-confirm { font-size: 14px; }
.comparison-metrics dt, .mri-metrics dt { font-size: 13px; line-height: 1.65; }
.comparison-metrics dd { font-size: 22px; }
.mri-metrics dd { font-size: 15px; }
.mri-model-source > summary, .mri-guide > summary { font-size: 14px; }
.mri-setup > h3, .mri-inputs > h3 { font-size: 18px; }
.mri-placeholder { font-size: 14px; }
.source-note { gap: 32px; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); }
.source-details { font-size: 15px; line-height: 1.85; }
.source-details h3 { font-size: 17px; }
footer { margin-left: 230px; padding: 18px 44px 22px; font-size: 11px; }

@media (max-width: 1100px) {
  .page { width: 100%; }
  .workspace-layout { grid-template-columns: 196px minmax(0, 1fr); gap: 0; }
  .site-header { padding: 0 24px; }
  .workspace-sidebar { padding-right: 10px; padding-left: 10px; }
  main { padding: 0 24px 28px; }
  .header-context > span { display: none; }
  footer { margin-left: 196px; padding-right: 24px; padding-left: 24px; }
  .atlas-layout { grid-template-columns: minmax(0, 1fr); }
  .region-panel { border-left: 0; border-top: 1px solid var(--line); }
  .region-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .comparison-layout, .mri-layout { grid-template-columns: minmax(0, 1fr); }
  .source-note { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .page { width: 100%; }
  .site-header { min-height: 66px; flex-wrap: nowrap; padding: 14px 18px; }
  .brand { font-size: 19px; gap: 9px; }
  .brand-mark { width: 31px; height: 31px; font-size: 20px; }
  .header-context { font-size: 11px; text-align: right; line-height: 1.5; }
  .workspace-layout { display: block; }
  .workspace-sidebar { position: static; min-height: 0; padding: 12px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-sidebar > .sidebar-label, .sidebar-note, .nav-group-label { display: none; }
  .workspace-sidebar nav { display: flex; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 7px; width: 100%; padding: 0 0 10px; scrollbar-width: thin; }
  .workspace-sidebar nav a { flex: 0 0 auto; gap: 8px; min-height: 42px; padding: 9px 13px; font-size: 13px; white-space: nowrap; background: transparent; }
  .nav-symbol { width: 16px; height: 18px; flex-basis: 16px; }
  main { padding: 0 16px 24px; }
  .intro { padding: 22px 0 18px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  .intro-copy { font-size: 14px; }
  .chat-panel, .search-panel, .thesis-panel, .comparison-panel, .mri-panel, .source-note { padding: 20px 16px; }
  .chat-panel { padding: 15px; }
  .chat-heading { align-items: flex-start; gap: 14px; }
  .chat-heading h2 { font-size: 13px; padding-top: 8px; }
  #clear-chat { font-size: 11px; padding: 7px 0; }
  .model-setup { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .model-actions { flex-direction: row; flex-wrap: wrap; }
  .model-setup .model-actions .primary-button { flex: 1; }
  .chat-welcome { padding: 26px 0 22px; }
  .chat-welcome h3 { font-size: 23px; }
  .chat-welcome > p { font-size: 13px; }
  .desktop-break { display: none; }
  .starter-questions { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .starter-questions button { min-height: 64px; padding: 11px 30px 11px 13px; }
  .starter-topic { margin-bottom: 1px; }
  .chat-messages { max-height: 60vh; }
  .chat-message { padding: 16px; width: 100%; }
  .user-message { width: fit-content; max-width: 92%; }
  .chat-input-row { flex-direction: column; align-items: stretch; }
  .chat-send-actions { flex-direction: row; justify-content: flex-end; padding: 0 2px 2px; }
  .chat-send-actions .primary-button { min-height: 36px; padding: 7px 14px; }
  #chat-question { width: 100%; min-height: 66px; }
  .chat-help { font-size: 10px; }
  .keyboard-hint { display: none; }
  .region-panel, .atlas-header { padding: 22px 18px; }
  .region-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-result { padding: 20px; }
  .mri-selectors, .comparison-selectors, .mri-file-grid { grid-template-columns: minmax(0, 1fr); }
  .mri-setup, .mri-inputs { padding: 20px 16px; }
  footer { margin-left: 0; padding: 16px 18px 20px; gap: 8px; }
}

@media (min-width: 761px) and (max-height: 850px) {
  .site-header { min-height: 64px; }
  .workspace-sidebar { min-height: calc(100vh - 64px); padding-top: 26px; }
  .sidebar-note { margin-top: 40px; }
  .intro { padding: 20px 0 18px; }
  h1 { font-size: 28px; }
  .intro-copy { font-size: 13px; }
  .chat-panel { padding: 16px 22px; }
  .chat-heading { padding-bottom: 10px; }
  .model-setup { margin-top: 12px; padding: 10px 14px; }
  .model-status { margin: 5px 0; }
  .semantic-options { margin-top: 4px; padding-top: 4px; padding-bottom: 4px; }
  .chat-welcome { padding: 18px 0 20px; }
  .welcome-symbol { width: 44px; height: 44px; margin-bottom: 12px; border-radius: 14px; }
  .welcome-symbol svg { width: 30px; height: 30px; }
  .chat-welcome h3 { font-size: 25px; }
  .chat-welcome > p { margin: 8px 0 18px; font-size: 13px; }
  .desktop-break { display: none; }
  .starter-questions button { min-height: 72px; padding: 12px 26px 12px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .starter-questions button { transition: none; }
}
