/*
 * store-layout.css — хедер, хиро, футер, сетки каталога
 */

/* ══ ВЕРХНИЙ БЛОК (хедер + категории) — sticky как единое целое ══ */
.site-top {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
}

/* ══ ХЕДЕР ══ */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
}
.brand-tag {
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 1px;
}

/* Поиск в хедере */
.header-search {
  flex: 1;
  max-width: 560px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text);
  transition: all .15s;
}
.header-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45,165,96,0.10);
}
.header-search::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  opacity: 0.5;
  pointer-events: none;
}

/* Правая группа (B2C / B2B пары кнопок) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Пара (B2C или B2B) */
.aud-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.aud-b2c {
  background: rgba(45,165,96,0.08);
  border-color: rgba(45,165,96,0.2);
}
.aud-b2b {
  background: rgba(29,78,216,0.08);
  border-color: rgba(29,78,216,0.2);
}
.aud-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 6px;
}
.aud-b2c .aud-label { color: var(--accent); }
.aud-b2b .aud-label { color: #1d4ed8; }

.aud-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: all .15s;
}
.aud-btn .ic { font-size: 15px; }
.aud-btn:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.aud-btn .cnt {
  background: rgba(255,255,255,0.25);
  color: inherit;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 800;
}
.aud-cart-btn { color: #fff !important; }
.aud-b2c .aud-cart-btn { background: var(--accent); }
.aud-b2c .aud-cart-btn:hover { background: var(--accent-2); }
.aud-b2b .aud-cart-btn { background: #1d4ed8; }
.aud-b2b .aud-cart-btn:hover { background: #1e40af; }

/* Категории-меню */
.cat-menu {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: relative;  /* для абсолютного позиционирования дропдауна */
}
.cat-menu .container {
  padding-top: 8px;
  padding-bottom: 8px;
  position: relative;
}

/* ── Десктопный вариант: горизонтальный скролл ссылок ── */
.cat-menu-desktop {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-menu-desktop::-webkit-scrollbar { display: none; }
.cat-menu-desktop a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  padding: 7px 14px;
  border-radius: 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;  /* Важно: защита от схлопывания из-за глобального min-width: 0 */
}
.cat-menu-desktop a:hover { background: var(--surface-2); color: var(--text); }
.cat-menu-desktop a.active { background: var(--accent-bg); color: var(--accent-2); font-weight: 600; }

/* ── Мобильный вариант: details-выпадашка ── */
.cat-menu-mobile { display: none; }
.cat-menu-mobile summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .15s;
}
.cat-menu-mobile summary::-webkit-details-marker { display: none; }
.cat-menu-mobile summary::marker { display: none; }
.cat-menu-mobile[open] summary {
  background: var(--accent-bg);
  color: var(--accent-2);
}
.cat-menu-mobile[open] .cat-summary-arrow { transform: rotate(180deg); }
.cat-summary-arrow {
  font-size: 14px;
  transition: transform .15s;
  color: var(--muted);
}
.cat-summary-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 16px;
  right: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 90;
  max-height: 70vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
}
.cat-dropdown a:hover { background: var(--surface-2); }
.cat-dropdown a.active { background: var(--accent-bg); color: var(--accent-2); font-weight: 600; }

/* Переключение десктоп / мобильный */
@media (max-width: 720px) {
  .cat-menu-desktop { display: none; }
  .cat-menu-mobile { display: block; }
}

/* ═══ Сворачиваемый блок фильтров (каталог) ═══ */
.filters-block {
  margin-bottom: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.filters-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters-block[open] .filters-arrow { transform: rotate(180deg); }
.filters-arrow { transition: transform .15s; }
.filters-block[open] .filters-summary {
  border-bottom: 1px solid var(--border);
}
.filters-toolbar {
  padding: 16px 18px 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: end;
}
@media (min-width: 721px) {
  .filters-toolbar {
    grid-template-columns: 1fr 1fr 1fr auto;
  }
}
/* На десктопе — summary скрыт (фильтры всегда видны) */
@media (min-width: 721px) {
  .filters-summary { display: none; }
  .filters-toolbar { padding: 16px 20px; }
}

/* ══ HERO (главная) ══ */
.hero {
  background: linear-gradient(135deg, #e8f6ed 0%, #f7f9fb 60%, #fef7ed 100%);
  padding: 60px 0 72px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -80px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(45,165,96,0.08);
  pointer-events: none;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 40px;
  align-items: center;
  position: relative;
}
.hero-title {
  font-size: clamp(28px, 4.5vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.8px;
  margin-bottom: 14px;
}
.hero-title span { color: var(--accent); }
.hero-sub {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 26px;
  max-width: 520px;
}
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.hero-badges {
  display: flex;
  gap: 20px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.hero-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.hero-badge-ic {
  width: 32px; height: 32px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.hero-photo {
  position: relative;
}
.hero-photo-main {
  aspect-ratio: 1;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-photo-main img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* ══ Сетка категорий (крупные тайлы) ══ */
.cat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.cat-tile {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 20px 22px 22px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all .18s;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}
.cat-tile:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--text);
}
.cat-tile-icon {
  width: 52px; height: 52px;
  background: var(--accent-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.cat-tile h3 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}
.cat-tile-count {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: auto;
}

/* ══ Сетка товаров ══ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.product-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all .18s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.product-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-2);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.product-img {
  aspect-ratio: 1;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .product-img img { transform: scale(1.05); }
.product-img-badge {
  position: absolute;
  top: 10px; left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.product-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.product-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  min-height: 38px;
}
.product-meta {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.product-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.product-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}
.product-unit {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.product-actions {
  padding: 0 14px 14px;
}
.product-stock {
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.product-stock.ok  { color: var(--accent); }
.product-stock.low { color: var(--warn); }
.product-stock.out { color: var(--danger); }
.product-stock::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ══ ФУТЕР ══ */
.site-footer {
  background: #1a1f36;
  color: #cbd5e1;
  padding: 50px 0 30px;
  margin-top: 60px;
}
.site-footer h4 {
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.site-footer .container {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 30px;
}
.site-footer a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13.5px;
  display: block;
  padding: 4px 0;
}
.site-footer a:hover { color: #fff; }
.site-footer .foot-about {
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.65;
}
.footer-bottom {
  max-width: 1280px;
  margin: 30px auto 0;
  padding: 20px 20px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-bottom a { display: inline; color: #7dd3fc; }

/* ═════════════════════════════════════════════════════════════════
 * СЕМАНТИЧЕСКИЕ СЕТКИ (классы вместо inline-стилей)
 * Эти классы используются на всех страницах (кроме home — там свой inline).
 * ═════════════════════════════════════════════════════════════════ */

/* Статистика: KPI-карточки. Всегда 2×2 на мобильных, 4 в ряд на десктопе */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (min-width: 900px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}

/* Информационные карточки (B2C vs B2B на главной в кабинете, разделы) */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
@media (min-width: 720px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* Поля формы парами (ФИО + Должность, Email + Телефон, ...) */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .form-row { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* Адреса доставки: плиткой */
.address-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .address-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
}

/* Ряд из 3 одинаковых карточек (например шаблоны заказов) */
.triple-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .triple-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
}

/* Sidebar-layouts для cart/checkout/product-main */
.cart-grid, .checkout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
@media (min-width: 900px) {
  .cart-grid { grid-template-columns: 1fr 340px; gap: 24px; }
  .checkout-grid { grid-template-columns: 1fr 360px; gap: 24px; }
}

.product-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 900px) {
  .product-main { grid-template-columns: minmax(0, 420px) 1fr; gap: 40px; }
}

/* ═════════════════════════════════════════════════════════════════
 * ACCOUNT LAYOUT — кабинет с sidebar (desktop) / горизонтальное меню (mobile)
 * ═════════════════════════════════════════════════════════════════ */
.account-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
.account-sidebar { position: sticky; top: 90px; }
.account-nav { display: flex; flex-direction: column; gap: 2px; }
.account-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
}
.account-nav-item:hover { background: var(--surface-2); }
.account-nav-item.active {
  background: var(--accent-bg);
  color: var(--accent-2);
  font-weight: 600;
}
.account-nav-icon { font-size: 16px; flex-shrink: 0; }
.account-nav-logout {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

/* На планшетах/мобильных — обычный block flow (надёжнее чем grid), горизонтальное меню с скроллом */
@media (max-width: 820px) {
  .account-layout {
    display: block;   /* не grid — ничего не наложится на stat-cards ниже */
  }
  .account-sidebar {
    position: static !important;   /* отменяем sticky из desktop-правила */
    padding: 12px !important;
    margin-bottom: 16px;           /* нормальный отступ до stat-cards */
    display: block;
  }
  .account-main {
    display: block;
    margin-top: 0;
  }
  .account-user {
    margin-bottom: 10px !important;
    padding-bottom: 10px !important;
  }
  .account-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 2px 4px 4px;
    margin: 0 -4px;  /* чтобы компенсировать padding и иметь edge-to-edge */
  }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav-item {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 10px;
    white-space: nowrap;
    font-size: 13px;
  }
  .account-nav-item.active {
    box-shadow: 0 2px 6px rgba(45,165,96,.15);
  }
  .account-nav-item:last-child {
    padding-right: 14px;
    margin-right: 14px;  /* запас справа — последний элемент не обрезается */
  }
  .account-nav-logout {
    margin-top: 0;
    padding-top: 8px;
    border-top: none;
    border-left: 1px solid var(--border);
    padding-left: 12px;
    margin-left: 4px;
  }
}

/* ═════════════════════════════════════════════════════════════════
 * АДАПТИВ — единый блок для всех мобильных устройств
 * Принцип: то, что отлично работает на главной странице,
 * применяется ко всем страницам одинаково.
 * ═════════════════════════════════════════════════════════════════ */

/* ── TABLET / NARROW DESKTOP (≤900px): hero в одну колонку ── */
@media (max-width: 900px) {
  .hero { padding: 40px 0 48px; }
  .hero-inner { grid-template-columns: 1fr; gap: 24px; }
  .hero-photo { order: -1; max-width: 320px; margin: 0 auto; }
  .site-footer .container { grid-template-columns: 1fr 1fr; }

  /* Хедер — переносим поиск на вторую строку */
  .site-header .container {
    flex-wrap: wrap;
    gap: 10px;
  }
  .header-search {
    order: 99;
    flex-basis: 100%;
    max-width: 100%;
  }
  .header-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-actions > div {
    flex: 0 1 auto;
    min-width: 0;
  }
}

/* ── Сравнение "Было / Стало" и аудитории — 1 колонка на ≤820 ── */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 820px) {
  .compare-grid { grid-template-columns: 1fr; }
  .audience-grid { grid-template-columns: 1fr !important; }
}

/* ═══ MOBILE (≤720px) — основная мобильная раскладка ═══ */
@media (max-width: 720px) {
  /* — Контейнер — компактный padding — */
  .container { padding: 0 14px; }

  /* — Хедер — всё компактно — */
  .site-header .container {
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }
  .brand-tag { display: none; }
  .brand-name { font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }

  /* B2C/B2B группы компактно */
  .header-actions { gap: 6px; }
  .aud-group { padding: 2px; gap: 2px; }
  .aud-label { padding: 0 4px; font-size: 9.5px; letter-spacing: 0.5px; }
  .aud-btn { padding: 5px 7px; font-size: 11px; gap: 4px; border-radius: 7px; }
  .aud-btn .ic { font-size: 13px; }
  .aud-btn .lbl { display: none; }
  .aud-btn .cnt { padding: 1px 5px; font-size: 10px; }

  /* — Category menu (details) — уже компактный — */
  .cat-menu .container {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* — Секции — компактный padding — */
  .section, .section-lg { padding-top: 22px; padding-bottom: 22px; }

  /* — Карточки — компактные — */
  .card-white { padding: 16px; margin-bottom: 12px; }

  /* — Заголовки — размер меньше — */
  h1, .page-title { font-size: 22px; }
  h2, .section-title { font-size: 18px; }

  /* — Page head (крошки + h1 + описание) — компактно — */
  .page-head { margin-bottom: 14px; }
  .cat-desc { display: none; }
  .breadcrumbs { font-size: 11.5px; margin-bottom: 2px; }
  .breadcrumbs a { text-decoration: none; color: var(--muted); }

  /* — flex-between всегда переносится — */
  .flex-between { flex-wrap: wrap; }

  /* — Hero — компактный — */
  .hero { padding: 30px 0 36px; }
  .hero-photo { max-width: 280px; }

  /* — Product grid — ВСЕГДА 2 колонки на мобильных — */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .product-body { padding: 10px 10px 12px; gap: 6px; }
  .product-actions { padding: 0 10px 10px; }
  .product-name { font-size: 12.5px; min-height: 34px; line-height: 1.3; }
  .product-meta { font-size: 10.5px; }
  .product-price { font-size: 15px; }
  .product-unit { font-size: 10.5px; }
  .product-img-badge { top: 6px; left: 6px; gap: 3px; }
  .product-img-badge .badge { font-size: 10px; padding: 2px 7px; }
  .product-stock { font-size: 10.5px; }

  /* — Category tiles — 2 колонки — */
  .cat-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cat-tile { min-height: 130px; padding: 14px 16px; }
  .cat-tile-icon { width: 40px; height: 40px; font-size: 20px; }

  /* — Футер — 1 колонка — */
  .site-footer { padding: 30px 0 20px; margin-top: 30px; }
  .site-footer .container { grid-template-columns: 1fr; gap: 20px; padding: 0 14px; }
  .site-footer h4 { font-size: 12px; margin-bottom: 10px; }

  /* — Модалы — занимают экран почти полностью — */
  .modal { margin: 10px; max-width: calc(100vw - 20px) !important; }

  /* Старые layout по id теперь управляются через классы — но оставим защиту
   * для случаев, когда классов нет (например, account-grid сверстан через .account-layout). */
  #account-grid {
    grid-template-columns: 1fr !important;
  }

  /* Smart-delivery banner (главная) — 1 колонка + спрячем правую цель-иконку */
  #smart-delivery-banner {
    grid-template-columns: 1fr !important;
    padding: 22px 20px !important;
  }
  #smart-delivery-banner > div:last-child { display: none !important; }

  /* ── ИНЛАЙН-СЕТКИ (по селектору style) ──  */
  /* Двух- и трёхколоночные inline-grid → одна колонка */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Toolbar каталога 4-кол → stack */
  [style*="grid-template-columns:1fr 1fr 1fr auto"],
  [style*="grid-template-columns: 1fr 1fr 1fr auto"] {
    grid-template-columns: 1fr !important;
  }
  /* Sidebar-layouts (260px/340px/360px/400px/420px + 1fr) */
  [style*="grid-template-columns:260px 1fr"],
  [style*="grid-template-columns: 260px 1fr"],
  [style*="grid-template-columns:1fr 340px"],
  [style*="grid-template-columns: 1fr 340px"],
  [style*="grid-template-columns:1fr 360px"],
  [style*="grid-template-columns: 1fr 360px"],
  [style*="grid-template-columns:1fr 400px"],
  [style*="grid-template-columns: 1fr 400px"],
  [style*="minmax(0, 420px) 1fr"],
  [style*="minmax(0,420px) 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Sticky-сайдбары становятся static */
  [style*="position:sticky"], [style*="position: sticky"] {
    position: static !important;
  }

  /* ── КАРТОЧКА ТОВАРА: фото + описание — стеком ── */
  #product-main .hero-photo,
  #product-main > div:first-child {
    max-width: 100%;
  }

  /* ── Корзина (cart-row) — 2 строки: фото в левой колонке, справа инфо и actions ── */
  .cart-row {
    grid-template-columns: 60px 1fr !important;
    grid-template-areas:
      "img info"
      "img actions" !important;
    row-gap: 8px !important;
    padding: 12px 14px !important;
  }
  .cart-row > *:nth-child(1) { grid-area: img; width: 60px !important; height: 60px !important; }
  .cart-row > *:nth-child(2) { grid-area: info; }
  .cart-row > *:nth-child(3) { grid-area: actions; justify-self: start; }
  .cart-row > *:nth-child(4) { grid-area: actions; justify-self: end; text-align: right; }

  /* ── Атрибуты товара (160px 1fr) — уменьшаем ── */
  [style*="grid-template-columns:160px 1fr"] {
    grid-template-columns: 130px 1fr !important;
    font-size: 12.5px !important;
    padding: 8px 12px !important;
  }

  /* ── Контакт-строки (110px 1fr) — оставляем ── */
  /* ── Bonus history (1fr 120px 120px) — уменьшаем ── */
  [style*="grid-template-columns:1fr 120px 120px"] {
    grid-template-columns: 1fr 80px 80px !important;
    gap: 6px !important;
    font-size: 11.5px !important;
    padding: 8px 10px !important;
  }

  /* Mini-info/stat tiles — 2 колонки на всех мобильных (вместо 1 по auto-fit) */
  [style*="minmax(160px, 1fr)"],
  [style*="minmax(180px, 1fr)"],
  [style*="minmax(200px, 1fr)"],
  [style*="minmax(220px, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── УЗКИЕ PHONE (≤520px) — дополнительные подстройки ── */
@media (max-width: 520px) {
  /* Hero badges/CTA — в столбик */
  .hero-badges { flex-direction: column; align-items: flex-start; gap: 10px; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; }

  /* Большие minmax (240+) на узких — 1 колонка (они уже слишком крупные под 2 cols) */
  [style*="minmax(240px"],
  [style*="minmax(280px"],
  [style*="minmax(300px"] {
    grid-template-columns: 1fr !important;
  }
}

/* Stat/mini-info карточки (minmax 160–220) остаются 2×2 на всех мобильных — как на главной.
 * Ранее было правило @media (max-width: 360px) { → 1fr }, которое портило account-страницу.
 * Убрано: 2×2 красивее и компактнее даже на 320px с уменьшенным шрифтом ниже. */

/* ── УЛЬТРА-УЗКИЕ (≤380px, например iPhone SE 1st gen) — тонкие подгонки, НО 2 колонки для товаров ── */
@media (max-width: 380px) {
  .container { padding: 0 10px; }
  h1, .page-title { font-size: 20px; }
  .product-name { font-size: 11.5px; min-height: 32px; }
  .product-price { font-size: 14px; }
  .product-grid { gap: 8px; }
  /* Stat/mini-info карточки на узких экранах — компактнее внутри (чтобы 2×2 выглядели аккуратно) */
  [style*="minmax(160px, 1fr)"] > .card-white,
  [style*="minmax(180px, 1fr)"] > .card-white,
  [style*="minmax(200px, 1fr)"] > .card-white,
  [style*="minmax(220px, 1fr)"] > .card-white {
    padding: 12px !important;
  }
  /* Критично: product-grid остаётся 2 колонки даже здесь */
}
