/* ===========================================================================
   Доска объявлений (T28): список (DESIGN-FORMS.md §4) и страница объявления
   (§5). Все цвета — токены tokens.css (D17); оранжевые заливки — §7 (T27a):
   --orange-fill / --orange-ink / --orange-shadow. Цели касания ≥ 44 px (§6).
   Подключается из category_view_board / board_list / board_item — после
   base.css, поэтому переопределения общих компонентов допустимы.
   =========================================================================== */

/* --- Обёртка раздела -------------------------------------------------------- */

.m-ads,
.m-ad {
  max-width: 1200px;           /* ширина контента доски (§4) */
  margin: 0 auto;
}

/* Список доски — без одной большой белой подложки (§9): заголовок, чипы,
   фильтр и карточки лежат прямо на --bg, каждый блок — своя карточка.
   Страница объявления (.m-ad) и формы (add/edit) остаются на белой .m-body.
   Поддержка :has() — Chrome 105+/Safari 15.4+; без него просто остаётся
   белая подложка, ничего не ломается */
.m-body:has(.m-ads) {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

/* Строка «фильтр + список»; на телефоне — одна колонка. Вложенность допустима:
   category_view_board оборачивает $items_list_html (board_list), у которого
   свой .m-ads__layout с фильтром и карточками */
.m-ads__layout {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
}

/* --- Шапка раздела: заголовок, счётчик, сортировка, вид --------------------- */

.m-ads__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 0 0 16px;
}

.m-ads__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  min-width: 0;
}

.m-ads__title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.m-ads__count {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.m-ads__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.m-ads__desc {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  color: var(--muted);
}

/* Сортировка — пилюля с выпадающим меню (details/summary) */
.m-adsort { position: relative; }

.m-adsort__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;            /* цель касания; визуально пилюля §4 */
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.m-adsort__btn::-webkit-details-marker { display: none; }
.m-adsort__btn { list-style: none; }

.m-adsort__btn svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform .15s;
}

.m-adsort[open] .m-adsort__btn svg { transform: rotate(180deg); }

.m-adsort__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 220px;
  margin: 0;
  padding: 6px;
  list-style: none;
  /* T78: выпадающее меню сортировки — непрозрачная панель в обеих темах */
  background: var(--menu-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-card-lg);
}

/* Узкие экраны (§11.6, T47): меню сортировки не должно выходить за края —
   на ширине до 640 px открываем его нижней шторкой на всю ширину (минус
   поля 8px) поверх контента, выше таббара (T17). Читаемость в тёмной
   теме даёт пара --card/--ink */
@media (max-width: 639.98px) {
  .m-adsort__menu {
    position: fixed;
    top: auto;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 8px;
    right: 8px;
    min-width: 0;
    z-index: 50;
  }
}

.m-adsort__menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* T78: на непрозрачной панели белая подложка --tint не видна в светлой теме. */
.m-adsort__menu a:hover { background: var(--menu-hover); text-decoration: none; }

.m-adsort__menu a.is-active {
  background: var(--menu-selected);
  color: var(--accent-ink);
  font-weight: 800;
}

/* Вид списка (Плитка/Список) — компонент .m-seg из base.css, без нижнего поля */
.m-seg--view { margin: 0; }

.m-seg--view .m-seg__item {
  min-height: 38px;
  border: 0;                   /* это <button>: сброс фона/рамки браузера */
  border-radius: var(--r-pill);
  background: transparent;
  font-family: var(--font);
  font-size: 13px;             /* 13–14px/700–800 по §2 */
  cursor: pointer;
}

/* --- Чипы категорий ----------------------------------------------------------
   Компонент .m-chip из base.css. Верхний ряд по §9 (T42): высота 44,
   радиус 22, значок Lucide 18px, шесть пастельных оттенков по кругу
   (--chipN-*), контур 1px белым 60%, мягкая тень как у плиток §8.
   Телефон: один ряд с прокруткой и затуханием по краям. */

.m-adscats { margin-bottom: 16px; }

.m-ads__chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin: 0 -16px 8px;         /* прокрутка во всю ширину экрана */
  padding: 4px 16px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* затухание по правому краю; после прокрутки — по обоим (класс JS) */
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 20px), transparent);
}

.m-ads__chips.is-scrolled {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}

.m-ads__chips::-webkit-scrollbar { display: none; }

