/* ==========================================================================
   Барахолка (v1.3): лента-сетка, карточки, фильтры, галерея, подача, кабинет, заказы.
   Только токены дизайн-системы из main.css; мобильная вёрстка — в первую очередь.
   ========================================================================== */

:root {
  --bh-gap: 10px;
  --bh-radius: var(--r-md);
  --bh-hl-bg: var(--c-accent-soft);
  --bh-hl-border: var(--c-accent);
  --bh-vip: var(--brand-lights);
  --bh-vip-text: var(--c-on-warning);
}

/* ---------- шапка раздела ---------- */
.bh-top { display: grid; gap: var(--s-3); margin-bottom: var(--s-4); min-width: 0; }
.bh-top__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.bh-top__title { margin: 0; font-size: var(--fs-24); line-height: var(--lh-tight); letter-spacing: -.01em; }
.bh-top__title a { color: inherit; text-decoration: none; }
.bh-top__links { display: flex; align-items: center; gap: var(--s-2); }

.bh-search { display: grid; gap: var(--s-2); min-width: 0; }
.bh-search__bar { display: flex; gap: var(--s-2); min-width: 0; }
.bh-search__field { flex: 1; min-width: 0; margin: 0; }
.bh-search__field .input { width: 100%; height: var(--tap); border-radius: var(--r-pill); }
.bh-search__go { flex: none; border-radius: var(--r-pill); }
.bh-search__filters { flex: none; position: relative; border-radius: var(--r-pill); min-width: var(--tap); padding-inline: var(--s-3); }
.bh-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--c-accent); }

.bh-filters { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--s-4); }
.bh-filters__grid { display: grid; gap: var(--s-3); grid-template-columns: 1fr 1fr; align-items: end; }
.bh-filters__grid .field { margin: 0; min-width: 0; }
.bh-filters__grid .field:first-child { grid-column: 1 / -1; }
.bh-filters__photo { grid-column: 1 / -1; }
.bh-filters__foot { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-3); }
.bh-range { display: flex; align-items: center; gap: var(--s-2); }
.bh-range .input { min-width: 0; width: 100%; }
.bh-js .bh-filters:not(.is-open) { display: none; }
@media (min-width: 960px) {
  .bh-top { grid-template-columns: 1fr; }
  .bh-filters__grid { grid-template-columns: 1.4fr 1fr 1fr 1fr auto; }
  .bh-filters__grid .field:first-child, .bh-filters__photo { grid-column: auto; }
  .bh-filters__photo { padding-bottom: var(--s-2); }
}

/* разделы — плитка с горизонтальной прокруткой на телефоне */
.bh-sections { display: flex; gap: var(--s-2); overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px var(--s-2);
  margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
.bh-sections::-webkit-scrollbar { display: none; }
.bh-section { flex: none; scroll-snap-align: start; display: grid; justify-items: center; gap: 6px; width: 84px; padding: var(--s-2) 4px;
  border-radius: var(--r-md); color: var(--c-text); text-decoration: none; text-align: center; font-size: var(--fs-12); line-height: 1.25;
  transition: background var(--dur) var(--ease); }
.bh-section:hover { background: var(--c-surface-2); }
.bh-section.is-active { background: var(--c-primary-soft); color: var(--c-primary-soft-text); font-weight: 600; }
.bh-section__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--c-surface-2); color: var(--c-primary); }
.bh-section__icon .icon { width: 26px; height: 26px; }
.bh-section__icon--goods { background: var(--c-primary-soft); }
.bh-section__icon--buy { background: var(--c-info-soft); color: var(--c-info-soft-text); }
.bh-section__icon--free { background: var(--c-success-soft); color: var(--c-success-soft-text); }
.bh-section__icon--vacancy, .bh-section__icon--resume { background: var(--c-warning-soft); color: var(--c-warning-soft-text); }
.bh-section__icon--services { background: var(--c-accent-soft); color: var(--c-accent-soft-text); }
.bh-section__icon--realty { background: var(--c-neutral-soft); color: var(--c-neutral-soft-text); }
.bh-section__icon--lost { background: var(--c-danger-soft); color: var(--c-danger-soft-text); }
.bh-section__name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 960px) {
  .bh-sections { margin-inline: 0; padding-inline: 2px; flex-wrap: wrap; overflow: visible; }
  .bh-section { width: 104px; font-size: var(--fs-13); }
}
.bh-subcats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
.bh-subcats .chip { flex: none; }
@media (min-width: 960px) { .bh-subcats { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; } }

