html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: #f7f6f3;
}

/* ── Page shell ─────────────────────────────────────────────── */
.cart-main {
  max-width: 1200px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 24px;
  background: #f7f6f3;
  border-left: 1px solid #ebebeb;
  border-right: 1px solid #ebebeb;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* ── Page title row ─────────────────────────────────────────── */
.cart-page-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.cart-page-title {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  margin: 0;
}

.cart-item-count {
  color: var(--muted, #888);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── Cart message banner ────────────────────────────────────── */
.cart-message {
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: none;
}

.cart-message.success {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.cart-message.error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

/* ── Empty state ────────────────────────────────────────────── */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 80px 20px;
  text-align: center;
}

.cart-empty-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.cart-empty-title {
  font-size: 1.4rem;
  font-weight: 800;
}

.cart-empty-sub {
  color: var(--muted, #888);
  font-size: 1rem;
  margin: 0;
}

/* ── Two-column layout ──────────────────────────────────────── */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 22px;
  align-items: start;
}

/* ── Items section ──────────────────────────────────────────── */
.cart-items-section {
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 5px;
  box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.07));
  overflow: hidden;
}

/* Column header */
.cart-items-header {
  display: grid;
  grid-template-columns: 1fr 130px 90px 90px 36px;
  gap: 8px;
  padding: 11px 16px;
  background: #f4f6fb;
  border-bottom: 1px solid #e2e2e2;
  font-size: 0.8rem;
  font-weight: 700;
  color: #555;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* Individual rows */
.cart-items-list {
  display: flex;
  flex-direction: column;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr 130px 90px 90px 36px;
  gap: 8px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s ease;
}

.cart-row:last-child {
  border-bottom: none;
}

.cart-row:hover {
  background: #fafbff;
}

/* Product cell */
.cart-row-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cart-row-img-wrap {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 5px;
  overflow: hidden;
  background: #f0f2f5;
  border: 1px solid #e6e6e6;
}

.cart-row-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-row-info {
  min-width: 0;
}

.cart-row-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-row-id {
  font-size: 0.76rem;
  color: var(--muted, #888);
  margin-top: 3px;
}

/* Qty cell */
.cart-row-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid #d6d6d6;
  background: #f5f5f5;
  color: #333;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qty-btn:hover {
  background: #ebebeb;
  border-color: #bbb;
}

.qty-input {
  width: 46px;
  height: 28px;
  text-align: center;
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #111;
  background: #fff;
  -moz-appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

/* Price / total cells */
.cart-row-price {
  font-size: 0.92rem;
  color: #555;
  font-weight: 500;
}

.cart-row-total {
  font-size: 0.96rem;
  font-weight: 800;
  color: #111;
}

/* Remove button */
.remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid #e8c8c8;
  background: #fff5f5;
  color: #e05252;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.remove-btn:hover {
  background: #fee2e2;
  border-color: #f5a9a9;
  color: #c62828;
}

/* Footer */
.cart-items-footer {
  padding: 12px 16px;
  background: #f8f9fc;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}

.cart-clear-btn {
  font-size: 0.84rem;
  padding: 7px 14px;
  border-color: #e5c5c5;
  color: #c62828;
}

.cart-clear-btn:hover {
  background: #fff0f0;
  border-color: #e09090;
}

/* ── Summary sidebar ────────────────────────────────────────── */
.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.cart-summary-card {
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 5px;
  box-shadow: var(--shadow, 0 2px 8px rgba(0,0,0,0.07));
  padding: 20px;
}

.cart-summary-title {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.3px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #efefef;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  color: #555;
  margin-bottom: 10px;
}

.cart-summary-row--total {
  font-weight: 900;
  font-size: 1.05rem;
  color: #111;
  margin-bottom: 0;
}

.cart-summary-divider {
  height: 1px;
  background: #efefef;
  margin: 12px 0;
}

.cart-summary-delivery-note {
  font-size: 0.8rem;
  color: #15803d;
  font-weight: 600;
  margin-top: 8px;
  min-height: 16px;
}

.cart-checkout-btn {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  font-size: 1rem;
  border-radius: 5px;
  font-weight: 800;
  text-align: center;
  transition: background 0.25s ease;
}

.cart-checkout-btn:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000 12%);
}

.cart-delivery-select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
}

.cart-delivery-select:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.cart-continue-link {
  display: block;
  text-align: center;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted, #888);
  text-decoration: none;
  transition: color 0.15s ease;
}

.cart-continue-link:hover {
  color: var(--accent, #2563eb);
}

/* Address card */
.cart-address-card {
  font-size: 0.88rem;
}

.address-display {
  color: #444;
  line-height: 1.7;
  margin-bottom: 10px;
}

.address-line:empty {
  display: none;
}

.cart-edit-address-link {
  font-size: 0.82rem;
  color: var(--accent, #2563eb);
  text-decoration: none;
  font-weight: 600;
}

.cart-edit-address-link:hover {
  text-decoration: underline;
}

/* ── Top block: logo + continue shopping ────────────────────── */
.cart-top-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 18px;
}

.cart-logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}

