/* =====================================================================
   REFORMA — мини-приложение для мессенджера MAX
   Витрина лотов, заточенная под телефон. Отдельная страница, НЕ часть
   лендинга: у неё свой хост и своя CSP.

   Файл самодостаточный. Тащить сюда css/style.css (~5300 строк про лендинг)
   не нужно и нельзя — общими остаются только дизайн-токены ниже.

   ВЁРСТКА МОБИЛЬНАЯ ПО-НАСТОЯЩЕМУ, а не «адаптив с десктопа»: одна колонка,
   крупные тап-таргеты (минимум 44 px), липкая панель действий, ширина
   рассчитана от 360 px. Медиазапросы здесь работают ВВЕРХ (min-width) —
   планшет получает разве что более широкие поля.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. ДИЗАЙН-ТОКЕНЫ
   Скопированы ДОСЛОВНО из :root в ../css/style.css (блок «1. DESIGN TOKENS»).
   ВНИМАНИЕ: при смене фирменных цветов правятся ОБА места — здесь и там.
   Автоматической связи между файлами нет и быть не может: мини-апп живёт
   на своём хосте и лендинговый CSS не грузит.
   --------------------------------------------------------------------- */
:root {
  /* brand colours */
  --red:   #C50022;               /* the single accent */
  --red-2: #E10E2E;               /* brighter — hover / glow */
  --black: #050506;
  --bg:    #0B0A0C;               /* near-black hero base */
  --surface: #141216;
  --white: #FFFFFF;
  --cream: #F4F1EA;
  --muted: rgba(255, 255, 255, .62);
  --line:  rgba(255, 255, 255, .12);

  /* type */
  --font-display: 'Oswald', sans-serif;
  --font-body:    'Inter', sans-serif;

  /* motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* --- своё, только для мини-аппа ---------------------------------- */
  /* Боковое поле: не меньше 16 px и не меньше выреза экрана. */
  --gut: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --top-safe: env(safe-area-inset-top);
  --bottom-safe: env(safe-area-inset-bottom);
  /* Высота экранной клавиатуры. Ставит app.js по visualViewport; пока
     клавиатуры нет — 0. Липкая панель и лист заявки поднимаются на неё,
     иначе поле ввода уезжает под клавиатуру. */
  --kb: 0px;
  --bar-h: 60px;                  /* высота липкой панели действий */
  --radius: 14px;
}

/* ---------------------------------------------------------------------
   2. RESET / BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--black);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--white);
  /* ФОН СОВПАДАЕТ С ФОНОМ МЕССЕНДЖЕРА ПО КРАЯМ. Тему MAX не подхватываем
     специально: стиль фирменный, тёмный. Но белых полос сверху/снизу при
     оверскролле быть не должно — отсюда одинаковый чёрный на html и body. */
  background: var(--black);
  overflow-x: hidden;             /* горизонтальной прокрутки не бывает */
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;    /* оверскролл не «пробивает» в мессенджер */
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* СЕТКА БЕЗОПАСНОСТИ ДЛЯ [hidden] — правило обязательное, не «на всякий
   случай». Авторское правило со свойством display перебивает [hidden]
   { display: none } из таблицы БРАУЗЕРА (авторский слой сильнее слоя
   user-agent даже при равной специфичности). Всё, что JS прячет через
   `.hidden = true`, обязано это учитывать, иначе элемент остаётся на
   экране: так плашка «Фото у площадки» висела поверх загруженной
   фотографии, счётчик «0» горел на кнопке фильтров, а стрелки галереи
   торчали у лота с одним снимком.
   Одно правило на всё приложение вместо перечисления классов: следующий
   скрытый элемент не должен снова напороться на то же самое.
   Тот же приём используется на сайте (`.calc [hidden]`, `.lot-modal
   [hidden]` в css/style.css) — второго механизма не заводим. */
[hidden] { display: none !important; }
ul { list-style: none; margin: 0; padding: 0; }
dl, dd { margin: 0; }
h1, h2, h3, p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--red-2);
  outline-offset: 2px;
}

.noscript {
  padding: 24px var(--gut);
  color: var(--muted);
  font-size: .95rem;
}
.noscript a { color: var(--white); }

/* Ловушка для ботов: за краем экрана, но не display:none — часть ботов
   игнорирует скрытые поля. */
.form-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------------------------------------------------------------------
   3. КНОПКИ
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;               /* тап-таргет */
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.btn--primary { background: var(--red); color: var(--white); }
.btn--primary:active { background: var(--red-2); }
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--white);
}
.btn--ghost:active { border-color: rgba(255, 255, 255, .3); }
.btn--wide { width: 100%; }
.btn--grow { flex: 1 1 auto; }
.btn--icon { flex: 0 0 auto; width: 52px; padding: 12px; }
.btn--icon svg { width: 20px; height: 20px; }
.btn[disabled] { opacity: .55; cursor: default; }