/* ---------- результаты, сетка ---------- */
.bh-results { min-height: 40vh; transition: opacity var(--dur) var(--ease); }
.bh-results.htmx-request { opacity: .55; }
.bh-results__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: var(--s-3); flex-wrap: wrap; }
.bh-results__title { margin: 0; font-size: var(--fs-18); line-height: var(--lh-snug); min-width: 0; overflow-wrap: anywhere; }
.bh-saved-search { display: inline-flex; align-items: center; gap: 6px; color: var(--c-success-soft-text); font-size: var(--fs-14); font-weight: 600; }
.bh-saved-search .icon { width: 18px; height: 18px; }

.bh-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4) var(--bh-gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .bh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .bh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-6) var(--s-4); } }
@media (min-width: 1180px) { .bh-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.bh-grid--row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 960px) { .bh-grid--row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.bh-card { position: relative; min-width: 0; border-radius: var(--bh-radius); }
.bh-card__link { display: grid; gap: var(--s-2); color: var(--c-text); text-decoration: none; }
.bh-card__media { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: var(--bh-radius); overflow: hidden; background: var(--c-surface-2); }
.bh-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 300ms var(--ease); }
.bh-card__link:hover .bh-card__media img { transform: scale(1.03); }
.bh-card__noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--c-text-3); }
.bh-card__noimg .icon { width: 36px; height: 36px; opacity: .6; }
.bh-card__badges { position: absolute; left: 6px; top: 6px; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 48px); }
.bh-card__body { display: grid; gap: 2px; min-width: 0; padding-inline: 2px; }
.bh-card__price { font-size: var(--fs-18); font-weight: 750; line-height: 1.2; letter-spacing: -.01em; overflow-wrap: anywhere; }
.bh-card__title { font-size: var(--fs-14); line-height: 1.3; color: var(--c-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bh-card__link:hover .bh-card__title { color: var(--c-primary); }
.bh-card__meta, .bh-card__time { font-size: var(--fs-12); color: var(--c-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-card--hl { background: var(--bh-hl-bg); box-shadow: 0 0 0 2px var(--bh-hl-border); padding: 6px 6px var(--s-2); }
.bh-card--hl .bh-fav { top: 12px; right: 12px; }

.bh-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .92);
  color: #1C1424; font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .01em; }
.bh-badge--vip { background: var(--bh-vip); color: var(--bh-vip-text); }
.bh-badge--free { background: var(--c-success); color: #fff; }
.bh-badge--urgent { background: var(--c-danger); color: #fff; }
.bh-badge--demo { background: var(--c-neutral-soft); color: var(--c-neutral-soft-text); }
.bh-badge--plain { background: var(--c-surface-2); color: var(--c-text-2); height: 24px; font-size: var(--fs-12); }

.bh-fav { position: absolute; top: 6px; right: 6px; margin: 0; }
.bh-fav__btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9);
  color: #4E4459; cursor: pointer; box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease); }
.bh-fav__btn:hover { transform: scale(1.08); }
.bh-fav__btn:active { transform: scale(.92); }
.bh-fav__btn.is-on { color: #D7265E; }
.bh-fav__btn .icon { width: 20px; height: 20px; }
.bh-fav--big { position: static; }
.bh-fav--big .bh-fav__btn, a.bh-fav--big { display: inline-flex; gap: var(--s-2); width: 100%; height: var(--tap); border-radius: var(--r-md); border: 1px solid var(--c-border);
  background: var(--c-surface); color: var(--c-text); font: inherit; font-weight: 600; box-shadow: none; place-items: initial; justify-content: center; align-items: center; text-decoration: none; }
.bh-fav--big .bh-fav__btn.is-on { color: #D7265E; border-color: currentColor; }

.bh-more { grid-column: 1 / -1; display: grid; justify-items: center; gap: var(--s-2); padding-block: var(--s-4); }
.bh-more.htmx-request .btn { opacity: .6; pointer-events: none; }

/* VIP-полоса */
.bh-vip { margin-bottom: var(--s-6); padding: var(--s-3); border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--c-warning-soft), var(--c-accent-soft)); }
.bh-vip__title { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--s-3); font-size: var(--fs-16); color: var(--c-warning-soft-text); }
.bh-vip__title .icon { width: 18px; height: 18px; }
.bh-vip__list { list-style: none; margin: 0; padding: 0 0 4px; display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: var(--bh-gap);
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.bh-vip__list > li { scroll-snap-align: start; }
@media (min-width: 600px) { .bh-vip__list { grid-auto-columns: calc((100% - 2 * var(--bh-gap)) / 3); } }
@media (min-width: 960px) { .bh-vip__list { grid-auto-columns: calc((100% - 4 * var(--s-4)) / 5); gap: var(--s-4); } }

/* плавающая кнопка */
.bh-fab { position: fixed; z-index: 40; right: var(--gutter); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: var(--s-2); height: 52px; padding: 0 var(--s-5); border-radius: var(--r-pill);
  background: var(--c-accent); color: #fff; font-weight: 700; text-decoration: none; box-shadow: var(--shadow-2);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.bh-fab:hover { background: var(--c-accent-hover); color: #fff; transform: translateY(-2px); }
.bh-fab .icon { width: 22px; height: 22px; }
@media (min-width: 960px) { .bh-fab { bottom: var(--s-8); right: var(--s-8); } }
@media (max-width: 359px) { .bh-fab span { display: none; } .bh-fab { width: 52px; padding: 0; justify-content: center; } }
.bh-page .site-footer { padding-bottom: 80px; }

/* ---------- карточка объявления ---------- */
.bh-detail { display: grid; gap: var(--s-5); min-width: 0; }
.bh-detail__main { min-width: 0; display: grid; gap: var(--s-4); }
@media (min-width: 960px) {
  .bh-detail { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-8); align-items: start; }
  .bh-detail__aside { position: sticky; top: calc(var(--header-h) + var(--s-4)); }
}
.bh-gallery { position: relative; margin-inline: calc(var(--gutter) * -1); background: var(--c-surface-2); }
@media (min-width: 960px) { .bh-gallery { margin-inline: 0; border-radius: var(--r-lg); overflow: hidden; } }
.bh-gallery__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; outline-offset: -3px; }
.bh-gallery__track::-webkit-scrollbar { display: none; }
.bh-gallery__slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; }
.bh-gallery__open { all: unset; cursor: zoom-in; display: grid; width: 100%; height: 100%; }
.bh-gallery__open:focus-visible { outline: 3px solid var(--c-focus); outline-offset: -3px; }
.bh-gallery__slide img { width: 100%; height: 100%; object-fit: contain; background: #120A18; }
.bh-gallery__count { position: absolute; right: var(--s-3); bottom: var(--s-3); padding: 3px 9px; border-radius: var(--r-pill); background: rgba(20, 8, 28, .7);
  color: #fff; font-size: var(--fs-12); font-weight: 600; }
.bh-gallery__nav { position: absolute; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .9); color: #1C1424; cursor: pointer; box-shadow: var(--shadow-2); }
.bh-gallery__nav--prev { left: var(--s-3); }
.bh-gallery__nav--next { right: var(--s-3); }
.bh-gallery__thumbs { display: flex; gap: var(--s-2); padding: var(--s-2); background: var(--c-surface); overflow-x: auto; }
.bh-gallery__thumbs button { flex: none; padding: 0; border: 2px solid transparent; border-radius: var(--r-xs); overflow: hidden; cursor: pointer; background: none; }
.bh-gallery__thumbs button[aria-current] { border-color: var(--c-primary); }
.bh-gallery__thumbs img { display: block; width: 80px; height: 60px; object-fit: cover; }
.bh-gallery--empty, .bh-gallery__none { display: grid; place-items: center; gap: var(--s-2); aspect-ratio: 16 / 7; color: var(--c-text-3); }
.bh-gallery__none .icon { width: 48px; height: 48px; }

.bh-detail__head { display: grid; gap: var(--s-2); }
.bh-detail__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.bh-detail__title { margin: 0; font-size: var(--fs-24); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.bh-detail__price { margin: 0; font-size: var(--fs-30); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.bh-detail__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--c-text-3); font-size: var(--fs-14); }
.bh-detail__meta .icon { width: 16px; height: 16px; }
.bh-detail__section { display: grid; gap: var(--s-2); }
.bh-detail__h2 { margin: 0; font-size: var(--fs-18); }
.bh-detail__text { font-size: var(--fs-16); line-height: var(--lh-ui); overflow-wrap: anywhere; white-space: normal; }
.bh-detail__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--c-border); }
.bh-specs { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px var(--s-4); margin: 0; font-size: var(--fs-14); }
.bh-specs dt { color: var(--c-text-3); }
.bh-specs dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.bh-scam { font-size: var(--fs-14); }

.bh-actions { display: grid; gap: var(--s-2); }
.bh-actions--mobile { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; padding: var(--s-2) 0; background: var(--c-bg); }
.bh-phone { display: grid; gap: 4px; }
.bh-phone form { margin: 0; }
.bh-phone__number { font-variant-numeric: tabular-nums; font-size: var(--fs-18); }
.bh-buy { display: grid; gap: var(--s-3); }
.bh-seller { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); margin-inline: calc(var(--s-3) * -1); border-radius: var(--r-md); color: var(--c-text); text-decoration: none; }
.bh-seller:hover { background: var(--c-surface-2); }
.bh-seller > span { display: grid; gap: 2px; flex: 1; min-width: 0; font-size: var(--fs-14); }
.bh-owner { display: grid; gap: var(--s-2); }
.bh-owner form { margin: 0; }

/* полноэкранный просмотр */
.bh-viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0B0610; color: #fff; }
.bh-viewer::backdrop { background: #0B0610; }
.bh-viewer[open] { display: grid; }
.bh-viewer__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; height: 100dvh; }
.bh-viewer__track::-webkit-scrollbar { display: none; }
.bh-viewer__slide { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; }
.bh-viewer__slide img { max-width: 100%; max-height: 100dvh; object-fit: contain; }
.bh-viewer__close { position: fixed; top: var(--s-3); right: var(--s-3); z-index: 2; background: rgba(255, 255, 255, .15); color: #fff; }
.bh-viewer__nav { position: fixed; top: 50%; transform: translateY(-50%); z-index: 2; display: grid; place-items: center; width: 48px; height: 48px; border: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; cursor: pointer; }
.bh-viewer__nav--prev { left: var(--s-3); }
.bh-viewer__nav--next { right: var(--s-3); }
.bh-viewer__count { position: fixed; left: 50%; bottom: var(--s-4); transform: translateX(-50%); font-size: var(--fs-14); opacity: .8; }
.bh-noscroll, .bh-noscroll body { overflow: hidden; }
@media (max-width: 599px) { .bh-viewer__nav { display: none; } }

/* цитата объявления в ЛС */
.bh-quote { display: flex; align-items: center; gap: var(--s-3); margin: 4px 0 6px; padding: var(--s-2); border-radius: var(--r-sm); background: var(--c-surface-2);
  color: var(--c-text); text-decoration: none; border-left: 3px solid var(--c-accent); max-width: 100%; }
.msg--own .bh-quote { background: rgba(255, 255, 255, .14); color: inherit; }
.bh-quote img { flex: none; width: 56px; height: 56px; border-radius: var(--r-xs); object-fit: cover; }
.bh-quote > span { display: grid; gap: 1px; min-width: 0; }
.bh-quote__label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.bh-quote__title { font-weight: 600; font-size: var(--fs-14); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-quote__price { font-weight: 700; font-size: var(--fs-14); }
.bh-write { display: grid; gap: var(--s-4); }

/* блок на главной */
.bh-home__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-2); }
.bh-mini { display: grid; gap: 2px; color: var(--c-text); text-decoration: none; min-width: 0; }
.bh-mini img, .bh-mini__noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--c-surface-2); display: grid; place-items: center; color: var(--c-text-3); }
.bh-mini__price { font-weight: 750; font-size: var(--fs-14); margin-top: 4px; }
.bh-mini__title { font-size: var(--fs-13); color: var(--c-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-mini:hover .bh-mini__title { color: var(--c-primary); }
.bh-home .row { flex-wrap: nowrap; }

/* ---------- пошаговая подача ---------- */
.bh-wizard { max-width: 720px; margin-inline: auto; display: grid; gap: var(--s-4); min-width: 0; }
.bh-wizard__head { display: flex; align-items: center; gap: var(--s-3); }
.bh-wizard__head > div { flex: 1; min-width: 0; }
.bh-wizard__title { margin: 0; font-size: var(--fs-20); }
.bh-wizard__step { margin: 0; color: var(--c-text-3); font-size: var(--fs-13); }
.bh-wizard__q { margin: 0 0 var(--s-2); font-size: var(--fs-18); font-weight: 650; }
.bh-wizard__nav { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: var(--s-2); justify-content: space-between;
  padding: var(--s-3) 0; background: var(--c-bg); border-top: 1px solid var(--c-border); margin-top: var(--s-2); }
.bh-wizard__nav > :last-child { flex: 1; max-width: 360px; margin-left: auto; }
.bh-autosave { font-size: var(--fs-12); color: var(--c-text-3); text-align: right; }
.bh-saved { color: var(--c-success-soft-text); }
.bh-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; counter-reset: s; }
.bh-steps__item > a, .bh-steps__item > span { display: grid; gap: 4px; color: var(--c-text-3); text-decoration: none; font-size: 11px; }
.bh-steps__item b { display: block; height: 4px; border-radius: 2px; background: var(--c-surface-3); font-size: 0; }
.bh-steps__item.is-done b { background: var(--c-primary); }
.bh-steps__item.is-current b { background: var(--c-accent); }
.bh-steps__item.is-current { color: var(--c-text); font-weight: 600; }
.bh-steps__item.is-current > span { color: var(--c-text); }
.bh-steps__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 599px) { .bh-steps__name { display: none; } }

