.cart-page {
  padding: clamp(1rem, 5vw, 4rem);
}

.cart-hero {
  display: grid;
  gap: 0.8rem;
  max-width: 920px;
  padding: clamp(1.5rem, 4vw, 3.5rem) 0;
}

.cart-hero h1 {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 6rem);
  line-height: 0.94;
}

.cart-hero p:not(.label) {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: clamp(1rem, 4vw, 2rem);
  align-items: start;
}

.cart-panel,
.checkout-panel {
  display: grid;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1rem, 3vw, 1.4rem);
}

.checkout-panel {
  position: sticky;
  top: 1rem;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.panel-heading.compact {
  align-items: center;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  line-height: 1;
}

.text-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
}

.text-button:hover,
.text-button:focus-visible {
  color: var(--ink);
  border-color: rgba(24, 22, 19, 0.32);
}

.cart-items {
  display: grid;
  gap: 0.85rem;
}

.cart-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cart-item img,
.cart-thumb-placeholder {
  width: 92px;
  height: 108px;
  object-fit: cover;
  background: var(--linen);
  border-radius: 6px;
}

.cart-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.cart-item-body {
  display: grid;
  gap: 0.35rem;
}

.cart-item-body h3 {
  margin: 0;
  font-size: 1.15rem;
}

.cart-item-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.cart-item-price {
  font-weight: 950;
}

.cart-actions {
  display: grid;
  gap: 0.55rem;
  justify-items: end;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.quantity-control input {
  width: 4.2rem;
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  text-align: center;
}

.remove-item {
  border: 0;
  background: transparent;
  color: var(--clay);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.cart-empty {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--paper);
  border-radius: 8px;
}

.cart-empty[hidden] {
  display: none;
}

.cart-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.cart-total {
  font-size: 1.35rem;
}

.checkout-note {
  padding: 0.85rem;
  background: #fff4df;
  border: 1px solid rgba(182, 99, 69, 0.26);
  border-radius: 8px;
  color: #68412f;
  line-height: 1.5;
}

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

.checkout-form,
.checkout-form label,
.payment-methods {
  display: grid;
  gap: 0.75rem;
}

.checkout-form label {
  color: var(--muted);
  font-weight: 850;
}

.checkout-form input,
.checkout-form textarea {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.checkout-form textarea {
  resize: vertical;
}

.payment-option {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.payment-option:has(input:checked) {
  background: var(--surface);
  border-color: var(--clay);
  box-shadow: 0 0 0 2px rgba(182, 99, 69, 0.2), var(--soft-shadow);
}

.payment-option input {
  width: auto;
  min-height: auto;
  margin-top: 0.2rem;
  accent-color: var(--clay);
}

.payment-option span {
  display: grid;
  gap: 0.25rem;
  color: var(--ink);
}

.payment-option small {
  color: var(--muted);
  line-height: 1.4;
}

.checkout-button {
  width: 100%;
  background: var(--ink);
  color: #ffffff;
}

.checkout-status {
  min-height: 1.45rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

  .checkout-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .cart-page {
    padding: 0.85rem 1rem 2rem;
  }

  .cart-hero {
    gap: 0.6rem;
    padding: 1rem 0 1.2rem;
  }

  .cart-hero h1 {
    font-size: clamp(2rem, 10.4vw, 2.7rem);
    line-height: 1.02;
  }

  .cart-hero p:not(.label) {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .cart-layout {
    gap: 0.9rem;
  }

  .cart-panel,
  .checkout-panel {
    gap: 0.8rem;
    padding: 0.85rem;
  }

  .panel-heading {
    align-items: start;
    flex-direction: column;
    gap: 0.55rem;
    padding-bottom: 0.75rem;
  }

  .panel-heading.compact {
    align-items: start;
  }

  .panel-heading h2 {
    font-size: 1.45rem;
  }

  .cart-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 0.7rem;
    padding: 0.65rem;
  }

  .cart-item img,
  .cart-thumb-placeholder {
    width: 76px;
    height: 92px;
  }

  .cart-actions {
    grid-column: 1 / -1;
    justify-items: stretch;
  }

  .quantity-control {
    justify-content: space-between;
  }

  .checkout-form,
  .checkout-form label,
  .payment-methods {
    gap: 0.62rem;
  }

  .checkout-form input,
  .checkout-form textarea {
    min-height: 2.65rem;
    padding: 0.68rem 0.75rem;
  }
}
