.cart-page {
  padding: var(--sp-5) 0 var(--sp-10);
}

.cart-page__title {
  font-family: var(--ff-display);
  font-size: var(--fs-h2);
  text-wrap: balance;
  margin-bottom: var(--sp-5);
}

.cart-layout {
  display: grid;
  gap: var(--sp-6);
  align-items: start;
}

@media (min-width: 900px) {
  .cart-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: var(--sp-8);
  }
}

.cart-items,
#cart-lines {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.cart-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: var(--sp-3) var(--sp-4);
  align-items: start;
  padding: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.cart-item__media {
  width: 88px;
  height: 88px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-bg-alt);
}

.cart-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__media--empty {
  display: grid;
  place-items: center;
  color: var(--c-text-muted);
  font-size: var(--fs-xs);
}

.cart-item__body {
  display: grid;
  gap: var(--sp-2);
  min-width: 0;
}

.cart-item__name {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
}

.cart-item__name a:hover {
  color: var(--c-action);
}

.cart-item__sku {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
}

.cart-item__unit {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

.cart-item__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-1);
}

.cart-item__total {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--c-action);
  white-space: nowrap;
}

.cart-item__remove {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--c-text-muted);
  transition: background var(--t-fast), color var(--t-fast);
}

.cart-item__remove:hover {
  background: rgba(184, 60, 60, 0.1);
  color: var(--c-danger);
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--c-surface);
}

.qty-control button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--c-text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}

.qty-control button:hover {
  background: var(--c-bg-alt);
  color: var(--c-text);
}

.qty-control input {
  width: 48px;
  height: 40px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--c-border);
  border-right: 1px solid var(--c-border);
  font-size: 16px;
  background: transparent;
}

.cart-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4);
  background: var(--c-surface);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
}

.cart-empty__icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--c-brand-bg);
  color: var(--c-action);
}

.cart-empty__title {
  font-family: var(--ff-display);
  font-size: var(--fs-xl);
}

.cart-empty__text {
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
  max-width: 28ch;
}

.cart-sidebar {
  display: grid;
  gap: var(--sp-4);
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top) + var(--sp-4));
}

.cart-summary {
  padding: var(--sp-5);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: var(--sp-3);
}

.cart-summary__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--c-text-secondary);
}

.cart-summary__row strong,
.cart-summary__row span:last-child {
  color: var(--c-text);
  font-weight: 600;
  white-space: nowrap;
}

.cart-summary__row--discount span:last-child {
  color: var(--c-success);
}

.cart-summary__divider {
  height: 1px;
  background: var(--c-border);
  margin: var(--sp-1) 0;
}

.cart-summary__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  font-size: var(--fs-lg);
  font-weight: 700;
}

.cart-summary__total span:last-child {
  color: var(--c-action);
  white-space: nowrap;
}

.cart-summary__actions {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.cart-promo {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-4);
  background: var(--c-bg-alt);
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
}

.cart-promo__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text-secondary);
}

.cart-promo__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-2);
}

@media (min-width: 480px) {
  .cart-item {
    grid-template-columns: 100px minmax(0, 1fr) auto;
  }

  .cart-item__media {
    width: 100px;
    height: 100px;
  }
}

@media (min-width: 768px) {
  .cart-page {
    padding: var(--sp-8) 0 var(--sp-10);
  }
}
