/*=====================================================
  CART — web storefront (отдельный файл, storefront.css не трогаем)
  ✨ Обновлённая версия: современнее, воздушнее, дороже
  📱 Мобильная версия полностью переработана
  🛡️ HTML-структура сохранена — стилизация только через CSS
======================================================*/

.cart-page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 8px 0 48px;
}

/* ===== HEADER — стилизованный заголовок ===== */
.cart-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cart-title {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
  position: relative;
}

/* Подпись с количеством — стилизуем как бейдж */
.cart-subtitle {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(143, 47, 103, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-subtitle::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  flex-shrink: 0;
}

/* Layout */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 300px);
  gap: 28px;
  align-items: start;
}

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

/* Items */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Тонкая левая полоска-акцент при наведении */
.cart-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(0.6);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cart-item:hover {
  border-color: rgba(143, 47, 103, 0.22);
  box-shadow: 0 8px 24px rgba(143, 47, 103, 0.08), var(--shadow-sm);
  transform: translateY(-3px);
}

.cart-item:hover::before {
  opacity: 1;
  transform: scaleY(1);
}

/* Анимация удаления: scale + fade + сдвиг вправо */
.cart-item.is-removing {
  opacity: 0;
  pointer-events: none;
  transform: translateX(40px) scale(0.95);
  max-height: 0;
  padding: 0;
  margin: 0;
  gap: 0;
  border: none;
  overflow: hidden;
  transition: 
    opacity 0.35s ease,
    transform 0.35s ease,
    max-height 0.35s ease 0.1s,
    padding 0.3s ease,
    margin 0.3s ease,
    gap 0.3s ease;
}

.cart-item-image {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  aspect-ratio: 1;
  transition: transform 0.3s ease;
}

.cart-item:hover .cart-item-image {
  transform: scale(1.03);
}

.cart-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cart-item-placeholder {
  width: 100%;
  height: 100%;
  min-height: 100px;
  display: grid;
  place-items: center;
  font-size: 2rem;
  background: var(--surface-2);
}

.cart-item-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 12px;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.cart-item-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  transition: color 0.2s ease;
}

.cart-item-name:hover {
  color: var(--accent);
}

.cart-item-meta {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cart-item-remove {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.cart-item-remove svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.cart-item-remove:hover {
  color: var(--danger);
  background: rgba(212, 88, 88, 0.1);
  transform: rotate(8deg);
}

.cart-item-remove:hover svg {
  transform: rotate(-16deg);
}

.cart-item-remove:active {
  transform: scale(0.88) rotate(0deg);
}

.cart-item-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

/* Цена товара — крупнее, с градиентом */
.cart-item-price {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: transform 0.2s ease;
}

.cart-item-price.is-updating {
  animation: pricePulse 0.4s ease;
}

@keyframes pricePulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.12); }
  60%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

/* Quantity controls */
.cart-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cart-qty:focus-within {
  border-color: rgba(143, 47, 103, 0.35);
  box-shadow: 0 0 0 3px rgba(143, 47, 103, 0.08);
}

.cart-qty--locked {
  gap: 8px;
  padding: 8px 14px;
}

.cart-qty-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: lowercase;
}

.cart-qty-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
  display: grid;
  place-items: center;
}

.cart-qty-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.cart-qty-btn:active {
  transform: scale(0.88);
}

.cart-qty-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cart-qty-input {
  width: 56px;
  height: 34px;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  -moz-appearance: textfield;
  outline: none;
  transition: color 0.2s ease;
}

.cart-qty-input::-webkit-outer-spin-button,
.cart-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Пульсация при изменении количества */
.cart-qty-input.is-changing {
  animation: qtyFlash 0.35s ease;
}

@keyframes qtyFlash {
  0%   { color: var(--text); }
  40%  { color: var(--accent); transform: scale(1.15); }
  100% { color: var(--text); transform: scale(1); }
}

