/* Commerce campaign buyer flow component classes (S1: {element}-csm-{variant}). */

/* Catalog: header. */
.catalog-hero { border-radius: 0.75rem; overflow: hidden; margin-bottom: 1.5rem; background: var(--bs-tertiary-bg); }
.catalog-hero-img { display: block; width: 100%; max-height: 16rem; object-fit: cover; }
.catalog-hero-body { padding: 1.25rem 1.5rem; }
.catalog-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
.catalog-description > p:last-child { margin-bottom: 0.5rem; }
.catalog-deadline { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.9rem; color: var(--bs-secondary-color); }

/* Catalog hero: collapsible description (native disclosure; starts closed
   on all screen sizes — approved 2026-11-04 production hotfix). */
.catalog-desc-csm { margin-bottom: 0.75rem; }
.catalog-desc-csm > .catalog-desc-summary {
    display: flex; align-items: center; gap: 0.4rem; cursor: pointer;
    list-style: none; font-weight: 600;
}
.catalog-desc-csm > .catalog-desc-summary::-webkit-details-marker { display: none; }
.catalog-desc-csm > .catalog-desc-summary .bi { transition: transform 0.15s; }
.catalog-desc-csm[open] > .catalog-desc-summary .bi { transform: rotate(180deg); }

/* Catalog: filters. */
.catalog-filters { margin-bottom: 1rem; }
.facet-bar {
    display: flex; flex-direction: column; gap: 0.75rem;
    padding: 1rem; border: 1px solid var(--bs-border-color); border-radius: 0.75rem;
}
/* Panel-title pattern (cart-title / checkout-panel-title); facet-bar's flex
   gap provides the spacing, hence margin: 0. */
.facet-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 700; margin: 0; }
.facet-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.facet-label { font-weight: 600; min-width: 4.5rem; }
.facet-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; flex: 1; }
.facet-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    border: 1px solid var(--bs-border-color); border-radius: 999px;
    padding: 0.2rem 0.7rem; font-size: 0.875rem; text-decoration: none; color: var(--bs-body-color);
    background: var(--bs-body-bg); transition: border-color 0.15s, color 0.15s;
}
.facet-chip:hover { border-color: var(--csm-primary); color: var(--csm-primary); }
.facet-chip.active { background: var(--csm-primary); color: var(--bs-white); border-color: var(--csm-primary); }
.facet-chip.disabled { opacity: 0.45; pointer-events: none; }
.facet-count { font-size: 0.8em; opacity: 0.7; }
.facet-reset { align-self: flex-start; font-size: 0.875rem; color: var(--bs-secondary-color); text-decoration: none; }
.facet-reset:hover { color: var(--bs-danger); }
.catalog-count { font-size: 0.875rem; margin-bottom: 0.75rem; }

/* Catalog: product cards (whole card clickable via .stretched-link). */
.catalog-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.catalog-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--bs-border-color); border-radius: 0.75rem; background: var(--bs-body-bg);
    transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.catalog-card:not(.is-sold-out):hover { border-color: var(--csm-primary); box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08); transform: translateY(-2px); }