/* core.js вставляет пустой select в каждый <nav> (известно с T17) */
.m-ads__chips .mobile_menu_select { display: none; }

.m-ads__chips .m-chip {
  min-height: 44px;            /* §9 */
  padding: 0 16px;
  border: 1px solid var(--chip-line);
  border-radius: 22px;
  scroll-snap-align: start;
  box-shadow: var(--tile-card-shadow);
  color: var(--chip-title);
  font-size: 14px;
  transition: transform .15s ease;
}

/* значок Lucide по слагу категории (шаблон кладёт SVG в .m-chip__icon) */
.m-ads__chips .m-chip__icon {
  display: inline-flex;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.m-ads__chips .m-chip__icon svg { width: 100%; height: 100%; display: block; }

/* шесть пастельных оттенков по кругу (§9); порядок — порядок категорий */
.m-ads__chips .m-chip--tone1 { background: var(--chip1-fill); }
.m-ads__chips .m-chip--tone2 { background: var(--chip2-fill); }
.m-ads__chips .m-chip--tone3 { background: var(--chip3-fill); }
.m-ads__chips .m-chip--tone4 { background: var(--chip4-fill); }
.m-ads__chips .m-chip--tone5 { background: var(--chip5-fill); }
.m-ads__chips .m-chip--tone6 { background: var(--chip6-fill); }

.m-ads__chips .m-chip--tone1 .m-chip__icon { color: var(--chip1-ink); }
.m-ads__chips .m-chip--tone2 .m-chip__icon { color: var(--chip2-ink); }
.m-ads__chips .m-chip--tone3 .m-chip__icon { color: var(--chip3-ink); }
.m-ads__chips .m-chip--tone4 .m-chip__icon { color: var(--chip4-ink); }
.m-ads__chips .m-chip--tone5 .m-chip__icon { color: var(--chip5-ink); }
.m-ads__chips .m-chip--tone6 .m-chip__icon { color: var(--chip6-ink); }

.m-ads__chips .m-chip__count {
  font-size: 12px;
  font-weight: 700;
  opacity: .7;
}

.m-ads__chips .m-chip:hover { text-decoration: none; }

.m-ads__chips .m-chip:hover:not(.is-active) { transform: translateY(-1px); }

/* Активная категория — инверсия, без пастели (§9); правило после тонов */
.m-ads__chips .m-chip.is-active {
  background: var(--chip-active-bg);
  border-color: transparent;
  box-shadow: none;
  color: var(--chip-active-ink);
}

.m-ads__chips .m-chip.is-active .m-chip__icon { color: var(--chip-active-ink); }

/* «Ещё N» (§9): пилюля в стиле чипа; [hidden] обязателен — базовый
   display перебивает браузерное скрытие */
.m-ads__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0 0 0 8px;
  padding: 0 18px;
  border: 1px solid var(--chip-line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--tile-card-shadow);
  color: var(--chip-title);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.m-ads__more[hidden] { display: none; }

.m-ads__more svg { width: 16px; height: 16px; transition: transform .15s ease; }

.m-ads__more[aria-expanded="true"] svg { transform: rotate(180deg); }

.m-ads__more:hover { text-decoration: none; transform: translateY(-1px); }

/* Подкатегории выбранной категории — второй ряд мелких чипов (§9, T42):
   36px, радиус 18, светлее (оттенок родителя, --chipN-soft), без значка */
.m-adsubcats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0 2px;
}

/* core.js вставляет пустой select в каждый <nav> (известно с T17) */
.m-adsubcats .mobile_menu_select { display: none; }

.m-adsub {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--chip-title);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.m-adsubcats--tone1 .m-adsub { background: var(--chip1-soft); }
.m-adsubcats--tone2 .m-adsub { background: var(--chip2-soft); }
.m-adsubcats--tone3 .m-adsub { background: var(--chip3-soft); }
.m-adsubcats--tone4 .m-adsub { background: var(--chip4-soft); }
.m-adsubcats--tone5 .m-adsub { background: var(--chip5-soft); }
.m-adsubcats--tone6 .m-adsub { background: var(--chip6-soft); }

.m-adsub:hover { text-decoration: none; }

.m-adsub.is-active {
  background: var(--chip-active-bg);
  box-shadow: none;
  color: var(--chip-active-ink);
}

/* --- Фильтр -------------------------------------------------------------------
   Телефон: пилюля «Фильтр (N)» справа внизу, панель — нижний лист с подложкой.
   Компьютер (от 1024 px): карточка 272 px слева, развёрнута всегда (§4). */

