@layer components {
  .cx-card,
  .cx-kpi,
  .cx-page-header,
  .cx-semantic-card {
    position: relative;
    isolation: isolate;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius-xl);
    background: var(--cx-panel-bg);
    box-shadow: var(--cx-shadow-soft);
    overflow: hidden;
  }

  .cx-card-header,
  .cx-card-body,
  .cx-card-footer { padding: var(--cx-space-5); }

  .cx-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--cx-space-3);
    border-block-end: 1px solid var(--cx-border);
    background: color-mix(in srgb, var(--cx-surface) 74%, transparent);
  }

  .cx-page-header {
    padding: var(--cx-space-5);
    color: #fff;
    border-color: color-mix(in srgb, var(--cx-brand-accent) 30%, rgba(255,255,255,.26));
    background:
      radial-gradient(circle at 10% 18%, rgba(255,255,255,.16), transparent 15rem),
      radial-gradient(circle at 92% 0%, rgba(216,59,190,.24), transparent 18rem),
      linear-gradient(135deg, #20105d 0%, var(--cx-brand-primary) 28%, var(--cx-brand-secondary) 70%, #8a239f 100%);
    box-shadow: 0 18px 42px rgba(36,16,102,.18), inset 0 1px 0 rgba(255,255,255,.12);
  }
  .cx-page-header::after {
    content: '';
    position: absolute;
    inset-inline-end: -4rem;
    inset-block-end: -6rem;
    inline-size: 22rem;
    block-size: 13rem;
    border: 12px solid rgba(255,255,255,.14);
    border-inline-start-color: transparent;
    border-block-start-color: rgba(216,59,190,.34);
    border-radius: 999px;
    transform: rotate(-10deg);
    pointer-events: none;
  }
  .cx-page-header > * { position: relative; z-index: 1; }
  .cx-page-header h1 {
    margin: 0;
    font-size: clamp(1.65rem, 3vw, 2.4rem);
    font-weight: 950;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: #fff;
    text-shadow: 0 2px 14px rgba(18,8,54,.22);
  }
  .cx-page-header .cx-page-eyebrow,
  .cx-page-header .cx-help { color: #fff; }
  .cx-page-header .cx-page-eyebrow { color: rgba(255,255,255,.88); }
  .cx-page-header .cx-help { opacity: .86; line-height: 1.65; }
  .cx-page-eyebrow { display: inline-flex; margin-block-end: .35rem; color: var(--cx-brand-strong); font-size: .82rem; font-weight: 950; letter-spacing: .02em; }

  .cx-kpi {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: .14rem;
    min-height: var(--cx-card-metric-min-height, 84px);
    padding: .66rem .76rem;
    padding-inline-start: 3.7rem;
    border-radius: var(--cx-card-radius-compact);
  }
  .cx-kpi::before {
    content: '';
    position: absolute;
    inset-inline-start: .72rem;
    inset-block-start: 50%;
    transform: translateY(-50%);
    inline-size: 2.4rem;
    block-size: 2.4rem;
    border: 1px solid color-mix(in srgb, var(--cx-sem-color, var(--cx-brand-strong)) 18%, transparent);
    border-radius: 11px;
    background-color: color-mix(in srgb, var(--cx-sem-soft, var(--cx-brand-soft)) 76%, #fff);
    background-image: var(--cx-kpi-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 8 4-8 4-8-4 8-4Z'/%3E%3Cpath d='m4 12 8 4 8-4'/%3E%3Cpath d='m4 17 8 4 8-4'/%3E%3C/svg%3E"));
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.18rem 1.18rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
    opacity: 1;
    pointer-events: none;
    z-index: 0;
  }
  .cx-kpi::after,
  .cx-card[data-semantic]::before,
  .cx-semantic-card::before {
    content: '';
    position: absolute;
    inset-inline-end: 0;
    inset-block: 0;
    inline-size: 2px;
    background: var(--cx-sem-color, var(--cx-brand-strong));
    opacity: .28;
  }
  .cx-kpi > * { position: relative; z-index: 1; }
  [data-theme="dark"] .cx-kpi::before { opacity: .34; }

  .cx-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-width:0; }
  .cx-kpi-icon {
    inline-size: 1.55rem;
    block-size: 1.55rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--cx-sem-color, var(--cx-brand-strong)) 14%, var(--cx-surface));
    color: var(--cx-sem-color, var(--cx-brand-strong));
    border: 1px solid color-mix(in srgb, var(--cx-sem-color, var(--cx-brand-strong)) 20%, transparent);
    font-weight: 950;
  }
  .cx-kpi-value,
  .cx-metric-value { color: var(--cx-sem-color, var(--cx-brand-strong)); font-size: clamp(1.28rem, 1.75vw, 1.62rem); font-weight: 950; line-height: 1.02; }
  .cx-kpi-label,
  .cx-metric-label { color: var(--cx-text-strong, var(--cx-text)); font-weight: 900; font-size: .8rem; line-height:1.2; }
  .cx-kpi .cx-help { color: var(--cx-muted); line-height: 1.25; font-size:.69rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-inline-size:100%; }
  .cx-kpi[data-semantic],
  .cx-card[data-semantic] {
    border-color: var(--cx-sem-line, var(--cx-border));
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--cx-sem-soft, var(--cx-brand-soft)) 64%, transparent), transparent 58%),
      var(--cx-panel-bg);
  }

  .cx-kpi[data-semantic="revenue"], .cx-card[data-semantic="revenue"] { --cx-sem-color: var(--cx-sem-revenue); --cx-sem-soft: var(--cx-sem-revenue-soft); --cx-sem-line: var(--cx-sem-revenue-line); }
  .cx-kpi[data-semantic="profit"], .cx-card[data-semantic="profit"] { --cx-sem-color: var(--cx-sem-profit); --cx-sem-soft: var(--cx-sem-profit-soft); --cx-sem-line: var(--cx-sem-profit-line); }
  .cx-kpi[data-semantic="loss"], .cx-card[data-semantic="loss"], .cx-kpi[data-semantic="danger"], .cx-card[data-semantic="danger"] { --cx-sem-color: var(--cx-sem-loss); --cx-sem-soft: var(--cx-sem-loss-soft); --cx-sem-line: var(--cx-sem-loss-line); }
  .cx-kpi[data-semantic="cost"], .cx-card[data-semantic="cost"] { --cx-sem-color: var(--cx-sem-cost); --cx-sem-soft: var(--cx-sem-cost-soft); --cx-sem-line: var(--cx-sem-cost-line); }
  .cx-kpi[data-semantic="expense"], .cx-card[data-semantic="expense"] { --cx-sem-color: var(--cx-sem-expense); --cx-sem-soft: var(--cx-sem-expense-soft); --cx-sem-line: var(--cx-sem-expense-line); }
  .cx-kpi[data-semantic="inventory"], .cx-card[data-semantic="inventory"] { --cx-sem-color: var(--cx-sem-inventory); --cx-sem-soft: var(--cx-sem-inventory-soft); --cx-sem-line: var(--cx-sem-inventory-line); }
  .cx-kpi[data-semantic="production"], .cx-card[data-semantic="production"] { --cx-sem-color: var(--cx-sem-production); --cx-sem-soft: var(--cx-sem-production-soft); --cx-sem-line: var(--cx-sem-production-line); }
  .cx-kpi[data-semantic="forecast"], .cx-card[data-semantic="forecast"] { --cx-sem-color: var(--cx-sem-forecast); --cx-sem-soft: var(--cx-sem-forecast-soft); --cx-sem-line: var(--cx-sem-forecast-line); }
  .cx-kpi[data-semantic="settlement"], .cx-card[data-semantic="settlement"] { --cx-sem-color: var(--cx-sem-settlement); --cx-sem-soft: var(--cx-sem-settlement-soft); --cx-sem-line: var(--cx-sem-settlement-line); }
  .cx-kpi[data-semantic="pending"], .cx-card[data-semantic="pending"], .cx-kpi[data-semantic="warning"], .cx-card[data-semantic="warning"] { --cx-sem-color: var(--cx-sem-pending); --cx-sem-soft: var(--cx-sem-pending-soft); --cx-sem-line: var(--cx-sem-pending-line); }

  html[data-ui-skin="backoffice"] .cx-kpi {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 8 4-8 4-8-4 8-4Z'/%3E%3Cpath d='m4 12 8 4 8-4'/%3E%3Cpath d='m4 17 8 4 8-4'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="revenue"],
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="forecast"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19V9'/%3E%3Cpath d='M10 19V5'/%3E%3Cpath d='M16 19v-7'/%3E%3Cpath d='M22 19V3'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="profit"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 17 6-6 4 4 8-9'/%3E%3Cpath d='M14 6h7v7'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="loss"],
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="danger"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 13V7a2 2 0 0 0-2-2h-6L4 13l7 7 9-7Z'/%3E%3Cpath d='M16 9h.01'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="cost"],
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="expense"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c2410c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2'/%3E%3Cpath d='M8 6h8'/%3E%3Cpath d='M8 10h2m4 0h2M8 14h2m4 0h2M8 18h2m4 0h2'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="inventory"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 8-9 5-9-5'/%3E%3Cpath d='m3 8 9-5 9 5v8l-9 5-9-5V8Z'/%3E%3Cpath d='M12 13v8'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="production"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2392400e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2'/%3E%3Cpath d='M9 4V2h6v2M8 9h8M8 13h5M8 17h6'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="pending"],
  html[data-ui-skin="backoffice"] .cx-kpi[data-semantic="warning"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 21h20L12 3Z'/%3E%3Cpath d='M12 9v5M12 18h.01'/%3E%3C/svg%3E");
  }

  .cx-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--cx-space-4); }
  .cx-empty-state,
  .cx-state-box { display: grid; place-items: center; gap: .75rem; min-height: 140px; text-align: center; }
  .cx-empty-inline { padding: 1rem; color: var(--cx-muted); text-align: center; }

  .cx-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: var(--cx-brand-soft);
    color: var(--cx-brand-strong);
    font-weight: 900;
    font-size: .85rem;
  }
  .cx-status-pill[data-state="ok"] { background: rgba(22, 138, 74, .13); color: var(--cx-success); }
  .cx-status-pill[data-state="warn"] { background: rgba(183, 121, 31, .15); color: var(--cx-warning); }
  .cx-status-pill[data-state="bad"] { background: rgba(180, 35, 24, .13); color: var(--cx-danger); }
  .cx-status-pill[data-state="revenue"] { background: var(--cx-sem-revenue-soft); color: var(--cx-sem-revenue); }
  .cx-status-pill[data-state="profit"] { background: var(--cx-sem-profit-soft); color: var(--cx-sem-profit); }
  .cx-status-pill[data-state="loss"], .cx-status-pill[data-state="danger"] { background: var(--cx-sem-loss-soft); color: var(--cx-sem-loss); }
  .cx-status-pill[data-state="cost"] { background: var(--cx-sem-cost-soft); color: var(--cx-sem-cost); }
  .cx-status-pill[data-state="expense"] { background: var(--cx-sem-expense-soft); color: var(--cx-sem-expense); }
  .cx-status-pill[data-state="inventory"] { background: var(--cx-sem-inventory-soft); color: var(--cx-sem-inventory); }
  .cx-status-pill[data-state="production"] { background: var(--cx-sem-production-soft); color: var(--cx-sem-production); }
  .cx-status-pill[data-state="forecast"] { background: var(--cx-sem-forecast-soft); color: var(--cx-sem-forecast); }
  .cx-status-pill[data-state="settlement"] { background: var(--cx-sem-settlement-soft); color: var(--cx-sem-settlement); }
  .cx-status-pill[data-state="pending"] { background: var(--cx-sem-pending-soft); color: var(--cx-sem-pending); }
}


