/* ==========================================================================
   Material Design 3 — Design Tokens (CattleSales)
   ========================================================================== */

/* ==========================================================================
   ЕДИНЫЙ ЦВЕТОВОЙ ДИЗАЙН-КОД — 18 токенов с закреплёнными ролями
   (design_handoff_color_system, 2026-08-22)
   --------------------------------------------------------------------------
   Заменяет разнобой: 11 оттенков серого для текста, 5 зелёных, 8 границ и
   посторонний синий. Это НЕ редизайн — layout, типографика и отступы прежние,
   меняется дисциплина цвета.

   ⚠️ ГЛАВНОЕ ПРАВИЛО: прямые hex в компонентных стилях запрещены. Только
   переменные. Исключения — статичные ассеты (SVG с зашитым fill) и почтовые
   шаблоны (в почте CSS-переменные не работают; в этом проекте своих почтовых
   шаблонов нет — только внутри venv, их не трогаем).

   Роли, а не оттенки: сопоставлять найденный цвет с токеном по НАЗНАЧЕНИЮ.
   Близость hex ничего не значит — один и тот же серый может быть и текстом,
   и границей.
   ========================================================================== */
:root {
  /* --- Текст: ровно три роли, четвёртой не заводить --- */
  --c-text:            #1A2015; /* заголовки, названия, значения, основной текст */
  --c-text-muted:      #5F6B57; /* метаданные, подписи полей, крошки, описания */
  --c-text-disabled:   #9AA492; /* плейсхолдеры, неактивные пункты, ID объявления */
  --c-on-brand:        #FFFFFF; /* текст и иконки на зелёном и на цветных бейджах */

  /* --- Бренд: один зелёный. Второй только hover, третий только заливка --- */
  --c-brand:           #1B743E; /* кнопки, активные состояния, ссылки, цены, иконки */
  --c-brand-hover:     #145C31; /* hover / active — единственное состояние */
  --c-brand-tint:      #E8F1E7; /* активный пункт меню, третичная кнопка, мягкий бейдж */
  --c-brand-border:    #C3D8C1; /* граница мягких зелёных блоков */

  /* --- Поверхности: максимум 4. Нужен ещё слой — тень, а не новый фон --- */
  --c-page:            #F5F7EB; /* фон страницы */
  --c-surface:         #FBFCF6; /* сайдбар, поля, карточки правой колонки */
  --c-surface-alt:     #EFF3E5; /* хедер, карточки объявлений, заголовки таблиц, футер */
  --c-canvas:          #E4E8DA; /* фон вокруг макета, разделительные зоны */

  /* --- Границы: две --- */
  --c-border:          #E1E6D4; /* разделители, границы карточек и секций */
  --c-border-strong:   #CBD2BC; /* поля, селекты, чипы, вторичные кнопки */

  /* --- Статусы. Оранжевый и золотой = ДЕНЬГИ и ничего больше:
         только платное размещение, иначе платные метки перестают читаться --- */
  --c-premium:         #C79A1F; /* только Premium-подписка продавца */
  --c-top:             #E07B1E; /* только платное размещение «Топ»: бейдж + рамка */
  --c-notice-bg:       #FBF4E2; /* «Безопасная сделка» и предупреждения */
  --c-notice-border:   #EDE1BE;
}

:root {
  /* === Primary === */
  --md-sys-color-primary: var(--c-brand);
  --md-sys-color-on-primary: var(--c-on-brand);
  --md-sys-color-primary-container: var(--c-brand-tint);
  --md-sys-color-on-primary-container: var(--c-brand);

  /* === Secondary (CattleSales olive) === */
  --md-sys-color-secondary: #C2BF6C;
  --md-sys-color-secondary-container: rgba(194, 191, 108, 0.14);
  --md-sys-color-secondary-container-solid: #EBEACF;
  --md-sys-color-on-secondary: #2B2A1A;
  --md-sys-color-on-secondary-container: #1A1A0A;

  /* === Surface (warm cream-green, tonal-tinted от primary #1B743E) === */
  --md-sys-color-surface: var(--c-surface);
  --md-sys-color-on-surface: var(--c-text);
  --md-sys-color-surface-dim: var(--c-canvas);
  --md-sys-color-surface-bright: var(--c-surface);
  --md-sys-color-surface-variant: var(--c-surface-alt);
  --md-sys-color-on-surface-variant: var(--c-text-muted);
  --md-sys-color-surface-container-lowest: var(--c-surface);
  /* Карточки лент и заголовки таблиц: по спецификации это --c-surface-alt,
     ТЕМНЕЕ фона страницы. Сведение сюда --c-surface перевернуло
     соотношение слоёв — карточка становилась светлее фона и сливалась
     с нижним краем фиксированного градиента body. */
  --md-sys-color-surface-container-low: var(--c-surface-alt);
  --md-sys-color-surface-container: var(--c-surface-alt);
  --md-sys-color-surface-container-high: var(--c-surface-alt);
  --md-sys-color-surface-container-highest: var(--c-canvas);
  --md-sys-color-surface-tint: var(--c-brand);

  /* === Outline (tinted greenish-neutral) === */
  /* ⚠️ В Material `outline` служит ДВУМ ролям сразу — и границам, и
     приглушённому тексту. В проекте он красит ТЕКСТ в 29 местах и
     границу всего в 2. Сопоставление его с `--c-border-strong`
     (сделанное в первом проходе) дало на тексте контраст 1.51 —
     «На платформе с…», номер объявления и подписи стали почти
     невидимы. Поэтому токен указывает на текстовую роль, а те две
     границы заданы `--c-border-strong` явно. */
  --md-sys-color-outline: var(--c-text-muted);
  --md-sys-color-outline-variant: var(--c-border);

  /* === Error === */
  --md-sys-color-error: #B3261E;
  --md-sys-color-on-error: var(--c-on-brand);
  --md-sys-color-error-container: #F9DEDC;

  /* === Background (cream) === */
  --md-sys-color-background: var(--c-page);
  --md-sys-color-on-background: var(--c-text);

  /* === Brand (CattleSales) === */
  --brand-ink: var(--c-text);
  --brand-muted: var(--c-text-muted);
  --brand-cream: var(--c-page);
  --brand-olive: #C2BF6C;
  --brand-green: var(--c-brand);

  /* === Тень карточки ленты ===
     Спецификация дизайн-кода: «нужно разделить слои — использовать ТЕНЬ, а
     не новый оттенок фона». У карточки `--c-surface-alt`, то есть она темнее
     фона страницы, и одной границы для объёма мало: на светлой палитре
     переход читается как плоская заливка.
     Базовый цвет тени — `--c-text` (#1A2015), а НЕ чистый чёрный: нейтральный
     чёрный на тёплой зеленоватой палитре мутит и выглядит грязным пятном.
     Два слоя: короткий контактный (лежит на поверхности) и длинный мягкий
     (даёт высоту). */
  --shadow-card: 0 1px 2px rgba(26, 32, 21, 0.07),
                 0 4px 14px rgba(26, 32, 21, 0.10);
  --shadow-card-hover: 0 2px 4px rgba(26, 32, 21, 0.09),
                       0 10px 28px rgba(26, 32, 21, 0.16);

  /* === Elevation shadows (soft & diffused) === */
  --md-sys-elevation-0: none;
  --md-sys-elevation-1: 0px 2px 8px rgba(0,0,0,0.08), 0px 1px 4px rgba(0,0,0,0.06);
  --md-sys-elevation-2: 0px 4px 16px rgba(0,0,0,0.10), 0px 2px 6px rgba(0,0,0,0.06);
  --md-sys-elevation-3: 0px 8px 24px rgba(0,0,0,0.12), 0px 2px 8px rgba(0,0,0,0.08);

  /* === Typography · Roboto Flex (variable font, opsz+wght) === */
  --font-sans: 'Roboto Flex', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --md-sys-typescale-display-large: 800 57px/60px var(--font-sans);
  --md-sys-typescale-headline-large: 800 36px/42px var(--font-sans);
  --md-sys-typescale-headline-medium: 700 28px/34px var(--font-sans);
  --md-sys-typescale-title-large: 700 22px/28px var(--font-sans);
  --md-sys-typescale-title-medium: 600 16px/22px var(--font-sans);
  --md-sys-typescale-body-large: 400 16px/24px var(--font-sans);
  --md-sys-typescale-body-medium: 400 14px/20px var(--font-sans);
  --md-sys-typescale-body-small: 400 12px/16px var(--font-sans);
  --md-sys-typescale-label-large: 600 14px/20px var(--font-sans);
  --md-sys-typescale-label-medium: 500 12px/16px var(--font-sans);
  --md-sys-typescale-label-small: 500 11px/16px var(--font-sans);
  /* Optical sizing + weight axis — M3 Expressive */
  --typo-headline-variation: "opsz" 32, "wght" 800, "GRAD" 0;
  --typo-title-variation: "opsz" 22, "wght" 700, "GRAD" 0;
  --typo-body-variation: "opsz" 16, "wght" 400, "GRAD" 0;

  /* === Shape (friendly rounded — from Figma) === */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 12px;
  --md-sys-shape-corner-small: 16px;
  --md-sys-shape-corner-medium: 24px;
  --md-sys-shape-corner-large: 31px;
  --md-sys-shape-corner-extra-large: 31px;
  --md-sys-shape-corner-full: 100px;

  /* === Spacing === */
  --md-sys-spacing-xs: 4px;
  --md-sys-spacing-sm: 8px;
  --md-sys-spacing-md: 16px;
  --md-sys-spacing-lg: 24px;
  --md-sys-spacing-xl: 32px;
  --md-sys-spacing-xxl: 48px;

  /* === Layout === */
  --header-height: 60px;
  --sidebar-width: 240px;
  --bottom-nav-height: 56px;
  --content-max-width: 1200px;

  /* === Motion · M3 Expressive curves === */
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 300ms;
  --md-sys-motion-duration-long: 500ms;
  --md-sys-motion-duration-spring: 650ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-decelerate: cubic-bezier(0, 0, 0, 1);
  /* Expressive spring — overshoot bounce (для hover/focus/page transitions) */
  --md-sys-motion-easing-expressive: cubic-bezier(0.34, 1.56, 0.64, 1);
  --md-sys-motion-easing-emphasized-in: cubic-bezier(0.3, 0, 0.8, 0.15);
  --md-sys-motion-easing-emphasized-out: cubic-bezier(0.05, 0.7, 0.1, 1);

  /* === Success === */
  --md-sys-color-success: #2E7D32;
  --md-sys-color-success-container: #C8E6C9;

  /* === Warning === */
  --md-sys-color-warning: var(--c-top);
  --md-sys-color-warning-container: var(--c-notice-bg);

  /* === Избранное (звезда) ===
     Решение владельца 2026-08-12: не лайк-сердце, а «в избранное» —
     серая ☆ в покое, жёлтая ★ в списке. Жёлтый НЕ равен оранжевому
     `warning` (#F57F17): им помечены «Топ» и раньше была «Договорная»,
     и звезда сливалась бы с платной меткой. Зеркало во Flutter —
     `AppColors.favorite` / `favoriteIdle`. */
  --cs-favorite: #F5B301;
  --cs-favorite-idle: #9E9E9E;

  /* === Glass / acrylic (light default) === */
  --glass-bg: rgba(255, 251, 238, 0.72);
  --glass-border: rgba(194, 191, 108, 0.35);
  --glass-blur: blur(18px) saturate(160%);
  --glass-rim: 0 1px 0 rgba(255,255,255,0.2);
}