.bh-cats { display: grid; gap: var(--s-2); }
.bh-cat { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; padding: var(--s-2) var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); cursor: pointer; list-style: none; }
.bh-cat::-webkit-details-marker { display: none; }
.bh-cat:has(input:checked) { border-color: var(--c-primary); box-shadow: 0 0 0 1px var(--c-primary); }
.bh-cat input, .bh-subcat input { accent-color: var(--c-primary); width: 20px; height: 20px; flex: none; }
.bh-cat > label > input { order: 3; }
.bh-cat__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none; background: var(--c-surface-2); color: var(--c-primary); }
.bh-cat__name { flex: 1; font-weight: 600; min-width: 0; }
.bh-cat__paid { font-size: var(--fs-12); font-weight: 700; color: var(--c-warning-soft-text); background: var(--c-warning-soft); padding: 2px 8px; border-radius: var(--r-pill); }
.bh-cat__chev { transition: transform var(--dur) var(--ease); }
.bh-cat-group[open] .bh-cat__chev { transform: rotate(180deg); }
.bh-cat-group__list { display: grid; gap: 2px; padding: var(--s-2) 0 var(--s-2) 52px; }
.bh-subcat { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); padding: 0 var(--s-2); border-radius: var(--r-sm); cursor: pointer; }
.bh-subcat:hover { background: var(--c-surface-2); }
.bh-subcat span:first-of-type { flex: 1; }

