.checkout-modal {
  width: min(620px, calc(100vw - 28px));
  max-width: none;
  max-height: min(760px, calc(100dvh - 28px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: #0b1420;
  color: #f3f7fa;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.checkout-modal::backdrop {
  background: rgba(2, 8, 17, 0.82);
}

body.checkout-modal-open {
  overflow: hidden;
}

.checkout-modal-shell {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.checkout-modal-head,
.checkout-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
}

.checkout-modal-head {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.checkout-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.checkout-modal-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  background: transparent;
  color: inherit;
}

.checkout-modal-body {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 22px;
}

.checkout-modal-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.checkout-modal-options button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 6px;
  background: #213a4e;
  color: #f3f7fa;
  font-weight: 700;
}

.checkout-modal-options button[aria-pressed="true"] {
  border-color: #32d296;
  background: #126d55;
  color: #fff;
}

.checkout-modal button:focus-visible,
.checkout-modal a:focus-visible {
  outline: 2px solid #32d296;
  outline-offset: 2px;
}

.checkout-modal-options .material-symbols-rounded {
  font-size: 22px;
  flex: 0 0 auto;
}

.checkout-modal-view[hidden],
.checkout-modal-options[hidden],
.checkout-modal-success[hidden],
.checkout-modal-feedback[hidden],
.checkout-modal-empty[hidden] {
  display: none;
}

.checkout-modal-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  padding: 20px 0;
  text-align: center;
}

.checkout-modal-success-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(134, 239, 172, 0.42);
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  animation: checkoutModalMark 0.45s cubic-bezier(0.2, 0.9, 0.2, 1.2) both;
}

.checkout-modal-success-mark .material-symbols-rounded {
  font-size: 30px;
  animation: checkoutModalCheck 0.35s 0.16s ease-out both;
}

.checkout-modal-success h3 {
  margin: 10px 0 0;
  font-size: 22px;
}

.checkout-modal-success p {
  max-width: 100%;
  margin: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.checkout-modal-success button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: min(100%, 300px);
  min-height: 44px;
  margin-top: 16px;
}

@keyframes checkoutModalMark {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes checkoutModalCheck {
  from { opacity: 0; transform: scale(0.45); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .checkout-modal-success-mark,
  .checkout-modal-success-mark .material-symbols-rounded {
    animation: none;
  }
}

.checkout-modal-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 6px;
  background: #08111c;
}

.checkout-modal-search-field:focus-within {
  border-color: #32d296;
}

.checkout-modal-search-field input {
  width: 100%;
  min-height: 44px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

.checkout-modal-results {
  display: grid;
  margin-top: 10px;
}

.checkout-modal-result {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.checkout-modal-result img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
}

.checkout-modal-result-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.checkout-modal-result-info strong {
  overflow-wrap: anywhere;
}

.checkout-modal-result-info small,
.checkout-modal-feedback,
.checkout-modal-empty,
.checkout-modal-cart-count {
  color: #b2c0cc;
}

.checkout-modal-result button {
  min-width: 68px;
}

.checkout-modal-custom-form {
  display: grid;
  gap: 14px;
}

.checkout-modal-custom-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
}

.checkout-modal-custom-form label {
  display: grid;
  gap: 6px;
}

.checkout-modal-custom-form input,
.checkout-modal-custom-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 6px;
  background: #08111c;
  color: inherit;
}

.checkout-modal-custom-form textarea {
  resize: vertical;
}

.checkout-modal-custom-form button {
  justify-self: start;
}

.checkout-modal-feedback {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 0.88rem;
}

.checkout-modal-feedback.is-error {
  color: #fda4af;
}

.checkout-modal-feedback.is-success {
  color: #86efac;
}

.checkout-modal-foot {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.checkout-modal-foot .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

@media (max-width: 520px) {
  .checkout-modal-head,
  .checkout-modal-foot {
    padding: 14px;
  }

  .checkout-modal-body {
    padding: 14px;
  }

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

  .checkout-modal-options button {
    justify-content: flex-start;
  }

  .checkout-modal-custom-fields {
    grid-template-columns: minmax(0, 1fr) 90px;
  }

  .checkout-modal-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .checkout-modal-foot .btn {
    justify-content: center;
  }
}
