.fpbt-wrap {
  --fpbt-ink: #17211d;
  --fpbt-muted: #52605a;
  --fpbt-line: #dde5e1;
  --fpbt-surface: #f5f8f6;
  --fpbt-accent: var(--gsmp-accent, #163c9f);
  --fpbt-accent-dark: var(--gsmt-accent-dark, #0f2d7a);
  box-sizing: border-box;
  container-type: inline-size;
  width: 100%;
  margin: 1.5rem 0;
  overflow: hidden;
  border: 1px solid var(--fpbt-line);
  border-radius: 14px;
  background: #fff;
  color: var(--fpbt-ink);
  box-shadow: 0 10px 28px rgba(23, 33, 29, 0.08);
}

.woocommerce div.product > .fpbt-wrap {
  width: min(calc(100% - 40px), 1400px);
  margin: 2rem auto;
}

.fpbt-wrap *,
.fpbt-wrap *::before,
.fpbt-wrap *::after { box-sizing: border-box; }

.fpbt-heading-row,
.fpbt-summary,
.fpbt-item,
.fpbt-meta { display: flex; align-items: center; }

.fpbt-heading-row {
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--fpbt-line);
  background: var(--fpbt-surface);
}

.fpbt-heading-copy { min-width: 0; }
.fpbt-heading-row > h2,
.fpbt-heading-copy h2 {
  margin: 0;
  color: var(--fpbt-ink);
  font-size: clamp(1.05rem, 3.5cqi, 1.35rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.fpbt-heading-copy p {
  margin: 0.3rem 0 0;
  max-width: 60ch;
  color: var(--fpbt-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.fpbt-count {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--fpbt-line);
  border-radius: 999px;
  background: #fff;
  color: var(--fpbt-muted);
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
}

.fpbt-list { padding: 0 1.125rem; }
.fpbt-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px 72px minmax(0, 1fr);
  grid-template-areas:
    "choice thumb copy"
    ". thumb meta";
  gap: 0.65rem 0.9rem;
  min-height: 108px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--fpbt-line);
  transition: background-color 160ms ease-out;
}

.fpbt-item:last-child { border-bottom: 0; }
.fpbt-item.is-selected { background: color-mix(in srgb, var(--fpbt-accent) 7%, white); }

.fpbt-choice {
  grid-area: choice;
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 44px;
  align-self: center;
  cursor: pointer;
}

.fpbt-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.fpbt-checkmark {
  position: relative;
  width: 22px;
  height: 22px;
  border: 2px solid #78857f;
  border-radius: 6px;
  background: #fff;
  transition: border-color 140ms ease-out, background-color 140ms ease-out;
}

input[type="radio"] + .fpbt-checkmark { border-radius: 50%; }
.fpbt-choice input:checked + .fpbt-checkmark { border-color: var(--fpbt-accent); background: var(--fpbt-accent); }
.fpbt-choice input:checked + .fpbt-checkmark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="radio"]:checked + .fpbt-checkmark::after {
  left: 5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: none;
}

.fpbt-choice input:focus-visible + .fpbt-checkmark { outline: 3px solid color-mix(in srgb, var(--fpbt-accent) 25%, transparent); outline-offset: 3px; }
.fpbt-choice input:disabled + .fpbt-checkmark { border-color: #aeb8b3; background: #e8ecea; cursor: not-allowed; }

.fpbt-thumb { grid-area: thumb; align-self: start; }
.fpbt-thumb img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--fpbt-surface);
}

.fpbt-copy { grid-area: copy; min-width: 0; }
.fpbt-copy h3 { margin: 0; font-size: 0.98rem; line-height: 1.35; }
.fpbt-copy h3 a { color: inherit; text-decoration: none; }
.fpbt-copy h3 a:hover { color: var(--fpbt-accent); text-decoration: underline; text-underline-offset: 3px; }
.fpbt-description { margin-top: 0.35rem; max-width: 65ch; color: var(--fpbt-muted); font-size: 0.86rem; line-height: 1.5; }

.fpbt-meta {
  grid-area: meta;
  min-width: 0;
  justify-content: space-between;
  gap: 0.75rem;
}

.fpbt-price { color: var(--fpbt-ink); font-size: 0.95rem; font-weight: 700; white-space: nowrap; }
.fpbt-qty-label,
.fpbt-variation-label { display: flex; color: var(--fpbt-muted); font-size: 0.8rem; }
.fpbt-qty-label { align-items: center; gap: 0.5rem; }
.fpbt-qty { width: 64px !important; min-height: 42px; }
.fpbt-variation-label { align-items: flex-start; flex-direction: column; gap: 0.35rem; margin-top: 0.65rem; }
.fpbt-variation {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  border-color: #cbd5d0;
  border-radius: 8px;
  background-color: #fff;
  color: var(--fpbt-ink);
  font-size: 0.88rem;
}

.fpbt-variation:focus-visible,
.fpbt-qty:focus-visible { outline: 3px solid color-mix(in srgb, var(--fpbt-accent) 22%, transparent); outline-offset: 2px; }

.fpbt-summary {
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.125rem;
  border-top: 1px solid var(--fpbt-line);
  background: var(--fpbt-surface);
}

.fpbt-summary-label { color: var(--fpbt-muted); font-size: 0.86rem; }
.fpbt-selected-total { color: var(--fpbt-accent-dark); font-size: 1.05rem; }
.fpbt-after { padding: 0.85rem 1.125rem; border-top: 1px solid var(--fpbt-line); color: var(--fpbt-muted); }
.fpbt-item.is-unavailable { opacity: 0.58; }

@container (min-width: 760px) {
  .fpbt-item {
    grid-template-columns: 40px 72px minmax(240px, 1fr) auto;
    grid-template-areas: "choice thumb copy meta";
    align-items: center;
  }
  .fpbt-meta { justify-content: flex-end; }
  .fpbt-variation { max-width: 420px; }
}

@container (max-width: 460px) {
  .fpbt-heading-row { align-items: flex-start; flex-direction: column; gap: 0.65rem; }
  .fpbt-count { white-space: normal; }
  .fpbt-list { padding-inline: 0.9rem; }
  .fpbt-item {
    grid-template-columns: 36px 62px minmax(0, 1fr);
    gap: 0.6rem 0.75rem;
  }
  .fpbt-thumb img { width: 62px; height: 62px; }
  .fpbt-meta { grid-column: 2 / -1; }
}

@media (max-width: 640px) {
  .woocommerce div.product > .fpbt-wrap { width: calc(100% - 24px); margin: 1.25rem auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fpbt-item,
  .fpbt-checkmark { transition: none; }
}