/* Dark theme удалена (2026-05-12) — поддерживаем только light, чтобы не
   множить mismatch'ы между темами. color-scheme: light явно, чтобы браузер
   не подкидывал свои dark-style scrollbar/form controls. */
:root { color-scheme: light; }

/* ==========================================================================
   БРЕЙКПОИНТЫ — единая схема (docs/design.md § Breakpoints)
   --------------------------------------------------------------------------
   Токенами их не задать: в `@media` CSS-переменные не работают (условие
   вычисляется до каскада). Поэтому схема живёт здесь КОММЕНТАРИЕМ, а числа
   пишутся в медиа-запросах руками — сверяться с этим списком.

       Mobile   < 600px   1 колонка, нижний бар, бургер-меню
       Tablet   600 … 839 2 колонки карточек, нижний бар
       Desktop  >= 840px  сайдбар виден, нижнего бара нет, поиск в шапке
       Wide     >= 1200px ширина контента упирается в --content-max-width

   ⚠️ ПРАВИЛО ГРАНИЦЫ: верхняя граница диапазона = нижняя МИНУС 0.02px.
       правильно:  (max-width: 839.98px)  ↔  (min-width: 840px)
       НЕЛЬЗЯ:     (max-width: 839px)     ↔  (min-width: 840px)
       НЕЛЬЗЯ:     (max-width: 840px)     ↔  (min-width: 840px)
   Ширина окна дробная (масштаб браузера, 125 % DPI, узкий десктоп): на 839.5px
   пара 839/840 не срабатывала НИ ОДНОЙ веткой — сайдбар оставался закрытым и
   недостижимым, а контент уезжал под нижний бар. Пара 840/840, наоборот,
   применяет обе ветки разом. 0.02 — шаг, который различают все движки.

   Свои значения вне схемы (640 / 720 / 768 / 900 / 960 / 1000 / 1100 / 1360 и
   мелкие 380 / 419 / 480) остались у отдельных компонентов — чат, VoIP-оверлей,
   карточки «Маркет v3», второстепенные страницы. Их не сводим к общей схеме,
   чтобы не переверстывать, но правило границы действует и на них: если рядом
   есть парный min-width, max-width обязан быть на 0.02px ниже.
   ========================================================================== */
/* ==========================================================================
   Base Layout — CattleSales M3
   ========================================================================== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-background);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  font-variation-settings: var(--typo-body-variation);
}

/* Bug fix: атрибут [hidden] перебивается любым `display: ...` правилом более
   высокой специфичности (.chat-composer__attach-menu, .chat-rec и пр. имеют
   display: flex без `:not([hidden])`). Глобально форсим — чтобы любой
   `[hidden]` действительно скрывал элемент. */
[hidden] { display: none !important; }

html { max-width: 100vw; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  /* Tonal gradient — через bg/surface токены, работает в обеих темах */
  background:
    radial-gradient(ellipse 1200px 600px at top,
      color-mix(in srgb, var(--md-sys-color-primary) 5%, transparent),
      transparent 60%),
    linear-gradient(180deg,
      var(--md-sys-color-background) 0%,
      var(--md-sys-color-surface) 100%);
  background-attachment: fixed;
  color: var(--md-sys-color-on-background);
}

/* Detail-page · фон = цвет карточки (surfaceContainerLow). При переходе
   из списка (карточка на тёмном фоне) в детальную страницу визуальная
   непрерывность сохраняется — фон становится цветом карточки. */
body.page-detail {
  background: var(--md-sys-color-surface-container-low);
}

/* page-chat — chat-detail full-screen без рамок, без bottom-nav, без page scroll.
   Лечит mobile vertical scroll: .app имел min-height: 100vh, при свёрнутой адресной
   строке 100vh > 100dvh → page растягивается ниже viewport. Принудительно фиксируем
   высоту контейнера на 100dvh и блокируем overflow на body. */
body.page-chat { overflow: hidden; }
body.page-chat .app { min-height: 0; height: 100vh; height: 100dvh; }
body.page-chat .app__content { padding: 0; padding-bottom: 0; min-height: 0; overflow: hidden; }
body.page-chat .bottom-nav { display: none; }

/* --- View Transitions API (Chrome/Edge/Safari 18+) --- */
@view-transition { navigation: auto; }

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 260ms;
  animation-timing-function: var(--md-sys-motion-easing-emphasized-out, cubic-bezier(0.05,0.7,0.1,1));
}