/* min-width: 0 — колонка фильтра не раздувается шире заданной: без него
   flex-элемент не сжимается ниже min-content полей и карточка была 305px
   вместо 272px (§11.3, T47) */
.m-adfilter { flex: 1 1 100%; min-width: 0; }

.m-adfilter__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.m-adfilter__toggle svg { width: 18px; height: 18px; color: var(--ink); }

.m-adfilter__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--card);
  font-size: 12px;
  font-weight: 800;
}

.m-adfilter .m-adfilter__panel { display: none; }   /* телефон: панель по кнопке */

.m-adfilter__head { display: none; }

/* Заголовок карточки фильтра (§9; значок 20px — §11.3, T47): «Фильтр» со
   значком sliders-horizontal в одной строке с текстом */
.m-adfilter__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.m-adfilter__title svg {
  width: 20px;
  height: 20px;
  color: var(--accent-ink);
}

/* Поля фильтра (§9): высота 48 px, радиус 24 px; группы разделяет
   отступ 16 px (§11.3, T47) */
.m-adfilter__fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.m-adfilter .my_field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.m-adfilter .my_field .my_b_title,
.m-adfilter fieldset > legend {
  padding: 0;
  margin: 0 0 8px;             /* §2: подпись — отступ до поля 8 px */
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.m-adfilter .my_b_value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Поля: ядерные .input/.input-small/.date-input, select и инпуты выбора
   категории (.my_b_f_input). Селектор с form — перебить базовые
   .m-body form .input|… (та же специфичность, board.css идёт позже base.css) */
.m-adfilter form .input,
.m-adfilter form .input-small,
.m-adfilter form select,
.m-adfilter form .date-input,
.m-adfilter form .my_b_f_input {
  flex: 1 1 90px;
  width: auto !important;      /* против .m-body form .input-small 90px / .date-input 130px */
  min-width: 0;
  min-height: 48px;            /* §9 */
  box-sizing: border-box;
  padding: 0 14px;
  border: 1.5px solid var(--filter-line);
  border-radius: 24px;         /* §9: радиус 24 */
  background: var(--filter-field-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.m-adfilter form .input::placeholder,
.m-adfilter form .input-small::placeholder,
.m-adfilter form .date-input::placeholder { color: var(--muted); opacity: 1; }

.m-adfilter form .input:focus,
.m-adfilter form .input-small:focus,
.m-adfilter form select:focus,
.m-adfilter form .date-input:focus,
.m-adfilter form .my_b_f_input:focus {
  border-color: var(--accent);
  background: var(--card);
  box-shadow: var(--focus-ring);
  outline: none;
}

/* --- Select «Выбрать категорию» (§9, T41); шеврон — §11.2 (T47): ровно
   одна стрелка, нарисованная CSS (маска на ::after обёртки), 16x16,
   справа 14px, цвет токеном --ink (тёмный в светлой теме, светлый
   в тёмной) ---------------------------------------------------------------- */

.m-adfilter__select {
  position: relative;
  display: flex;
  align-items: center;
}

.m-adfilter__select select {
  flex: 1 1 auto;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;         /* место под шеврон (14px + 16px) */
  text-overflow: ellipsis;
  cursor: pointer;
}

/* Шеврон общих форм (T27, background-image на .m-body form select) здесь
   не нужен — своя стрелка на ::after обёртки. В тёмной теме правило T27
   специфичнее ([data-theme]) и перебивает шортхэнд background выше, а
   сброшенный им repeat мостит поле шевронами — гасим теми же селекторами */
.m-adfilter form select,
[data-theme="dark"] .m-adfilter form select,
:root:not([data-theme="light"]) .m-adfilter form select {
  background-image: none;
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .m-adfilter form select {
    background-image: none;
    background-repeat: no-repeat;
  }
}

.m-adfilter__select::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background-color: var(--ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
}

/* --- Пары «от/до» (§9, T41): подпись сверху, два поля в одной строке ------ */

.m-adfilter__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;  /* «до» не переносится вниз */
  gap: 8px;
}

.m-adfilter__cell {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.m-adfilter__cell .input,
.m-adfilter__cell .input-small {
  flex: 1 1 auto;
  width: 100% !important;
}

/* Единицы цены («руб.») с §11.3 (T47) живут в заголовке группы «Цена,
   руб.» — внутри поля больше не выводятся (правило .m-adfilter__unit и
   запасной паддинг под него убраны) */

/* Селектор категории (cat_selector) из фильтра убран (§9, T41) —
   вместо него нативный select; в форме подачи доски cat_selector
   оформляется общими стилями форм (base.css, T27) */

.m-adfilter .input-number-units {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

/* Кнопки фильтра (§9): «Фильтровать» — основная оранжевая (§7) на всю
   ширину, «Сбросить» — текстовая ссылка под ней цветом --accent-ink */
.m-adfilter__buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-top: 18px;
}

.m-adfilter .m-adfilter__buttons .button-submit,
.m-adfilter .m-adfilter__buttons input.button-submit {
  flex: 1 1 auto;
  width: 100%;
  min-height: 48px;
  font-size: 15px;
}

.m-adfilter__reset {
  align-self: center;
  min-height: 44px;            /* цель касания */
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-ink);
  white-space: nowrap;
}

.m-adfilter__reset:hover { color: var(--ink); }

/* Спиннер AJAX-подгрузки фильтра — показывает ядро, стили из theme-gui */

/* --- Список карточек ---------------------------------------------------------- */

.m-ads__content { flex: 1 1 100%; min-width: 0; }   /* колонка результатов — вся ширина (§9) */

.m-ads__found {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.m-ads__found b { color: var(--ink); font-weight: 800; }

.m-ads__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* телефон: 2 колонки (§4) */
  gap: 12px;
}

/* Карточка объявления — геометрия m-bcard главной (§4) */
.m-adcard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-nested);          /* T76: стекло внутри панели */
  border: 1px solid var(--card-nested-line);
  border-radius: var(--r-card);            /* T76: радиус карточек 26 px */
  box-shadow: var(--shadow);
  color: var(--ink);
}

