/* Shared appearance tokens are calculated from the user's background colour. */
:root{--background:#fafbf9;--surface:#fefefd;--surface-soft:#fcfcfb;--accent:#876019;--accent-soft:#f2eee3;--on-accent:#fff;--on-accent-soft:#26332d;--control-line:#858c83;--danger:#a33225;--success:#286244;--warning:#896017;--focus-color:#876019}
html,body,.main-shell,.chat-page #main{background:var(--background);color:var(--ink)}
body :is(h1,h2,h3,h4,h5,h6){color:var(--ink)}
body :is(button,a,input,select,textarea,[tabindex]):focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
body :is(input,select,textarea){accent-color:var(--accent);caret-color:var(--ink)}
body ::placeholder{color:var(--muted);opacity:1}
body ::selection{background:var(--accent);color:var(--on-accent)}
body :is(.sidebar,.topbar){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
body :is(.brand-caption,.workspace-label small,.nav-label,.sidebar .nav-label,.tiny-lock,.profile small,.breadcrumb,.breadcrumb>span,.breadcrumb strong,.date-label,.eyebrow,.overline,.section-index,.page-footer,.muted,.subtitle){color:var(--muted)}
body :is(nav a,.settings-link,.sidebar-history h2,.twol-history-open,.twol-history-rename,.twol-history-empty,.sidebar-history .twol-history-empty,.twol-history-heading){color:var(--muted)}
body :is(nav a:hover,.settings-link:hover,.twol-history-row:hover,.twol-history-rename:hover,.icon-button:hover){background:var(--accent-soft);color:var(--on-accent-soft)}
body :is(nav a[aria-current=page],.sidebar nav a[aria-current=page],.twol-history-row.is-current){background:var(--accent-soft);color:var(--on-accent-soft);box-shadow:inset 3px 0 var(--accent)}
body .twol-history-row.is-current .twol-history-open{color:var(--on-accent-soft)}
body :is(.nav-count,.profile-avatar,.workspace-symbol,.project-symbol,.sidebar .new-chat-button){background:var(--surface);border-color:var(--control-line);color:var(--ink)}
body .new-chat-button:hover{background:var(--accent-soft);color:var(--on-accent-soft)}
body :is(.profile,.sidebar-bottom,.workspace-symbol){border-color:var(--line)}
body .brand-mark>span{background:var(--accent)}
body .profile-dot{background:var(--success)}
body :is(.icon-button,.completion-button,.connection-pill,.connection-pill.connected,.completion-count){color:var(--ink)}
body .completion-button{background:var(--surface);border-color:var(--control-line)}
body :is(.completion-count,.connection-pill,.connection-pill.connected,.demo-badge){background:var(--surface-soft);border-color:var(--line)}
body .notification-dot{background:var(--accent);border-color:var(--surface)}
body .button,body .twol-chat-dialog-actions button{background:var(--surface);color:var(--ink);border-color:var(--control-line)}
body .button:hover,body .twol-chat-dialog-actions button:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--on-accent-soft)}
body :is(.button.primary,.twol-chat-dialog-actions .twol-chat-primary,.twol-chat-primary,.twol-chat-send){background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
body :is(.button.primary:hover,.twol-chat-dialog-actions .twol-chat-primary:hover,.twol-chat-primary:hover,.twol-chat-send:hover){background:var(--accent);color:var(--on-accent);filter:brightness(.96)}
body .button.ghost{background:transparent;border-color:transparent;color:var(--muted)}
body .button.ghost:hover{background:var(--accent-soft);color:var(--on-accent-soft)}
body :is(.settings-panel,.project-list,.task-list,.attention-box,.prompt-box,.search-box,.side-dialog,.drawer-header,.twol-chat-dialog){background:var(--surface);color:var(--ink);border-color:var(--line)}
body :is(.field,.task-full-row>select,.project-selector select,.twol-chat-rename-form input){background:var(--surface);color:var(--ink);border-color:var(--control-line)}
body :is(.form-group label,.setting-row p,.setting-help,.setting-note,.task-full-row small,.today-text small,.project-open small,.table-phase,.table-deadline,.table-deadline small,.result-meta,.drawer-intro,.drawer-robot p,.detail-section p,.detail-keyvalues dt,.step-list li small,.timeline>div,.timeline time,.prompt-label,.prompt-help){color:var(--muted)}
body :is(.settings-avatar,.drawer-robot,.result-page-intro,.office-hidden,.chat-answer,.callout,.ready-indicator){background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
body :is(.setting-row,.task-full-row,.today-row,.result-item,.detail-section,.timeline,.project-table td,.project-table th,.member-detail-meta){border-color:var(--line)}
body :is(.today-row:hover,.project-table tbody tr:hover){background:var(--surface-soft)}
body :is(.project-table th,.tlo-table th){background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
body .segmented button{color:var(--muted)}
body .segmented button[aria-pressed=true]{background:var(--accent-soft);color:var(--on-accent-soft);border-color:var(--accent);box-shadow:inset 0 -2px var(--accent)}
body .status{background:var(--surface-soft);color:var(--success);border:1px solid currentColor}
body .status.waiting{background:var(--surface-soft);color:var(--warning)}
body :is(.status.done,.status.draft){background:var(--surface-soft);color:var(--muted)}
body .step-dot{background:var(--surface-soft);color:var(--muted);border:1px solid var(--control-line)}
body :is(.step-list li.complete .step-dot,.step-list li.current .step-dot){background:var(--accent);color:var(--on-accent);border-color:var(--accent)}
body .timeline>div::before{background:var(--accent)}
body .stored-sample-note,body .member-data-note{background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
body :is(.stored-sample-note>span,.member-type-badge,.member-role-badge){background:var(--surface);color:var(--ink);border-color:var(--line)}
body :is(.member-section-heading p,.member-connect-loading,.member-source-controls p,.member-detail-meta dt,.member-progress-text,.member-result,.member-detail-log,.member-detail-log time){color:var(--muted)}
body .member-progress{background:var(--surface-soft);border-color:var(--line)}
body .member-progress>span{background:var(--accent)}
body .member-avatar-icon{background:var(--surface-soft);color:var(--accent);border-color:var(--line)}
body .online-dot{background:var(--success);box-shadow:0 0 0 3px var(--surface-soft)}
body #toast{background:var(--ink);color:var(--background);border:1px solid var(--control-line)}
body .skip{background:var(--ink);color:var(--background)}
/* Chat typography retains its layout, while every text and input surface follows the theme. */
body :is(.twol-chat-conversation-title,.twol-chat-text-button,.twol-chat-welcome-kicker,.twol-chat-welcome>p:not(.twol-chat-welcome-kicker),.twol-chat-message-actions button,.twol-chat-message-status,.twol-chat-assistant-heading,.twol-chat-stream-label,.twol-chat-sample-label,.twol-chat-connection,.twol-chat-enter-help,.twol-chat-composer-note,.twol-chat-dialog h2,.twol-chat-icon-button,.twol-chat-rename-form label,.twol-chat-file-note,.twol-chat-file-preview){color:var(--muted)}
body :is(.twol-chat-message-actions button:hover,.twol-chat-text-button:hover){background:var(--accent-soft);color:var(--on-accent-soft)}
body .twol-chat-message-status.is-error{color:var(--danger)}
body .twol-chat-welcome h1{color:var(--ink)}
body .twol-chat-starters button{color:var(--ink);border-color:var(--control-line);background:var(--surface)}
body .twol-chat-starters button:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--on-accent-soft)}
body .twol-chat-user-text{background:var(--accent-soft);color:var(--on-accent-soft)}
body :is(.twol-prose,.twol-chat-notice .twol-prose,.twol-prose h1,.twol-prose h2,.twol-prose h3,.twol-prose h4,.twol-prose h5,.twol-prose h6){color:var(--ink)}
body .twol-prose blockquote{border-color:var(--control-line);color:var(--muted)}
body .twol-prose a{color:var(--accent);text-decoration-color:var(--accent)}
body .twol-prose hr{border-color:var(--line)}
body :is(.twol-prose code,.twol-prose pre,.twol-chat-code,.twol-chat-code-bar){background:var(--surface-soft);color:var(--ink);border-color:var(--line)}
body .twol-chat-code-bar button{color:var(--muted)}
body .twol-prose pre code{background:transparent;color:inherit}
body :is(.twol-chat-table-scroll,.twol-prose th,.twol-prose td){border-color:var(--line)}
body .twol-prose table{color:var(--ink)}
body .twol-prose th{background:var(--surface-soft);color:var(--ink)}
body :is(.twol-prose details,.twol-chat-sample-label){border-color:var(--line)}
body .twol-prose summary{color:var(--accent)}
body .twol-chat-composer-wrap{background:var(--background);box-shadow:0 -14px 0 0 var(--background)}
body .twol-chat-composer{background:var(--surface);border-color:var(--control-line)}
body .twol-chat-composer:focus-within{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}
body .twol-chat-composer textarea{color:var(--ink)}
body :is(.twol-chat-pulse,.twol-chat-thinking span){background:var(--accent)}
body .twol-chat-send:disabled{background:var(--surface-soft);color:var(--muted);border:1px solid var(--control-line)}
body .twol-chat-latest{background:var(--surface);color:var(--ink);border-color:var(--control-line)}
/* Scene geometry keeps the established illustration; surrounding UI and labels remain readable. */
body .tlo-office{--tlo-ink:var(--ink);--tlo-secondary:var(--muted);--tlo-line:var(--line);--tlo-sage:var(--surface-soft)}
body :is(.tlo-tabs,.tlo-stage,.tlo-scene-footer,.tlo-table-wrap,.tlo-table-avatar,.tlo-type-tag,.tlo-zoom,.tlo-member-label,.tlo-no-members){background:var(--surface-soft);color:var(--ink);border-color:var(--line)}
body .tlo-member-label,body .tlo-labels .tlo-member-label{background:var(--surface);color:var(--ink);border-color:var(--control-line)}
body .tlo-labels .tlo-member-label:hover{background:var(--accent-soft);color:var(--on-accent-soft);border-color:var(--accent)}
body .tlo-tabs button{color:var(--muted)}
body .tlo-tabs button[aria-selected=true]{background:var(--surface);color:var(--ink);border-color:var(--control-line);box-shadow:inset 0 -2px var(--accent)}
body :is(.tlo-source,.tlo-source-disconnected,.tlo-scene-caption,.tlo-scene-caption small,.tlo-scene-footer,.tlo-scene-footer>span,.tlo-connection-note,.tlo-sample-note,.tlo-type-tag,.tlo-status,.tlo-table time,.tlo-table-person small,.tlo-table-person>svg,.tlo-empty-table,.tlo-zoom button,.tlo-zoom output){color:var(--muted)}
body .tlo-table{color:var(--ink)}
body .tlo-table td{border-color:var(--line)}
body .tlo-table tbody tr:hover{background:var(--surface-soft)}
body .tlo-text-button{color:var(--accent)}
body :is(.tlo-status-working,.tlo-status-done){color:var(--success)}
body .tlo-status-review{color:var(--warning)}
body .tlo-status-error{color:var(--danger)}
body .tlo-notification{background:var(--surface);color:var(--warning);border-color:var(--warning)}
body .tlo-warning{background:var(--surface);color:var(--danger);border-color:var(--danger)}
body .tlo-complete{background:var(--surface);color:var(--success);border-color:var(--success)}
body .tlo-zoom button:hover{background:var(--accent-soft);color:var(--on-accent-soft)}
body .tlo-zoom>span{background:var(--line)}
body .tlo-office button:focus-visible,body .tlo-table-wrap:focus-visible{outline-color:var(--focus-color)}
body .tlo-office .tlo-member:focus-visible{outline-color:var(--focus-color)}
/* Appearance settings: radio choices and a contained preview never modify the page until saved. */
.theme-settings{margin-top:26px}
.theme-settings-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:24px}
.theme-settings-heading h2{margin:0 0 6px}
.theme-settings-heading p{font-size:13px;color:var(--muted)}
.theme-saved-badge{font-size:11px;border:1px solid var(--control-line);padding:3px 8px;border-radius:5px;white-space:nowrap;color:var(--muted)}
.theme-settings-form{max-width:900px}
.theme-settings-form fieldset{border:0;margin:0;padding:0;min-width:0}
.theme-settings-form legend,.theme-custom-field>label{font-size:13px;font-weight:500;margin-bottom:12px;display:block;color:var(--ink)}
.theme-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.theme-option{position:relative;display:block;cursor:pointer;min-width:0}
.theme-option>input{position:absolute;opacity:0;inset:0;width:100%;height:100%;margin:0;cursor:pointer}
.theme-mini-preview{display:flex;height:78px;gap:0;background:var(--preview-bg);border:1px solid var(--control-line);border-radius:8px 8px 0 0;overflow:hidden;pointer-events:none}
.theme-mini-preview>i{width:23%;border-right:1px solid var(--preview-line);background:var(--preview-surface)}
.theme-mini-preview>span{padding:17px 15px;display:block;flex:1}
.theme-mini-preview b{display:block;background:var(--preview-line);height:3px;margin-bottom:7px;width:75%;border-radius:1px}
.theme-mini-preview b:nth-child(2){width:95%;height:2px}
.theme-mini-preview em{display:block;width:33%;min-width:22px;height:10px;background:var(--preview-accent);border-radius:2px;margin-top:9px}
.theme-option-label{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:41px;padding:8px 11px;font-size:13px;border:1px solid var(--control-line);border-top:0;border-radius:0 0 8px 8px;background:var(--surface);color:var(--ink)}
.theme-choice-check{visibility:hidden;color:var(--accent);font-weight:700}
.theme-option input:checked~.theme-mini-preview,.theme-option input:checked~.theme-option-label{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.theme-option input:checked~.theme-option-label .theme-choice-check{visibility:visible}
.theme-option input:focus-visible~.theme-mini-preview{outline:3px solid var(--focus-color);outline-offset:4px}
.theme-custom-field{margin-top:23px}
.theme-custom-field[hidden]{display:none}
.theme-color-inputs{display:flex;align-items:center;gap:10px;max-width:350px}
.theme-color-inputs input[type=color]{width:48px;height:43px;background:var(--surface);padding:4px;border:1px solid var(--control-line);border-radius:7px;cursor:pointer}
.theme-color-inputs input[type=text]{flex:1;min-width:0;height:43px;padding:8px 12px;border:1px solid var(--control-line);border-radius:7px;background:var(--surface);color:var(--ink);font:14px ui-monospace,SFMono-Regular,Menlo,monospace}
.theme-custom-field>p{font-size:12px;color:var(--muted);margin-top:9px}
.theme-contrast-toggle{display:flex;align-items:flex-start;gap:11px;margin:22px 0;color:var(--ink);font-size:13px;cursor:pointer}
.theme-contrast-toggle input{width:18px;height:18px;flex-shrink:0;margin:3px 0 0}
.theme-contrast-toggle small{display:block;color:var(--muted);font-size:12px;line-height:1.8;margin-top:3px}
.theme-live-preview{display:flex;border:1px solid var(--preview-line);border-radius:10px;overflow:hidden;background:var(--preview-bg);color:var(--preview-ink);max-width:580px;min-height:190px}
.theme-preview-sidebar{display:flex;flex-direction:column;gap:12px;width:19%;min-width:58px;padding:19px 11px;background:var(--preview-surface);border-right:1px solid var(--preview-line)}
.theme-preview-sidebar b{font-size:19px;color:var(--preview-accent);letter-spacing:-1px}
.theme-preview-sidebar>span{height:3px;background:var(--preview-line);width:80%}
.theme-preview-content{padding:22px;display:flex;flex-direction:column;align-items:flex-start;gap:9px;min-width:0}
.theme-preview-content strong{font-size:14px;line-height:1.7;color:var(--preview-ink)}
.theme-preview-content p{font-size:13px;color:var(--preview-muted);line-height:1.8}
.theme-preview-button{display:inline-block;background:var(--preview-accent);color:var(--preview-on-accent);font-size:12px;padding:6px 12px;border-radius:5px;margin-top:3px}
.theme-preview-contrast{font-size:11px;color:var(--preview-muted);line-height:1.7}
.theme-adjustment-note,.theme-setting-status,.theme-storage-note{font-size:12px;color:var(--muted);line-height:1.8;margin-top:11px}
.theme-setting-status:empty{display:none}
.theme-settings-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:20px}
.theme-settings-actions .button{font-size:13px;min-height:41px}
.theme-storage-note{margin-top:13px}
[data-high-contrast=true] :is(.settings-panel,.task-list,.project-list,.tlo-stage,.side-dialog,.twol-chat-dialog){border-color:var(--control-line)}
@media(max-width:620px){.theme-options{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.theme-settings-heading{gap:10px}.theme-settings-heading p{font-size:12px}.theme-preview-content{padding:18px 14px}.theme-preview-content strong{font-size:13px}.theme-preview-contrast{font-size:10px}.theme-settings-actions .button{flex:1;font-size:12px}.theme-option-label{font-size:12px}.theme-live-preview{min-height:188px}}
@media(forced-colors:active){.theme-option input:checked~.theme-option-label{outline:2px solid Highlight}.theme-choice-check{color:Highlight}.theme-mini-preview,.theme-live-preview{forced-color-adjust:none}}
/* Explicit compound selectors override the original shell's state-specific colours. */
body.chat-page{background:var(--background)}
body .sidebar nav a:hover{background:var(--accent-soft);color:var(--on-accent-soft)}
body .member-data-note.sample{background:var(--surface-soft);color:var(--muted)}
body :is(.new-chat-plus,.sidebar-toggle,.project-selector,.member-detail-name p,.member-detail-log li,.member-status){color:var(--muted)}
body .member-detail-log li{border-color:var(--line)}
body :is(.member-status.working,.member-status.done){color:var(--success)}
body .member-status.review{color:var(--warning)}
body .member-status.error{color:var(--danger)}
body .member-detail-portrait{background:var(--surface-soft)}
body .human-portrait{background:var(--accent-soft);color:var(--on-accent-soft)}
body .connection-pill::before{background:var(--muted)}
body .connection-pill.connected::before{background:var(--success)}
body .completion-button:hover{background:var(--accent-soft);color:var(--on-accent-soft)}
body :is(.twol-chat-composer textarea,.search-box input,.prompt-form input,.field,.theme-color-inputs input)::placeholder{color:var(--muted);opacity:1}
