/* Neo Commerce 2.5 — UI stabilization and component-level light/dark unification.
 * Loaded last. This file intentionally scopes high-specificity corrections to known
 * storefront surfaces so the 18k-line legacy bundle can be retired incrementally.
 */
:root{
  --neo-action-bg:#007a3d;
  --neo-action-bg-hover:#006535;
  --neo-action-text:#fff;
  --neo-neutral-950:#0d0f0e;
  --neo-neutral-900:#131614;
  --neo-neutral-850:#171a18;
  --neo-neutral-800:#1d211e;
  --neo-neutral-700:#2b312d;
  --neo-neutral-400:#98a29c;
  --neo-layout-wide:1240px;
  --neo-layout-checkout:1180px;
}

/* ---------- Accessible interactive contract ---------- */
:where(.checkout-btn,.neo-order-button,.neo-home-add-to-cart,.product-card-cta,.add-cart,.neo-mini-cart-primary,.neo-cart-modal-primary,.cart-empty-primary){
  background:var(--neo-action-bg)!important;
  border-color:var(--neo-action-bg)!important;
  color:var(--neo-action-text)!important;
  text-decoration:none!important;
}
:where(.checkout-btn,.neo-order-button,.neo-home-add-to-cart,.product-card-cta,.add-cart,.neo-mini-cart-primary,.neo-cart-modal-primary,.cart-empty-primary):hover{
  background:var(--neo-action-bg-hover)!important;
  border-color:var(--neo-action-bg-hover)!important;
  color:#fff!important;
}

/* ---------- Woo system-page shell ownership ----------
 * page.php bypasses the generic 900px article shell for these routes. These
 * selectors are a defensive fallback for full-page caches/third-party wrappers
 * that may still serve the older nested DOM for one request after deployment.
 */
body.woocommerce-cart .neo-default-page,
body.woocommerce-checkout .neo-default-page,
body.woocommerce-account .neo-default-page{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
}
body.woocommerce-cart .neo-default-page-content,
body.woocommerce-checkout .neo-default-page-content,
body.woocommerce-account .neo-default-page-content{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
}

/* ---------- Cart layout contract ----------
 * cart-layout has ONE direct child: the cart form. The form itself owns the
 * two-column cart-main + cart-summary grid. Keeping the outer wrapper as a
 * block prevents the form from being squeezed into a phantom first column.
 */
body.woocommerce-cart .cart-page{
  width:min(calc(100% - 48px),var(--neo-layout-wide))!important;
  max-width:var(--neo-layout-wide)!important;
  margin-inline:auto!important;
  padding-inline:0!important;
}
body.woocommerce-cart .cart-layout{
  display:block!important;
  width:100%!important;
  max-width:none!important;
  margin:22px 0 0!important;
}
body.woocommerce-cart .cart-layout>form.woocommerce-cart-form{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(340px,380px)!important;
  gap:28px!important;
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
  align-items:start!important;
}
body.woocommerce-cart .cart-main,
body.woocommerce-cart .cart-summary{
  width:100%!important;
  max-width:none!important;
  min-width:0!important;
  margin:0!important;
}
body.woocommerce-cart .cart-main{grid-column:1!important;grid-row:1!important}
body.woocommerce-cart .cart-summary{grid-column:2!important;grid-row:1!important;position:sticky!important;top:118px!important;align-self:start!important}
body.woocommerce-cart .cart-item{
  display:grid!important;
  grid-template-columns:112px minmax(180px,1fr) 110px 132px!important;
  gap:16px!important;
  align-items:center!important;
  width:100%!important;
  min-width:0!important;
}
body.woocommerce-cart .cart-item-info{min-width:180px!important;max-width:100%!important}
body.woocommerce-cart .cart-item-info h2,
body.woocommerce-cart .cart-item-info h2 a{
  display:block!important;
  width:auto!important;
  max-width:100%!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  hyphens:none!important;
  line-height:1.34!important;
}
body.woocommerce-cart .cart-price{min-width:0!important;margin-right:18px!important}
body.woocommerce-cart .cart-card,
body.woocommerce-cart .summary-card,
body.woocommerce-cart .summary-help{
  border-radius:18px!important;
}