.catalog-card:focus-within { outline: 2px solid var(--csm-primary); outline-offset: 2px; }
.catalog-card-media {
    position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    padding: 0.75rem; background: var(--bs-tertiary-bg);
}
.catalog-card-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.catalog-card-placeholder { font-size: 2.5rem; color: var(--bs-secondary-color); }
.catalog-card-badge { position: absolute; top: 0.5rem; left: 0.5rem; }
.catalog-card-body { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; padding: 0.875rem 1rem 1rem; }
.catalog-card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.catalog-card-title a { color: inherit; text-decoration: none; }
.catalog-card-title a:focus { outline: none; }
.catalog-card-price { font-size: 1.125rem; font-weight: 700; margin: 0; }
.catalog-card-price-from { font-size: 0.8rem; font-weight: 400; color: var(--bs-secondary-color); }
.catalog-card-cta { margin-top: auto; padding-top: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--csm-primary); }
.catalog-card.is-sold-out .catalog-card-img { opacity: 0.45; filter: grayscale(1); }
.catalog-card.is-sold-out .catalog-card-body { color: var(--bs-secondary-color); }
.catalog-empty { text-align: center; color: var(--bs-secondary-color); padding: 3rem 1rem; border: 1px dashed var(--bs-border-color); border-radius: 0.75rem; }
.catalog-empty .bi { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

/* Product detail. */
.product-image-frame { height: min(24rem, 75vw); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.product-detail .img-fluid { max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 0.5rem; display: block; }
#picker-container { overflow-anchor: none; }
#cart-container { overflow-anchor: none; }
.variant-selector { border: 0; padding: 0; margin: 0; min-width: 0; }
.variant-grid { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(3.5rem, 1fr)); }
.variant-grid-images { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
.variant-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
    padding: 0.5rem; border: 1px solid var(--bs-border-color); border-radius: 0.5rem;
    background: var(--bs-body-bg); cursor: pointer; text-align: center; font-size: 0.875rem; line-height: 1.2;
}
.variant-card:hover { border-color: var(--bs-secondary-color); }
.btn-check:checked + .variant-card { border-color: var(--bs-primary); box-shadow: 0 0 0 1px var(--bs-primary); font-weight: 600; }
.btn-check:focus-visible + .variant-card { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
/* Fixed square box: thumbnails keep their size while loading after an htmx swap. */
.variant-card-img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }

/* Price + quantity stepper + add-to-cart. */
.product-price { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; }
.qty-stepper .qty-input { text-align: center; -moz-appearance: textfield; appearance: textfield; }
.qty-stepper .qty-input::-webkit-outer-spin-button,
.qty-stepper .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.picker-add { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.qty-stepper-csm { width: 9rem; flex: 0 0 auto; }
.qty-stepper-csm > .btn, .qty-stepper-csm > .qty-input { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.qty-stepper-csm > .btn { width: 2.75rem; }
.picker-add-submit {
    flex: 1 1 12rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-weight: 600; padding: 0.625rem 1.25rem;
}

/* Product detail: buy column (desktop) / sticky buy bar (phones). */
#picker-buy { overflow-anchor: none; }
.buybar-csm { border: 1px solid var(--bs-border-color); border-radius: 0.75rem; padding: 1.25rem; background: var(--bs-body-bg); }
.buybar-csm .product-price { margin-bottom: 0.75rem; }
@media (min-width: 992px) {
    .buy-column-csm { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1rem; }
    /* Description beside the main image; selectors keep full width below. */
    .product-media-desc-csm { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
    .product-media-csm { flex: 1 1 55%; min-width: 0; order: 0; }
    .product-description-csm { flex: 1 1 40%; min-width: 0; order: 1; margin-top: 0; }
    .picker-select { flex: 1 1 100%; order: 2; }
}
@media (max-width: 991.98px) {
    /* Clearance so the cart/footer scroll clear of the fixed bar. */
    .product-detail { padding-bottom: 6.5rem; }
    /* Phone: the budget banner is hidden on the buying page only (R106);
       the 1px brand border separates the navbar in its place. The !important
       is REQUIRED: the banner root carries Bootstrap's .d-flex, and display
       utilities are !important — a plain display:none would lose to it. */
    body:has(.product-detail) .budget-banner-csm { display: none !important; }
    body:has(.product-detail) nav.navbar:has(+ .budget-banner-csm) { border-bottom: 1px solid var(--csm-secondary); }
    /* Catalog (order) page: same phones-only banner treatment (R106). */
    body:has(.catalog) .budget-banner-csm { display: none !important; }
    body:has(.catalog) nav.navbar:has(+ .budget-banner-csm) { border-bottom: 1px solid var(--csm-secondary); }
    .buybar-csm {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
        display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
        border: 0; border-top: 1px solid var(--csm-secondary); border-radius: 0;
        box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.08);
        padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom));
    }
    .buybar-csm .product-price { margin: 0; font-size: 1.25rem; flex: 0 0 auto; }
    /* The chosen values already show in the selector legends. */
    .buybar-csm p.text-muted { display: none; }
    .buybar-csm .picker-add { flex: 1 1 auto; }
    .buybar-csm .qty-stepper-csm { width: 7.5rem; }
    .buybar-csm .qty-stepper-csm > .btn { width: 2.25rem; }
    .buybar-csm .picker-add-submit { flex: 1 1 8rem; padding: 0.5rem 0.75rem; }
    /* Catalog filters: one non-wrapping, horizontally scrollable chip row
       per facet, label compacted above the row (option A, 2026-10-15) —
       many colors/sizes no longer stack the bar. Desktop keeps the wrapping
       base rules. width: 100% is REQUIRED: as a column-flex item, a scroll
       container is sized by content instead of being stretched, so the box
       must be constrained explicitly or it bursts out of the facet-bar card
       and the page scrolls sideways (regression pinned by test). flex is
       neutralized too — the base flex:1 (row layout) collapses the box
       height via flex-basis 0% in the column layout. */
    .facet-group { flex-direction: column; align-items: stretch; gap: 0.25rem; }
    .facet-label { min-width: 0; font-size: 0.8rem; }
    .facet-chips { flex: 0 0 auto; width: 100%; flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 0.25rem; }
    .facet-chip { flex: 0 0 auto; scroll-snap-align: start; }
}
.cart-badge-csm {
    display: inline-flex; align-items: center; gap: 0.35rem; margin-left: auto;
    border: 1px solid var(--csm-primary); color: var(--csm-primary);
    border-radius: 999px; padding: 0.4rem 0.75rem; text-decoration: none; font-weight: 600;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}
.cart-badge-csm:hover, .cart-badge-csm:focus { background: var(--csm-primary); color: var(--bs-white); }
.cart-badge-csm.is-bumped { transform: scale(1.15); }
@media (min-width: 992px) {
    /* Desktop sees the full cart beside the buy card; the badge is a phone affordance. */
    .cart-badge-csm { display: none; }
}

/* Product detail: description section (always visible). */
.product-description-csm { margin-top: 1rem; }
.description-label-csm { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
/* Sold-out notice inside the buy bar (S4: single class for the repeated cluster). */
.soldout-csm { margin: 0; padding-block: 0.5rem; flex-grow: 1; }
/* Cart CTA — enlarged brand-secondary button (Payer). */
.cart-continue-csm { font-size: 1.125rem; font-weight: 600; }

/* Cart panel. */
.cart-panel { border: 1px solid var(--bs-border-color); border-radius: 0.75rem; padding: 1.25rem; background: var(--bs-body-bg); }
.cart-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
.cart-count { background: var(--csm-primary); font-size: 0.75rem; }
.cart-line { padding: 0.875rem 0; border-top: 1px solid var(--bs-border-color); }
.cart-line-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.cart-line-name { min-width: 0; overflow-wrap: anywhere; }
.cart-remove { padding: 0 0.25rem; color: var(--bs-secondary-color); line-height: 1.5; }
.cart-remove:hover, .cart-remove:focus { color: var(--bs-danger); }
.cart-line-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.cart-qty-stepper { width: 7rem; flex-wrap: nowrap; }
.cart-line-price { text-align: right; white-space: nowrap; }
.cart-total {
    display: flex; justify-content: space-between; align-items: baseline;
    border-top: 2px solid var(--bs-border-color); padding-top: 0.875rem; margin-bottom: 1rem;
    font-size: 1.125rem; font-weight: 700;
}
.cart-empty { text-align: center; color: var(--bs-secondary-color); padding: 1.5rem 0; }
.cart-empty .bi { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

/* Confirm (checkout) page. */
.checkout-back { color: var(--bs-secondary-color); text-decoration: none; font-size: 0.9rem; }
.checkout-back:hover { color: var(--csm-primary); }
.checkout-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 1.25rem; }
.checkout-panel { border: 1px solid var(--bs-border-color); border-radius: 0.75rem; padding: 1.25rem; background: var(--bs-body-bg); }
.checkout-panel-title { display: flex; align-items: center; gap: 0.5rem; font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; }
@media (min-width: 992px) {
    .checkout-summary { position: sticky; top: 1rem; }
}
.summary-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0; border-top: 1px solid var(--bs-border-color); }
.summary-line-name { min-width: 0; overflow-wrap: anywhere; }
.summary-line-total { font-weight: 600; white-space: nowrap; }
.summary-total {
    display: flex; justify-content: space-between; align-items: baseline;
    border-top: 2px solid var(--bs-border-color); padding-top: 0.875rem;
    font-size: 1.25rem; font-weight: 700;
}
.checkout-edit { display: inline-block; margin-top: 1rem; font-size: 0.875rem; color: var(--csm-primary); text-decoration: none; }
.checkout-edit:hover { text-decoration: underline; }
.checkout-submit { margin-top: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-weight: 600; }

/* Campaign statistics page. */
/* Shared root wrapper of the commerce working pages (stats, préparation
   board, wave e-mail preview). Named « page » because it outgrew the stats
   page; on wide screens it widens so the board uses the available width. */
.page-csm-root { max-width: 48rem; margin-left: auto; margin-right: auto; }
@media (min-width: 992px) { .page-csm-root { max-width: 64rem; } }
@media (min-width: 1200px) { .page-csm-root { max-width: 75rem; } }
.stats-csm-title { font-size: 1.5rem; font-weight: 700; margin: 0; }
/* Supplier-order export CTA: compact icon-only button below the sm breakpoint. */
@media (max-width: 575.98px) {
    .stats-csm-export-btn { padding: 0.1875rem 0.4375rem; font-size: 0.8125rem; line-height: 1; }
}
.stats-csm-tile { border: 1px solid var(--bs-border-color); border-radius: 0.625rem; padding: 0.5rem 0.375rem; text-align: center; }
.stats-csm-tile b { display: block; font-size: 1.125rem; }
.stats-csm-tile span { font-size: 0.75rem; color: var(--bs-secondary-color); }
.stats-csm-tile--lead b { font-size: 1.35rem; }
.stats-csm-sub { font-size: 0.7rem; color: var(--bs-danger); }
.stats-csm-sub-muted { font-size: 0.7rem; color: var(--bs-secondary-color); }
.stats-csm-card { border: 1px solid var(--bs-border-color); border-radius: 0.625rem; padding: 0.75rem; }
.stats-csm-cardtitle { font-size: 1rem; font-weight: 500; margin-bottom: 0.5rem; }
/* Board sections (preparation 1–4) read as clearly separate blocks:
   brand accent bar on top, bolder title ruled off from the content.
   Variant only — the shared base keeps its quiet look on the stats and
   wave-email pages. */
.stats-csm-card--section { border-top: 3px solid var(--bs-primary); }
.stats-csm-card--section .stats-csm-cardtitle {
  font-size: 1.05rem;
  font-weight: 600;
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--bs-border-color);
}
/* Collapsible board sections: the header is the Bootstrap collapse toggle
   (server renders every body open — commerce_prep_sections.js collapses
   all but the spotlight section and remembers the operator's choices). */
