:root[data-product="crm"][data-theme="dark"] {
  color-scheme:dark;
  --paper:#111416;
  --line:#343a3f;
  --muted:#aeb8bf;
  --ink:#f4f6f7;
  background:#111416;
}

[data-product="crm"][data-theme="dark"] body,
[data-product="crm"][data-theme="dark"] .main,
[data-product="crm"][data-theme="dark"] .page { background:#111416;color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] .sidebar { background:#171b1e;color:#f4f6f7;box-shadow:1px 0 #2d3439; }
[data-product="crm"][data-theme="dark"] .sidebar-brand-logo { filter:grayscale(1) brightness(0) invert(1); }
[data-product="crm"][data-theme="dark"] .topbar { background:#171b1ef2;border-bottom-color:#30363b; }
[data-product="crm"][data-theme="dark"] :is(h1,h2,h3,h4,strong,label,legend) { color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] :is(p,small,.muted,.eyebrow,.page-head>p,.panel-head p) { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] a { color:#f0cc62; }
[data-product="crm"][data-theme="dark"] :is(a,.project-open,.report-value-link,.report-account-link):hover { color:#ffe5a0; }
[data-product="crm"][data-theme="dark"] :is(button,a,input,select,textarea):focus-visible { outline-color:#f0cc62; }

/* Navigation items are anchors in the current shell. Keep them readable instead
   of inheriting the pale color from the retired sidebar implementation. */
[data-product="crm"] .nav [data-nav]:visited,
[data-product="crm"] .nav-link:visited { color:#29323a; }
[data-product="crm"][data-theme="dark"] .nav :is(button,[data-nav],.nav-link,.nav-direction) { color:#dce3e8; }
[data-product="crm"][data-theme="dark"] .nav [data-nav]:visited,
[data-product="crm"][data-theme="dark"] .nav-link:visited { color:#dce3e8; }
[data-product="crm"][data-theme="dark"] .nav :is(button,[data-nav],.nav-link,.nav-direction):hover:not(.active) { background:#252b2f;color:#fff; }
[data-product="crm"][data-theme="dark"] .nav :is(button,[data-nav],.nav-link).active { background:#ffc629;color:#111; }
[data-product="crm"][data-theme="dark"] .nav .nav-icon-box { background:#2a3034;color:#cbd4da; }
[data-product="crm"][data-theme="dark"] .nav .active .nav-icon-box { background:#fff1ad;color:#111; }
[data-product="crm"][data-theme="dark"] .nav-planned { color:#8e989f; }
[data-product="crm"][data-theme="dark"] :is(.nav-group,.nav-subgroup) { border-color:#343b40; }
[data-product="crm"][data-theme="dark"] :is(.nav-group>summary,.nav-subgroup>summary) { color:#b9c2c8; }
[data-product="crm"][data-theme="dark"] .blower-launch { background:#20262b;border-color:#3e587d;color:#9bc4ff; }

[data-product="crm"][data-theme="dark"] :is(.panel,.stat,.employee-card,.card,.account-card,.customer-card,.direction-card,.module-card,.login-card,dialog) { background:#1b1f22;color:#f4f6f7;border-color:#343a3f;box-shadow:none; }
[data-product="crm"][data-theme="dark"] :is(.panel-head,.panel-body,.panel-foot,.table-toolbar,.team-toolbar,.savebar) { background:#1b1f22;border-color:#343a3f; }
[data-product="crm"][data-theme="dark"] :is(input,select,textarea) { background:#202529;color:#f4f6f7;border-color:#485158; }
[data-product="crm"][data-theme="dark"] :is(input,textarea)::placeholder { color:#89949c; }
[data-product="crm"][data-theme="dark"] :is(input,select,textarea):disabled { background:#292f33;color:#9da7ae; }
[data-product="crm"][data-theme="dark"] .manual-project-number { background:#202529;border-color:#485158; }
[data-product="crm"][data-theme="dark"] .manual-project-number[open]>summary { border-bottom-color:#485158; }
[data-product="crm"][data-theme="dark"] :is(.button,button:not(.active):not(.primary):not(.danger)) { background:#242a2e;color:#edf1f3;border-color:#485158; }
[data-product="crm"][data-theme="dark"] :is(.button,button):hover:not(:disabled):not(.active):not(.primary) { background:#30373c; }
[data-product="crm"][data-theme="dark"] :is(.button.primary,button.primary) { background:#ffc629;color:#111;border-color:#ffc629; }
[data-product="crm"][data-theme="dark"] :is(.button.primary,button.primary):hover:not(:disabled) { background:#ffd24e;color:#111; }

[data-product="crm"][data-theme="dark"] table { background:#1b1f22;color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] th { background:#292f33;color:#dce3e8;border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] td { background:#1b1f22;color:#e7ebed;border-color:#343a3f; }
[data-product="crm"][data-theme="dark"] :is(.projects,.engineering-table) tr:hover td { background:#29271c; }
[data-product="crm"][data-theme="dark"] .table-wrap { border-color:#343a3f;background:#1b1f22; }
[data-product="crm"][data-theme="dark"] .global-search { background:#202529;border-color:#3d454b; }
[data-product="crm"][data-theme="dark"] .global-search :is(input,kbd) { background:transparent;color:#dfe5e8;border-color:#485158; }
[data-product="crm"][data-theme="dark"] .global-search-results { background:#1d2225;border-color:#40484e;box-shadow:0 14px 36px #0009; }
[data-product="crm"][data-theme="dark"] .global-search-group,[data-product="crm"][data-theme="dark"] .global-search-option small,[data-product="crm"][data-theme="dark"] .global-search-empty { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .global-search-option { color:#edf1f3; }
[data-product="crm"][data-theme="dark"] .global-search-option:hover,[data-product="crm"][data-theme="dark"] .global-search-option.active { background:#34301f; }
[data-product="crm"][data-theme="dark"] :is(.topbar-icon,.topbar-avatar) { background:#252b2f;color:#e6ebee;border-color:#454d53; }
[data-product="crm"][data-theme="dark"] .pilot { background:#34301f;color:#ffe58b; }

[data-product="crm"][data-theme="dark"] .profile-menu { background:#1d2225;border-color:#40484e;box-shadow:0 18px 50px #0009; }
[data-product="crm"][data-theme="dark"] .profile-menu-head { border-bottom-color:#343a3f; }
[data-product="crm"][data-theme="dark"] .profile-menu-head :is(small,em) { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .profile-menu>button { background:transparent;color:#edf1f3;border-color:transparent; }
[data-product="crm"][data-theme="dark"] .profile-menu>button:hover { background:#2a3034; }
[data-product="crm"] .profile-theme { display:grid;grid-template-columns:1fr auto;align-items:center;gap:12px;margin:5px 0;padding:9px 11px;border-top:1px solid #e8eaec; }
[data-product="crm"] .profile-theme span { font-size:12px;font-weight:700; }
[data-product="crm"] .profile-theme select { min-width:132px;padding:7px 26px 7px 9px;font-size:12px; }
[data-product="crm"][data-theme="dark"] .profile-theme { border-top-color:#343a3f; }

[data-product="crm"][data-theme="dark"] :is(.workspace-stats .stat,.help-grid>div,.employee-card,.team-toolbar) { background:#1b1f22;border-color:#343a3f; }
[data-product="crm"][data-theme="dark"] .workspace-stats .stat-icon { background:#2b3237;color:#cbd4da; }
[data-product="crm"][data-theme="dark"] .workspace-stats .stat-attention { background:#2b2718;border-color:#665829; }
[data-product="crm"][data-theme="dark"] .help-grid .help-icon { background:#3a3218;color:#ffd552; }
[data-product="crm"][data-theme="dark"] :is(.badge.archived,.access-state) { background:#343a3f;color:#d0d7dc; }
[data-product="crm"][data-theme="dark"] :is(.badge.review,.task-late,.access-state.pending) { background:#4a3c12;color:#ffe18a; }
[data-product="crm"][data-theme="dark"] .badge.approved { background:#173d2a;color:#92e0b6; }
[data-product="crm"][data-theme="dark"] :is(.route-stages button.active,.queue-tab.active) { background:#3a3218;color:#ffe38a;border-color:#8e7520; }
[data-product="crm"][data-theme="dark"] :is(.route-stages button.active span,.queue-tab.active strong) { background:#ffc629;color:#111; }
[data-product="crm"][data-theme="dark"] .route-stages { gap:6px;padding-bottom:0; }
[data-product="crm"][data-theme="dark"] .route-stages button { border:1px solid #3b4349!important;border-radius:7px!important;background:#20262a;color:#d8e0e4; }
[data-product="crm"][data-theme="dark"] .route-stages button:hover:not(.active) { background:#2a3034;color:#f5f7f8; }
[data-product="crm"][data-theme="dark"] .route-stages button span { flex:0 0 25px;background:#394147;color:#d8e0e4; }
[data-product="crm"][data-theme="dark"] .route-stages button.active span { background:#ffc629;color:#111; }
[data-product="crm"][data-theme="dark"] .route-progress-state { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .route-progress-state strong { color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary { background:#20262a;border-color:#3b4349;color:#d8e0e4; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary strong { color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary span,[data-product="crm"][data-theme="dark"] .project-workflow-summary small { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.closed { background:#351f22;border-color:#7d3b43; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.closed strong { color:#ffb8be; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.paused { background:#342d1a;border-color:#725c22; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.paused strong { color:#ffe38a; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.completed { background:#193629;border-color:#397254; }
[data-product="crm"][data-theme="dark"] .project-workflow-summary.completed strong { color:#aee5c2; }
[data-product="crm"][data-theme="dark"] .route-stopped { background:#1b2024;border-color:#3b4349;color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .route-stopped strong { color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] .route-stages button.done { background:#193629!important;color:#aee5c2;border-color:#397254!important; }
[data-product="crm"][data-theme="dark"] .route-stages button.done span { background:#2c8b58;color:#fff; }
[data-product="crm"][data-theme="dark"] .route-stages button.current { background:#3a3218!important;color:#ffe38a;border-color:#8e7520!important;box-shadow:inset 0 -3px #ffc629; }
[data-product="crm"][data-theme="dark"] .route-stages button.upcoming { background:#1b2024!important;color:#8d989f;border-color:#343d42!important; }
[data-product="crm"][data-theme="dark"] .task-countdown { color:#b3c3ca; }
[data-product="crm"][data-theme="dark"] .task-countdown.overdue { color:#ff9a87; }
[data-product="crm"][data-theme="dark"] .queue-tab { background:#1b1f22;color:#dbe3e7;border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] .queue-tab strong { background:#2a3034;color:#dbe3e7; }

[data-product="crm"][data-theme="dark"] :is(.tabs,.project-workspace-tabs,.project-nav,.route-stages,.filters,.toolbar,.pagination,.mail-toolbar,.logistics-toolbar) { border-color:#343a3f; }
[data-product="crm"][data-theme="dark"] :is(.tab,.project-workspace-tab,.project-nav a,.queue-tab) { color:#c5cdd2; }
[data-product="crm"][data-theme="dark"] :is(.tab.active,.project-workspace-tab.active,.project-nav a.active) { color:#fff; }
[data-product="crm"][data-theme="dark"] :is(.empty,.inline-note,.mail-onboarding,.attention-banner) { background:#2b2718;color:#f5e6ad;border-color:#665829; }
[data-product="crm"][data-theme="dark"] #notice { background:#e6ebee;color:#111;box-shadow:0 12px 35px #0008; }
[data-product="crm"][data-theme="dark"] #notice.error { background:#7d2929;color:#fff; }

/* The compact reports have their own light table and inline-control palette. */
[data-product="crm"][data-theme="dark"] .portfolio-total { background:linear-gradient(100deg,#20262aee,#1b2023ee);border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] .portfolio-total strong { color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] :is(.engineering-table thead,.report-column-head th,.nomenclature-group th) { background:#252b2f!important;color:#e4eaed!important;border-color:#414a50!important; }
[data-product="crm"][data-theme="dark"] .report-filter-row th { background:#1e2428!important;border-bottom-color:#4b555b!important; }
[data-product="crm"][data-theme="dark"] :is(.report-filter-row input,.report-filter-row select,.column-filters input) { background:#20262a!important;color:#f0f3f4!important;border-color:#4b555b!important; }
[data-product="crm"][data-theme="dark"] .report-compact .engineering-table th button.filtered { background:#3a3218;color:#ffe8a6; }
[data-product="crm"][data-theme="dark"] .report-column-head button span { color:#f0cc62; }
[data-product="crm"][data-theme="dark"] :is(.inline-report-value:hover span,.inline-report-value:focus-visible span) { color:#ffe8a6;text-decoration-color:#9c812f;text-decoration-style:solid; }
[data-product="crm"][data-theme="dark"] :is(.history-trigger,.report-cell-edit) { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] :is(.report-cell-actions:hover .history-trigger,.history-trigger:focus-visible,.report-cell-actions:hover .report-cell-edit,.report-cell-edit:focus-visible) { background:#2a3034;color:#f0cc62;border-color:#59646b; }
[data-product="crm"][data-theme="dark"] .report-account-link { color:#f0cc62; }
[data-product="crm"][data-theme="dark"] .report-account-link:hover,[data-product="crm"][data-theme="dark"] .report-account-link:focus-visible { background:#2a2820; }
[data-product="crm"][data-theme="dark"] :is(.engineering-table td.editing,.inline-group-dropdown,.product-group-section,.project-profile-summary,.commercial-signals,.commercial-finance,.layout-row,.catalog-row) { background:#202529;color:#edf1f3;border-color:#40494f; }
[data-product="crm"][data-theme="dark"] :is(.report-layout .panel-head,.workflow-edit-dialog .panel-head,.catalog-edit-dialog .panel-head,.rename-scope-dialog .panel-head) { background:#1b1f22; }
[data-product="crm"][data-theme="dark"] .filter-emphasis { background:#302d1d;color:#f4e2a2;border-color:#75622a; }

/* Sales workbench: every lane, card and counter must stay in the dark surface. */
[data-product="crm"][data-theme="dark"] :is(.sales-view-switcher,.sales-today>section,.sales-funnel>section,.sales-room-picker,.sales-form,.sales-proposal-card,.sales-work-card,.sales-funnel-lane article,.sales-proposal-lines>div,.sales-decision-lines>div,.sales-handoff,.sales-readiness,.sales-decision-readiness) { background:#1b1f22;color:#eef2f3;border-color:#3b4349;box-shadow:none; }
[data-product="crm"][data-theme="dark"] .sales-view-switcher { background:#20262a;border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] .sales-view-switcher button { color:#b7c1c7; }
[data-product="crm"][data-theme="dark"] .sales-view-switcher button.active { background:#2b3033;color:#ffe8a6;box-shadow:inset 0 -2px #ffc629; }
[data-product="crm"][data-theme="dark"] .sales-today-summary>div { background:#1b1f22;border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] .sales-today-summary>div.active { background:#2d291a;border-color:#806b28; }
[data-product="crm"][data-theme="dark"] .sales-today>section { background:#20262a; }
[data-product="crm"][data-theme="dark"] .sales-today>section>.sales-section-title { background:#20262a;border-color:#3b4349; }
[data-product="crm"][data-theme="dark"] :is(.sales-section-title>span,.sales-funnel-head>span) { background:#2a3034;color:#f3f5f6; }
[data-product="crm"][data-theme="dark"] .sales-empty { background:#242a2e;color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .sales-funnel { background:transparent; }
[data-product="crm"][data-theme="dark"] .sales-funnel-head { border-color:#3b4349;background:#20262a; }
[data-product="crm"][data-theme="dark"] .sales-funnel-lane { background:#1b1f22; }
[data-product="crm"][data-theme="dark"] :is(.sales-qualified,.sales-won,.sales-accepted) { background:#183b2a;color:#a4e6c2; }
[data-product="crm"][data-theme="dark"] :is(.sales-on_hold,.sales-partial,.sales-awaiting_acceptance,.sales-pending) { background:#493b17;color:#ffe39a; }
[data-product="crm"][data-theme="dark"] :is(.sales-lost,.sales-cancelled,.sales-declined,.sales-no_go) { background:#482526;color:#f4b9b9; }

/* Project profile has a denser card hierarchy than the generic panel. Its
   light-mode backgrounds used to win here, leaving bright rectangles in dark
   mode. Keep every nested surface dark, with borders and shadows doing the
   separation instead of white fills. */
[data-product="crm"][data-theme="dark"] .project-profile-card { background:#15191c;border-color:#3a4349; }
[data-product="crm"][data-theme="dark"] .profile-section { background:#1b2024;border-color:#3c464d;box-shadow:0 10px 24px #0005; }
[data-product="crm"][data-theme="dark"] .profile-section-head { background:#20262a;border-color:#3c464d; }
[data-product="crm"][data-theme="dark"] :is(.profile-section-head small,.profile-section-head>span,.profile-fields label small,.project-profile-help) { color:#aeb8bf; }
[data-product="crm"][data-theme="dark"] .project-profile-summary { background:#20262a;border-color:#3c464d; }
[data-product="crm"][data-theme="dark"] .profile-next-action { background:#2c291d;color:#f4dea0;border-color:#d9ad28; }
[data-product="crm"][data-theme="dark"] .profile-next-action.ready { background:#193428;color:#b6e7c7;border-color:#4d9a6e; }
[data-product="crm"][data-theme="dark"] .commercial-section { background:#1b2024;border-color:#4b5153;box-shadow:0 12px 28px #0007; }
[data-product="crm"][data-theme="dark"] .commercial-section .profile-section-head { background:#22282b; }
[data-product="crm"][data-theme="dark"] .commercial-section .profile-section-head>span { background:#403318;color:#ffe19a; }
[data-product="crm"][data-theme="dark"] .commercial-signals { background:#20262a;border-color:#3d464c; }
[data-product="crm"][data-theme="dark"] .commercial-signal { background:#252b2f;border-color:#465159;box-shadow:inset 0 1px #ffffff08,0 7px 16px #0006;color:#eef2f3; }
[data-product="crm"][data-theme="dark"] :is(.commercial-probability,.commercial-quarter) { background:#252b2f; }
[data-product="crm"][data-theme="dark"] .commercial-signal :is(input,select) { background:transparent;color:#f4f6f7;border-bottom-color:#66737a; }
[data-product="crm"][data-theme="dark"] .commercial-signal :is(input,select):focus { border-bottom-color:#ffc629; }
[data-product="crm"][data-theme="dark"] :is(.commercial-probability input,.commercial-unit) { color:#7ee0aa; }
[data-product="crm"][data-theme="dark"] .commercial-key-project { background:#302b1d;border-color:#8b7126;color:#f9e5a4; }
[data-product="crm"][data-theme="dark"] .commercial-finance { background:#20262a;border-color:#3d464c; }
[data-product="crm"][data-theme="dark"] .commercial-finance>label { background:#252b2f;border-color:#465159;color:#dce5e9; }
[data-product="crm"][data-theme="dark"] .commercial-finance :is(input,select) { background:transparent;color:#f4f6f7;border-bottom-color:#66737a; }
[data-product="crm"][data-theme="dark"] .competitor-picker { background:#20262a;border-color:#465159; }
[data-product="crm"][data-theme="dark"] .competitor-entry input { background:#252b2f;color:#f4f6f7; }
[data-product="crm"][data-theme="dark"] .competitor-tag { background:#34414a;color:#e2edf1; }
[data-product="crm"][data-theme="dark"] .competitor-tag button { background:#52616a;color:#fff; }
[data-product="crm"][data-theme="dark"] .loading { color:#c8d3d8; }

@media (prefers-reduced-motion:reduce) {
  [data-product="crm"] * { transition:none!important; }
}
