body.checkout-open {
  overflow: hidden;
}

.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  padding: 0.5rem 1rem;
  place-items: center;
  background: rgba(32, 29, 27, 0.46);
  overflow: hidden;
}

/* El cuadro no se desplaza entero: solo el cuerpo. Así el pie con la acción
   principal queda anclado y el botón nunca se pierde bajo el desplazamiento. */
.checkout-dialog {
  position: relative;
  display: grid;
  width: min(42rem, 100%);
  max-height: calc(100vh - 1rem);
  min-height: 0;
  overflow: hidden;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fffaf6;
  box-shadow: 0 2rem 4rem rgba(32, 29, 27, 0.18);
}

.checkout-body {
  min-height: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--wine) 42%, transparent) transparent;
  font-family: var(--legible);
  font-size: 1rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1.45;
}

/* La barra de desplazamiento como un filete de la marca, no como el control
   gris del sistema. */
.checkout-body::-webkit-scrollbar {
  width: 0.6rem;
}

.checkout-body::-webkit-scrollbar-track {
  margin-block: 0.9rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--gold) 18%, transparent);
}

.checkout-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--wine) 45%, transparent);
  background-clip: content-box;
}

.checkout-body::-webkit-scrollbar-thumb:hover {
  background: var(--wine);
  background-clip: content-box;
}

.checkout-footer {
  display: grid;
  padding: 0.9rem clamp(1.5rem, 4vw, 2.4rem) clamp(1.1rem, 3vw, 1.5rem);
  gap: 0.55rem;
  border-top: 1px solid var(--line);
  background: #fffaf6;
  box-shadow: 0 -0.75rem 1.5rem rgba(255, 250, 246, 0.95);
}

.checkout-footer[hidden] {
  display: none;
}

.checkout-footer .button {
  width: 100%;
  min-height: 3.4rem;
  font-size: 1rem;
}

.checkout-footer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.checkout-close {
  position: absolute;
  z-index: 5;
  top: 0.85rem;
  right: 0.85rem;
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: rgba(255, 250, 246, 0.96);
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0.35rem 0.9rem rgba(32, 29, 27, 0.12);
  touch-action: manipulation;
}

.checkout-close:hover,
.checkout-close:focus-visible {
  background: #fff;
  color: var(--wine-dark);
}

.checkout-close:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

.checkout-body h2 {
  margin: 0.45rem 0 0;
  font-family: var(--script);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.checkout-heading > p:last-child {
  max-width: 35rem;
  margin-bottom: 0;
}

.checkout-step-choice .checkout-heading > p:last-child {
  line-height: 1.4;
}

/* Paso de elección: resumen y métodos comparten margen y respiro para que se
   lean como dos fichas de la misma familia, no como dos cajas sueltas. */
.checkout-step-choice .checkout-summary {
  margin-top: 1.15rem;
}

.checkout-step-choice .checkout-payment-methods {
  margin-top: 0.85rem;
}

.checkout-step-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.checkout-step-heading > div {
  min-width: 0;
}

.checkout-step-heading p:last-child {
  max-width: 35rem;
  margin-bottom: 0;
}

.checkout-step-details .checkout-step-heading h2 {
  font-size: clamp(1.85rem, 3.5vw, 2.15rem);
}

.checkout-step-details .checkout-step-heading p:last-child {
  line-height: 1.3;
}

.checkout-step-details .checkout-selected-method {
  margin-top: 0.7rem;
  padding-block: 0.5rem;
}

.checkout-step-details .checkout-test {
  margin: 0.45rem 0 0;
  line-height: 1.3;
}

.checkout-step-details .checkout-form {
  margin-top: 0.65rem;
}

.checkout-step-details .checkout-registration,
.checkout-step-details .checkout-account {
  padding: 0.65rem 0.75rem;
}

.checkout-step-details .checkout-form label {
  margin-top: 0.35rem;
  font-size: 0.93rem;
}

.checkout-step-details .checkout-form input {
  min-height: 2.35rem;
  padding-block: 0.45rem;
}

.checkout-step-details .checkout-account p {
  margin-bottom: 0.3rem;
  font-size: 0.88rem;
}

.checkout-step-details .checkout-hint {
  margin-top: 0.3rem;
  font-size: 0.82rem;
}

.checkout-back {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--wine);
  cursor: pointer;
  font-family: var(--legible);
  font-size: 0.9rem;
  font-style: normal;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.checkout-back:hover,
.checkout-back:focus-visible {
  color: var(--wine-dark);
}

.checkout-selected-method {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(185, 147, 86, 0.4);
  border-radius: 0.65rem;
  background: #fff;
}

.checkout-selected-method span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-selected-method strong {
  color: var(--wine-dark);
  font-family: var(--legible);
  font-size: 1.05rem;
  font-style: normal;
}

.checkout-body p,
.checkout-points,
.checkout-steps,
.checkout-note {
  color: var(--muted);
  line-height: 1.5;
}

.checkout-points,
.checkout-steps {
  margin: 1rem 0 0;
  padding-left: 1.15rem;
}

.checkout-price,
.checkout-code,
.checkout-facts {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(185, 147, 86, 0.4);
  border-radius: 0.75rem;
  background: #fff;
}

.checkout-summary {
  display: grid;
  margin-top: 1.35rem;
  padding: 1rem 1.1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border: 1px solid rgba(185, 147, 86, 0.4);
  border-radius: 0.75rem;
  background: #fff;
}

.checkout-summary > div {
  display: grid;
  gap: 0.25rem;
}

.checkout-summary > div > span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-summary > div > strong {
  color: var(--wine-dark);
  font-size: 1rem;
}

/* En el resumen el total no es una línea más: la etiqueta va arriba en
   versalitas y la cifra debajo, alineada al canto derecho de la ficha. */
.checkout-summary .checkout-price {
  display: grid;
  margin: 0;
  padding: 0 0 0 1.1rem;
  gap: 0.2rem;
  justify-items: end;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  text-align: right;
}

.checkout-summary .checkout-price span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-summary .checkout-price strong {
  color: var(--wine-dark);
  font-size: 1.5rem;
  line-height: 1.05;
}

.checkout-price,
.checkout-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.checkout-price strong,
.checkout-code strong,
.checkout-facts dd {
  color: var(--wine-dark);
  font-size: 1.08rem;
}

/* Datos que el cliente copia tal cual (número SINPE, monto, código, enlace,
   número de pedido) se quedan en la serif: la cursiva confunde dígitos. */
.checkout-price strong,
.checkout-code strong,
.checkout-facts dd,
.checkout-summary > div > strong,
.checkout-known strong,
.checkout-body > .eyebrow {
  font-family: var(--legible);
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.checkout-facts {
  display: grid;
  gap: 0.55rem;
}

.checkout-facts div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.checkout-facts dt {
  color: var(--muted);
  font-size: 0.92rem;
}

.checkout-facts dd {
  margin: 0;
  font-weight: 700;
}

.checkout-form {
  display: grid;
  margin-top: 0.95rem;
  gap: 0.35rem;
}

@media (min-width: 48rem) {
  .checkout-form {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.85fr);
    align-items: start;
    column-gap: 0.7rem;
  }

  .checkout-form > .checkout-registration,
  .checkout-form > .checkout-account {
    margin-top: 0;
  }
}

.checkout-registration,
.checkout-account {
  min-width: 0;
  margin: 0;
  padding: 0.8rem 0.9rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.62);
}

