/* Foreground/background pairs shared by the complete site, including dialogs. */
:root, html[data-theme="bright"] {
  --muted: #4c5e79;
  --scheme-muted: #4c5e79;
  --good: #146c45;
  --success: #146c45;
  --scheme-positive: #146c45;
  --scheme-positive-rgb: 20 108 69;
  --accent: #205ac4;
  --brand: #205ac4;
  --panel: var(--paper-strong);
  --scheme-background: var(--bg);
  --scheme-text-rgb: 22 51 91;
  --primary-action-bg: #2055b2;
  --primary-action-text: #ffffff;
  --control-border: #74849c;
  --selection-ink: #081b33;
}
html[data-theme="dark"] {
  --muted: #b5c5de;
  --scheme-muted: #b5c5de;
  --good: #83e3b5;
  --success: #83e3b5;
  --success-soft: #203e39;
  --danger: #ffb3bf;
  --danger-soft: #482938;
  --scheme-positive: #83e3b5;
  --scheme-positive-rgb: 131 227 181;
  --accent: #a8caff;
  --brand: #a8caff;
  --panel: var(--paper-strong);
  --scheme-background: var(--bg);
  --scheme-text-rgb: 237 243 255;
  --primary-action-bg: #315a96;
  --primary-action-text: #ffffff;
  --control-border: #7189aa;
}
html[data-theme] .workspace-body :is(dialog, [role="dialog"], .modal-panel, .pokescan-modal__panel, .search-add-modal__panel, .ui-menu-popover) {
  color: var(--text);
  background: var(--paper-strong);
  border-color: var(--line);
}
html[data-theme] .workspace-body :is(dialog, [role="dialog"]) :is(h1, h2, h3, legend) { color: var(--text); }
html[data-theme] .workspace-body .ghost-button {
  background: var(--scheme-surface-soft);
  color: var(--brand-dark);
  border-color: var(--control-border);
}
html[data-theme] .workspace-body .ghost-button:is(:hover, :focus-visible) {
  background: var(--scheme-surface-raised);
  color: var(--text);
}
html[data-theme] .workspace-body .icon-button {
  color: var(--text);
  background: var(--scheme-surface-raised);
  border: 1px solid var(--control-border);
}
html[data-theme] .workspace-body .ui-help-tooltip {
  color: var(--text);
  background: var(--paper-strong);
  border-color: var(--line);
}
html[data-theme] .workspace-body :is(input, textarea, select) {
  border-color: var(--control-border);
  accent-color: var(--brand);
}
html[data-theme] .workspace-body :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme] .workspace-body option { color: var(--text); background: var(--scheme-field); }
html[data-theme] .workspace-body :is(button, input, select, textarea):disabled {
  opacity: 1;
  color: var(--muted);
  background: var(--scheme-surface-raised);
  border-color: var(--line);
  cursor: not-allowed;
}
html[data-theme] .workspace-body :is(.ui-topnav-link.is-active, .ui-side-link.is-active, .ui-primary-button) { color: var(--selection-ink); }
html[data-theme] .workspace-body :is(.ui-topnav-link.is-active,.ui-side-link.is-active){background:linear-gradient(135deg,#ffcb05,#ef5350)}
html[data-theme] .workspace-body .ui-side-link.is-active svg { color: var(--selection-ink); }
html[data-theme] .business-native .eyebrow { color: var(--scheme-warning); }
html[data-theme] #invoice-download-error { color: var(--scheme-danger); }
/* Keep the wallet's outline and flame, with a readable backdrop for its amount. */
#coinBalanceLink::before { background: linear-gradient(157deg,#176b86,#1551a3 47%,#123e75 77%,#125965); }
#coinBalanceLink.is-empty::before { background: linear-gradient(150deg,#974152,#793447 44%,#50304f); }
/* Status copy uses matching themed surfaces, even inside a native business view. */
html[data-theme] .workspace-body :is(.flash-warning, .notice-warning) { color: var(--scheme-warning); background: var(--scheme-warning-surface); }
html[data-theme] .workspace-body :is(.flash-error, .flash-danger) { color: var(--scheme-danger); background: var(--scheme-danger-surface); }
html[data-theme] .workspace-body .flash-success { color: var(--scheme-positive); background: var(--success-soft); }

html[data-theme] .workspace-body .ui-inventory-view-switch button[aria-pressed="true"]{color:var(--text);background:var(--scheme-selected);border-color:var(--scheme-accent-border)}
html[data-theme="bright"] #insightsPage{--insight-cost:#086a45}
html[data-theme="bright"] .purchase-welcome-price>s{color:var(--muted)}
html[data-theme] .workspace-body .ui-primary-button{background:var(--scheme-primary);color:var(--selection-ink);border-color:var(--scheme-warning-border)}
html[data-theme] .workspace-body .ui-primary-button:is(:hover,:focus-visible){background:var(--scheme-primary-hover);color:var(--selection-ink)}
/* Dashboard badges, metrics and action cards must use pairs in either scheme. */
html[data-theme] .business-native :is(.dash-badge,.dash-section-number,.dash-action-icon){color:var(--brand-dark);background:var(--scheme-surface-raised)}
html[data-theme] .business-native .dash-margin-gauge{color:var(--scheme-positive)}
html[data-theme] .business-native :is(.ink-negative,.dash-margin-gauge.is-negative){color:var(--scheme-danger)!important}
html[data-theme] .business-native .ink-positive{color:var(--scheme-positive)!important}
html[data-theme] .business-native :is(#potential-inventory-revenue,#price-group-sales-total){color:var(--brand-dark)}
html[data-theme] .business-native .bulk-value-label{color:var(--text)}
html[data-theme] .business-native .insight-ring>div{background:var(--paper-strong)}
html[data-theme] .business-native .insight-ring strong{color:var(--text)}
html[data-theme] .business-native .insight-ring span{color:var(--muted)}
html[data-theme] .business-native .dash-supply-row.is-low strong{color:var(--scheme-danger)}
html[data-theme] .business-native .dash-actions>a{background:var(--paper-strong);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .dash-equity :is(.eyebrow,.dash-badge){color:#d4e1f4;background:transparent}
html[data-theme] .business-native .dash-chart svg text{fill:var(--muted);opacity:1}
html[data-theme] .business-native .dash-equity svg text{fill:#d4e1f4}
/* Admin analytics previously mixed a dark translucent panel with bright-mode copy. */
html[data-theme="bright"] .analytics{--an-mint:#116c4a;--an-blue:#215aa6;--an-gold:#815112;--an-violet:#6744a1}
html[data-theme] .analytics :is(.an-panel,.an-kpi,.an-stat,.an-filters,.an-chart-tip,.an-income-sources article){background:var(--paper-strong);color:var(--text);border-color:var(--line)}
html[data-theme] .analytics .an-income-sources article>span{color:var(--text)}
html[data-theme] .analytics :is(.an-error,.an-status-error){color:var(--scheme-danger)!important}
html[data-theme] .business-native :is(.sales-settings-card,.sales-tier-panel,.purchase-period-strip,.shipping-sim-advanced){background:var(--paper-strong);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native :is(.resolve-category small,.resolve-wait-settings summary){color:var(--muted)}
html[data-theme] .business-native .shipping-sim-advanced summary{color:var(--brand-dark)}
/* The bright-mode link hover color must not leak onto the dark navigation rail. */
html[data-theme] .ui-topbar :is(.ui-brand,.ui-signin,.ui-avatar,.ui-topnav-link:not(.is-active)):hover{color:#ffffff}
html[data-theme] .workspace-sidebar :is(.ui-side-link:not(.is-active),.ui-user-summary a):hover{color:#ffffff}
html[data-theme] .business-native :is(#revenue-section,#customers-section,#stock-section,#shipping-section) .dash-section-number{color:var(--text);background:var(--scheme-selected)}
/* The empty image preview sits on the black camera/crop canvas in either theme. */
html[data-theme] #settingsPreviewEmpty{color:#d4e1f4}
html[data-theme] .workspace-body :is(button,a,summary,input,select,textarea):focus-visible{outline:2px solid var(--brand-dark);outline-offset:3px}
html[data-theme] .ui-topbar :is(.ui-topnav-link,.ui-icon-button,.ui-brand,.ui-signin,.ui-avatar):focus-visible,
html[data-theme] .workspace-sidebar :is(.ui-side-link,.ui-user-summary a):focus-visible{outline-color:#ffe187}
html[data-theme] .business-native :is(.workflow-card,.bulk-calculator-section,.bulk-calculator-output){background:var(--scheme-surface-soft);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .bulk-calculator-dialog .stack-form>.bulk-calculator-grid:first-child{background:var(--scheme-surface-soft);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .supply-calculator-results>div{background:var(--scheme-surface-soft);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .supply-calculator-results .supply-calculator-unit{background:var(--scheme-selected);color:var(--text);border-color:var(--scheme-accent-border)}

/* Content surfaces must change with their text, including previews and the
   expanded states of calculators, purchase details and reconciliation forms. */
html[data-theme] .business-native :is(
  .resolve-effects>div,.resolve-note,.resolve-context,.resolve-allocation-form,
  .resolve-case:target,.resolve-symbol,.set-rank,
  .purchase-milestones>div,.purchase-quantity-grid>div,.purchase-card-period,
  .supply-calculator-dialog,.shipping-simulator-dialog,.shipping-sim-notice,
  .bulk-value-card.is-value
){background:var(--scheme-surface-soft);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .resolve-effects span{color:var(--muted)}
html[data-theme] .business-native .resolve-effects strong{color:var(--text)}
html[data-theme] .business-native :is(
  .resolve-status,.resolve-change.is-addition,.shipping-sim-notice.success,
  .shipping-sim-budget,.purchase-milestones .is-covered,.purchase-milestones .is-positive
){background:var(--success-soft);color:var(--scheme-positive);border-color:var(--scheme-accent-border)}
html[data-theme] .business-native :is(
  .resolve-status.open,.purchase-status,.unit-label-confirm,
  .shipping-sim-budget.incomplete,.shipping-sim-notice.warning
){background:var(--scheme-warning-surface);color:var(--scheme-warning);border-color:var(--scheme-warning-border)}
html[data-theme] .business-native :is(
  .resolve-change.is-deduction,.shipping-sim-budget.over,.purchase-milestones .is-negative,
  .usage-rules-table tr.is-supply-inactive>td,
  .usage-rules-table tr.is-supply-inactive .method-choice
){background:var(--scheme-danger-surface);color:var(--scheme-danger);border-color:var(--scheme-danger-border)}
html[data-theme] .business-native .resolve-status.void{background:var(--scheme-surface-raised);color:var(--muted)}
html[data-theme] .business-native .resolve-pending{color:var(--scheme-warning)}
html[data-theme] .business-native :is(
  .shipping-sim-method-info>summary:hover,.shipping-sim-method-info[open]>summary,
  .shipping-sim-info>summary:hover,.shipping-sim-alternatives tr.selected,
  .dash-info>summary:hover,.dash-info[open]>summary,
  tr[id^="candidate-"]:target>td
){background:var(--scheme-selected);color:var(--text)}
html[data-theme] .business-native #euer-dashboard :is(input,select,textarea){background:var(--scheme-field);color:var(--text)}
html[data-theme] .business-native .invoice-xml-view .invoice-text-word:hover{background:var(--scheme-selected);color:var(--text)}
html[data-theme] .purchase-eyebrow{color:var(--scheme-warning)}
html[data-theme] .business-native .dash-supply-row:not(.is-low) strong{color:var(--scheme-positive)}
html[data-theme] .business-native :is(.sales-order-card,.sales-empty-state){background:var(--paper-strong);color:var(--text);border-color:var(--line)}
html[data-theme] .business-native .sales-empty-state{color:var(--muted)}
/* Inactive controls keep their state while their labels remain readable. */
html[data-theme] .workspace-body label:has(:is(input,select,textarea):is(:disabled,[readonly])){opacity:1!important}
html[data-theme] .workspace-body label:has(:is(input,select,textarea):is(:disabled,[readonly]))>span{color:var(--muted)}
html[data-theme] .business-native :is(.shipping-sim-metric.is-negative,.shipping-sim-outcome.over,.shipping-sim-ratio.over)>strong{color:var(--scheme-danger)}
html[data-theme] .business-native :is(.shipping-sim-outcome.within,.shipping-sim-ratio.within)>strong{color:var(--scheme-positive)}
html[data-theme] .business-native :is(.shipping-sim-outcome.incomplete,.shipping-sim-ratio.incomplete)>strong{color:var(--scheme-warning)}
html[data-theme] .business-native :is(.dashboard-detail-period,.set-overlay-counts strong){color:var(--brand-dark)}
html[data-theme] .business-native :is(.purchase-status.listed,.purchase-status.is-covered){background:var(--success-soft);color:var(--scheme-positive);border-color:var(--scheme-accent-border)}