.bh-seg { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bh-seg__item { position: relative; }
.bh-seg__item input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.bh-seg__item span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); border-radius: var(--r-pill); border: 1px solid var(--c-border-strong);
  background: var(--c-surface); font-size: var(--fs-14); font-weight: 500; }
.bh-seg__item input:checked + span { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.bh-seg__item input:focus-visible + span { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.bh-price-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-3); }

.bh-photos { display: grid; gap: var(--s-3); }
.bh-photos.htmx-request { opacity: .6; }
.bh-photos__grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
@media (min-width: 600px) { .bh-photos__grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.bh-photos__item { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--c-surface-2); cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.bh-photos__item img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bh-photos__item.is-dragging { transform: scale(1.06); box-shadow: var(--shadow-3); z-index: 2; cursor: grabbing; }
.bh-photos__cover { position: absolute; left: 4px; bottom: 4px; padding: 2px 6px; border-radius: var(--r-pill); background: var(--c-accent); color: #fff; font-size: 11px; font-weight: 700; }
.bh-photos__del, .bh-photos__make-cover { position: absolute; top: 4px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(20, 8, 28, .65); color: #fff; cursor: pointer; }
.bh-photos__del { right: 4px; }
.bh-photos__make-cover { left: 4px; }
.bh-photos__del .icon, .bh-photos__make-cover .icon { width: 16px; height: 16px; }
.bh-dropzone { min-height: 140px; }

.bh-preview { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); }
.bh-grid--preview { grid-template-columns: minmax(0, 220px); }
.bh-preview__info { display: grid; gap: var(--s-2); }
@media (min-width: 600px) { .bh-preview { grid-template-columns: 220px minmax(0, 1fr); } .bh-grid--preview { grid-template-columns: 1fr; } }

/* ---------- кабинет ---------- */
.bh-tabs { overflow-x: auto; flex-wrap: nowrap; margin-bottom: var(--s-4); }
.bh-tabs .tabs__link { white-space: nowrap; }
.bh-mine { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.bh-mine__item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
.bh-mine__media { display: block; aspect-ratio: 4 / 3; border-radius: var(--r-sm); overflow: hidden; background: var(--c-surface-2); }
.bh-mine__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bh-mine__body { display: grid; gap: 4px; min-width: 0; }
.bh-mine__title { font-weight: 650; color: var(--c-text); text-decoration: none; overflow-wrap: anywhere; }
.bh-mine__price { font-weight: 750; }
.bh-mine__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-3); font-size: var(--fs-13); color: var(--c-text-3); }
.bh-mine__meta .icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.bh-mine__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); grid-column: 1 / -1; }
.bh-mine__actions form { margin: 0; }
@media (max-width: 599px) { .bh-mine__actions { margin-left: -108px; } }
@media (min-width: 600px) { .bh-mine__item { grid-template-columns: 160px minmax(0, 1fr); } }

