/* =============================================================================
   opt.css — оптовый раздел kusmartkz.com/opt
   Фирменный стиль птицефабрики «Қазгер-Құс» (kazgerkus.kz):
   палитра и пара шрифтов взяты из их themes/demo/assets/css/theme.css.
   Тема светлая — осознанно: раздел живёт внутри корпоративного лендинга
   kusmartkz.com, который тоже светлый.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Фирменные цвета */
  --blue:        #3353A0;
  --blue-deep:   #26407E;
  --blue-pale:   #BDCBEE;
  --blue-wash:   #EEF2FB;

  /* Нейтрали — уведены в синеву фирстиля, а не чистый серый */
  --ink:         #151515;
  --ink-soft:    #3C4250;
  --mute:        #666B76;
  --line:        #DCDCDC;
  --line-soft:   #ECEEF2;
  --ground:      #F5F6F8;
  --card:        #FFFFFF;

  /* Семантика статусов — отдельно от акцента */
  --ok:          #2E7D4F;
  --ok-wash:     #E9F4EE;
  --warn:        #B4771A;
  --warn-wash:   #FBF2E3;
  --danger:      #B3261E;
  --danger-wash: #FBEBEA;
  --yolk:        #E8A33D;

  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 1px 2px rgba(21,21,21,.06), 0 8px 24px rgba(38,64,126,.07);
  --shadow-lift: 0 4px 12px rgba(21,21,21,.08), 0 18px 40px rgba(38,64,126,.12);

  --header-h:    68px;
  --maxw:        1240px;

  --display: "M PLUS Rounded 1c", "Commissioner", system-ui, sans-serif;
  --body:    "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */

.hdr {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.hdr__in {
  max-width: var(--maxw); margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 800; font-size: 17px;
}
.brand__name {
  font-family: var(--display); font-weight: 800; font-size: 17px;
  color: var(--ink); letter-spacing: -.02em; line-height: 1.1;
}
.brand__sub {
  display: block; font-family: var(--body); font-weight: 500;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mute);
}

/* .hdr__menu — обёртка над навигацией и действиями. На десктопе она
   «растворяется» (display:contents), поэтому раскладка шапки не меняется;
   на телефоне превращается в выпадающую панель под шапкой. */
.hdr__menu { display: contents; }

.hdr__nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.hdr__nav a {
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  padding: 6px 0; border-bottom: 2px solid transparent;
}
.hdr__nav a:hover { color: var(--blue); }
.hdr__nav a[aria-current="page"] { color: var(--blue); border-bottom-color: var(--blue); }

.hdr__actions { display: flex; align-items: center; gap: 10px; }

/* Корзина и бургер живут вне .hdr__menu — они нужны всегда */
.hdr__quick { display: flex; align-items: center; gap: 8px; margin-left: 10px; }

.hdr__burger {
  display: none;                       /* включается в мобильной медиа-квери */
  width: 44px; height: 44px; flex-shrink: 0;
  align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); cursor: pointer;
}
.hdr__burger:hover { border-color: var(--blue); color: var(--blue); }
.hdr__burger span,
.hdr__burger span::before,
.hdr__burger span::after {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform .18s, opacity .18s;
}
.hdr__burger span { position: relative; }
.hdr__burger span::before,
.hdr__burger span::after { content: ""; position: absolute; left: 0; }
.hdr__burger span::before { top: -6px; }
.hdr__burger span::after  { top: 6px; }
.hdr__burger[aria-expanded="true"] span { background: transparent; }
.hdr__burger[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.hdr__burger[aria-expanded="true"] span::after  { transform: translateY(-6px) rotate(-45deg); }

/* ── Кнопки ──────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--body); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: background .16s, border-color .16s, color .16s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover:not([disabled]) { background: var(--blue-deep); color: #fff; }

.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover:not([disabled]) { border-color: var(--blue); color: var(--blue); }

.btn--quiet { background: transparent; color: var(--mute); padding: 8px 10px; }
.btn--quiet:hover:not([disabled]) { color: var(--danger); }

.btn--sm { padding: 7px 13px; font-size: 13px; }
.btn--block { width: 100%; }

.btn--cart { position: relative; }
.btn--cart__count {
  position: absolute; top: -6px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--yolk); color: #21160A;
  font-size: 11px; font-weight: 800; line-height: 20px; text-align: center;
}
.btn--cart__count[hidden] { display: none; }

/* ── Герой ───────────────────────────────────────────────────────────────── */

.hero {
  background:
    linear-gradient(105deg, var(--blue-deep) 0%, var(--blue) 58%, #4468B8 100%);
  color: #fff;
  padding: 56px 0 60px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -80px -180px auto;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.10), transparent 68%);
}
.hero__in { position: relative; z-index: 1; max-width: 720px; }
.hero__eyebrow {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--blue-pale); margin-bottom: 14px;
}
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1; }
.hero p {
  margin: 16px 0 0; font-size: 17px; line-height: 1.5;
  color: rgba(255,255,255,.86); max-width: 56ch;
}
.hero__stats {
  display: flex; flex-wrap: wrap; gap: 36px; margin-top: 32px;
  padding-top: 26px; border-top: 1px solid rgba(255,255,255,.2);
}
.hero__stat b {
  display: block; font-family: var(--display); font-size: 26px;
  font-weight: 800; line-height: 1.1;
}
.hero__stat span { font-size: 13px; color: rgba(255,255,255,.75); }

