/* NX Plug storefront QA | P0 interface polish | 2026-11-10
   Scoped to product, cart and checkout surfaces. Do not change merchant
   theme tokens, product media behavior, forms or payment logic. */
:where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout]){
  --nx-ui-ink:#142b45;
  --nx-ui-muted:#587087;
  --nx-ui-line:#dfe8ef;
  --nx-ui-surface:#ffffff;
  --nx-ui-canvas:#f6f9fc;
  --nx-ui-radius:18px;
  --nx-ui-elevation:0 8px 30px rgba(18,46,74,.055);
  color:var(--nx-ui-ink);
  font-kerning:normal;
  text-rendering:optimizeLegibility;
}
:where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout])
  :is(button,input,select,textarea){font-family:inherit;}
:where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout])
  :is(button,a,summary,input,select,textarea):focus-visible{
  outline:2px solid color-mix(in srgb,var(--merchant-accent,#0c97c5) 82%,#16406b);
  outline-offset:3px;
}
[data-commerce-product-detail][data-reference-fidelity="v8"]{
  background:linear-gradient(180deg,#fff 0%,#f8fafc 100%)!important;
  padding-bottom:clamp(28px,5vw,64px);
}
[data-commerce-product-detail][data-reference-fidelity="v8"]>div{
  width:min(100%,1240px);
  max-width:1240px;
  padding:clamp(15px,2.25vw,32px) clamp(16px,3vw,38px) clamp(26px,4vw,52px);
}
[data-reference-fidelity="v8"] nav[aria-label]{margin-bottom:clamp(15px,2vw,24px);line-height:1.55;}
[data-reference-fidelity="v8"] .commerce-reference-grid{
  column-gap:clamp(26px,4vw,60px)!important;
  row-gap:24px!important;
  grid-template-columns:minmax(0,.95fr) minmax(0,1.05fr)!important;
}
[data-reference-fidelity="v8"] .commerce-gallery{top:100px;}
[data-reference-fidelity="v8"] .commerce-gallery [data-gallery-empty="true"]{border-color:var(--nx-ui-line);}
[data-reference-fidelity="v8"] [data-commerce-gallery][data-gallery-empty="true"] [data-product-main-image]{
  aspect-ratio:5/4!important;
  min-height:260px;
  border:1px solid #e3ebf1!important;
  border-radius:20px!important;
  background:radial-gradient(circle at 84% 12%,#e7f5fa,transparent 43%),
             linear-gradient(145deg,#f9fbfc,#eef5f8 70%,#f8f5ed)!important;
  box-shadow:var(--nx-ui-elevation)!important;
}
[data-reference-fidelity="v8"] [data-product-empty-thumbnails]{display:none!important;}
[data-reference-fidelity="v8"] .commerce-reference-details{padding-top:2px;}
[data-reference-fidelity="v8"] #commerce-product-title{
  font-size:clamp(28px,2.45vw,36px);
  font-weight:700;letter-spacing:-.028em;line-height:1.18;
  text-wrap:pretty;
}
[data-reference-fidelity="v8"] [data-product-selling-price]{
  font-size:clamp(26px,2.5vw,33px);
  font-weight:700;letter-spacing:-.026em;line-height:1.2;
}
[data-reference-fidelity="v8"] .commerce-price-block{margin:19px 0 13px;}
[data-reference-fidelity="v8"] .commerce-availability{margin-top:11px;padding:6px 10px;border-radius:999px;}
[data-reference-fidelity="v8"] .commerce-product-intro{margin:15px 0 0;padding:0 0 18px;}
[data-reference-fidelity="v8"] .commerce-product-intro p{font-size:14px;line-height:1.65;}
[data-reference-fidelity="v8"] [data-commerce-preorder-status]{
  margin-top:14px;line-height:1.55;align-items:center;
}
[data-reference-fidelity="v8"] [data-product-price-list]{
  margin-top:15px;gap:10px;border-radius:13px;padding:11px 14px;
}
[data-reference-fidelity="v8"] [data-product-bundle]{
  margin:18px 0 0;padding:16px 18px;border-radius:15px;
  border:1px solid #ead9b7;background:#fffbf1;
}
[data-reference-fidelity="v8"] [data-product-bundle] ul{line-height:1.55;}
[data-reference-fidelity="v8"] .commerce-inline-order{
  margin-top:20px;
  padding-top:18px;
  border-top:1px solid var(--nx-ui-line);
}
[data-reference-fidelity="v8"] .commerce-builder-options{gap:14px!important;}
[data-reference-fidelity="v8"] .commerce-builder-options>[data-product-choice-group]{
  border:1px solid var(--nx-ui-line)!important;
  border-radius:15px!important;
  padding:15px!important;
  background:#fff!important;
  box-shadow:0 3px 14px rgba(17,48,76,.035)!important;
}
[data-reference-fidelity="v8"] .commerce-choice-heading{flex-wrap:wrap;gap:8px 10px;margin-bottom:11px;}
[data-reference-fidelity="v8"] .commerce-choice-heading .commerce-choice-title{
  font-weight:700;font-size:14px;line-height:1.45;
}
[data-reference-fidelity="v8"] .commerce-choice-heading .commerce-choice-meta{
  margin-inline-start:auto!important;
  flex-wrap:wrap;
  font-size:12px;
}
[data-reference-fidelity="v8"] .commerce-choice-options{gap:10px;}
[data-reference-fidelity="v8"] .commerce-choice-option{
  min-height:53px;padding:11px 13px;border-radius:11px;
  border:1px solid #dce7ee;background:#fbfdff;
}
[data-reference-fidelity="v8"] .commerce-choice-option:hover{border-color:#8dbbd1;background:#f2f9fc;}
[data-reference-fidelity="v8"] .commerce-choice-option:has(input:checked){
  border-color:color-mix(in srgb,var(--merchant-accent,#0e96bc) 65%,white);
  background:#eff9fb;
}
[data-reference-fidelity="v8"] [data-open-amount-input],
[data-reference-fidelity="v8"] [data-b2b-quantity]{
  min-height:50px;border-radius:11px;font-size:16px;
}
[data-reference-fidelity="v8"] .commerce-dropdown-trigger{min-height:50px;border-radius:11px;font-size:14px;}
[data-reference-fidelity="v8"] .commerce-builder-aside{margin-top:16px;}
[data-reference-fidelity="v8"] .commerce-builder-aside-content{
  border-radius:16px!important;
  background:linear-gradient(180deg,#f8fbfd,#f0f6fa)!important;
  border:1px solid #dce7ed!important;
  padding:16px!important;
  box-shadow:none!important;
}
[data-reference-fidelity="v8"] .commerce-purchase-actions{gap:10px;}
[data-reference-fidelity="v8"] .commerce-purchase-actions button{
  min-height:50px;
  border-radius:11px;
  font-size:14px;
  font-weight:650;
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
[data-reference-fidelity="v8"] .commerce-purchase-actions button:hover:not(:disabled){transform:translateY(-1px);}
[data-reference-fidelity="v8"] .commerce-request-note{font-size:12px;line-height:1.5;}
[data-reference-fidelity="v8"] .commerce-continue-shopping{margin-top:18px;}
[data-reference-fidelity="v8"] .commerce-information-section{margin-top:28px;}
[data-reference-fidelity="v8"] .commerce-information-section+[data-commerce-order-journey]{margin-top:24px;}
[data-reference-fidelity="v8"] .commerce-order-journey{padding-top:23px;}
[data-reference-fidelity="v8"] .commerce-related-grid{gap:15px;}
[data-reference-fidelity="v8"] .commerce-related-grid .commerce-product-card{
  border:1px solid var(--nx-ui-line);
  border-radius:15px;
  box-shadow:0 6px 22px rgba(18,46,74,.045);
}
/* Cart: consistent readable cards and denser summary. */
[data-commerce-cart]{
  background:linear-gradient(180deg,#f8fbfd,#f3f7fa)!important;
  padding-bottom:30px;
}
[data-commerce-cart]>div{width:min(100%,1200px);max-width:1200px;}
[data-commerce-cart] h1{font-size:clamp(24px,2.8vw,32px);font-weight:700;letter-spacing:-.025em;}
[data-commerce-cart] [data-price-list-panel],
[data-commerce-cart] .commerce-cart-item,
[data-commerce-cart] [data-cart-summary]{
  border-color:var(--nx-ui-line);
  border-radius:var(--nx-ui-radius);
  box-shadow:var(--nx-ui-elevation);
}
[data-commerce-cart] [data-price-list-panel]{padding:clamp(14px,1.8vw,22px);}
[data-commerce-cart] .commerce-cart-item{gap:15px;}
[data-commerce-cart] .commerce-cart-item h2{font-size:15px;line-height:1.45;}
[data-commerce-cart] .commerce-cart-item [data-cart-price-list],
[data-commerce-cart] .commerce-cart-item [data-cart-preorder]{line-height:1.5;}
[data-commerce-cart] [data-cart-subtotal],
[data-commerce-cart] [data-cart-estimated-total-amount]{font-variant-numeric:tabular-nums;}
[data-commerce-cart] [data-cart-summary] h2{font-size:19px;letter-spacing:-.02em;}
/* Checkout: one visual hierarchy, consistent form blocks and stable totals. */
[data-storefront-checkout]{
  background:linear-gradient(180deg,#f8fbfd,#f2f7fa)!important;
  padding-top:clamp(22px,3vw,45px);
  padding-bottom:clamp(34px,5vw,65px);
}
[data-storefront-checkout]>div{width:min(100%,1200px);max-width:1200px;}
[data-storefront-checkout] h1{
  font-size:clamp(27px,2.75vw,35px);font-weight:700;letter-spacing:-.028em;
}
[data-storefront-checkout] [data-checkout-customer],
[data-storefront-checkout] [data-checkout-summary]{
  border-color:var(--nx-ui-line);border-radius:var(--nx-ui-radius);
  box-shadow:var(--nx-ui-elevation);
}
[data-storefront-checkout] [data-checkout-customer]>div:first-child,
[data-storefront-checkout] [data-checkout-summary]>header{
  background:#fbfdff;padding-block:19px;
}
[data-storefront-checkout] [data-checkout-customer] form{padding:clamp(18px,2.5vw,30px);}
[data-storefront-checkout] :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select,textarea){
  min-height:48px;border-radius:11px;border-color:#ccdae6;background:#fbfdff;
  font-size:16px;
}
[data-storefront-checkout] :is(input,select,textarea):focus{background:#fff;}
[data-storefront-checkout] [data-checkout-summary] dl>div:last-child{
  padding-top:16px;margin-top:6px;
}
[data-storefront-checkout] [data-checkout-summary] [data-checkout-submit]{
  min-height:52px;border-radius:11px;font-size:15px;
}
[data-storefront-checkout] .commerce-checkout-mobile-review{
  min-height:58px;border-radius:13px;padding:13px 15px;
}
/* Keep mobile safe areas and keyboard access intact. */
@media(max-width:899px){
 [data-reference-fidelity="v8"] .commerce-reference-grid{
  grid-template-columns:minmax(0,1fr)!important;gap:20px!important;
 }
 [data-reference-fidelity="v8"] .commerce-gallery{position:static;top:auto;}
}
@media(max-width:639px){
 [data-reference-fidelity="v8"]>div{
  padding:17px 16px 35px;
 }
 [data-reference-fidelity="v8"] .commerce-gallery{max-width:100%;}
 [data-reference-fidelity="v8"] [data-commerce-gallery][data-gallery-empty="true"] [data-product-main-image]{
  max-width:100%;min-height:0;aspect-ratio:1.42!important;
  border-radius:16px!important;
 }
 [data-reference-fidelity="v8"] #commerce-product-title{font-size:27px;line-height:1.2;}
 [data-reference-fidelity="v8"] .commerce-price-block{margin:15px 0 10px;}
 [data-reference-fidelity="v8"] .commerce-builder-options>[data-product-choice-group]{padding:13px!important;}
 [data-reference-fidelity="v8"] .commerce-choice-heading .commerce-choice-meta{
  flex:1 1 100%;margin-inline-start:0!important;
 }
 [data-reference-fidelity="v8"] .commerce-choice-options{
  grid-template-columns:repeat(2,minmax(0,1fr));
 }
 [data-reference-fidelity="v8"] .commerce-builder-aside-content{padding:14px!important;}
 [data-reference-fidelity="v8"] .commerce-order-journey{margin-top:20px;}
 [data-reference-fidelity="v8"] .commerce-related-grid{gap:10px;}
 [data-commerce-cart] .commerce-cart-item{padding:14px;gap:12px;}
 [data-storefront-checkout] [data-checkout-customer] form{padding:17px;}
 [data-storefront-checkout] [data-checkout-summary]>header{padding:16px;}
}
@media(max-width:370px){
 [data-reference-fidelity="v8"] .commerce-choice-options{grid-template-columns:minmax(0,1fr);}
 [data-reference-fidelity="v8"] .commerce-purchase-actions{
  grid-template-columns:minmax(0,1fr)!important;
 }
 [data-reference-fidelity="v8"] .commerce-purchase-actions button{min-height:48px;}
}
@media(prefers-reduced-motion:reduce){
 :where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout]) *,
 :where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout]) *::before,
 :where([data-commerce-product-detail],[data-commerce-cart],[data-storefront-checkout]) *::after{
  transition-duration:.01ms!important;animation-duration:.01ms!important;
 }
}

/* Checkout is a focused form. Its edit-cart and continue-shopping links
   replace the floating mobile shop tabs, which otherwise cover fields. */
@media(max-width:639px){
  body:has([data-storefront-checkout]) .merchant-safe-tabs{
    display:none!important;
  }
  [data-storefront-checkout]{
    padding-bottom:max(24px,env(safe-area-inset-bottom));
  }
}