.bh-searches__form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: 0; }

/* ---------- продвижение и заказ ---------- */
.bh-tariffs { display: grid; gap: var(--s-2); }
.bh-tariff { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); cursor: pointer; }
.bh-tariff:has(input:checked) { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); background: var(--c-accent-soft); }
.bh-tariff input { width: 20px; height: 20px; accent-color: var(--c-accent); flex: none; }
.bh-tariff__body { flex: 1; display: grid; gap: 2px; min-width: 0; }
.bh-tariff__title { font-weight: 650; }
.bh-tariff__desc { font-size: var(--fs-13); color: var(--c-text-3); }
.bh-tariff__price { font-weight: 800; font-size: var(--fs-18); white-space: nowrap; }
.bh-tariff--package { border-style: dashed; }

.bh-order { display: grid; gap: var(--s-4); }
.bh-order__card { display: grid; gap: var(--s-2); justify-items: start; }
.bh-order__label { margin: 0; color: var(--c-text-3); font-size: var(--fs-13); text-transform: uppercase; letter-spacing: .06em; }
.bh-order__number { margin: 0; font-size: var(--fs-30); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bh-order__sum { margin: 0; font-size: var(--fs-38); font-weight: 800; letter-spacing: -.02em; color: var(--c-primary); }
.bh-order__items { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 4px; border-top: 1px solid var(--c-border); padding-top: var(--s-2); }
.bh-order__items li { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-14); }
.bh-pay { display: grid; gap: var(--s-3); border: 2px solid var(--c-primary); }
.bh-pay .box__title { display: flex; align-items: center; gap: var(--s-2); }
.bh-pay__text { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--c-surface-2); font-size: var(--fs-16); overflow-wrap: anywhere; }
.bh-pay__text p { margin: 0 0 var(--s-2); }
.bh-pay__text p:last-child { margin: 0; }
.bh-pay__note { display: flex; gap: var(--s-2); margin: 0; font-size: var(--fs-14); color: var(--c-text-2); }
.bh-pay__note .icon { flex: none; margin-top: 2px; }
.bh-pay .form__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bh-pay .form__actions form { margin: 0; }