/* ── Каталог ─────────────────────────────────────────────────────────────── */

.catalog { padding: 36px 0 72px; }

.catalog__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.catalog__head h2 { font-size: 26px; }
.catalog__head p { margin: 5px 0 0; color: var(--mute); font-size: 14px; }

.catalog__body {
  display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px;
  align-items: start;
}

.filters {
  position: sticky; top: calc(var(--header-h) + 20px);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px;
  display: flex; flex-direction: column; gap: 20px;
}
.filters__group { display: flex; flex-direction: column; gap: 8px; }
.filters__label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mute);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--body); font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  cursor: pointer; transition: background .14s, border-color .14s, color .14s;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip[aria-pressed="true"] {
  background: var(--blue); border-color: var(--blue); color: #fff;
}

.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field > label,
.filters__label + input { font-size: 13px; }
.field label {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  font-family: var(--body); font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-wash);
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field__hint { font-size: 12px; color: var(--mute); }
.field__err { font-size: 12px; color: var(--danger); }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
}

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .16s, box-shadow .16s, transform .16s;
}
.card:hover {
  border-color: var(--blue-pale); box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.card__media {
  aspect-ratio: 4 / 3; background: var(--blue-wash);
  display: grid; place-items: center; position: relative;
  border-bottom: 1px solid var(--line-soft);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__media svg { width: 62px; height: 62px; opacity: .55; }

.card__grade {
  position: absolute; top: 10px; left: 10px;
  background: var(--blue); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 12px;
  padding: 4px 9px; border-radius: 6px; letter-spacing: .01em;
}
.card__stock {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.94); border-radius: 999px;
  padding: 4px 9px; font-size: 11px; font-weight: 600; color: var(--ink-soft);
}
.card__stock::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--yolk);
}
.card__stock--out { color: var(--danger); }
.card__stock--out::before { background: var(--danger); }

.card__body { padding: 14px 15px 15px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__name { font-family: var(--display); font-size: 15px; font-weight: 700; line-height: 1.3; }
.card__meta { font-size: 12.5px; color: var(--mute); display: flex; flex-wrap: wrap; gap: 4px 10px; }

.card__price { display: flex; align-items: baseline; gap: 7px; margin-top: auto; }
.card__price b { font-family: var(--display); font-size: 21px; font-weight: 800; }
.card__price span { font-size: 12.5px; color: var(--mute); }
.card__price-own {
  font-size: 11px; font-weight: 700; color: var(--ok);
  background: var(--ok-wash); padding: 2px 7px; border-radius: 5px;
}

.qty { display: flex; gap: 8px; }
.qty__unit { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.qty__unit label {
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--mute);
}
.qty__unit input {
  font-family: var(--body); font-size: 14px; font-variant-numeric: tabular-nums;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  width: 100%; text-align: center;
}
.qty__unit input:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash);
}

/* ── Корзина (выезжает справа) ───────────────────────────────────────────── */

