/* Box Boy V5.8.33 - Design tokens and scoped components.
   DO NOT apply borders to arbitrary divs, maps, chart internals or media. */
body.boxboy-theme-light{
  --bb33-page:#f5f7f9; --bb33-surface:#fff; --bb33-surface-alt:#fbfcfd;
  --bb33-surface-row:#f7f9fb; --bb33-text:#172732; --bb33-muted:#45596a;
  --bb33-orange:#ffb957; --bb33-outline:#ffb957;
  --bb33-divider:#e1e7ed; --bb33-field-border:#aebcc9;
  --bb33-primary-text:#2c210d; --bb33-purple:#3e1284; --bb33-purple-text:#fff;
  --bb33-focus:#864000; --bb33-radius:10px; --bb33-radius-sm:8px;
  --bb33-control-h:38px; --bb33-gap:12px;
}
body.boxboy-theme-dark{
  --bb33-page:#081b2b; --bb33-surface:#0d2434; --bb33-surface-alt:#102c3f;
  --bb33-surface-row:#122e40; --bb33-text:#eff6fc; --bb33-muted:#bfd1dd;
  --bb33-orange:#ffb957; --bb33-outline:#d79b57;
  --bb33-divider:#335063; --bb33-field-border:#597386;
  --bb33-primary-text:#241b10; --bb33-purple:#5825a5; --bb33-purple-text:#fff;
  --bb33-focus:#ffcd78; --bb33-radius:10px; --bb33-radius-sm:8px;
  --bb33-control-h:38px; --bb33-gap:12px;
}
/* Prefer color roles over component-specific grays. Preserve maps and workflow status palettes. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage{
  --bb-card-border:var(--bb33-outline); --bb-card-radius:var(--bb33-radius);
  --bb-field-border:var(--bb33-field-border); color:var(--bb33-text);
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(
 .card,.kpi,.dashboard-kpi-v5655,.dashboard-filters-v5655,.dashboard-quick-card-v5655,
 .report-filter-panel,.general-report-table-card,.orders-panel-list,.orders-order-card,
 .orders-group,.orders-group-header,.ship-card,.courier-kpis .kpi,
 .heat-filter-grid,.heat-side>.card,.queue-general-card-v5736,.queues-editor-card-v5637,
 .clan-list-card,.clan-editor-card,.v50-filter-card,.v50-list-card,
 .courier-admin-filter-card-v539,.courier-admin-list-card-v539,.courier-admin-detail-card-v539,
 .bb-reg-kpi-v5738,.access-create-card-v5620,.audit-filter-card-v563,.audit-list-card-v563,
 .af-panel-v5751,.af-kpi-v5751,.mg-panel-v584,.mg-kpi-v584,.mg-store-card-v584,
 .wd-kpi-v5622,.wd-provider-item-v5622,.wd-exempt-kpi-v5750,
 .billing-form-card-v571,.billing-kpi-v571,.billing-close-kpi-v5723,
 .billing-close-fields-panel-v5723,.billing-bulk-closing-v5720,
 .focus-v5731-kpi,.qw-card,.bb-extra-kpi-v5746,.bb-extra-overlaps-v5746,
 .bb-extra-map-card-v5746,.bb-extra-rule-summary-v5746,.extra-fee-overview-v559,
 .apk-panel-v5733,.app-banner-kpi-v5673,.app-banner-workspace-v5673,
 .perf-diagnostics-v5831,.developer-section-v5696,.communications-editor-v562,
 .communications-filter-card-v562,.communications-table-card-v562,.communications-manual-v562,
 .whatsapp-store-row-v562,.collections-toolbar-card-v569
 ){
  border:1px solid var(--bb33-outline)!important;
  border-radius:var(--bb33-radius)!important;
  box-shadow:none;
}
/* Surface synchronization prevents black text on old dark backgrounds (V5.8.32). */
body.boxboy-theme-light .tabpage :is(
 .card,.dashboard-kpi-v5655,.dashboard-filters-v5655,.dashboard-quick-card-v5655,
 .report-filter-panel,.general-report-table-card,.ship-card,.queue-general-card-v5736,
 .af-panel-v5751,.af-kpi-v5751,.mg-panel-v584,.mg-kpi-v584,
 .v50-filter-card,.v50-list-card,.courier-admin-filter-card-v539,
 .courier-admin-list-card-v539,.courier-admin-detail-card-v539,
 .access-create-card-v5620,.audit-filter-card-v563,.audit-list-card-v563,
 .billing-form-card-v571,.billing-close-fields-panel-v5723,.billing-close-kpi-v5723,
 .communications-editor-v562,.whatsapp-store-row-v562,.apk-panel-v5733,
 .app-banner-workspace-v5673,.developer-section-v5696,.perf-diagnostics-v5831,
 .orders-order-card,.orders-group,.orders-group-header
 ){
  background:var(--bb33-surface)!important;
  background-image:none!important;
  color:var(--bb33-text)!important;
}
body.boxboy-theme-dark .tabpage :is(
 .card,.ship-card,.queue-general-card-v5736,.af-panel-v5751,
 .mg-panel-v584,.v50-filter-card,.v50-list-card,.courier-admin-filter-card-v539,
 .courier-admin-list-card-v539,.courier-admin-detail-card-v539,
 .access-create-card-v5620,.audit-filter-card-v563,.audit-list-card-v563,
 .communications-editor-v562,.whatsapp-store-row-v562,.apk-panel-v5733,
 .app-banner-workspace-v5673,.developer-section-v5696,.perf-diagnostics-v5831
 ){
  background:var(--bb33-surface)!important;
  background-image:none!important;
  color:var(--bb33-text)!important;
}
/* Consistent gaps without changing grids or business-specific layouts. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(
 .dashboard-kpis-v5655,.kpis,.finance-grid,.heat-layout,.ship-grid,
 .clan-admin-grid,.admin-grid,.app-banner-workspace-v5673,.wd-kpis-v5622,
 .mg-kpis-v584,.af-kpis-v5751
 ){gap:var(--bb33-gap)}
/* Inner dividers are intentionally less vivid than card outline. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(
 .tablewrap,.registration-table-wrap,.courier-admin-table-wrap-v539,
 .af-table-wrap-v5751,.mg-table-wrap-v584,.v50-table-wrap,
 .audit-table-wrap-v563,.communications-tablewrap-v562,
 .orders-form-section,.orders-modal-head,.courier-simple-modal-head-v539
 ){border-color:var(--bb33-divider)!important}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea){
  border:1px solid var(--bb33-field-border);border-radius:var(--bb33-radius-sm);
  min-height:var(--bb33-control-h);box-shadow:none;
}
body.boxboy-theme-light .tabpage :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea){
  background:var(--bb33-surface)!important;color:var(--bb33-text)!important;
}
body.boxboy-theme-dark .tabpage :is(input:not([type=checkbox]):not([type=radio]):not([type=file]),select,textarea){
  background:var(--bb33-surface-alt)!important;color:var(--bb33-text)!important;
}
/* Common button vocabulary. Action/status controls keep their own semantic colors. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(.btn,.btn2,
 .report-page-controls>button,.courier-pagination-v5829>button){
  min-height:var(--bb33-control-h);border-radius:var(--bb33-radius-sm)!important;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage .btn:not(.danger):not([disabled]){
  background:var(--bb33-orange)!important;border:1px solid #bd7f2c!important;
  color:var(--bb33-primary-text)!important;box-shadow:none!important;
}
body.boxboy-theme-light .tabpage .btn2:not(.danger):not(.is-destructive):not(.bb33-action-clear):not(.bb33-action-filter):not([aria-pressed=true]){
  background:var(--bb33-surface)!important;border:1px solid var(--bb33-field-border)!important;
  color:var(--bb33-text)!important;
}
body.boxboy-theme-dark .tabpage .btn2:not(.danger):not(.is-destructive):not(.bb33-action-clear):not(.bb33-action-filter):not([aria-pressed=true]){
  background:var(--bb33-surface-alt)!important;border:1px solid var(--bb33-field-border)!important;
  color:var(--bb33-text)!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(.bb33-action-clear,.bb33-action-clear.btn2){
  background:var(--bb33-purple)!important;border:1px solid var(--bb33-purple)!important;
  color:var(--bb33-purple-text)!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(.bb33-action-filter,.bb33-action-filter.btn2){
  background:var(--bb33-orange)!important;border:1px solid #bd7f2c!important;
  color:var(--bb33-primary-text)!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage :is(button,input,select,textarea,[role=button]):focus-visible{
  outline:2px solid var(--bb33-focus)!important;outline-offset:2px!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage button:disabled{cursor:not-allowed;opacity:.55}
/* Rendered tables, including alternate rows: do not recolor status badges. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage table:not(.leaflet-control *){
  border-collapse:separate;border-spacing:0;
}
body.boxboy-theme-light .tabpage table tbody tr:nth-child(even){background:var(--bb33-surface-row)}
body.boxboy-theme-light .tabpage table tbody tr:nth-child(odd){background:var(--bb33-surface)}
body.boxboy-theme-dark .tabpage table tbody tr:nth-child(even){background:var(--bb33-surface-row)}
body.boxboy-theme-dark .tabpage table tbody tr:nth-child(odd){background:var(--bb33-surface)}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .tabpage table :is(th,td){border-color:var(--bb33-divider)!important}
/* Deliberately preserve selected/hover/status background from per-module styles. */
body.boxboy-theme-light .tabpage table tbody tr:is(.is-selected,.selected,[aria-selected=true]){background:#fff0da!important}
body.boxboy-theme-dark .tabpage table tbody tr:is(.is-selected,.selected,[aria-selected=true]){background:#3c311e!important}
/* Header sorting in accessible buttons; no click handling on bare th. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-sort-head{
  appearance:none;background:none;border:0;color:inherit;font:inherit;font-weight:inherit;
  width:100%;min-height:32px;display:inline-flex;align-items:center;justify-content:flex-start;
  gap:6px;text-align:inherit;cursor:pointer;padding:2px 4px;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-sort-head:after{content:'⇅';color:var(--bb33-muted);font-size:12px}
body:is(.boxboy-theme-light,.boxboy-theme-dark) th[aria-sort=ascending]>.bb33-sort-head:after{content:'▲';color:var(--bb33-text)}
body:is(.boxboy-theme-light,.boxboy-theme-dark) th[aria-sort=descending]>.bb33-sort-head:after{content:'▼';color:var(--bb33-text)}
/* Paging numbers + size selector. Mobile naturally wraps. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) :is(.bb33-pager,.courier-pagination-v5829){
  display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;
  gap:6px;min-height:44px;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-pages{display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-pages button{
  min-width:32px;min-height:32px;border-radius:var(--bb33-radius-sm);border:1px solid var(--bb33-divider);
  background:var(--bb33-surface);color:var(--bb33-text);font-weight:700
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-pages button[aria-current=page]{
  background:var(--bb33-orange);color:#261a09;border-color:var(--bb33-outline)
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-per-page{width:auto!important;min-width:76px;min-height:32px!important;padding:3px 6px!important}
body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-counter{font-size:12px;color:var(--bb33-muted)}
/* Courier onboarding modal: light surfaces, labels and autofill control. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) #courierCreateFormV539{
  background:var(--bb33-surface)!important;color:var(--bb33-text)!important;
  border:1px solid var(--bb33-outline)!important;border-radius:var(--bb33-radius)!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) #courierCreateFormV539 :is(.courier-simple-modal-head-v539,.courier-simple-modal-body-v539,.courier-simple-modal-actions-v539){
  background:var(--bb33-surface)!important;color:var(--bb33-text)!important;
  border-color:var(--bb33-divider)!important;
}
#courierCreateFormV539 .bb33-courier-field{display:flex;flex-direction:column;min-width:0;gap:4px}
#courierCreateFormV539 .bb33-courier-field>span{font-size:12px;font-weight:700;color:var(--bb33-muted)}
#courierCreateFormV539 .bb33-courier-field>input{width:100%;min-width:0}
body.boxboy-theme-light #courierCreateFormV539 input:-webkit-autofill{
  -webkit-text-fill-color:#172732!important;box-shadow:0 0 0 1000px #fff inset!important;
}
body.boxboy-theme-dark #courierCreateFormV539 input:-webkit-autofill{
  -webkit-text-fill-color:#eff6fc!important;box-shadow:0 0 0 1000px #102c3f inset!important;
}
body:is(.boxboy-theme-light,.boxboy-theme-dark) #ordersManualDrawer .orders-drawer-card,
body:is(.boxboy-theme-light,.boxboy-theme-dark) #ordersManualDrawer .orders-modal-card{
  border:1px solid var(--bb33-outline)!important;border-radius:var(--bb33-radius)!important;
}
/* Symbolic theme action; accessible name is provided by map-ui. */
#globalThemeToggleV540 .theme-label-v540{display:none!important}
#globalThemeToggleV540{min-width:38px;min-height:38px;display:inline-grid;place-items:center}
@media(max-width:650px){
 body:is(.boxboy-theme-light,.boxboy-theme-dark) :is(.bb33-pager,.courier-pagination-v5829){justify-content:center}
 body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-counter{width:100%;text-align:center}
}
/* Old versions with ID-heavy !important overrides need deliberate local corrections. */
body:is(.boxboy-theme-light,.boxboy-theme-dark) #registrationsPage :is(
 .courier-admin-filter-card-v539,.courier-admin-list-card-v539,.courier-admin-detail-card-v539,
 .bb-reg-kpi-v5738){border-radius:var(--bb33-radius)!important}
body.boxboy-theme-light #shippingPage .ship-card,
body.boxboy-theme-dark #shippingPage .ship-card{
  border:1px solid var(--bb33-outline)!important;border-radius:var(--bb33-radius)!important;
}
body.boxboy-theme-light #reportsPage #reportClear,
body.boxboy-theme-dark #reportsPage #reportClear,
body.boxboy-theme-light #registrationsPage #clearRegistrationFilters,
body.boxboy-theme-dark #registrationsPage #clearRegistrationFilters,
body.boxboy-theme-light #storesAdminPage #storeCatalogClearV50,
body.boxboy-theme-dark #storesAdminPage #storeCatalogClearV50{
 background:var(--bb33-purple)!important;color:#fff!important;border-color:var(--bb33-purple)!important;
}

body:is(.boxboy-theme-light,.boxboy-theme-dark) .bb33-total{font-size:13px;font-weight:650;margin-right:8px}