/* Reduce motion — a11y */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  @view-transition { navigation: none; }
}

/* Headings — Roboto Flex с opsz */
h1, h2, h3, .page-title, .listing-detail__section-title {
  font-variation-settings: var(--typo-headline-variation);
  letter-spacing: -0.5px;
}
h1, .page-title { font: var(--md-sys-typescale-headline-large); }
h2, .listing-detail__section-title { font: var(--md-sys-typescale-headline-medium); }
h3 { font: var(--md-sys-typescale-title-large); }

a { color: var(--md-sys-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* --- SVG icons --- */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon svg {
  fill: currentColor;
  width: 1em;
  height: 1em;
}

ul, ol { list-style: none; }

/* --- App Layout --- */
.app { display: flex; flex-direction: column; min-height: 100vh; }

.app__body {
  display: flex;
  flex: 1;
  padding-top: var(--header-height);
}

.app__content {
  flex: 1;
  min-width: 0;
  padding: var(--md-sys-spacing-sm);
  padding-bottom: calc(var(--bottom-nav-height) + var(--md-sys-spacing-lg));
}

@media (min-width: 600px) {
  .app__content { padding: var(--md-sys-spacing-md); }
}

/* --- Header (Top App Bar) --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  /* Спецификация дизайн-кода: хедер — `--c-surface-alt`, то есть ТЕМНЕЕ фона
     страницы. На `--c-surface` он был светлее фона, и граница шапки читалась
     наоборот. Оливковую подложку-плёнку оставляем: она даёт тёплый оттенок
     бренда и от токена не зависит. */
  background: var(--c-surface-alt);
  background-image: linear-gradient(90deg, rgba(164, 161, 80, 0.08) 0%, rgba(164, 161, 80, 0.08) 100%);
  box-shadow: 0px 1px 2px rgba(0,0,0,0.2), 0px 2px 6px rgba(0,0,0,0.15);
}

.header__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface);
  font-size: 24px;
}

.header__menu-btn:hover { background: var(--md-sys-color-secondary-container); }

.header__logo {
  /* CattleSales wordmark: ink-чёрный base, зелёная pivot-S — inline в _header.html */
  font: 900 22px/28px 'Roboto', sans-serif;
  letter-spacing: -0.5px;
  color: var(--c-text);
  white-space: nowrap;
  margin-right: auto;
  text-decoration: none;
}
.header__logo:hover { text-decoration: none; }

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (min-width: 840px) {
  .header__actions { gap: 24px; }
}

.header__flag {
  width: 24px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
  overflow: hidden;
  flex-shrink: 0;
}

@media (min-width: 840px) {
  .header__flag { width: 36px; height: 22px; border-radius: 6px; }
}

/* Глобус вместо флага на главном домене (request.is_main_domain).
   ⚠️ Раньше здесь стояло ЭМОДЗИ 🌐, и оно рисовалось СИНИМ: цвет эмодзи
   задаёт шрифт, а не CSS, поэтому `color` на него не действовал — синева
   держалась вопреки палитре. По дизайн-коду синего в продукте нет, а
   глобус брендовый. Иконка из спрайта (`fill="currentColor"`) цвет
   наследует, поэтому красится токеном как обычный текст. */
.header__flag--globe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  background: transparent;
  color: var(--c-brand);
}
.header__flag--globe svg { width: 20px; height: 20px; }
@media (min-width: 840px) {
  .header__flag--globe svg { width: 24px; height: 24px; }
}

.header__currency {
  font: 500 16px/24px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  white-space: nowrap;
  display: none;
}

@media (min-width: 840px) {
  .header__currency { display: inline-flex; align-items: center; }
}

.header__icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface);
  font-size: 24px;
}

.header__icon-btn:hover { background: var(--md-sys-color-secondary-container); }

/* Theme switcher удалён (dark theme removed 2026-05-12). */

/* --- Account dropdown (user menu) --- */
.header__account {
  position: relative;
}
.header__account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-2);
  display: none;
  z-index: 110;
}
.header__account-dropdown.is-open { display: block; }
.header__account-name {
  padding: 8px 14px 10px;
  font: var(--md-sys-typescale-label-medium);
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  margin-bottom: 4px;
}
.header__account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--md-sys-shape-corner-small);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-label-large);
  text-decoration: none;
  transition: background var(--md-sys-motion-duration-short);
}
.header__account-item:hover {
  background: var(--md-sys-color-secondary-container);
  text-decoration: none;
}
.header__account-item--danger { color: var(--md-sys-color-error); }
.header__account-item svg { flex-shrink: 0; }

/* --- Header search bar (desktop) --- */
.header__search {
  display: none;
  align-items: center;
  flex: 1;
  max-width: 480px;
  margin: 0 16px;
  position: relative;
}

.header__search-input {
  width: 100%;
  padding: 10px 18px 10px 42px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container);
  min-height: 44px;
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  outline: none;
  transition: background var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard),
              box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.header__search-input:focus {
  background: var(--md-sys-color-surface);
  box-shadow: var(--md-sys-elevation-2);
}

.header__search-input::placeholder { color: var(--md-sys-color-on-surface-variant); }

.header__search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
}

@media (min-width: 840px) {
  .header__search { display: flex; }
  .header__search-mobile { display: none; }
}

/* --- Language switcher --- */
.header__lang { position: relative; }

.header__lang-select {
  appearance: none;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  padding: 2px 16px 2px 6px;
  font: 500 11px/14px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2349454F' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") right 2px center no-repeat;
  cursor: pointer;
  outline: none;
  width: 42px;
}

.header__lang-select:focus {
  border-color: var(--md-sys-color-primary);
}

/* --- Country switcher dropdown --- */
.header__country {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header__country-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  font: 500 12px/16px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  padding: 4px 6px;
  border-radius: var(--md-sys-shape-corner-full);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header__country-btn:hover { background: var(--md-sys-color-surface-container); }

.header__country-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-3);
  max-height: 400px;
  overflow-y: auto;
  min-width: 220px;
  padding: 8px 0;
}

.header__country-dropdown.is-open { display: block; }

.header__country-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font: 400 13px/18px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  white-space: nowrap;
}

.header__country-item:hover {
  background: var(--md-sys-color-surface-container);
  text-decoration: none;
}

.header__country-item img {
  border-radius: 2px;
  flex-shrink: 0;
}

/* «Global»-пункт: глобус размером с флаги + active-подсветка на главном
   домене. Комментарий раньше гласил «синий глобус» — синего в продукте
   больше нет, иконка брендовая (см. `.header__flag--globe` выше). */
.header__country-item--global .header__flag--globe {
  width: 20px;
  line-height: 14px;
  text-align: center;
  flex-shrink: 0;
}

.header__country-item--active {
  background: var(--md-sys-color-primary-container);
  font-weight: 600;
}

/* --- Language switcher dropdown --- */
.header__lang {
  position: relative;
}

.header__lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  cursor: pointer;
  font: 500 12px/16px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  padding: 4px 6px;
  border-radius: var(--md-sys-shape-corner-full);
}

.header__lang-btn:hover { background: var(--md-sys-color-surface-container); }

.header__lang-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 200;
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-3);
  min-width: 200px;
  padding: 8px 0;
  /* На main domain в dropdown'е все 43 языка — не влезут в экран. */
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.header__lang-dropdown.is-open { display: block; }

.header__lang-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font: 400 13px/18px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

/* Плоский флаг страны-эмблемы языка (как в Flutter-пикере), вместо голого ISO */
.header__lang-flag {
  width: 20px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 auto;
  display: block;
}

.header__lang-item .header__lang-name {
  flex: 1 1 auto;
  white-space: nowrap;
}

.header__lang-code {
  color: var(--md-sys-color-on-surface-variant, var(--c-text-muted));
  font-size: 11px;
  flex: 0 0 auto;
}

.header__lang-item:hover {
  background: var(--md-sys-color-surface-container);
  text-decoration: none;
}