.scrim {
  position: fixed; inset: 0; background: rgba(21,21,21,.42);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 60;
}
.scrim[data-open="true"] { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(440px, 100%); max-width: 100vw; background: var(--ground);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  box-shadow: -12px 0 40px rgba(21,21,21,.16);
}
.drawer[data-open="true"] { transform: none; }

.drawer__head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px; background: #fff; border-bottom: 1px solid var(--line);
}
.drawer__head h2 { font-size: 18px; margin-right: auto; }
.drawer__body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px;
}
/* env(safe-area-inset-bottom) — чтобы кнопка оформления не пряталась
   под домашней полосой iPhone и жестовой панелью Android. */
.drawer__foot {
  padding: 16px 20px max(20px, env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line);
}

.line {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 13px; display: flex; flex-direction: column; gap: 6px;
}
.line__top { display: flex; gap: 10px; align-items: flex-start; }
.line__name { font-size: 14px; font-weight: 600; line-height: 1.35; flex: 1; }
.line__meta { font-size: 12.5px; color: var(--mute); }
.line__sum {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px;
}
.line__sum b { font-family: var(--display); font-size: 16px; }

.total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.total span { font-size: 14px; color: var(--mute); }
.total b { font-family: var(--display); font-size: 25px; font-weight: 800; }

.empty {
  text-align: center; color: var(--mute); padding: 44px 20px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.empty svg { width: 46px; height: 46px; opacity: .3; }
.empty b { font-family: var(--display); color: var(--ink); font-size: 16px; }

/* ── Формы-страницы (вход, регистрация) ──────────────────────────────────── */

.auth {
  min-height: calc(100vh - var(--header-h));
  display: grid; place-items: center; padding: 44px 24px 64px;
}
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 30px; width: 100%;
}
.panel--auth { max-width: 440px; }
.panel--wide { max-width: none; }
.panel__head { margin-bottom: 22px; }
.panel__head h1 { font-size: 24px; }
.panel__head p { margin: 7px 0 0; color: var(--mute); font-size: 14px; }

.form { display: flex; flex-direction: column; gap: 15px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form__foot { margin-top: 4px; display: flex; flex-direction: column; gap: 12px; }
.form__alt { text-align: center; font-size: 14px; color: var(--mute); }

.alert {
  border-radius: var(--radius); padding: 11px 14px; font-size: 14px;
  border: 1px solid transparent; line-height: 1.45;
}
.alert--err  { background: var(--danger-wash); border-color: #F0C9C6; color: #8A1E17; }
.alert--ok   { background: var(--ok-wash);     border-color: #C3E2CF; color: #1E5B39; }
.alert--info { background: var(--blue-wash);   border-color: var(--blue-pale); color: var(--blue-deep); }
.alert[hidden] { display: none; }

/* ── Кабинет и админка ───────────────────────────────────────────────────── */

.page { padding: 32px 0 72px; }
.page__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 22px;
}
.page__head h1 { font-size: 27px; }
.page__head p { margin: 5px 0 0; color: var(--mute); font-size: 14px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 24px; align-items: start; }

.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--mute);
  padding: 0 14px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td {
  padding: 13px 14px; border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.tbl tbody tr:hover { background: var(--blue-wash); }
table.tbl td.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--line-soft); color: var(--ink-soft);
}
.pill--new     { background: var(--blue-wash);   color: var(--blue-deep); }
.pill--work    { background: var(--warn-wash);   color: var(--warn); }
.pill--done    { background: var(--ok-wash);     color: var(--ok); }
.pill--dead    { background: var(--danger-wash); color: var(--danger); }

