/* Screen-only shared surfaces. The approved palettes live in glow-themes.css. */
@media screen {
  html[data-appearance] body :is(.inventory-page,.mw-workspace,.op-workspace,.mg-workspace,.integrations-screen,.commerce-screen,.report-center,.platform-body,.core-account) {
    --inv-ink:var(--ui-ink);--inv-muted:var(--ui-muted);--inv-border:var(--ui-line);--inv-blue:var(--ui-accent);
    --mw-accent:var(--ui-accent);--mw-surface:var(--ui-panel);
    --op-surface:var(--ui-panel);--op-muted:var(--ui-muted);--op-accent:var(--ui-accent);
    --ix-border:var(--ui-line);--ix-muted:var(--ui-muted);--ix-surface:var(--ui-panel);--ix-accent:var(--ui-accent);
    color:var(--ui-ink);
  }
  /* Menu / products / preparations: counts, footer actions, records and editors. */
  html[data-appearance] body .mw-nav-grid.mw-candidate .mw-nav-card :is(strong,.mw-card-description) {color:var(--ui-ink)!important}
  html[data-appearance] body .mw-nav-grid.mw-candidate .mw-nav-card .mw-card-description {color:var(--ui-muted)!important}
  html[data-appearance] body .mw-nav-grid.mw-candidate .mw-nav-card .mw-card-count {background:var(--ui-soft)!important;color:var(--ui-muted)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body .mw-nav-grid.mw-candidate .mw-nav-card .mw-card-open {background:color-mix(in srgb,var(--card-accent,var(--ui-accent)) 9%,var(--ui-panel))!important;color:var(--card-accent,var(--ui-accent))!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.mw-editor-banner,.mw-media,.mw-reference-help,.mw-recipe-intro,.mw-recipe-totals>div,.mw-check-grid label,.mw-allergen-grid fieldset,.mce-current span,.mce-ack,.mwr-fixed-unit,.mwi-quantity-row,.mwm-options,.mvp-note,.mvp-item,.mw-operation-review,.mw-section-number,.mw-section-count,.mw-card-count,.mwp-state,.mvp-status) {background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.mw-editor-banner strong,.mw-profile-summary strong,.mw-recipe-totals strong,.mw-operation-summary strong,.mw-operation-review strong,.mw-record-preview strong) {color:var(--ui-ink)!important}
  html[data-appearance] body :is(.mw-editor-banner small,.mw-recipe-totals small,.mw-operation-summary span,.mw-operation-review small,.mvp-note,.mw-card-count) {color:var(--ui-muted)!important}
  html[data-appearance] body :is(.mw-setting-shortcut,.mce-dialog summary,.mce-transfers li,.mwi-dialog .mw-dialog-actions,.mmc-dialog .mw-dialog-actions,.mwm-group header,.mmc-option,.mw-media-editor,.mw-image-pending) {background:var(--ui-panel)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  /* Operations / finance / B2B / customer and supplier accounts. */
  html[data-appearance] body :is(.op-workspace .op-back,.op-status,.op-prep-costs>div,.mg-profile-tabs button,.commerce-flow,.commerce-close,.commerce-form .commerce-check,.commerce-product-results button,.commerce-catalog-switch,.commerce-proof-upload,.ca-statement-summary,.sp-design-note) {background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.op-table th,.mg-table th,.commerce-table th,.ca-table th,.sp-table th) {background:var(--ui-soft)!important;color:var(--ui-muted)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.op-card-top small,.mg-card-top small,.op-empty p,.op-context,.mg-note,.commerce-note,.ca-caption,.sp-heading p) {color:var(--ui-muted)!important}
  /* Stock count page and its edit/import dialogs. */
  html[data-appearance] body #modalWrap.sc-count-open .modal,html[data-appearance] body :is(.sc-page-body,.sc-session,.sc-empty,.sc-kpi,.sc-summary,.sc-import-review,.sc-table-wrap,.sc-search) {background:var(--ui-panel)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body #modalWrap.sc-count-open #modalTitle,html[data-appearance] body :is(.sc-page-header h1,.sc-kpi strong,.sc-system,.sc-table .sc-actual,.sc-kpi span) {color:var(--ui-ink)!important}
  html[data-appearance] body :is(.sc-table th,.sc-unit,.sc-state,.sc-toolbar button,.sc-footer button,.sc-import-review button,.sc-table input) {background:var(--ui-raised)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.sc-kpi.counted,.sc-kpi.pending,.sc-kpi.variance) {background:var(--ui-soft)!important}
  html[data-appearance] body .sc-kpi.pending strong {color:var(--ui-warning)!important}
  html[data-appearance] body .sc-kpi.variance strong {color:var(--ui-error)!important}
  html[data-appearance] body .sc-kpi.counted strong {color:var(--ui-success)!important}
  /* Reports / integrations / import / application configuration. */
  html[data-appearance] body :is(.ix-connector,.ix-summary article,.ix-tabs,.ix-readiness,.ix-data-item,.ix-data-item:has(input:checked),.ix-family-card .ix-family-footer,.integration-dialog,.integration-dialog header button,.fi-panel,.fi-catalog .ix-summary article,.rc-group,.rc-report-cards button,.rc-metrics article,.rc-notes,.rc-table-panel,.rc-empty,.rc-unavailable,.rc-filter,.rc-search,.rc-catalog-search,.rc-scope,.branch-reporting-dialog,.br-dialog.commerce-dialog,.bbr-dialog.commerce-dialog,.bbr-dialog form,.bd-dialog.commerce-dialog,.bd-close,.bd-category-list label,.bd-counts span,.bd-dialog .bd-context) {background:var(--ui-panel)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.ix-summary img,.ix-preview,.ix-status,.ix-muted-pill,.ix-button,.ix-tabs button,.rc-circle,.rc-actions button,.rc-actions a,.rc-pagination button,.branch-reporting-dialog header>img,.branch-reporting-dialog [data-dismiss],.fi-table th,.report-center th) {background:var(--ui-soft)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.rc-group h2,.rc-report-cards strong,.rc-metrics strong,.rc-table-panel h2,.ix-readiness h3,.ix-data-item strong,.ix-family-card h2) {color:var(--ui-ink)!important}
  /* Account / branch transfer / subscriptions / platform owner. */
  html[data-appearance] body .modal-wrap.account-compact .modal,html[data-appearance] body :is(.core-review-card,.core-account button,.core-branch,.core-empty,.core-session,.p-demo-notice,.platform-body label.p-check,.p-form details,.platform-body button.p-list-row) {background:var(--ui-panel)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body :is(.core-review-card label,.core-account h4,.core-count-heading,.br-list strong,.bd-heading h2,.bd-dialog h3,.p-list-row strong,.p-form legend) {color:var(--ui-ink)!important}
  html[data-appearance] body :is(.bd-price-table input:disabled,.core-master-cards button,.core-profile-link,.core-live) {background:var(--ui-soft)!important;color:var(--ui-muted)!important;border-color:var(--ui-line)!important}
  /* Buttons selected by the existing application keep an obvious selected state. */
  html[data-appearance] body :is(.mw-section-tabs,.mw-product-tabs,.mw-filters,.mw-categories,.mg-profile-tabs,.mg-order-counts,.commerce-catalog-switch,.ca-tabs,.ix-tabs,.rc-pagination,.inventory-filters) :is(button[aria-pressed=true],button[aria-selected=true],button[aria-current=page],button.active,button.selected),
  html[data-appearance] body :is(.commerce-button.primary,.inventory-action.primary,.sc-toolbar button.primary,.sc-footer button.primary,.sc-footer button.sc-primary,.sc-toolbar button.sc-primary,.sc-primary,.ix-button.primary,.ix-button.ix-primary,.core-account button.core-primary,.br-dialog button.primary,.bd-dialog button.primary,.platform-body .p-primary) {background:var(--ui-accent)!important;color:var(--ui-accent-ink)!important;border-color:var(--ui-accent)!important}
  html[data-appearance] body :is(.ix-data-item:has(input:checked),.rc-report-cards button.selected,.commerce-card.selected,.inventory-category-card[aria-pressed=true]) {background:var(--ui-tint)!important;border-color:var(--ui-accent)!important;color:var(--ui-ink)!important;box-shadow:inset 0 0 0 1px var(--ui-accent)!important}
  html[data-appearance] body :is(.commerce-button.danger,.platform-body .p-danger,.core-account button.danger) {background:color-mix(in srgb,var(--ui-error) 10%,var(--ui-panel))!important;color:var(--ui-error)!important;border-color:color-mix(in srgb,var(--ui-error) 40%,var(--ui-line))!important}
  html[data-appearance] body .mw-check-grid label:has(:checked),html[data-appearance] body .mw-allergen-grid fieldset:has(:checked) {background:var(--ui-tint)!important;border-color:var(--ui-accent)!important}
  /* White legacy icon plates must not survive before/without mask enhancement. */
  html[data-appearance=dark] body .reference-home .ref-card-rows .ref-tile .ref-tile-icon,
  html[data-appearance=dark] body .mw-nav-grid.mw-candidate .mw-nav-card .mw-card-icon {background:transparent!important;background-image:none!important;border-color:transparent!important;box-shadow:none!important}
  html[data-appearance] body .reference-home .ref-card-rows .ref-tile .ref-tile-icon {align-self:center!important}
  /* Header search and date have both surface and foreground colors in dark mode. */
  html[data-appearance] body .maxdash-header .ref-global-search,
  html[data-appearance] body .maxdash-header .toolbar #dateSelect,
  html[data-appearance] body .maxdash-header .toolbar #languageToggle,
  html[data-appearance] body .maxdash-header .toolbar #notifications {background:var(--ui-panel)!important;background-image:none!important;border-color:var(--ui-line)!important;color:var(--ui-ink)!important}
  html[data-appearance] body .maxdash-header .ref-global-search #homeSearch {background:transparent!important;border:0!important;color:var(--ui-ink)!important}
  html[data-appearance] body .maxdash-header .toolbar #dateSelect span {color:var(--ui-ink)!important}
  /* Inventory: compact opening, one coherent snapshot instead of a blue/white block. */
  html[data-appearance] body .inventory-page .inventory-experience-heading {gap:20px;margin:0 0 20px;align-items:center}
  html[data-appearance] body .inventory-page .inventory-experience-heading h1 {font-size:30px!important;line-height:1.5!important;margin:4px 0!important;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page .inventory-experience-heading p {font-size:14px!important;line-height:1.7;color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page .inventory-experience-actions {gap:8px;flex-wrap:wrap}
  html[data-appearance] body .inventory-page .inventory-experience-actions .inventory-action {min-height:40px;height:auto;padding:9px 14px;border-radius:12px;background:var(--ui-raised)!important;color:var(--ui-ink)!important;border-color:var(--ui-line)!important;font-size:13px!important}
  html[data-appearance] body .inventory-page .inventory-experience-actions .inventory-action.primary {background:var(--ui-accent)!important;border-color:var(--ui-accent)!important;color:var(--ui-accent-ink)!important}
  html[data-appearance] body .inventory-page .inventory-experience-summary {grid-template-columns:minmax(0,1.7fr) minmax(240px,1fr);gap:16px;margin-bottom:24px;align-items:stretch}
  html[data-appearance] body .inventory-page .inventory-snapshot {grid-template-columns:minmax(190px,.85fr) minmax(0,1.2fr);border-radius:18px;background:var(--ui-panel)!important;border-color:var(--ui-line)!important;box-shadow:var(--ui-shadow)!important}
  html[data-appearance] body .inventory-page .inventory-value-hero {min-height:0;height:auto;justify-content:center;gap:8px;padding:20px;background:linear-gradient(145deg,var(--ui-tint),var(--ui-panel))!important;color:var(--ui-ink)!important;border:0;border-inline-end:1px solid var(--ui-line);border-radius:0}
  html[data-appearance] body .inventory-page .inventory-value-hero>span {font-size:12px;line-height:1.6;color:var(--ui-muted)!important;letter-spacing:0}
  html[data-appearance] body .inventory-page .inventory-value-hero>strong {font-size:28px!important;line-height:1.3;margin:0!important;color:var(--ui-accent)!important;font-variant-numeric:tabular-nums}
  html[data-appearance] body .inventory-page .inventory-value-hero>small {font-size:11px;color:var(--ui-muted)!important;line-height:1.7}
  html[data-appearance] body .inventory-page .inventory-value-hero img {filter:var(--ui-icon-filter)!important}
  html[data-appearance] body .inventory-page .inventory-health {padding:18px;background:var(--ui-panel)!important;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page :is(.inventory-health,.inventory-priorities) header {margin-bottom:14px}
  html[data-appearance] body .inventory-page :is(.inventory-health,.inventory-priorities) h2 {font-size:16px;line-height:1.5;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page :is(.inventory-health,.inventory-priorities) header>span {padding:4px 8px;background:var(--ui-soft)!important;color:var(--ui-muted)!important;font-size:10px}
  html[data-appearance] body .inventory-page .inventory-health-stats {gap:12px}
  html[data-appearance] body .inventory-page .inventory-health-stats button {background:transparent!important;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page .inventory-health-stats strong {font-size:25px;line-height:1.3}
  html[data-appearance] body .inventory-page .inventory-health-stats button:nth-child(2) strong {color:var(--ui-warning)!important}
  html[data-appearance] body .inventory-page .inventory-health-stats button:nth-child(3) strong {color:var(--ui-error)!important}
  html[data-appearance] body .inventory-page .inventory-health-stats span {font-size:11px;color:var(--ui-muted)!important;line-height:1.7}
  html[data-appearance] body .inventory-page .inventory-health-bar {margin:12px 0;height:5px;background:var(--ui-soft)!important}
  html[data-appearance] body .inventory-page .inventory-health p {font-size:11px;color:var(--ui-muted)!important;line-height:1.7}
  html[data-appearance] body .inventory-page .inventory-priorities {padding:18px;border-radius:18px;background:var(--ui-panel)!important;border-color:var(--ui-line)!important;box-shadow:var(--ui-shadow)!important}
  html[data-appearance] body .inventory-page .inventory-priorities>button {padding:8px 0;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page .inventory-priorities>button>strong {width:32px;height:32px;background:var(--ui-tint)!important;color:var(--ui-warning)!important}
  html[data-appearance] body .inventory-page .inventory-priorities>button:nth-of-type(n+2)>strong {background:color-mix(in srgb,var(--ui-error) 12%,var(--ui-panel))!important;color:var(--ui-error)!important}
  html[data-appearance] body .inventory-page .inventory-priorities b {color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page .inventory-priorities small {color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page :is(.inventory-stock-details,.inventory-category-section,.inventory-table-wrap,.inventory-supplier-card,.inventory-location-card,.inventory-category-card) {background:var(--ui-panel)!important;border-color:var(--ui-line)!important;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page :is(.inventory-stock-details>summary,.inventory-card-copy b,.inventory-value-cell,.inventory-sections-heading h2,.inventory-view-heading h2) {color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page :is(.inventory-table th,.inventory-filters,.inventory-table-toolbar,.inventory-filter-btn,.inventory-card-symbol,.inventory-card-open) {background:var(--ui-soft)!important;border-color:var(--ui-line)!important;color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page :is(.inventory-card-copy small,.inventory-card-footer,.inventory-sections-heading p,.inventory-view-heading p) {color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page .inventory-section-card .inventory-card-content {flex-direction:row!important;gap:12px;align-items:flex-start}
  html[data-appearance] body .inventory-page .inventory-section-card .inventory-card-copy b {font-size:18px!important;line-height:1.6!important}
  html[data-appearance] body .inventory-page .inventory-section-card .inventory-card-symbol {width:44px;height:44px;padding:10px;box-sizing:border-box;border-radius:12px}
  /* Imported documents / photos and receipt print canvases intentionally retain their own pixels. */
  @media(max-width:1100px) {
    html[data-appearance] body .inventory-page .inventory-experience-summary {grid-template-columns:1fr}
    html[data-appearance] body .inventory-page .inventory-priorities {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:20px}
    html[data-appearance] body .inventory-page .inventory-priorities header {grid-column:1/-1}
  }
  @media(max-width:700px) {
    html[data-appearance] body .inventory-page .inventory-experience-heading {align-items:stretch;gap:16px}
    html[data-appearance] body .inventory-page .inventory-experience-heading h1 {font-size:27px!important}
    html[data-appearance] body .inventory-page .inventory-experience-actions .inventory-action {flex:1 1 auto;justify-content:center;padding:9px 10px}
    html[data-appearance] body .inventory-page .inventory-snapshot {grid-template-columns:1fr}
    html[data-appearance] body .inventory-page .inventory-value-hero {display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto;align-items:center;gap:6px 16px;padding:16px;border-inline-end:0;border-bottom:1px solid var(--ui-line)}
    html[data-appearance] body .inventory-page .inventory-value-hero>strong {grid-column:2;grid-row:1/3;font-size:26px!important;max-width:55vw;overflow-wrap:anywhere}
    html[data-appearance] body .inventory-page .inventory-value-hero>span {grid-column:1;grid-row:1}
    html[data-appearance] body .inventory-page .inventory-value-hero>small {grid-column:1;grid-row:2}
    html[data-appearance] body .inventory-page .inventory-health {padding:16px}
    html[data-appearance] body .inventory-page .inventory-priorities {column-gap:14px}
    html[data-appearance] body .inventory-page .inventory-priorities>button {gap:8px;min-width:0}
    html[data-appearance] body .inventory-page .inventory-priorities b {font-size:12px;line-height:1.7}
    html[data-appearance] body .inventory-page .inventory-priorities small {font-size:10px;line-height:1.7}
    html[data-appearance] body .inventory-page .inventory-priorities>button>img {display:none}
  }
  @media(max-width:380px) {
    html[data-appearance] body .inventory-page .inventory-value-hero {grid-template-columns:1fr}
    html[data-appearance] body .inventory-page .inventory-value-hero>strong {grid-column:1;grid-row:2;max-width:none}
    html[data-appearance] body .inventory-page .inventory-value-hero>small {grid-row:3}
  }
}
@media screen {
  /* Inventory detail views: compact KPIs and explicit readable action states. */
  html[data-appearance] body .inventory-page :is(.inventory-tab,.inventory-all-branches,.inventory-action,.inventory-export) {color:var(--ui-ink)!important;border-color:var(--ui-line)!important}
  html[data-appearance] body .inventory-page :is(.inventory-tab.active,.inventory-all-branches.selected) {background:var(--ui-tint)!important;color:var(--ui-accent)!important;border-color:var(--ui-accent)!important}
  html[data-appearance] body .inventory-page .inventory-action.primary {background:var(--ui-accent)!important;color:var(--ui-accent-ink)!important;border-color:var(--ui-accent)!important}
  html[data-appearance] body .inventory-page .inventory-module-kpi {min-height:0!important;padding:16px!important;border-color:var(--ui-line)!important;background:var(--ui-panel)!important}
  html[data-appearance] body .inventory-page .inventory-module-kpi>b {font-size:25px!important;line-height:1.4!important;margin-top:8px!important;color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page .inventory-module-kpi>span {font-size:13px!important;line-height:1.7!important;color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page .inventory-module-kpi>small {font-size:11px!important;line-height:1.7!important;color:var(--ui-muted)!important}
  html[data-appearance] body .inventory-page :is(.inventory-item-name b,.inventory-location-card strong,.inventory-supplier-card strong) {color:var(--ui-ink)!important}
  html[data-appearance] body .inventory-page :is(.inventory-module,.inventory-detail-panel,.inventory-section-switcher,.inventory-panel,.inventory-item-toolbar) {border-color:var(--ui-line)!important}
}
