.bundle-save {
  width: 100%;
  max-width: 100%;
  color: #111;
  box-sizing: border-box;
  overflow-x: clip;
}

.bundle-save.is-panel-open {
  overflow: visible;
}

.bundle-save *,
.bundle-save *::before,
.bundle-save *::after {
  box-sizing: border-box;
}

.bundle-save__heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  width: 100%;
}

.bundle-save__heading-line {
  flex: 1 1 auto;
  height: 1px;
  background: #111;
  min-width: 12px;
}

.bundle-save__heading-text {
  flex: 0 0 auto;
  max-width: 70%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-align: center;
}

.bundle-save__tiers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.bundle-save__tier {
  position: relative;
  border: 1px solid #ddd;
  background: #fff;
  overflow: visible;
  width: 100%;
}

.bundle-save__tier.is-selected,
.bundle-save:not(:has(.bundle-save__tier.is-selected)) .bundle-save__tier:first-child {
  border-color: #111;
}

.bundle-save__ribbon {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-block;
  padding: 4px 8px;
  background: #111;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateY(-45%) rotate(6deg);
  transform-origin: 100% 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.bundle-save__ribbon[hidden] {
  display: none !important;
}

.bundle-save__tier-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.bundle-save__radio {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  border: 1.5px solid #111;
  border-radius: 50%;
  position: relative;
}

.bundle-save__tier.is-selected .bundle-save__radio::after,
.bundle-save:not(:has(.bundle-save__tier.is-selected))
  .bundle-save__tier:first-child
  .bundle-save__radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #111;
}

.bundle-save__tier-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.bundle-save__tier-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bundle-save__tier-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.bundle-save__tier-support {
  font-size: 12px;
  line-height: 1.3;
  color: #666;
}

.bundle-save__price-col {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 4.5em;
}

.bundle-save__price-now {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: #111;
}

.bundle-save__price-was {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  color: #999;
  text-decoration: line-through;
}

.bundle-save__price-was[hidden],
.bundle-save__price-save[hidden] {
  display: none;
}

.bundle-save__price-save {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  color: #111;
}

.bundle-save__tier-body {
  padding: 0 12px 10px 40px;
}

.bundle-save__tier-body[hidden] {
  display: none;
}

.bundle-save__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bundle-save__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.bundle-save__row.is-invalid .bundle-save__row-label {
  color: #c44;
}

.bundle-save__row-label {
  flex: 0 0 auto;
  min-width: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #111;
  line-height: 32px;
}

.bundle-save__row-options {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bundle-save__option {
  flex: 1 1 88px;
  min-width: 0;
  max-width: 100%;
}

.bundle-save__select {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 32px;
  padding: 3px 16px 3px 6px;
  border: 1px solid #ccc;
  border-radius: 0;
  background: #fff;
}

.bundle-save__select::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 50%;
  margin-top: -2px;
  border: 4px solid transparent;
  border-top-color: #111;
  pointer-events: none;
}

.bundle-save__select-thumb {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 2px;
  background: #eee;
}

.bundle-save__select-thumb[hidden] {
  display: none;
}

.bundle-save__select-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  line-height: 1.3;
  color: #111;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bundle-save__select-trigger:focus,
.bundle-save__select-trigger:focus-visible {
  outline: none;
}

.bundle-save__select:has(.bundle-save__select-trigger:focus-visible) {
  border-color: #888;
}

.bundle-save__select-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-save__select select {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
  opacity: 0;
}

.bundle-save__panel {
  position: fixed;
  inset: 0;
  z-index: 80;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.bundle-save__panel[hidden] {
  display: none;
}

.bundle-save__panel-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.bundle-save__panel-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 100%;
  max-height: 78vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 16px 24px;
  background: #fff;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
}

.bundle-save__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.bundle-save__panel-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.bundle-save__panel-x {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #111;
  cursor: pointer;
}

.bundle-save__panel-grid--image {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 8px;
}

.bundle-save__panel-grid--text {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bundle-save__choice {
  position: relative;
  margin: 0;
  border: 0;
  background: transparent;
  color: #111;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bundle-save__choice:focus,
.bundle-save__choice:focus-visible {
  outline: none;
}

.bundle-save__choice:disabled {
  cursor: not-allowed;
}

.bundle-save__choice:disabled::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  width: 72%;
  height: 1px;
  background-color: rgba(17, 17, 17, 0.2);
  transform: translate(-50%, -50%) rotate(-45deg);
  pointer-events: none;
}

.bundle-save__choice--image {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 0;
  text-align: center;
}

.bundle-save__choice-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f3f3f3;
  box-shadow: inset 0 0 0 1px #ddd;
}

.bundle-save__choice--image.is-selected .bundle-save__choice-image {
  box-shadow: inset 0 0 0 2px #111;
}

