/* Shared color conversion also covers inline palettes and open shadow menus.
   Keep photos, maps, videos and embedded pages in their own colors. */
@media screen {
 :root[data-todoku-theme="dark"] {
  color-scheme: light;
  --todoku-brand-filter: invert(1) hue-rotate(180deg);
  --todoku-brand-background: #fff;
  filter: invert(1) hue-rotate(180deg);
  /* These colors are converted by the filter into the visible navy palette. */
  --todoku-dark-page: #dfeaf6;
  --todoku-dark-surface: #d3e0ee;
  --todoku-dark-header: #dbe7f5;
  --todoku-dark-raised: #c9d8e8;
  --todoku-dark-edge: #9eaebe;
  background: var(--todoku-dark-page);
 }
 :root[data-todoku-theme="dark"] > body { background-color:var(--todoku-dark-page); }
 :root[data-todoku-theme="dark"] :is(header.nav,.search-wrap) { background-color:var(--todoku-dark-header); }
 :root[data-todoku-theme="dark"] #pamoja-products .yp-premium-card:has(>.yp-service-photo) {
  background-color:var(--todoku-dark-surface)!important;
 }
 /* Shared public and workspace surfaces. Photo panels are handled separately. */
 :root[data-todoku-theme="dark"] {
  --yp-paper:var(--todoku-dark-page);
  --staff-glass:var(--todoku-dark-surface);
  --staff-line:var(--todoku-dark-edge);
 }
 :root[data-todoku-theme="dark"] body:is(.yp-shell,.pamoja-bookkeeper,.pamoja-bookkeeper.bk-staff) {
  background:var(--todoku-dark-page)!important;
 }
 :root[data-todoku-theme="dark"] :is(#yp-side,#yp-top,#yp-account-menu,body.yp-shell header,.pamoja-bookkeeper .sw-bottom) {
  background:var(--todoku-dark-header)!important;
 }
 :root[data-todoku-theme="dark"] :is(dialog,.tile,.summary-card,body.yp-shell :is(.panel,.card,.stat,.box,.item,.yp-module,#reader,#editor),.pamoja-bookkeeper :is(.bk-workspace,.bk-queue,.bk-period,.bk-choice,.sw-attendance,.sw-training,.sw-queue,.sw-next-task,.sw-tool,.sw-empty,.bk-actions button:not(.bk-primary),.bk-footer button)) {
  background:var(--todoku-dark-surface)!important;
 }
 :root[data-todoku-theme="dark"] .pamoja-bookkeeper .bk-metric {
  background:linear-gradient(135deg,var(--todoku-dark-raised),color-mix(in srgb,var(--todoku-dark-surface) 78%,var(--tint)))!important;
 }
 :root[data-todoku-theme="dark"] :is(.pamoja-bookkeeper .bk-arrow,#yp-close-menu,.bk-close,.delivery-request-header button) {
  background:var(--todoku-dark-raised)!important;
 }
 :root[data-todoku-theme="dark"] :is(body.yp-shell,.pamoja-bookkeeper) :is(th,tr:hover td) {
  background:var(--todoku-dark-raised)!important;
 }
 :root[data-todoku-theme="dark"] :is(body.yp-shell,.pamoja-bookkeeper) :is(
  input:not([type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"],[type="range"]),
  select,textarea
 ) {
  background-color:var(--todoku-dark-raised)!important;
  border-color:#73899e!important;
 }
 /* Modal dialogs and open popovers paint outside the filtered page. */
 :root[data-todoku-theme="dark"] :is(:modal,:popover-open) {
  filter: invert(1) hue-rotate(180deg);
 }
 /* Keep the existing dark hero treatments, including their CSS photos and overlays. */
 :root[data-todoku-theme="dark"] :is(.hero#home,.yp-delivery-hero,.pamoja-bookkeeper .bk-hero,.category[data-type],#pamoja-products .pathway-card,.yp-premium-card:has(.yp-card-photo),.yp-inventory-photo) {
  filter: invert(1) hue-rotate(180deg);
 }
 :root[data-todoku-theme="dark"] :is(img,video,iframe,canvas,.leaflet-tile-pane) {
  filter: invert(1) hue-rotate(180deg);
 }
 :root[data-todoku-theme="dark"] :is(.leaflet-tile-pane,.hero#home,.yp-delivery-hero,.pamoja-bookkeeper .bk-hero,.category[data-type],#pamoja-products .pathway-card,.yp-premium-card:has(.yp-card-photo)) :is(img,video,iframe,canvas,.leaflet-tile-pane) { filter:none; }
 :root[data-todoku-theme="dark"] .delivery-request-dialog { background:var(--todoku-dark-surface); }
 :root[data-todoku-theme="dark"] .delivery-request-header { background:var(--todoku-dark-header); }
 :root[data-todoku-theme="dark"] .delivery-request-dialog #delivery-form :is(
  input:not([type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"]),
  select,textarea
 ) {
  background:#b8c9da!important;
  border:1px solid #63788e!important;
  color:#15212c!important;
 }
 :root[data-todoku-theme="dark"] .delivery-request-dialog select { appearance:auto; }
 :root[data-todoku-theme="dark"] .delivery-request-dialog :is(input,textarea)::placeholder {
  color:#465361;
  opacity:1;
 }
 :root[data-todoku-theme="dark"] .delivery-request-dialog #delivery-form :is(input,select,textarea):focus-visible {
  outline:2px solid #365d80!important;
  outline-offset:2px;
 }
 :root[data-todoku-theme="dark"] img:is([src*="todoku-logo"],[src*="todoku-symbol"]) {
  background:#fff;
  border-radius:.45rem;
 }
 .todoku-theme-fallback { position:fixed; inset:auto auto max(.5rem,env(safe-area-inset-bottom)) .5rem; z-index:90; }
}