.order-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.order-card__top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.order-card__no { font-family: var(--display); font-size: 17px; font-weight: 800; }
.order-card__date { font-size: 13px; color: var(--mute); margin-left: auto; }
.order-card__items { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.order-card__item { display: flex; gap: 12px; }
.order-card__item span:first-child { flex: 1; }
.order-card__foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.order-card__total { font-family: var(--display); font-size: 18px; font-weight: 800; margin-left: auto; }
.order-card__note {
  background: var(--blue-wash); border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; color: var(--ink-soft);
}
.order-card__note b { font-weight: 700; }
.order-card__pay { margin-top: 12px; }

/* ── Оплата: модальное окно ─────────────────────────────────────────────── */

.pm {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
  background: rgba(21, 21, 21, .5);
}
.pm__box {
  position: relative; width: 100%; max-width: 640px; margin: auto;
  background: var(--card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift); padding: 22px 22px 26px;
}
.pm__close {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  font-size: 22px; line-height: 1; color: var(--mute); cursor: pointer;
}
.pm__close:hover { border-color: var(--blue); color: var(--blue); }
.pm__title { font-family: var(--display); font-size: 20px; margin: 0 40px 4px 0; }
.pm__sum { font-size: 15px; color: var(--ink-soft); margin: 6px 0 18px; }
.pm__sum b { font-family: var(--display); font-size: 18px; color: var(--ink); }
.pm__methods {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.pm__method {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.pm__method-head { font-weight: 700; color: var(--ink); }
.pm__qr {
  display: flex; align-items: center; justify-content: center;
  min-height: 220px;
}
.pm__qr-img {
  width: 100%; max-width: 220px; height: auto; border-radius: 6px;
  image-rendering: pixelated;
}
.pm__hint { font-size: 12px; color: var(--mute); margin: 0; }
.pm__method--soon { justify-content: center; }

/* ── Подвал ──────────────────────────────────────────────────────────────── */

.ftr { background: #fff; border-top: 1px solid var(--line); padding: 34px 0; }
.ftr__in {
  display: flex; gap: 26px; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
  font-size: 13.5px; color: var(--mute);
}
.ftr a { color: var(--ink-soft); }
.ftr a:hover { color: var(--blue); }

/* ── Тосты ───────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; left: 50%;
  bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lift); animation: toast-in .2s ease-out;
  max-width: min(460px, 90vw);
}
.toast--err { background: var(--danger); }
.toast--ok  { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ── Адаптив ──────────────────────────────────────────────────────────────
   Раздел рассчитан на телефон как на равноправное устройство: оптовик
   заказывает с него в поле, а не только из офиса. Правила ниже — про три
   вещи: (1) до всего можно дотянуться пальцем, (2) iOS не зумит формы,
   (3) ничто не уезжает за край экрана.
   ========================================================================== */

@media (max-width: 940px) {
  .catalog__body { grid-template-columns: 1fr; }
  .filters {
    position: static; flex-direction: row; flex-wrap: wrap; gap: 14px;
  }
  .filters__group { flex: 1 1 240px; }
  .cols { grid-template-columns: 1fr; }
}

/* ── Планшет и телефон: шапка сворачивается в бургер ─────────────────────── */

@media (max-width: 860px) {
  /* .hdr__menu уходит в position:fixed и перестаёт занимать место в строке,
     поэтому вправо прижимается сам .hdr__quick. */
  .hdr__burger { display: inline-flex; }
  .hdr__quick { margin-left: auto; }

  .hdr__menu {
    display: block;
    position: fixed; top: var(--header-h); left: 0; right: 0;
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lift);
    padding: 8px 16px max(16px, env(safe-area-inset-bottom));
    transform: translateY(-10px); opacity: 0; visibility: hidden;
    transition: transform .18s ease, opacity .18s ease, visibility .18s;
    z-index: 55;
  }
  .hdr__menu[data-open="true"] { transform: none; opacity: 1; visibility: visible; }

  .hdr__nav { flex-direction: column; align-items: stretch; gap: 0; margin: 0; }
  .hdr__nav a {
    padding: 14px 2px; font-size: 16px;
    border-bottom: 1px solid var(--line-soft); border-left: 3px solid transparent;
  }
  .hdr__nav a[aria-current="page"] {
    border-bottom-color: var(--line-soft);
    border-left-color: var(--blue); padding-left: 10px;
  }

  .hdr__actions {
    flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 0 4px;
  }
  .hdr__actions .btn { width: 100%; min-height: 46px; font-size: 15px; }
  .hdr__actions > span { padding: 2px 0 6px; }   /* строка «кто вошёл» */
}

/* ── Телефон ─────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root { --header-h: 58px; }

  .wrap, .hdr__in { padding: 0 14px; }
  body { overflow-x: hidden; }          /* страховка от случайного выезда */

  .brand__mark { width: 30px; height: 30px; font-size: 15px; }
  .brand__name { font-size: 15px; }
  .brand__sub  { font-size: 10px; }

  /* iOS увеличивает страницу, если шрифт поля меньше 16px, и обратно уже
     не отматывает — поэтому на телефоне все поля ровно 16px. */
  .field input, .field select, .field textarea,
  .qty__unit input { font-size: 16px; }

  /* Палец — не курсор: минимум 44px по высоте у всего кликабельного. */
  .btn { min-height: 46px; padding: 12px 18px; }
  .btn--sm { min-height: 42px; padding: 10px 14px; font-size: 14px; }
  .btn--quiet { min-height: 42px; }
  .chip { min-height: 40px; padding: 9px 14px; font-size: 14px; }

  .hero { padding: 30px 0 34px; }
  .hero p { font-size: 15.5px; margin-top: 12px; }
  .hero__stats { gap: 18px 26px; margin-top: 22px; padding-top: 18px; }
  .hero__stat b { font-size: 21px; }

  .catalog { padding: 22px 0 56px; }
  .catalog__head { gap: 12px; margin-bottom: 16px; }
  .catalog__head h2 { font-size: 22px; }
  .catalog__head .field { max-width: none !important; }

  /* Фильтры: чипы в один ряд с горизонтальной прокруткой — иначе на узком
     экране они занимают пол-страницы и отодвигают каталог за сгиб. */
  .filters { padding: 12px 0; border: 0; background: transparent; gap: 12px; }
  .filters__group { flex: 1 1 100%; }
  .filters .chips {
    flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .filters .chips::-webkit-scrollbar { display: none; }
  .filters .chip { flex: 0 0 auto; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
  .card__media { aspect-ratio: 3 / 2; }
  .card__media svg { width: 44px; height: 44px; }
  .card__body { padding: 12px 12px 13px; gap: 9px; }
  .card__name { font-size: 14px; }
  .card__meta { font-size: 12px; gap: 2px 8px; }
  .card__price b { font-size: 19px; }
  .card:hover { transform: none; box-shadow: none; border-color: var(--line); }
  .qty { gap: 6px; }
  .qty__unit label { font-size: 10px; }

  .form__row { grid-template-columns: 1fr; }
  .panel { padding: 18px 16px; border-radius: var(--radius); }
  .auth { padding: 24px 14px 48px; }

  .page { padding: 22px 0 56px; }
  .page__head { gap: 12px; margin-bottom: 16px; }
  .page__head h1 { font-size: 23px; }
  .page__head .btn { width: 100%; }

  .drawer__head { padding: 14px 16px; }
  .drawer__body { padding: 14px 16px; }
  .drawer__foot { padding: 14px 16px max(16px, env(safe-area-inset-bottom)); }
  .total b { font-size: 22px; }

  .order-card { padding: 15px 16px; }
  .order-card__date { margin-left: 0; width: 100%; }
  .order-card__foot .btn { width: 100%; }
  .order-card__total { margin-left: 0; }

  /* Таблица админки → карточки. Горизонтальный скролл таблицы на телефоне
     нечитаем: заголовки уезжают, и строка теряет смысл. data-label
     проставляет admin.js при рендере. */
  .tbl-scroll { overflow-x: visible; }
  table.tbl { min-width: 0; display: block; }
  table.tbl thead { display: none; }
  table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 4px 0; margin-bottom: 12px; background: #fff;
  }
  table.tbl tbody tr:hover { background: #fff; }
  table.tbl td { border-bottom: 1px solid var(--line-soft); padding: 10px 14px; }
  table.tbl tr td:last-child { border-bottom: 0; }
  table.tbl td[data-label]::before {
    content: attr(data-label);
    display: block; margin-bottom: 3px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--mute);
  }
  table.tbl td.num { text-align: left; }
  table.tbl td .btn { width: 100%; }

  .ftr { padding: 24px 0; }
  .ftr__in { gap: 16px; }
  .toast { max-width: calc(100vw - 28px); }
}

/* ── Узкий телефон (iPhone SE и подобные) ────────────────────────────────── */

@media (max-width: 400px) {
  .brand__sub { display: none; }
  .grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 25px; }
}