.section-csm-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: start;
  cursor: pointer;
}
.section-csm-toggle:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 3px;
  border-radius: 0.25rem;
}
.section-csm-caret {
  flex: 0 0 auto;
  color: var(--bs-secondary-color);
  transition: transform 0.15s ease-in-out;
}
.section-csm-toggle[aria-expanded="false"] .section-csm-caret { transform: rotate(-90deg); }
.stats-csm-badge { font-size: 0.7rem; font-weight: 700; padding: 0.125rem 0.5rem; border-radius: 0.625rem; background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.stats-csm-chart { display: flex; align-items: flex-end; gap: 0.3rem; height: 6rem; padding-top: 0.25rem; }
.stats-csm-day { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.125rem; height: 100%; }
.stats-csm-bars { display: flex; align-items: flex-end; justify-content: center; gap: 0.125rem; width: 100%; height: 100%; }
.stats-csm-bar { width: 0.5rem; border-radius: 2px 2px 0 0; }
.stats-csm-bar--paid { background: var(--bs-success); }
.stats-csm-bar--pending { background: var(--bs-warning); }
.stats-csm-bar--sold { background: var(--bs-primary); }
.stats-csm-daylabel { font-size: 0.65rem; color: var(--bs-secondary-color); }
.stats-csm-funnel { display: flex; height: 0.875rem; border-radius: 0.4375rem; overflow: hidden; margin: 0.375rem 0 0.125rem; background: var(--bs-secondary-bg); }
.stats-csm-seg { height: 100%; }
.stats-csm-seg--paid { background: var(--bs-success); }
.stats-csm-seg--pending { background: var(--bs-warning); }
.stats-csm-seg--cancelled { background: var(--bs-danger); }
.stats-csm-seg--refunded { background: var(--bs-secondary); }
.stats-csm-legend { display: flex; flex-wrap: wrap; gap: 0.625rem; font-size: 0.75rem; color: var(--bs-secondary-color); }
.stats-csm-dot { display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; margin-right: 0.1875rem; }
.stats-csm-dot--paid { background: var(--bs-success); }
.stats-csm-dot--pending { background: var(--bs-warning); }
.stats-csm-dot--sold { background: var(--bs-primary); }
.stats-csm-dot--cancelled { background: var(--bs-danger); }
.stats-csm-dot--refunded { background: var(--bs-secondary); }
.stats-csm-grouphead { font-size: 0.7rem; text-transform: uppercase; color: var(--bs-secondary-color); margin-top: 0.5rem; }
.stats-csm-row { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; padding: 0.25rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.stats-csm-row:last-child { border-bottom: none; }
.stats-csm-stock { color: var(--bs-secondary-color); }
.stats-csm-stock--low { color: var(--bs-danger); font-weight: 700; }
.stats-csm-virtual { color: var(--bs-primary); text-transform: none; }
.stats-csm-retired { color: var(--bs-warning-text-emphasis); text-transform: none; }

/* Post-sale control-panel step rows (R201) — a 4-column grid:
   N° | Titre | Statut | CTA. The status is a solid full-colour block; its
   colours come from the Bootstrap text-bg-* utilities set in
   templates/partials/commerce/prep_step_badge.html (which state → which colour
   is a readiness-service decision, never a template one). The two form steps
   (tick-ready / guichet) hang their inputs on a full-width subline. */
.step-csm {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 15rem 11.5rem;
  gap: 0.4rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}
.step-csm:last-child { border-bottom: 0; }
.step-csm-num { text-align: center; font-weight: 700; color: var(--bs-secondary-color); }
.step-csm-title { font-weight: 600; }
.step-csm-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}
.step-csm-form {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding-left: 3.25rem;
}
.step-csm-status {
  display: block;
  width: 100%;
  border: 1.5px solid transparent;
  border-radius: 0.5rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
}
/* The grid-adjust form's two inputs (R192) — widths as component classes,
   never inline styles (S rule). */
.step-csm-variant { min-width: 11rem; max-width: 18rem; }
.step-csm-qty { width: 5.5rem; flex: 0 0 auto; }
/* Progression spotlight (R201, option Q): the readiness service marks exactly
   one step progress == "now" — the current frontier of the phase ladder —
   rendered FULL (solid status block + filled CTA) with a row tint and a ▸
   marker; every other row carries .step-csm--next and drops to the OUTLINE
   of its own colour, CTAs included. Which step is "now" is decided in
   commerce.services.preparation.readiness (never here); these rules only
   restyle what the partial already coloured, using Bootstrap variables. */
.step-csm--now { background-color: var(--bs-primary-bg-subtle); border-radius: 0.625rem; }
.step-csm--now .step-csm-num { color: var(--bs-emphasis-color); }
.step-csm--now .step-csm-title::before { content: "\25B8\00a0"; color: var(--bs-primary); }
.step-csm--now .step-csm-status.text-bg-success { box-shadow: 0 0 0 3px rgba(var(--bs-success-rgb), 0.3); }
.step-csm--now .step-csm-status.text-bg-primary { box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.3); }
.step-csm--now .step-csm-status.text-bg-secondary { box-shadow: 0 0 0 3px rgba(var(--bs-secondary-rgb), 0.3); }
.step-csm--now .step-csm-status.text-bg-danger { box-shadow: 0 0 0 3px rgba(var(--bs-danger-rgb), 0.3); }
.step-csm--next .step-csm-status { background-color: transparent !important; }
.step-csm--next .step-csm-status.text-bg-success { color: var(--bs-success) !important; border-color: var(--bs-success); }
.step-csm--next .step-csm-status.text-bg-primary { color: var(--bs-primary) !important; border-color: var(--bs-primary); }
.step-csm--next .step-csm-status.text-bg-secondary { color: var(--bs-secondary-color) !important; border-color: var(--bs-secondary-color); }
.step-csm--next .step-csm-status.text-bg-danger { color: var(--bs-danger) !important; border-color: var(--bs-danger); }
.step-csm--next .btn-csm-primary {
  color: var(--bs-secondary-color);
  background-color: transparent;
  border-color: var(--bs-border-color);
}
.step-csm--next .btn-csm-primary:hover,
.step-csm--next .btn-csm-primary:focus {
  color: var(--bs-emphasis-color);
  background-color: var(--bs-secondary-bg);
  border-color: var(--bs-secondary-color);
}
@media (max-width: 575.98px) {
  .step-csm { grid-template-columns: 1.75rem minmax(0, 1fr); row-gap: 0.5rem; }
  .step-csm-status { grid-column: 1 / -1; }
  .step-csm-cta { grid-column: 1 / -1; justify-content: flex-start; }
  .step-csm-form { padding-left: 2.5rem; }
}

