/* CTR SUITE: global theme-aware visual surfaces; loaded after workspace CSS.
   Semantic success/warning/error remain unchanged. */
:root {
  --ctr-palette-canvas:color-mix(in srgb,var(--blue) 5%,#f3f5fb);
  --ctr-palette-surface:#fff;
  --ctr-palette-surface-muted:color-mix(in srgb,var(--blue) 4%,#fff);
  --ctr-palette-line:color-mix(in srgb,var(--blue) 12%,#dce4f2);
  --ctr-palette-hero-start:color-mix(in srgb,var(--blue) 25%,#172745);
  --ctr-palette-hero-end:color-mix(in srgb,var(--blue) 45%,#24395a);
  --ctr-palette-topbar:color-mix(in srgb,var(--blue) 3%,#fff);
  --ctr-palette-row-hover:color-mix(in srgb,var(--blue) 7%,#fff);
}
html[data-theme="dark"] {
  --ctr-palette-canvas:color-mix(in srgb,var(--blue) 5%,#0b1120);
  --ctr-palette-surface:color-mix(in srgb,var(--blue) 3%,#111827);
  --ctr-palette-surface-muted:color-mix(in srgb,var(--blue) 7%,#151e2f);
  --ctr-palette-line:color-mix(in srgb,var(--blue) 14%,#273244);
  --ctr-palette-topbar:color-mix(in srgb,var(--blue) 4%,#0b1120);
  --ctr-palette-row-hover:color-mix(in srgb,var(--blue) 11%,#151e2f);
}
/* Shared canvas, header, and workspace panels. */
html body:has(.app) { --ctr-surface-border:var(--ctr-palette-line); }
html :is(.main,.content,.module-page,.profile-page,.customer-page,.reports-detail-page,.sales-modern-page) {
  background-color:var(--ctr-palette-canvas);
}
html .topbar { background-color:var(--ctr-palette-topbar)!important; border-color:var(--ctr-palette-line)!important; }
html[data-sidebar-theme="theme"] .sidebar { background:linear-gradient(180deg,var(--sidebar-1),var(--sidebar-2))!important; }
/* Neutral card backgrounds remain light/dark readable but carry selected theme tint. */
html :is(.m-card,.m-kpi,.pb-card,.stat-card,.insight-card,.profile-card,.catalog-card,.cart-card,.customer-stat,.customer-toolbar,.customer-table-wrap,.settings-nav,.filter-bar,.list-card,.tbl-card,.billing-card) {
  background-color:var(--ctr-palette-surface)!important;
  border-color:var(--ctr-palette-line)!important;
}
html :is(.m-card-head,.list-head,.billing-card-head,.customer-table thead,.m-table thead,.sales-table thead) { border-color:var(--ctr-palette-line); }
html :is(.m-table thead,.customer-table thead,.sales-table thead,.tbl-card thead) {background-color:var(--ctr-palette-surface-muted)!important;}
html :is(.m-table tbody tr:hover,.customer-table tbody tr:hover,.sales-table tbody tr:hover) {background-color:var(--ctr-palette-row-hover)!important;}
html :is(.m-modal,.modal-content,.m-drawer,.drawer-content,.dropdown-menu,.user-menu,.help-menu) {
  background-color:var(--ctr-palette-surface)!important;
  border-color:var(--ctr-palette-line)!important;
}
/* Accent-selectors: target only active/selected elements, not success/error badges. */
html :is(.tab.active,.tabs .active,.nav-tab.active,.filter-chip.active,.category-chip.active,.pagination .active) {
  border-color:var(--blue)!important;
}
html :is(.theme-v2-preview,.theme-v2-preview-main) {background-color:var(--ctr-palette-canvas)!important;}
html .theme-v2-preview-table::before {background:var(--blue-soft)!important;}
/* Theme-wide hero colors, without changing geometry or contents. */
html :is(.module-hero,.page-hero,.inventory-hero,.stock-hero,.supplier-hero,.purchase-hero,.hero-banner) {
  background:linear-gradient(115deg,var(--ctr-palette-hero-start),var(--ctr-palette-hero-end))!important;
}
/* Do not override semantic status or destructive actions. */
/* Module headline banners in this build. Keep text contrast against dark gradients. */
html :is(.ctr-stock-page-head,.pb-page-head,.ctr-supplier-page-head,.ctr-promo-page-head) {
  background:linear-gradient(115deg,var(--ctr-palette-hero-start),var(--ctr-palette-hero-end))!important;
  border-color:color-mix(in srgb,var(--blue) 20%,transparent)!important;
}
html :is(.ctr-stock-page-head,.pb-page-head,.ctr-supplier-page-head,.ctr-promo-page-head) :is(h1,h2,p) {color:#fff!important;}
/* Accent tints for standard workspace tabs and informational elements. */
html :is(.ctr-flow-nav a.active,.ctr-stock-tabs a.active) {border-color:var(--blue)!important;}
html :is(.ctr-stock-guide,.theme-mode-note) {border-color:var(--ctr-palette-line)!important;}
/* Consistent control borders and focus without recoloring business semantics. */
html :is(.m-input,.m-select,.m-textarea,.pb-input,.pb-select,.search-box) {border-color:var(--ctr-palette-line);}
html :is(.m-input,.m-select,.m-textarea,.pb-input,.pb-select):focus-visible {border-color:var(--blue)!important;outline-color:var(--blue)!important;}