.cart-qty-unit {
  padding-right: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== SUMMARY — обновлённый блок «Итого» ===== */
.cart-summary {
  position: sticky;
  top: 160px;
}

.cart-summary-card {
  padding: 24px 22px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.3) 30%, transparent 31%),
    repeating-radial-gradient(ellipse at 55% 50%, rgba(196, 112, 74, 0.1) 0 2px, transparent 2px 10px),
    linear-gradient(160deg, #fffaf6 0%, #f8ece4 40%, #f3e0d4 100%);
  border: 1px solid rgba(196, 112, 74, 0.2);
  border-radius: var(--radius-md);
  box-shadow:
    0 4px 20px rgba(196, 112, 74, 0.08),
    0 1px 3px rgba(74, 59, 43, 0.06);
  position: relative;
  overflow: hidden;
}

/* Декоративная верхняя полоска */
.cart-summary-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #c4704a, var(--accent));
  opacity: 0.6;
}

.cart-summary-title {
  margin: 0 0 20px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

/* Убрали строку «Товары», оставили только крупный итог */
.cart-summary-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(196, 112, 74, 0.25);
}

.cart-summary-total-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cart-summary-total-price {
  font-weight: 900;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
  transition: transform 0.3s ease;
}

.cart-summary-total-price.is-updating {
  animation: totalPulse 0.5s ease;
}