.checkout-payment-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.25rem 0 0;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.62);
}

.checkout-payment-methods legend {
  grid-column: 1 / -1;
  padding: 0 0.45rem;
  color: var(--wine);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Cada método es una ficha con la misma retícula: sello a la izquierda,
   nombre y marca de selección en la primera línea, y debajo el detalle. Así
   las dos opciones ocupan lo mismo aunque el texto de una sea más largo. */
.checkout-payment-method {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr) 1.2rem;
  grid-template-areas:
    'icon title mark'
    'icon description description'
    'icon note note';
  align-content: center;
  gap: 0.12rem 0.75rem;
  margin: 0;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(185, 147, 86, 0.3);
  border-radius: 0.7rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.checkout-payment-method:hover {
  border-color: rgba(185, 147, 86, 0.65);
}

.checkout-payment-method:has(input:checked) {
  border-color: var(--wine);
  background: #fffdfb;
  box-shadow: 0 0 0 2px rgba(126, 32, 45, 0.1);
}

.checkout-payment-method:has(input:focus-visible) {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}

/* La marca redonda sustituye al botón de radio del sistema: mismo gesto,
   pero con el trazo de la casa. */
.checkout-method-mark {
  display: grid;
  width: 1.2rem;
  height: 1.2rem;
  grid-area: mark;
  place-items: center;
  align-self: center;
  border: 1px solid rgba(185, 147, 86, 0.7);
  border-radius: 50%;
  background: #fff;
}

.checkout-method-mark::after {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: transparent;
  content: '';
}

.checkout-payment-method:has(input:checked) .checkout-method-mark {
  border-color: var(--wine);
}

.checkout-payment-method:has(input:checked) .checkout-method-mark::after {
  background: var(--wine);
}

.checkout-method-icon {
  display: grid;
  width: 2.9rem;
  height: 2.9rem;
  grid-area: icon;
  place-items: center;
  align-self: center;
  border: 1px solid currentColor;
  border-radius: 0.8rem;
}

.checkout-method-icon svg {
  width: 1.95rem;
  height: 1.95rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.checkout-payment-method.is-card .checkout-method-icon {
  color: #233c82;
  background: rgba(35, 60, 130, 0.06);
}

.checkout-payment-method.is-sinpe .checkout-method-icon {
  color: #3c6e43;
  background: rgba(60, 110, 67, 0.06);
}

.checkout-method-title {
  grid-area: title;
  align-self: center;
  color: var(--wine-dark);
  font-family: var(--legible);
  font-size: 1.05rem;
  font-style: normal;
  font-weight: 700;
}

.checkout-method-description {
  grid-area: description;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

/* La línea de confianza va debajo, en tono dorado y en minúscula: acompaña
   al método sin pelear con su nombre. */
.checkout-method-note {
  grid-area: note;
  margin-top: 0.25rem;
  color: #8a6a2f;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
}

.onvo-card-container {
  min-height: 18rem;
  margin-top: 1.25rem;
  padding: 0.2rem;
  border: 1px solid rgba(185, 147, 86, 0.35);
  border-radius: 0.75rem;
  background: #fff;
}

.checkout-registration legend,
.checkout-account legend {
  padding: 0 0.45rem;
  color: var(--wine);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.checkout-section-intro {
  margin: 0.05rem 0 0.55rem;
  font-size: 0.94rem;
}

.checkout-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 0.8rem;
}

.checkout-field {
  display: grid;
  min-width: 0;
  gap: 0.45rem;
}

.checkout-field label {
  margin-top: 0.55rem;
}

.checkout-form label,
.account-form label {
  margin-top: 0.55rem;
  font-size: 0.98rem;
  font-weight: 700;
}

.checkout-form label span,
.account-form label span {
  color: var(--muted);
  font-weight: 500;
}

.checkout-form input,
.checkout-form select,
.account-form input,
.account-form select {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: #fff;
  color: var(--ink);
}

.checkout-account {
  margin-top: 0.7rem;
  border: 1px dashed rgba(185, 147, 86, 0.55);
  background: #fffaf6;
}

.checkout-account p {
  margin: 0 0 0.45rem;
  font-size: 0.94rem;
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 0.9rem;
  gap: 0.55rem;
}

.checkout-actions .button {
  min-height: 2.9rem;
  font-size: 0.94rem;
}

.checkout-error,
.account-error {
  color: #a33f3f;
  font-size: 1.01rem;
}

/* Paso de tarjeta: el estado del formulario y el aviso de error acompañan al
   botón en el pie, centrados bajo él y sin empujar la acción fuera de vista. */
.checkout-footer .checkout-status {
  justify-self: center;
  margin: 0;
}

.checkout-footer .checkout-error {
  margin: 0;
  font-size: 0.92rem;
  text-align: center;
}

.checkout-footer .checkout-error[hidden] {
  display: none;
}

.checkout-status {
  display: inline-flex;
  margin: 0.7rem 0 0;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--blush);
  color: var(--wine-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.checkout-test,
.checkout-note,
.checkout-contact {
  font-size: 0.9rem;
}

/* Aviso del modo de prueba dentro del formulario de tarjeta: tiene que
   distinguirse del texto normal para que nadie confunda un cobro simulado
   con uno real. */
.onvo-test-notice {
  margin: 0.6rem 0 0;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--gold);
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 600;
}

.checkout-contact {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid var(--gold);
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.62);
}

.checkout-contact strong {
  color: var(--wine-dark);
}

.checkout-contact a {
  color: var(--wine);
  font-weight: 700;
}

.checkout-note a {
  color: var(--wine);
}

@media (max-width: 34rem) {
  .checkout-modal {
    padding: max(0.5rem, env(safe-area-inset-top))
      max(0.65rem, env(safe-area-inset-right))
      max(0.5rem, env(safe-area-inset-bottom))
      max(0.65rem, env(safe-area-inset-left));
    place-items: stretch;
  }

  .checkout-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0.85rem;
  }

  .checkout-body {
    padding-top: 3.7rem;
    -webkit-overflow-scrolling: touch;
  }

  .checkout-close {
    top: 0.65rem;
    right: 0.65rem;
    width: 2.75rem;
    height: 2.75rem;
    background: rgba(255, 250, 246, 0.98);
    font-size: 1.75rem;
  }

  .checkout-payment-methods {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    grid-template-columns: 1fr;
  }

  .checkout-summary .checkout-price {
    padding: 0.75rem 0 0;
    justify-items: start;
    border-top: 1px solid var(--line);
    border-left: 0;
    text-align: left;
  }

  .checkout-form-grid {
    grid-template-columns: 1fr;
  }

  .checkout-step-heading {
    display: block;
  }

  .checkout-back {
    display: inline-block;
    margin-top: 0.8rem;
  }

  .checkout-selected-method {
    align-items: start;
    flex-direction: column;
    gap: 0.2rem;
  }
}

.checkout-hint {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

/* Aviso de cuenta: mismo formato que el de contacto, pero con el filete en
   vino, para que se lea como el camino de vuelta a lo que compró. */
.checkout-account-note {
  border-left-color: var(--wine);
}

.checkout-account a,
.checkout-hint a {
  color: var(--wine);
  font-weight: 700;
}

/* Cliente con sesión: los datos se confirman de un vistazo en vez de volver
   a escribirse. */
.checkout-registration.is-known {
  border-color: rgba(185, 147, 86, 0.5);
  background: rgba(255, 253, 249, 0.85);
}

.checkout-known {
  display: grid;
  margin: 0.35rem 0 0;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.7rem 1.1rem;
}

.checkout-known > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.checkout-known span {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.checkout-known strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1.09rem;
  font-weight: 600;
}

.checkout-edit-data {
  justify-self: start;
  margin-top: 0.9rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--wine);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.checkout-edit-data:hover,
.checkout-edit-data:focus-visible {
  color: var(--wine-dark);
}
