/*
 * Enterprise core-page migration layer.
 *
 * ui-shell.js exposes the active route as body[data-current-page]. This keeps
 * page-family refinements centralized and prevents business render functions
 * from accumulating visual-only className fragments and inline overrides.
 */

body.premium-ui[data-current-page] #content .stats {
  gap: 12px !important;
  margin-bottom: 20px !important;
}

body.premium-ui[data-current-page] #content .stats > .stat {
  min-height: 96px !important;
  padding: 15px 16px !important;
  border-radius: 10px !important;
  box-shadow: var(--wx-shadow-card) !important;
}

body.premium-ui[data-current-page] #content .stats > .stat::after {
  display: none !important;
}

body.premium-ui[data-current-page] #content .stats > .stat :where(strong, b) {
  font-size: 22px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em !important;
}

/* Dashboard / owner workbench */
body.premium-ui[data-current-page="dashboard"] .workflow-hero {
  margin-bottom: 16px !important;
}

body.premium-ui[data-current-page="dashboard"] .flow-pipeline {
  gap: 8px !important;
  margin-bottom: 18px !important;
}

body.premium-ui[data-current-page="dashboard"] .flow-pipeline button {
  min-height: 68px !important;
  padding: 11px 12px !important;
}

body.premium-ui[data-current-page="dashboard"] .flow-pipeline b {
  background: var(--wx-primary-soft) !important;
  color: var(--wx-primary) !important;
}