.header__lang-item--active {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

/* --- Sidebar (desktop) --- */
.sidebar {
  display: none;
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--md-sys-color-surface);
  border-right: 1px solid var(--md-sys-color-outline-variant);
  overflow-y: auto;
  padding: var(--md-sys-spacing-sm) 0
    calc(env(safe-area-inset-bottom, 0px) + var(--md-sys-spacing-md)) 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px var(--md-sys-spacing-lg) 12px;
  color: var(--c-text);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.sidebar__logo:hover { text-decoration: none; }
.sidebar__logo-icon { font-size: 28px; line-height: 1; }
.sidebar__logo-text { font-size: 22px; line-height: 1; }
.sidebar__logo-pivot {
  color: var(--md-sys-color-primary, var(--c-brand));
  font-size: 1.18em;
  font-weight: 900;
  -webkit-text-stroke: 0.5px var(--md-sys-color-primary, var(--c-brand));
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-md);
  padding: 14px var(--md-sys-spacing-lg);
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-large);
  font-size: 15px;
  letter-spacing: 0.1px;
  transition: background 0.15s;
  margin: 2px 8px;
  border-radius: var(--md-sys-shape-corner-full);
}

.sidebar__item:hover {
  background: var(--md-sys-color-secondary-container);
  text-decoration: none;
}

.sidebar__item:active {
  background: var(--md-sys-color-surface-container-high);
}

.sidebar__item--disabled {
  opacity: 0.4;
  pointer-events: none;
  cursor: default;
}

.sidebar__item--active {
  color: var(--md-sys-color-primary);
  background: var(--md-sys-color-secondary-container);
  font-weight: 600;
}
.sidebar__divider {
  height: 1px;
  background: var(--md-sys-color-outline-variant);
  margin: var(--md-sys-spacing-sm) 0;
}

/* --- Sidebar theme toggle: один пункт меню, циклический переключатель --- */
.sidebar__item--button {
  width: calc(100% - 16px);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

/* --- Bottom Navigation (mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* Высота + safe-area-inset-bottom (iPhone home indicator, Android gesture
     bar) — иначе нижний ряд иконок недоступен. Инсет капим 24px: Chrome
     edge-to-edge при скрытии адресной строки может отдавать в env() высоту
     СВОИХ controls (до ~110px) → панель раздувалась пустотой под иконками
     (скрины 148/149). Легитимному gesture-инсету хватает ≤24px. */
  height: calc(var(--bottom-nav-height) + min(env(safe-area-inset-bottom, 0px), 24px));
  padding-bottom: min(env(safe-area-inset-bottom, 0px), 24px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--md-sys-color-surface);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  border-radius: var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0 0;
  /* Гарантируем что bottom-nav поверх любых z-index-overlay (gallery, modals)
     и контента, иначе на скролле длинных страниц теряется. */
  transform: translateZ(0);
}

/* Bleed-хвост: продлевает поверхность панели ниже края вьюпорта. Пока Chrome
   анимирует скрытие/показ адресной строки, layout-viewport меняется с
   задержкой и fixed-панель на время «повисает» выше настоящего низа экрана —
   в дыре был виден голый фон страницы (скрины 148/149). Хвост закрашивает её
   поверхностью панели; в устоявшемся состоянии он за экраном и невидим. */
.bottom-nav::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 160px;
  background: var(--md-sys-color-surface);
}

/* На mobile main-контент должен иметь padding-bottom = высота bnav (иначе
   последние карточки/кнопки уезжают под bnav и невидимы). */
@media (max-width: 839.98px) {
  .app__content {
    padding-bottom: calc(
      var(--bottom-nav-height) +
      min(env(safe-area-inset-bottom, 0px), 24px) +
      var(--md-sys-spacing-md)
    );
  }
}

.bottom-nav__item {
  /* Равные колонки: 4 пункта (Маркет/Блог | Сообщения/Профиль) делят ширину
     поровну → центральный FAB (фикс. 56px) оказывается строго по центру навбара
     (2 пункта слева = 2 справа). Раньше пункты были по ширине контента →
     «Сообщения» шире «Блог» → FAB съезжал влево. */
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-small);
  padding: var(--md-sys-spacing-xs) 2px;
  border-radius: var(--md-sys-shape-corner-medium);
  transition: background 0.15s;
}

.bottom-nav__item:hover {
  background: var(--md-sys-color-secondary-container);
  text-decoration: none;
}

.bottom-nav__item--active,
.bottom-nav__item.is-active { color: var(--md-sys-color-primary); }

.bottom-nav__item--messages { position: relative; }

/* Аватар пользователя в табе «Профиль» (как в Avito) — круглое фото вместо иконки. */
.bottom-nav__avatar {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  display: block;
}
.bottom-nav__item--active .bottom-nav__avatar,
.bottom-nav__item.is-active .bottom-nav__avatar {
  border-color: var(--md-sys-color-primary);
}

/* Дедуп профиля: на мобильном (есть нижний бар) убираем профиль-вход из шапки —
   его роль берёт нижний таб «Профиль». На десктопе (>=840px) нижнего бара нет,
   поэтому в шапке профиль остаётся. */
@media (max-width: 839.98px) {
  .header__profile-entry { display: none !important; }
}

.bottom-nav__badge {
  position: absolute;
  top: 2px;
  /* У верх-правого угла ЦЕНТРИРОВАННОЙ иконки (24px), а не у правого края
     колонки — иначе после flex:1 на пункте бейдж улетал вправо от иконки. */
  left: calc(50% + 3px);
  right: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error, white);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border: 1.5px solid var(--md-sys-color-surface);
  box-sizing: border-box;
}

/* === Header — Сообщения с бейджем === */
.header__chat-link {
  position: relative;
  /* Bug 27: chat-icon ОБЯЗАН помещаться в header — не сжимаем под flex. */
  flex-shrink: 0;
}
/* Bug 23: Messages теперь видна и на mobile (в bottom-nav вместо «Сообщения»
   стоит «Личный кабинет» как в Flutter app). На узком header кнопка чата
   получает уменьшенный padding чтобы поместиться рядом с лого/account. */
@media (max-width: 599.98px) {
  .header__chat-link { padding: 4px 6px; }
  .header__chat-link svg { width: 22px; height: 22px; }

  /* Bug 27: на узких экранах country-btn показывает только флаг (текст
     «Global»/«Россия» скрыт). На > 600px → текст возвращается. caret тоже
     скрыт чтобы не есть ещё 14px. */
  .header__country-btn > span:first-child,
  .header__country-btn > .icon { display: none; }
  .header__country-btn { padding: 4px; max-width: 40px; }

  /* Уменьшаем gap между header-actions чтобы 4 элемента (country/lang/chat/
     account) гарантированно влезли. */
  .header__actions { gap: 4px; }
}

/* === Header — Avatar (Google sociallogin / fallback initial) === */
.header__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  text-transform: uppercase;
  user-select: none;
}
.header__avatar--initial {
  font-family: var(--md-ref-typeface-plain, system-ui, sans-serif);
}
.header__account-btn { padding: 4px; }
@media (min-width: 840px) {
  .header__avatar { width: 36px; height: 36px; font-size: 15px; }
}
.header__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error, white);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 1.5px solid var(--md-sys-color-surface);
  box-sizing: border-box;
  pointer-events: none;
}

/* === Sidebar — Сообщения с бейджем === */
.sidebar__item { position: relative; }
.sidebar__badge {
  margin-left: auto;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error, white);
  border-radius: 11px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  line-height: 1.3;
}

/* === Dropdown account — Сообщения с бейджем === */
.header__account-item { position: relative; display: flex; align-items: center; gap: 8px; }
.header__account-badge {
  margin-left: auto;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error, white);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
/* Bottom nav FAB (center circle) — паритет с Flutter: 64px, выше бара,
   видимая подпись «Подать объявление» под кнопкой (2 строки). */
