/* SAFO Cart Experience — always-loaded cart styling */
:root {
  --safo-cart-shell: 760px;
}

body.route-cart #app-content {
  max-width: 100%;
}

.safo-cart-page {
  max-width: var(--safo-cart-shell);
  margin: 0 auto;
  padding: 0 12px 132px;
}

.safo-cart-header {
  margin-inline: -12px;
  padding-inline: 12px;
}

.safo-cart-list {
  gap: 12px;
  margin-top: 14px;
}

.safo-cart-card {
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.safo-cart-card__image {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  border: 1px solid #edf2f7;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.safo-cart-card__image--fallback {
  object-fit: contain;
  padding: 12px;
}

.safo-cart-card__content {
  gap: 10px;
}

.safo-cart-card__top {
  gap: 10px;
}

.safo-cart-card__name {
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 8px;
}

.safo-cart-card__seller {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: #F0FDF4;
  border: 1px solid #DCFCE7;
  color: #065F46;
  font-size: 11px;
  font-weight: 700;
}

.safo-cart-card__bottom {
  align-items: center;
  gap: 10px;
}

.safo-cart-pricing {
  gap: 2px;
}

.safo-cart-price-label {
  font-size: 11px;
  color: #374151;
  font-weight: 700;
}

.safo-cart-price {
  font-size: 15px;
  font-weight: 800;
  color: #047857;
}

.safo-cart-subtotal {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: #047857;
}

.safo-cart-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
}