.m-adcard.is-vip {
  box-shadow: 0 0 0 1.5px var(--accent), var(--shadow);   /* рамка VIP (§4) */
}

.m-adcard__photo {
  position: relative;
  display: block;
  flex: 0 0 auto;
  height: 128px;               /* телефон 128 px, от 1024 px — 200 px */
  background: var(--photo);
}

/* Скелетон под фото — как у m-bcard (SPEC п. 10, T21) */
.m-adcard__photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo);
  animation: m-skeleton 1.6s ease-in-out infinite;
}

.m-adcard__photo img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-adcard__photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--photo-shade);
}

/* Ценник — §7: --orange-fill, текст --orange-ink 14 px (карточка в 2 колонки) */
.m-adcard__price {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-size: 14px;
  font-weight: 800;
}

/* VIP-плашка — слева сверху, --orange-fill, 12 px/800 (§4, §7) */
.m-adcard__vip {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.m-adcard__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
}

.m-adcard__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.m-adcard__title:hover { text-decoration: none; color: var(--accent-ink); }

.m-adcard__sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* T61: тип продавца — бейдж под категорией (частное лицо / агент) */
.m-adcard__seller {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--chip3-soft);
  color: var(--chip3-ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.m-adcard__seller.is-agent {
  background: var(--chip2-soft);
  color: var(--chip2-ink);
}

.m-adcard__seller svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

.m-adcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--sep);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.m-adcard__hits {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.m-adcard__hits svg { width: 14px; height: 14px; }

/* Вид «Список»: одна колонка, фото слева */
.m-ads__grid.is-list { grid-template-columns: 1fr; }

.m-ads__grid.is-list .m-adcard {
  flex-direction: row;
  align-items: stretch;
}

.m-ads__grid.is-list .m-adcard__photo {
  flex: 0 0 132px;
  height: auto;
  min-height: 116px;
}

.m-ads__grid.is-list .m-adcard__body { padding: 12px 16px; }

/* --- Постраничность: кружки 44 px, текущая — --orange-fill (§4, §7) ----------- */

.m-adpages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 8px;
}

/* Ядро добавляет в <nav> служебный select.mobile_menu_select (T64: он
   попадал в постраничность и растягивал её на 79/127 px). */
.m-adpages .mobile_menu_select { display: none; }

.m-adpages__page,
.m-adpages__nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.m-adpages__page:hover { text-decoration: none; box-shadow: var(--shadow-float); }

.m-adpages__nav svg { width: 20px; height: 20px; }

.m-adpages__page.is-current {
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-weight: 800;
}