.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--white);
}
.iconbtn svg { width: 24px; height: 24px; }
.iconbtn:active { background: rgba(255, 255, 255, .08); }
/* Скрытие своей стрелки «назад» внутри MAX обеспечивает общее правило
   [hidden] в блоке 2 — отдельное здесь не нужно. */

.linkbtn {
  margin-top: 8px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--red-2);
  font-size: .88rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------------------------------------------------------------------
   4. ЭКРАНЫ
   Прокручивается сам документ, вложенных скроллов нет: на телефоне
   вложенный скролл почти всегда ловит палец не тем контейнером.
   --------------------------------------------------------------------- */
.screen { padding-bottom: 32px; }
.screen[hidden] { display: none; }
.screen--lot {
  /* место под липкую панель действий (она fixed) */
  padding-bottom: calc(var(--bar-h) + var(--bottom-safe) + 24px);
}

/* --- шапка списка --- */
.topbar {
  padding: calc(var(--top-safe) + 18px) var(--gut) 14px;
}
.topbar__brand {
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--red);
  text-transform: uppercase;
}
.topbar__title {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}
.topbar__sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: .86rem;
}

/* --- липкая панель фильтров --- */
.filterbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px var(--gut) 10px;
  background: var(--black);
  border-bottom: 1px solid var(--line);
}
/* Второй ряд панели: счётчик слева, кнопка фильтров справа. */
.filterbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chips {
  display: flex;
  gap: 6px;
  min-width: 0;
  /* Полоса на всю ширину — четыре чипа помещаются и на 360 px (нужно 299,
     доступно 328). Прокрутка оставлена страховкой на совсем узкие экраны. */
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  /* 44 px — минимальный тап-таргет, ниже опускаться нельзя. */
  min-height: 44px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip.is-active {
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.filterbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--white);
  font-size: .88rem;
  font-weight: 500;
}
.filterbtn__ico { width: 18px; height: 18px; }
.filterbtn__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: var(--white);
  font-size: .72rem;
  font-weight: 700;
}

/* --- счётчик и служебные строки --- */
/* Счётчик живёт ВНУТРИ липкой панели (второй ряд), поэтому боковых полей
   у него своих нет — их даёт .filterbar. */
.count {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .01em;
}
/* aria-live-слот нельзя прятать через display:none — у пустого просто
   убирается маркер. */
.count::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}
.count:empty::before { content: none; }
.count--muted { color: var(--muted); font-weight: 500; }
.count--muted::before { background: var(--muted); }

.stale {
  padding: 6px var(--gut) 0;
  color: var(--muted);
  font-size: .8rem;
}

.offernote {
  padding: 20px var(--gut) 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
}

.more { padding: 18px var(--gut) 0; }

.state {
  margin: 18px var(--gut) 0;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.state__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
}
.state__text {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: .9rem;
}

/* ---------------------------------------------------------------------
   5. КАРТОЧКА СПИСКА
   Одна колонка на любой ширине — так лот читается одной рукой.
   --------------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px var(--gut) 0;
}

.card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
/* Точка входа в карточку — настоящая <button>, растянутая на всю плитку.
   В Tab-порядке остаётся ОДИН осмысленный элемент. */
.card__open {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  font-size: 0;
}
.card__open:active + .card__media { opacity: .85; }

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;          /* фиксированное соотношение = нулевой CLS */
  background: #0d0c0f;
  transition: opacity .15s linear;
}
.card__img { width: 100%; height: 100%; object-fit: cover; }
.card__nophoto {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .85rem;
}