.bundle-save__choice--image:focus-visible .bundle-save__choice-image {
  box-shadow: inset 0 0 0 2px #888;
}

.bundle-save__choice--image.is-selected:focus-visible .bundle-save__choice-image {
  box-shadow: inset 0 0 0 2px #111;
}

.bundle-save__choice-label {
  display: block;
  width: 100%;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-save__choice--image:disabled .bundle-save__choice-image {
  opacity: 0.4;
}

.bundle-save__choice--image:disabled .bundle-save__choice-label {
  color: rgba(17, 17, 17, 0.35);
}

.bundle-save__choice--text {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 8px 20px;
  background: #fff;
  font-size: 13px;
  line-height: 1.3;
  box-shadow: 0 0 0 1px #ccc;
}

.bundle-save__choice--text.is-selected {
  box-shadow: 0 0 0 2px #111;
}

.bundle-save__choice--text:focus-visible {
  box-shadow: 0 0 0 2px #888;
}

.bundle-save__choice--text.is-selected:focus-visible {
  box-shadow: 0 0 0 2px #111;
}

.bundle-save__choice--text:disabled {
  color: rgba(17, 17, 17, 0.2);
}

@media (max-width: 430px) {
  .bundle-save__panel-sheet {
    padding: 14px 12px 22px;
  }

  .bundle-save__panel-grid--image {
    gap: 10px 6px;
  }

  .bundle-save__choice--text {
    padding: 8px 16px;
  }
}

.bundle-save__row-note {
  flex: 0 0 100%;
  margin: 0;
  font-size: 11px;
  line-height: 1.3;
  color: #c44;
}

.bundle-save__row-note[hidden] {
  display: none;
}

.bundle-save__empty {
  font-size: 12px;
  color: #666;
}

.bundle-save__actions {
  margin-top: 12px;
  width: 100%;
}

.bundle-save__add {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  background: #111;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bundle-save__add:disabled {
  cursor: not-allowed;
}

.bundle-save__add.is-loading {
  color: transparent;
}

.bundle-save__add-spinner {
  display: none;
  position: absolute;
  width: 20px;
  height: 20px;
  color: #fff;
  animation: bundle-save-spin 0.8s linear infinite;
}

.bundle-save__add.is-loading .bundle-save__add-spinner {
  display: block;
}

.bundle-save__add-error {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.3;
  color: #c44;
}

.bundle-save__add-error[hidden] {
  display: none;
}

@keyframes bundle-save-spin {
  to {
    transform: rotate(360deg);
  }
}

/*
  Phase 5: hide native purchase controls only after THIS PDP Bundle is ready.
  Native DOM stays in place. No class → native stays visible (fallback).
  Scoped to theme-product-detail.bundle-ready so Featured Product / cards / other PDPs are untouched.
*/
theme-product-detail.bundle-ready .product-detail__variant-picker,
theme-product-detail.bundle-ready .product-detail__quantity-selector,
theme-product-detail.bundle-ready .product-detail__volume-pricing,
theme-product-detail.bundle-ready .product-detail__buy-buttons,
theme-product-detail.bundle-ready theme-sticky-position:has(.product-detail__buy-buttons) {
  display: none !important;
}

/* Unexpected Bundle JS failure: hide broken enhance layer; native purchase is restored. */
.bundle-save.is-failed {
  display: none !important;
}

/*
  Mobile sticky Add to cart — second entry only; forwards to [data-bundle-add].
  Full-bleed bar (no card padding). Hidden on desktop, panel open, and fail-safe.
*/
.bundle-save__sticky {
  display: none;
}

@media (max-width: 959px) {
  .bundle-save.bundle-ready:not(.is-failed) .bundle-save__sticky.is-visible {
    display: block;
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: var(--z-index-sticky, 1000);
    width: 100%;
    margin: 0;
    padding: 0;
    background: #111;
  }

  .bundle-save.is-panel-open .bundle-save__sticky,
  .bundle-save__sticky[hidden] {
    display: none !important;
  }

  .bundle-save__sticky-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    padding-block-end: calc(12px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bundle-save__sticky-trigger:disabled {
    cursor: not-allowed;
  }

  .bundle-save__sticky-trigger.is-loading {
    color: transparent;
  }

  .bundle-save__sticky-spinner {
    display: none;
    position: absolute;
    width: 20px;
    height: 20px;
    color: #fff;
    animation: bundle-save-spin 0.8s linear infinite;
  }

  .bundle-save__sticky-trigger.is-loading .bundle-save__sticky-spinner {
    display: block;
  }
}

@media (max-width: 430px) {
  .bundle-save__tier-body {
    padding-left: 12px;
  }

  .bundle-save__ribbon {
    right: 0;
    font-size: 9px;
    padding: 3px 7px;
  }
}