/* B-Design-1 — Card contract variants.
   These variants standardize visual language only; card click/drilldown behavior remains owned by JS routes. */
@layer components {
  .cx-card,
  .cx-kpi,
  .cx-semantic-card {
    border-color: var(--cx-card-border);
    background: var(--cx-card-bg);
    box-shadow: var(--cx-card-shadow);
  }

  .cx-card--panel { padding: var(--cx-space-4); border-radius: var(--cx-card-radius); }
  .cx-card--metric { padding: var(--cx-space-4); border-radius: var(--cx-card-radius-compact); }
  .cx-card--compact { padding: var(--cx-space-3); border-radius: var(--cx-card-radius-compact); }
  .cx-card--summary { padding: var(--cx-space-3); display: grid; gap: var(--cx-space-2); }
  .cx-card--details { padding: var(--cx-space-4); min-width: 0; }

  .cx-card--interactive,
  .cx-card[data-interactive="true"],
  .cx-semantic-card[data-interactive="true"] {
    cursor: pointer;
    transition: transform var(--cx-motion-base), box-shadow var(--cx-motion-base), border-color var(--cx-motion-base), background var(--cx-motion-base);
  }
  .cx-card--interactive:hover,
  .cx-card[data-interactive="true"]:hover,
  .cx-semantic-card[data-interactive="true"]:hover {
    transform: translateY(var(--cx-motion-lift-y));
    box-shadow: var(--cx-card-shadow-hover);
    border-color: var(--cx-border-strong);
  }

  .cx-card--success { --cx-sem-color: var(--cx-sem-profit); --cx-sem-soft: var(--cx-sem-profit-soft); --cx-sem-line: var(--cx-sem-profit-line); border-color: var(--cx-sem-line); }
  .cx-card--danger { --cx-sem-color: var(--cx-sem-loss); --cx-sem-soft: var(--cx-sem-loss-soft); --cx-sem-line: var(--cx-sem-loss-line); border-color: var(--cx-sem-line); }
  .cx-card--warning { --cx-sem-color: var(--cx-sem-pending); --cx-sem-soft: var(--cx-sem-pending-soft); --cx-sem-line: var(--cx-sem-pending-line); border-color: var(--cx-sem-line); }
  .cx-card--info { --cx-sem-color: var(--cx-sem-revenue); --cx-sem-soft: var(--cx-sem-revenue-soft); --cx-sem-line: var(--cx-sem-revenue-line); border-color: var(--cx-sem-line); }

  .cx-section-card { border: 1px solid var(--cx-card-border); border-radius: var(--cx-card-radius); background: var(--cx-card-bg); box-shadow: var(--cx-card-shadow); }
}