.m-adpages__gap { color: var(--muted); font-weight: 700; }

.m-adpages__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 100%;              /* телефон: пилюля на всю ширину (§4) */
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.m-adpages__next svg { width: 18px; height: 18px; }

.m-adpages__next:hover { text-decoration: none; box-shadow: var(--shadow-float); }

/* --- Пустое состояние (§4; правки §9 — T41) ------------------------------------- */

.m-adempty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 40px 24px 44px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

/* Значок inbox в подложке 64px в стиле плиток §8: градиент, контур
   градиентом, тени, значок --accent-ink с цветной тенью */
.m-adempty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border: 1px solid transparent;
  border-radius: var(--r-icon-box);
  background:
    var(--tile-fill) padding-box,
    var(--tile-edge) border-box;
  box-shadow: var(--tile-shadow);
  color: var(--accent-ink);
}

.m-adempty__icon svg {
  width: 32px;
  height: 32px;
  display: block;
  filter: var(--tile-icon-shadow);
}

.m-adempty__title {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.m-adempty__text {
  max-width: 420px;
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  color: var(--muted);
}

/* Кнопка «Подать объявление» — основная (§2, §7) */
.m-adempty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 32px;
  border-radius: 26px;
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-size: 17px;
  font-weight: 800;
}

.m-adempty__btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

.m-adempty__btn:active {
  transform: translateY(1px);
  box-shadow: var(--orange-shadow-press);
}

.m-adempty__btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* Ссылка «Все объявления» (§9) — под кнопкой */
.m-adempty__all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-ink);
}

.m-adempty__all:hover { color: var(--ink); }

/* ===========================================================================
   Страница объявления (§5)
   =========================================================================== */

.m-ad {
  display: flex;
  flex-direction: column;      /* телефон: одна колонка, боковые под галереей */
  gap: 16px;
}

.m-ad__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.m-ad__side {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Галерея (§5) --------------------------------------------------------------- */

.m-adgal {
  padding: 12px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.m-adgal__stage {
  position: relative;
  min-width: 0;
}

.m-adgal__main {
  display: block;
  width: 100%;
  height: 240px;               /* телефон; от 1024 px — 480 px (§5) */
  object-fit: cover;
  border-radius: 16px;
  background: var(--photo);
}

.m-adgal__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  cursor: pointer;
}

.m-adgal__arrow svg { width: 22px; height: 22px; }

.m-adgal__arrow.is-prev { left: 12px; }
.m-adgal__arrow.is-next { right: 12px; }

.m-adgal__arrow:hover { filter: brightness(1.03); }

.m-adgal__arrow:focus-visible,
.m-adgal__thumb:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.m-adgal__count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--card);
  font-size: 12px;
  font-weight: 800;
}

.m-adgal__thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.m-adgal__thumbs::-webkit-scrollbar { display: none; }

.m-adgal__thumb {
  flex: 0 0 auto;
  width: 96px;
  height: 64px;                /* телефон; от 1024 px — 76 px (§5) */
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--photo);
  cursor: pointer;
}

.m-adgal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.m-adgal__thumb.is-active {
  outline: 2.5px solid var(--accent);
  outline-offset: -2.5px;      /* рамка внутри (§5) */
}

/* Пустая галерея */
.m-adgal.is-empty { padding: 0; background: transparent; box-shadow: none; }

.m-adgal__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 200px;
  border-radius: 20px;
  background: var(--field-bg);
  border: 2px dashed var(--field-line-strong);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.m-adgal__placeholder svg { width: 44px; height: 44px; }

/* --- Секции под галереей: описание, характеристики, где находится --------------- */

