/* Device preference, with the original document colours deliberately unchanged. */
[data-theme-picker] { position: relative; flex: 0 0 40px; margin-left: 8px; }
.theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; list-style: none; cursor: pointer; }
.theme-toggle::-webkit-details-marker { display: none; }
.theme-toggle > span { display: grid; place-items: center; }
.theme-toggle > [hidden] { display: none; }
.theme-toggle svg { width: 19px; height: 19px; }
.theme-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 100; width: 222px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-strong); }
.theme-menu legend { float: left; width: 100%; margin: 0 0 8px; padding: 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; }
.theme-menu label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px; border: 1px solid transparent; border-radius: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.theme-menu label:hover { background: var(--surface-strong); }
.theme-menu label:has(:checked) { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
.theme-menu input { width: 16px; height: 16px; margin: 0; order: 2; margin-left: auto; accent-color: var(--teal); }
.theme-menu svg { width: 18px; height: 18px; flex: none; }
.auth-screen { position: relative; }
.auth-theme-picker { position: absolute; top: 16px; right: 16px; z-index: 3; }
.auth-theme-picker .theme-menu { left: auto; right: 0; }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141618;
  --surface: #1c1f22;
  --surface-strong: #25292d;
  --text: #edf0f3;
  --muted: #b1bbc4;
  --line: #383e44;
  --teal: #70d2b4;
  --teal-soft: #223c34;
  --blue: #99c1f2;
  --blue-soft: #263748;
  --green: #85d4a9;
  --green-soft: #243b30;
  --amber: #ebc575;
  --amber-soft: #423924;
  --red: #f3a0a4;
  --red-soft: #482c32;
  --gold: #e4bf72;
  --gold-deep: #e4bf72;
  --gold-soft: #3e3525;
  --violet: #c4afe2;
  --violet-soft: #373043;
  --rose: #eda9c3;
  --rose-soft: #442e39;
  --ink: #e5e8eb;
  --shadow: 0 2px 8px #0002;
  --shadow-strong: 0 16px 48px #0006;
}
html[data-theme="dark"] :is(body, .app-shell, .workspace, .auth-screen, .boot-screen) { background: var(--bg); color: var(--text); }
html[data-theme="dark"] * { scrollbar-color: #606a73 transparent; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb { background-color: #606a73; }
html[data-theme="dark"] ::selection { color: #f4fff9; background: #386354; }
html[data-theme="dark"] :is(button, summary, a, input, select, textarea):focus-visible { outline-color: #70d2b4; }
html[data-theme="dark"] :is(.sidebar, .app-shell.sidebar-collapsed .sidebar) { background: #191b1e; border-color: var(--line); }
html[data-theme="dark"] .topbar { background: #191b1ef5; border-color: var(--line); }
html[data-theme="dark"] :is(.brand strong, .side-panel strong, .workspace-context-copy strong) { color: var(--text); }
html[data-theme="dark"] :is(.brand span, .nav-section-label, .nav-item, .workspace-more-button, .panel-label, .workspace-context-copy small) { color: var(--muted); }
html[data-theme="dark"] :is(.nav-item:hover, .sidebar-profile-button:hover, .workspace-day-counts button:hover) { background: var(--surface-strong); color: var(--text); }
html[data-theme="dark"] :is(.nav-item.is-active, .workspace-more-button.is-active) { background: var(--teal-soft); color: var(--teal); }
html[data-theme="dark"] :is(.nav-item svg, .sidebar-profile-button svg) { color: inherit; }
html[data-theme="dark"] :is(.nav-item[data-view="documents"] svg, .nav-item[data-view="workApprovals"] svg, .nav-item[data-view="deadlines"] svg, .nav-item[data-view="actionGuides"] svg) { color: var(--muted); }
html[data-theme="dark"] .nav-item.is-active svg { color: var(--teal); }
html[data-theme="dark"] :is(.side-panel, .sidebar-profile-button) { background: transparent; border-color: var(--line); }
html[data-theme="dark"] .workspace-day-counts button { background: var(--surface-strong); color: var(--muted); }
html[data-theme="dark"] .workspace-day-counts .has-overdue b { color: var(--red); }

/* Common surfaces and form controls, including the legacy task dialogs. */
html[data-theme="dark"] :is(dialog, .panel, .auth-card, .boot-card, .metric-card,
  .task-card, .task-board .task-card, .personal-task-card, .controlled-request-card,
  .approval-card, .action-guide-card, .user-card, .doc-card,
  .notification-popover, .notification-item, .notification-preview-item,
  .dialog-header, .dialog-actions, .task-dialog form, .dialog-body,
  .workspace-nav-dialog, .documentation-create-dialog,
  .documentation-content, .documentation-commandbar, .documentation-file-card,
  .file-preview-dialog, .file-preview-header, .file-preview-body, .file-preview-shell,
  .attachment-drawer, .attachment-list, .attachment-file, .attachment-preview-panel,
  .attachment-preview-header, .attachment-preview-shell, .attachment-preview-empty,
  .attachment-preview-loading, .file-preview-loading, .letter-summary-item) {
  color: var(--text); background: var(--surface); border-color: var(--line); background-image: none;
}
html[data-theme="dark"] :is(.task-column, .approval-summary-item, .action-guide-overview > div,
  .personal-create-summary, .personal-task-summary, .file-picker, .attachment-summary,
  .letter-summary-section, .documentation-sidebar, .documentation-folder-card) {
  background: var(--surface-strong); color: var(--text); border-color: var(--line); background-image: none;
}
html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  background: #181b1e; color: var(--text); border-color: #4b545c; caret-color: var(--teal); box-shadow: none;
}
html[data-theme="dark"] :is(input, textarea)::placeholder { color: #9aa5af; opacity: 1; }
html[data-theme="dark"] :is(input, select, textarea):disabled { color: var(--muted); opacity: .7; }
html[data-theme="dark"] :is(input, select, textarea):focus { border-color: var(--teal); }
html[data-theme="dark"] input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: inset 0 0 0 1000px #181b1e; }
html[data-theme="dark"] :is(.secondary-button, .icon-button, .ghost-button, .theme-toggle) { color: var(--text); background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] :is(.secondary-button, .icon-button, .ghost-button, .theme-toggle):hover { color: var(--text); background: #30363b; border-color: #62726e; }
html[data-theme="dark"] .primary-button { background: #85d6ba; border-color: #85d6ba; color: #122b23; box-shadow: none; }
html[data-theme="dark"] .primary-button:hover { background: #a0e4cc; border-color: #a0e4cc; }
html[data-theme="dark"] :is(.danger-button, .icon-button.danger) { color: var(--red); background: var(--red-soft); border-color: #75434b; }
html[data-theme="dark"] :is(#notifyButton, #topLogoutButton, .workspace-sidebar-toggle) { color: var(--muted); background: transparent; }
html[data-theme="dark"] :is(.search-field, .approval-search, .action-guide-search, .documentation-search,
  .request-content-search-row, .request-customer-filter, .request-sort-field) { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] :is(.search-field, .approval-search, .action-guide-search, .documentation-search, .request-content-search-row, .request-sort-field, .request-customer-filter) :is(input, select) { background: transparent; }
html[data-theme="dark"] :is(.dialog-header p, .panel-header p, .request-result-summary,
  .request-content-search-row label > span, .request-customer-filter > span, .request-sort-field > span,
  .request-contractor-toolbar-title small, .request-contractor-group-copy small,
  .request-desktop-row td small, .documentation-item-copy small, .documentation-items-label,
  .documentation-sidebar-title, .document-name-field, .document-format-options legend,
  .document-format-options small, .document-create-location, .file-convert-note) { color: var(--muted); }
html[data-theme="dark"] dialog::backdrop { background: #050709b3; }
html[data-theme="dark"] .toast, html[data-theme="dark"] .toast[popover] { background: #d6efe4; color: #1b3329; border: 1px solid #98cfb8; }
html[data-theme="dark"] :is(.metric-card:hover, .task-board .task-card:hover, .documentation-file-card:hover,
  .documentation-folder-card:hover, .approval-card:hover, .action-guide-card:hover) { background: #252c2c; border-color: #5b756c; }

/* Journal: calm rows, with colour reserved for deadlines and status. */
html[data-theme="dark"] .request-focus-button { color: var(--muted); }
html[data-theme="dark"] .request-focus-button:hover { background: var(--surface); }
html[data-theme="dark"] .request-focus-button strong { background: var(--surface-strong); color: var(--muted); }
html[data-theme="dark"] .request-focus-button.is-selected { color: var(--teal); border-color: var(--teal); }
html[data-theme="dark"] .request-focus-button.is-selected strong { background: var(--teal-soft); color: var(--teal); }
html[data-theme="dark"] .request-focus-button[data-request-focus="overdue"] strong { background: var(--red-soft); color: var(--red); }
html[data-theme="dark"] :is(#requests th, th) { background: var(--surface-strong); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] #requests .request-desktop-row td { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] #requests .request-desktop-row:hover td { background: #252c2c; }
html[data-theme="dark"] :is(.request-contractor-group-button, .request-contractor-group-row.is-overdue .request-contractor-group-button, .request-contractor-group-row.is-soon .request-contractor-group-button) { background: #26322e; color: var(--text); }
html[data-theme="dark"] .request-contractor-group-button:hover { background: #2e3e36; }
html[data-theme="dark"] :is(.request-contractor-group-icon, .request-contractor-toolbar-icon, .request-contractor-stat) { background: var(--surface); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] .request-contractor-stat.overdue { background: var(--red-soft); color: var(--red); }
html[data-theme="dark"] :is(.request-desktop-row td > strong, .request-mobile-number-line > strong) { color: var(--muted); }
html[data-theme="dark"] .request-point-inline { color: var(--blue); background: var(--blue-soft); }
html[data-theme="dark"] :is(.request-mobile-tab, .request-mobile-panel) { color: var(--text); background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .request-mobile-deadline { background: var(--surface-strong); }
html[data-theme="dark"] .deadline-clear { --deadline-accent: #a4aeb7; --deadline-tint: #25292d; }
html[data-theme="dark"] .deadline-warn { --deadline-accent: #f3d679; --deadline-tint: #443d25; }
html[data-theme="dark"] .deadline-orange { --deadline-accent: #f2b87b; --deadline-tint: #493725; }
html[data-theme="dark"] .deadline-hot { --deadline-accent: #ff9d89; --deadline-tint: #4d302b; }
html[data-theme="dark"] .deadline-danger { --deadline-accent: #ff8b99; --deadline-tint: #522b36; }
html[data-theme="dark"] .deadline-overdue { --deadline-accent: #ffc3d2; --deadline-tint: #642a3d; }
html[data-theme="dark"] :is(.pill.deadline-pill, .request-mobile-deadline) { background: var(--deadline-tint, var(--surface-strong)); color: var(--deadline-accent, var(--muted)); border-color: var(--deadline-accent, var(--line)); }
html[data-theme="dark"] .deadline-surface { background: var(--surface); border-color: var(--deadline-accent, var(--line)); }
html[data-theme="dark"] .deadline-surface .personal-task-summary { background: var(--deadline-tint, var(--surface-strong)); }
html[data-theme="dark"] :is(.request-mobile-tab, .task-card).deadline-surface { border-left-color: var(--deadline-accent, var(--line)); }
html[data-theme="dark"] .timeline-bar { background: var(--deadline-accent, var(--teal)); }
html[data-theme="dark"] .metric-icon { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] .metric-card:nth-child(2) .metric-icon { color: var(--blue); background: var(--blue-soft); }
html[data-theme="dark"] .metric-card:nth-child(3) .metric-icon { color: var(--amber); background: var(--amber-soft); }
html[data-theme="dark"] .metric-card:nth-child(4) .metric-icon { color: var(--red); background: var(--red-soft); }

/* Folder hierarchy keeps distinct closed, expanded, current and favourite states. */
html[data-theme="dark"] :is(.documentation-tree-button, .documentation-root-button, .documentation-breadcrumbs button) { color: var(--muted); }
html[data-theme="dark"] :is(.documentation-tree > .documentation-tree-node, .documentation-tree .documentation-tree-children) { border-color: var(--line); }
html[data-theme="dark"] .documentation-tree-children > .documentation-tree-node > .documentation-tree-row::before { background: var(--line); }
html[data-theme="dark"] .documentation-tree .documentation-tree-button { background: transparent; color: var(--muted); }
html[data-theme="dark"] .documentation-tree .documentation-tree-button:hover { background: #30363c; border-color: #526375; }
html[data-theme="dark"] :is(.documentation-tree .documentation-tree-chevron, .documentation-tree-add) { color: var(--muted); background: var(--surface); border-color: #525f6a; }
html[data-theme="dark"] .documentation-tree .documentation-tree-button > svg { color: #99b2c9; fill: #2e3a44; }
html[data-theme="dark"] .documentation-tree-node.is-open > .documentation-tree-row > .documentation-tree-button { background: var(--blue-soft); color: var(--blue); border-color: #475e73; }
html[data-theme="dark"] .documentation-tree-node.is-open > .documentation-tree-row .documentation-tree-chevron { background: #3a5673; color: #e3f1ff; border-color: #6686a4; }
html[data-theme="dark"] .documentation-tree-node.is-open > .documentation-tree-row > .documentation-tree-button > svg { color: var(--blue); fill: #334b63; }
html[data-theme="dark"] .documentation-tree-node.is-current > .documentation-tree-row > .documentation-tree-button.is-active { background: var(--teal-soft); color: var(--teal); border-color: #578c76; box-shadow: inset 3px 0 var(--teal); }
html[data-theme="dark"] .documentation-tree-node.is-current > .documentation-tree-row .documentation-tree-chevron { background: #35634e; color: #e1fff0; border-color: #6bb194; }
html[data-theme="dark"] .documentation-tree-node.is-current > .documentation-tree-row > .documentation-tree-button > svg { color: var(--teal); fill: #335644; }
html[data-theme="dark"] .documentation-tree .documentation-tree-button small { color: var(--muted); }
html[data-theme="dark"] .documentation-root-button.is-active { color: var(--blue); background: var(--blue-soft); }
html[data-theme="dark"] :is(.documentation-favorites-nav.is-active, .documentation-favorite-button.is-favorite) { color: var(--gold); background: var(--gold-soft); border-color: #756444; }
html[data-theme="dark"] :is(.documentation-favorites-nav strong, .documentation-favorites-nav.is-active strong) { background: var(--surface); color: var(--gold); }
html[data-theme="dark"] :is(.documentation-favorites-nav:hover, .documentation-favorite-button:hover) { background: #4a3f2c; color: var(--gold); }
html[data-theme="dark"] :is(.documentation-favorites-nav > svg, .documentation-favorite-button.is-favorite svg) { color: var(--gold); }
html[data-theme="dark"] .documentation-folder-icon { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] .documentation-file-icon { background: var(--green-soft); color: var(--green); }
html[data-theme="dark"] .documentation-file-icon:has(svg.lucide-file-text) { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] .documentation-item-copy .documentation-location { color: var(--blue); }
html[data-theme="dark"] :is(.documentation-estimate-total, .file-total-slot .file-total-badge) { background: var(--teal-soft); border-color: #4d7966; color: var(--teal); }
html[data-theme="dark"] :is(.documentation-estimate-label, .documentation-estimate-amount strong,
  .documentation-estimate-value.is-counted, .documentation-estimate-details > summary, .file-ocr-slot .file-ocr-status.ready) { color: var(--teal); }
html[data-theme="dark"] :is(.documentation-estimate-heading small, .documentation-estimate-status, .documentation-estimate-file small, .documentation-estimate-value) { color: var(--muted); }
html[data-theme="dark"] :is(.documentation-estimate-file, .documentation-estimate-status .is-pending) { color: var(--blue); }
html[data-theme="dark"] :is(.documentation-estimate-status .is-review, .documentation-estimate-value.is-review, .documentation-estimate-partial, .file-total-slot .file-total-review, .file-ocr-slot .file-ocr-status.needs-review) { color: var(--amber); }
html[data-theme="dark"] .documentation-estimate-row { border-color: #416251; }
html[data-theme="dark"] .documentation-estimate-amount .icon-button { background: var(--surface); color: var(--teal); border-color: #4d7966; }
html[data-theme="dark"] .documentation-upload-status { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] #workspaceNavItems button { color: var(--text); background: var(--surface-strong); }
html[data-theme="dark"] #workspaceNavItems button[aria-current] { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] .document-format-options label { border-color: var(--line); }
html[data-theme="dark"] .document-format-options label:has(input:checked) { background: var(--teal-soft); border-color: var(--teal); }
html[data-theme="dark"] .document-format-options strong { color: var(--text); }
html[data-theme="dark"] .document-format-icon.excel { background: var(--green-soft); color: var(--green); }
html[data-theme="dark"] .document-format-icon.word { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] .document-create-error { background: var(--red-soft); color: var(--red); }

html[data-theme="dark"] :is(.request-command-center, .request-contractor-toolbar, .table-wrap,
  .documentation-shell, .documentation-folder-tools, .documentation-dropzone,
  .approval-toolbar, .action-guide-toolbar, .action-guide-overview) { background: var(--bg); border-color: var(--line); }
html[data-theme="dark"] :is(.request-contractor-toggle-all, .request-sort-direction, .personal-task-summary-date) { background: var(--surface-strong); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] :is(.documentation-item-copy strong, .documentation-breadcrumbs strong) { color: var(--text); }
html[data-theme="dark"] :is(.push-mini-status-card, .push-mini-status-card.warn) { background: var(--amber-soft); border-color: #756444; color: var(--amber); }
html[data-theme="dark"] .push-mini-status-card.ok { background: var(--green-soft); border-color: #4d7966; color: var(--green); }
html[data-theme="dark"] :is(.action-guide-card > summary, .action-guide-summary-facts > span, .approval-card-actions) { background: var(--surface-strong); border-color: var(--line); }
html[data-theme="dark"] .action-guide-category { color: var(--teal); }
html[data-theme="dark"] .action-guide-overview > div > span { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] .action-guide-overview > div:nth-child(2) > span { color: var(--amber); background: var(--amber-soft); }
html[data-theme="dark"] .action-guide-overview > div:nth-child(3) > span { color: var(--green); background: var(--green-soft); }
html[data-theme="dark"] :is(.approval-summary-item, .approval-status, .approval-card, .approval-history-item) { --approval-color: var(--muted); --approval-soft: var(--surface-strong); }
html[data-theme="dark"] :is(.approval-summary-item, .approval-status, .approval-card, .approval-history-item).is-pending { --approval-color: var(--amber); --approval-soft: var(--amber-soft); }
html[data-theme="dark"] :is(.approval-summary-item, .approval-status, .approval-card, .approval-history-item).is-approved { --approval-color: var(--green); --approval-soft: var(--green-soft); }
html[data-theme="dark"] :is(.approval-summary-item, .approval-status, .approval-card, .approval-history-item).is-rejected { --approval-color: var(--red); --approval-soft: var(--red-soft); }
html[data-theme="dark"] .approval-card-main:hover { background: var(--surface-strong); }
html[data-theme="dark"] .approval-card-meta .is-overdue :is(strong, svg) { color: var(--red); }
html[data-theme="dark"] .approval-card-meta .is-due-soon :is(strong, svg) { color: var(--amber); }
html[data-theme="dark"] #requests .table-wrap { background: var(--bg); }
html[data-theme="dark"] :is(.documentation-folder-tools strong, .action-guide-summary-facts strong) { color: var(--text); }
html[data-theme="dark"] :is(.edit-section, .request-workflow-section, .request-reminder-section, .route-autofill-panel) { background: var(--surface-strong); background-image: none; border-color: var(--line); }
html[data-theme="dark"] .route-autofill-panel[data-status="partial"] { background: var(--amber-soft); border-color: #756444; }
html[data-theme="dark"] .route-autofill-panel[data-status="error"] { background: var(--red-soft); border-color: #75434b; }
html[data-theme="dark"] .attachment-tabs button { background: var(--surface-strong); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] .attachment-tabs button.is-selected { background: var(--teal-soft); color: var(--teal); border-color: #578c76; }
html[data-theme="dark"] .attachment-file.is-selected { background: var(--teal-soft); border-color: #578c76; }
html[data-theme="dark"] .alert-item.done { background: var(--green-soft); }
html[data-theme="dark"] .alert-item.warn { background: var(--amber-soft); }
html[data-theme="dark"] .alert-item.danger { background: var(--red-soft); }
html[data-theme="dark"] :is(.action-guide-dialog-body, .action-guide-step-editor-row > header,
  .action-guide-step-options, .action-guide-reference-empty, .action-guide-step-state) { background: var(--surface-strong); color: var(--muted); border-color: var(--line); }
html[data-theme="dark"] :is(.action-guide-editor-section, .action-guide-step-editor-row,
  .action-guide-step-editor-grid, .action-guide-step-options-grid, .action-guide-template-list,
  .action-flow-node.is-reference, .action-guide-step.is-reference) { background: var(--surface); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] :is(.action-guide-template-copy strong, .action-guide-step-editor-summary strong) { color: var(--text); }
html[data-theme="dark"] :is(.action-guide-form-grid > label > span > small, .action-guide-step-options > summary,
  .action-guide-step-options-grid > label, .action-guide-existing-heading, .action-guide-step-copy > p) { color: var(--muted); }
html[data-theme="dark"] :is(.action-guide-step-editor-number, .action-guide-step-editor-status) { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] :is(.action-guide-template-icon, .action-guide-step-number,
  .action-guide-existing-heading span, .action-guide-template-picker) { background: var(--teal-soft); color: var(--teal); border-color: #578c76; }
html[data-theme="dark"] .action-flow-node.is-reference .action-flow-state { color: var(--teal) !important; background: var(--teal-soft); }
html[data-theme="dark"] :is(.action-guide-editor-section-heading strong, .action-guide-step-builder-heading strong) { color: var(--text); }
html[data-theme="dark"] .action-guide-form-grid > label > span { color: var(--muted); }
html[data-theme="dark"] .action-guide-form-grid > label > span > b { color: var(--red); }
html[data-theme="dark"] #actionGuideStepCount { color: var(--teal); }
html[data-theme="dark"] :is(.request-mobile-field, .request-mobile-note) { background: var(--surface-strong); border-color: var(--line); }

@media (min-width: 761px) and (max-width: 1100px) {
  .workspace-context { display: flex; flex: 0 0 auto; min-width: 40px; }
  .workspace-context [data-theme-picker] { margin-left: 0; }
}

@media (max-width: 760px) {
  .auth-screen { padding-top: 72px; }
  .workspace-context { width: 100%; }
  .workspace-context [data-theme-picker] { margin-left: auto; }
  .workspace-context .theme-toggle { width: 40px; height: 40px; }
  .workspace-context .theme-menu { left: auto; right: 0; }
}
@media print {
  [data-theme-picker] { display: none; }
}

html[data-theme="dark"] {
  --ui-rail: #191c1f;
  --ui-hover: #29333e;
  --ui-active: #26394d;
  --ui-active-text: #bbd9f8;
  --ui-subtle: #23282c;
  --ui-focus: #91bfe9;
}
html[data-theme="dark"] .nav-item.is-active { background: var(--ui-active); color: var(--ui-active-text); box-shadow: inset 3px 0 var(--ui-focus); }
html[data-theme="dark"] .user-avatar-initials.tone-gold { background: var(--teal-soft); color: var(--teal); }
html[data-theme="dark"] .workspace-day-counts button { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .request-contractor-group-button,
html[data-theme="dark"] .request-contractor-group-row.is-overdue .request-contractor-group-button,
html[data-theme="dark"] .request-contractor-group-row.is-soon .request-contractor-group-button { background: var(--ui-subtle); border-color: #46514d; }
html[data-theme="dark"] .request-contractor-stat { background: transparent; }
html[data-theme="dark"] .request-identity .request-point-primary { color: var(--blue); }
html[data-theme="dark"] .request-desktop-row .response-note { color: var(--teal); }
html[data-theme="dark"] .documentation-file-icon[data-file-kind="pdf"] { color: #e9a7af; background: #412d32; }
html[data-theme="dark"] .documentation-file-icon[data-file-kind="sheet"] { color: #a0dabc; background: #2a3b32; }
html[data-theme="dark"] .documentation-file-icon[data-file-kind="word"] { color: #a7c9eb; background: #2b3848; }
html[data-theme="dark"] .documentation-item-actions .icon-button { background: transparent; border-color: transparent; }
html[data-theme="dark"] .documentation-item-actions .icon-button:hover { background: var(--surface-strong); border-color: var(--line); }
html[data-theme="dark"] .documentation-item-actions .is-favorite { background: var(--gold-soft); color: var(--gold); }
html[data-theme="dark"] .documentation-estimate-total { background: #202c27; border-bottom-color: #3a5046; }
html[data-theme="dark"] .documentation-tree-add { background: transparent; border-color: transparent; }
html[data-theme="dark"] .primary-button { box-shadow: inset 0 1px 0 #ffffff30, 0 2px 4px #0002; }
html[data-theme="dark"] .control-tooltip { color: var(--text); background: #30383e; border-color: #65727b; }
html[data-theme="dark"] .journal-task.deadline-surface { border-color: var(--line); background: var(--surface); }
html[data-theme="dark"] .journal-task.deadline-surface:hover { border-color: var(--ui-focus); background: var(--ui-subtle); }
html[data-theme="dark"] .journal-density-toggle[aria-pressed="true"] { color: var(--teal); border-color: var(--ui-focus); background: var(--teal-soft); }
html[data-theme="dark"] .action-guide-content-heading > span { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] .action-guide-content-heading strong { color: var(--text); }
html[data-theme="dark"] .action-guide-description { color: var(--text); background: var(--ui-subtle); border-left-color: var(--teal); }
html[data-theme="dark"] .action-flow-node.is-reference .action-flow-number { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] .action-guide-summary-facts > span { background: transparent; }
@media (max-width: 760px) {
  [data-theme-picker] { flex-basis: 44px; }
  .theme-toggle { width: 44px; height: 44px; }
}
html[data-theme="dark"] .documentation-tree-add:hover { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .journal-view-switch button[aria-pressed="true"] { color: var(--ui-active-text); background: var(--ui-active); border-color: #4d7192; }
html[data-theme="dark"] .form-grid :is(input, select, textarea),
html[data-theme="dark"] .inline-form :is(input, select, textarea),
html[data-theme="dark"] .personal-task-editor :is(input, select, textarea) { border-color: #65727e; }
html[data-theme="dark"] .form-grid :is(input, select, textarea):focus,
html[data-theme="dark"] .inline-form :is(input, select, textarea):focus,
html[data-theme="dark"] .personal-task-editor :is(input, select, textarea):focus { border-color: var(--ui-focus); }
html[data-theme="dark"] .task-dialog .dialog-actions { background: var(--ui-subtle); }
html[data-theme="dark"] .file-total-slot .file-total-pending { color: var(--muted); }
html[data-theme="dark"] .file-total-slot .file-total-review { color: var(--amber); }
@media (max-width: 760px) {
  html[data-theme="dark"] .nav-item.is-active { box-shadow: none; }
  html[data-theme="dark"] .request-mobile-field { background: transparent; }
}