body.woocommerce-cart .cart-main{overflow:visible!important}
body.woocommerce-cart .cart-item>*{min-width:0!important}
body.woocommerce-cart .cart-recommendation .mini-product-row{grid-template-columns:repeat(3,minmax(0,1fr))!important}
body.woocommerce-cart .cart-recommendation .mini-product-row>a{min-width:0!important}

/* ---------- Checkout: stable 2-column desktop rail ---------- */
body.woocommerce-checkout .checkout-page{
  width:min(calc(100% - 48px),var(--neo-layout-checkout))!important;
  max-width:var(--neo-layout-checkout)!important;
  margin-inline:auto!important;
  padding-inline:0!important;
}
body.woocommerce-checkout form.checkout-layout,
body.woocommerce-checkout form.woocommerce-checkout.checkout-layout{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(340px,380px)!important;
  gap:28px!important;
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  align-items:start!important;
}
body.woocommerce-checkout .checkout-main,
body.woocommerce-checkout .checkout-summary{width:100%!important;max-width:none!important;min-width:0!important;margin:0!important}
body.woocommerce-checkout .checkout-summary{grid-column:2;position:sticky!important;top:118px!important;align-self:start!important}
body.woocommerce-checkout .checkout-grid.two{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:14px!important}
body.woocommerce-checkout .field{min-width:0!important}
body.woocommerce-checkout .field.full{grid-column:1/-1!important}
body.woocommerce-checkout :where(input,select,textarea){width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box!important}
body.woocommerce-checkout .checkout-hero{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(230px,310px)!important;gap:24px!important;align-items:center!important}
body.woocommerce-checkout .checkout-hero h1{max-width:760px!important}