.m-ad__section {
  padding: 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.m-ad__caption {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.m-ad__text {
  font-size: 16px;
  line-height: 26px;
  color: var(--ink);
  overflow-wrap: break-word;
}

.m-ad__text p { margin: 0 0 12px; }
.m-ad__text p:last-child { margin-bottom: 0; }

/* Таблица характеристик: 2 колонки, строки через --sep (§5) */
.m-adprops {
  width: 100%;
  border-collapse: collapse;
}

.m-adprops tr + tr th,
.m-adprops tr + tr td { border-top: 1px solid var(--sep); }

.m-adprops th {
  width: 44%;
  padding: 10px 12px 10px 0;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.m-adprops td {
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: break-word;
}

.m-adprops td a { color: var(--accent-ink); }

/* T77 (п. 4): своё значение пункта «Другое» — отдельной строкой под
   обычными значениями свойства */
.m-adprops__other { display: block; margin-top: 4px; font-weight: 600; color: var(--ink); }

/* «Где находится»: адрес плашкой на --tint; карта появится с ключом
   Яндекс.Карт (решение по Q20) */
.m-admap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--tint);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.m-admap svg {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--accent-ink);
}

/* --- Боковая карточка: цена, контакты (§5) --------------------------------------- */

.m-adside {
  padding: 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.m-adside__title {
  margin: 0 0 10px;
  font-size: 20px;             /* телефон; от 1024 px — 26 px (§5) */
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
}

/* T61: бейдж типа продавца на странице объявления */
.m-adside__seller {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--chip3-soft);
  color: var(--chip3-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.m-adside__seller.is-agent {
  background: var(--chip2-soft);
  color: var(--chip2-ink);
}

.m-adside__seller svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.m-adside__price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  margin: 0 0 2px;
}

.m-adside__price-value {
  font-size: 28px;             /* телефон; от 1024 px — 34 px (§5) */
  font-weight: 800;
  color: var(--ink);
}

.m-adside__price-unit {
  font-size: 16px;
  font-weight: 700;
  color: var(--muted);
}

.m-adside__torg {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.m-adside__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.m-adside__meta li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.m-adside__meta svg { width: 14px; height: 14px; }

.m-adside__contacts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

/* «Показать телефон» — основная кнопка 56 px (§2, §7) */
.m-adside__phone-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px;
  border: 2px solid transparent;
  border-radius: 28px;
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
}

.m-adside__phone-btn svg { width: 20px; height: 20px; }

.m-adside__phone-btn:hover { filter: brightness(1.05); }

.m-adside__phone-btn:active {
  transform: translateY(1px);
  box-shadow: var(--orange-shadow-press);
}

.m-adside__phone-btn:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.m-adside__phone { margin: 0; }

.m-adside__phone a {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}

/* T77 п. 6: Telegram/MAX — вторичные пилюли в блоке контактов */
.m-adside__messengers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.m-adside__messenger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--tile-edge);
  border-radius: var(--r-pill);
  background: var(--tile-fill);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.m-adside__messenger svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.m-adside__messenger:hover {
  background: var(--chip);
  box-shadow: 0 0 0 3px var(--tile-ring);
  text-decoration: none;
}

.m-adside__messenger:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* «Написать продавцу» — вторичная кнопка 52 px (§2, §5); T76 этап 5:
   стекло по токенам, как .button-cancel, а не чёрная рамка C3 */
.m-adside__write {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border: 1px solid var(--tile-edge);
  border-radius: var(--r-pill);
  background: var(--tile-fill);
  box-shadow: var(--tile-shadow);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.m-adside__write:hover {
  background: var(--chip);
  box-shadow: 0 0 0 3px var(--tile-ring);
  text-decoration: none;
}

.m-adside__write:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.m-adside__private { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }

.m-adside__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* «Пожаловаться» — третичная пилюля 46 px (§2) */
.m-adside__complain {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 23px;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.m-adside__complain svg { width: 18px; height: 18px; }

.m-adside__complain:hover { color: var(--ink); text-decoration: none; }

/* --- Карточка продавца (§5) -------------------------------------------------------- */

.m-adseller {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.m-adseller__ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--hero);
  color: var(--hero-ink);
  font-size: 22px;
  font-weight: 800;
}

.m-adseller__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.m-adseller__name {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

a.m-adseller__name:hover { color: var(--accent-ink); text-decoration: none; }

.m-adseller__sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.m-adseller__all {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-ink);
}

.m-adseller__all:hover { color: var(--ink); }

/* --- «Безопасная сделка» — светлая информационная плашка (T77, В2) ---------------
   Была тёмная с тёмным заголовком; по ревью владельца — мягкий зелёный фон,
   тёмно-зелёный текст и иконка щита. Контраст текста ≥ 4.5:1 в обеих темах. */

.m-adsafe {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--safe-line);
  border-radius: 24px;
  background: var(--safe-fill);
}

.m-adsafe__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-icon-box);
  background: var(--ok-bg);
  color: var(--safe-icon);
}

.m-adsafe__icon svg { width: 24px; height: 24px; }

/* Специфичность выше `.m-body h2`, иначе заголовок наследует цвет текста
   страницы и снова станет тёмным на цветном фоне. */