/* ---------------------------------------------------------------------------
   Fixed delivery page (R199, single-delivery-page rework). STANDALONE
   tablet screen: templates/commerce/delivery.html loads ONLY this file
   (no Bootstrap, no styles.css), so the rules are self-contained — brand
   colour rides the --csm-primary fallback chain (S2), neutrals are
   page-local. Classes delivery-csm-* (S1), defined once, all used.
   --------------------------------------------------------------------------- */
.delivery-csm-page {
  --csm-ink: #0f172a; --csm-fast: #fde047;
  margin: 0 auto; padding: 16px; max-width: 720px;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 18px; color: #0f172a; background: #f8fafc;
}
.delivery-csm-title { margin: 0 0 16px; font-size: 26px; }
.delivery-csm-subtitle { margin: 0 0 8px; font-size: 20px; }
.delivery-csm-label { display: block; font-weight: 700; margin-bottom: 6px; }
.delivery-csm-form { margin: 0 0 16px; }
.delivery-csm-code-input {
  display: block; box-sizing: border-box; width: 100%; margin-bottom: 10px; padding: 14px 16px;
  font-size: 22px; letter-spacing: .12em; text-transform: uppercase;
  border: 2px solid #64748b; border-radius: 10px;
}
.delivery-csm-search-input {
  display: block; box-sizing: border-box; width: 100%; margin-bottom: 10px; padding: 14px 16px;
  font-size: 22px; border: 2px solid #64748b; border-radius: 10px;
}
.delivery-csm-btn {
  display: block; box-sizing: border-box; width: 100%; padding: 16px;
  font-size: 24px; font-weight: 700; color: #fff;
  background: var(--csm-primary, #66247f); border: 0; border-radius: 10px;
  cursor: pointer;
}
.delivery-csm-btn--scan { margin-top: 10px; background: #1d4ed8; }
.delivery-csm-btn--confirm { background: #15803d; }
.delivery-csm-card {
  margin: 0 0 16px; padding: 14px 16px;
  border: 2px solid #cbd5e1; border-radius: 10px; background: #fff;
}
.delivery-csm-card--error {
  border-color: #b91c1c; background: #fef2f2; color: #b91c1c; font-weight: 700;
}
.delivery-csm-card--success { border-color: #15803d; background: #f0fdf4; }
.delivery-csm-success-line { margin: 0; font-weight: 700; color: #15803d; }
.delivery-csm-code { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: .14em; }
.delivery-csm-code--small { display: inline-block; margin-right: 10px; font-size: 26px; }
.delivery-csm-buyer { margin: 4px 0 0; font-size: 24px; font-weight: 700; }
.delivery-csm-order { margin: 0; color: #475569; }
.delivery-csm-fast {
  display: inline-block; margin: 4px 0 0; padding: 2px 12px;
  font-size: 18px; font-weight: 900; letter-spacing: .18em;
  background: var(--csm-ink, #0f172a); color: var(--csm-fast, #fde047);
  border-radius: 8px;
}
.delivery-csm-lines { margin: 10px 0 14px; padding-left: 20px; }
.delivery-csm-lines li { margin: 4px 0; }
.delivery-csm-results { margin: 0; padding-left: 0; list-style: none; }
.delivery-csm-results li { padding: 10px 0; border-bottom: 1px solid #e2e8f0; }
.delivery-csm-hint { margin: 10px 0 0; color: #475569; }
.delivery-csm-footer { margin: 24px 0 8px; color: #64748b; font-size: 14px; }
/* QR reader overlay (built by commerce_delivery_scan.js — classes only,
   never JS-injected styling, S9). */
.delivery-csm-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; background: rgba(15, 23, 42, .92);
}
.delivery-csm-video { width: 100%; max-width: 480px; background: #000; border-radius: 10px; }
.delivery-csm-overlay-status { margin: 0; color: #f8fafc; font-size: 20px; font-weight: 700; }
.delivery-csm-btn--close { width: auto; padding: 12px 24px; font-size: 18px; }