/* B-Design-2 — Cards Unification.
   Shared cards become easier to adjust later through card/window/table tokens only.
   Click/drilldown behavior stays owned by route logic. */
@layer components {
  .cx-card,
  .cx-semantic-card,
  .cx-kpi {
    border-radius: var(--cx-card-radius);
    transition: border-color var(--cx-motion-base), box-shadow var(--cx-motion-base), background var(--cx-motion-base), transform var(--cx-motion-base);
  }

  .cx-card-header,
  .cx-card-body,
  .cx-card-footer {
    min-width: 0;
  }

  .cx-card-header {
    padding: var(--cx-card-header-padding);
    gap: var(--cx-space-3);
    background: var(--cx-card-header-bg);
    border-block-end-color: var(--cx-card-header-border);
  }
  .cx-card-header > div:first-child {
    min-width: 0;
    display: grid;
    gap: .35rem;
  }
  .cx-card-header h2,
  .cx-card-header h3,
  .cx-card-header h4 {
    margin: 0;
    color: var(--cx-text-main);
    font-size: clamp(1rem, 1.65vw, 1.2rem);
    font-weight: 950;
    line-height: 1.35;
  }
  .cx-card-header .cx-help,
  .cx-card-header p {
    margin: 0;
    color: var(--cx-text-soft);
  }
  .cx-card-body {
    padding: var(--cx-card-body-padding);
    display: grid;
    gap: var(--cx-card-body-gap);
  }
  .cx-card-footer {
    padding: var(--cx-card-footer-padding);
    border-block-start: 1px solid var(--cx-card-header-border);
    background: color-mix(in srgb, var(--cx-surface-card) 88%, var(--cx-brand-soft));
  }

  .cx-card--panel,
  .cx-card:not([class*="cx-card--"]) {
    border-radius: var(--cx-card-radius);
  }
  .cx-card--metric,
  .cx-kpi {
    min-height: var(--cx-card-metric-min-height);
    border-radius: var(--cx-card-radius-compact);
  }
  .cx-card--summary {
    background: color-mix(in srgb, var(--cx-brand-soft) 28%, var(--cx-card-bg));
  }
  .cx-card--details {
    background: color-mix(in srgb, var(--cx-surface-card) 90%, var(--cx-brand-soft));
  }

  .cx-card--interactive:focus-visible,
  .cx-card[data-interactive="true"]:focus-visible,
  .cx-semantic-card[data-interactive="true"]:focus-visible,
  .cx-kpi:focus-visible {
    outline: none;
    box-shadow: var(--cx-focus-ring), var(--cx-card-shadow-hover);
    border-color: var(--cx-card-interactive-outline);
  }

  .cx-kpi {
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--cx-sem-soft, var(--cx-brand-soft)) 46%, transparent), transparent 58%),
      var(--cx-card-bg);
  }
  .cx-kpi-head {
    min-width: 0;
  }
  .cx-kpi-label,
  .cx-metric-label {
    color: var(--cx-text-soft);
  }
  .cx-kpi-value,
  .cx-metric-value {
    letter-spacing: -.02em;
  }
  .cx-kpi .cx-status-pill {
    justify-self: start;
  }

  .cx-card-body > .cx-table-wrap:first-child,
  .cx-card-body > .cx-smart-table-wrap:first-child {
    margin-block-start: calc(var(--cx-space-2) * -1);
  }
}


