/* Theme preference is applied before the first paint by theme.js. */
:root{color-scheme:light}
:root[data-theme=dark]{color-scheme:dark;--paper:#111923;--card:#1b2533;--ink:#e7edf5;--muted:#a6b3c5;--line:#3b4b60;--navy:#dce7f6;--blue:#8ebcff;--gold:#d4b775;--green:#76d9a3;--red:#ffaaa4;--shadow:0 14px 38px #0004;--theme-soft:#243244;--theme-hover:#2b3b50;--theme-link:#a7caff;--theme-primary:#315d96}
.theme-toggle{position:relative;display:inline-flex;align-items:center;flex:0 0 68px;width:68px;height:30px;padding:3px;border:1px solid #c9cfcb;border-radius:999px;background:#f6f7f4;cursor:pointer;box-shadow:inset 0 1px 2px #0000000c;vertical-align:middle}
.theme-toggle-thumb{display:grid;place-items:center;width:24px;height:24px;flex:none;border-radius:50%;background:#fff;color:#48534e;box-shadow:0 1px 3px #0002;transform:translateX(0);transition:transform .18s ease,background-color .18s ease}
.theme-icon-moon{display:none}
[data-theme=dark] .theme-toggle{background:#48554f;border-color:#64716a}
[data-theme=dark] .theme-toggle-thumb{transform:translateX(36px);background:#27352e;color:#d9e4dd}
[data-theme=dark] .theme-icon-sun{display:none}
[data-theme=dark] .theme-icon-moon{display:block}
.theme-toggle:focus-visible{outline:3px solid #a7caff;outline-offset:4px}
@media(prefers-reduced-motion:reduce){.theme-toggle-thumb{transition:none}}
@media(max-width:700px){.topbar .topbar-controls{grid-template-columns:auto minmax(0,1fr) auto auto;grid-template-areas:"theme profile bell gear" "feedback feedback feedback feedback";max-width:250px}.topbar .theme-toggle{grid-area:theme;width:54px;flex-basis:54px}.topbar .theme-toggle-thumb{width:22px;height:22px}[data-theme=dark] .topbar .theme-toggle-thumb{transform:translateX(24px)}}

html[data-theme=dark] body{background:var(--paper);color:var(--ink)}
html[data-theme=dark] .topbar{background:#0b1523}
html[data-theme=dark] :is(p,.project-workspace .message p,.project-workspace .action-card p,.rg-body,.rg-action,.rg-first-line,.rg-page-body,.fb-ticket-body,.fb-detail-body){color:#c4cfdd}
html[data-theme=dark] :is(h1,h2,h3,h4,.project-main strong,.project-author,.project-workspace .message-head>strong,.rg-page h1,.rg-page h2,.rg-page h3,.rg-label,.rg-page-block summary,.rg-guidance>summary,.nt-item-title,.nt-page-title,.fb-title,.fb-subtitle,.fb-label,.fb-ticket-title,.fb-preview-name,.fb-paste-title,.fb-shot-name,.rge-head h1,.rge-head h2,.rg-memo-head h2,.project-log-head h2,.project-log summary,.cp-jobs summary,.cp-job-detail summary,.cp-card summary){color:var(--ink)}
html[data-theme=dark] :is(.auth-card,.upload-card,.action-card,.project-row,.empty-state,.user-row,.accounts-page .account-record,.profile-page .profile-card,.pinned-file-card,.project-workspace .chat-shell,.composer,.project-workspace .composer,.technologist-notes,.project-log,.project-log-dialog,.settings-menu-panel,.topbar .profile-menu-panel,.nt-dropdown,.nt-dropdown-head,.nt-item-page,.nt-empty-page,.fb-form,.fb-ticket,.fb-detail-body,.fb-shot,.fb-status-card,.fb-empty,.rg-page,.rg-memo,.rg-addition,.rg-guidance-item,.rg-document,.rg-rule,.rge-editor,.rge-history,.rge-history-view,.cp-card,.cp-job-detail,.cp-jobs){background:var(--card);border-color:var(--line);color:var(--ink)}
html[data-theme=dark] :is(input,select,textarea,.auth-card .login-identity>input,.auth-card .login-identity>select,.fb-input,.cp-decision textarea,.project-workspace .composer textarea,.note-editor,.note-rich-editor,.project-owner-filters select){background:#15202e;color:var(--ink);border-color:#55667d;accent-color:#8ebcff}
html[data-theme=dark] :is(input,select,textarea,.auth-card .login-identity>input,.auth-card .login-identity>select,.fb-input,.cp-decision textarea,.project-workspace .composer textarea):focus{border-color:#8ebcff;outline-color:#8ebcff}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#9cabc0;opacity:1}
html[data-theme=dark] :is(.note-rich-editor:empty::before,.note-rich-editor[contenteditable=false]){color:var(--muted)}
html[data-theme=dark] :is(.button,.picker-button,.password-toggle,.profile-page .password-toggle,.project-workspace .archive-add-button,.project-log-close,.project-filter,.rg-memo-close,.rg-memo-error button,.fb-preview-remove,.rge-tool,.rge-select,.note-format-button,.cp-filters a){background:var(--theme-soft);color:var(--ink);border-color:#53657e}
html[data-theme=dark] :is(.button.primary,.button.primary:hover,.project-filter.is-active,.cp-filters .is-active,.rg-page .rg-pdf,.rg-search button,.rge-primary,.rge-primary:hover){background:var(--theme-primary);border-color:#5883b9;color:#fff}
html[data-theme=dark] .button.success{background:#216d4c;color:#fff;border-color:#4c9f74}
html[data-theme=dark] :is(.project-filter-count,.note-revision,.technologist-note .note-controls .note-revision,.file-kind,.file-kind.pdf,.attachment span,.project-workspace .attachment span,.rg-level,.rge-badge,.fb-kind){background:var(--theme-soft);color:#c0d4f0}
html[data-theme=dark] .project-filter.is-active .project-filter-count{background:#ffffff26;color:#fff}
html[data-theme=dark] :is(.archive-picker,.file-status,.ai-state,.note-history,.note-history-preview,.note-diff,.project-workspace .message,.message,.message.system,.project-log li,.project-log-events li,.frozen-note,.revision-selection,.manual-report,.report-ready-notice,.rg-search,.rg-regulation-body blockquote,.rg-rich blockquote,.rge-toolbar,.rge-history th,.rg-rich th,.cp-page blockquote,.cp-source,.cp-merged-sources,.fb-paste,.fb-preview,.fb-shot-img,.success-card){background:var(--theme-soft);color:#c4cfdd;border-color:var(--line)}
html[data-theme=dark] .project-workspace .message.own{background:#233b55;border-color:#46617e}
html[data-theme=dark] :is(.attachment,.project-workspace .attachment){background:#172331;color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.project-row:hover,.pinned-file-row:hover,.project-workspace .archive-add-button:hover,.project-log-close:hover,.password-toggle:hover,.profile-page .password-toggle:hover,.project-filter:hover,.accounts-page .account-summary:hover,.accounts-page .account-record[open]>.account-summary,.nt-item-button:hover,.topbar nav .profile-menu-panel a:hover,.topbar nav .profile-menu-panel .profile-menu-logout button:hover,.settings-menu-panel a:hover,.rge-tool:hover,.rge-select:hover,.fb-preview-remove:hover){background:var(--theme-hover)}
html[data-theme=dark] :is(.nt-item-button,.topbar nav .profile-menu-panel a,.topbar nav .profile-menu-panel .profile-menu-logout button,.topbar nav .settings-menu-panel a,.pinned-file-row){color:var(--ink)}
html[data-theme=dark] :is(.nt-item.nt-unread,.nt-item-page.nt-unread,.note-format-button[aria-pressed=true],.rge-tool[aria-pressed=true],.archive-picker.dragging){background:#223c58;color:var(--ink)}
html[data-theme=dark] :is(.rg-page a,.rge-link,.rge-history a,.file-open,.nt-all-link,.topbar nav .nt-all-link,.nt-read-all,.fb-shot-download,.rg-memo-error a,.cp-actions a,.cp-links a){color:var(--theme-link)}
html[data-theme=dark] :is(.rg-tab,.rg-tab--active){background:var(--theme-soft);color:var(--ink);border-color:#8ebcff}
html[data-theme=dark] :is(.rg-kicker,.rg-source,.rg-code,.rg-meta,.rg-lead,.rge-muted,.project-creator,.project-detail-header .project-creator,.profile-page .profile-note,.project-rights-note,.project-progress small,.project-main small,.project-meta,.project-meta small,.pinned-file-info small,.pinned-file-card h2,.file-empty,.project-workspace .message-head,.project-workspace .message-head time,.chat-heading small,.project-log-content>p,.project-log-body>p,.project-log-events time,.nt-item-body,.nt-item-time,.nt-item-state,.nt-empty,.nt-pagination,.rg-memo-status,.fb-lead,.fb-file-limits,.fb-preview-size,.fb-hint,.fb-note,.fb-ticket-meta,.fb-shot-meta,.fb-note,.cp-meta,.cp-job-row small,.cp-decision-result,.stage-list span,.review-eta,.revision-hint,.archive-busy-note,.project-workspace .archive-busy-note,.accounts-page .account-contacts,.accounts-page .account-meta,.accounts-page .account-edit-hint,.accounts-page .role-lock-note){color:var(--muted)}
html[data-theme=dark] .eyebrow{color:#d7bf81}
html[data-theme=dark] .rg-regulation-body{color:var(--ink)}
html[data-theme=dark] .rge-shell{--rge-border:var(--line);--rge-ink:var(--ink);--rge-muted:var(--muted);--rge-bg:var(--theme-soft);--rge-accent:var(--theme-link);color:var(--ink)}
html[data-theme=dark] :is(.rg-tabs,.rg-reading-actions,.chat-heading,.rg-memo-head,.project-log-head,.nt-dropdown-foot,.nt-item,.profile-menu-logout,.cp-decision,.cp-decision-result,.cp-comparison-row,.cp-job-row,.user-actions,.form-separator,.rge-history th,.rge-history td,.rg-rich th,.rg-rich td){border-color:var(--line)}
html[data-theme=dark] :is(progress,progress::-webkit-progress-bar){background:#344258}
html[data-theme=dark] :is(.project-state-pill.project-state-new,.project-state-pill.project-state-processing,.project-state-new,.project-state-processing,.status-badge.paused,.file-status.loading,.note-marker,.note-marker:hover,.note-conflict,.rg-alert,.cp-alert,.rge-rejected,.rg-memo-error,.fb-status-new){background:#40351f;color:#f0ce88;border-color:#8b7346}
html[data-theme=dark] :is(.project-state-pill.project-state-reviewed,.project-state-reviewed,.file-kind.pdf){background:#233d5a;color:#b5d5ff;border-color:#547ca8}
html[data-theme=dark] :is(.project-state-pill.project-state-closed,.project-state-closed,.current-report-label,.file-status.ready,.ai-state.ready,.fb-status-resolved,.accounts-page .account-status.is-active,.note-diff ins,.note-diff-legend ins,.rge-note){background:#1b3c30;color:#a7e9c4;border-color:#507f66}
html[data-theme=dark] :is(.project-state-error,.status-badge.error,.file-status.error,.project-log li.log-error,.project-log-events li.log-error,.dashboard-results-error,.rge-error,.note-diff del,.note-diff-legend del){background:#49282d;color:#ffc0bc;border-color:#a76b71}
html[data-theme=dark] :is(.note-status[data-state=error],.note-status[data-state=conflict],.note-status[data-state=closed],.revision-hint.error,.fb-hint-error,.nt-read-error,.project-log-events code,.project-log code){color:#ffc0bc}
html[data-theme=dark] :is(.note-status[data-state=saved],.revision-hint.success){color:#a7e9c4}
html[data-theme=dark] .note-status[data-state=dirty]{color:#f0ce88}
html[data-theme=dark] :is(.accounts-page .account-status.is-off,.fb-status-rejected){background:#303d50;color:#c3cfdf}
html[data-theme=dark] .nt-count{background:#c62828;color:#fff}
html[data-theme=dark] .status-badge{background:var(--theme-soft);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.technologist-note-body,.note-empty,.note-conflict-body){background:#192636;color:#c4cfdd;border-color:var(--line)}
html[data-theme=dark] progress::-webkit-progress-bar{background:#344258}
html[data-theme=dark] .profile-page .profile-note{background:var(--theme-soft);color:var(--muted);border-color:var(--line)}

.theme-save-notice{position:fixed;right:20px;bottom:20px;z-index:200;display:flex;align-items:center;gap:12px;max-width:calc(100vw - 40px);padding:14px 16px;border:1px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink);box-shadow:var(--shadow);font-size:13px}
.theme-save-notice button{border:1px solid var(--line);border-radius:7px;background:transparent;color:inherit;padding:7px 10px;font:inherit;cursor:pointer}
