/* Cart uses the same surfaces, text colors, and accent as the main UI. */
body.cart-is-open {
  overflow: hidden;
}

.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: 560px;
  max-width: 100%;
  height: 100dvh;
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--shadow);
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 250ms ease, visibility 250ms;
}

.cart-drawer.open {
  visibility: visible;
  transform: translateX(0);
}

.cart-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1099;
  background: rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.cart-drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.cl-eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.cart-drawer-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-family: 'Sora', 'Inter', sans-serif;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.04em;
}

.cart-drawer-title-badge {
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--accent-lt);
  color: var(--accent);
  font: 600 11px 'Inter', sans-serif;
  letter-spacing: 0;
}

.cl-caption,
.cl-section-description,
.cl-store-note,
.cl-item-sub,
.cl-item-price-sub {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.cl-caption {
  margin-top: 6px;
}

.cart-drawer #cart-close-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}

.cart-drawer button,
.cart-drawer summary {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.cart-drawer :is(button, summary, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cart-drawer :is(button, summary) {
  touch-action: manipulation;
}

.cart-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  background: var(--bg-alt);
  scrollbar-width: thin;
  scrollbar-color: var(--border-dark) transparent;
}

.cl-section {
  flex-shrink: 0;
}

.cl-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.cl-section-title {
  color: var(--text-1);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.cl-section-count {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
  margin-left: 5px;
}

.cl-text-btn {
  min-height: 36px;
  padding: 6px 2px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-underline-offset: 3px;
}

.cl-text-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cl-items,
.cl-store-row,
.cl-split-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.cl-items {
  list-style: none;
  overflow: hidden;
}

.cl-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 18px 16px;
}

.cl-item + .cl-item {
  border-top: 1px solid var(--border);
}

.cl-item-body {
  min-width: 0;
}

.cl-item-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.cl-item-sub {
  margin-top: 3px;
  font-size: 11px;
}

.cl-item-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.cl-qty-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cl-qty-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface);
  color: var(--text-1);
  font-size: 18px;
  cursor: pointer;
}

.cl-qty-btn:hover {
  background: var(--accent-lt);
  color: var(--accent);
}

.cl-qty-num {
  min-width: 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cl-item-price-wrap {
  text-align: right;
}

.cl-item-price {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cl-item-price-sub {
  margin-top: 3px;
  font-size: 10px;
}

.cl-price-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 14px 0 8px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}

.cl-mode-btn {
  min-height: 38px;
  padding: 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.cl-mode-btn[aria-pressed="true"] {
  background: var(--accent-lt);
  color: var(--accent);
}

.cl-offer-help {
  margin-bottom: 14px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.6;
}

.cl-store-rows {
  display: grid;
  gap: 10px;
}

.cl-store-row {
  padding: 16px;
  min-width: 0;
}

.cl-store-row.cheapest {
  border-color: var(--accent);
}

.cl-store-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cl-store-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cl-store-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.cl-store-name-text {
  font-size: 13px;
  font-weight: 600;
}

.cl-store-note {
  margin-top: 2px;
  font-size: 11px;
}

.cl-store-right {
  flex-shrink: 0;
  text-align: right;
}

.cl-store-total {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cl-store-original {
  color: var(--text-2);
  font-size: 11px;
  text-decoration: line-through;
}

.cl-best-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
}

.cl-store-card-tag {
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 11px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.cl-store-card-tag.inactive {
  background: var(--bg-alt);
  color: var(--text-2);
}

.cl-store-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
}

.cl-terms > summary {
  color: var(--text-2);
  font-size: 11px;
  cursor: pointer;
  padding: 9px 0;
}

.cl-terms-content {
  margin-top: 4px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.cl-terms-content p + p {
  margin-top: 6px;
}

.cl-comparison-note {
  margin-top: 12px;
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.7;
}

.cl-split-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px;
  list-style: none;
  cursor: pointer;
}

.cl-split-section > summary::-webkit-details-marker {
  display: none;
}

.cl-split-section > summary::after {
  content: '+';
  color: var(--accent);
  font-size: 22px;
}

.cl-split-section[open] > summary::after {
  content: '\2212';
}

.cl-split-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 400;
}

.cl-split-content {
  padding: 0 16px 16px;
}

.cl-optimal-block + .cl-optimal-block {
  margin-top: 12px;
}

.cl-optimal-store-header,
.cl-optimal-item,
.cl-optimal-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.cl-optimal-store-header {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
}

.cl-optimal-item {
  padding: 8px 0;
  color: var(--text-2);
  font-size: 11px;
}

.cl-optimal-item-name {
  overflow-wrap: anywhere;
}

.cl-optimal-item-price,
.cl-optimal-store-amount {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.cl-optimal-total {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-lt);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.cl-optimal-total-amount {
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
}

.cl-savings-note {
  margin-top: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.cl-footer {
  flex-shrink: 0;
  padding: 18px 24px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.cl-footer[hidden] {
  display: none;
}

.cl-footer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.cl-footer-label {
  font-size: 12px;
  font-weight: 600;
}

.cl-footer-store {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11px;
}

.cl-footer-amount {
  color: var(--accent);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cl-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--surface);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.cl-cta-btn:hover {
  opacity: .88;
}

.cl-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
}

.cl-empty-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--accent-lt);
  color: var(--accent);
}

.cl-empty h3 {
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -.03em;
}

.cl-empty p {
  max-width: 280px;
  margin-bottom: 24px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.8;
}

.cl-empty .cl-cta-btn {
  max-width: 260px;
}

.cl-empty .cl-text-btn {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .cart-drawer {
    width: 100%;
  }

  .cart-drawer-header {
    padding: 20px 16px;
  }

  .cart-body {
    gap: 20px;
    padding: 20px 14px;
  }

  .cl-footer {
    padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  }

  .cl-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px 12px;
  }

  .cl-item-price-wrap {
    grid-column: 1;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    text-align: left;
  }

  .cl-qty-btn {
    width: 40px;
    height: 40px;
  }

  .cl-store-row {
    padding: 14px 12px;
  }

  .cl-store-logo-img {
    width: 28px;
    height: 28px;
  }

  .cl-store-left {
    gap: 8px;
  }

  .cl-store-total {
    font-size: 15px;
  }

  .cl-footer-amount {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer,
  .cart-drawer-backdrop {
    transition: none;
  }
}