/* ---------- Component-level dark palette ---------- */
body.neo-surface-dark{
  --neo-page-bg:var(--neo-neutral-950);
  --neo-page-surface:var(--neo-neutral-900);
  --neo-page-surface-alt:var(--neo-neutral-850);
  --neo-page-text:#f4f7f5;
  --neo-page-muted:#a7b0aa;
  --neo-page-border:#2a302c;
  color-scheme:dark;
}
body.neo-surface-dark :where(.topbar,.header-shell,.main-header,.nav-row,.category-page,.product-page,.cart-page,.checkout-page,.neo-search-page){color:var(--neo-page-text)}
body.neo-surface-dark :where(.topbar,.header-shell,.main-header,.nav-row){background:var(--neo-neutral-900)!important;border-color:var(--neo-page-border)!important}
body.neo-surface-dark :where(.nav-row a,.topbar a,.action-btn,.neo-account-link,.neo-theme-mode-toggle){color:var(--neo-page-text)!important}
body.neo-surface-dark :where(.nav-row .nav-item,.nav-row>button,.nav-row>a,.category-nav a,.more-menu-trigger,.action-btn){background:var(--neo-neutral-850)!important;border-color:var(--neo-page-border)!important}
body.neo-surface-dark :where(.search-zone,.search-zone input,.search-zone select){background:var(--neo-neutral-850)!important;border-color:var(--neo-page-border)!important;color:var(--neo-page-text)!important}
body.neo-surface-dark :where(.search-zone input::placeholder,input::placeholder,textarea::placeholder){color:#7f8983!important}

body.neo-surface-dark :where(
  .category-hero-card,.filter-sidebar,.filter-group,.listing-toolbar,.product-card,
  .detail-shell,.detail-card,.detail-tabs,.detail-gallery,.detail-info,.review-box,.faq-item,
  .cart-hero,.cart-card,.cart-item,.cart-summary,.summary-card,.summary-help,.cart-recommendation,
  .checkout-hero,.checkout-card,.checkout-summary,.summary-card,.summary-help,.choice,.invoice-note,
  .neo-mini-cart,.neo-account-dropdown,.neo-cart-modal-dialog,.neo-pdp-modal-sheet,.neo-tech-specs-sheet
){
  background:var(--neo-page-surface)!important;
  border-color:var(--neo-page-border)!important;
  color:var(--neo-page-text)!important;
  box-shadow:0 12px 34px rgba(0,0,0,.18)!important;
}
body.neo-surface-dark :where(.filter-group,.summary-trust>div,.neo-pdp-micro-item,.spec-row,.neo-tech-specs-grid-row,.checkout-mini-items>div,.coupon-box,.shipping-options .choice){background:var(--neo-page-surface-alt)!important;border-color:var(--neo-page-border)!important}
body.neo-surface-dark :where(h1,h2,h3,h4,h5,strong,.product-card h3 a,.detail-info h1,.summary-total strong,.summary-head strong,.checkout-card-head strong,.cart-item-info h2 a){color:var(--neo-page-text)!important}
body.neo-surface-dark :where(p,small,.detail-sub,.product-meta,.product-card .installment,.filter-option-text,.summary-lines span,.summary-help span,.checkout-card-head small,.cart-item-info p,.breadcrumb,.breadcrumb a){color:var(--neo-page-muted)!important}
body.neo-surface-dark :where(input,select,textarea,.price-inputs input,.qty-control){background:#111412!important;border-color:#343a36!important;color:var(--neo-page-text)!important}
body.neo-surface-dark :where(.category-kicker,.badge,.neo-stock-pill,.cart-item-top span,.cart-item-top em){border-color:#31513d!important}
body.neo-surface-dark .checkout-hero{
  background:linear-gradient(120deg,#121713 0%,#17251c 58%,#1d3a27 100%)!important;
}
body.neo-surface-dark .checkout-hero :where(h1,p,strong,span){color:var(--neo-page-text)!important}
body.neo-surface-dark .checkout-hero-mini{background:rgba(255,255,255,.055)!important;border-color:rgba(255,255,255,.1)!important}
body.neo-surface-dark .cart-hero{background:linear-gradient(120deg,#111812,#18321f 58%,#264c33)!important}
body.neo-surface-dark .cart-hero :where(h1,p,strong,span){color:var(--neo-page-text)!important}
body.neo-surface-dark .filter-sidebar :where(input[type=checkbox],input[type=radio]){accent-color:var(--neo-brand)}
body.neo-surface-dark .product-card .product-media,
body.neo-surface-dark .cart-item-media,
body.neo-surface-dark .checkout-mini-items img{background:#f8faf9!important;border-color:var(--neo-page-border)!important}
body.neo-surface-dark .footer{background:#090b0a!important}

/* Corporate documents use neutral editorial modes, not one layout for every content type. */
.neo-corporate-page.neo-corporate-type-editorial .neo-corporate-content{max-width:840px!important}
.neo-corporate-page.neo-corporate-type-legal .neo-corporate-content{max-width:900px!important;font-size:14.5px!important;line-height:1.74!important}
.neo-corporate-page.neo-corporate-type-legal .neo-corporate-content h2{margin-top:42px!important;padding-top:20px!important;border-top:1px solid var(--neo-page-border)!important}
.neo-corporate-page.neo-corporate-type-legal .neo-corporate-content h2:first-child{border-top:0!important;padding-top:0!important}
.neo-corporate-page.neo-corporate-type-legal .neo-corporate-content :where(ul,ol){padding:14px 18px 14px 34px!important;border:1px solid var(--neo-page-border)!important;border-radius:14px!important;background:var(--neo-page-surface-alt)!important}
.neo-corporate-page.neo-corporate-type-legal .neo-corporate-content li+li{margin-top:8px!important}
.neo-corporate-page.neo-corporate-type-editorial .neo-corporate-hero{padding-bottom:24px!important}
.neo-corporate-page.neo-corporate-type-editorial .neo-corporate-content>p:first-of-type{font-size:1.04rem!important;line-height:1.75!important;color:var(--neo-page-text)!important}
.neo-corporate-toc{max-width:100%!important}
.neo-corporate-toc nav{scrollbar-width:thin}

/* System appearance mirrors the exact dark token contract. */
@media(prefers-color-scheme:dark){
  body.neo-surface-system{
    --neo-page-bg:var(--neo-neutral-950);
    --neo-page-surface:var(--neo-neutral-900);
    --neo-page-surface-alt:var(--neo-neutral-850);
    --neo-page-text:#f4f7f5;
    --neo-page-muted:#a7b0aa;
    --neo-page-border:#2a302c;
    color-scheme:dark;
  }
  body.neo-surface-system :where(.topbar,.header-shell,.main-header,.nav-row){background:var(--neo-neutral-900)!important;border-color:var(--neo-page-border)!important}
  body.neo-surface-system :where(.nav-row a,.topbar a,.action-btn,.neo-account-link,.neo-theme-mode-toggle){color:var(--neo-page-text)!important}
  body.neo-surface-system :where(.nav-row .nav-item,.nav-row>button,.nav-row>a,.category-nav a,.more-menu-trigger,.action-btn,.search-zone,.search-zone input,.search-zone select){background:var(--neo-neutral-850)!important;border-color:var(--neo-page-border)!important;color:var(--neo-page-text)!important}
  body.neo-surface-system :where(.category-hero-card,.filter-sidebar,.filter-group,.listing-toolbar,.product-card,.detail-shell,.detail-card,.detail-tabs,.detail-gallery,.detail-info,.review-box,.faq-item,.cart-hero,.cart-card,.cart-item,.cart-summary,.summary-card,.summary-help,.cart-recommendation,.checkout-hero,.checkout-card,.checkout-summary,.choice,.invoice-note,.neo-mini-cart,.neo-account-dropdown,.neo-cart-modal-dialog,.neo-pdp-modal-sheet,.neo-tech-specs-sheet){background:var(--neo-page-surface)!important;border-color:var(--neo-page-border)!important;color:var(--neo-page-text)!important;box-shadow:0 12px 34px rgba(0,0,0,.18)!important}
  body.neo-surface-system :where(.filter-group,.summary-trust>div,.neo-pdp-micro-item,.spec-row,.neo-tech-specs-grid-row,.checkout-mini-items>div,.coupon-box,.shipping-options .choice){background:var(--neo-page-surface-alt)!important;border-color:var(--neo-page-border)!important}
  body.neo-surface-system :where(h1,h2,h3,h4,h5,strong,.product-card h3 a,.detail-info h1,.summary-total strong,.summary-head strong,.checkout-card-head strong,.cart-item-info h2 a){color:var(--neo-page-text)!important}
  body.neo-surface-system :where(p,small,.detail-sub,.product-meta,.product-card .installment,.filter-option-text,.summary-lines span,.summary-help span,.checkout-card-head small,.cart-item-info p,.breadcrumb,.breadcrumb a){color:var(--neo-page-muted)!important}
  body.neo-surface-system :where(input,select,textarea,.price-inputs input,.qty-control){background:#111412!important;border-color:#343a36!important;color:var(--neo-page-text)!important}
}

/* ---------- Responsive ---------- */
@media(max-width:1120px){
  body.woocommerce-cart .cart-layout>form.woocommerce-cart-form,
  body.woocommerce-checkout form.checkout-layout,
  body.woocommerce-checkout form.woocommerce-checkout.checkout-layout{
    grid-template-columns:minmax(0,1fr)!important;
    gap:18px!important;
    max-width:none!important;
    margin:0!important;
  }
  body.woocommerce-cart .cart-main,
  body.woocommerce-cart .cart-summary,
  body.woocommerce-checkout .checkout-main,
  body.woocommerce-checkout .checkout-summary{
    grid-column:1!important;
    grid-row:auto!important;
    position:static!important;
    width:100%!important;
    max-width:none!important;
  }
}
@media(max-width:760px){
  body.woocommerce-cart .cart-page,
  body.woocommerce-checkout .checkout-page{width:min(calc(100% - 24px),100%)!important}
  body.woocommerce-cart .cart-item{
    grid-template-columns:86px minmax(0,1fr)!important;
    gap:12px!important;
    padding:14px!important;
    padding-top:44px!important;
  }
  body.woocommerce-cart .cart-item-info{min-width:0!important}
  body.woocommerce-cart .cart-item .qty-control,
  body.woocommerce-cart .cart-item .cart-stock-problem-note{grid-column:2!important;justify-self:start!important}
  body.woocommerce-cart .cart-item .cart-price{grid-column:2!important;align-items:flex-start!important;text-align:left!important;margin-right:0!important;white-space:normal!important}
  body.woocommerce-checkout .checkout-grid.two{grid-template-columns:1fr!important}
  body.woocommerce-checkout .field.full{grid-column:auto!important}
  body.woocommerce-checkout .checkout-hero{grid-template-columns:1fr!important}
  body.woocommerce-checkout .checkout-hero-mini{display:none!important}
}

/* Mini-cart media must remain visible even when legacy image rules/lazy-load plugins intervene. */
.neo-mini-cart-thumb{display:grid!important;place-items:center!important;overflow:hidden!important;width:64px!important;height:64px!important;min-width:64px!important;background:#fff!important;border:1px solid var(--neo-page-border)!important;border-radius:11px!important}
.neo-mini-cart-thumb :where(img,.neo-product-img,.attachment-woocommerce_thumbnail){display:block!important;position:static!important;width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;margin:0!important;opacity:1!important;visibility:visible!important;object-fit:contain!important;object-position:center!important;transform:none!important;filter:none!important}

/* Dark-mode detail polish discovered in the full screen recording. */
body.neo-surface-dark :where(.detail-tabs button,.storage-options button,.variant-block,.neo-tech-specs-search input,.neo-pdp-description-compact,.neo-pdp-micro-grid,.review,.faq-list){background:var(--neo-page-surface-alt)!important;border-color:var(--neo-page-border)!important;color:var(--neo-page-text)!important}
body.neo-surface-dark :where(.detail-tabs button.active,.storage-options button.active){background:color-mix(in srgb,var(--neo-brand) 12%,var(--neo-page-surface-alt))!important;color:#8df2b2!important;border-color:#31513d!important}
body.neo-surface-dark :where(.neo-tech-specs-grid-row,.spec-row){border-color:var(--neo-page-border)!important}
body.neo-surface-dark :where(.neo-tech-specs-grid-row>:first-child,.spec-row>:first-child){color:var(--neo-page-muted)!important}
@media(prefers-color-scheme:dark){
  body.neo-surface-system .checkout-hero{background:linear-gradient(120deg,#121713 0%,#17251c 58%,#1d3a27 100%)!important}
  body.neo-surface-system .cart-hero{background:linear-gradient(120deg,#111812,#18321f 58%,#264c33)!important}
  body.neo-surface-system :where(.checkout-hero,.cart-hero) :where(h1,p,strong,span){color:var(--neo-page-text)!important}
  body.neo-surface-system :where(.detail-tabs button,.storage-options button,.variant-block,.neo-tech-specs-search input,.neo-pdp-description-compact,.neo-pdp-micro-grid,.review,.faq-list){background:var(--neo-page-surface-alt)!important;border-color:var(--neo-page-border)!important;color:var(--neo-page-text)!important}
  body.neo-surface-system :where(.detail-tabs button.active,.storage-options button.active){background:color-mix(in srgb,var(--neo-brand) 12%,var(--neo-page-surface-alt))!important;color:#8df2b2!important;border-color:#31513d!important}
}