@keyframes totalPulse {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.08); }
  50%  { transform: scale(0.97); }
  75%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.cart-summary-note {
  margin: 0 0 18px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Кнопка оформления — градиент + свечение */
.cart-checkout-btn {
  width: 100%;
  margin-bottom: 14px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: block;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 32%),
    linear-gradient(135deg, var(--accent), #a63a78 55%, #6e1f4e);
  box-shadow:
    0 6px 18px rgba(143, 47, 103, 0.35),
    inset 0 -3px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.cart-checkout-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cart-checkout-btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 10px 28px rgba(143, 47, 103, 0.45),
    inset 0 -3px 8px rgba(0, 0, 0, 0.15);
}

.cart-checkout-btn:hover::before {
  opacity: 1;
}

.cart-checkout-btn:active {
  transform: translateY(0) scale(0.98);
}

.cart-continue {
  display: block;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

.cart-continue::before {
  content: "← ";
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: inline-block;
}

.cart-continue:hover {
  color: var(--accent);
}

.cart-continue:hover::before {
  opacity: 0.8;
  transform: translateX(-3px);
}

/* Empty state — плавающая иконка + мягкий фон */
.cart-empty {
  text-align: center;
  padding: 56px 24px 40px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.5) 40%, transparent 41%),
    linear-gradient(180deg, var(--surface) 0%, #faf5f2 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.cart-empty::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 47, 103, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.cart-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  display: inline-block;
  animation: floatY 3s ease-in-out infinite;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.cart-empty h2 {
  margin: 0 0 10px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}

.cart-empty p {
  margin: 0 0 26px;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Quick add on cards */
.card {
  position: relative;
}
.card-add-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 5;

    width: 38px;
    height: 38px;
    padding: 0;

    display: grid;
    place-items: center;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.88);
    color: rgba(36, 33, 29, 0.62);

    cursor: pointer;

    /* всегда видна — иначе на тач-устройствах «некуда тыкать» */
    opacity: 1;
    transform: scale(1);

    box-shadow:
        0 3px 12px rgba(74, 59, 43, 0.12),
        0 1px 3px rgba(74, 59, 43, 0.08);

    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    transition:
        opacity 0.22s ease,
        transform 0.22s cubic-bezier(.22, .61, .36, 1),
        color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover .card-add-btn,
.card-add-btn:focus-visible {
    opacity: 1;
    transform: scale(1.05);
}

.card-add-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none;

    transition:
        transform 0.2s ease,
        stroke-width 0.2s ease;
}

.card-add-btn:hover {
    color: var(--accent);

    background: rgba(255, 255, 255, 0.96);

    transform: scale(1.08);

    box-shadow:
        0 5px 16px rgba(143, 47, 103, 0.18),
        0 0 0 1px rgba(143, 47, 103, 0.08);
}

.card-add-btn:hover svg {
    transform: scale(1.05);
}

.card-add-btn:active {
    transform: scale(0.92);
}

.card-add-btn.is-added {
    color: var(--accent);
    background: var(--accent-light);

    box-shadow:
        0 4px 14px rgba(143, 47, 103, 0.2);
}

@media (hover: none) {
    .card-add-btn {
        opacity: 1;
        transform: scale(1);
    }
}

/* Пока жмём «в корзину» — не красим нижнюю стрелку карточки (card:active) */
.card:has(.card-add-btn:active) .card-btn-icon,
.card:has(.card-add-btn:focus) .card-btn-icon {
    background: linear-gradient(135deg, #ffffff, #f3efe9) !important;
    color: inherit !important;
    transform: none !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05) !important;
}

.card:has(.card-add-btn:active) .card-btn-icon svg {
    transform: none !important;
}

@media (max-width: 768px) {
    .card-add-btn {
        top: 8px;
        right: 8px;

        width: 32px;
        height: 32px;
    }

    .card-add-btn svg {
        width: 18px;
        height: 18px;
    }
}


/* Detail page add block */
.detail-cart-block {
  margin-top: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.detail-cart-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.detail-cart-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.detail-cart-qty input {
  width: 64px;
  height: 38px;
  border: none;
  background: transparent;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  -moz-appearance: textfield;
  outline: none;
}

.detail-cart-qty input::-webkit-outer-spin-button,
.detail-cart-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.detail-cart-qty-btn {
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.detail-cart-qty-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.detail-cart-qty-btn:active {
  transform: scale(0.9);
}

.detail-cart-unit {
  padding-right: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.detail-add-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 22px;
  font-size: 0.95rem;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .detail-cart-block {
    padding: 14px;
    margin-top: 14px;
  }

  .detail-cart-row {
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }

  .detail-cart-qty {
    flex: 0 0 auto;
  }

  .detail-cart-qty-btn {
    width: 34px;
    height: 34px;
    font-size: 1.05rem;
  }

  .detail-cart-qty input {
    width: 48px;
    height: 34px;
    font-size: 0.92rem;
  }

  .detail-cart-unit {
    padding-right: 6px;
    font-size: 0.78rem;
  }

  .detail-add-btn {
    flex: 1 1 0;
    padding: 10px 12px;
    font-size: 0.88rem;
  }
}

.detail-cart-hint {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Header cart badge */
.header-action--cart {
  color: #7a3d28;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.28) 28%, transparent 29%),
    repeating-radial-gradient(ellipse at 52% 54%, rgba(196, 112, 74, 0.18) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #fff6f0, #f5e0d4 48%, #edd4c4);
  box-shadow:
    inset 0 -6px 12px rgba(196, 112, 74, 0.08),
    0 8px 16px rgba(74, 59, 43, 0.08);
}

.header-action--cart:hover {
  color: #5c2e1c;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.35) 28%, transparent 29%),
    repeating-radial-gradient(ellipse at 52% 54%, rgba(196, 112, 74, 0.22) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #fffaf6, #f0d5c6 48%, #e5c4b0);
}

.header-action--cart .header-cart-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 2px 8px rgba(143, 47, 103, 0.5);
  pointer-events: none;
  z-index: 2;
}

/* Бейдж при пустой корзине — «0», иконка всегда видна */
.header-action--cart .header-cart-badge.is-empty {
  display: flex;
  background: rgba(143, 47, 103, 0.35);
  box-shadow: none;
  font-size: 0.68rem;
}

.header-action--cart .header-action-icon,
.header-action--cart .header-action-text {
  opacity: 1;
}

/* Toast */
.cart-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2000;
  transform: translateX(-50%) translateY(20px);
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.cart-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cart-toast.is-error {
  background: var(--danger);
}

.cart-toast.is-success {
  background: var(--green);
}

/* Header grid */
@media (min-width: 1px) {
  .header-nav {
    grid-template-columns: auto minmax(160px, 680px) auto;
  }

  .header-nav-left,
  .header-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .header-nav-left {
    justify-content: flex-start;
  }

  .header-nav-right {
    justify-content: flex-end;
  }
}

.header-action--account {
  color: #1a5c45;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.28) 28%, transparent 29%),
    repeating-radial-gradient(ellipse at 52% 54%, rgba(46, 145, 105, 0.16) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #eefaf4, #d4f0e4 48%, #c5e8d9);
  box-shadow:
    inset 0 -6px 12px rgba(46, 145, 105, 0.08),
    0 8px 16px rgba(74, 59, 43, 0.08);
}

.header-action--account:hover {
  color: #144a38;
  transform: translateY(-2px) scale(1.04);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.35) 28%, transparent 29%),
    repeating-radial-gradient(ellipse at 52% 54%, rgba(46, 145, 105, 0.2) 0 2px, transparent 2px 9px),
    linear-gradient(135deg, #f3fcf7, #dcede4 48%, #b8e0cd);
  box-shadow:
    inset 0 -8px 14px rgba(46, 145, 105, 0.1),
    0 12px 22px rgba(46, 145, 105, 0.16);
}

.header-action--account .header-action-icon,
.header-action--account .header-action-text {
  color: inherit;
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .header-nav {
    height: 64px;
    grid-template-columns: auto minmax(100px, 1fr) auto;
    gap: 6px;
  }

  .header-nav-left,
  .header-nav-right {
    gap: 4px;
  }

  .header-action {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
  }

  .header-action-icon,
  .header-action-icon svg {
    width: 18px;
    height: 18px;
  }

  .header-action--vk .header-action-icon svg text {
    font-size: 12px;
  }

  .header-action--cart .header-cart-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.62rem;
  }

  body {
    padding-top: 84px;
  }
}

@media (max-width: 560px) {
  .header-nav {
    height: 56px;
    gap: 4px;
  }

  .header-nav-left,
  .header-nav-right {
    gap: 3px;
  }

  .header-action {
    width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .header-action-icon,
  .header-action-icon svg {
    width: 16px;
    height: 16px;
  }

  .header-action::before {
    inset: 6px;
  }

  .header-action::after {
    inset: 10px 4px;
  }

  body {
    padding-top: 72px;
  }
}

/* ============================================================
   📱 CART PAGE — MOBILE (полностью переработано)
   ============================================================ */

@media (max-width: 640px) {
  .cart-page {
    padding: 0 16px 24px;
  }

  /* Шапка — заголовок + бейдж в одну строку */
  .cart-header {
    margin-bottom: 20px;
    padding-top: 4px;
    padding-bottom: 14px;
    align-items: center;
  }

  .cart-title {
    font-size: 1.5rem;
    letter-spacing: -0.03em;
  }

  .cart-subtitle {
    padding: 5px 12px;
    font-size: 0.78rem;
  }

  .cart-layout {
    gap: 20px;
  }

  /* Карточка товара — полноценная "плитка" */
  .cart-item {
    grid-template-columns: 80px 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 16px;
    background: #fff;
    border: none;
    box-shadow:
      0 2px 8px rgba(74, 59, 43, 0.06),
      0 0 1px rgba(74, 59, 43, 0.12);
  }

  .cart-item:hover {
    transform: translateY(-2px);
    box-shadow:
      0 6px 20px rgba(143, 47, 103, 0.1),
      0 0 1px rgba(74, 59, 43, 0.12);
  }

  .cart-item::before {
    width: 4px;
    top: 16px;
    bottom: 16px;
  }

  .cart-item-image {
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  }

  .cart-item-placeholder {
    min-height: 80px;
    font-size: 1.8rem;
    border-radius: 12px;
  }

  .cart-item-body {
    gap: 10px;
    justify-content: space-between;
  }

  .cart-item-top {
    align-items: flex-start;
    gap: 8px;
  }

  .cart-item-name {
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
  }

  .cart-item-meta {
    font-size: 0.78rem;
    margin-top: 3px;
  }

  /* Кнопка удаления — крупнее, лучше для пальца */
  .cart-item-remove {
    width: 40px;
    height: 40px;
    margin: -8px -8px 0 0;
    background: rgba(212, 88, 88, 0.06);
  }

  .cart-item-remove svg {
    width: 20px;
    height: 20px;
  }

  .cart-item-remove:hover {
    background: rgba(212, 88, 88, 0.12);
  }

  /* Нижняя часть карточки: количество + цена */
  .cart-item-bottom {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
  }

  /* Количество — компактный, но удобный контрол */
  .cart-qty {
    width: auto;
    flex-shrink: 0;
    padding: 3px;
    gap: 3px;
    background: #f5f0ec;
    border: 1px solid #e8e0da;
    border-radius: 999px;
  }

  .cart-qty-btn {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  }

  .cart-qty-btn:active {
    transform: scale(0.9);
    background: var(--accent-light);
  }

  .cart-qty-input {
    width: 44px;
    height: 36px;
    font-size: 1rem;
  }

  .cart-qty-unit {
    padding-right: 6px;
    font-size: 0.78rem;
  }

  /* Цена — крупная, справа */
  .cart-item-price {
    font-size: 1.2rem;
    font-weight: 900;
    margin-left: auto;
    letter-spacing: -0.02em;
  }

  /* ===== STICKY ИТОГ ВНИЗУ ЭКРАНА ===== */
  .cart-summary {
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-top: 8px;
  }

  .cart-summary-card {
    padding: 16px 20px 24px;
    border-radius: 20px 20px 0 0;
    border: none;
    border-top: 1px solid rgba(196, 112, 74, 0.15);
    box-shadow:
      0 -4px 24px rgba(74, 59, 43, 0.1),
      0 -1px 3px rgba(74, 59, 43, 0.06);
    background:
      radial-gradient(circle at 50% 0%, rgba(255,255,255,0.95), rgba(255,255,255,0.6) 40%, transparent 41%),
      linear-gradient(180deg, #fffaf6 0%, #f8ece4 60%, #f3e0d4 100%);
  }

  .cart-summary-card::after {
    height: 3px;
    border-radius: 0 0 3px 3px;
    top: 0;
    background: linear-gradient(90deg, transparent, var(--accent), #c4704a, var(--accent), transparent);
    opacity: 0.5;
  }

  .cart-summary-title {
    display: none;
  }

  .cart-summary-total {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(196, 112, 74, 0.2);
  }

  .cart-summary-total-label {
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
  }

  .cart-summary-total-price {
    font-size: 1.6rem;
  }

  .cart-summary-note {
    display: none;
  }

  .cart-checkout-btn {
    padding: 16px 20px;
    font-size: 1.05rem;
    border-radius: 14px;
    margin-bottom: 0;
    box-shadow:
      0 6px 20px rgba(143, 47, 103, 0.4),
      inset 0 -3px 8px rgba(0, 0, 0, 0.12);
  }

  .cart-continue {
    display: block;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-top: 10px;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .cart-continue::before {
    content: "← ";
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: inline-block;
  }

  .cart-continue:hover {
    color: var(--accent);
  }

  .cart-continue:hover::before {
    opacity: 1;
    transform: translateX(-3px);
  }

  /* Пустая корзина */
  .cart-empty {
    margin: 16px 0;
    padding: 48px 20px 36px;
    border-radius: 20px;
  }

  .cart-empty-icon {
    font-size: 4rem;
  }

  .cart-empty h2 {
    font-size: 1.3rem;
  }

  .cart-empty p {
    font-size: 0.9rem;
  }
}

/* Очень узкие экраны */
@media (max-width: 380px) {
  .cart-page {
    padding: 0 12px 24px;
  }

  .cart-item {
    grid-template-columns: 64px 1fr;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
  }

  .cart-item-name {
    font-size: 0.92rem;
  }

  .cart-qty-btn {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }

  .cart-qty-input {
    width: 38px;
    height: 32px;
    font-size: 0.9rem;
  }

  .cart-item-price {
    font-size: 1.05rem;
  }

  .cart-summary-total-price {
    font-size: 1.4rem;
  }

  .cart-checkout-btn {
    padding: 14px 16px;
    font-size: 0.95rem;
    border-radius: 12px;
  }

  .header-action {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .header-action-icon,
  .header-action-icon svg {
    width: 14px;
    height: 14px;
  }
}

/* Sticky footer */
html {
  height: 100%;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main.wrap {
  flex: 1 0 auto;
  width: min(1240px, calc(100% - 40px));
}
.site-footer {
  margin-top: auto;
  flex-shrink: 0;
}