body.premium-ui[data-current-page="dashboard"] .flow-pipeline .danger-step b {
  background: var(--wx-danger-soft) !important;
  color: var(--wx-danger) !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness {
  margin-bottom: 20px !important;
  overflow: hidden;
  border: 1px solid var(--wx-border) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: var(--wx-shadow-card) !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness.has-risk {
  border-color: var(--wx-warning-border) !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header {
  gap: 20px !important;
  padding: 17px 19px !important;
  border-bottom: 1px solid var(--wx-border) !important;
  background: #fff !important;
  background-image: none !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header span {
  color: var(--wx-text-muted) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header b {
  color: var(--wx-primary) !important;
  font-size: 28px !important;
  font-weight: 600 !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header small,
body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header p {
  color: var(--wx-text-muted) !important;
  font-weight: 400 !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness-list {
  gap: 0 !important;
  padding: 8px !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness-list > button {
  min-height: 68px !important;
  padding: 12px !important;
  border-radius: 8px !important;
  background: #fff !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness-list > button:hover {
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-readiness-list i,
body.premium-ui[data-current-page="dashboard"] .bcc-dimensions em,
body.premium-ui[data-current-page="dashboard"] :where(.high, .medium, .low) {
  font-weight: 500 !important;
}

body.premium-ui[data-current-page="dashboard"] .workflow-stats > .stat {
  min-height: 102px !important;
}

/* Product master and high-frequency product tables */
body.premium-ui[data-current-page="products"] #content > .toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 9px !important;
  padding: 12px !important;
}

body.premium-ui[data-current-page="products"] #content > .toolbar > #productSearch {
  flex: 1 1 250px !important;
  width: auto !important;
  min-width: 220px !important;
}

body.premium-ui[data-current-page="products"] #content > .toolbar > select {
  flex: 1 1 126px !important;
  width: auto !important;
  min-width: 118px !important;
  max-width: 176px !important;
}

body.premium-ui[data-current-page="products"] #content > .toolbar > button {
  flex: 0 0 auto !important;
  width: auto !important;
  white-space: nowrap;
}

body.premium-ui[data-current-page="products"] .foundation-summary-banner,
body.premium-ui[data-current-page="products"] .product-quality-banner {
  margin-bottom: 16px !important;
}

body.premium-ui[data-current-page="products"] .foundation-summary-banner b,
body.premium-ui[data-current-page="products"] .product-quality-banner b {
  font-size: 18px !important;
  font-weight: 600 !important;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap {
  position: relative;
  isolation: isolate;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap :where(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 82px;
  min-width: 82px;
  max-width: 82px;
  background: #fff;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap :where(th, td):nth-child(2) {
  position: sticky;
  left: 82px;
  z-index: 3;
  min-width: 176px;
  background: #fff;
  box-shadow: 1px 0 var(--wx-border);
}

body.premium-ui[data-current-page="products"] .card > .table-wrap th:first-child,
body.premium-ui[data-current-page="products"] .card > .table-wrap th:nth-child(2) {
  z-index: 5;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap :where(th, td):last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  width: 220px;
  min-width: 220px;
  max-width: 220px;
  background: #fff;
  box-shadow: -1px 0 var(--wx-border);
  white-space: normal;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap th:last-child {
  z-index: 5;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap tbody tr:hover > :where(td:first-child, td:nth-child(2), td:last-child) {
  background: #fafbfc !important;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap :where(th, td):nth-child(6),
body.premium-ui[data-current-page="products"] .card > .table-wrap :where(th, td):nth-child(7) {
  text-align: right !important;
}

body.premium-ui[data-current-page="products"] .card > .table-wrap td:last-child button {
  min-height: 30px !important;
  margin: 2px !important;
  padding-inline: 7px !important;
  font-size: 12px !important;
}

/* Finance page family */
body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-two-column {
  gap: 16px !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-section-title {
  margin-bottom: 12px !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-guidance-grid {
  gap: 10px 16px !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-automation-list article {
  gap: 12px !important;
  padding: 13px 0 !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-automation-policy {
  margin: 0 16px 16px !important;
  padding: 12px 13px !important;
  border-color: var(--wx-info-border) !important;
  border-radius: 8px !important;
  background: var(--wx-info-soft) !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-flow {
  padding-inline: 16px !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-boundary > div {
  padding: 14px 16px !important;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-table :where(th, td):where(:nth-child(2), :nth-child(3)) {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Supplier and supply-chain administration */
body.premium-ui[data-current-page="suppliers"] #content > .toolbar {
  display: flex !important;
  justify-content: flex-end !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body.premium-ui[data-current-page="suppliers"] .auto-table-wrap {
  overflow: auto !important;
}

body.premium-ui[data-current-page="suppliers"] .auto-table-wrap :where(th, td):last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 170px;
  background: #fff;
  box-shadow: -1px 0 var(--wx-border);
  white-space: nowrap;
}

body.premium-ui[data-current-page="suppliers"] .auto-table-wrap th:last-child {
  z-index: 3;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="suppliers"] .auto-table-wrap tbody tr:hover > td:last-child {
  background: #fafbfc !important;
}

body.premium-ui[data-current-page="suppliers"] .auto-table-wrap td:last-child button {
  min-height: 30px !important;
  padding-inline: 7px !important;
  font-size: 12px !important;
}

/* Customer-service page family */
body.premium-ui[data-current-page^="customer-service-"] .cs-confidence-stats > .stat,
body.premium-ui[data-current-page^="customer-service-"] .cs-v1-stats > .stat {
  min-height: 96px !important;
}

body.premium-ui[data-current-page^="customer-service-"] #content .stats > .stat .cs-time-value {
  font-size: 18px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  word-break: normal !important;
}

body.premium-ui[data-current-page^="customer-service-"] .cs-disabled-banner {
  gap: 12px !important;
  margin-bottom: 16px !important;
  padding: 11px 14px !important;
  border-color: var(--wx-warning-border) !important;
  border-radius: 10px !important;
  background: var(--wx-warning-soft) !important;
  color: var(--wx-warning) !important;
}

body.premium-ui[data-current-page^="customer-service-"] .cs-v1-grid {
  gap: 18px !important;
}

body.premium-ui[data-current-page^="customer-service-"] .cs-health-panel {
  overflow: hidden;
}

body.premium-ui[data-current-page^="customer-service-"] .sync-notice,
body.premium-ui[data-current-page^="customer-service-"] .cs-automation-admin,
body.premium-ui[data-current-page^="customer-service-"] .cs-automation-preview {
  border-radius: 8px !important;
  box-shadow: none !important;
}

body.premium-ui[data-current-page^="customer-service-"] .cs-ticket-table-tools,
body.premium-ui[data-current-page^="customer-service-"] .cs-ticket-table-pager {
  padding: 11px 12px !important;
  border-color: var(--wx-border) !important;
  color: var(--wx-text-muted) !important;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page^="customer-service-"] .table-wrap :where(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 184px;
  background: #fff;
  box-shadow: 1px 0 var(--wx-border);
}

body.premium-ui[data-current-page^="customer-service-"] .table-wrap th:first-child {
  z-index: 4;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page^="customer-service-"] .table-wrap :where(th, td):last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 84px;
  background: #fff;
  box-shadow: -1px 0 var(--wx-border);
  white-space: nowrap;
}

body.premium-ui[data-current-page^="customer-service-"] .table-wrap th:last-child {
  z-index: 4;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page^="customer-service-"] .table-wrap tbody tr:hover > :where(td:first-child, td:last-child) {
  background: #fafbfc !important;
}

/* Channel, store and platform collaboration */
body.premium-ui[data-current-page="channel-center"] .channel-hero {
  margin-bottom: 18px !important;
}

body.premium-ui[data-current-page="channel-center"] .channel-rules {
  gap: 12px !important;
  margin-bottom: 20px !important;
}

body.premium-ui[data-current-page="channel-center"] .channel-rules > div {
  padding: 15px 16px !important;
  border-color: var(--wx-border) !important;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: none !important;
}

body.premium-ui[data-current-page="channel-center"] .channel-rules b {
  color: var(--wx-ink) !important;
  font-weight: 600 !important;
}

body.premium-ui[data-current-page="channel-center"] .channel-filters {
  padding: 10px 12px !important;
}

body.premium-ui[data-current-page="channel-center"] .table-wrap :where(th, td):last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 110px;
  background: #fff;
  box-shadow: -1px 0 var(--wx-border);
}

body.premium-ui[data-current-page="channel-center"] .table-wrap th:last-child {
  z-index: 3;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="channel-center"] .table-wrap tbody tr:hover > td:last-child {
  background: #fafbfc !important;
}

body.premium-ui[data-current-page="channel-center"] .table-wrap .empty {
  padding: 32px 20px !important;
  color: var(--wx-text-muted) !important;
}

/* Accounts, permissions and logs */
body.premium-ui[data-current-page="accounts"] .permission-matrix {
  min-width: 1120px !important;
}

body.premium-ui[data-current-page="accounts"] .permission-matrix :where(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 108px !important;
  background: #fff;
  box-shadow: 1px 0 var(--wx-border);
}

body.premium-ui[data-current-page="accounts"] .permission-matrix th:first-child {
  z-index: 5;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="accounts"] .permission-level {
  min-width: 46px !important;
  padding: 2px 7px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

body.premium-ui[data-current-page="accounts"] .sensitive-permission-strip {
  gap: 10px !important;
  padding: 12px 14px !important;
  border-color: var(--wx-border) !important;
  background: var(--wx-surface-subtle) !important;
}

body.premium-ui[data-current-page="accounts"] .sensitive-permission-strip > div {
  border-color: var(--wx-border) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

@media (max-width: 1100px) {
  body.premium-ui[data-current-page="products"] #content > .toolbar > #productSearch {
    flex-basis: 100% !important;
  }

  body.premium-ui[data-current-page^="customer-service-"] .cs-confidence-stats,
  body.premium-ui[data-current-page^="customer-service-"] .cs-v1-stats,
  body.premium-ui[data-current-page="channel-center"] .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  body.premium-ui[data-current-page="dashboard"] .workflow-readiness > header {
    align-items: flex-start !important;
    flex-direction: column !important;
  }

  body.premium-ui[data-current-page="products"] #content > .toolbar > select {
    flex: 1 1 calc(50% - 9px) !important;
    max-width: none !important;
  }

  body.premium-ui[data-current-page="products"] #content > .toolbar > button {
    flex: 1 1 auto !important;
  }

  body.premium-ui[data-current-page^="customer-service-"] .cs-confidence-stats,
  body.premium-ui[data-current-page^="customer-service-"] .cs-v1-stats,
  body.premium-ui[data-current-page="channel-center"] .stats {
    grid-template-columns: 1fr !important;
  }

  body.premium-ui[data-current-page^="finance-v1-"] .finance-v1-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