/* ---------- панель ---------- */
.bh-panel-nav { overflow-x: auto; flex-wrap: nowrap; margin-bottom: var(--s-4); }
.bh-panel-nav .tabs__link { white-space: nowrap; }
.bh-qrow { display: flex; gap: var(--s-3); align-items: flex-start; min-width: 0; }
.bh-qrow__img { flex: none; width: 72px; height: 54px; border-radius: var(--r-xs); object-fit: cover; background: var(--c-surface-2); display: grid; place-items: center; }
.bh-pphotos { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.bh-pphotos img { width: 160px; height: 120px; object-fit: cover; border-radius: var(--r-sm); display: block; }
.bh-ban > summary { list-style: none; cursor: pointer; }
.bh-ban > summary::-webkit-details-marker { display: none; }
.bh-ban[open] > summary { margin-bottom: var(--s-3); }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: var(--fs-13); }

@media (prefers-reduced-motion: reduce) {
  .bh-card__media img, .bh-fab, .bh-fav__btn, .bh-photos__item { transition: none; }
}
.bh-top__links .btn { white-space: nowrap; }
.site-header .header-user__name { white-space: nowrap; }
.bh-mine__meta > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bh-mine__meta .icon { margin: 0; }
.box__title > .icon { display: inline-block; vertical-align: -3px; margin-right: 6px; }
.bh-detail__foot .share-bar { border: 0; padding: 0; margin: 0; }

/* ==========================================================================
   v1.3, Дополнение 3: привычная структура доски объявлений (лента с фильтрами слева, белые карточки,
   плитка/список, страница объявления «галерея слева — цена и связь справа»). Цвета и шрифты — сайта.
   ========================================================================== */
.bh-crumbs { margin-bottom: var(--s-3); }
.bh-search { gap: var(--s-3); }
.bh-search__add { flex: none; border-radius: var(--r-pill); white-space: nowrap; }
.bh-sections { padding-bottom: 0; }
.bh-mobile-bar { display: flex; gap: var(--s-2); overflow-x: auto; }
.bh-mobile-bar .btn { position: relative; flex: none; }

.bh-layout { display: grid; gap: var(--s-5); margin-top: var(--s-4); min-width: 0; }
@media (min-width: 960px) { .bh-layout { grid-template-columns: 250px minmax(0, 1fr); gap: var(--s-6); align-items: start; } }