.cart-nav-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid #d6d6d6;
  border-radius: 999px;
  background: #fff;
  transition: background 0.15s ease;
}

.cart-nav-link:hover {
  background: #f0f0f0;
}


/* ── Confirm / checkout modal ───────────────────────────────── */
.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 24px;
}

.confirm-modal.show {
  display: flex;
}

.confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.confirm-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px 24px 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  border: 1px solid rgba(106, 136, 213, 0.14);
}

.confirm-card--wide {
  max-width: 560px;
}

.confirm-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 10px 0;
  color: #111;
}

.confirm-body {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #edf1f7;
}

.confirm-actions .ghost-btn,
.confirm-actions .primary-btn {
  min-width: 128px;
  min-height: 44px;
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.confirm-actions .ghost-btn {
  background: #ffffff;
  color: #344054;
  border: 1px solid #d0d5dd;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}

.confirm-actions .ghost-btn:hover {
  background: #f8fafc;
  border-color: #b8c0cc;
  color: #18202a;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
  transform: translateY(-1px);
}

.confirm-actions .primary-btn {
  background: var(--accent, #2563eb);
  color: #ffffff;
  border: 1px solid var(--accent, #2563eb);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.confirm-actions .primary-btn:hover {
  background: color-mix(in srgb, var(--accent, #2563eb) 88%, #000000 12%);
  border-color: color-mix(in srgb, var(--accent, #2563eb) 88%, #000000 12%);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
  transform: translateY(-1px);
}

.confirm-actions .ghost-btn:active,
.confirm-actions .primary-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.confirm-actions .ghost-btn:disabled,
.confirm-actions .primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.danger-btn {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.2s ease;
}

.danger-btn:hover {
  background: #b91c1c;
}

/* ── Checkout modal details ─────────────────────────────────── */
.checkout-order-lines {
  background: #f8f9fc;
  border: 1px solid #eaeaea;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkout-line {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  font-size: 0.9rem;
  color: #333;
}

.checkout-line-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkout-line-qty {
  color: #888;
  font-weight: 600;
  white-space: nowrap;
}

.checkout-line-total {
  font-weight: 800;
  white-space: nowrap;
}

.checkout-totals {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.checkout-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #555;
}

.checkout-total-row--grand {
  font-weight: 900;
  font-size: 1rem;
  color: #111;
  padding-top: 8px;
  border-top: 1px solid #eee;
  margin-top: 4px;
}

.checkout-address-block {
  background: #f4f6fb;
  border: 1px solid #dce3f4;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 0.86rem;
  color: #444;
  line-height: 1.7;
  margin-bottom: 10px;
}

.checkout-address-label {
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
}

/* ── form-message helper (shared pattern) ───────────────────── */
.form-message {
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 20px;
}

.form-message.success { color: #15803d; }
.form-message.error   { color: #dc2626; }

/* ── Loading overlay (mirrors shop.css) ─────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  display: block;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--accent, #2563eb);
  animation: cart-spin 0.75s linear infinite;
  margin-bottom: 16px;
}

@keyframes cart-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.loading-text {
  color: #ffffff;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 10px 16px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
  }
}

@media (max-width: 640px) {
  .cart-items-header {
    display: none;
  }

  .cart-row {
    grid-template-columns: 1fr 100px;
    grid-template-rows: auto auto;
    row-gap: 10px;
  }

  .cart-row-product {
    grid-column: 1 / -1;
  }

  .cart-row-price {
    display: none;
  }

  .cart-row-total {
    font-size: 0.9rem;
  }

  .cart-row-remove {
    justify-self: end;
  }

  .confirm-card {
    padding: 24px 18px 18px 18px;
  }

  .confirm-actions {
    flex-direction: column;
  }

  .confirm-actions .ghost-btn,
  .confirm-actions .danger-btn,
  .confirm-actions .primary-btn {
    width: 100%;
    text-align: center;
  }
}

.cart-login-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.cart-login-field label {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}

.cart-login-field input {
  width: 100%;
  background: #ffffff;
  color: #1b2430;
  border: 1px solid #d9e1ee;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 0.95rem;
}

.cart-login-field input:focus {
  outline: none;
  border-color: var(--accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.cart-delivery-note-field {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e4e8f0;
}

.cart-delivery-note-field label {
  display: block;
  margin-bottom: 8px;
  color: #18202a;
  font-size: 0.92rem;
  font-weight: 700;
}

.cart-delivery-note-field textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #ffffff;
  color: #18202a;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.cart-delivery-note-field textarea::placeholder {
  color: #98a2b3;
}

.cart-delivery-note-field textarea:focus {
  border-color: var(--accent, #2f6fed);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.14);
  background: #ffffff;
}