.bottom-nav__fab-wrap {
  /* Фикс. колонка — НЕ растягивается (центр держат равные пункты по бокам). */
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav__fab {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Кнопка приподнята над баром; подпись остаётся у низа бара.
     Flow-высота wrap: (64−34) + 2 + ~22 (2 строки label) ≈ 54px ≤ 56px бара. */
  margin-top: -34px;
  box-shadow: 0 6px 14px rgba(27, 116, 62, 0.40), 0 2px 6px rgba(0, 0, 0, 0.20);
  text-decoration: none;
}
.bottom-nav__fab:hover { text-decoration: none; filter: brightness(1.1); }
.bottom-nav__fab-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  text-align: center;
  line-height: 1.1;
  /* «Подать объявление» переносится на 2 строки, не налезая на соседние пункты. */
  max-width: 76px;
}

/* --- FAB (desktop, bottom-right) --- */
.fab {
  position: fixed;
  bottom: var(--md-sys-spacing-lg);
  right: var(--md-sys-spacing-lg);
  z-index: 99;
  width: 56px;
  height: 56px;
  border-radius: var(--md-sys-shape-corner-large);
  border: none;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--md-sys-elevation-3);
  display: none;
  align-items: center;
  justify-content: center;
}

.fab:hover { filter: brightness(1.1); }

/* (sidebar overlay styles moved to sidebar mobile slide-in section) */

/* --- Sidebar mobile slide-in --- */
@media (max-width: 839.98px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
    box-shadow: none;
    /* Нижний отступ = высота BottomNav + safe-area (iOS home indicator),
       чтобы последние пункты меню («Тема») не уезжали под bottom-nav. */
    padding-bottom: calc(
      var(--bottom-nav-height) +
      env(safe-area-inset-bottom, 0px) +
      var(--md-sys-spacing-md)
    );
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--md-sys-elevation-3);
  }
}

.sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.sidebar-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* --- Desktop breakpoint --- */
@media (min-width: 840px) {
  .sidebar { display: flex; flex-direction: column; position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); }
  .bottom-nav { display: none; }
  .fab { display: none; }      /* desktop CTA — в header (.header__post-cta), FAB не нужен */
  .app__content { padding-bottom: var(--md-sys-spacing-lg); }
  .header__menu-btn { display: none; }
  /* В sidebar logo дублируется с header__logo — спрятать на desktop */
  .sidebar__logo { display: none; }
}

/* --- Header CTA — «+ Подать объявление» (desktop) --- */
.header__post-cta {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  height: 36px;
  border-radius: 18px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font: 500 14px/1 'Roboto', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  transition: filter 0.15s, transform 0.1s;
}
.header__post-cta:hover { filter: brightness(1.08); text-decoration: none; }
.header__post-cta:active { transform: scale(0.97); }
@media (min-width: 840px) {
  .header__post-cta { display: inline-flex; }
}

@media (min-width: 1200px) {
  .app__content { max-width: var(--content-max-width); }
}

/* --- Snackbar messages --- */
.snackbar {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 80px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: var(--md-sys-spacing-md) var(--md-sys-spacing-lg);
  background: var(--c-text);
  color: var(--c-on-brand);
  border-radius: var(--md-sys-shape-corner-medium);
  font: var(--md-sys-typescale-body-medium);
  box-shadow: var(--md-sys-elevation-3);
  animation: snackbar-in 0.3s ease;
}

@keyframes snackbar-in {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (min-width: 840px) {
  .snackbar { bottom: var(--md-sys-spacing-lg); }
}

/* --- Ripple effect --- */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  width: 100px;
  height: 100px;
  transform: translate(-50%, -50%) scale(0);
}

.ripple:active::after {
  opacity: 0.12;
  transform: translate(-50%, -50%) scale(4);
  transition: transform 0.4s var(--md-sys-motion-easing-standard),
              opacity 0.1s;
}

/* --- Scroll reveal --- */
/* .js навешивается inline-скриптом в начале <body> (base.html): без JS
   (или до его исполнения) карточки не прячутся в opacity:0 — LCP/no-JS safe. */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-decelerate),
              transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-decelerate);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--md-sys-color-surface-variant) 25%,
    var(--md-sys-color-surface-container-high) 50%,
    var(--md-sys-color-surface-variant) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--md-sys-shape-corner-small);
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--text { height: 16px; margin-bottom: 8px; }
.skeleton--title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton--image { aspect-ratio: 4/3; border-radius: var(--md-sys-shape-corner-medium); }
.skeleton--card { height: 140px; border-radius: var(--md-sys-shape-corner-medium); }

/* --- Page title --- */
.page-title {
  font: var(--md-sys-typescale-headline-medium);
  color: var(--md-sys-color-on-surface);
  margin-bottom: var(--md-sys-spacing-lg);
}

/* --- Section --- */
.section {
  margin-bottom: var(--md-sys-spacing-xl);
}

/* --- Container with filters layout --- */
.layout-with-filters {
  display: flex;
  gap: var(--md-sys-spacing-lg);
}

.layout-with-filters__filters { display: none; }
.layout-with-filters__content { flex: 1; min-width: 0; }

/* --- Bottom sheet (mobile filters) --- */
.bottom-sheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
  box-shadow: var(--md-sys-elevation-3);
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.bottom-sheet.is-open {
  display: block;
  transform: translateY(0);
}

@media (min-width: 840px) {
  .bottom-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    width: 480px;
    max-height: 80vh;
    border-radius: var(--md-sys-shape-corner-extra-large);
  }
  .bottom-sheet.is-open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.bottom-sheet__handle {
  width: 32px;
  height: 4px;
  background: var(--md-sys-color-outline-variant);
  border-radius: 2px;
  margin: 12px auto 8px;
}

.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 16px;
}

.bottom-sheet__title {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface);
}

.bottom-sheet__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface);
}

.bottom-sheet__body {
  padding: 0 16px 24px;
  /* Защита от horizontal overflow внутреннего контента (select 230 стран) */
  overflow-x: hidden;
  box-sizing: border-box;
}

.bottom-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.bottom-sheet-overlay.is-open {
  display: block;
  opacity: 1;
}

/* --- Results counter --- */
.results-counter {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: var(--md-sys-spacing-md);
}

.results-counter strong {
  color: var(--md-sys-color-on-surface);
}

/* --- Active filter chips --- */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--md-sys-spacing-sm);
  margin-bottom: var(--md-sys-spacing-md);
}

.active-filters:empty { display: none; }

/* Чип активного фильтра (v3 §3): мягкий зелёный тинт с зелёной рамкой и
   зелёным текстом. Отступы логические — в ar/fa/ur чип зеркалится, и
   физический `padding-left` оставил бы крестик впритык к краю. */
.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-block: 6px;
  padding-inline: 14px 8px;
  background: var(--c-brand-tint);
  border: 1px solid var(--c-brand-border);
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  color: var(--c-brand);
  text-decoration: none;
  transition: background var(--md-sys-motion-duration-short);
}

/* Крестик — отдельная ссылка, а не клик по всему чипу: так фильтр снимается
   с клавиатуры и адрес виден в статусной строке. */
.active-filter__remove {
  display: inline-flex;
  align-items: center;
  color: inherit;
  border-radius: var(--md-sys-shape-corner-full);
}
.active-filter__remove:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

/* «Сбросить всё» — текстовая ссылка рядом с чипами, не кнопка: действие
   вторичное, кнопка спорила бы с самими чипами. */
.active-filters__reset {
  align-self: center;
  color: var(--c-text-muted);
  font: var(--md-sys-typescale-label-large);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.active-filters__reset:hover { color: var(--c-brand); }

.active-filter:hover { background: var(--md-sys-color-surface-container-high); }

/* Крестик — зелёная круглая кнопка с белым ✕ (единый дизайн). */
.active-filter svg {
  width: 20px;
  height: 20px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  flex-shrink: 0;
}

@media (min-width: 840px) {
  .layout-with-filters__filters {
    display: block;
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + var(--md-sys-spacing-md));
    max-height: calc(100vh - var(--header-height) - var(--md-sys-spacing-xl));
    overflow-y: auto;
  }
}