/* фильтры: колонка слева на компьютере, шторка снизу на телефоне */
.bh-sheet__panel { display: grid; gap: var(--s-4); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--s-4); }
.bh-sheet__backdrop { display: none; }
.bh-sheet__head { display: flex; align-items: center; justify-content: space-between; }
.bh-sheet__foot { display: grid; gap: var(--s-2); }
.bh-filter { display: grid; gap: var(--s-2); margin: 0; }
.bh-filter__title { margin: 0; font-size: var(--fs-14); font-weight: 700; color: var(--c-text); }
.bh-tree, .bh-tree ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bh-tree ul { padding-left: var(--s-3); margin: 2px 0 var(--s-2); border-left: 2px solid var(--c-border); }
.bh-tree a { display: block; padding: 5px var(--s-2); border-radius: var(--r-xs); color: var(--c-text-2); text-decoration: none; font-size: var(--fs-14); }
.bh-tree a:hover { background: var(--c-surface-2); color: var(--c-text); }
.bh-tree a[aria-current] { color: var(--c-primary); font-weight: 700; background: var(--c-primary-soft); }
.bh-filter .bh-seg__item span { min-height: 34px; padding: 0 var(--s-3); font-size: var(--fs-13); }
@media (min-width: 960px) {
  .bh-side { position: sticky; top: calc(var(--header-h) + var(--s-3)); max-height: calc(100vh - var(--header-h) - var(--s-6)); overflow: auto; }
}
@media (max-width: 959px) {
  .bh-js .bh-sheet:not(.is-open) { display: none; }
  .bh-js .bh-sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; }
  .bh-js .bh-sheet__backdrop { display: block; position: absolute; inset: 0; background: var(--c-overlay); }
  .bh-js .bh-sheet__panel { position: relative; width: 100%; max-height: 86dvh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom)); animation: bh-sheet-up 220ms var(--ease); }
  .bh-js .bh-sheet__foot { position: sticky; bottom: calc(var(--s-4) * -1 - env(safe-area-inset-bottom)); background: var(--c-surface); padding-top: var(--s-2); }
}
@keyframes bh-sheet-up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* шапка результатов */
.bh-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-2); }
.bh-toolbar__title { margin: 0; font-size: var(--fs-20); line-height: var(--lh-snug); min-width: 0; overflow-wrap: anywhere; }
.bh-toolbar__count { color: var(--c-text-3); font-weight: 500; font-size: var(--fs-16); white-space: nowrap; }
.bh-toolbar__controls { display: flex; align-items: center; gap: var(--s-2); }
.bh-toolbar__sort { height: 38px; min-width: 0; width: auto; font-size: var(--fs-14); }
.bh-view { display: inline-flex; border: 1px solid var(--c-border); border-radius: var(--r-sm); overflow: hidden; }
.bh-view__btn { display: grid; place-items: center; width: 38px; height: 36px; color: var(--c-text-3); }
.bh-view__btn.is-active { background: var(--c-primary-soft); color: var(--c-primary); }
.bh-results__save { margin-bottom: var(--s-3); }
@media (min-width: 960px) { .bh-toolbar__title { font-size: var(--fs-24); } }

/* сетка: телефон 2, планшет 3, компьютер 4 */
.bh-grid { gap: var(--s-3) var(--bh-gap); }
@media (min-width: 600px) { .bh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); } }
@media (min-width: 960px) { .bh-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .bh-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* белая карточка */
.bh-card { background: var(--c-surface); border-radius: var(--r-md); overflow: hidden; box-shadow: 0 0 0 1px var(--c-border); display: flex; flex-direction: column;
  transition: box-shadow var(--dur) var(--ease); }
.bh-card:hover { box-shadow: 0 0 0 1px var(--c-border), var(--shadow-2); }
.bh-card__media { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 0; background: var(--c-surface-2); }
.bh-card__media img { transition: none; }
.bh-card__link:hover .bh-card__media img { transform: none; }
.bh-card__body { display: grid; gap: 3px; padding: var(--s-2) var(--s-3) var(--s-3); }
.bh-card__title { order: 1; font-size: var(--fs-14); line-height: 1.3; color: var(--c-primary); text-decoration: none; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.bh-card__title:hover { color: var(--c-accent); text-decoration: underline; }
.bh-card__title::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.bh-card { position: relative; }
.bh-card__price { order: 2; font-size: var(--fs-18); font-weight: 800; color: var(--c-text); }
.bh-card__desc { display: none; order: 3; }
.bh-card__meta { order: 4; margin-top: 2px; }
.bh-card__time { order: 5; }
.bh-card .bh-fav { z-index: 2; top: 8px; right: 8px; }
.bh-card__media[data-bh-photos] { z-index: 2; }
.bh-card__badges { left: 8px; top: 8px; z-index: 2; pointer-events: none; }
.bh-card__dots { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; gap: 4px; padding: 0 var(--s-3); pointer-events: none; }
.bh-card__dots i { flex: 1; max-width: 22px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .55); box-shadow: 0 0 2px rgba(0, 0, 0, .25); }
.bh-card__dots i.is-on { background: #fff; }
.bh-card--hl { background: var(--bh-hl-bg); box-shadow: 0 0 0 2px var(--bh-hl-border); padding: 0; }
.bh-card--hl .bh-fav { top: 8px; right: 8px; }
.bh-card--vip .bh-card__price { color: var(--c-accent); }
.bh-badge { height: 22px; font-size: 11px; }

/* вид «Список» */
.bh-grid--list { grid-template-columns: minmax(0, 1fr) !important; gap: var(--s-3); }
.bh-grid--list .bh-card { display: grid; grid-template-columns: 128px minmax(0, 1fr); }
.bh-grid--list .bh-card__media { aspect-ratio: auto; min-height: 112px; height: 100%; }
.bh-grid--list .bh-card__body { padding: var(--s-3) 48px var(--s-3) var(--s-3); align-content: start; }
.bh-grid--list .bh-card__title { font-size: var(--fs-16); }
.bh-grid--list .bh-card__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-14); color: var(--c-text-2); }
.bh-grid--list .bh-fav { top: 8px; right: 8px; }
.bh-grid--list .bh-card__media .bh-card__badges { max-width: calc(100% - 16px); }
@media (min-width: 600px) { .bh-grid--list .bh-card { grid-template-columns: 200px minmax(0, 1fr); } .bh-grid--list .bh-card__media { min-height: 150px; } }
@media (max-width: 599px) { .bh-grid--list .bh-card__desc { display: none; } }

