.checkout-page {
  min-height: calc(100vh - 72px);
  padding: 42px 0 80px;
}

.checkout-heading {
  max-width: 820px;
  margin: 52px 0 42px;
}

.checkout-heading h1 {
  margin-bottom: 22px;
  letter-spacing: -0.07em;
}

.checkout-heading p {
  max-width: 720px;
  font-size: clamp(1rem, 2vw, 1.17rem);
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 20px;
  align-items: start;
}

.checkout-panel,
.order-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.checkout-panel {
  padding: clamp(24px, 4vw, 42px);
  background:
    radial-gradient(circle at 100% 0%, rgba(111, 75, 242, 0.08), transparent 18rem),
    rgba(255, 255, 255, 0.94);
}

.checkout-panel h2 {
  margin: 10px 0 24px;
}

.step-label {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  color: var(--violet-dark);
  background: var(--violet-soft);
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkout-form {
  display: grid;
  gap: 12px;
}

.checkout-form > label:first-child {
  font-weight: 800;
}

.checkout-form input[type="email"] {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fbfafe;
  font-size: 1rem;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.checkout-form input[type="email"]:focus {
  border-color: var(--violet);
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(111, 75, 242, 0.11);
}

.checkout-form input[aria-invalid="true"] {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(238, 121, 151, 0.16);
}

.field-note {
  font-size: 0.84rem;
}

.payment-methods {
  min-width: 0;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.payment-methods legend {
  margin-bottom: 10px;
  font-weight: 800;
}

.payment-method-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.payment-method-option {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfafe;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.payment-method-option:has(input:checked) {
  border-color: var(--violet);
  background: var(--violet-soft);
  box-shadow: 0 0 0 3px rgba(111, 75, 242, 0.1);
}

.payment-method-option:focus-within {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.payment-method-option input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--violet);
}

.payment-method-option span {
  display: grid;
  gap: 4px;
}

.payment-method-option strong {
  color: var(--ink);
}

.payment-method-option small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.agreement-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.agreement-check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--violet);
}

.agreement-check a {
  color: var(--violet-dark);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.checkout-actions .button {
  flex: 1 1 190px;
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.checkout-status {
  min-height: 28px;
  margin-top: 18px;
  font-size: 0.9rem;
}

.checkout-status[data-state="error"] {
  color: #bd4267;
  font-weight: 700;
}

.checkout-status[data-state="success"] {
  color: var(--teal-dark);
  font-weight: 700;
}

.saved-order {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #b9e5d8;
  border-radius: 14px;
  background: var(--teal-soft);
}

.saved-order[hidden],
.payment-next[hidden] {
  display: none;
}

.saved-order-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: linear-gradient(145deg, #58bfa2, #258b70);
  box-shadow: 0 8px 20px rgba(37, 139, 112, 0.2);
  font-weight: 900;
}

.saved-order p {
  margin-top: 4px;
}

.payment-next {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.payment-next h2 {
  margin-bottom: 12px;
}

.payment-next p {
  margin-bottom: 18px;
}

.payment-next .button {
  width: 100%;
  margin-top: 10px;
}

.order-card {
  position: sticky;
  top: 104px;
  padding: 28px;
  background:
    radial-gradient(circle at 92% 0%, rgba(111, 75, 242, 0.12), transparent 14rem),
    rgba(255, 255, 255, 0.96);
}

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.order-card-head a {
  color: var(--violet-dark);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.order-price {
  margin: 14px 0 24px;
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.065em;
}

.order-details {
  margin: 0;
}

.order-details > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.order-details dt {
  color: var(--muted);
}

.order-details dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
}

.order-note {
  margin-top: 18px;
  font-size: 0.82rem;
}

@media (max-width: 820px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .order-card {
    position: static;
    grid-row: 1;
  }

  .checkout-heading {
    margin-top: 30px;
  }
}

@media (max-width: 560px) {
  .checkout-page {
    padding-top: 22px;
    padding-bottom: 48px;
  }

  .checkout-panel,
  .order-card {
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
  }

  .checkout-panel {
    padding: 22px 18px;
  }

  .order-card {
    padding: 22px;
  }

  .checkout-actions {
    display: grid;
  }

  .payment-method-options {
    grid-template-columns: 1fr;
  }

  .payment-method-option {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