/* B-Design-Recovery-1 — Card layout recovery.
   Shared card bodies must not force every page layout into grid. Variants can opt in. */
@layer components {
  .cx-card-body {
    display: block;
  }

  .cx-card--panel > .cx-card-body,
  .cx-card--details > .cx-card-body,
  .cx-modal .cx-card--details > .cx-card-body {
    display: grid;
    gap: var(--cx-card-body-gap);
  }

  .cx-card--summary {
    display: grid;
    gap: var(--cx-space-2);
  }
}

/* 2026-09-30 Backoffice icon-card contract: one visual icon owner, no duplicate legacy glyph. */
@layer components {
  html[data-ui-skin="backoffice"] .cx-kpi > .cx-kpi-head .cx-kpi-icon {
    display: none;
  }
  html[data-ui-skin="backoffice"] .cx-kpi .cx-status-pill {
    position: absolute;
    inset-block-start: .62rem;
    inset-inline-end: .68rem;
    z-index: 2;
    padding: .17rem .46rem;
    font-size: .66rem;
    line-height: 1.12;
    border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
    box-shadow: none;
  }
  html[data-ui-skin="backoffice"] .cx-kpi:has(.cx-status-pill) .cx-kpi-head {
    padding-inline-end: 3.25rem;
  }
  html[data-ui-skin="backoffice"] .cx-kpi:hover {
    transform: translateY(-1px);
    box-shadow: var(--cx-card-shadow-hover);
  }
}

