/* Appearance controls share the existing settings drawer and accent palette. */
html body.erp-system-ui .erp-appearance-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
html body.erp-system-ui .erp-appearance-option{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;min-height:90px;padding:14px 6px;border:1px solid var(--ui-border,#e3e9f1);border-radius:12px;background:var(--ui-surface,#fff);color:var(--ui-text,#25364d);font:inherit;font-size:13px;cursor:pointer}
html body.erp-system-ui .erp-appearance-option svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
html body.erp-system-ui .erp-appearance-option.active{border-color:var(--ui-accent,#20aec2);background:var(--ui-accent-soft,#edf9fb);color:var(--ui-accent-hover,#168b9d);box-shadow:inset 0 0 0 1px var(--ui-accent,#20aec2)}
html body.erp-system-ui .erp-appearance-option:focus-visible{outline:2px solid var(--ui-accent,#20aec2);outline-offset:3px}
html body.erp-system-ui .erp-theme-drawer{max-width:calc(100vw - 20px);max-height:100dvh;overflow-y:auto;overscroll-behavior:contain}
html[data-erp-mode="light"]{color-scheme:light}

@media screen{
 @layer erpColorMode.overrides{
  html[data-erp-mode="dark"]{
   color-scheme:dark!important;background:#111!important;
   --dm-canvas:#111;--dm-surface:#191919;--dm-raised:#262626;
   --dm-text:#dcdcdc;--dm-muted:#a0a0a0;--dm-line:#383838;
   --dm-positive:#6bd5a0;--dm-negative:#ff8594;--dm-link:#83b8ff;
  }
  html[data-erp-mode="dark"] body.erp-system-ui{
   --ui-surface:var(--dm-surface)!important;--ui-field-surface:#202020!important;
   --ui-text:var(--dm-text)!important;--ui-label:#e8e8e8!important;--ui-table-heading:#e8e8e8!important;
   --ui-field-text:var(--dm-text)!important;--ui-placeholder:#959595!important;
   --ui-border:var(--dm-line)!important;--ui-border-soft:#2e2e2e!important;
   --ui-accent-soft:var(--dm-raised)!important;
   --ui-accent-hover:var(--theme-accent)!important;
   --ui-disabled-surface:#222!important;--ui-disabled-text:#858585!important;
   --ui-danger:#dc566a!important;--ui-danger-hover:#ff8d9e!important;--ui-danger-soft:#38202c!important;
   --ui-menu-shadow:0 12px 40px #0006!important;--ui-dialog-shadow:0 24px 80px #0009!important;
   --ui-overlay:#000b!important;--workspace-shadow:0 2px 12px #0002!important;
   --erp-text:var(--dm-text)!important;--erp-text-2:#bbb!important;--erp-muted:var(--dm-muted)!important;
   --erp-field-value:var(--dm-text)!important;--erp-field-placeholder:#959595!important;
   --erp-ui-bg:var(--dm-canvas)!important;--erp-ui-card:var(--dm-surface)!important;--erp-ui-line:var(--dm-line)!important;
   --v2-bg:var(--dm-canvas)!important;--v2-surface:var(--dm-surface)!important;--v2-line:var(--dm-line)!important;--v2-line-soft:#2e2e2e!important;
   --v3-canvas:var(--dm-canvas)!important;--v3-line:var(--dm-line)!important;--v3-line-soft:#2e2e2e!important;
   --theme-page-a:var(--dm-canvas)!important;--theme-page-b:var(--dm-canvas)!important;
   --theme-accent-soft:var(--dm-raised)!important;
   background:var(--dm-canvas)!important;color:var(--dm-text)!important;
  }
  html[data-erp-mode="dark"] body.erp-system-ui .main{background:var(--dm-canvas)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(aside.side,.main>.top,.erp-theme-drawer){background:var(--dm-surface)!important;border-color:var(--dm-line)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(#pm-app,.pm-portal){--pm-text:var(--dm-text)!important;--pm-muted:var(--dm-muted)!important;--pm-border:var(--dm-line)!important;--pm-tint:var(--dm-raised)!important;--pm-accent-border:#555!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(#procurement-app,.pc-dialog){--pc-link:var(--dm-link)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(#click-ads,#finance,#returns){--mg-border:var(--dm-line)!important;--mg-muted:var(--dm-muted)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-primary,.btn.primary,.pm-primary,.pc-primary,.pc-edit-button,.lc-primary,.rc-primary,.auth-submit,.weight-confirm-btn,.order-note-save,.cancel-save-btn,.system-confirm-ok,.ca-ref-btn.primary,.profit-primary-btn-v3249,.erp-btn.active,.page .btn.active,.pm-btn.active,.ca-ref-btn.active){--ui-button-text:#171717!important;--ui-button-hover-text:#171717!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.pl-btn.primary,.wm-btn.primary,.wh-primary,.returns-refresh-v3300,.dash-range-system-btn.active,.finance-quick button.active,#profit-calculator :is(.profit-segment-v3249,.profit-config-tabs-v3249) button.active){color:#171717!important;-webkit-text-fill-color:currentColor!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.pl-btn.primary,.wm-btn.primary,.returns-refresh-v3300) *{color:inherit!important;-webkit-text-fill-color:currentColor!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-pagination :is(.erp-pagination-pages button,.erp-pagination-current,.erp-pagination-jump input){border-color:var(--ui-border)!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-pagination .erp-pagination-pages button:is(.active,:hover:not(:disabled)){border-color:var(--ui-accent)!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-pagination .erp-pagination-jump input:focus{border-color:var(--ui-accent)!important}
  html[data-erp-mode="dark"] body.erp-system-ui #profit-calculator .profit-segment-v3249 button.active::before{background:currentColor!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(a,.text-blue,.copy-value,.pm-link-btn,.pc-link){color:var(--dm-link)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.text-green,.money-positive,.actual-profit-positive){color:var(--dm-positive)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.text-red,.money-negative,.actual-profit-negative,.wh-inventory-warning,.inventory-warning){color:var(--dm-negative)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(input,textarea)::placeholder{color:var(--ui-placeholder)!important;-webkit-text-fill-color:var(--ui-placeholder)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(input,textarea):autofill{-webkit-box-shadow:0 0 0 100px var(--ui-field-surface) inset!important;-webkit-text-fill-color:var(--ui-field-text)!important;caret-color:var(--ui-field-text)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(table,thead,tbody,tr,th,td){border-color:var(--dm-line)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(thead,thead th,.simple-table th){background:var(--dm-raised)!important;color:#e8e8e8!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-choice-menu,.erp-select-menu,.pc-calendar,.erp-theme-drawer){box-shadow:var(--ui-menu-shadow)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-appearance-option,.erp-theme-option){background:var(--dm-raised)!important;color:var(--dm-text)!important;border-color:var(--dm-line)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-appearance-option,.erp-theme-option).active{background:var(--ui-accent-soft)!important;border-color:var(--ui-accent)!important;color:var(--ui-accent)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-appearance-option,.erp-theme-option) :is(b,span){color:inherit!important;-webkit-text-fill-color:currentColor!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-appearance-option svg{fill:none!important;stroke:currentColor!important}
  /* Match the mobile tenant/account pair without legacy dark adapters splitting their colors. */
  @media(max-width:900px){
   html[data-erp-mode="dark"] body.erp-system-ui .main>.top:has(#tenantViewBannerV3296) :is(#tenantViewBannerV3296,#erpLicenseButton){
    background:var(--ui-accent-soft)!important;color:var(--ui-accent-hover)!important;border-color:var(--ui-accent)!important;box-shadow:none!important;
   }
   html[data-erp-mode="dark"] body.erp-system-ui #tenantViewBannerV3296 :is(.tenant-view-label-v3296,.tenant-view-label-v3296 b,.tenant-view-return-v3296){color:inherit!important}
   html[data-erp-mode="dark"] body.erp-system-ui #tenantViewBannerV3296 .tenant-view-return-v3296{background:transparent!important;border-color:var(--ui-accent)!important}
   html[data-erp-mode="dark"] body.erp-system-ui .main>.top:has(#tenantViewBannerV3296) :is(#erpLicenseButton,.tenant-view-return-v3296):hover{background:var(--ui-surface)!important;color:var(--ui-accent-hover)!important}
   html[data-erp-mode="dark"] body.erp-system-ui .main>.top:has(#tenantViewBannerV3296) #erpLicenseButton::before{background:currentColor!important}
  }
  /* Icon tiles and masked action glyphs use separate surface/ink colors. */
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-v2-icon,.erp-color-icon,.profit-tool-icon-v3249,.profit-heading-icon-v447){background:var(--dm-raised)!important;border-color:var(--dm-line)!important;box-shadow:none!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.modal-mask .modal-head,#pm-dialog .pm-dialog-head,#pm-editor .pm-dialog-head,.lc-dialog>header,.pc-dialog>header):not(:has(.lc-issue-emblem)):not([data-erp-custom-heading])::before{background:var(--dm-raised)!important;border-color:var(--dm-line)!important;box-shadow:none!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.nav-ico,.nav-main-icon,.nav-sub-icon,.erp-head-tool,.erp-mobile-menu,.erp-mobile-close){color:var(--dm-text)!important}
  html[data-erp-mode="dark"] body.erp-system-ui .nav :is(.active,.has-active>.nav-parent) :is(.nav-ico,.nav-main-icon,.nav-sub-icon){color:var(--theme-accent)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.nav-arrow,.nav-parent-arrow,.nav-sub-arrow){color:var(--dm-muted)!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-head-tool:hover{background:var(--dm-raised)!important;color:var(--theme-accent)!important}
  /* The document's inline filter supplies the dark logo colors; no backing tile. */
  html[data-erp-mode="dark"] body.erp-system-ui :is(.erp-brand-logo-full,.erp-brand-logo-icon){background:transparent!important;border-radius:0!important;box-shadow:none!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-theme-note{color:var(--dm-muted)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.screen-chart-wrap,.dash-chart-wrap,.sa-chart) svg :is(text,tspan){fill:var(--dm-muted)!important;color:var(--dm-muted)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.screen-chart-wrap,.dash-chart-wrap,.sa-chart) svg [stroke="#e5e7eb"]{stroke:var(--dm-line)!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.legacy-thumb,.pm-photo,.detail-summary-img,.detail-product-img,.image-preview-img){background:#fff!important}
  html[data-erp-mode="dark"] body.erp-system-ui :is(.modal-mask,.erp-theme-mask){background:var(--ui-overlay)!important}
  html[data-erp-mode="dark"] body.erp-system-ui dialog::backdrop{background:var(--ui-overlay)!important}
  html[data-erp-mode="dark"] body.erp-system-ui .erp-mobile-backdrop{background:var(--ui-overlay)!important}
  html[data-erp-mode="dark"] body.erp-system-ui ::-webkit-scrollbar-track{background:transparent!important}
  html[data-erp-mode="dark"] body.erp-system-ui ::-webkit-scrollbar-thumb{background:#555!important;border-color:transparent!important}
 }
}
@media print{html[data-erp-mode]{color-scheme:light!important}}
