.checkout-dialog {
  width: min(870px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 25px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 90px rgb(13 22 49 / 24%);
}

.checkout-dialog::backdrop {
  background: rgb(16 25 45 / 57%);
  backdrop-filter: blur(3px);
}

body:has(.checkout-dialog[open]) { overflow: hidden; }

.checkout-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.checkout-mode {
  margin-bottom: 5px;
  color: #155bbc;
  font-size: 12px;
  font-weight: 690;
}

.checkout-mode span { padding-inline: 3px; }
.checkout-heading h2 { font-size: clamp(25px, 4.1vw, 36px); text-wrap: initial; }
.checkout-heading h2:focus { outline: none; }

.checkout-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--wash);
  color: var(--ink);
  cursor: pointer;
}

.checkout-close span { display: grid; place-items: center; }
.checkout-close span::before, .checkout-close span::after {
  content: "";
  grid-area: 1 / 1;
  width: 16px;
  height: 1.6px;
  border-radius: 5px;
  background: currentColor;
  transform: rotate(45deg);
}
.checkout-close span::after { transform: rotate(-45deg); }

.checkout-form { display: grid; grid-template-columns: 1fr 1fr; }
.checkout-options, .checkout-payment { min-width: 0; padding: 25px 28px 28px; }
.checkout-options { background: #edf3fc; }
.checkout-payment { background: #fff; }
.checkout-form h3 { margin-bottom: 17px; font-size: 18px; }
.checkout-form fieldset { min-width: 0; padding: 0; margin: 20px 0 0; border: 0; }

.checkout-label {
  display: block;
  margin-bottom: 7px;
  padding: 0;
  color: #262d3c;
  font-size: 13px;
  font-weight: 650;
}

.checkout-field {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid #d5dce9;
  border-radius: 11px;
  background: #f7f9fc;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.checkout-options h3 { margin-bottom: 2px; }
.checkout-note { margin-top: 6px; color: var(--muted); font-size: 12px; }
.checkout-periods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.checkout-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.checkout-offer, .checkout-method {
  position: relative;
  min-width: 0;
  border: 1px solid #dbe2ef;
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
}

.checkout-offer {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 90px;
  padding: 11px;
}

.checkout-offer strong { padding-right: 20px; }
.checkout-offer input { position: absolute; top: 12px; right: 10px; }
.checkout-method {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 61px;
  padding: 9px;
  background: #f7f9fc;
}

.checkout-offer strong, .checkout-method strong { font-size: 13px; font-weight: 670; line-height: 1.28; }
.checkout-offer small, .checkout-method small { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }
.checkout-offer-price { margin-top: 5px; font-size: 19px; font-weight: 730; line-height: 1.2; letter-spacing: -.03em; }
.checkout-offer:has(:checked), .checkout-method:has(:checked) {
  border-color: #176ce7;
  box-shadow: inset 0 0 0 1px #176ce7;
}
.checkout-method:has(:checked) { background: #f0f6ff; }

.checkout-form input[type="radio"], .checkout-agreement input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue);
}

.checkout-agreement {
  display: flex;
  align-items: start;
  gap: 9px;
  margin-top: 18px;
  color: #424959;
  font-size: 12px;
  cursor: pointer;
}
.checkout-agreement input { margin-top: 2px; }
.checkout-agreement a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }

.checkout-total {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #424959;
  font-size: 13px;
}
.checkout-total small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.checkout-total output { flex: none; color: var(--ink); font-size: 22px; font-weight: 740; line-height: 1.2; white-space: nowrap; }
.checkout-submit { width: 100%; margin-top: 12px; min-height: 48px; cursor: pointer; }
.checkout-feedback { margin-top: 8px; color: #a23418; font-size: 13px; }

@media (hover: hover) {
  .checkout-close:hover { background: #e7edf8; }
  .checkout-offer:hover, .checkout-method:hover { border-color: #176ce7; }
}

@media (max-width: 650px) {
  .checkout-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 18px; }
  .checkout-heading { position: sticky; z-index: 1; top: 0; padding: 13px 15px; }
  .checkout-form { grid-template-columns: minmax(0, 1fr); }
  .checkout-options, .checkout-payment { padding: 17px 15px; }
  .checkout-form h3 { margin-bottom: 12px; }
  .checkout-options h3 { margin-bottom: 2px; }
  .checkout-form fieldset { margin-top: 15px; }
  .checkout-offer { min-height: 77px; padding: 9px; }
  .checkout-offer input { top: 10px; right: 9px; }
  .checkout-offer-price { font-size: 17px; }
}