.badge {
  position: absolute;
  z-index: 1;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.badge--rate { background: var(--red); color: var(--white); }
/* САНКЦИОННЫЙ АВТО — пилюля КОНТУРНАЯ, без красной заливки: это факт о лоте,
   а не предупреждение. Красный на бренде — единственный акцент, отдавать его
   сюда нельзя (то же решение, что на сайте). */
.badge--sanction {
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(5, 5, 6, .72);
  color: var(--white);
  font-weight: 500;
}
.card__rate { top: 10px; right: 10px; }
.card__sanction { bottom: 10px; left: 10px; }

.card__body { padding: 14px 14px 16px; }
.card__title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.card__facts {
  margin-top: 6px;
  color: var(--muted);
  font-size: .86rem;
}
.card__price {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.card__price--na { color: var(--muted); font-weight: 500; }
.card__pricesub {
  margin-top: 2px;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.card__source {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}

/* --- скелетоны --- */
.card--skeleton .card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card__skelbar {
  display: block;
  height: 12px;
  width: 55%;
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
}
.card__skelbar--wide { width: 85%; }
.card--skeleton .card__media { background: rgba(255, 255, 255, .05); }
/* Пульсация — единственная анимация витрины, и живёт она только пока идёт
   запрос. На слабых телефонах и при reduced-motion выключается (блок 11). */
.grid[aria-busy="true"] .card--skeleton { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------------------------------------------------------------------
   6. ЭКРАН ЛОТА
   --------------------------------------------------------------------- */
.lotbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--top-safe) + 8px) 8px 8px;
  background: rgba(5, 5, 6, .92);
  border-bottom: 1px solid var(--line);
}
/* Стрелку убрали (мы внутри MAX) — заголовок не должен упираться в край. */
.lotbar > .iconbtn[hidden] + .lotbar__title { padding-left: 8px; }
.lotbar__title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* --- скелетон карточки --- */
.lotload { padding: 0 0 24px; }
.lotload__media {
  aspect-ratio: 4 / 3;
  background: rgba(255, 255, 255, .05);
}
.lotload__bar {
  height: 14px;
  width: 45%;
  margin: 16px var(--gut) 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
}
.lotload__bar--wide { width: 80%; }

/* --- ГАЛЕРЕЯ --- */
.gallery__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #0d0c0f;
  /* Вертикаль отдаём прокрутке страницы, горизонталь ловим сами (свайп). */
  touch-action: pan-y;
  overflow: hidden;
}
.gallery__img { width: 100%; height: 100%; object-fit: cover; }
.gallery__none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 24px;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}
.gallery__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(5, 5, 6, .6);
  color: var(--white);
}
.gallery__nav svg { width: 22px; height: 22px; }
.gallery__nav--prev { left: 8px; }
.gallery__nav--next { right: 8px; }
.gallery__counter {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 5, 6, .72);
  color: var(--white);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.gallery__sanction { bottom: 10px; left: 10px; }

.gallery__thumbs {
  display: flex;
  gap: 8px;
  padding: 10px var(--gut) 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery__thumbs::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0c0f;
  overflow: hidden;
}
.thumb.is-active { border-color: var(--red); }
.thumb__img { width: 100%; height: 100%; object-fit: cover; }

