.theme-trigger { width: 35px; height: 35px; }
.theme-options { display: grid; gap: 7px; padding: 12px; }
.theme-option { display: grid; grid-template-columns: 65px minmax(0, 1fr) 18px; align-items: center; gap: 12px; min-height: 57px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; text-align: left; color: var(--text); }
.theme-option:hover { background: var(--panel-2); }
.theme-option[aria-pressed="true"] { border-color: var(--accent); }
.theme-sample { display: flex; gap: 3px; padding: 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); }
.theme-sample i { width: 16px; height: 20px; border: 1px solid #80808055; border-radius: 3px; }
.theme-description strong { display: block; font-size: 13px; }
.theme-description small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.theme-selected { color: var(--accent); visibility: hidden; }
.theme-option[aria-pressed="true"] .theme-selected { visibility: visible; }
.prompt-disclosure { margin-top: 15px; border-top: 1px solid var(--line); padding-top: 10px; }
.prompt-disclosure summary { cursor: pointer; font-weight: 650; }
#prompt-history { padding-left: 20px; white-space: pre-wrap; }
#prompt-history li + li { margin-top: 10px; }
:root[data-theme="graphite"] {
  --bg: #10191d; --panel: #152126; --panel-2: #1d2b30; --line: #304047;
  --text: #f1f7f5; --muted: #aabebd; --quiet: #91a6a9;
  --accent: #9ce2d6; --accent-strong: #87d7ca; --accent-ink: #16302b;
  --clinical: #a5decf; --imaging: #acd2f8;
}
[data-theme="graphite"] .topbar { background: #131f24; border-color: var(--line); }
[data-theme="graphite"] :is(.top-search, .top-plain:hover, .icon-btn:hover, .footer-btn:hover, .catalog-input, .catalog-select select, .select-shell) { background: #1d2b31; border-color: #36484e; }
[data-theme="graphite"] :is(.system-button, .side-heading h2, .select-shell, .side-region label, .export-trigger, .entity-body p, .case-section p, .case-section li) { color: #c7d7d7; }
[data-theme="graphite"] :is(.system-button[aria-pressed="true"], .case-list-item[aria-current], .context-link[data-active="true"], .icon-btn[aria-pressed="true"], .body-switch button[aria-pressed="true"], .intro-clinical, .secondary-action) { background: #213b3b; border-color: #4a706b; color: #d7f6f0; }
[data-theme="graphite"] :is(.case-list-item:hover, .system-button:hover, .context-link:hover, .result:hover) { background: #25383c; border-color: #456062; }
[data-theme="graphite"] :is(.focus-model, .brand-icon) { color: #142d28; background: var(--accent-strong); }
[data-theme="graphite"] .focus-model:hover { background: #abecdf; }
[data-theme="graphite"] :is(.body-switch, kbd, .dialog, .dialog-search, .book-term, .test-card, .context-link, .modality-tabs button, .small-action) { background: #1d2b30; border-color: #384e54; color: #d8e6e5; }
[data-theme="graphite"] :is(.entity-icon, .study-note, .entity-links button, .entity-links a) { background: #22363a; border-color: #40575b; color: #bde8de; }
[data-theme="graphite"] .study-note p { color: #c1d8d5; }
[data-theme="graphite"] .stage-background { background: radial-gradient(ellipse at 50% 46%, #26383d, #1a282e 55%, #142128); }
[data-theme="graphite"] .stage-grid { background-image: radial-gradient(circle at center, #6d959a .75px, transparent 1px); }
[data-theme="graphite"] .stage-orbit { border-color: #a9dde224; box-shadow: 0 0 0 35px #b7e5e80b, 0 0 0 36px #b7e5e810; }
[data-theme="graphite"] :is(.stage-toggle, .stage-tools, .stage .select-shell, .slice-panel, .view-context, .marker-name, .stage-mode) { background: #1a2a32ed; border-color: #466067; color: #d9efed; }
[data-theme="graphite"] .marker-point { background: #a7ded7; border-color: #e6fdf9; box-shadow: 0 0 0 3px #9be3d544; }
[data-theme="graphite"] .marker-leader { background: #9be3d5aa; }
[data-theme="graphite"] :is(.context-section a, .entity-links a, .prompt-disclosure) { color: #bde1da; }
[data-theme="graphite"] .chapter-heading { background: radial-gradient(ellipse at 100% 0%, #264644, transparent 85%), #192a2e; }
[data-theme="graphite"] .dialog-header, [data-theme="graphite"] .case-title-block { border-color: var(--line); }

:root[data-theme="paper"] {
  color-scheme: light;
  --bg: #f4f2ec; --panel: #fffdf9; --panel-2: #edf0e9; --line: #d7ddd5;
  --text: #202b2a; --muted: #536664; --quiet: #627270;
  --accent: #28695d; --accent-strong: #367a6b; --accent-ink: #fffefa;
  --clinical: #246b5f; --imaging: #315684;
}
[data-theme="paper"] .topbar { background: #fcfaf4; border-color: var(--line); }
[data-theme="paper"] :is(.brand, .side-heading h2, .entity-group h4, .case-list-item, .case-section h3, .flow-step h3, .case-section li, .case-section p, .case-context p, .help-body h3, .help-body dt) { color: var(--text); }
[data-theme="paper"] :is(.system-button, .select-shell, .side-region label, .entity-body p, .export-trigger, .entity-links a, .entity-links button, .help-body, .case-title-block p, .test-card dd, .flow-step p) { color: #415654; }
[data-theme="paper"] :is(.top-search, .top-plain:hover, .icon-btn:hover, .footer-btn:hover, .catalog-input, .catalog-select select, .select-shell, .body-switch, kbd, .dialog-search, .book-term, .test-card, .context-link, .modality-tabs button, .small-action) { background: #f0f1e9; border-color: #d9ded5; color: #365451; }
[data-theme="paper"] :is(.system-button[aria-pressed="true"], .case-list-item[aria-current], .context-link[data-active="true"], .icon-btn[aria-pressed="true"], .body-switch button[aria-pressed="true"], .intro-clinical, .secondary-action, .mode-chip, .flow-step::before) { background: #dceee5; border-color: #a5c5b7; color: #285a51; }
[data-theme="paper"] :is(.case-list-item:hover, .system-button:hover, .context-link:hover, .result:hover) { background: #edf2e9; border-color: #cedad1; color: #315a54; }
[data-theme="paper"] :is(.focus-model, .brand-icon) { color: #fff; background: var(--accent-strong); }
[data-theme="paper"] .focus-model:hover { background: #2e675c; }
[data-theme="paper"] :is(.entity-icon, .study-note, .entity-links button, .entity-links a, .case-reading, .entity-clinical) { background: #edf3ea; border-color: #d0ded1; color: #335c53; }
[data-theme="paper"] :is(.study-note p, .case-reading p, .test-card dt, .context-section a) { color: #3c5853; }
[data-theme="paper"] .dialog { color: var(--text); background: #fffdf9; border-color: #aebbb2; }
[data-theme="paper"] .dialog::backdrop { background: #1e2a2a75; }
[data-theme="paper"] .chapter-heading, [data-theme="paper"] .case-title-block { background: radial-gradient(ellipse at 100% 0%, #e2f0e5, transparent 85%), #f8f8ef; border-color: var(--line); }
[data-theme="paper"] .scan-panel, [data-theme="paper"] .scan-top, [data-theme="paper"] .scan-bottom, [data-theme="paper"] .stage { color-scheme: dark; }
[data-theme="paper"] .stage .select-shell { color: #e2eae8; border-color: #466067; background: #243038; }
[data-theme="paper"] .stage .icon-btn, [data-theme="paper"] .scan-top .icon-btn, [data-theme="paper"] .scan-range { color: #b9c9c8; }
[data-theme="paper"] .stage .icon-btn[aria-pressed="true"] { color: #c4f0e6; background: #254740; }
@media (max-width: 1290px) {
  .profile-trigger .profile-name, .export-trigger .action-text { display: none; }
  .profile-trigger, .export-trigger { width: 35px; padding: 0; justify-content: center; }
}
@media (max-width: 760px) {
  .topbar { height: auto; min-height: 56px; gap: 0 7px; flex-wrap: wrap; }
  .topbar .brand, .top-actions { height: 52px; }
  .topbar .top-divider { display: none; }
  .workspace-nav { order: 3; width: 100%; min-height: 36px; }
  .workspace-nav button { justify-content: center; flex: 1; }
}
@media (max-width: 405px) {
  .top-actions { gap: 2px; }
  .topbar .top-actions :is(.top-plain, .top-search, .theme-trigger, .help-btn) { width: 27px; min-height: 31px; height: 31px; }
  .workspace-nav button { padding-inline: 3px; font-size: 11px; }
}