/* Backoffice analysis primitive — reusable insight strip for analysis-first pages. */
@layer components {
  .cx-insight-strip {
    --cx-insight-color: var(--cx-sem-inventory, #0f766e);
    --cx-insight-soft: var(--cx-sem-inventory-soft, #ecfdf5);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .8rem;
    min-height: 64px;
    padding: .78rem .95rem;
    border: 1px solid color-mix(in srgb, var(--cx-insight-color) 22%, var(--cx-border));
    border-inline-start: 4px solid var(--cx-insight-color);
    border-radius: 14px;
    background:
      radial-gradient(circle at 8% 50%, color-mix(in srgb, var(--cx-insight-soft) 72%, transparent), transparent 16rem),
      linear-gradient(135deg, color-mix(in srgb, var(--cx-insight-soft) 86%, #fff), #fff 72%);
    box-shadow: 0 8px 22px rgba(52,34,74,.045);
  }
  .cx-insight-strip[data-semantic="danger"] { --cx-insight-color: var(--cx-sem-loss); --cx-insight-soft: var(--cx-sem-loss-soft); }
  .cx-insight-strip[data-semantic="warning"] { --cx-insight-color: var(--cx-sem-pending); --cx-insight-soft: var(--cx-sem-pending-soft); }
  .cx-insight-strip[data-semantic="profit"] { --cx-insight-color: var(--cx-sem-profit); --cx-insight-soft: var(--cx-sem-profit-soft); }
  .cx-insight-icon {
    inline-size: 2.35rem;
    block-size: 2.35rem;
    border-radius: 11px;
    background-color: color-mix(in srgb, var(--cx-insight-color) 10%, #fff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237c3aed' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v18'/%3E%3Cpath d='M3 12h18'/%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.15rem;
    border: 1px solid color-mix(in srgb, var(--cx-insight-color) 18%, transparent);
  }
  .cx-insight-strip[data-semantic="danger"] .cx-insight-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 19-9-16-9 16h18Z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  }
  .cx-insight-strip[data-semantic="warning"] .cx-insight-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  }
  .cx-insight-copy { min-width: 0; display: grid; gap: .14rem; }
  .cx-insight-copy strong { color: var(--cx-text-main); font-size: .94rem; font-weight: 950; letter-spacing:-.01em; }
  .cx-insight-copy span { color: var(--cx-text-soft); font-size: .77rem; line-height: 1.55; }
  @media (max-width: 720px) {
    .cx-insight-strip { grid-template-columns: auto minmax(0,1fr); }
    .cx-insight-strip > .cx-status-pill { grid-column: 1/-1; justify-self: start; }
  }
}

/* Backoffice KPI semantic icon variants — static SVG only, no runtime icon library. */
@layer components {
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="opening"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 8-9 5-9-5'/%3E%3Cpath d='m3 8 9-5 9 5v8l-9 5-9-5V8Z'/%3E%3Cpath d='M12 13v8'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="receive"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="issue"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c2410c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21V9'/%3E%3Cpath d='m7 14 5-5 5 5'/%3E%3Cpath d='M5 3h14'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="waste"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M10 11v6M14 11v6'/%3E%3Cpath d='m6 7 1 14h10l1-14'/%3E%3Cpath d='M9 7V4h6v3'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="shortage"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12h8'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="surplus"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="closing"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 7 9 5 9-5'/%3E%3Cpath d='m3 12 9 5 9-5'/%3E%3Cpath d='m3 17 9 5 9-5'/%3E%3C/svg%3E");
  }
  html[data-ui-skin="backoffice"] .cx-kpi[data-kpi-icon="negative"] {
    --cx-kpi-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m12 3 9 17H3L12 3Z'/%3E%3Cpath d='M12 9v5M12 17h.01'/%3E%3C/svg%3E");
  }
}

/* Order cart notes — shared by POS and Call Center. */
@layer components {
  .cx-cart-card-header {
    position: relative;
    z-index: 20;
    display: grid !important;
    grid-template-columns: minmax(0, auto) minmax(112px, 1fr) minmax(0, auto);
    align-items: center !important;
    justify-content: stretch !important;
    gap: 8px !important;
    overflow: visible !important;
  }
  .cx-cart-header-primary {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .75rem;
    direction: rtl;
  }
.cx-order-notes-control {
    position: relative;
    z-index: 30;
    flex: 0 0 auto;
  }
  .cx-order-notes-trigger {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .36rem .62rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 12px;
    background: linear-gradient(180deg, var(--cx-surface), color-mix(in srgb, var(--cx-brand-soft, #f3efff) 34%, var(--cx-surface)));
    color: var(--cx-text-main, var(--cx-text));
    box-shadow: 0 7px 18px rgba(50, 35, 75, .055);
    cursor: pointer;
    font: inherit;
    text-align: start;
    transition: border-color var(--cx-transition, .16s ease), box-shadow var(--cx-transition, .16s ease), transform var(--cx-transition, .16s ease);
  }
  .cx-order-notes-trigger:hover,
  .cx-order-notes-control.is-open .cx-order-notes-trigger {
    border-color: color-mix(in srgb, var(--cx-brand, #6d28d9) 42%, var(--cx-border));
    box-shadow: 0 10px 24px rgba(50, 35, 75, .09);
  }
  .cx-order-notes-trigger:active { transform: translateY(1px); }
  .cx-order-notes-icon {
    inline-size: 24px;
    block-size: 24px;
    flex: 0 0 24px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 10%, var(--cx-surface));
    color: var(--cx-brand-strong, var(--cx-brand));
    font-size: .9rem;
    font-weight: 1000;
  }
  .cx-order-notes-copy { display: grid; gap: .05rem; line-height: 1.2; }
  .cx-order-notes-copy strong { font-size: .82rem; font-weight: 950; white-space: nowrap; }
  .cx-order-notes-copy small { color: var(--cx-text-soft, var(--cx-muted)); font-size: .69rem; font-weight: 800; white-space: nowrap; }
  .cx-order-notes-check {
    inline-size: 20px;
    block-size: 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--cx-sem-profit, #15803d);
    color: #fff;
    font-size: .7rem;
    font-weight: 1000;
  }
  .cx-order-notes-control.has-notes .cx-order-notes-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-profit, #15803d) 28%, var(--cx-border));
  }
  .cx-order-notes-popover {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: calc(100% + 8px);
    z-index: 80;
    inline-size: min(340px, calc(100vw - 40px));
    padding: .8rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 14px;
    background: var(--cx-surface, #fff);
    box-shadow: 0 20px 48px rgba(38, 27, 56, .16);
  }
  .cx-order-notes-popover[hidden] { display: none !important; }
  .cx-order-notes-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    margin-block-end: .65rem;
  }
  .cx-order-notes-panel-head strong { font-size: .9rem; font-weight: 950; }
  .cx-order-notes-panel-head span { color: var(--cx-text-soft, var(--cx-muted)); font-size: .72rem; font-weight: 800; }
  .cx-order-notes-input {
    min-height: 92px !important;
    resize: vertical;
    line-height: 1.65;
    font-weight: 750;
  }
  @media (max-width: 640px) {
    .cx-order-notes-copy small { display: none; }
    .cx-order-notes-trigger { padding-inline: .55rem; }
    .cx-order-notes-popover { inline-size: min(310px, calc(100vw - 28px)); }
  }
  @media (prefers-reduced-motion: reduce) {
    .cx-order-notes-trigger { transition: none; }
  }
}
@layer components { .cx-order-notes-check[hidden]{display:none!important} }

/* Order quick fields + discount dropdown — shared by POS and Call Center. */
@layer components {
  [data-cx-anchored-popover="1"] {
    z-index: 12000 !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .cx-order-quick-control {
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
  }
  .cx-order-quick-trigger {
    min-height: 42px;
    min-width: 138px;
    max-width: 190px;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .46rem .7rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 12px;
    background: linear-gradient(180deg, var(--cx-surface), color-mix(in srgb, var(--cx-brand-soft, #f3efff) 34%, var(--cx-surface)));
    color: var(--cx-text-main, var(--cx-text));
    box-shadow: 0 7px 18px rgba(50, 35, 75, .055);
    cursor: pointer;
    font: inherit;
    text-align: start;
    transition: border-color var(--cx-transition, .16s ease), box-shadow var(--cx-transition, .16s ease), transform var(--cx-transition, .16s ease);
  }
  .cx-order-quick-trigger:hover,
  .cx-order-quick-control.is-open .cx-order-quick-trigger {
    border-color: color-mix(in srgb, var(--cx-brand, #6d28d9) 42%, var(--cx-border));
    box-shadow: 0 10px 24px rgba(50, 35, 75, .09);
  }
  .cx-order-quick-trigger:active { transform: translateY(1px); }
  .cx-order-quick-icon {
    inline-size: 28px;
    block-size: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 10%, var(--cx-surface));
    color: var(--cx-brand-strong, var(--cx-brand));
    font-size: .82rem;
    font-weight: 1000;
  }
  .cx-order-quick-copy {
    min-width: 0;
    display: grid;
    flex: 1 1 auto;
    gap: .05rem;
    line-height: 1.2;
  }
  .cx-order-quick-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .82rem;
    font-weight: 950;
  }
  .cx-order-quick-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cx-text-soft, var(--cx-muted));
    font-size: .69rem;
    font-weight: 800;
  }
  .cx-order-quick-check {
    inline-size: 20px;
    block-size: 20px;
    flex: 0 0 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--cx-sem-profit, #15803d);
    color: #fff;
    font-size: .7rem;
    font-weight: 1000;
  }
  .cx-order-quick-check[hidden] { display: none !important; }
  .cx-order-quick-control.has-value .cx-order-quick-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-profit, #15803d) 30%, var(--cx-border));
    background: linear-gradient(180deg, var(--cx-surface), color-mix(in srgb, var(--cx-sem-profit, #15803d) 7%, var(--cx-surface)));
  }
  .cx-order-quick-control.is-required:not(.has-value) .cx-order-quick-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-warning, #d97706) 30%, var(--cx-border));
  }
  .cx-order-quick-popover {
    position: absolute;
    inset-inline-start: 0;
    inset-block-start: calc(100% + 8px);
    z-index: 90;
    inline-size: min(320px, calc(100vw - 40px));
    padding: .8rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 14px;
    background: var(--cx-surface, #fff);
    box-shadow: 0 20px 48px rgba(38, 27, 56, .16);
  }
  .cx-order-quick-popover[hidden] { display: none !important; }
  .cx-order-quick-panel-head {
    display: grid;
    gap: .12rem;
    margin-block-end: .65rem;
  }
  .cx-order-quick-panel-head strong { font-size: .9rem; font-weight: 950; }
  .cx-order-quick-panel-head span { color: var(--cx-text-soft, var(--cx-muted)); font-size: .72rem; font-weight: 800; }
  .cx-order-quick-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: center;
  }
  .cx-order-quick-entry .cx-input { min-height: 42px !important; height: 42px !important; width: 100%; }
  .cx-order-quick-entry .cx-btn { min-height: 42px !important; padding-inline: .8rem !important; }
  .cx-order-quick-entry:has(.cx-input:only-child) { grid-template-columns: 1fr; }
  .cx-order-quick-clear {
    width: 100%;
    margin-block-start: .55rem;
    min-height: 36px;
    border: 1px solid color-mix(in srgb, var(--cx-sem-danger, #dc2626) 28%, var(--cx-border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 5%, var(--cx-surface));
    color: var(--cx-sem-danger, #b91c1c);
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 900;
  }

  .cx-order-discount-suite {
    display: inline-flex;
    align-items: center;
    min-width: 0;
  }
  .cx-order-discount-control {
    position: relative;
    flex: 0 0 auto;
  }
  .cx-order-discount-trigger {
    min-height: 44px;
    min-width: 176px;
    max-width: 250px;
    display: inline-flex;
    align-items: center;
    gap: .48rem;
    padding: .42rem .58rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 12px;
    background: var(--cx-surface, #fff);
    color: var(--cx-text-main, var(--cx-text));
    box-shadow: 0 5px 14px rgba(50, 35, 75, .045);
    cursor: pointer;
    font: inherit;
    text-align: start;
    transition: border-color var(--cx-transition, .16s ease), box-shadow var(--cx-transition, .16s ease), transform var(--cx-transition, .16s ease), background-color var(--cx-transition, .16s ease);
  }
  .cx-order-discount-trigger:hover,
  .cx-order-discount-control.is-open .cx-order-discount-trigger {
    border-color: color-mix(in srgb, var(--cx-brand, #6d28d9) 42%, var(--cx-border));
    box-shadow: 0 9px 22px rgba(50, 35, 75, .085);
  }
  .cx-order-discount-trigger:active { transform: translateY(1px); }
  .cx-order-discount-icon {
    inline-size: 27px;
    block-size: 27px;
    flex: 0 0 27px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 9%, var(--cx-surface));
    color: var(--cx-brand-strong, var(--cx-brand));
    font-size: .8rem;
    font-weight: 1000;
  }
  .cx-order-discount-copy {
    min-width: 0;
    display: grid;
    flex: 1 1 auto;
    gap: .04rem;
    line-height: 1.15;
  }
  .cx-order-discount-copy strong {
    font-size: .75rem;
    font-weight: 950;
  }
  .cx-order-discount-copy small {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cx-text-soft, var(--cx-muted));
    font-size: .62rem;
    font-weight: 800;
  }
  .cx-order-discount-value {
    min-width: 34px;
    min-height: 28px;
    display: inline-grid;
    place-items: center;
    padding-inline: .45rem;
    border-radius: 9px;
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 7%, var(--cx-surface));
    color: var(--cx-brand-strong, var(--cx-brand));
    font-size: .74rem;
    font-weight: 1000;
    white-space: nowrap;
  }
  .cx-order-discount-check {
    inline-size: 21px;
    block-size: 21px;
    flex: 0 0 21px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--cx-sem-success, #16a34a);
    color: #fff;
    font-size: .65rem;
    font-weight: 1000;
  }
  .cx-order-discount-check[hidden] { display: none !important; }
  .cx-order-discount-caret {
    flex: 0 0 auto;
    color: var(--cx-text-soft, var(--cx-muted));
    font-size: .86rem;
    transition: transform var(--cx-transition, .16s ease);
  }
  .cx-order-discount-control.is-open .cx-order-discount-caret { transform: rotate(180deg); }
  .cx-order-discount-suite.is-applied .cx-order-discount-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-success, #16a34a) 42%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-sem-success, #16a34a) 5%, var(--cx-surface));
  }
  .cx-order-discount-suite.is-applied .cx-order-discount-value {
    background: color-mix(in srgb, var(--cx-sem-success, #16a34a) 10%, var(--cx-surface));
    color: var(--cx-sem-success, #166534);
  }
  .cx-order-discount-suite.needs-input .cx-order-discount-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-warning, #d97706) 36%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-sem-warning, #d97706) 4%, var(--cx-surface));
  }
  .cx-order-discount-suite.is-invalid .cx-order-discount-trigger {
    border-color: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 45%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 4%, var(--cx-surface));
  }
  .cx-order-discount-suite.is-invalid .cx-order-discount-value {
    background: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 9%, var(--cx-surface));
    color: var(--cx-sem-danger, #b91c1c);
  }
  .cx-order-discount-popover,
  .cx-order-discount-editor-popover {
    position: fixed;
    z-index: 1000;
    inline-size: min(340px, calc(100vw - 40px));
    padding: .75rem;
    border: 1px solid color-mix(in srgb, var(--cx-brand, #6d28d9) 18%, var(--cx-border));
    border-radius: 14px;
    background: var(--cx-surface, #fff);
    box-shadow: 0 20px 48px rgba(38, 27, 56, .16);
    overflow: auto;
  }
  .cx-order-discount-popover[hidden],
  .cx-order-discount-editor-popover[hidden] { display: none !important; }
  .cx-order-discount-panel-head {
    display: grid;
    gap: .12rem;
    margin-block-end: .65rem;
  }
  .cx-order-discount-panel-head strong { font-size: .88rem; font-weight: 950; }
  .cx-order-discount-panel-head span { color: var(--cx-text-soft, var(--cx-muted)); font-size: .69rem; font-weight: 800; }
  .cx-order-discount-options {
    display: grid;
    gap: .38rem;
    max-height: 260px;
    overflow: auto;
    overscroll-behavior: contain;
    padding-inline-end: 2px;
  }
  .cx-order-discount-option {
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border: 1px solid var(--cx-border);
    border-radius: 11px;
    background: var(--cx-surface, #fff);
    color: var(--cx-text-main, var(--cx-text));
    cursor: pointer;
    font: inherit;
    text-align: start;
  }
  .cx-order-discount-option:hover {
    border-color: color-mix(in srgb, var(--cx-brand, #6d28d9) 34%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-brand-soft, #f3efff) 24%, var(--cx-surface));
  }
  .cx-order-discount-option.is-selected {
    border-color: color-mix(in srgb, var(--cx-brand, #6d28d9) 52%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 8%, var(--cx-surface));
  }
  .cx-order-discount-option-main { min-width: 0; display: grid; gap: .08rem; }
  .cx-order-discount-option-main strong { font-size: .78rem; font-weight: 950; }
  .cx-order-discount-option-main small { color: var(--cx-text-soft, var(--cx-muted)); font-size: .67rem; font-weight: 800; }
  .cx-order-discount-option-check {
    inline-size: 20px;
    block-size: 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--cx-brand, #6d28d9);
    color: #fff;
    font-size: .67rem;
    font-weight: 1000;
  }
  .cx-order-discount-warning,
  .cx-order-discount-validation {
    margin-block-start: .55rem;
    padding: .5rem .58rem;
    border: 1px solid color-mix(in srgb, var(--cx-sem-warning, #d97706) 28%, var(--cx-border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--cx-sem-warning, #d97706) 7%, var(--cx-surface));
    color: var(--cx-text-main, var(--cx-text));
    font-size: .68rem;
    font-weight: 850;
  }
  .cx-order-discount-validation.is-success {
    border-color: color-mix(in srgb, var(--cx-sem-success, #16a34a) 32%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-sem-success, #16a34a) 7%, var(--cx-surface));
    color: var(--cx-sem-success, #166534);
  }
  .cx-order-discount-validation.is-danger {
    border-color: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 34%, var(--cx-border));
    background: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 6%, var(--cx-surface));
    color: var(--cx-sem-danger, #b91c1c);
  }
  .cx-order-discount-limits {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-block-end: .6rem;
  }
  .cx-order-discount-limits span {
    padding: .28rem .48rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--cx-brand, #6d28d9) 6%, var(--cx-surface));
    color: var(--cx-text-soft, var(--cx-muted));
    font-size: .64rem;
    font-weight: 900;
  }
  .cx-order-discount-editor-fields { display: grid; gap: .55rem; }
  .cx-order-discount-editor-field { min-width: 0; display: grid; gap: .28rem; }
  .cx-order-discount-editor-field > span { color: var(--cx-text-soft, var(--cx-muted)); font-size: .68rem; font-weight: 900; }
  .cx-order-discount-editor-field .cx-input { width: 100%; min-height: 42px !important; height: 42px !important; }
  .cx-order-discount-runtime-input-wrap { position: relative; }
  .cx-order-discount-runtime-input-wrap .cx-input { padding-inline-end: 2.3rem !important; }
  .cx-order-discount-runtime-input-wrap em {
    position: absolute;
    inset-inline-end: .7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--cx-text-soft, var(--cx-muted));
    font-style: normal;
    font-size: .72rem;
    font-weight: 950;
    pointer-events: none;
  }
  .cx-order-discount-remove {
    width: 100%;
    margin-block-start: .55rem;
    min-height: 36px;
    border: 1px solid color-mix(in srgb, var(--cx-sem-danger, #dc2626) 28%, var(--cx-border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--cx-sem-danger, #dc2626) 5%, var(--cx-surface));
    color: var(--cx-sem-danger, #b91c1c);
    cursor: pointer;
    font: inherit;
    font-size: .72rem;
    font-weight: 900;
  }

  @media (max-width: 720px) {
    .cx-order-discount-suite { width: 100%; }
    .cx-order-discount-control { flex: 1 1 190px; }
    .cx-order-discount-trigger { width: 100%; max-width: none; }
    .cx-order-discount-popover,
    .cx-order-quick-popover { inline-size: min(320px, calc(100vw - 28px)); }
    .cx-order-quick-control { flex: 1 1 138px; }
    .cx-order-quick-trigger { width: 100%; max-width: none; }
  }
  @media (max-width: 640px) {
    .cx-order-quick-copy small { display: none; }
    .cx-order-quick-trigger { padding-inline: .55rem; }
  }
  @media (prefers-reduced-motion: reduce) {
    .cx-order-quick-trigger,
    .cx-order-discount-trigger,
    .cx-order-discount-caret { transition: none; }
  }
}

/* POS + Call Center unified cart/toolbar (v10). One definition for both routes. */
.cx-pos-modern-page .cx-smart-cart,.cc-modern-page .cx-smart-cart{container-type:inline-size}
.cx-pos-modern-page .cx-smart-cart > .cx-cart-card-header,.cc-modern-page .cx-smart-cart > .cx-cart-card-header{padding:7px 10px!important}
.cx-pos-modern-page .cx-cart-header-primary,.cc-modern-page .cx-cart-header-primary{grid-column:1;min-width:0}
.cx-pos-modern-page .cx-cart-header-center,.cc-modern-page .cx-cart-header-center{grid-column:2;justify-self:center;min-width:112px;max-width:200px;width:100%;display:flex;align-items:center;justify-content:center}
.cx-pos-modern-page .cx-cart-header-actions,.cc-modern-page .cx-cart-header-actions{grid-column:3;margin-inline-start:0;justify-self:end}
.cx-pos-modern-page .cx-cart-header-center .cx-order-discount-suite,.cc-modern-page .cx-cart-header-center .cx-order-discount-suite{max-width:100%;width:100%}
.cx-pos-modern-page .cx-cart-header-center .cx-order-discount-trigger,.cc-modern-page .cx-cart-header-center .cx-order-discount-trigger{width:100%;max-width:none;min-width:0;min-height:38px}
.cx-pos-modern-page .cx-menu-toolbar-heading,.cc-modern-page .cx-menu-toolbar-heading{display:flex;align-items:center;gap:7px;min-width:0;white-space:nowrap;margin-inline-end:auto}
.cx-pos-modern-page .cx-menu-toolbar-heading strong,.cc-modern-page .cx-menu-toolbar-heading strong{font-size:.92rem;font-weight:950;color:var(--cx-text,#171422)}
.cx-pos-modern-page .cx-menu-search-toggle,.cc-modern-page .cx-menu-search-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;padding:7px 12px;border:1px solid var(--cx-border,#ddd8e6);border-radius:10px;background:var(--cx-surface,#fff);color:var(--cx-text,#171422);font:inherit;font-size:.84rem;font-weight:900;cursor:pointer;white-space:nowrap}
.cx-pos-modern-page .cx-menu-search-toggle.has-query,.cc-modern-page .cx-menu-search-toggle.has-query{border-color:var(--cx-primary,#6d28d9);color:var(--cx-primary,#6d28d9)}
.cx-pos-modern-page .cx-menu-search-toggle[aria-expanded="true"],.cc-modern-page .cx-menu-search-toggle[aria-expanded="true"]{box-shadow:0 0 0 2px color-mix(in srgb,var(--cx-primary,#6d28d9) 12%,transparent)}
.cx-pos-modern-page .cx-menu-search-field[hidden],.cc-modern-page .cx-menu-search-field[hidden],.cx-pos-modern-page .cx-menu-search-clear[hidden],.cc-modern-page .cx-menu-search-clear[hidden]{display:none!important}
@media(max-width:1100px){
  .cx-pos-modern-page .cx-menu-results,.cc-modern-page .cx-menu-results{max-height:min(58dvh,650px);min-height:0}
}
@container (max-width:440px){
  .cx-pos-modern-page .cx-smart-cart > .cx-cart-card-header,.cc-modern-page .cx-smart-cart > .cx-cart-card-header{grid-template-columns:minmax(0,1fr) minmax(0,1fr);row-gap:5px}
  .cx-pos-modern-page .cx-cart-header-primary,.cc-modern-page .cx-cart-header-primary{grid-column:1}
  .cx-pos-modern-page .cx-cart-header-center,.cc-modern-page .cx-cart-header-center{grid-column:2;grid-row:1}
  .cx-pos-modern-page .cx-cart-header-actions,.cc-modern-page .cx-cart-header-actions{grid-column:1/-1;justify-self:end}
}
