#checkoutdialog {
  width: min(650px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 24px;
}

.checkout-progress {
  display: flex;
  justify-content: space-between;
  list-style: none;
  padding: 0;
  gap: 8px;
  margin: 0 0 24px;
  font-size: 12px;
  color: #8b7976;
}

.checkout-progress li {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
}

.checkout-progress span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #f0e8e2;
  border-radius: 50%;
  font-weight: 700;
}

.checkout-progress .current {
  color: #a52331;
  font-weight: 700;
}

.checkout-progress .current span {
  background: #a52331;
  color: white;
}

.checkout-progress .done span {
  background: #e7f2e8;
  color: #286a3e;
}

#modes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 0;
  padding: 0;
  margin: 18px 0;
}

#modes legend {
  font-weight: 700;
  margin-bottom: 10px;
}

#modes label {
  flex: 1 1 180px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px;
  margin: 0;
  border: 1px solid #e8ded7;
  border-radius: 14px;
}

#modes input, .checkout-needs-change input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
  accent-color: #a52331;
}

#modes label:has(input:checked) {
  border-color: #a52331;
  background: #fff2ee;
}

.checkout-needs-change {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.checkout-review-details {
  padding: 14px 18px;
  border-radius: 14px;
  background: #f8f4ef;
  margin-bottom: 20px;
}

.checkout-review-details p {
  margin: 6px 0;
  font-size: 14px;
}

.checkout-actions {
  position: sticky;
  bottom: -24px;
  display: flex;
  gap: 10px;
  padding: 16px 0 max(16px, env(safe-area-inset-bottom));
  background: white;
  border-top: 1px solid #eee4dd;
  z-index: 2;
}

.checkout-actions button {
  min-height: 48px;
  flex: 1;
}

.checkout-actions #send {
  background: #287744;
}
#checkoutdialog [hidden] {
  display: none !important;
}

.checkout-field-error, .checkout-step-error {
  display: block;
  color: #a52331;
  font-size: 13px;
}

[aria-invalid="true"] {
  border-color: #a52331;
}

@media(max-width: 480px) {
  #checkoutdialog {
    padding: 18px;
  }
  .checkout-actions {
    bottom: -18px;
    flex-wrap: wrap;
  }
  .checkout-actions #send {
    flex: 2;
  }
}

/* Keep address suggestions and navigation reachable above a mobile keyboard. */
#orderform .address-candidates {
  max-height: 180px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-margin: 12px;
}
@media (max-width: 768px) {
  #checkoutdialog {
    position: fixed;
    top: var(--checkout-viewport-top, 12px);
    bottom: auto;
    margin-top: 0;
    max-height: var(--checkout-available-height, calc(100dvh - 24px));
  }
  .checkout-progress {
    font-size: 10px;
    gap: 4px;
    margin-bottom: 18px;
  }
}

/* Compact checkout actions retain a comfortable touch target. */
.checkout-actions { gap: 8px; padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.checkout-actions button { min-height: 44px; padding: 10px 14px; font-size: 14px; }