/* VIP-полоса */
.bh-vip { background: var(--c-surface); border: 1px solid var(--c-border); padding: var(--s-3); }
.bh-vip__title { color: var(--c-text); font-size: var(--fs-16); }
.bh-vip__title::before { content: "VIP"; display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-pill); background: var(--bh-vip); color: var(--bh-vip-text); font-size: 11px; }
.bh-vip__list { grid-auto-columns: 46%; }
@media (min-width: 600px) { .bh-vip__list { grid-auto-columns: calc((100% - 2 * var(--s-4)) / 3); } }
@media (min-width: 1180px) { .bh-vip__list { grid-auto-columns: calc((100% - 3 * var(--s-4)) / 4); } }

/* ---------- страница объявления ---------- */
.bh-detail__head { gap: 4px; }
.bh-detail__title { font-size: var(--fs-24); }
@media (min-width: 960px) {
  .bh-detail { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
  .bh-detail__title { font-size: var(--fs-30); }
}
.bh-detail__meta .icon { width: 15px; height: 15px; }
.bh-gallery__badge { position: absolute; left: var(--s-3); top: var(--s-3); }
.bh-gallery__thumbs img { width: 96px; height: 72px; }
.bh-specs { grid-template-columns: 1fr; gap: 6px; }
.bh-specs > div { display: grid; grid-template-columns: minmax(110px, 45%) 1fr; gap: var(--s-3); }
@media (min-width: 960px) { .bh-specs { grid-template-columns: 1fr 1fr; column-gap: var(--s-8); } }
.bh-loc { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0; }
.bh-loc .icon { color: var(--c-text-3); }
.bh-demo-note { font-size: var(--fs-13); margin: 0; }
.bh-buy { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: var(--s-5); display: grid; gap: var(--s-3); }
.bh-buy .bh-detail__price { font-size: var(--fs-38); }
.bh-phone__btn { display: grid; gap: 0; line-height: 1.2; padding-block: var(--s-2); height: auto; min-height: 56px; }
.bh-phone__btn small { font-weight: 500; opacity: .85; font-size: var(--fs-12); }
.bh-seller-card { display: grid; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--c-border); }
.bh-seller-card .bh-seller { margin: 0; padding: 0; }
.bh-seller-card .bh-seller:hover { background: none; }
.bh-seller-card__all { font-size: var(--fs-14); }
.bh-side-actions { display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.bh-side-actions .share-bar { border: 0; padding: 0; margin: 0; }
.bh-mseller { padding: var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
.bh-mseller .bh-seller-card { border: 0; padding: 0; }
.bh-detail__mprice { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.bh-detail__mprice .bh-fav { position: static; }
@media (max-width: 959px) {
  .bh-detail__main { display: flex; flex-direction: column; gap: var(--s-4); }
  .bh-detail__main > .bh-gallery { order: -2; }
  .bh-detail__mprice { order: -1; margin-bottom: calc(var(--s-3) * -1); }
  .bh-detail-page .breadcrumbs { display: none; }
  .bh-detail__aside .bh-side-actions { margin-top: 0; }
}
/* нижняя панель «Позвонить / Написать» поверх навигации сайта */
.bh-callbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; gap: var(--s-2); padding: var(--s-2) var(--gutter) calc(var(--s-2) + env(safe-area-inset-bottom));
  background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -6px 20px -12px rgba(45, 15, 70, .35); }
.bh-callbar > * { flex: 1; min-width: 0; }
.bh-callbar .bh-phone { gap: 0; }
.bh-callbar .btn { min-height: 48px; }
.has-callbar .site-footer { padding-bottom: 88px; }
.has-callbar .toast-region { bottom: 88px; }
@media (min-width: 960px) { .bh-scam--m { display: none; } }
@media (min-width: 960px) {
  .bh-search .bh-search__add.only-desktop { display: inline-flex !important; }
  .bh-gallery .bh-gallery__thumbs.only-desktop { display: flex !important; }
  .bh-gallery .bh-gallery__nav.only-desktop { display: grid !important; }
}
.check.bh-filter { display: flex; }