.m-body .m-adsafe__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--safe-ink);
}

.m-body .m-adsafe__list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
  color: var(--safe-ink);
}

.m-adsafe__list li + li { margin-top: 6px; }

@media (max-width: 479.98px) {
  .m-adsafe { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 16px; }
  .m-adsafe__icon { width: 40px; height: 40px; }
}

/* --- Закреплённая панель действий на телефоне (§5) -----------------------------------
   Над нижней навигационной панелью (T17); от 900 px скрыта вместе с ней. */

.m-adbar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(66px + 10px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-pill);
  /* T78: плавающая панель действий — непрозрачная в обеих темах */
  background: var(--menu-bg);
  box-shadow: var(--shadow-float);
}

.m-adbar__phone {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: 24px;
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.m-adbar__phone:hover { filter: brightness(1.05); }

.m-adbar__phone:active {
  transform: translateY(1px);
  box-shadow: var(--orange-shadow-press);
}

.m-adbar__phone:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.m-adbar__write {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 2px solid var(--ink);
  border-radius: 24px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.m-adbar__write:hover { background: var(--bg); text-decoration: none; }

/* T82 (дефект №2 T79): гостю вместо «Написать» — ссылка на вход.
   В нижней панели она занимает отдельную строку, чтобы не сжимать
   «Показать телефон»; высота панели учитывается в padding-bottom. */
.m-adbar { flex-wrap: wrap; }

.m-adbar__write--guest {
  flex: 1 1 100%;
  min-height: 44px;
  padding: 0 14px;
  border-width: 2px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

/* место под панель, чтобы она не накрывала подвал (та же схема, что у таббара T17) */
@media (max-width: 899.98px) {
  body:has(.m-adbar) { padding-bottom: 148px; }
  body:has(.m-adbar--guest) { padding-bottom: 200px; }
}

@media (min-width: 900px) {
  .m-adbar { display: none; }
}

/* ===========================================================================
   Компьютер (от 1024 px): 3 колонки плитки, фильтр-колонка, две колонки
   страницы объявления (§4, §5)
   =========================================================================== */

@media (min-width: 1024px) {

  .m-ads__layout { gap: 24px; flex-wrap: nowrap; }

  .m-ads__head { margin-bottom: 20px; }

  .m-ads__title { font-size: 36px; }          /* §4 */

  .m-adscats { margin-bottom: 20px; }

  .m-ads__chips {
    margin: 0;
    padding: 4px 2px;
    flex-wrap: wrap;
    overflow: visible;
    /* затухание краёв — только у прокручиваемого ряда на телефоне */
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* §9: не больше двух рядов, остальное под «Ещё N» (класс ставит JS);
     104 = паддинги 2×4 + два ряда по 44 + зазор 8 */
  .m-ads__chips.is-clamped { max-height: 104px; overflow: hidden; }

  .m-ads__chips .m-chip { min-height: 44px; } /* §9 */

  .m-adfilter { flex: 0 0 272px; }            /* §4 */

  .m-adfilter__toggle { display: none; }      /* карточка развёрнута всегда */

  /* Карточка фильтра (§9): лёгкий градиент, контур 1px градиентом
     (border: transparent + background-clip), радиус 28, паддинг 20 */
  .m-adfilter .m-adfilter__panel {
    display: block;
    padding: 20px;
    border: 1px solid transparent;
    border-radius: 28px;
    background:
      var(--filter-fill) padding-box,
      var(--filter-edge) border-box;
    box-shadow: var(--shadow);
  }

  .m-adfilter__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
  }

  .m-adfilter__close { display: none; }

  .m-ads__content { flex: 1 1 auto; }

  .m-ads__grid {
    grid-template-columns: repeat(3, 1fr);    /* §4: 3 колонки */
    gap: 16px;
  }

  .m-adcard { border-radius: var(--r-card); } /* T76: 26 px */

  .m-adcard__photo { height: 200px; }         /* §4 */

  .m-adcard__price { font-size: 16px; }       /* §7: 16 px на широких карточках */

  .m-adpages__next { flex: 0 0 auto; }

  /* Страница объявления: основная + боковая 380 px (§5) */
  .m-ad {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
  }

  .m-ad__side { flex: 0 0 380px; }

  .m-ad__main,
  .m-ad__side { display: flex; flex-direction: column; gap: 24px; }

  .m-adgal { padding: 16px; border-radius: 28px; }

  .m-adgal__main { height: 480px; border-radius: 20px; }   /* §5 */

  .m-adgal__thumb { width: 108px; height: 76px; }          /* §5 */

  .m-ad__section { padding: 28px; border-radius: var(--r-block); }

  .m-adside { padding: 26px; border-radius: 28px; }

  .m-adside__title { font-size: 26px; }       /* §5 */

  .m-adside__price-value { font-size: 34px; } /* §5 */

  .m-ads__grid--similar { grid-template-columns: repeat(4, 1fr); }

  .m-ads__grid--similar .m-adcard__photo { height: 128px; }

  .m-ads__grid--similar .m-adcard__price { font-size: 14px; }
}

/* ===========================================================================
   Телефон: фильтр — пилюля и нижний лист (§4)
   =========================================================================== */

@media (max-width: 1023.98px) {

  /* Телефон: боковые блоки (цена, контакты, продавец) — сразу под галереей
     (§5); описание, характеристики, «Где находится» и «Похожие» — ниже.
     display: contents раскрывает .m-ad__main, порядок задаётся явно. */
  .m-ad__main { display: contents; }

  .m-adgal { order: 1; }

  .m-ad__side { order: 2; }

  .m-ad__section { order: 3; }   /* равный порядок — по порядку в DOM */

  .m-adfilter__toggle {
    position: fixed;
    right: 16px;
    bottom: calc(66px + 12px + env(safe-area-inset-bottom, 0px));
    z-index: 45;
    box-shadow: var(--shadow-float);
  }

  /* над таббаром (T17) он виден до 900 px, выше — просто у нижнего края */
  @media (min-width: 900px) {
    .m-adfilter__toggle { bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  }

  .m-adfilter .m-adfilter__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: block;
    max-height: 82vh;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    /* T78: нижняя шторка фильтра — непрозрачная панель в обеих темах */
    background: var(--menu-bg);
    box-shadow: var(--shadow-card-lg);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform .2s ease, visibility .2s;
  }

  .m-adfilter .m-adfilter__panel.is-open {
    transform: translateY(0);
    visibility: visible;
  }

  .m-adfilter__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
  }

  .m-adfilter__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
  }

  .m-adfilter__close svg { width: 22px; height: 22px; }

  .m-adfilter__close:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
  }

  /* Подложка под нижним листом */
  body.m-adfilter-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--scrim);
  }

  body.m-adfilter-open { overflow: hidden; }

  /* Кружки постраничности на телефоне чуть компактнее, «Дальше» — пилюля */
  .m-adpages__page,
  .m-adpages__nav { width: 40px; height: 40px; }
}