/* ==========================================================================
   Маркет v3 §6/§7 — кнопка подачи в шапке, группировка сайдбара
   (design_handoff_market_v3, решение владельца 2026-08-24)
   ========================================================================== */

/* Кнопка «Подать объявление» — главное действие сайта, поэтому в шапке и
   зелёная. Из сайдбара пункт убран. */
.header__post-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding-inline: 16px;
  background: var(--c-brand);
  color: var(--c-on-brand);
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--md-sys-motion-duration-short);
}
.header__post-btn:hover { background: var(--c-brand-hover); }
.header__post-btn svg { flex-shrink: 0; }
/* На узких экранах остаётся только «+»: подпись съедала место у поиска. */
@media (max-width: 1100px) {
  .header__post-btn span { display: none; }
  .header__post-btn { padding-inline: 12px; }
}
/* На телефоне действие уже есть отдельной кнопкой в нижнем баре (FAB). */
@media (max-width: 767.98px) {
  .header__post-btn { display: none; }
}

/* Кнопка «Найти» внутри поля поиска. */
/* Поле должно знать про кнопку внутри себя, иначе плейсхолдер и введённый
   текст уезжают ПОД неё. Отступы логические: в ar/fa/ur кнопка слева.
   Иконка лупы тоже переводится на логическое свойство — с физическим
   `left: 14px` в RTL она наложилась бы на кнопку. */
.header__search-input {
  padding-inline: 42px 84px;
}
.header__search-icon {
  inset-inline-start: 14px;
  inset-inline-end: auto;
  left: auto;
  right: auto;
}
.header__search-submit {
  position: absolute;
  inset-inline-end: 5px;
  top: 50%;
  transform: translateY(-50%);
  height: 34px;
  padding-inline: 14px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--c-brand);
  color: var(--c-on-brand);
  font: var(--md-sys-typescale-label-medium);
  cursor: pointer;
}
.header__search-submit:hover { background: var(--c-brand-hover); }
.header__search form { position: relative; }

/* Подписи групп сайдбара. */
.sidebar__group-label {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-text-disabled);
}

/* Группа «Ещё» (свёрнутый <details>) убрана 25.08.2026 по решению
   владельца — пункты показываются всегда. Стили удалены вместе с разметкой:
   мёртвый CSS переживает свою разметку и потом мешает искать актуальное. */

/* Счётчик активных фильтров на кнопке «Фильтры» (v3 §4). */
.filter-toggle-btn__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-inline-start: 6px;
  padding-inline: 6px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--c-brand);
  color: var(--c-on-brand);
  font: 600 12px/1 'Roboto', sans-serif;
}
/* ==========================================================================
   M3 Components — CattleSales
   ========================================================================== */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--md-sys-spacing-sm);
  padding: 12px 28px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  font-size: 15px;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
  min-height: 44px;
}

.btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.btn--filled:hover { filter: brightness(1.08); box-shadow: var(--md-sys-elevation-1); text-decoration: none; }

.btn--outlined {
  background-image: linear-gradient(rgba(194,191,108,0.08), rgba(194,191,108,0.08)),
                     linear-gradient(var(--md-sys-color-surface), var(--md-sys-color-surface));
  color: var(--md-sys-color-primary);
  border: 1px solid #c2bf6c;
}
.btn--outlined:hover { background-image: linear-gradient(rgba(194,191,108,0.15), rgba(194,191,108,0.15)), linear-gradient(var(--md-sys-color-surface), var(--md-sys-color-surface)); text-decoration: none; }

.btn--elevated {
  background: var(--md-sys-color-surface);
  background-image: linear-gradient(rgba(164,161,80,0.05), rgba(164,161,80,0.05));
  color: var(--md-sys-color-primary);
  box-shadow: var(--md-sys-elevation-1);
}
.btn--elevated:hover { box-shadow: var(--md-sys-elevation-2); text-decoration: none; }

.btn--text {
  background: none;
  color: var(--md-sys-color-primary);
  padding: 10px 12px;
}
.btn--text:hover { background: var(--md-sys-color-secondary-container); text-decoration: none; }

.btn--sm { padding: 8px 20px; font: var(--md-sys-typescale-label-medium); min-height: 36px; }
.btn--lg { padding: 16px 36px; font-size: 16px; min-height: 52px; }

/* --- Cards --- */
.card {
  background-image: linear-gradient(rgba(164,161,80,0.06), rgba(164,161,80,0.06)),
                     linear-gradient(var(--md-sys-color-surface), var(--md-sys-color-surface));
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: 0px 2px 12px rgba(0,0,0,0.10), 0px 4px 20px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  box-shadow: 0px 4px 20px rgba(0,0,0,0.14), 0px 8px 32px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.card:active { box-shadow: 0px 2px 8px rgba(0,0,0,0.12); transform: translateY(0); }

.card__media {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--md-sys-color-surface-variant);
  display: block;
}

.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media > div { position: absolute; inset: 0; }

.card__media-badge {
  position: absolute;
  bottom: var(--md-sys-spacing-sm);
  right: var(--md-sys-spacing-sm);
}

.card__body { padding: var(--md-sys-spacing-md); }

.card__title {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface);
  margin-bottom: var(--md-sys-spacing-xs);
}

.card__subtitle {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: var(--md-sys-spacing-sm);
}

.card__text {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
}

.card__actions {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-sm);
  padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md) var(--md-sys-spacing-md);
}

.card__footer {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-md);
  padding: var(--md-sys-spacing-sm) var(--md-sys-spacing-md) var(--md-sys-spacing-md);
  font: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Card grid --- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--md-sys-spacing-md);
}

@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* --- Inputs --- */
.input-group {
  margin-bottom: var(--md-sys-spacing-md);
}

.input-group__label {
  display: block;
  font: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: var(--md-sys-spacing-xs);
}

.input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  outline: none;
  transition: border-color 0.15s;
  min-height: 48px;
}

.input:focus { border-color: var(--md-sys-color-primary); border-width: 2px; padding: 11px 15px; }

.input--error { border-color: var(--md-sys-color-error); }

.input-group__error {
  font: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-error);
  margin-top: var(--md-sys-spacing-xs);
}

/* --- Select --- */
.select {
  width: 100%;
  padding: 14px 40px 14px 18px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  min-height: 48px;
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%2349454F' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") right 8px center no-repeat;
  appearance: none;
  cursor: pointer;
  outline: none;
}

.select:focus { border-color: var(--md-sys-color-primary); border-width: 2px; }

/* --- Textarea --- */
.textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 16px;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--md-sys-shape-corner-extra-small);
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  resize: vertical;
  outline: none;
}

.textarea:focus { border-color: var(--md-sys-color-primary); border-width: 2px; }

/* --- Radio --- */
.radio-list { display: flex; flex-direction: column; }

.radio-item {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-md);
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--md-sys-shape-corner-small);
}

.radio-item:hover { background: var(--md-sys-color-secondary-container); }

.radio-item input[type="radio"] { display: none; }

.radio-item__indicator {
  width: 20px;
  height: 20px;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.radio-item input[type="radio"]:checked + .radio-item__indicator {
  border-color: var(--md-sys-color-primary);
}

.radio-item input[type="radio"]:checked + .radio-item__indicator::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--md-sys-color-primary);
  border-radius: 50%;
}

.radio-item--selected,
.radio-item:has(input[type="radio"]:checked) {
  background: var(--md-sys-color-secondary-container);
}

.radio-item__label {
  font: var(--md-sys-typescale-body-large);
  letter-spacing: 0.5px;
}

/* --- Checkbox --- */
.checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-md);
  padding: 12px 16px;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
}

