.stack-checkout {
  --checkout-ink: #17202c;
  --checkout-muted: #5d6675;
  --checkout-line: #e1e5eb;
  --checkout-blue: #185adb;
  --checkout-soft: #f4f6f9;
  color-scheme: light;
  width: min(1000px, calc(100% - 40px));
  max-width: none;
  max-height: min(900px, calc(100dvh - 48px));
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 24px;
  background: #fff;
  color: var(--checkout-ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: 0 30px 120px rgb(8 16 30 / 24%);
}

.stack-checkout[open] { animation: stack-checkout-enter 220ms cubic-bezier(.22, .7, .3, 1) both; }
.stack-checkout::backdrop { background: rgb(14 21 33 / 42%); backdrop-filter: blur(7px); }
.stack-checkout *, .stack-checkout *::before, .stack-checkout *::after { box-sizing: border-box; }
.stack-checkout :is(button, input, summary) { touch-action: manipulation; }
.stack-checkout :is(button, input, summary):focus-visible { outline: 3px solid #376cf5; outline-offset: 4px; }
.stack-checkout h2:focus, .stack-checkout__error:focus { outline: none; }
.stack-checkout :is(h2, h3, p, ul, dl, dd) { margin: 0; }
.stack-checkout h2 { font-size: clamp(26px, 4vw, 34px); font-weight: 600; letter-spacing: -.05em; line-height: 1.15; }
.stack-checkout h3 { font-size: 21px; font-weight: 600; letter-spacing: -.025em; line-height: 1.3; }
.stack-checkout button { font: inherit; cursor: pointer; }
.stack-checkout input { accent-color: var(--checkout-blue); }
.stack-checkout__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 32px 18px; }
.stack-checkout__mode { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px; color: #20539f; font-size: 12px; font-weight: 600; }
.stack-checkout__mode::before { content: ''; width: 6px; height: 6px; border: 1.5px solid currentColor; border-radius: 50%; }
.stack-checkout__close { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 1px solid var(--checkout-line); border-radius: 50%; background: #fff; color: var(--checkout-ink); transition: background 150ms ease; }
.stack-checkout__close:hover { background: var(--checkout-soft); }
.stack-checkout__notice { margin: 0 32px !important; padding: 12px 16px; border-radius: 10px; background: #eef4ff; color: #315077; font-size: 13px; }
.stack-checkout__steps { display: flex; flex-wrap: wrap; gap: 10px 25px; list-style: none; margin: 0; padding: 24px 32px; border-bottom: 1px solid var(--checkout-line); }
.stack-checkout__steps li { display: flex; align-items: center; gap: 8px; color: var(--checkout-muted); font-size: 13px; }
.stack-checkout__steps li > span { display: grid; place-items: center; width: 23px; height: 23px; border: 1px solid #ced4de; border-radius: 50%; font-size: 11px; }
.stack-checkout__steps [aria-current] { color: var(--checkout-ink); font-weight: 600; }
.stack-checkout__steps [aria-current] > span { border-color: var(--checkout-ink); background: var(--checkout-ink); color: #fff; }
.stack-checkout__body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
.stack-checkout__main { min-width: 0; padding: 30px 32px 32px; }
.stack-checkout__intro { margin-top: 9px !important; max-width: 46ch; color: var(--checkout-muted); font-size: 14px; line-height: 1.6; }
.stack-checkout__customer { display: grid; gap: 3px; margin-top: 25px; padding-bottom: 23px; border-bottom: 1px solid var(--checkout-line); }
.stack-checkout__customer > strong { font-size: 15px; font-weight: 600; }
.stack-checkout__customer > span:last-child { color: var(--checkout-muted); font-size: 14px; }
.stack-checkout__small-label { margin-bottom: 5px; color: var(--checkout-muted); font-size: 12px; }
.stack-checkout__choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; margin: 24px 0 0; padding: 0; border: 0; }
.stack-checkout__choices legend { margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.stack-checkout__choices label { display: flex; align-items: flex-start; gap: 9px; min-width: 0; min-height: 78px; padding: 14px 12px; border: 1px solid #d6dce5; border-radius: 12px; cursor: pointer; transition: border-color 150ms ease, background 150ms ease; }
.stack-checkout__choices label:has(:checked) { border-color: #7399e9; background: #f1f6ff; }
.stack-checkout__choices label:has(:focus-visible) { outline: 3px solid #376cf5; outline-offset: 3px; }
.stack-checkout__choices input { flex-shrink: 0; width: 16px; height: 16px; margin: 3px 0 0; }
.stack-checkout__choices span { display: grid; gap: 4px; min-width: 0; }
.stack-checkout__choices strong { font-size: 14px; font-weight: 600; }
.stack-checkout__choices small { color: var(--checkout-muted); font-size: 12px; line-height: 1.4; }
.stack-checkout__address { display: grid; gap: 5px; margin: 20px 0; font-size: 13px; }
.stack-checkout__address strong { font-weight: 500; }
.stack-checkout__address span, .stack-checkout__address p { color: var(--checkout-muted); }
.stack-checkout__address p { font-size: 12px; }
.stack-checkout__actions { display: grid; gap: 9px; margin-top: 25px; }
.stack-checkout__primary, .stack-checkout__secondary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 48px; padding: 13px 18px; border: 1px solid transparent; border-radius: 12px; text-align: left; font-size: 14px !important; font-weight: 600 !important; line-height: 1.5; transition: background 160ms ease, transform 160ms ease; }
.stack-checkout__primary { background: var(--checkout-blue); color: #fff; }
.stack-checkout__primary:hover { background: #164bb4; }
.stack-checkout__primary:active, .stack-checkout__secondary:active { transform: translateY(1px); }
.stack-checkout__secondary { justify-content: center; border-color: var(--checkout-line); background: #fff; color: var(--checkout-ink); }
.stack-checkout__secondary:hover { background: var(--checkout-soft); }
.stack-checkout__text-button { width: fit-content; min-height: 44px; justify-self: center; padding: 10px 14px; border: 0; background: transparent; color: var(--checkout-muted); font-size: 13px !important; text-decoration: underline; text-underline-offset: 4px; }
.stack-checkout__summary { min-width: 0; padding: 30px 28px 32px; border-left: 1px solid var(--checkout-line); background: #f7f8fa; }
.stack-checkout__summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stack-checkout__summary-heading h3 { font-size: 18px; }
.stack-checkout__summary-heading span { color: var(--checkout-muted); font-size: 12px; white-space: nowrap; }
.stack-checkout__lines { list-style: none; padding: 8px 0 0; }
.stack-checkout__lines > li { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--checkout-line); }
.stack-checkout__lines > li > div { display: grid; gap: 5px; min-width: 0; }
.stack-checkout__lines strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.stack-checkout__lines span { color: var(--checkout-muted); font-size: 12px; }
.stack-checkout__lines b { flex-shrink: 0; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.stack-checkout__bundle-items { display: grid; gap: 3px; padding: 5px 0 0 14px; color: var(--checkout-muted); font-size: 12px; }
.stack-checkout__totals { display: grid; gap: 11px; padding-top: 22px; font-size: 13px; }
.stack-checkout__totals > div, .stack-checkout__charge { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.stack-checkout__totals dt { color: var(--checkout-muted); }
.stack-checkout__totals dd { text-align: right; font-variant-numeric: tabular-nums; }
.stack-checkout__total { margin-top: 6px; padding-top: 18px; border-top: 1px solid var(--checkout-line); }
.stack-checkout__total dt { color: var(--checkout-ink); font-weight: 600; }
.stack-checkout__total dd { font-size: 25px; font-weight: 600; letter-spacing: -.045em; }
.stack-checkout__fine { margin-top: 16px !important; color: var(--checkout-muted); font-size: 12px; line-height: 1.6; }
.stack-checkout__charge { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--checkout-line); font-size: 13px; }
.stack-checkout__charge strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.stack-checkout__card { display: grid; gap: 26px; margin-top: 25px; padding: 22px; border: 1px solid #354153; border-radius: 16px; background: linear-gradient(140deg, #283344, #121b29); color: #fff; box-shadow: 0 12px 20px rgb(16 25 43 / 10%); }
.stack-checkout__card > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 12px; color: #d2d9e6; }
.stack-checkout__card > strong { font-size: clamp(16px, 2.3vw, 22px); font-weight: 400; letter-spacing: .04em; white-space: nowrap; }
.stack-checkout__test-controls { margin-top: 18px; color: var(--checkout-muted); font-size: 13px; }
.stack-checkout__test-controls summary { display: list-item; min-height: 44px; padding-block: 12px; cursor: pointer; }
.stack-checkout__test-controls fieldset { display: grid; gap: 2px; margin: 0; padding: 6px 0 0; border: 0; }
.stack-checkout__test-controls label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.stack-checkout__test-controls input { width: 16px; height: 16px; margin: 0; }
.stack-checkout__error { margin-top: 15px; padding: 14px 16px; border: 1px solid #ebc7c5; border-radius: 10px; background: #fff5f3; color: #8c3028; font-size: 13px; }
.stack-checkout__error strong { font-weight: 600; }
.stack-checkout__error p { margin-top: 5px; }
.stack-checkout__complete-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 21px; border: 1px solid #cbdcfb; border-radius: 50%; background: #edf4ff; color: var(--checkout-blue); animation: stack-checkout-confirm 300ms ease-out both; }
.stack-checkout__confirmation h3 { max-width: 15ch; font-size: clamp(26px, 4vw, 34px); font-weight: 500; line-height: 1.15; letter-spacing: -.04em; }
.stack-checkout__receipt-meta { display: grid; gap: 13px; margin-top: 25px !important; padding-block: 20px; border-block: 1px solid var(--checkout-line); }
.stack-checkout__receipt-meta > div { display: grid; gap: 3px; }
.stack-checkout__receipt-meta dt { color: var(--checkout-muted); font-size: 12px; }
.stack-checkout__receipt-meta dd { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.stack-checkout__empty { display: grid; gap: 18px; padding: 32px; }
.stack-checkout__empty p { color: var(--checkout-muted); }
.stack-checkout__pending-items { display: grid; gap: 16px; padding: 0; list-style: none; }
.stack-checkout__pending-items li { display: grid; gap: 5px; padding: 16px; border: 1px solid var(--checkout-line); border-radius: 12px; overflow-wrap: anywhere; }
.stack-checkout__pending-items strong { font-size: 14px; font-weight: 600; }
.stack-checkout__pending-items span { color: var(--checkout-muted); font-size: 13px; }
.stack-checkout__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes stack-checkout-enter { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes stack-checkout-confirm { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 680px) {
  .stack-checkout { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 18px; }
  .stack-checkout__header { padding: 22px 20px 16px; }
  .stack-checkout__notice { margin-inline: 20px !important; padding: 12px; font-size: 12px; }
  .stack-checkout__steps { gap: 10px 18px; padding: 19px 20px; }
  .stack-checkout__steps li { gap: 6px; font-size: 12px; }
  .stack-checkout__steps li > span { width: 20px; height: 20px; }
  .stack-checkout__body { grid-template-columns: minmax(0, 1fr); }
  .stack-checkout__main { padding: 25px 20px; }
  .stack-checkout__summary { grid-row: auto; padding: 25px 20px; border-top: 1px solid var(--checkout-line); border-left: 0; }
  .stack-checkout__choices { gap: 8px; }
  .stack-checkout__choices label { padding: 13px 10px; }
  .stack-checkout__choices input { width: 15px; height: 15px; }
  .stack-checkout__choices small { font-size: 11px; }
  .stack-checkout__card { gap: 24px; padding: 20px; }
  .stack-checkout__empty { padding: 25px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .stack-checkout, .stack-checkout * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
