/* LS Office dark-mode override.
   Light mode remains the design-system baseline in index.html. This file only
   activates when the saved user preference sets data-theme="dark". */
html[data-theme="dark"] {
  color-scheme: dark;
  --navy: #9cc8ff;
  --navy2: #315f97;
  --sea: #7db9ff;
  --bg: #0b111c;
  --card: #102033;
  --ink: #eef4fb;
  --mut: #9aaabd;
  --muted: #9aaabd;
  --line: #294b70;
  --ok: #70d89a;
  --okbg: #142e25;
  --warn: #f3bd61;
  --warnbg: #382b16;
  --bad: #ff8a86;
  --badbg: #3b1d22;
  --gold: #f3bd61;
  --blue: #7db9ff;
  --dark-surface: #0e2238;
  --dark-raised: #172c44;
  --dark-input: #0d1a2a;
  --dark-soft-line: #1d3855;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background: var(--bg);
  color: var(--ink) !important;
}

html[data-theme="dark"] #nav {
  background: var(--card);
  border-right: 1px solid var(--line);
}
html[data-theme="dark"] #topbar {
  background: #091423;
  border-bottom-color: #4b8ed0;
}
html[data-theme="dark"] .kicker { color: var(--sea); }
html[data-theme="dark"] .navgroup-title { color: #92a8c2; }
html[data-theme="dark"] nav button.nv.on { background: #24578c; }
html[data-theme="dark"] .navbadge { background: #234f7f; }
html[data-theme="dark"] .navbadge.alert { background: #c7505d; }

/* Theme control sits beside refresh and remains usable at phone widths. */
.themetoggle {
  min-width: 72px;
  height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 5px;
  background: transparent;
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.themetoggle:hover,.themetoggle:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.themetoggle svg { width: 15px; height: 15px; }
.themetoggle .theme-sun { display: none; }
html[data-theme="dark"] .themetoggle .theme-moon { display: none; }
html[data-theme="dark"] .themetoggle .theme-sun { display: block; }
@media(max-width:860px){.themetoggle{min-width:31px;width:31px;padding:0}.themetoggle span{display:none}}

/* Shared interactive surfaces. */
html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  border-color: var(--line);
  background-color: var(--dark-input);
  color: var(--ink) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #75879d; }
html[data-theme="dark"] #topbar input {
  border-color: rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: #fff;
}
html[data-theme="dark"] button.b { background: #315f97; color: #fff; }
html[data-theme="dark"] button.b:hover { background: #3b70ad; }
html[data-theme="dark"] button.b.sec2,
html[data-theme="dark"] .b.danger.ghost {
  border-color: var(--line);
  background: var(--card);
  color: var(--sea);
}
html[data-theme="dark"] button.b.sec2:hover,
html[data-theme="dark"] .b.danger.ghost:hover { background: var(--dark-raised); }
html[data-theme="dark"] button.b.danger { background: #a83d49; color: #fff; }
html[data-theme="dark"] button.b.ok { background: #26704d; color: #fff; }
html[data-theme="dark"] .filters button {
  border-color: var(--line);
  background: var(--card);
  color: var(--mut);
}
html[data-theme="dark"] .filters button:hover { background: var(--dark-raised); color: var(--ink); }

/* Primary white surfaces. */
html[data-theme="dark"] :where(
  .card,.searchdrop,.searchdrop a,.invoicekpis,.invoicelist,.invoicedetail,
  .jobstatusbar,.clientpackagesource,.clientpackagesummary,
  .clientpackagecontrolgrid,.clientpackageitemtable,.clientpackagedocumenttable,
  .clientpackageprogresscontrols,.clientpackageprogressrow,.clientpackageevents,
  .todo-listnav,.todo-workspace,.todo-filter.on,.todo-package,.todo-package-toggle,
  .auditlinkrow,.auditrelated,.audittimeline,.audittimelineitem,.invoicefacts>div,
  .scheduleworkresults,.scheduleworkresult,.scheduleworkbench.haswork .scheduleworkaction,
  .schedulecommandlink,.scheduleratepanel,.scheduleraterow,.scheduletoolbar,
  .scheduleoptionspanel,.schedulepeople,.schedulelegend,.tlschedule,
  .tlschedule .tlname,.tlschedule .tlhours,.jobhourspeople>span,.completionmore>summary,
  .completionmenu,.jobteamtodotick,.taskfilesempty,.taskfileicon,.taskfiletile,
  .taskfilerow,.jobcloseoutcommand,.closeoutdonut::after,.closeoutlifecycle,
  .closeoutlist,.stockreturnlist,.activityfilters button,.jobtabprimary button.on,
  .jobtabsecondary button:hover,.jobtabsecondary button.on,.jobdetailsfield input,
  .jobdetailsfield textarea,.tabs button,.tabs button.on,.purchasestat,.stockpurchase,
  .restockcontrol,.restockstats,.stockscantorch,.stockembeddedtools,
  .officecataloguehead .b,.officecataloguetabs button[aria-selected="true"],
  .officecataloguefact,.stockpostats,.pojobpick,.stockinvoice,
  .invoicegate.matched .invoicegateicon,.invoicepreviewpanel,.invoicelinepanel,
  .invoicelinerow,.invoicelinerow select,.landingweather,.landingweatherrefresh,
  .landingcontrolsummary,.landingquick a,.landingattention,.costrates span,
  .directorytab.on,.clienttabs button.on,.clientsubtabs button.on,.directoryresults,
  .directoryrow,.directorypartner>summary,.clientpanel,.clientactivity,
  .report-review-item,.report-review-actions,.simprofile,.fileviewerhead,
  .report-lifecycle,.report-step-number,.sitelist,.siterow,.siteworkspacetab:hover,
  .siteworkspacetab.active,.sitespecificaddress,.sitespecificsource,
  .profileenrichmentsuggestion,.profileenrichmentactions,.sitepassportvesselfield,
  .jobfilesexplorer,.jobfilessearch,.jobfilescollapse,.jobfilesreveal,.fileviewbutton,
  .jobfileaction,.jobfiletile,.jobfilethumb.file span,.schedulecoloursearch,
  .workgroup,.workinspector,.workdialog,.qw-card,.qw-preview,.qw-dialog,
  .business-report-tab.active,.business-report-preset:hover,.business-report-preset.active,
  .business-report-showcase .b.sec2,.business-report-showcase-period,.todo-insight,
  .todo-modenav,.todo-shared-picker select,.todo-toolbar,.todo-ai-inbox-toolbar,
  .todo-ai-inbox-side,.todo-ai-card,.todo-ai-empty,.copilot-hero,.copilot-loading,
  .copilot-loaderror,.copilot-kpis,.copilot-panel,.copilot-citation,.copilot-planrow,
  .copilot-report,.copilot-source
) {
  background: var(--card) !important;
  color: var(--ink);
}

/* Subdued section headers and secondary surfaces. */
html[data-theme="dark"] :where(
  .invoicehead,.invoicedetailside,.clientpackagecontactgrid,.clientpackagebody,
  .permissionlegend,.todo-compose,.todo-packagebody,.todo-package-note,.todo-addstep,
  .auditlinkcardhead,.auditmorelinks[open] summary,.auditdetailgrid>div,.auditchange,
  .commercialdocstate,.schname,.schedulechosenlabel,.scheduleworkhead,
  .scheduleworkaction,.scheduleratepicker>summary,.scheduleworkpickercard>.scheduleworkresults:empty,
  .scheduledayhint,.jobhoursgrid,.jobhoursdetails[open]>summary,.jobhourspeople,
  .overviewscopehead,.overviewscopedescription,.jobteamtodohead,.jobteamtodocompose,
  .jobteamtodoprivacy,.completionhead,.completionresolved,.completionadd,
  .taskfilessection,.closeoutexceptions,.closeoutexceptions>summary,.activityfilters,
  .activityemptyicon,.jobtabsecondary,.jobdetailshead,.restockcontrolhead,
  .commercialintro,.officecatalogueactions,.stockpurchasehead,.stockinvoicehead,
  .stockjobselected,.invoicegate,.smartinvoicesteps>div,.dropinvoice,.podirectdrop,
  .invoicescan,.invoicecriterion,.deliveryconfirm,.landingforecaststrip,
  .landingbriefinghead,.landingsectionhead,.enquiryscope,.costprovider,.costusage,
  .directorypartnerbody,.clientfield,.report-template-details,.report-review-section,
  .report-lifecycle-step.pending,.siteqrnone,.sitespecificdetails,
  .profileenrichmentexplain,.sitepassportvessel,.jobfilesbar,.jobfilerow:hover,
  .schedulecolourcardhead,.workgroup>h3,.business-report-snapshot-values,
  .business-report-ageing-row,.todo-listhead,.todo-insight-head,
  .todo-ai-dialog .todo-plan-dialog-head,.todo-ai-inbox-main,.copilot-panelhead,
  .copilot-answercard
) {
  background: var(--dark-surface) !important;
  color: var(--ink);
}

/* Blue selection and contextual surfaces. */
html[data-theme="dark"] :where(
  .filters button.on,.invoicerow.on,.clientpackageboundary,.permgroup-title,
  .pill.navy,.quoteformat,.quotetotals,.bk,.scheduleworkresult:hover,
  .overviewscopemark,.completionstep,.completionmark,.completionmenu button:hover,
  .aiassist,.closeoutpolicy,.assiststatus.waived,.assistnotice,
  .landingweatherrefresh:hover,.enquiryworknotice,.costnotice,.costsource,
  .report-register,.simprofileicon,.report-lifecycle-step.current,
  .siteclassicon,.siteheroicon,.jobfilescollapse:hover,.jobfilesreveal:hover,
  .jobfilesfolder:hover,.fileviewbutton:hover,.jobfilemini,.jobfiletypeicon,
  .jobfileaction:hover,.business-report-sourcebar,.business-report-coverage-note,
  .todo-source-boundary,.copilot-prompts button:hover,.copilot-citation:hover,
  .qw-tabs .active,.qw-message
) {
  background: #153b62 !important;
  color: var(--ink);
}

html[data-theme="dark"] :where(
  .searchdrop a:hover,.simprofile:hover,.pojobpick:hover,.directoryrow:hover,
  .directorypartner>summary:hover,.directorypartner[open]>summary,
  .clientactivity.clickable:hover,.siterow:hover,.business-report-tab:hover,
  .todo-modetab:hover,.todo-chip:hover
) { background: var(--dark-raised) !important; }

html[data-theme="dark"] table,
html[data-theme="dark"] .tablewrap { background: var(--card); color: var(--ink); }
html[data-theme="dark"] thead th,
html[data-theme="dark"] .invoicehead { background: var(--dark-surface); color: #adbed1; }
html[data-theme="dark"] tbody td { border-color: var(--line); }
html[data-theme="dark"] tr.rowlink:hover td { background: var(--dark-raised); }

/* Feature workspaces that define their own light palettes. */
html[data-theme="dark"] .qw { color: var(--ink); }
html[data-theme="dark"] .qw input:not([type="checkbox"]),
html[data-theme="dark"] .qw select,
html[data-theme="dark"] .qw textarea,
html[data-theme="dark"] .qw-dialog input,
html[data-theme="dark"] .qw-dialog textarea { background: var(--dark-input); color: var(--ink); }
html[data-theme="dark"] .qw th { background: var(--dark-surface); color: var(--mut); }
html[data-theme="dark"] .qw-totals { background: #153b62; }

html[data-theme="dark"] .copilot-page {
  --cp-navy: #9cc8ff;
  --cp-blue: #7db9ff;
  --cp-line: #294b70;
  --cp-soft: #0e2238;
  color: var(--ink);
}
html[data-theme="dark"] .copilot-identity h1,
html[data-theme="dark"] .copilot-panelhead h2,
html[data-theme="dark"] .copilot-kpi b { color: var(--sea); }
html[data-theme="dark"] .copilot-identity p,
html[data-theme="dark"] .copilot-kpi span { color: var(--mut); }

html[data-theme="dark"] .business-report-tabs,
html[data-theme="dark"] .business-report-presets { background: var(--dark-surface); }
html[data-theme="dark"] .business-report-kpi>small,
html[data-theme="dark"] .business-report-prior strong,
html[data-theme="dark"] .business-report-delta,
html[data-theme="dark"] .business-report-trend-value,
html[data-theme="dark"] .business-report-trend-label { color: var(--mut); }
html[data-theme="dark"] .business-report-ageing-track,
html[data-theme="dark"] .business-report-share { background: var(--dark-soft-line); }

html[data-theme="dark"] .todo-listbutton.on,
html[data-theme="dark"] .todo-chip.on,
html[data-theme="dark"] .todo-tasktag.when { background: #153b62; color: var(--sea); }
html[data-theme="dark"] .todo-modetab.on { background: #315f97; color: #fff; }
html[data-theme="dark"] .todo-timegroup-head,
html[data-theme="dark"] .todo-insight-section,
html[data-theme="dark"] .todo-insight-audit,
html[data-theme="dark"] .todo-source-row,
html[data-theme="dark"] .todo-ai-evidence { background: var(--dark-surface); color: var(--mut); }

/* Complete the theme for nested controls and information tiles. These small
   surfaces sit inside cards, so they are easy to miss when a feature adds a
   hard-coded light fill of its own. */
html[data-theme="dark"] :where(
  .kpi .chip,.clientpackagedecision,.permseg,
  .access-feature-note,.todo-listmark,.todo-listcount,.todo-kind,
  .todo-avatar.more,.todo-filters,.todo-package-ratio,.pbar .trk,
  .schhead,.scheduleweekboard .schhead,.scheduleworkchange,
  .completioncount,.completionstate,.taskfilepreview,.recentrow,.aispark,
  .assistaction>span,.tabbadge,.restockstatus,.commercialtabs,
  .officecataloguephotoempty,.pobound,.invoiceworkbench,.invoicepreviewbody,
  .invoicepreviewbody img,.invoicelinehead,.criterionmark,
  .landingweathericon,.landingbriefingheadicon,.landingbriefingcount,
  .landingbriefingmark,.landingbriefingemptyicon,.landingsectionicon,
  .enquirymeta span,.enquiryphoto,.enquiryconversionid,
  .directoryavatar,.clientheroavatar,.clienttags span,.report-count,
  .report-history th,.report-steps,.report-template-info,.ims-code,
  .report-table-head,.siteworkspacetabs,.profileofficialhint,
  .profileenrichmentboundary,.newjobevidence,.newjobphoto,.jobfilesfolders,
  .jobfilesresize,.jobfilescount,.jobfilelisthead,.filesource,
  .jobfilesemptyicon,.schedulecolourboundary,.jobfilestorage,
  .business-report-checklist li,.business-report-showcase-source,
  .business-report-showcase-answer,.business-report-showcase-ageingbar,
  .business-report-showcase-utilbar,.todo-planningstate,.todo-capacity,
  .todo-ai-sourcecode,.copilot-answerempty.working,.copilot-answerpoint,
  .copilot-sourcecode,.copilot-tags span,.copilot-boundary
) {
  background: var(--dark-raised) !important;
  border-color: var(--line);
  color: var(--ink) !important;
}

html[data-theme="dark"] :where(
  .jobfilterselect,.clientdocumentrequest,.clientpackageprivate,
  .todo-personalitem.done,
  .scheduleworkidentity[role=button]:hover,.scheduleworkidentity[role=button]:focus-visible,
  .completionrow:hover,.stockreturnhead,.officecataloguephotos img,
  #release-ready,.invoiceworkhead,.sitepublicapproval,.siteaccessrow:hover,
  .jobfilestorage,.business-report-showcase-demo,
  .business-report-showcase-brief,.business-report-showcase-change,
  .business-report-showcase-insight
) {
  background: var(--dark-surface) !important;
  border-color: var(--line);
  color: var(--ink) !important;
}

html[data-theme="dark"] :where(
  .todo-progress,.todo-progress-track,.jobfilesresize::after,
  .business-report-showcase-weekbars,.business-report-trend-track
) { background-color: var(--dark-soft-line) !important; }

html[data-theme="dark"] :where(
  .tlarea.drawready,.completionrow.done,.lifecycleitem.done,.closeoutcompleted,
  .stockreturndecided,.restockstatus.part_received,.todo-planningstate.suggested,
  .todo-planningstate.approved,.todo-ai-confidence,.todo-ai-decision.accepted
) {
  background: var(--okbg) !important;
  border-color: #326b53;
  color: var(--ok) !important;
}

html[data-theme="dark"] :where(
  .tlarea.drawready.drawactivity,.completionduplicate,.closeouttick,
  .restockstatus.requested,.restocksafety,.newpobox,.landingbriefinglist>a.high,
  .landingbriefinglist>a.high .landingbriefingmark,.jobfilestorage.unknown,
  .jobfileswarning,.business-report-showcase-empty,
  .business-report-showcase-empty-icon,.copilot-unable,
  .copilot-answerwarning,.copilot-answererror,.copilot-tags span.p2,
  .copilot-safety
) {
  background: var(--warnbg) !important;
  border-color: #72562a;
  color: var(--warn) !important;
}

html[data-theme="dark"] :where(
  .copilot-tags span.p1,.sitehistorydot.fail,.sitehistorydot.retest_required
) {
  background: var(--badbg) !important;
  border-color: #7d3c45;
  color: var(--bad) !important;
}

html[data-theme="dark"] :where(
  .completionrow.context,.completionstate.context,.restockstatus.ordered,
  .invoicecreatequestion.safe,.closeoutrow.waived .closeouttick
) {
  background: #153b62 !important;
  border-color: var(--line);
  color: var(--sea) !important;
}

html[data-theme="dark"] :where(
  .landingweatherhead small,.landingweatherhead span,
  .landingweathercurrent>div:nth-child(2)>span,.landingweatherrange small,
  .landingweatherrange span,.landingweathermetrics small,.landingforecasthead span,
  .landingforecaststrip small,.landingforecaststrip span,.landingweatherfoot,
  .landingbriefingtitle span,.landingbriefinglist small,.landingbriefingempty,
  .landingsectiontitle span,.landingquick small,.landingquick span
) { color: var(--mut) !important; }

html[data-theme="dark"] :where(
  .landingweatherhead b,.landingweathercurrent>div:nth-child(2)>b,
  .landingweatherrange b,.landingweathermetrics b,.landingforecasthead b,
  .landingforecaststrip b,.landingbriefingtitle b,.landingbriefinglist b,
  .landingsectiontitle b
) { color: var(--ink) !important; }

html[data-theme="dark"] :where(
  .landingweathericon,.landingbriefingheadicon,.landingbriefingcount,
  .landingbriefingmark,.landingbriefingemptyicon,.landingsectionicon
) { color: var(--sea) !important; }

html[data-theme="dark"] :where(
  .landingbriefingheadicon.calendar,.landingcalendarcard .landingbriefingcount,
  .landingsectionhead.pulse .landingsectionicon
) {
  background: var(--okbg) !important;
  border-color: #326b53;
  color: var(--ok) !important;
}

html[data-theme="dark"] :where(
  .landingbriefinglist>a:hover,.landingsectionhead>a:hover,
  .landingbriefinghead>a:hover,.tlarea.drawready:hover,
  .tlarea.drawready.drawactivity:hover
) { background: var(--dark-raised) !important; }

html[data-theme="dark"] .landingwelcome {
  background: linear-gradient(115deg,var(--card) 0%,var(--dark-surface) 100%);
  border-color: var(--line);
}
html[data-theme="dark"] .sitehistorydot { background: var(--dark-input); }
html[data-theme="dark"] .sitehistorydot.completed,
html[data-theme="dark"] .sitehistorydot.pass { background: var(--okbg); }
html[data-theme="dark"] .sitehistorydot.conditional,
html[data-theme="dark"] .sitehistorydot.open { background: var(--warnbg); }
html[data-theme="dark"] .schedulecolourpicker { background: var(--dark-input); }
html[data-theme="dark"] .business-report-showcase-weekbars {
  background-image: repeating-linear-gradient(to top,transparent,transparent 44px,var(--dark-soft-line) 45px) !important;
}
html[data-theme="dark"] .business-report-trend-track {
  background-image: linear-gradient(to top,transparent 47px,var(--dark-soft-line) 48px,transparent 49px,transparent 95px,var(--dark-soft-line) 96px,transparent 97px) !important;
}

/* Route-specific state surfaces that use light fills in the default theme. */
html[data-theme="dark"] :where(
  .sorthead:hover,.sorthead.on,.tlschedule .tlhead,
  .tlschedule .tlhead>div:first-child,.tlschedule .tlhourshead,
  .directorytabs,.clienttabs,.clientsubtabs
) {
  background: var(--dark-raised) !important;
  border-color: var(--line);
  color: var(--ink) !important;
}
html[data-theme="dark"] :where(
  .invoicering,.tlblk.activity:not(.schedulecard),
  .bk.activity:not(.schedulecard),.invoicecriterion.stop,
  .invoicecriterion.stop .criterionmark
) {
  background: var(--warnbg) !important;
  border-color: #72562a;
  color: var(--warn) !important;
}
html[data-theme="dark"] :where(
  .governance-app-update,.jobhourskpi.actual,.workfilters button.on,
  .copilot-panelhead .copilot-readonly
) {
  background: var(--okbg) !important;
  border-color: #326b53;
  color: var(--ok) !important;
}
html[data-theme="dark"] :where(.permchoice.on.hide,.qw-message.error) {
  background: var(--badbg) !important;
  border-color: #7d3c45;
  color: var(--bad) !important;
}
html[data-theme="dark"] :where(.permchoice.on.view,.permchoice.on.edit) {
  background: #153b62 !important;
  border-color: var(--line);
  color: var(--sea) !important;
}
html[data-theme="dark"] :where(.qw-blockers,.bk.activity.today:not(.schedulecard)) {
  background: var(--warnbg) !important;
  border-color: #72562a;
  color: var(--warn) !important;
}
html[data-theme="dark"] :where(.tlblk.b,.tlblk.drawghost) {
  background: #173b5d !important;
  color: var(--ink) !important;
}
html[data-theme="dark"] th { background: var(--dark-surface); color: #adbed1; }

/* Restore readable copy where feature styles specify light-theme ink directly. */
html[data-theme="dark"] :where(
  .sorthead span,.invoicequeuefilters small,.invoicegatecaption,.invoicefinance small,
  .permchoice,.todo-listsection-title,.todo-chevron,.scheduleratelabel,
  .scheduleworkbench.haswork .scheduleworkidentity.empty b,
  .scheduletoolbar>span.mut,.schedulecontrollabel,.schedulenavigation>span,
  .schedulelegenditem,.scheduleratelegend,.completiondetails,.commandfact small,
  .aiassist .aicopy small,.rail .ev .when,.jobtabsecondarylabel,
  .jobdescriptionmeta,.landingnextbody p,.landingpulsegrid small,
  .landingbookingmain small,.directoryarrow,.report-empty,.report-evidence-note,
  .report-evidence-ids,.sitefilefoldergroup,.newjobevidenceboundary
) { color: var(--mut) !important; }

html[data-theme="dark"] :where(
  .overviewscopepending,.completionnotice,.completionnotice span,
  .report-save-warning,.business-report-warning,.business-report-boundary,
  .business-report-unavailable h2,.business-report-unavailable p,.business-report-unavailable small,
  .business-report-pnl-status h2,.business-report-pnl-status p,
  .business-report-warning-list li,.todo-capacity-note b,.todo-capacity-note p,
  .todo-plan-lock,.copilot-sourceplan
) { color: var(--warn) !important; }

html[data-theme="dark"] :where(.auditbefore,.totalbox b,.clientpackagewarning) {
  color: var(--bad) !important;
}

html[data-theme="dark"] .business-report-showcase :where(h1,h2,h3,b,strong) { color: var(--ink) !important; }
html[data-theme="dark"] .business-report-showcase :where(p,span,small,figcaption) { color: var(--mut) !important; }
html[data-theme="dark"] .business-report-showcase :where(a,summary,.kicker) { color: var(--sea) !important; }
html[data-theme="dark"] .business-report-showcase :where(.badtext,.business-report-showcase-severity.critical) { color: var(--bad) !important; }
html[data-theme="dark"] .business-report-showcase :where(.warntext,.business-report-showcase-severity.watch) { color: var(--warn) !important; }
html[data-theme="dark"] .todo-page :where(
  .todo-registerline,.todo-taskowner span small,.todo-planningcell p,
  .todo-capacity-copy,.todo-timeline-item time,.todo-timeline-item small,
  .todo-ai-ready p,.todo-plan-grid label>b,.todo-plan-note>b,
  .todo-source-toggle em,.todo-ai-card-head small,.todo-ai-reason,
  .todo-ai-card-actions small
) { color: var(--mut) !important; }
html[data-theme="dark"] .copilot-page :where(
  .copilot-live,.copilot-answerhead small,.copilot-citations>small,
  .copilot-decisioncopy>small,.copilot-decisioncopy p,.copilot-decisioncopy>em,
  .copilot-empty,.copilot-empty b,.copilot-sourcecopy small,
  .copilot-switch small,.copilot-activityrow time,.copilot-activityrow span small
) { color: var(--mut) !important; }
html[data-theme="dark"] .copilot-page :where(.copilot-textbutton,.copilot-reportid) { color: var(--sea) !important; }
html[data-theme="dark"] .copilot-sourcecopy em { color: var(--bad) !important; }

/* Semantic colours stay explicit rather than being flattened into blue. */
html[data-theme="dark"] .pill.grey { background: #26384e; color: #bac7d7; }
html[data-theme="dark"] .pill.ok { background: var(--okbg); color: var(--ok); }
html[data-theme="dark"] .pill.warn { background: var(--warnbg); color: var(--warn); }
html[data-theme="dark"] .pill.bad { background: var(--badbg); color: var(--bad); }
html[data-theme="dark"] .pill.jobstatus-order-materials { background: #431f12; color: #fdba74; }
html[data-theme="dark"] .pill.jobstatus-awaiting-materials { background: #3b2b10; color: #fde047; }
html[data-theme="dark"] .pill.jobstatus-ready-to-schedule { background: #32204d; color: #d8b4fe; }
html[data-theme="dark"] .pill.jobstatus-scheduled { background: #173a60; color: #93c5fd; }
html[data-theme="dark"] .pill.jobstatus-amsa-scheduled { background: #123b4a; color: #67e8f9; }
html[data-theme="dark"] .pill.jobstatus-started { background: #123c37; color: #5eead4; }
html[data-theme="dark"] .pill.jobstatus-po-required { background: #491c2b; color: #fda4af; }
html[data-theme="dark"] .pill.jobstatus-ready-to-invoice { background: #461d4b; color: #f0abfc; }
html[data-theme="dark"] .pill.jobstatus-completed { background: #163b28; color: #86efac; }
html[data-theme="dark"] .pill.jobstatus-invoiced { background: #2d2b58; color: #a5b4fc; }
html[data-theme="dark"] .pill.jobstatus-paid { background: #2c3a18; color: #bef264; }
html[data-theme="dark"] .pill.jobstatus-archived,
html[data-theme="dark"] .pill.jobstatus-unknown { background: #26384e; color: #bac7d7; }
html[data-theme="dark"] dialog::backdrop { background: rgba(0,0,0,.68); }
html[data-theme="dark"] a { color: var(--sea); }
html[data-theme="dark"] :focus-visible { outline-color: var(--sea); }

/* Documents, QR codes and PDF/image canvases intentionally remain white. */
html[data-theme="dark"] :where(
  .siteqrimage,.invoicepdfpage canvas,.taskfileviewerbody iframe,
  .clientpackagepreview,.report-preview-paper
) {
  color-scheme: light;
  background: #fff !important;
  color: #14181f;
}
