:root{--theme-bg:#f7f8fc;--theme-panel:#fff;--theme-soft:#edf0f6;--theme-raised:#e1e7f0;--theme-text:#283246;--theme-muted:#737c8f;--theme-line:#dce2ec;--theme-orange:#bd542b;--theme-warm:#fff4e9;--theme-warm-line:#ecd3bd}
html[data-theme="dark"]{color-scheme:dark;--theme-bg:#15191f;--theme-panel:#1d232c;--theme-soft:#252d38;--theme-raised:#343f4f;--theme-text:#e6eaf1;--theme-muted:#a7b1c1;--theme-line:#35404f;--theme-orange:#f39b6c;--theme-warm:#322820;--theme-warm-line:#66503d;--bg:var(--theme-bg);--card:var(--theme-panel);--muted:var(--theme-muted);--ink:var(--theme-text);--line:var(--theme-line);--accent:var(--theme-orange);--orange:#d96f3d}
html[data-theme="light"]{color-scheme:light}
.theme-control{display:flex;align-items:center;gap:10px;font:14px 'PT Sans',sans-serif;color:var(--theme-muted)}
.theme-control select{font:inherit;padding:7px 9px;min-width:130px;border:1px solid var(--theme-line);border-radius:9px;background:var(--theme-panel);color:var(--theme-text);cursor:pointer}
.theme-floating{position:fixed;right:20px;bottom:18px;z-index:40;padding:8px 12px;border-radius:12px;border:1px solid var(--theme-line);background:var(--theme-panel);box-shadow:0 3px 18px #00000012}
.sidebar-bottom .theme-control{padding:8px 0 12px;justify-content:space-between}.sidebar-bottom .theme-control select{min-width:0;max-width:154px}
html[data-theme="dark"] body{background:var(--theme-bg);color:var(--theme-text)}
html[data-theme="dark"] :is(.studio-sidebar,.project-brief,.login-body){background:var(--theme-bg)}
html[data-theme="dark"] :is(#workspace,.studio-topbar,.studio-composer){background:var(--theme-bg);border-color:var(--theme-line)}
html[data-theme="dark"] :is(button,input,textarea,select,.card,.workroom-card,.project-card,.help-panel,.login-card,.paper,.format-card,.source,.plan-dialog){background-color:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme="dark"] :is(.primary,.button,.login-button,#email-login .login-button){background:#d96f3d;color:#fff;border-color:#d96f3d}
html[data-theme="dark"] :is(.ghost,.brief-link,.theme-control,.main-navigation button,.service-navigation button){background:transparent;color:var(--theme-muted)}
html[data-theme="dark"] :is(.studio-brand,.brand,.login-brand,.login-intro h1,.login-card h2,.welcome-copy h1,.section-top h2,.paper h1,.paper h2){color:var(--theme-text)}
html[data-theme="dark"] :is(.hint,.sidebar-label,.sidebar-empty,.history-search input::placeholder,.welcome-copy>p,.welcome-fox>span,.start-bottom>span,.start-settings,.start-settings label,.starter-grid small,.project-card small,.sidebar-bottom a,.sidebar-bottom button,.brief-caption,.brief-empty,.brief-facts dt,.workroom-card dt,.message.system,.paper p,.kicker,.bottom,.login-card p,.login-card small,.login-card label,.login-tabs button,.login-forgot,.login-divider,.login-body footer,.login-intro>p,.login-benefits,.login-legal-note,.hero-fine,.intro,.section-top>p,.work-card p,.flow p,.price-note,.pricing-note,.footer,.workroom-type){color:var(--theme-muted)}
html[data-theme="dark"] :is(.message.user,.message.system,.tabs .selected,.main-navigation .active,.service-navigation .active,.history-item.selected,.nav a.active,.login-tabs button.selected){background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme="dark"] :is(.starter-grid button,.composer-tools button,.history-search input,.start-settings input,#load-telegram,.login-google,.plan-metric,.plan-included span,.plan-checks){background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme="dark"] :is(#pending,#order,.chat-pay,#outline-ready,#clarification,.workroom-next,.unfinished-work,.draft,.pill,#notice:not(:empty),.plan-review,.login-symbol){background:var(--theme-warm);border-color:var(--theme-warm-line);color:var(--theme-text)}
html[data-theme="dark"] :is(.work-card,.price-card,.chat,.final-banner,.flow article){background:var(--theme-panel);border-color:var(--theme-line)}
html[data-theme="dark"] :is(.work-card.large,.price-card.featured){background:var(--theme-warm);border-color:var(--theme-warm-line)}
html[data-theme="dark"] :is(.plan-dialog-header,.plan-dialog-footer,.plan-section,.brief-group,.source,.sources,.footer,.login-body footer,#workroom-outline p,.tabs,.topbar-divider,.studio-sidebar,.project-brief){border-color:var(--theme-line)}
html[data-theme="dark"] :is(.plan-dialog-header,.plan-dialog-footer,.plan-dialog-body){background:var(--theme-panel);color:var(--theme-text)}
html[data-theme="dark"] :is(.plan-intro h2,.plan-price strong,.plan-metric strong,.plan-section h3,.plan-review h3,.plan-checks h3){color:var(--theme-text)}
html[data-theme="dark"] :is(.brief-group p,.brief-group small,.plan-dialog p,.plan-metric span,.price-card p,.price-card li,.chat p){color:var(--theme-muted)}
html[data-theme="dark"] :is(.orange,.overline,.eyebrow,.work-card .tag,.brief-link:hover,.service-navigation .active,.login-legal-note a){color:var(--theme-orange)}
html[data-theme="dark"] :is(.hero,.process-box,.plan,.plan.featured,.chat-tag,.flow .num){background:var(--theme-panel);border-color:var(--theme-line)}
html[data-theme="dark"] .hero{background:#202734}
html[data-theme="dark"] .format-card.available{background:var(--theme-warm);border-color:#b87550}
html[data-theme="dark"] :is(h1,h2,h3,.plan .price,.plan ul,.work-card h3,.chat .sender){color:var(--theme-text)}
html[data-theme="dark"] :is(.hero .eyebrow,.plan-label,.plan.featured){background:var(--theme-warm);color:var(--theme-orange)}
html[data-theme="dark"] .work-card.large{background:#283449}
html[data-theme="dark"] :is(.work-card:nth-child(3),.work-card:nth-child(4),.work-card:nth-child(5),.chat.student:after){background:var(--theme-panel)}
html[data-theme="dark"] :is(.plan>p,.plan li,.mini-benefits,.hero-fine,.chat-tag){color:var(--theme-muted)}
html[data-theme="dark"] :is(.drawer-shade,.brief-shade){background:#0009}
html[data-theme="dark"] textarea::placeholder,html[data-theme="dark"] input::placeholder{color:#929eb2}
html[data-theme="dark"] :is(button,.format-card):disabled{color:#97a2b5;opacity:.8}
@media(max-width:760px){.theme-floating{position:static;width:fit-content;margin:8px auto 20px;padding:6px 9px}.theme-control{font-size:13px}.theme-control select{min-width:120px}.sidebar-bottom .theme-control{font-size:14px}}

html[data-theme="dark"] :is(#chat,form#create){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme="dark"] .tabs button:not(.selected){background:transparent;color:var(--theme-muted)}
html[data-theme="dark"] .tabs button.selected{background:var(--theme-raised);color:var(--theme-text)}
html[data-theme="dark"] :is(.paper li,.paper .lead,.login-consent){color:var(--theme-muted)}

/* Dark: status colours of the work header, literature and the side panel come from the theme, never light patches. */
html[data-theme="dark"]{--done:#7fcf9f;--current:#3a2a20;--warm-line:#66503d}
html[data-theme="dark"] .work-head .stages li{background:none;color:var(--theme-muted)}
html[data-theme="dark"] .work-head .stages li.done{color:#7fcf9f}
html[data-theme="dark"] .work-head .stages li.current{background:#3a2a20;color:var(--theme-orange)}
html[data-theme="dark"] .sidebar-bottom button,html[data-theme="dark"] .sidebar-bottom a{background:transparent;border:0;padding:0}
html[data-theme="dark"] .brief-state{background:var(--theme-soft);color:var(--theme-muted)}
html[data-theme="dark"] .brief-state strong{color:var(--theme-text)}
html[data-theme="dark"] .literature-badge.ok{background:#1f3a2b;color:#7fcf9f}
html[data-theme="dark"] .literature-badge.warn{background:#3d2c18;color:#f0b66f}
html[data-theme="dark"] #literature .literature-warning{color:#f0b66f}
html[data-theme="dark"] .studio-thread .literature-stage{background:var(--theme-warm);border-color:var(--theme-warm-line)}
html[data-theme="dark"] .brief-head #brief-close{background:transparent;color:var(--theme-muted)}
html[data-theme="dark"] .brief-head #brief-close:hover,html[data-theme="dark"] .brief-head #brief-close:focus-visible{background:var(--theme-raised);color:var(--theme-text)}