/* ===========================================================================
   T56b: действия модератора в списке /moderation для Объявлений.
   Ядро кладёт кнопки в list_actions_menu (content/hooks/moderation_list.php),
   но для Board используется board_list.tpl.php, где меню не выводилось.
   Оформление — по токенам, цель касания ≥ 44 px, в обычном списке блок
   не появляется (меню пустое).
   =========================================================================== */

.m-modactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--sep);
  background: var(--tint);
  border-radius: var(--r-tile) var(--r-tile) 0 0;
}

.m-modactions__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--btn-reg-border);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--btn-reg-from), var(--btn-reg-to));
  box-shadow: var(--btn-reg-shadow);
  color: var(--btn-reg-ink);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.m-modactions__btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--btn-reg-shadow-hover);
  text-decoration: none;
}

.m-modactions__btn:active {
  transform: none;
  box-shadow: var(--btn-reg-shadow-active);
}

.m-modactions__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.m-modactions__btn.accept {
  border-color: transparent;
  background: var(--orange-fill);
  box-shadow: var(--orange-shadow);
  color: var(--orange-ink);
}

.m-modactions__btn.accept:hover {
  box-shadow: var(--orange-shadow), 0 10px 22px rgba(42,30,18,.18);
}

.m-modactions__btn.accept:active {
  box-shadow: var(--orange-shadow-press);
}

.m-modactions__btn.delete,
.m-modactions__btn.refuse {
  border-color: var(--danger);
  background: var(--danger-bg);
  box-shadow: none;
  color: var(--danger-ink);
}

@media (max-width: 420px) {
  .m-modactions { padding: 8px; }
  .m-modactions__btn { flex: 1 1 calc(50% - 6px); }
}
