:root {
  --paper: #f8f7f4;
  --card: #ffffff;
  --ink: #1f1f1f;
  --muted: #6f6b64;
  --line: #e2ddd4;
  --sand: #ece2d3;
  --accent: #a85f37;
  --accent-dark: #8f4d2b;
}

.cart-main {
  padding: 1.2rem 1.35rem 2rem;
}

.cart-main h1 {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.cart-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}

.cart-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.cart-empty-state {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.9rem;
}

.cart-empty-state h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2.3vw, 1.9rem);
  color: #4a3f35;
  white-space: nowrap;
}

.cart-empty-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  justify-content: center;
}

.cart-empty-actions .btn {
  min-width: 0;
  border-radius: 10px;
  white-space: nowrap;
}

.cart-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 0.5rem;
}

.cart-item-media {
  position: relative;
}

.cart-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #ede8df;
  background: #f4f2ee;
}

.cart-item-personalize-btn {
  position: absolute;
  right: 0.55rem;
  bottom: 0.55rem;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid #9d5d3d;
  border-radius: 999px;
  background: #b56a41;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 16px rgba(45, 25, 14, 0.25);
}

.cart-item-personalize-btn::before {
  content: '';
  width: 19px;
  height: 19px;
  display: block;
  background: currentColor;
  -webkit-mask: url('assets/personalize-icon.png?v=20260410-7') center / contain no-repeat;
  mask: url('assets/personalize-icon.png?v=20260410-7') center / contain no-repeat;
}

.cart-item-personalize-btn:hover,
.cart-item-personalize-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(45, 25, 14, 0.3);
}

.cart-item h2 {
  margin: 0.6rem 0 0.45rem;
  font-size: 1.07rem;
  line-height: 1.2;
}

.remove-item {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  border-radius: 4px;
  border: 1px solid #cdc6bb;
  padding: 0.06rem 0.32rem;
  background: #f3eee6;
  color: #3f3f3f;
  font-size: 0.82rem;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}

.remove-confirm {
  position: absolute;
  bottom: 3.35rem;
  left: 0.55rem;
  right: auto;
  top: auto;
  z-index: 3;
  background: #fff;
  border: 1px solid #d8d2c8;
  border-radius: 8px;
  box-shadow: 0 12px 22px rgba(45, 34, 22, 0.16);
  padding: 0.45rem 0.55rem;
}

.remove-confirm p {
  margin: 0 0 0.3rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.confirm-actions {
  display: flex;
  gap: 0.35rem;
}

.confirm-actions button {
  border: 1px solid #d6d0c8;
  background: #f8f6f2;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.confirm-actions .confirm-yes {
  border-color: #c08768;
  color: #7b4429;
  background: #f8ede6;
}

.item-foot {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 0.5rem;
}

.qty-spinner {
  display: inline-grid;
  grid-template-columns: 29px 39px 29px;
  align-items: center;
  border: 1px solid #d2cbbc;
  border-radius: 4px;
  overflow: hidden;
  background: #f5f5f5;
}

.qty-btn {
  border: 0;
  border-right: 1px solid #d2cbbc;
  background: #f1f1f1;
  color: #2f2f2f;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  height: 27px;
  cursor: pointer;
}

.qty-btn:last-child {
  border-right: 0;
  border-left: 1px solid #d2cbbc;
}

.qty-value {
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 500;
  color: #2b2b2b;
  background: #efefef;
}

.item-price {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
}

.subtotal-pane {
  border: 2px solid #74553e;
  border-radius: 12px;
  background: #efe8dc;
  padding: 0.9rem;
  position: sticky;
  top: 1rem;
}

.summary-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.42rem;
}

.summary-line span {
  color: #3b372f;
}

.summary-line strong {
  font-size: 1.08rem;
}

.subtotal-pane hr {
  border: 0;
  border-top: 1px solid #d8cfbf;
  margin: 0.7rem 0;
}

.promo-wrap {
  display: block;
  font-size: 0.86rem;
  color: #5d5548;
  margin-bottom: 0.3rem;
}

.subtotal-pane input {
  width: 100%;
  border: 1px solid #d6cebf;
  border-radius: 8px;
  padding: 0.58rem 0.68rem;
  font-size: 0.95rem;
  margin-bottom: 0.7rem;
}

.checkout-btn {
  width: 100%;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dark) 100%);
  font-size: 1rem;
}

.checkout-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-btn.is-active {
  position: relative;
  border-radius: 8px;
  border: 1px solid #b88b67;
  background: #f0e4d7;
  text-decoration: none;
}

.nav-icons .icon-btn {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7e4b2e;
  color: #fff;
  font-size: 0.67rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

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

  .subtotal-pane {
    position: static;
  }

  .cart-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cart-main {
    padding: 1rem 0.8rem 1.5rem;
  }

  .cart-items {
    grid-template-columns: 1fr;
  }

  .item-price {
    font-size: 1.6rem;
  }
}
