/* Shared appearance tokens; images, avatars and project colours keep their originals. */
:root{color-scheme:light;--theme-bg:#fff;--theme-panel:#fff;--theme-soft:#fafafa;--theme-hover:#efeff1;--theme-text:#29292d;--theme-muted:#777d83;--theme-line:#ededf0}
:root[data-theme=dark]{color-scheme:dark;--theme-bg:#16191d;--theme-panel:#22262c;--theme-soft:#1c2025;--theme-hover:#2e343c;--theme-text:#e9edf2;--theme-muted:#a5aeb9;--theme-line:#373e48;--theme-accent:#b1c8ab;--theme-tint:#2c3a30;--muted:#a5aeb9;--line:#373e48;--green:#b1c8ab}
.theme-toggle{width:40px;height:40px;min-width:40px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border:1px solid var(--theme-line);border-radius:12px;background:var(--theme-panel);color:var(--theme-text);cursor:pointer;padding:10px}
.theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle:hover{background:var(--theme-hover)}
.theme-toggle:focus-visible{outline:3px solid #92ab9d;outline-offset:3px}
.auth-theme-toggle{position:fixed;top:max(18px,env(safe-area-inset-top));right:max(18px,env(safe-area-inset-right));z-index:5}
.mac-header .theme-toggle{margin-left:auto}
html[data-theme=dark],html[data-theme=dark] body{background:var(--theme-bg);color:var(--theme-text)}
html[data-theme=dark] :is(.sidebar,.column,.task-pane,.create-main,.detail-meta,.profile-dialog,.task-chat,.create-chat,.auth-card~*,#cloudLoading){background:var(--theme-soft);color:var(--theme-text)}
html[data-theme=dark] :is(dialog,.task-details,.task-create,.task-card,.team-card,.document-card,.task-files,.create-file-section,.create-description,.create-people,.comment-composer,.chat-header,.chat-search,.create-actions,.create-chat>header,.profile-dialog-header,.profile-read-grid,.profile-read-about,.project-dialog,.notification-panel,.notification-item,.pwa-dialog,.deadline-picker,.rich-editor,.auth-card,.sync-recovery,.stage-ghost,.trash-file-row){background:var(--theme-panel);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] :is(.task-pane-header,.detail-top,.task-actionbar,.project-dialog-footer,.profile-form-footer){background:#22262cf5;color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] dialog:not(.image-preview-dialog)::backdrop{background:#06090bb3}
html[data-theme=dark] :is(.document-row,.create-row,.task-labels,.task-crumb,.detail-breadcrumb,.breadcrumb,.save-state,.nav-label,.nav-count,.column-count,.column-grip,.date,.card-project,.task-card .description,.page-footer,.board-summary,.empty-state,.team-header,.team-meta,.field,.detail-meta-field,.detail-created,.document-created,.discussion-local,.discussion-empty,.comment-as,.composer-footer>span,.task-action-note,.file-hint,.file-download span,.card-file-count,.profile-photo-hint,.profile-read-grid span,.project-hint,.project-member-row small,.project-role-badge,.deleted-project-list span,.stage-intro,.stage-position,.stage-row>small,.move-task-hint,.pwa-dialog p,.pwa-caption,.notification-kind,.notification-change,.notification-copy small,.notification-empty,.calendar-weekdays,.calendar-presets span,.calendar-footer button,.auth-note,.intro,.rich-editor-footer,.chat-file-tools>span,.trash-file-info span){color:var(--theme-muted)}
html[data-theme=dark] :is(.breadcrumb strong,.detail-breadcrumb span:last-child,.nav-item,.icon-button,.text-button,.view-tab,.select-wrap,.select-wrap select,.search,.search input,.detail-person,.detail-meta-value,.detail-section-label,.detail-section-label .text-button,.detail-prose,.task-description .detail-prose,.document-row>.detail-person,.chat-header h3,.comment-meta strong,.comment-body p,.task-chat .comment-meta strong,.task-chat .comment-body p,.comment-composer textarea,.create-header h2,.create-chat>header strong,.create-chat-empty h3,.file-section-heading h3,.file-section-heading>strong,.file-download strong,.team-meta strong,.team-card p,.profile-hero p,.profile-read-grid strong,.profile-read-about,.team-card .team-position,.project-dialog h3,.move-task-title,.rich-toolbar button,.help-copy,.help-copy strong,.notification-copy strong,.deadline-trigger.has-date,.mac-page h1,.mac-page h2,.mac-page strong){color:var(--theme-text)}
html[data-theme=dark] :is(.nav-item.active,.nav-item:hover,.icon-button:hover,.text-button:hover,.secondary,.secondary:hover,.help kbd,.search kbd,.avatar-stack .more-avatars,.progress-track,.list-table th,.list-table tr[data-task]:hover,.stage-row-actions .icon-button,.card-drag-handle:hover,.card-drag-handle:active,.notification-bell:hover,.notification-bell[aria-expanded=true],.notification-item:hover,.notification-more:hover,.rich-toolbar button:hover,.rich-toolbar button:focus-visible,.calendar-heading .calendar-arrow:hover){background:var(--theme-hover);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] .view-tab.active{color:var(--theme-text)}
html[data-theme=dark] .view-tab.active:after{background:var(--theme-text)}
html[data-theme=dark] .primary{background:#b9cbb4;color:#172017}
html[data-theme=dark] .primary:hover{background:#cfddca}
html[data-theme=dark] :is(.task-actionbar>.primary,.detail-task-actions .primary,.create-actions>.primary,.task-chat .composer-footer .primary){background:#a9c2a3;color:#172017}
html[data-theme=dark] .primary:disabled,html[data-theme=dark] .task-chat .composer-footer .primary:disabled{background:var(--theme-hover);color:var(--theme-muted)}
html[data-theme=dark] :is(.field input,.field textarea,.field select,.profile-dialog .field input,.profile-dialog .field textarea,.document-row select,.document-row input,.create-row select,.create-row input,.detail-meta-field select,.detail-meta-field input,.chat-search input,.stage-name-input,.project-member-row select,.rich-link-panel input,.deadline-trigger){background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#99a3b0}
html[data-theme=dark] input[type=checkbox]{accent-color:#a9c2a3}
html[data-theme=dark] :is(.document-row select,.document-row input):hover,html[data-theme=dark] :is(.create-row select,.create-row input):hover{background:var(--theme-hover);border-color:#69796b}
html[data-theme=dark] .title-field input{background:transparent;border-color:transparent}
html[data-theme=dark] :is(.column,.profile,.avatar,.card-bottom,.team-meta,.list-table td,.dialog-actions,.detail-grid,.detail-meta,.task-discussion,.document-created,.task-chat,.chat-header,.create-chat,.create-actions,.stage-row,.profile-form-footer,.profile-access,.project-dialog-header,.project-dialog-footer,.project-member-list,.project-member-row,.deleted-project-list article,.notification-panel>header,.pwa-heading,.pwa-install,.pwa-toggle,.calendar-footer,.calendar-presets,.rich-toolbar,.rich-editor-footer,.rich-link-panel,.mac-header,.mac-steps,.mac-steps article,.mac-page footer){border-color:var(--theme-line)}
html[data-theme=dark] :is(.divider,.detail-meta-divider,.rich-tool-divider){background:var(--theme-line)}
html[data-theme=dark] .task-card:hover{border-color:#617168;box-shadow:0 5px 18px #0003}
html[data-theme=dark] :is(.column.drag-over,.stage-target){background:#29392e}
html[data-theme=dark] .task-chat .discussion-messages{background:none}
html[data-theme=dark] .task-chat .comment-body{background:#292e35;border-color:var(--theme-line)}
html[data-theme=dark] .task-chat .is-mine .comment-body{background:#2c3b31;border-color:#405544}
html[data-theme=dark] .task-chat .comment-meta time{color:#a8b4aa}
html[data-theme=dark] :is(.task-chat .reply-preview,.reply-preview,.comment-body blockquote,.rich-content blockquote,.rich-description blockquote,.file-tile,.task-chat .file-tile,.upload-item,.rich-file,.rich-image,.rich-toolbar,.card-cover){background:var(--theme-soft);border-color:var(--theme-line);color:var(--theme-text)}
html[data-theme=dark] :is(.file-thumb,.file-type,.profile-department,.profile-pending,.pwa-hint,.pwa-status,.chat-title-icon,.chat-header h3>span,.task-labels .detail-project,.detail-project,.notification-event-icon,.notification-item.is-unread,.restore,.rich-link-panel button,.rich-toolbar button.rich-attach){background:var(--theme-tint);border-color:#405544;color:var(--theme-accent)}
html[data-theme=dark] :is(.file-section-heading>.text-button,.file-download strong,.file-type,.chat-file-tools .text-button,.upload-item strong,.profile-photo-actions button,.pwa-guide-link,.pwa-dialog .pwa-notice,.notification-more,.notification-copy .notification-snippet,.rich-content a,.rich-description a,.edit-document,.list-stage,.comment-reply,.reply-preview strong,.file-trash-page .trash-file-status,.auth-links a){color:var(--theme-accent)}
html[data-theme=dark] :is(.upload-item span,.reply-preview span,.comment-body blockquote strong,.profile-pending p,.chat-header p,.discussion-header h3 span,.profile small,.profile svg){color:var(--theme-muted)}
html[data-theme=dark] :is(.upload-error,.project-delete-confirm,.stage-error){background:#3c2d28;border-color:#775144;color:#efb8a1}
html[data-theme=dark] :is(.upload-error span,.file-notice,.profile-notice,.project-form-error,.file-trash-error,.notification-error,.auth-error,.description-limit,.danger,.project-delete-button,.document-overdue,.date.urgent,.detail-overdue,.project-delete-confirm p){color:#e5a88f}
html[data-theme=dark] .important-mark{background:#4a302c;color:#f0b19b}
html[data-theme=dark] .project-delete-confirm .primary{background:#d5a48f;color:#261b16}
html[data-theme=dark] .notification-bell{color:var(--theme-text)}
html[data-theme=dark] .notification-badge{background:#c4d4bf;color:#172017;border-color:var(--theme-bg)}
html[data-theme=dark] .pwa-toggle input{background:#4c5560}
html[data-theme=dark] .pwa-toggle input:checked{background:#91ad85}
html[data-theme=dark] .pwa-status.is-on{background:#2e4433;color:#bfd6b7}
html[data-theme=dark] .calendar-presets button{border-color:#465765;color:var(--theme-text)}
html[data-theme=dark] :is(.calendar-presets button:hover,.calendar-grid .calendar-day:hover){background:#293d4a;color:#9bdcff}
html[data-theme=dark] .calendar-grid .calendar-day.other-month{color:#737f90}
html[data-theme=dark] .calendar-grid .calendar-day.weekend{color:#fa9aa4}
html[data-theme=dark] .calendar-grid .calendar-day.selected{background:#46bce5;color:#10252e}
html[data-theme=dark] .calendar-grid .calendar-day.today:not(.selected){color:#79d4f8}
html[data-theme=dark] .kanban-scroll-arrow{background:#22262cb3;color:#d1e1cf;border-color:#64756566}
html[data-theme=dark] .kanban-scroll-arrow:hover{background:#323a43e6}
html[data-theme=dark] :is(.brand .brand-logo,.auth-brand .brand-logo,.mac-header img){filter:brightness(0) invert(1)}
html[data-theme=dark] :is(.tag,.tag-system){background:#33364d;color:#c3c9ec}
html[data-theme=dark] .tag-brand{background:#45382e;color:#dfc1a7}
html[data-theme=dark] .tag-research{background:#304032;color:#bbd1b1}
html[data-theme=dark] .tag-graphic{background:#49343d;color:#e3b9cc}
html[data-theme=dark] .member-pending{color:var(--theme-muted)!important}
html[data-theme=dark] :is(.mac-steps,.mac-icon){border-color:var(--theme-line)}
html[data-theme=dark] :is(.mac-page p,.mac-label,.header-link,.mac-page footer){color:var(--theme-muted)}
html[data-theme=dark] :is(.menu-path,.step-number){background:var(--theme-panel);border-color:var(--theme-line);color:var(--theme-accent)}
/* The image viewer is already dark in both themes; never filter user images. */
html[data-theme=dark] .image-preview-dialog{background:#202223;color:#fff;border-color:#ffffff15}
@media(max-width:600px){.topbar-right .theme-toggle{width:36px;height:36px;min-width:36px;border-radius:11px;padding:8px}.topbar-right{gap:8px}.breadcrumb{min-width:0}.breadcrumb strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.auth-theme-toggle{top:12px;right:12px}}