/* --- заголовок лота --- */
.lothead { padding: 18px var(--gut) 0; }
.lothead__eyebrow {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lothead__title {
  margin-top: 6px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.lothead__title:focus { outline: none; }

/* --- РАЗБИВКА ЦЕНЫ ---
   Суммы стоят ровной колонкой: flex + space-between, у значения nowrap,
   у подписи min-width:0 (перенос внутри своей доли). tabular-nums — иначе
   в пропорциональном наборе «1» уже остальных цифр и колонка «дышит». */
.price {
  margin: 18px var(--gut) 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.price__label {
  color: var(--muted);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.price__total {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 8vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.price__src {
  margin-top: 4px;
  color: var(--muted);
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.lines {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}
.line__name {
  min-width: 0;
  font-size: .95rem;
  text-wrap: pretty;
}
.line__sub {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.line__val {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.line__val--na { color: var(--muted); }

.fee {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.fee__key { min-width: 0; font-size: 1.05rem; font-weight: 500; text-wrap: pretty; }
.fee__val {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.fee__val--na { color: var(--muted); font-weight: 400; }

.excl {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.excl__head {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.excl__list { margin-top: 6px; }
.excl__item {
  position: relative;
  padding-left: 16px;
  font-size: .9rem;
}
.excl__item::before {
  content: '';
  position: absolute;
  left: 0;
  top: .7em;
  width: 8px;
  height: 1px;
  background: var(--muted);
}

.rates {
  margin-top: 12px;
  color: rgba(255, 255, 255, .45);
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
}

.disclaimer {
  padding: 12px var(--gut) 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.nocalc {
  margin: 18px var(--gut) 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.nocalc__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
}
.nocalc__text { margin-top: 6px; color: var(--muted); font-size: .9rem; }
.nocalc__price {
  margin-top: 10px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* --- характеристики --- */
.specs__head {
  padding: 24px var(--gut) 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.specs { padding: 8px var(--gut) 0; }
.spec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.spec__key { min-width: 0; color: var(--muted); font-size: .9rem; }
.spec__val {
  flex: 0 1 auto;
  font-size: .92rem;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

/* --- липкая панель действий --- */
.actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb);              /* поднимается над клавиатурой */
  z-index: 30;
  display: flex;
  gap: 10px;
  padding: 10px var(--gut) calc(10px + var(--bottom-safe));
  background: rgba(5, 5, 6, .96);
  border-top: 1px solid var(--line);
}
.actionbar[hidden] { display: none; }

/* ---------------------------------------------------------------------
   7. ЛИСТЫ (нативный <dialog>)
   Фокус-трап, Esc и ::backdrop даёт браузер. Нет showModal — app.js
   открывает окно через атрибут open и ставит .sheet--fallback.
   --------------------------------------------------------------------- */
.sheet {
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  overflow: visible;
}
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(5, 5, 6, .72); }

/* Лист прижат к низу экрана и поднимается над клавиатурой. */
.sheet__panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb);
  display: flex;
  flex-direction: column;
  /* svh, а НЕ dvh: dvh пересчитывается, пока схлопывается адресная строка,
     и высота листа плывёт прямо во время прокрутки. На лендинге на это уже
     наступали — правило записано в CLAUDE.md. */
  max-height: calc(100svh - var(--kb) - 24px);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  background: var(--surface);
}
.sheet--fallback {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 5, 6, .72);
}
.sheet__grab {
  width: 40px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
}
.sheet__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px var(--gut);
}
.sheet__title {
  flex: 1 1 auto;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
}
.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 4px var(--gut) 16px;
  overflow-y: auto;
  overscroll-behavior: contain;   /* прокрутка листа не «пробивает» в фон */
  -webkit-overflow-scrolling: touch;
}
.sheet__foot {
  display: flex;
  gap: 10px;
  padding: 12px var(--gut) calc(12px + var(--bottom-safe));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

/* ---------------------------------------------------------------------
   8. ПОЛЯ ФОРМ
   --------------------------------------------------------------------- */
.field { margin-top: 14px; }
.field:first-child { margin-top: 4px; }
.field__label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field__input,
.field__select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--white);
  /* 16px обязательны: при меньшем размере iOS зумит страницу на фокусе. */
  font-family: var(--font-body);
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
}
.field__select {
  /* стрелка нарисована фоном, чтобы не тащить картинку */
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.field__input::placeholder { color: rgba(255, 255, 255, .38); }
.field__input:disabled,
.field__select:disabled { opacity: .5; }
.field__input:focus,
.field__select:focus { border-color: rgba(255, 255, 255, .3); outline: none; }
.field__input:focus-visible,
.field__select:focus-visible { outline: 2px solid var(--red-2); outline-offset: 1px; }
/* Стрелки-спиннеры у number на телефоне только мешают. */
.field__input::-webkit-outer-spin-button,
.field__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field__input[type="number"] { -moz-appearance: textfield; }

.field__pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.field__dash { color: var(--muted); }
.field__hint { margin-top: 6px; color: var(--muted); font-size: .78rem; }
.field__error {
  margin-top: 6px;
  color: var(--red-2);
  font-size: .8rem;
}
.field__error:empty { display: none; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  cursor: pointer;
}
.consent__input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--red);
}
.consent__text { color: var(--muted); font-size: .82rem; line-height: 1.45; }
.consent__link { color: var(--white); text-underline-offset: 3px; }

.leadform__text {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}
.leadform__fail {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--red);
  border-radius: 10px;
  color: var(--white);
  font-size: .86rem;
}
#leadSubmit { margin-top: 18px; }

.leadok { padding: 18px 0 8px; text-align: center; }
.leadok__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: uppercase;
}
.leadok__text { margin: 8px 0 18px; color: var(--muted); font-size: .9rem; }

/* ---------------------------------------------------------------------
   9. ТОСТ (запасной путь «поделиться»: ссылка скопирована)
   --------------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--bottom-safe) + 20px);
  z-index: 80;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--white);
  font-size: .85rem;
  text-align: center;
}
.toast[hidden] { display: none; }

/* ---------------------------------------------------------------------
   10. ШИРЕ ТЕЛЕФОНА
   Мини-апп открывается и на десктопной версии MAX. Ограничиваем ширину
   колонки, чтобы карточки не растягивались на весь экран.
   --------------------------------------------------------------------- */
@media (min-width: 620px) {
  :root { --gut: max(24px, env(safe-area-inset-left)); }
  .app,
  .sheet__panel {
    max-width: 620px;
    margin-inline: auto;
  }
  .sheet__panel { left: 50%; right: auto; transform: translateX(-50%); width: 100%; }
  .actionbar {
    max-width: 620px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
  }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------------
   11. REDUCED MOTION
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