/* --- Chips --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--md-sys-spacing-xs);
  padding: 8px 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-medium);
  color: var(--md-sys-color-on-surface-variant);
  background: var(--md-sys-color-surface);
  white-space: nowrap;
  min-height: 36px;
}

.chip--filled {
  background-image: linear-gradient(rgba(194,191,108,0.3), rgba(194,191,108,0.3)),
                     linear-gradient(var(--md-sys-color-surface), var(--md-sys-color-surface));
  border-color: transparent;
  color: var(--md-sys-color-on-surface);
}

.chip--primary {
  background: var(--md-sys-color-primary);
  border-color: transparent;
  color: var(--md-sys-color-on-primary);
}

/* «Договорная» — тот же вид, что у ценника (2026-08-12). Оранжевая заливка
   совпадала с плашкой «Топ», и бесплатное объявление выглядело помеченным
   как платное. Договорная цена — это ЦЕНА, поэтому и плашка ценника. */
.chip--negotiable {
  background: var(--md-sys-color-primary);
  border-color: transparent;
  color: var(--md-sys-color-on-primary);
}

/* --- Flag badge --- */
.flag-badge {
  width: 36px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* --- Characteristics list --- */
.char-list { display: flex; flex-direction: column; gap: var(--md-sys-spacing-sm); }

.char-item {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-sm);
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
}

/* --- Price tag --- */
.price {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

.price--lg { font-size: 22px; }

/* --- Stats (views, likes) --- */
.stats {
  display: flex;
  align-items: center;
  gap: var(--md-sys-spacing-md);
  font: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-on-surface-variant);
}

.stats__item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--md-sys-color-outline-variant);
  margin: var(--md-sys-spacing-md) 0;
}

.divider--primary { background: var(--md-sys-color-primary); }

/* --- Range slider --- */
.range-slider { width: 100%; margin: var(--md-sys-spacing-sm) 0; }

.range-slider input[type="range"] {
  width: 100%;
  accent-color: var(--md-sys-color-primary);
  cursor: pointer;
}

.range-slider__values {
  display: flex;
  justify-content: space-between;
  font: var(--md-sys-typescale-body-small);
  color: var(--md-sys-color-primary);
  margin-top: var(--md-sys-spacing-xs);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--md-sys-spacing-xs);
  padding: var(--md-sys-spacing-lg) 0;
}

.pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface);
  transition: background 0.15s;
}

.pagination__item:hover { background: var(--md-sys-color-secondary-container); text-decoration: none; }
.pagination__item--active { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.pagination__item--disabled { color: var(--md-sys-color-outline); pointer-events: none; }
/* Многоточие между окном текущей страницы и первой/последней — не кликается,
   ширина и высота как у цифры, чтобы ряд не прыгал. */
.pagination__item--ellipsis { color: var(--md-sys-color-outline); pointer-events: none; cursor: default; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--md-sys-spacing-xxl) var(--md-sys-spacing-md);
  color: var(--md-sys-color-on-surface-variant);
}
.empty-state__title { font: var(--md-sys-typescale-title-large); margin-bottom: var(--md-sys-spacing-sm); }
.empty-state__text { font: var(--md-sys-typescale-body-large); }

/* --- Favorite button with bounce animation ---
   Звезда «в избранное»: серая в покое, жёлтая в списке (2026-08-12).
   Раньше это было розовое сердце-лайк — метка популярности; владелец
   переопределил смысл на «отложить себе». */
.favorite-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cs-favorite-idle);
  font: var(--md-sys-typescale-body-medium);
  padding: var(--md-sys-spacing-xs);
  border-radius: var(--md-sys-shape-corner-full);
  transition: color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.favorite-btn:hover { color: var(--cs-favorite); }
.favorite-btn--active { color: var(--cs-favorite); }

/* Иконки рендерятся SVG-спрайтом (<use>), не Material-Icons шрифтом —
   селекторы на svg, иначе bounce/scale не применялись. */
.favorite-btn svg {
  transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.favorite-btn:active svg {
  transform: scale(1.3);
}

.favorite-btn.is-animating svg {
  animation: favorite-bounce 0.4s var(--md-sys-motion-easing-emphasized);
}

@keyframes favorite-bounce {
  0% { transform: scale(1); }
  25% { transform: scale(1.4); }
  50% { transform: scale(0.9); }
  75% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* --- Breadcrumbs (глобально — на всех страницах, не только маркетплейс) --- */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 18px;
  color: var(--md-sys-color-on-surface-variant);
}
.breadcrumbs__link {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  transition: color var(--md-sys-motion-duration-short);
}
.breadcrumbs__link:hover {
  color: var(--brand-green);
  text-decoration: underline;
}
.breadcrumbs__sep {
  color: var(--md-sys-color-outline);
  opacity: 0.6;
}
.breadcrumbs__current {
  color: var(--brand-ink);
  font-weight: 500;
}

/* @username-упоминание в комментариях/ответах базы знаний */
.mention {
  color: var(--brand-green);
  font-weight: 600;
}

/* --- Category icon --- */
.category-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--md-sys-spacing-sm);
  padding: var(--md-sys-spacing-md);
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s;
}

.category-icon:hover { transform: scale(1.05); text-decoration: none; }

.category-icon__img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--md-sys-color-surface-container-low);
  padding: 8px;
}

.category-icon__name {
  font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface);
}

/* --- Category icons row --- */
.category-row {
  display: flex;
  gap: var(--md-sys-spacing-sm);
  overflow-x: auto;
  padding-bottom: var(--md-sys-spacing-sm);
  scrollbar-width: none;
}

.category-row::-webkit-scrollbar { display: none; }

/* ==========================================================================
   Searchable select (Bug 4) — wrapper над native <select>
   ========================================================================== */
.searchable-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.searchable-select--compact { width: auto; min-width: 0; flex: 0 0 auto; }

.searchable-select__native {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
  /* ВАЖНО: оригинальный select виден для form-submit, но визуально скрыт. */
}

.searchable-select__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large);
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
.searchable-select--compact .searchable-select__trigger {
  /* Bug 27: компактный trigger в header — только флаг (2 emoji char). */
  min-height: 36px;
  padding: 4px 10px;
  font-size: 18px; /* эмодзи флага читаемее */
  border-radius: var(--md-sys-shape-corner-full);
  gap: 4px;
  width: auto;
  min-width: 0;
}
.searchable-select--compact .searchable-select__label {
  flex: 0 0 auto;
  line-height: 1;
}
.searchable-select--compact .searchable-select__caret { font-size: 11px; }
.searchable-select__trigger:hover { border-color: var(--md-sys-color-primary); }
.searchable-select__trigger[aria-expanded="true"] {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  padding: 11px 13px;
}
.searchable-select__label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.searchable-select__caret {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

.searchable-select__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-2);
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.searchable-select--compact .searchable-select__panel {
  right: auto;
  min-width: 240px;
}

.searchable-select__search {
  padding: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.searchable-select__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  font: inherit;
  outline: none;
  box-sizing: border-box;
}
.searchable-select__input:focus {
  border-color: var(--md-sys-color-primary);
  border-width: 2px;
  padding: 9px 11px;
}

.searchable-select__list {
  list-style: none;
  margin: 0; padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}
.searchable-select__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
  transition: background 0.1s;
}
.searchable-select__item:hover,
.searchable-select__item.is-active {
  background: var(--md-sys-color-secondary-container);
}
.searchable-select__flag {
  font-size: 18px;
  line-height: 1;
}
.searchable-select__empty {
  padding: 12px 14px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 13px;
}

/* На mobile занимаем полную ширину панели. */
@media (max-width: 599.98px) {
  .searchable-select__panel { max-height: 60vh; }
}

/* ==========================================================================
   Post sheet — bottom-sheet выбора типа объявления (как в мобильном app).
   Триггеры: [data-post-sheet] (fab/header/sidebar). Markup: includes/_post_sheet.html
   ========================================================================== */
.post-sheet {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.post-sheet[hidden] { display: none; }
body.post-sheet-locked { overflow: hidden; }

.post-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity .24s ease;
}
.post-sheet.is-open .post-sheet__backdrop { opacity: 1; }

.post-sheet__panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--md-sys-color-surface, var(--c-surface));
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform .26s cubic-bezier(.2, 0, 0, 1);
}
.post-sheet.is-open .post-sheet__panel { transform: translateY(0); }