.safo-cart-remove-btn {
  min-height: 34px;
  padding: 8px 12px;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.safo-cart-qty {
  direction: ltr;
  display: inline-grid;
  grid-template-columns: 40px 48px 40px;
  align-items: center;
  min-height: 42px;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #DCFCE7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

.safo-cart-qty button,
.safo-cart-qty span {
  display: grid;
  place-items: center;
  min-height: 42px;
}

.safo-cart-qty button {
  font-size: 20px;
  font-weight: 800;
  color: #065F46;
  background: #fff;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.safo-cart-qty button:hover,
.safo-cart-qty button:active {
  background: #f8fafc;
}

.safo-cart-qty span {
  border-inline: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 900;
  color: #065F46;
}

.safo-cart-footer {
  max-width: var(--safo-cart-shell);
  margin: 0 auto;
  left: max(0px, calc((100vw - var(--safo-cart-shell)) / 2));
  right: max(0px, calc((100vw - var(--safo-cart-shell)) / 2));
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding-top: 16px;
}

.safo-cart-footer__summary {
  gap: 2px;
}

.safo-cart-footer__meta {
  white-space: normal;
  line-height: 1.5;
}

.safo-cart-footer__cta {
  min-height: 52px;
  font-weight: 900;
}

@media (max-width: 640px) {
  .safo-cart-page {
    padding-inline: 10px;
    padding-bottom: 128px;
  }

  .safo-cart-header {
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .safo-cart-card {
    grid-template-columns: 78px minmax(0, 1fr);
    border-radius: 20px;
    padding: 10px;
  }

  .safo-cart-card__image {
    width: 78px;
    height: 78px;
    border-radius: 16px;
  }

  .safo-cart-card__bottom {
    align-items: stretch;
    flex-direction: column;
  }

  .safo-cart-actions {
    margin-inline-start: 0;
    justify-content: flex-start;
  }

  .safo-cart-footer {
    left: 0;
    right: 0;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
  }
}

/* ── Mobile-first cart hierarchy and item checkout ─────────────── */
.safo-cart-list {
  display: grid;
  gap: 14px;
}

.safo-cart-card {
  position: relative;
  display: grid !important;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: start;
  background: #ffffff;
}

.safo-cart-card__quick-checkout {
  grid-column: 1 / -1;
  order: -1;
  width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #bfe7d4;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0faf5, #e8f6f0);
  color: #0b6b4f;
  font-size: 12px;
  font-weight: 800;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.safo-cart-card__quick-checkout:hover,
.safo-cart-card__quick-checkout:focus-visible {
  background: #dff3e9;
  border-color: #8fd1b0;
  transform: translateY(-1px);
}

.safo-cart-card__quick-checkout svg { flex: 0 0 auto; }

.safo-cart-card__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.safo-cart-card__top { min-width: 0; }
.safo-cart-card__name { overflow-wrap: anywhere; }

.safo-cart-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .safo-cart-page {
    padding-inline: 10px;
    padding-bottom: 150px;
    background: #f7fbf9;
  }

  .safo-cart-header {
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid #dcefe5;
  }

  .safo-cart-list { gap: 12px; margin-top: 12px; }

  .safo-cart-card {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border: 1px solid #dcefe5;
    border-radius: 18px;
    box-shadow: 0 8px 22px rgba(16, 66, 49, .07);
  }

  .safo-cart-card__quick-checkout {
    min-height: 38px;
    border-radius: 11px;
    font-size: 12px;
  }

  .safo-cart-card__image {
    width: 84px;
    height: 84px;
    border-radius: 15px;
    background: #f4fbf7;
  }

  .safo-cart-card__content { gap: 8px; }
  .safo-cart-card__name { font-size: 13px; line-height: 1.5; }
  .safo-cart-card__seller { padding: 5px 8px; font-size: 10px; }

  .safo-cart-card__bottom {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .safo-cart-pricing {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 2px 8px;
  }

  .safo-cart-price-label { grid-column: 1 / -1; }
  .safo-cart-subtotal { margin-top: 0; text-align: end; }

  .safo-cart-actions {
    width: 100%;
    margin-inline-start: 0;
    justify-content: space-between;
    gap: 7px;
  }

  .safo-cart-qty {
    flex: 1;
    grid-template-columns: 38px minmax(40px, 1fr) 38px;
    min-height: 40px;
  }

  .safo-cart-qty button,
  .safo-cart-qty span { min-height: 40px; }

  .safo-cart-remove-btn {
    min-height: 40px;
    padding-inline: 11px;
    border-radius: 10px;
  }

  .safo-cart-footer {
    padding: 14px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,.98);
    border: 1px solid #dcefe5;
    box-shadow: 0 -10px 28px rgba(16, 66, 49, .10);
  }

  .safo-cart-footer__cta { min-height: 50px; border-radius: 14px; }
}

/* ── Cart header: light, calm and mobile-safe ─────────────────── */
.safo-cart-page .safo-cart-header,
[data-theme="dark"] .safo-cart-page .safo-cart-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-height: 68px;
  padding-block: 12px !important;
  background: #ffffff !important;
  color: #12352d !important;
  border-bottom: 1px solid #dcefe5 !important;
  box-shadow: 0 4px 16px rgba(16, 66, 49, .06) !important;
}

.safo-cart-page .safo-cart-header h2,
[data-theme="dark"] .safo-cart-page .safo-cart-header h2 {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 !important;
  color: #0b6b4f !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  white-space: nowrap;
}

.safo-cart-page .safo-cart-header > div:first-child,
.safo-cart-page .safo-cart-header > div:last-child {
  min-width: 0;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.safo-cart-page .safo-cart-header > div:last-child {
  flex-shrink: 0;
}

.safo-cart-page .safo-cart-header .back-btn {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d8eee3;
  border-radius: 12px;
  background: #f4fbf7 !important;
  color: #0b6b4f !important;
}

.safo-cart-page .safo-cart-header .safo-cart-clear-btn {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #f3caca;
  border-radius: 11px;
  background: #fff7f7 !important;
  color: #b42318 !important;
  font-size: 12px;
  white-space: nowrap;
}

.safo-cart-page .safo-cart-header .cart-count-pill {
  margin: 0;
  background: #e8f6f0 !important;
  border: 1px solid #bfe7d4;
  color: #0b6b4f !important;
}

@media (max-width: 640px) {
  .safo-cart-page .safo-cart-header {
    margin-inline: -10px;
    padding-inline: 10px !important;
  }

  .safo-cart-page .safo-cart-header > div:last-child button:first-child {
    display: none;
  }

  .safo-cart-page .safo-cart-header > div:last-child {
    gap: 6px !important;
  }
}

@media (max-width: 390px) {
  .safo-cart-page .safo-cart-header { gap: 8px !important; }
  .safo-cart-page .safo-cart-header h2 { font-size: 16px !important; }
  .safo-cart-page .safo-cart-header .safo-cart-clear-btn {
    padding-inline: 8px;
    font-size: 11px;
  }
}
