/* Four preset semantic layer; content-assigned memo/date colors retain their original rules. */
:root[data-ui-theme] body{background:var(--bg);color:var(--text-primary)}
:root[data-ui-theme] :is(.sidebar,.topbar,.mobile-header,.login-brand,.login-form,.viewer-header,dialog,.pwa-install-dialog){background:var(--surface);color:var(--text-primary);border-color:var(--border);box-shadow:var(--shadow)}
:root[data-ui-theme] :is(.mobile-shortcuts button,.mobile-work-card,.mobile-project-card,.mobile-recent,.mobile-chat-card,.mobile-menu-item,.order-card,.workflow-item,.list-row,.notice,.forum-post-card,.forum-comment,.member-row,.user-activity-card,.file-folder-card){background:var(--surface);color:var(--text-primary);border-color:var(--border);box-shadow:var(--shadow)}
:root[data-ui-theme] :is(.production-column,.calendar .day,.day,.profile-photo-section,.profile-handle-section,.font-preview,.theme-preset-card){background:var(--surface-elevated);color:var(--text-primary)}
:root[data-ui-theme] .day.other{background:var(--bg)}
:root[data-ui-theme] :is(.message p,.direct-bubble){background:var(--surface-elevated);color:var(--text-primary)}
:root[data-ui-theme] :is(.message.own p,.message.me p){background:var(--selected-bg);color:var(--text-primary)}
:root[data-ui-theme] :is(.muted,.mobile-eyebrow,.mobile-welcome>p,.mobile-menu-item small,.message-meta,.workspace-credit,.profile-card-handle){color:var(--text-secondary)}
:root[data-ui-theme] .login-brand h1{color:var(--text-primary)}
:root[data-ui-theme] :is(input:not([type=color]):not([type=range]):not([type=checkbox]):not([type=radio]),textarea,select){background:var(--surface-elevated);color:var(--text-primary);border-color:var(--border-strong)}
:root[data-ui-theme] :is(input,textarea)::placeholder{color:var(--text-secondary);opacity:1}
:root[data-ui-theme] :is(.primary,.pwa-offline a){background:var(--accent-text);color:var(--on-accent);border-color:var(--accent-text)}
:root[data-ui-theme] .primary:hover{background:var(--accent-text);filter:brightness(.96)}
:root[data-ui-theme] .secondary{background:var(--surface);color:var(--text-primary);border-color:var(--border-strong)}
:root[data-ui-theme] .danger{background:var(--red);color:var(--bg)}
:root[data-ui-theme] :is(.danger-text,.form-error){color:var(--red)}
:root[data-ui-theme] :is(button,a,input,select,textarea):focus-visible{outline:2px solid var(--accent-text);outline-offset:3px}
:root[data-ui-theme] dialog::backdrop{background:var(--scrim)}
:root[data-ui-theme] .mobile-bottom{background:var(--nav-bg);border-color:var(--border);box-shadow:var(--sheet-shadow)}
:root[data-ui-theme] .mobile-tab-badge{background:var(--accent-text);color:var(--on-accent)}
:root[data-ui-theme] #toast{background:var(--surface-elevated);color:var(--text-primary);border:1px solid var(--border-strong)}
:root[data-ui-theme] :is(.workflow-status,.badge){color:var(--accent-text);background:var(--selected-bg)}
:root[data-ui-theme] [data-tone=amber]{color:var(--amber);background:var(--amber-bg)}
:root[data-ui-theme] [data-tone=violet]{color:var(--violet);background:var(--violet-bg)}
:root[data-ui-theme] [data-tone=green]{color:var(--green);background:var(--green-bg)}
:root[data-ui-theme] [data-tone=red]{color:var(--red);background:var(--red-bg)}
:root[data-ui-theme] [data-tone=neutral]{color:var(--text-secondary)}
#workspace-theme-dialog{width:min(640px,calc(100vw - 28px));max-height:88dvh;overflow:auto;padding:20px;border-radius:16px}
.theme-preset-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:18px 0}
.theme-preset-card{display:flex;flex-direction:column;gap:9px;text-align:left;min-height:150px;min-width:0;padding:12px;white-space:normal;overflow-wrap:anywhere;border:2px solid var(--border-strong)}
:root[data-ui-theme] .theme-preset-card[aria-pressed=true]{border-color:var(--accent-text);outline:1px solid var(--accent-text)}
.theme-preset-card b{font-size:calc(15px * var(--font-overall,1) * var(--font-menu,1));line-height:1.5}.theme-preset-card small{color:var(--text-secondary);font-size:calc(12px * var(--font-overall,1) * var(--font-body,1));line-height:1.5}
.theme-preset-preview{display:flex;gap:6px;width:100%;min-height:45px;border-radius:8px;padding:10px;background:var(--preview-bg)}.theme-preset-preview i{display:block;background:var(--preview-surface);border-radius:4px;flex:1}.theme-preset-preview i:last-child{background:var(--preview-accent);flex:.4}
.theme-follow{display:flex;flex-direction:row;align-items:center;gap:10px;min-height:44px}.theme-follow input{width:auto;min-width:20px;min-height:20px;accent-color:var(--accent-text)}
@media(max-width:370px){#workspace-theme-dialog{padding:14px}.theme-preset-grid{gap:8px}.theme-preset-card{padding:9px}}

:root[data-ui-theme] .file-folder-grid .file-folder-card:where(.folder-color-1,.folder-color-2,.folder-color-3,.folder-color-4,.folder-color-5,.folder-color-6,.folder-color-7){
 background:color-mix(in srgb,var(--folder-accent) 24%,var(--surface));
 border-color:color-mix(in srgb,var(--folder-accent) 70%,var(--border));
}
:root[data-ui-theme] .file-folder-grid .file-folder-card:where(.folder-color-1,.folder-color-2,.folder-color-3,.folder-color-4,.folder-color-5,.folder-color-6,.folder-color-7):hover{
 background:color-mix(in srgb,var(--folder-accent) 32%,var(--surface));
 border-color:var(--folder-accent);
}
