/* ══════════════════════════════════════════════════════════
   Megafood — Оптовый каталог v11
   Цвета: красный #E8312A + белый
   ══════════════════════════════════════════════════════════ */

:root {
  --red:         #E8312A;
  --red-dark:    #C0251F;
  --red-bg:      #FFF0EF;
  --text:        #1A1A1A;
  --text-soft:   #666;
  --bg:          #F7F7F7;
  --card-bg:     #FFFFFF;
  --border:      #E0E0E0;
  --shadow:      0 1px 6px rgba(0,0,0,0.09);
  --shadow-lg:   0 4px 20px rgba(0,0,0,0.14);
  --radius:      12px;
  --radius-sm:   7px;
  --topbar-h:    60px;
  --toolbar-h:   104px;   /* search 48 + cats 56 */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  padding-top: calc(var(--topbar-h) + var(--toolbar-h));
  overflow-x: hidden;
}

/* ── Шапка ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  height: var(--topbar-h);
  background: var(--red);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  box-shadow: 0 2px 10px rgba(232,49,42,0.35);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar__logo  { height: 52px; width: auto; flex-shrink: 0; }
.topbar__name  { font-size: 1.2rem; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.topbar__contacts { flex: 1; color: rgba(255,255,255,.75); font-size: 0.85rem; margin-left: 8px; }
.topbar__cart-btn {
  position: relative;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 10px;
  color: #fff; font-size: 1.4rem;
  width: 52px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.topbar__cart-btn:hover  { background: rgba(255,255,255,.28); }
.topbar__cart-btn:active { background: rgba(255,255,255,.38); }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: #fff; color: var(--red);
  font-size: .7rem; font-weight: 800;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--red);
}

/* ── Toolbar: поиск + категории ─────────────────────────── */
.toolbar {
  position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 200;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  height: 48px;
}
.search-bar__icon { font-size: 1.1rem; color: var(--text-soft); flex-shrink: 0; }
.search-bar__input {
  flex: 1; border: none; outline: none;
  font-size: 0.95rem; color: var(--text); background: transparent;
  font-family: inherit;
}
.search-bar__input::placeholder { color: #aaa; }
.search-bar__clear {
  background: #e0e0e0; border: none; border-radius: 50%;
  width: 26px; height: 26px; font-size: .85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.cats {
  display: flex; align-items: center; gap: 6px;
  height: 56px; padding: 0 14px;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex-shrink: 0;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 20px; padding: 7px 14px;
  font-size: 0.82rem; font-weight: 600; color: var(--text-soft);
  cursor: pointer; white-space: nowrap;
  transition: all .15s; -webkit-tap-highlight-color: transparent;
}
.cat:hover  { border-color: var(--red); color: var(--red); }
.cat.active { background: var(--red); border-color: var(--red); color: #fff; }
.cat--sale  { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.cat--sale.active { background: var(--red); color: #fff; }

/* ── Каталог / сетка ─────────────────────────────────────── */
.catalog-screen {
  max-width: 1400px; margin: 0 auto;
  padding: 20px 20px 140px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.empty-msg { text-align: center; padding: 60px 20px; color: var(--text-soft); }

/* ── Карточка ─────────────────────────────────────────────── */
.card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  overflow: hidden; position: relative;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.card__badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 800; padding: 2px 7px;
  border-radius: 8px; text-transform: uppercase; letter-spacing: .4px;
}

.card__pic {
  height: 148px; display: flex; align-items: center; justify-content: center;
  background: var(--red-bg); overflow: hidden; position: relative;
}
/* Expiry — top-right overlay */
.card__expiry-badge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(0,0,0,.52); color: #fff;
  font-size: .58rem; font-weight: 700; padding: 2px 6px;
  border-radius: 6px; line-height: 1.4; backdrop-filter: blur(2px);
  white-space: nowrap; max-width: calc(100% - 12px);
  overflow: hidden; text-overflow: ellipsis;
}
/* Price — bottom-left overlay */
.card__price-badge {
  position: absolute; bottom: 6px; left: 6px; z-index: 2;
  background: var(--red); color: #fff;
  font-size: .75rem; font-weight: 800; padding: 3px 8px;
  border-radius: 7px; line-height: 1.3;
  display: flex; align-items: center; gap: 4px;
}
.card__price-old {
  font-size: .62rem; font-weight: 600; opacity: .7;
  text-decoration: line-through;
}

.card__emoji { font-size: 3rem; line-height: 1; }
.card__img   { max-width: 100%; max-height: 100%; object-fit: contain; padding: 8px; }

.card__body {
  padding: 8px 12px 6px; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.card__tag  { font-size: .78rem; color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.card__name { font-size: 1.12rem; font-weight: 800; line-height: 1.35; color: var(--text); }
.card__pkg  { font-size: .95rem; color: var(--text); font-weight: 600; margin-top: 2px; }
.card__vol  { font-weight: 800; color: var(--text); font-size: .88rem; }
.card__blk  { font-weight: 600; color: var(--text); font-size: .82rem; }
.card__cheese-note { font-size: .75rem; color: var(--text-soft); margin-top: 1px; }

.card__actions { padding: 8px 12px 12px; }

.btn-add {
  width: 100%; height: 44px;
  background: var(--red); color: #fff; border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: background .12s; -webkit-tap-highlight-color: transparent;
}
.btn-add:hover  { background: var(--red-dark); }
.btn-add:active { background: var(--red-dark); }

/* Блоки-степпер */
.stepper {
  display: flex; align-items: center; height: 38px;
  border: 2px solid var(--red); border-radius: var(--radius-sm); overflow: hidden;
}
.stepper__btn {
  width: 42px; height: 100%;
  background: var(--red-bg); border: none;
  font-size: 1.3rem; font-weight: 700; color: var(--red-dark);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.stepper__btn:hover  { background: #ffd5d3; }
.stepper__btn:active { background: #ffc0bc; }
.stepper__info {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #fff; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  height: 100%; min-width: 0;
}
.stepper__blocks { font-size: .95rem; font-weight: 800; color: var(--red); line-height: 1; }
.stepper__units  { font-size: .6rem; color: var(--text-soft); line-height: 1.2; }

/* ── Шторки ─────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 500;
  background: #fff; display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sheet.open { transform: translateY(0); }

.sheet__header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 2px solid var(--border);
  flex-shrink: 0; background: #fff;
}
.sheet__back {
  background: none; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 14px;
  font-size: .9rem; font-weight: 700; cursor: pointer; height: 40px;
  display: flex; align-items: center;
}
.sheet__back:hover { background: var(--bg); }
.sheet__title { font-size: 1.1rem; font-weight: 800; }

.sheet__body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 18px;
  max-width: 700px; width: 100%; margin: 0 auto;
}
.sheet__footer {
  padding: 14px 18px; border-top: 2px solid var(--border);
  flex-shrink: 0; display: flex; flex-direction: column; gap: 10px;
  max-width: 700px; width: 100%; margin: 0 auto;
}

/* Корзина */
.empty-cart { text-align: center; color: var(--text-soft); padding: 40px 20px; }
.cart-item  { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item__emoji { width: 50px; height: 50px; background: var(--red-bg); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 1.8rem; flex-shrink: 0; overflow: hidden; }
.cart-item__img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 4px; }
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { font-size: .88rem; font-weight: 700; line-height: 1.3; }
.cart-item__detail { font-size: .78rem; color: var(--text-soft); margin-top: 2px; }
.cart-item__right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.cart-item__sum  { font-size: .95rem; font-weight: 800; color: var(--red); white-space: nowrap; }
.cart-stepper { display: flex; align-items: center; gap: 0; border: 2px solid var(--red); border-radius: 8px; overflow: hidden; }
.cart-step-btn {
  width: 34px; height: 32px; background: var(--red-bg); border: none;
  font-size: 1.2rem; font-weight: 700; color: var(--red-dark);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.cart-step-btn:active { background: var(--red); color: #fff; }
.cart-step-val { min-width: 28px; text-align: center; font-size: .9rem; font-weight: 800; color: var(--text); }
.cart-total-line { font-size: 1rem; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.cart-total-line strong { font-size: 1.25rem; color: var(--red); }

/* Форма заказа */
.order-summary { background: var(--red-bg); border: 1.5px solid var(--red); border-radius: var(--radius); padding: 14px; margin-bottom: 18px; }
.order-summary-title { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--red-dark); margin-bottom: 10px; }
.order-line { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; padding: 3px 0; border-bottom: 1px solid rgba(232,49,42,.15); }
.order-line:last-child { border-bottom: none; }
.order-total { display: flex; justify-content: space-between; font-weight: 800; font-size: .95rem; margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--red); color: var(--red-dark); }

.order-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: .88rem; font-weight: 700; }
.field__input {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .95rem; color: var(--text);
  background: var(--bg); outline: none; width: 100%;
  transition: border-color .15s; font-family: inherit;
}
.field__input:focus { border-color: var(--red); background: #fff; }
.field__textarea { resize: vertical; min-height: 68px; }
.order-status { font-size: .88rem; font-weight: 600; padding: 8px 0; min-height: 18px; color: var(--text-soft); }
.order-status--error   { color: #C62828; }
.order-status--ok      { color: #2E7D32; }
.order-status--loading { color: var(--red); }

/* Успех */
.sheet--success { display: flex; align-items: center; justify-content: center; }
.success-content { text-align: center; padding: 30px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.success-icon  { font-size: 5rem; }
.success-title { font-size: 1.5rem; font-weight: 800; color: #2E7D32; }
.success-text  { font-size: .95rem; color: var(--text-soft); max-width: 280px; }

/* Кнопки */
.btn-primary {
  background: var(--red); color: #fff; border: none;
  border-radius: var(--radius); font-size: .95rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s; -webkit-tap-highlight-color: transparent;
}
.btn-primary:hover  { background: var(--red-dark); }
.btn-secondary {
  background: #fff; color: var(--text); border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: .95rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s;
}
.btn-secondary:hover { background: var(--bg); }
.btn-large { width: 100%; height: 50px; font-size: 1rem; }

.shade { position: fixed; inset: 0; z-index: 490; background: rgba(0,0,0,.4); }

[hidden] { display: none !important; }

/* ── Десктоп адаптация ────────────────────────────────── */
@media (min-width: 640px) {
  .topbar__contacts { display: block; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
  .card__pic { height: 150px; }
  .sheet__body, .sheet__footer { max-width: 800px; }
}
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
  .catalog-screen { padding: 24px 32px 50px; }
  .card__pic { height: 160px; }
  /* Корзина/заказ как боковая панель на десктопе */
  .sheet {
    left: auto; width: min(480px, 100%);
    transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 40px rgba(0,0,0,.14);
  }
  .sheet.open { transform: translateX(0); }
  .sheet--success {
    left: 0; width: 100%;
    transform: translateY(100%);
  }
  .sheet--success.open { transform: translateY(0); }
  .sheet__body, .sheet__footer { max-width: 100%; }
}

/* ── Мобильный ────────────────────────────────────────── */
@media (max-width: 420px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .catalog-screen { padding: 12px 10px 140px; }
  .topbar__contacts { display: none; }
  html { font-size: 14px; }
}

/* ══ Админ ═══════════════════════════════════════════════ */
body[data-page="admin"] {
  padding-top: 0; background: #f3f3f3;
}
.admin-topbar {
  background: var(--red); color: #fff;
  padding: 16px 20px; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; gap: 12px;
}
.admin-tabs {
  display: flex; background: #fff;
  border-bottom: 2px solid var(--border); overflow-x: auto;
}
.admin-tab {
  flex-shrink: 0; padding: 13px 20px; font-size: .88rem; font-weight: 700;
  color: var(--text-soft); border: none; background: none; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.admin-tab.active { color: var(--red); border-bottom-color: var(--red); }
.admin-tab-panel { display: none; padding: 16px; }
.admin-tab-panel.active { display: block; }
.admin-form {
  background: #fff; border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 11px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.admin-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; }
.admin-form input, .admin-form select, .admin-form textarea {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 11px; font-size: .9rem; font-family: inherit; outline: none; background: var(--bg);
}
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--red); background: #fff; }
.admin-form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-btn { padding: 9px 16px; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 700; cursor: pointer; border: none; height: 40px; }
.admin-btn--primary   { background: var(--red); color: #fff; }
.admin-btn--secondary { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.admin-btn--danger    { background: #C62828; color: #fff; }
.admin-btn--sm        { padding: 5px 10px; height: 32px; font-size: .78rem; }
.admin-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 7px 11px; margin-bottom: 12px; }
.admin-search input { border: none; outline: none; font-size: .9rem; flex: 1; background: none; font-family: inherit; }
.admin-item { background: #fff; border-radius: var(--radius-sm); padding: 11px; margin-bottom: 7px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.admin-item.is-hidden { opacity: .5; }
.admin-item__pic { width: 48px; height: 48px; background: var(--red-bg); border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; overflow: hidden; }
.admin-picture { max-width: 100%; max-height: 100%; object-fit: contain; padding: 2px; }
.admin-item__info { flex: 1; min-width: 0; }
.admin-item__info b { font-size: .84rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item__info small { font-size: .72rem; color: var(--text-soft); }
.admin-item__actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.admin-switch { display: flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; cursor: pointer; }
.admin-note { color: var(--text-soft); font-size: .88rem; padding: 14px; text-align: center; }
.order-admin-item { background: #fff; border-radius: var(--radius-sm); padding: 13px; margin-bottom: 9px; box-shadow: var(--shadow); border-left: 4px solid var(--red); }
.order-admin-item.is-accepted { border-left-color: #2E7D32; }
.order-admin-head { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; font-weight: 700; margin-bottom: 5px; }
.order-admin-meta { display: flex; gap: 10px; font-size: .78rem; color: var(--text-soft); margin-bottom: 8px; flex-wrap: wrap; }
.order-status-badge { font-size: .74rem; font-weight: 700; padding: 2px 7px; border-radius: 8px; background: var(--red-bg); color: var(--red); }
.order-status-badge.accepted { background: #E8F5E9; color: #2E7D32; }
.order-admin-actions { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.order-admin-actions button { padding: 6px 12px; border-radius: var(--radius-sm); font-size: .78rem; font-weight: 700; cursor: pointer; border: none; background: var(--bg); height: 32px; }
.order-admin-actions .accept { background: #2E7D32; color: #fff; }
.order-admin-actions .danger { background: #C62828; color: #fff; }

/* ══ Language Picker (fullscreen overlay) ══════════════════ */
.lang-picker {
  position: fixed; inset: 0; z-index: 2000;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.lang-picker[hidden] { display: none; }

.lang-picker__box {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 32px 24px; text-align: center;
  max-width: 340px; width: 100%;
}
.lang-picker__logo {
  width: 72px; height: 72px; object-fit: contain;
}
.lang-picker__title {
  font-size: 2rem; font-weight: 800; color: var(--red);
  margin: 0; letter-spacing: -0.5px;
}
.lang-picker__sub {
  font-size: .95rem; color: var(--text-soft); margin: 0;
}
.lang-picker__btns {
  display: flex; gap: 14px; margin-top: 8px; width: 100%;
}
.lang-pick-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #fff; cursor: pointer;
  font-size: .95rem; font-weight: 700; color: var(--text);
  transition: border-color .15s, background .15s, transform .1s;
}
.lang-pick-btn:hover  { border-color: var(--red); background: var(--red-bg); }
.lang-pick-btn:active { transform: scale(.97); }
.lang-flag { font-size: 2.2rem; line-height: 1; }

/* ══ Language Switcher (topbar) ════════════════════════════ */
.lang-switcher {
  display: flex; gap: 4px; margin-left: auto; margin-right: 6px;
}
.lang-btn {
  padding: 5px 9px;
  border: 1.5px solid rgba(255,255,255,.45);
  border-radius: 6px;
  background: transparent; color: #fff;
  font-size: .75rem; font-weight: 700; cursor: pointer;
  opacity: .7; transition: opacity .15s, background .15s;
  line-height: 1; white-space: nowrap;
}
.lang-btn:hover   { opacity: 1; background: rgba(255,255,255,.15); }
.lang-btn.active  { opacity: 1; background: rgba(255,255,255,.25); border-color: #fff; }

/* ── Cheese note in order form ─────────────────────────── */
.order-cheese-note {
  margin-top: 10px; padding: 10px 12px;
  background: #FFF8E1; border-left: 3px solid #FFC107;
  border-radius: 6px; font-size: .82rem; color: #5D4037; line-height: 1.5;
}
.order-line__kg { font-size: .72rem; color: var(--text-soft); margin-left: 4px; }

/* ── Delivery toggle ────────────────────────────────────── */
.delivery-toggle {
  display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap;
}
.delivery-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .95rem; font-weight: 600;
  transition: border-color .15s, background .15s; flex: 1;
  min-width: 140px;
}
.delivery-opt:has(input:checked) {
  border-color: var(--red); background: var(--red-bg); color: var(--red);
}
.delivery-opt input[type="radio"] {
  accent-color: var(--red); width: 18px; height: 18px; flex-shrink: 0;
}

.date-selects { display: flex; gap: 8px; }
.date-sel { flex: 1; min-width: 0; padding: 10px 8px; font-size: .95rem; }

/* ══ View toggle (grid / list) ════════════════════════════ */
.view-toggle {
  display: flex; gap: 3px; flex-shrink: 0; margin-left: 6px;
}
.view-toggle-btn {
  width: 32px; height: 32px;
  border: 1.5px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text-soft);
  font-size: 1.05rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
  line-height: 1;
}
.view-toggle-btn:hover:not(.active) {
  background: var(--red-bg); border-color: var(--red); color: var(--red);
}
.view-toggle-btn.active {
  background: var(--red); border-color: var(--red); color: #fff;
}

/* List view — single column, horizontal cards */
.product-grid.is-list {
  grid-template-columns: 1fr;
}
.product-grid.is-list .card {
  flex-direction: row;
  align-items: stretch;
  min-height: 100px;
}
.product-grid.is-list .card__pic {
  width: 110px;
  height: auto;
  flex-shrink: 0;
}
.product-grid.is-list .card__body {
  padding: 10px 12px;
  justify-content: center;
  flex: 1;
}
.product-grid.is-list .card__actions {
  padding: 8px 14px;
  display: flex; align-items: center; justify-content: flex-end;
  border-top: none; border-left: 1px solid var(--border);
  min-width: 150px; flex-shrink: 0;
}
.product-grid.is-list .card__actions .btn-add,
.product-grid.is-list .card__actions .stepper {
  width: 130px;
}

/* ══ Админка: PC layout ══════════════════════════════════= */
.admin-form-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-form-row label { min-width: 0; overflow: hidden; }
.admin-form-row input[type="file"] { width: 100%; font-size: .75rem; }
.admin-vol-row { display: flex; gap: 6px; }
.admin-vol-row input  { flex: 1; min-width: 0; }
.admin-vol-row select { width: 72px; flex-shrink: 0; }

/* Category filter in admin */
.admin-cats {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 0 0 12px;
}
.admin-cat-btn {
  padding: 5px 11px; border-radius: 20px; font-size: .78rem; font-weight: 700;
  border: 1.5px solid var(--border); background: #fff; color: var(--text-soft);
  cursor: pointer; white-space: nowrap; transition: all .12s;
}
.admin-cat-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.admin-cat-btn.active { background: var(--red); border-color: var(--red); color: #fff; }

@media (min-width: 860px) {
  body[data-page="admin"] { background: #eef0f3; }

  .admin-topbar { padding: 14px 32px; }
  .admin-tabs { padding: 0 32px; }

  .admin-products-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    padding: 24px 32px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
  }

  .admin-tab-panel { padding: 0; }
  .admin-tab-panel.active { display: block; }

  .admin-form-col {
    position: sticky;
    top: 24px;
  }
  .admin-form {
    margin-bottom: 0;
  }

  .admin-list-col { min-width: 0; }

  /* Карточки в списке — немного крупнее на десктопе */
  .admin-item__info b { font-size: .9rem; }
  .admin-item__pic { width: 56px; height: 56px; }
}

@media (max-width: 859px) {
  .admin-products-layout {
    display: block;
    padding: 16px;
  }
}

/* ══ FAB Фильтры ═══════════════════════════════════════════ */
.fab-filter { display: none; } /* moved to toolbar */

/* Filter button in toolbar */
.toolbar-filter-btn {
  flex-shrink: 0;
  background: #f0f4f8;
  border: 1.5px solid #d0d8e0;
  border-radius: 20px;
  padding: 0 12px;
  height: 36px;
  font-size: .82rem;
  font-weight: 600;
  color: #2C3E50;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.toolbar-filter-btn:active { background: #dce4ed; }
.toolbar-filter-btn.fab-filter--active {
  background: #2C3E50;
  color: #fff;
  border-color: #2C3E50;
}

/* Cart FAB — bottom, 2 sizes bigger */
.fab-cart {
  position: fixed; bottom: 24px; right: 20px; z-index: 350;
  display: flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff;
  border: none; border-radius: 36px;
  padding: 0 28px;
  height: 68px;
  font-size: 1.15rem; font-weight: 700;
  box-shadow: 0 6px 24px rgba(232,49,42,.5);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.fab-cart:active { transform: scale(.95); }

/* push scroll-top up when FAB visible */


/* ══ Панель фильтров ════════════════════════════════════════ */
.filter-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 500;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,.15);
  padding: 0 0 calc(env(safe-area-inset-bottom) + 16px);
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  max-height: 82vh; overflow-y: auto;
}
.filter-sheet.is-open {
  transform: translateY(0);
}
.filter-sheet__handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: #ddd; margin: 12px auto 4px;
}
.filter-section { padding: 14px 18px 6px; }
.filter-section__title {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-soft); margin-bottom: 10px;
}

/* Sort pills */
.sort-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.sort-pill {
  padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); font-size: .85rem; cursor: pointer;
  transition: all .15s;
}
.sort-pill.active {
  background: var(--red); color: #fff; border-color: var(--red);
}

/* Filter cats */
.filter-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-cat {
  padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); font-size: .85rem; cursor: pointer;
  transition: all .15s;
}
.filter-cat.active {
  background: var(--red); color: #fff; border-color: var(--red);
}
.filter-cat--sale.active { background: #ff6b35; border-color: #ff6b35; }

/* Apply button */
.filter-apply {
  display: block; width: calc(100% - 36px); margin: 16px 18px 0;
  height: 50px; border-radius: 12px; border: none;
  background: var(--red); color: #fff;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: background .15s;
}
.filter-apply:active { background: var(--red-dark); }

/* ── Retail dual buttons ──────────────────────── */
.retail-act {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.btn-add--box,
.btn-add--pcs {
  flex: 1;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-add--box {
  background: var(--accent, #2C3E50);
  color: #fff;
}
.btn-add--pcs {
  background: #e8f4fd;
  color: #1a6fa8;
  border: 1.5px solid #a8d4f0;
}
.btn-add--box:active { background: #1a252f; }
.btn-add--pcs:active { background: #c8e6fa; }

.retail-row {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: space-between;
  border-radius: 8px;
  padding: 5px 6px;
}
.retail-row--box { background: #f0f4f8; }
.retail-row--pcs { background: #e8f4fd; }
.retail-row__lbl {
  font-size: .72rem;
  font-weight: 600;
  color: #666;
  min-width: 28px;
  flex-shrink: 0;
}
.retail-row__val {
  font-size: .95rem;
  font-weight: 700;
  text-align: center;
  flex: 1;
  white-space: nowrap;
}
.retail-row__kgnote {
  font-size: .72rem;
  color: #1a6fa8;
  text-align: center;
  padding: 2px 6px 4px;
  white-space: nowrap;
}
.retail-row__kg {
  font-size: .72rem;
  color: #888;
}

/* ── Cheese warning banner ───────────────────── */
.cart-cheese-warn {
  background: #fff8e1;
  border-left: 4px solid #f9a825;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .83rem;
  color: #5d4037;
  line-height: 1.45;
  margin-bottom: 10px;
}
.retail-row__kg {
  font-size: .75rem;
  color: #888;
  margin-left: 4px;
}

/* ── Reload confirm modal ────────────────────── */
.reload-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
}
.reload-modal[hidden] { display: none; }
.reload-modal__box {
  background: #fff; border-radius: 16px;
  padding: 28px 24px 20px;
  max-width: 320px; width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  text-align: center;
}
.reload-modal__msg {
  font-size: 1rem; font-weight: 600;
  color: #2C3E50; line-height: 1.5;
  margin: 0 0 20px;
}
.reload-modal__btns {
  display: flex; gap: 12px; justify-content: center;
}
.reload-modal__yes,
.reload-modal__no {
  flex: 1; height: 46px; border: none;
  border-radius: 10px; font-size: 1rem;
  font-weight: 700; cursor: pointer;
}
.reload-modal__yes {
  background: var(--red); color: #fff;
}
.reload-modal__no {
  background: #f0f4f8; color: #2C3E50;
  border: 1.5px solid #d0d8e0;
}
.reload-modal__yes:active { opacity: .85; }
.reload-modal__no:active  { background: #dce4ed; }