.post-sheet__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--md-sys-color-outline-variant);
  margin: 6px auto 4px;
}
.post-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
}
.post-sheet__title {
  margin: 0;
  font: 600 17px/24px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface, var(--c-text));
}
.post-sheet__close {
  border: none;
  background: none;
  font-size: 28px;
  line-height: 1;
  color: var(--md-sys-color-on-surface-variant, var(--c-text-muted));
  cursor: pointer;
  padding: 0 4px;
}
.post-sheet__list { display: flex; flex-direction: column; gap: 4px; }
.post-sheet__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 8px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--md-sys-color-on-surface, var(--c-text));
  transition: background .15s;
}
.post-sheet__item:active,
.post-sheet__item:hover { background: var(--md-sys-color-surface-container, rgba(0,0,0,.04)); }
.post-sheet__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text);
  font-size: 22px;   /* размер эмодзи-иконки внутри кружка */
  line-height: 1;
}
.post-sheet__icon--animal  { background: #A5D6A7; }
.post-sheet__icon--product { background: #FFE0B2; }
.post-sheet__icon--meat    { background: #FFCDD2; }
.post-sheet__icon--milk    { background: #BBDEFB; }
.post-sheet__icon--service { background: #D1C4E9; }
.post-sheet__label {
  flex: 1;
  font: 500 15px/20px 'Roboto', sans-serif;
}
.post-sheet__chevron { color: var(--md-sys-color-outline, var(--c-text-disabled)); display: flex; }

/* --- Карта приватной зоны местоположения (Leaflet) --- */
.mkt-map-wrap {
  margin-top: 12px;
}
.mkt-map-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font: 500 13px/18px 'Roboto', sans-serif;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 6px;
}
.mkt-map {
  width: 100%;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--md-sys-color-surface-variant);
  z-index: 0; /* Leaflet tiles ниже sticky-сайдбара */
}
/* Атрибуция OSM не должна перекрывать карту */
.mkt-map .leaflet-control-attribution {
  font-size: 9px;
}
/* Убираем хардкод-флаг Украины из дефолтного префикса Leaflet (страховка к
   setPrefix в _location_map.html). */
.mkt-map .leaflet-attribution-flag {
  display: none !important;
}

/* --- Карусель «Другие объявления продавца» --- */
.mkt-seller-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0;
  -webkit-overflow-scrolling: touch;
  /* Карточки разной высоты (название в одну или две строки) не растягиваются
     до самой высокой: растянутая карточка добавляла под собой пустую полосу,
     и лента выглядела разорванной (2026-08-12). */
  align-items: flex-start;
}
.mkt-seller-carousel > .listing-card,
.mkt-seller-carousel > article {
  flex: 0 0 auto;
  width: 160px;
  scroll-snap-align: start;
}
/* Тонкий скролл-бар */
.mkt-seller-carousel {
  scrollbar-width: thin;
  scrollbar-color: var(--md-sys-color-outline, var(--c-text-disabled)) transparent;
}
.mkt-seller-carousel::-webkit-scrollbar {
  height: 6px;
}
.mkt-seller-carousel::-webkit-scrollbar-track {
  background: transparent;
}
.mkt-seller-carousel::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline);
  border-radius: 3px;
}
/* Карточка внутри карусели — чистый компактный вид: белая карточка с тенью,
   квадратное фото (object-fit cover), цена зелёным текстом. Базовые
   .listing-card стили рассчитаны на широкую grid-колонку и в узком (160px)
   flex-контексте растягивали картинку в вертикальную полосу (72×258). */
.mkt-seller-carousel > article,
.mkt-seller-carousel > .listing-card {
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface, var(--c-surface));
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20, 30, 20, 0.06);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.mkt-seller-carousel > article:hover,
.mkt-seller-carousel > .listing-card:hover {
  box-shadow: 0 6px 18px rgba(20, 30, 20, 0.12);
  transform: translateY(-2px);
}
.mkt-seller-carousel .listing-card__image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  flex: none;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  position: relative;
}
/* :not(.listing-card__flag) ОБЯЗАТЕЛЕН: без гейта width/height:100%
   !important растягивали флаг страны на всё фото карусели «Другие
   объявления продавца» (старый баг — market.css:41 загаржен, а это
   правило с !important побеждало его). */
.mkt-seller-carousel .listing-card__image img:not(.listing-card__flag),
.mkt-seller-carousel .listing-card__placeholder {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 0;
}
/* Флаг в компактной карусели — мельче ленточного (фото всего 150px). */
.mkt-seller-carousel .listing-card__flag {
  width: 20px;
  height: 15px;
}
.mkt-seller-carousel .listing-card__content {
  padding: 9px 11px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mkt-seller-carousel .listing-card__category {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
}
.mkt-seller-carousel .listing-card__breed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--md-sys-color-on-surface);
}
.mkt-seller-carousel .listing-card__footer {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Цена — чистым зелёным текстом, без «таблетки»-чипа */
.mkt-seller-carousel .listing-card__footer .chip,
.mkt-seller-carousel .listing-card__footer .chip--primary {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  color: var(--md-sys-color-primary, var(--c-brand)) !important;
  font-weight: 800;
  font-size: 13.5px;
}
.mkt-seller-carousel .stats__item {
  font-size: 11px;
  color: var(--md-sys-color-outline);
}

/* fix BUG-2059 (+ смежный BUG-2036 в товарах): раскрытая панель
   searchable-select перекрывалась следующими карточками визарда —
   animation: wizard-card-in (transform, fill both) делает каждую карточку
   собственным stacking context, и z-index:50 панели действует только внутри
   своей карточки. searchable_select.js вешает .ss-raised на карточку-хост
   (.wizard__card / .wiz-price) на время открытого дропдауна. */
.ss-raised {
  position: relative;
  z-index: 120;
}

/* Возраст объявления в карточке ленты (показывается у старше 30 дней).
   Приглушён: это справочная деталь, а не акцент — конкурировать с ценой
   и бейджами не должен. */
.listing-card__age {
  opacity: .7;
  white-space: nowrap;
}

/* === Premium: лавровый венок вокруг аватара (319.jpg-референс) ============ */
/* Обёртка вокруг любого avatar-блока; ::before рисует золотые ветви SVG,
   лента «Premium» — под аватаром. Условие ставит шаблон (farmer.is_premium). */
.premium-laurel {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.premium-laurel::before {
  content: '';
  position: absolute;
  top: -13%;
  left: 50%;
  transform: translateX(-50%);
  width: 132%;
  aspect-ratio: 1 / 1;
  background: url('../images/laurel_wreath.svg') center / contain no-repeat;
  pointer-events: none;
  z-index: 2;
}
.premium-laurel__ribbon {
  margin-top: 2px;
  z-index: 3;
  background: linear-gradient(180deg, var(--c-premium), var(--c-top));
  color: var(--c-on-brand);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .6px;
  padding: 2px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}

/* Мини-вариант венка (аватар в шапке/нижнем баре): без ленты, венок плотнее
   прижат к фото — иначе на 28–32px «ветви» не читаются. */
.premium-laurel--mini::before { top: -16%; width: 138%; }
.premium-laurel--mini .premium-laurel__ribbon { display: none; }

/* --- Toast — короткое уведомление внизу экрана ---------------------------
   Переехал из market.css (2026-09-02): тот грузится только на страницах
   маркетплейса (`{% if market_vertical %}`), а тост нужен и в «Моих
   объявлениях» (ошибка оплаты продвижения вместо alert()). Разметку создаёт
   `window.showToast` из app.js и inline-скрипты деталок («Ссылка скопирована»).
   Класс остаётся `mkt-*`: префикс `ad-*` режет AdBlock EasyList. */
.mkt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 18px;
  background: rgba(26, 28, 24, 0.92);
  color: var(--c-on-brand);
  font-size: 14px;
  border-radius: var(--md-sys-shape-corner-full);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  animation: mkt-toast-in 0.2s ease-out;
}
@keyframes mkt-toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
