/* Shared purchase spacing, with full-size controls and payment labels. */
.amg-single-product__summary { gap: 10px; }
.amg-single-product__summary > .amg-single-product__stock { margin-top: 4px; }
.amg-single-product__summary form.cart { margin-top: 4px; }
.amg-single-product__summary .amg-product-tools--single { margin-top: 0; gap: 24px; }
.amg-single-product__payments { margin-top: 0; padding: 0 0 12px; border-top: 0; border-bottom: 1px solid var(--border); flex-direction: row; align-items: center; gap: 8px 12px; }
.amg-single-product__payments-label { color: #626c61; font-size: 13px; font-weight: 500; line-height: 1.4; }
.amg-single-product__payments-list { gap: 6px; max-width: 100%; margin: 0; padding: 0; list-style: none; }
.amg-single-product__payments .amg-payment-method { justify-content: center; min-height: 32px; gap: 6px; margin: 0; padding: 4px 8px; border-color: #e6e9e5; border-radius: 8px; box-sizing: border-box; font-size: 12px; line-height: 1.35; }
.amg-single-product__payments .amg-payment-method--logo { width: 56px; padding: 4px 9px; }
.amg-payment-method--logo img { display: block; width: 36px; height: 22px; object-fit: contain; }
.amg-payment-method--label { color: #626c61; }
.amg-payment-method--label img { display: block; flex: 0 0 16px; width: 16px; height: 16px; }
.amg-payment-method--label span { min-width: 0; }

/* Keep an unpriced simple product's enquiry immediately after its price. */
.amg-single-product__summary > .amg-product-price-enquiry {
  grid-column: 1 / -1;
  grid-row: 9;
  margin: 0 0 4px;
}

@media (max-width: 680px) {
  .amg-single-product__payments-list { gap: 4px; }
  .amg-single-product__payments .amg-payment-method--logo { width: 48px; padding-inline: 5px; }
  .amg-single-product__payments .amg-payment-method--label { gap: 4px; padding-inline: 6px; }
  .amg-single-product__summary .amg-product-tools--single {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .amg-single-product__summary .amg-product-tools--single .amg-product-tool { min-width: 0; justify-content: flex-start; gap: 8px; }
  .amg-single-product__summary .amg-product-tools--single .amg-product-tool__icon { flex: 0 0 44px; }
  .amg-single-product__summary .amg-product-tools--single .amg-product-tool__text { min-width: 0; font-size: 13px; line-height: 1.35; white-space: normal; text-align: left; overflow-wrap: anywhere; }
  .amg-single-product__summary > .amg-product-price-enquiry {
    grid-row: auto;
  }
}

@media (max-width: 360px) {
  .amg-single-product__summary .amg-product-tools--single { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* Variable products need a full-width form, unlike a simple product's
   compact price / quantity grid. Keep WooCommerce variation UI intact. */
.product-type-variable.amg-single-product {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}

.product-type-variable .amg-single-product__top,
.product-type-variable .amg-single-product__gallery,
.product-type-variable .amg-single-product__details,
.product-type-variable .amg-single-product__details-main,
.product-type-variable .amg-single-product__details-side,
.product-type-variable .amg-single-product__panel {
  min-width: 0;
}

.product-type-variable .amg-single-product__summary {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.product-type-variable .amg-single-product__summary > * {
  min-width: 0;
  max-width: 100%;
}

.product-type-variable .amg-single-product__summary > .price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.product-type-variable .amg-single-product__summary .amount {
  white-space: nowrap;
}

.amg-variable-price {
  margin: 4px 0;
  min-width: 0;
}

.amg-variable-price__label {
  display: block;
  margin-bottom: 4px;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.4;
}

.amg-variable-price .price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  font-size: clamp(1.5rem, 2.1vw, 2rem);
  line-height: 1.35;
  font-weight: 600;
}

.amg-variable-price .woocommerce-price-suffix {
  color: #4b5563;
  font-size: 14px;
  font-weight: 400;
}

.amg-variable-price__hint {
  margin: 4px 0 0;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.4;
}

.amg-variable-price__hint[hidden],
.amg-variable-price-ready .woocommerce-variation-price,
.amg-variable-stock-ready .woocommerce-variation-availability {
  display: none;
}

.product-type-variable .amg-single-product__summary form.variations_form {
  display: block;
  width: 100%;
  margin: 4px 0 0;
}

.product-type-variable .variations tr {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.product-type-variable .variations th,
.product-type-variable .variations td {
  padding: 0;
  min-width: 0;
}

.product-type-variable .variations td.value {
  flex: 1 1 240px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.product-type-variable .variations select {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.product-type-variable .variations .reset_variations {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
  font-size: 14px;
}

.amg-variable-offer-layout > .amg-single-product__stock {
  margin: 28px 0 0;
}

.amg-variable-offer-layout > .amg-variable-price {
  margin-top: 6px;
}

.product-type-variable .single_variation_wrap {
  width: 100%;
  margin-top: 8px;
}

.product-type-variable .woocommerce-variation-add-to-cart {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 0;
}

/* Stack safely by default; use one purchase row only when it has room. */
.product-type-variable .amg-variable-offer-layout {
  container: amg-variable-offer / inline-size;
}

.amg-variable-purchase {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px 16px;
  min-width: 0;
}

.amg-variable-purchase > .amg-variable-price { margin: 0; }
.amg-variable-purchase > .woocommerce-variation-add-to-cart { min-width: 0; }

@media (min-width: 681px) {
  @container amg-variable-offer (min-width: 560px) {
    .amg-variable-purchase { grid-template-columns: minmax(0, 1fr) auto; }
    .amg-variable-purchase > .woocommerce-variation-add-to-cart { flex-wrap: nowrap; justify-self: end; }
  }
}

.product-type-variable .single_add_to_cart_button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  .product-type-variable .amg-single-product__top,
  .product-type-variable .amg-single-product__details {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* The exact hardware revision must be agreed before quote-only offers sell. */
.variations_form.amg-quote-only .woocommerce-variation-add-to-cart {
  display: none !important;
}

/* Accessible buttons enhance the existing WooCommerce selector. */
.amg-version-options[hidden],
.amg-version-option[hidden],
.amg-versions-ready .variations { display: none; }
.amg-version-options {
  --amg-version-accent: #638c35;
  --amg-version-muted: #606a73;
  --amg-version-unavailable: #b42318;
  margin: 0 0 8px;
}
.amg-version-options__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.amg-version-options__head > strong { color: #202b21; font-size: 15px; line-height: 1.4; }
.amg-version-options .amg-version-options__reset { min-height: 36px; padding: 4px 8px; border: 0; background: transparent; color: #52633e; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.amg-version-options__reset:disabled { opacity: .5; cursor: default; }
.amg-version-options__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.amg-version-options .amg-version-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "name check" "spec spec" "price price" "stock stock";
  align-items: start;
  gap: 9px 8px;
  width: 100%;
  min-width: 0;
  min-height: 194px;
  padding: 16px;
  border: 1px solid #dce3d7;
  border-radius: 16px;
  background: #fff;
  color: #263126;
  font: inherit;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.amg-version-options .amg-version-option:hover { border-color: var(--amg-version-accent); background: #fafcf7; }
.amg-version-options .amg-version-option.is-selected { border-color: var(--amg-version-accent); background: #f5f9ef; box-shadow: inset 0 0 0 1px var(--amg-version-accent); }
.amg-version-option:focus-visible,
.amg-version-options__reset:focus-visible { outline: 3px solid #557e2d; outline-offset: 3px; }
.amg-version-option__name { grid-area: name; font-size: 15px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.amg-version-option__selection { grid-area: check; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid #b8c2ae; border-radius: 50%; color: #fff; }
.amg-version-option__selection svg { display: block; opacity: 0; }
.amg-version-option.is-selected .amg-version-option__selection { border-color: var(--amg-version-accent); background: var(--amg-version-accent); }
.amg-version-option.is-selected .amg-version-option__selection svg { opacity: 1; }
.amg-version-option__spec { grid-area: spec; color: #596556; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.amg-version-option__price { grid-area: price; align-self: end; padding-top: 5px; font-size: 18px; font-weight: 650; line-height: 1.35; }
.amg-version-option__price .woocommerce-price-suffix { display: block; margin-top: 2px; color: #64705f; font-size: 11px; font-weight: 400; line-height: 1.4; }
.amg-version-option__price del { display: block; font-size: 13px; font-weight: 400; }
.amg-version-option__price ins { display: block; text-decoration: none; }
.amg-version-option__stock { grid-area: stock; display: flex; align-items: center; gap: 7px; align-self: end; padding-top: 10px; border-top: 1px solid #e5eadd; color: #32622d; font-size: 12px; font-weight: 650; line-height: 1.4; }
.amg-version-option__stock::before { content: ""; flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.amg-version-option.is-on-backorder .amg-version-option__stock { color: #805a19; }
.amg-version-options .amg-version-option.is-out-of-stock { border-color: #dfe2e5; background: #f1f2f3; color: var(--amg-version-muted); }
.amg-version-options .amg-version-option.is-out-of-stock:hover { border-color: #b0b7be; background: #ebedef; }
.amg-version-options .amg-version-option.is-out-of-stock.is-selected { border-color: #727d87; background: #ebedef; box-shadow: inset 0 0 0 1px #727d87; }
.amg-version-option.is-out-of-stock .amg-version-option__selection { border-color: #b8bec4; }
.amg-version-option.is-out-of-stock.is-selected .amg-version-option__selection { border-color: #727d87; background: #727d87; }
.amg-version-option.is-out-of-stock .amg-version-option__spec,
.amg-version-option.is-out-of-stock .amg-version-option__price .woocommerce-price-suffix { color: var(--amg-version-muted); }
.amg-version-option.is-out-of-stock .amg-version-option__stock { border-color: #dce0e3; color: var(--amg-version-unavailable); }
.amg-version-option.is-out-of-stock .amg-version-option__stock::before { display: none; }
.amg-version-option:disabled { opacity: .6; cursor: not-allowed; }
.amg-single-product__stock.is-pending { color: #596556; font-size: 13px; font-weight: 400; }
/* The enhancement chooses rows from available width and visible offers. */
@media (min-width: 681px) {
  .amg-version-options__grid[data-layout="single"] { grid-template-columns: minmax(0, 1fr); }
  .amg-version-options__grid[data-layout="pairs"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .amg-version-options__grid[data-layout="triples"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .amg-version-options__grid[data-layout="mixed"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .amg-version-options__grid[data-layout="mixed"] > .amg-version-option { grid-column: span 2; }
  .amg-version-options__grid[data-layout="mixed"] > .amg-version-option.is-wide { grid-column: span 3; }
  .amg-version-options__grid[data-layout="pairs"] > .amg-version-option.is-wide { grid-column: 1 / -1; }
  .amg-version-options .amg-version-option.is-compact {
    grid-template-columns: max-content minmax(0, 1fr) 20px;
    grid-template-rows: auto auto auto;
    grid-template-areas: "name name check" "spec spec spec" "price stock stock";
    gap: 7px 8px;
    min-height: 0;
    padding: 14px;
  }
  .amg-version-option.is-compact .amg-version-option__price { padding-top: 0; }
  .amg-version-option.is-compact .amg-version-option__stock {
    align-self: stretch;
    padding: 0 0 0 12px;
    border-top: 0;
    border-inline-start: 1px solid #e5eadd;
  }
  .amg-version-option.is-compact.is-out-of-stock .amg-version-option__stock { border-inline-start-color: #dce0e3; }
}
@media (max-width: 680px) {
  .amg-version-options__grid { grid-template-columns: 1fr; }
  .amg-version-options .amg-version-option {
    grid-template-columns: max-content minmax(0, 1fr) 20px;
    grid-template-rows: auto auto auto;
    grid-template-areas: "name name check" "spec spec spec" "price stock stock";
    gap: 6px 12px;
    min-height: 136px;
    padding: 14px;
  }
  .amg-version-option__selection { justify-self: end; }
  .amg-version-option__price { padding-top: 0; }
  .amg-version-option__stock { align-self: center; padding: 0 0 0 4px; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .amg-version-options .amg-version-option { transition: none; }
}
