/* ═══════════════════════════════════════════════════════════════════════════
   MAIN SCREEN — по скринам Figma
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-main {
  background: #F3F4F6;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* Header */
.m-header {
  background: #FFFFFF;
  padding: 16px 12px 12px;
  padding-top: 12px;
  border-radius: 0 0 8px 8px;
}
body.platform-ios .m-header,
body.platform-android .m-header {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.4 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.4 + 24px)
  );
}
/* Избранное: safe-area padding только в полном экране */
body.platform-ios.tg-fullscreen .fav-header,
body.platform-android.tg-expanded .fav-header {
  padding-top: max(
    calc(env(safe-area-inset-top, 0px) * 1.4 + 24px),
    calc(var(--tg-content-safe-area-inset-top, 0px) * 1.4 + 24px)
  );
}
/* Избранное: в неполном экране — без отрицательного margin, фиксированная высота */
body.tg-active.platform-ios:not(.tg-fullscreen) .fav-header,
body.tg-active.platform-android:not(.tg-expanded) .fav-header {
  padding-top: 0;
}
body.tg-active.platform-ios:not(.tg-fullscreen) .fav-header-inner,
body.tg-active.platform-android:not(.tg-expanded) .fav-header-inner {
  margin-top: 0;
  height: 44px;
}
.m-header-inner {
  display: flex;
  align-items: center;
  gap: 4px;
}
.m-search-wrap {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  background: #F2F2F7; border-radius: 12px;
  padding: 0 14px; height: 40px;
}
.m-search {
  border: none; background: transparent;
  font-family: var(--font); font-size: 15px; color: #000000;
  width: 100%; outline: none;
}
.m-search::placeholder { color: #AEAEB2; }
.m-notification-btn {
  width: 40px; height: 40px;
  background: #F2F2F7;
  border-radius: 12px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  
  cursor: pointer;
  padding: 0;
}
.m-notification-btn svg { display: block; }

/* Scroll */
.m-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; padding-top: 4px; background: #F3F4F6; }
.m-scroll::-webkit-scrollbar, .screen::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

.m-block {
  background: #FFFFFF;
  border-radius: 8px;
  margin-bottom: 4px;
  padding-bottom: 12px;
}

/* Section title */
.m-section-title {
  font-size: 14px; font-weight: 700; color: #000000;
  padding: 12px;
}

/* ── Категории ────────────────────────────────────────────────────────────── */
.m-cats { padding: 0 12px; display: flex; flex-direction: column; gap: 8px; }

.m-cats-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-big {
  background: #F2F2F7; border-radius: 12px;
  height: 84px; position: relative; overflow: hidden;
  padding: 14px 12px;
  cursor: pointer; transition: transform .15s;
}
.cat-big:active { transform: scale(.97); }
.cat-big span { font-size: 12px; font-weight: 600; color: #000000; position: relative; z-index: 1; display: block; }
/* Кошки — увеличенная, сдвинута правее и ниже */
.m-cats-row2 .cat-big:nth-child(1) img { position: absolute; right: -20px; bottom: -22px; width: 115px; height: 120px; object-fit: contain; }
/* Собаки — from SVG: card w=171 h=84, img offset left=86 top=-10 w=103 h=100 */
.m-cats-row2 .cat-big:nth-child(2) img { position: absolute; left: 50.3%; top: -13.9%; width: 103px; height: 100px; object-fit: contain; }

.m-cats-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-small {
  background: #F2F2F7; border-radius: 12px;
  height: 84px; position: relative; overflow: hidden;
  padding: 14px 10px;
  cursor: pointer; transition: transform .15s;
}
.cat-small:active { transform: scale(.95); }
.cat-small span { font-size: 12px; font-weight: 600; color: #000000; position: relative; z-index: 1; display: block; line-height: 1.2; }
/* Вязка — image2: rect x=15 y=172 w=106 h=46, card x=12 y=134 w=112 h=84 → centered, bottom:0 */
.cat-small:nth-child(1) img { position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 112px; height: 50px; object-fit: contain; }
/* Приюты — image3: rect x=182 y=156 w=62 h=62, card x=132 y=134 w=112 h=84 → right:0 bottom:0 */
.cat-small:nth-child(2) img { position: absolute; right: -7px; bottom: -10px; width: 99px; height: 89px; object-fit: contain; }
/* Потерянные — image4: rect x=301 y=157 w=60 h=62, card x=252 y=134 w=112 h=84 → right:3 bottom:-1 */
.cat-small:nth-child(3) img { position: absolute; right: 3px; bottom: -1px; width: 60px; height: 62px; object-fit: contain; }


/* ── Популярные питомцы ───────────────────────────────────────────────────── */
.m-ads-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 16px; }
/* Кнопка «Посмотреть остальные объявления» (Figma 4246-167):
   фон — акцент #635CFB @ 20%, текст — акцент, Onest Medium 14px, радиус 12px. */
.m-see-all-btn {
  display: block; width: calc(100% - 24px); margin: 0 12px; height: 44px;
  border: none; border-radius: 12px; background: rgba(99, 92, 251, 0.2);
  color: #635CFB; font-family: 'Onest', sans-serif; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: transform .15s, background .15s;
}
.m-see-all-btn:active { transform: scale(.98); background: rgba(99, 92, 251, 0.28); }
.m-ad {
  background: #FFFFFF; border-radius: 16px;
  overflow: visible; cursor: pointer; transition: transform .15s;
}
.m-ad:active { transform: scale(.97); }
.m-ad-img { 
  width: 100%; 
  height: 135px; 
  border-radius: 16px;
  object-fit: cover; 
}
/* ТОП-плашка на продвинутых объявлениях: плавающий пилюль в углу картинки,
   одинаковый стиль с ветклиниками (.vet-top-badge) */
.m-ad-topline {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  pointer-events: none;
}
.m-ad-top {
  display: flex; align-items: center; justify-content: center;
  padding: 4px 8px;
  background: #635CFB; color: #FFFFFF;
  font-family: var(--font); font-size: 12px; font-weight: 500; line-height: 15px;
  border-radius: 6px;
}
/* плашка «Вязка»: внутри ТОП-линии — в ряд, соло — в углу картинки */
.m-ad-mating {
  display: flex; align-items: center; justify-content: center;
  padding: 4px 8px; border-radius: 99px;
  background: #FF383C; color: #FFFFFF;
  font-family: var(--font, sans-serif); font-size: 12px; font-weight: 500;
}
.m-ad-mating-solo { position: absolute; top: 8px; left: 8px; z-index: 2; }
/* плашка «Потерянные» (Figma 3979-228): красная, углы чуть скруглены */
.m-ad-lost {
  display: flex; align-items: center; justify-content: center;
  padding: 4px 8px; border-radius: 8px;
  background: #FF383C; color: #FFFFFF;
  font-family: var(--font, sans-serif); font-size: 12px; font-weight: 500; line-height: 15px;
  white-space: nowrap;
}
.m-ad-lost-solo { position: absolute; top: 8px; left: 8px; z-index: 2; }
.m-ad-body { padding: 8px 12px 12px; }
.m-ad-price { font-size: 16px; font-weight: 700; color: #000000; margin-bottom: 2px; }
.m-ad-name { font-size: 14px; color: #000000; margin-bottom: 6px; }
.ad-city { font-size: 12px; color: #8E8E93; }
.ad-time-today, .ad-time-yesterday, .ad-time-other { font-size: 12px; color: #8E8E93; }

/* ── Сервисы ──────────────────────────────────────────────────────────────── */
.m-services-row {
  display: flex; gap: 8px; padding: 0 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.m-services-row::-webkit-scrollbar { display: none; }
.svc-tab {
   flex-shrink: 0; width: 164px; height: 93px;
  border-radius: 12px; position: relative; overflow: hidden;
  padding: 10px 12px; cursor: pointer; transition: transform .15s;
}
.svc-tab:active { transform: scale(.97); }
.svc-tab span {
  font-size: 12px;
  font-weight: 600;
  position: relative;
  z-index: 1;
  display: block;
  white-space: nowrap;
  font-family: 'Onest', sans-serif;
  font-style: normal;
  line-height: normal;
  font-feature-settings: 'liga' off, 'clig' off;
}
.svc-img { position: absolute; object-fit: contain; }

/* 1. Ветклиники */
.svc-tab:nth-child(1) { background: #635CFB; }
.svc-tab:nth-child(1) span { color: #FFFFFF; }
.svc-tab:nth-child(1) img { right: 0; bottom: 0; width: 138px; height: 70px; }

/* 2. Груминг */
.svc-tab:nth-child(2) { background: #E0DEFE; }
.svc-tab:nth-child(2) span { color: #000000; }
.svc-tab:nth-child(2) img { right: -5px; bottom: -16px; width: 159px; height: 95px; }

/* 3. Гостиницы / Зоомагазины */
.svc-tab:nth-child(3) { background: #F5F4FE; border-radius: 8px; }
.svc-tab:nth-child(3) span { color: #000000; }
.svc-tab:nth-child(3) img { right: 0; bottom: 0; width: 122px; height: 74px; }

/* ── Add button ───────────────────────────────────────────────────────────── */
.m-add-btn {
  display: block; width: calc(100% - 32px); margin: 16px 16px 0;
  padding: 15px; background: #635CFB; color: #FFF;
  border: none; border-radius: 14px;
  font-family: var(--font); font-size: 16px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 16px rgba(99,92,251,.3); transition: transform .15s;
}
.m-add-btn:active { transform: scale(.97); }

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.m-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 76px; background: #FFFFFF;
  border-top: none;
  display: flex; align-items: stretch; justify-content: space-around;
  padding-bottom: 0; z-index: 100;
}
.m-nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; color: #0F172A;
  font-family: var(--font); font-size: 10px; font-weight: 500;
  cursor: pointer; padding: 0; transition: color .15s;
}
.m-nav-btn.active { color: #635CFB; }
.m-nav-btn span { font-size: 12px; }
.m-nav-plus {
  width: 44px; height: 44px; background: #635CFB;
  border-radius: 50%; flex: none;
  box-shadow: none;
  margin-bottom: 8px; padding: 0; color: #FFF;
}

/* ── Profile panel — Figma Profile/Заполненный ───────────────────────────── */
.profile-panel {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: #F3F4F6;
  flex-direction: column;
  z-index: 50;
}
.prof-scroll {
  flex: 1;
  display: flex; flex-direction: column;
  overflow-y: auto;
  padding: 4px 0 88px; /* 4px под шапкой, 88px под таб-бар */
  gap: 8px;
}
.prof-scroll::-webkit-scrollbar { display: none; }

/* Карточка пользователя + статистика */
.prof-card {
  background: #FFFFFF;
  border-radius: 8px;
  padding: 12px;
  flex-shrink: 0;
}
.prof-user {
  display: flex; align-items: center; gap: 8px;
}
.profile-avatar {
  width: 56px; height: 56px; flex: none;
  background: #EEEDFF;
  border: 1px solid #F3F4F6;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}
.prof-user-details {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.profile-name {
  font-family: var(--font);
  font-size: 16px; font-weight: 500; color: #000000;
  line-height: 19px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prof-phone {
  font-family: var(--font);
  font-size: 12px; font-weight: 500; color: #9CA3AF;
  line-height: 14px;
}
/* Статистика 2×2 */
.prof-stats {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.prof-stat {
  background: #F3F4F6;
  border-radius: 12px;
  padding: 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.prof-stat-count {
  font-family: var(--font);
  font-size: 16px; font-weight: 700; color: #000000;
  line-height: 20px;
}
.prof-stat-label {
  font-family: var(--font);
  font-size: 14px; font-weight: 400; color: #000000;
  line-height: 18px;
}

/* Меню */
.prof-menu {
  background: #FFFFFF;
  border-radius: 8px;
  flex-shrink: 0;
}
.prof-item {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  cursor: pointer; transition: background .15s;
}
.prof-item:first-child { border-radius: 8px 8px 0 0; }
.prof-item:last-child { border-radius: 0 0 8px 8px; }
.prof-item:active { background: #F5F5F5; }
.prof-item-icon { width: 20px; height: 20px; flex: none; }
.prof-item-label {
  font-family: var(--font);
  font-size: 14px; font-weight: 400; color: #000000;
  line-height: 18px;
}
.prof-item-value {
  margin-left: auto;
  font-family: var(--font);
  font-size: 14px; font-weight: 400; color: #8E8E93;
  line-height: 18px;
}

/* Панели «Новости» и «Мои объявления»: шапка неподвижна, скроллится только контент */
#news-panel,
#my-ads-panel {
  overflow-y: hidden;
  overflow-x: hidden;
}
/* Пока над панелью открыта шторка «Продвинуть» (тариф/оплата), прячем её
   содержимое — чтобы сквозь затемнение не просвечивали карточки и чипы, а был
   ровный фон, как в потоке создания объявления (там .modal-open скрывает экран) */
#my-ads-panel.behind-modal > .fav-header,
#my-ads-panel.behind-modal > .fav-content-wrap {
  opacity: 0;
}
#my-ads-panel .fav-content-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* Обязательно: при overflow-y:auto вычисленный overflow-x тоже становится auto,
     и translateX анимации въезда даёт горизонтальную прокрутку — свайп между
     вкладками уводил контент вбок и он там залипал */
  overflow-x: hidden;
  /* none, а не contain: contain лишь запрещает прокрутку «протекать» наружу,
     но резиновый отскок внутри самого списка оставляет. На iOS палец уводил
     scrollTop далеко за предел (замер на устройстве: 134 при максимуме 15),
     и возврат этого отскока WebKit доигрывал уже на новой вкладке — экран
     дёргался. none отключает и отскок */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}
#my-ads-panel .fav-content-wrap::-webkit-scrollbar { display: none; }
#news-panel .news-content-wrap {
  min-height: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#news-panel .news-content-wrap::-webkit-scrollbar { display: none; }

/* Плавное появление новых карточек при смене фильтров/поиска */
@keyframes adCardIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.m-ad-enter { animation: adCardIn .25s ease-out; }

/* Плавное появление панелей «Новости», «Мои объявления» и FAQ */
@keyframes panelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
#news-panel.panel-appear,
#news-article-panel.panel-appear,
#my-ads-panel.panel-appear,
#faq-panel.panel-appear {
  animation: panelFadeIn .2s ease-out;
}

/* Плавное переключение вкладок нижнего меню (Главная/Избранное/Чат/Профиль):
   контент нового раздела мягко проявляется со слабым сдвигом вверх */
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.tab-appear { animation: tabFadeIn .28s ease-out; }

/* FAQ (дизайн Figma «Часто задаваемые вопросы») */
#faq-panel { overflow-y: hidden; }
/* Заголовок длинный — не поднимаем его в ряд кнопок Telegram: держим сразу
   под кнопкой «Назад» (−19px в fullscreen, 0 — в обычном режиме) */
#faq-panel .fav-header-inner { margin-top: calc(var(--app-title-margin, 0px) * 19 / 44); }
.faq-content-wrap {
  flex: 1;
  min-height: 0;
  padding: 16px 12px 88px;
  background: #FFFFFF;
  border-radius: 8px 8px 0 0;
  margin-top: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.faq-content-wrap::-webkit-scrollbar { display: none; }
.faq-item {
  border-bottom: 1px solid #E5E5EA;
  padding: 12px 0;
}
.faq-item:first-child { padding-top: 0; }
.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.faq-q-text {
  font-family: var(--font);
  font-size: 14px; font-weight: 500; color: #000000;
  line-height: 18px;
}
.faq-icon {
  width: 24px; height: 24px; flex: none;
  background: #F3F4F6;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform .25s ease;
}
.faq-item.open .faq-icon { transform: rotate(180deg); }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  font-family: var(--font);
  font-size: 13px; font-weight: 400; color: #6B7280;
  line-height: 18px;
}
.faq-a-inner { padding: 8px 36px 0 0; }

/* Скелетоны новостей */
@keyframes newsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.news-skel { animation: newsPulse 1.2s ease-in-out infinite; }
.news-skel-img {
  width: 100%; aspect-ratio: 351 / 164;
  background: #EFEFF1; border-radius: 16px;
}
.news-skel-line {
  height: 14px; border-radius: 6px;
  background: #EFEFF1; margin-top: 8px;
}

/* Новости (дизайн Figma «Новости») */
.news-content-wrap {
  flex: 1;
  padding: 12px 12px 88px; /* 88px под таб-бар */
  background: #FFFFFF;
  border-radius: 8px 8px 0 0;
  margin-top: 4px;
  overflow-y: auto;
}
.news-list {
  display: flex; flex-direction: column; gap: 16px;
}
.news-card { cursor: pointer; }
.news-img {
  width: 100%; aspect-ratio: 351 / 164;
  background: #E8E8E8;
  border-radius: 16px;
  overflow: hidden;
  display: block;
}
.news-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.news-info { padding-top: 8px; }
.news-tag {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 12px; font-weight: 400;
  line-height: 15px;
}
.news-card-title {
  margin-top: 8px;
  font-family: var(--font);
  font-size: 14px; font-weight: 600; color: #000000;
  line-height: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-date {
  margin-top: 8px;
  font-family: var(--font);
  font-size: 12px; font-weight: 400; color: #8E8E93;
  line-height: 15px;
}
.news-empty {
  padding: 40px 20px;
  text-align: center;
  font-family: var(--font);
  font-size: 14px; color: #8E8E93;
}

/* Страница статьи новости (дизайн Figma 4047-325) */
.news-article-wrap {
  flex: 1;
  padding: 12px 12px 88px;
  background: #FFFFFF;
  border-radius: 8px 8px 0 0;
  margin-top: 4px;
  overflow-y: auto;
}
.news-article-img {
  width: 100%;
  aspect-ratio: 351 / 164;
  border-radius: 16px;
  background: #E8E8E8 center / cover no-repeat;
  margin-bottom: 16px;
}
.news-article-title {
  margin-top: 12px;
  font-family: var(--font);
  font-size: 24px; font-weight: 600; line-height: 30px;
  color: #000000;
}
.news-article-date {
  margin-top: 8px;
  font-family: var(--font);
  font-size: 12px; font-weight: 400; line-height: 15px;
  color: #8E8E93;
}
.news-article-text {
  margin-top: 16px;
  font-family: var(--font);
  font-size: 14px; font-weight: 400; line-height: 22px;
  color: #000000;
  white-space: pre-wrap;
}

/* Шторка выбора языка (дизайн Figma «Язык») */
.lang-sheet-overlay {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: calc(var(--vh, 1vh) * 100);
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex; flex-direction: column; justify-content: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.lang-sheet-overlay.active {
  opacity: 1; pointer-events: auto;
}
.lang-sheet {
  width: 100%;
  background: #FFFFFF;
  border-radius: 12px 12px 0 0;
  padding: 16px 12px max(24px, calc(12px + env(safe-area-inset-bottom, 0px)));
  transform: translateY(100%);
  transition: transform .25s ease-out;
}
.lang-sheet-overlay.active .lang-sheet {
  transform: translateY(0);
}
.lang-sheet-title {
  font-family: var(--font);
  font-size: 16px; font-weight: 700; color: #000000;
  line-height: 20px; text-align: center;
  margin-bottom: 24px;
}
.lang-opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 8px;
  border-bottom: 1px solid #F2F2F2;
  cursor: pointer;
}
.lang-opt:first-child { padding-top: 0; }
.lang-opt:last-child { border-bottom: none; padding-bottom: 0; }
.lang-opt-name {
  font-family: var(--font);
  font-size: 14px; font-weight: 400; color: #000000;
  line-height: 22px;
}
.lang-radio {
  width: 20px; height: 20px; flex: none;
  box-sizing: border-box;
  border: 1.5px solid #E0E0E0;
  border-radius: 50%;
  background: #FFFFFF;
  position: relative;
  transition: background .15s, border .15s;
}
.lang-opt.selected .lang-radio {
  border: none;
  background: #635CFB;
}
.lang-opt.selected .lang-radio::after {
  content: '';
  position: absolute; inset: 5px;
  background: #FFFFFF;
  border-radius: 50%;
}

/* Выйти из аккаунта */
.prof-logout {
  margin: auto 12px 20px;
  height: 44px; flex-shrink: 0;
  background: rgba(255, 56, 60, 0.2);
  border: none; border-radius: 12px;
  font-family: var(--font);
  font-size: 14px; font-weight: 500; color: #FF383C;
  line-height: 18px;
  cursor: pointer;
}
.prof-logout:active { background: rgba(255, 56, 60, 0.3); }

.m-nav-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; color: #8E8E93; gap: 4px; border: none; background: transparent; cursor: pointer;
}
.m-nav-btn.active { color: #635CFB; }
.m-nav-btn span { font-size: 12px; }

/* Toggling outline and filled icons */
.m-nav-btn .icon-active { display: none; }
.m-nav-btn.active .icon-active { display: inline-block; }
.m-nav-btn.active .icon-inactive { display: none; }

/* Пружинка активной иконки при переходе на вкладку — одинаково для всех,
   включая «Главную» (у неё одна иконка без контурного варианта).
   Проигрывается только при реальной смене (повторный тап класс не перезапускает) */
@keyframes navIconPop {
  0%   { transform: scale(0.7); }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.m-nav-btn.active .icon-active,
.m-nav-btn[data-tab="home"].active > svg {
  animation: navIconPop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.m-nav-plus {
  width: 48px; height: 48px; background: #635CFB;
  border-radius: 50%; flex: none;
  box-shadow: 0 4px 14px rgba(99,92,251,.4);
  margin-bottom: 6px; padding: 0; color: #FFF;
}

.cats-header-top {
  padding: 4px;
  cursor: pointer;
  margin-left: -13px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.m-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F2F2F7;
  border-radius: 12px;
  padding: 10px 14px;
  height: 40px;
}

.m-search {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: #3C3C43;
  width: 100%;
  outline: none;
}

.m-search::placeholder {
  color: #AEAEB2;
}

/* Scroll area */
.m-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

/* Белый блок y=118 h=230 */
.m-white-block {
  background: #FFFFFF;
  padding: 12px 12px 16px;
  margin-bottom: 8px;
}

.m-block-title {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  margin-bottom: 10px;
}

/* 2 карточки y=160 h=84, рядом */
.m-cards-row {
  display: flex;
  gap: 8px;
}

.m-banner-card {
  flex: 1;
  height: 84px;
  background: #FFFFFF;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  padding: 10px 0 0 10px;
}

.m-banner-info {
  z-index: 1;
}

.m-banner-name {
  font-size: 11px;
  font-weight: 700;
  color: #1C1C1E;
  line-height: 1.3;
  max-width: 80px;
}

.m-banner-sub {
  font-size: 10px;
  color: #635CFB;
  margin-top: 3px;
  font-weight: 500;
}

.m-banner-img {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 0 0 12px 0;
}

/* Заголовок секции */
.m-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #1C1C1E;
  padding: 12px 12px 8px;
}

/* Категории — 3 в ряд (y=252 h=84 каждая w=112) */
.m-cats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px;
  margin-bottom: 4px;
}

.m-cat {
  background: #FFFFFF;
  border-radius: 12px;
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform .15s;
}

.m-cat:active {
  transform: scale(.95);
}

.m-cat-img {
  width: 48px;
  height: 42px;
  object-fit: contain;
}

.m-cat-more {
  width: 48px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #8E8E93;
  letter-spacing: 2px;
}

.m-cat span {
  font-size: 10px;
  font-weight: 600;
  color: #1C1C1E;
  text-align: center;
  line-height: 1.2;
  padding: 0 4px;
}

/* Объявления — 2 колонки (y=394 h=148 rx=16) */
.m-ads-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 12px 16px;
}

.m-ad {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: visible;
  cursor: pointer;
  transition: transform .15s;
  box-shadow: none;
}

.m-ad:active {
  transform: scale(.97);
}

.m-ad-img {
  width: 100%;
  height: 135px;
  border-radius: 16px;
  object-fit: cover;
}

.m-ad-body {
  padding: 8px 0 10px;
}

.m-ad-name {
  font-size: 13px;
  font-weight: 400;
  color: #1C1C1E;
}

.m-ad-price {
  font-size: 14px;
  font-weight: 700;
  color: #1C1C1E;
  margin-top: 2px;
}

.m-ad-loc {
  font-size: 11px;
  color: #8E8E93;
  margin-top: 3px;
}

/* Кнопка E'lon berish — y=1082 fill=#635CFB */
.m-add-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 16px 12px 0;
  padding: 15px;
  background: #635CFB;
  color: #FFF;
  border: none;
  border-radius: 14px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 92, 251, .35);
  transition: transform .15s;
}

.m-add-btn:active {
  transform: scale(.97);
}

/* Bottom nav — y=950 #635CFB active */
.m-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: #FFFFFF;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.m-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #0F172A;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  transition: color .15s;
}

.m-nav-btn.active {
  color: #635CFB;
}

.m-nav-btn span {
  font-size: 10px;
}

/* Бейдж непрочитанных на вкладке «Чат»: красный кружок с числом поверх иконки */
.m-nav-btn { position: relative; }
.m-nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 5px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FF3B30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  border-radius: 8px;
  pointer-events: none;
}
.m-nav-badge[hidden] { display: none; }

.m-nav-plus {
  width: 48px;
  height: 48px;
  background: #635CFB;
  border-radius: 50%;
  flex: none;
  box-shadow: none;
  margin-bottom: 6px;
  padding: 0;
  color: #FFF;
}

#screen-main {
  background: #F3F4F6;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────── */
.main-header {
  background: #FFFFFF;
  padding: 52px 16px 12px;

  border-bottom: 1px solid #F0F0F5;
}

.main-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.main-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.main-hello {
  font-size: 13px;
  color: #8E8E93;
}

.main-username {
  font-size: 17px;
  font-weight: 700;
  color: #1C1C1E;
}

.main-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #EEEDFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

/* Search */
.main-search {
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 8px;
}

.search-icon {
  font-size: 16px;
}

.search-input {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: #1C1C1E;
  width: 100%;
  outline: none;
}

.search-input::placeholder {
  color: #AEAEB2;
}

/* ── Scroll ─────────────────────────────────────────────── */
.main-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 80px;
}

.main-scroll::-webkit-scrollbar {
  display: none;
}

/* ── Section label ──────────────────────────────────────── */
.section-label {
  font-size: 16px;
  font-weight: 700;
  color: #1C1C1E;
  padding: 16px 16px 10px;
}

/* ── Banner row ─────────────────────────────────────────── */
.banner-row {
  display: flex;
  gap: 10px;
  padding: 0 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

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

.banner-card {
  min-width: 172px;
  height: 88px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  position: relative;
  overflow: hidden;

  scroll-snap-align: start;
}

.banner-card-text {
  z-index: 1;
}

.banner-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #1C1C1E;
  line-height: 1.3;
}

.banner-card-sub {
  font-size: 10px;
  color: #635CFB;
  margin-top: 2px;
}

.banner-card-img {
  width: 74px;
  height: 79px;
  object-fit: cover;
  position: absolute;
  right: 0;
  bottom: 0;
  border-radius: 0 0 12px 0;
}

/* ── Categories grid ────────────────────────────────────── */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.cat-card {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 12px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.cat-card:active {
  transform: scale(0.95);
}

.cat-card img {
  width: 52px;
  height: 46px;
  object-fit: contain;
  border-radius: 8px;
}

.cat-card span {
  font-size: 11px;
  font-weight: 600;
  color: #1C1C1E;
  text-align: center;
}

/* ── Ads grid ───────────────────────────────────────────── */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.ad-card {
  background: #FFFFFF;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ad-card:active {
  transform: scale(0.97);
}

.ad-img {
  width: 100%;
  height: 130px;
  object-fit: cover;
}

.ad-info {
  padding: 8px 10px 10px;
}

.ad-title {
  font-size: 13px;
  font-weight: 600;
  color: #1C1C1E;
}

.ad-price {
  font-size: 13px;
  font-weight: 700;
  color: #635CFB;
  margin-top: 2px;
}

.ad-location {
  font-size: 11px;
  color: #8E8E93;
  margin-top: 3px;
}

/* ── Add button ─────────────────────────────────────────── */
.add-btn {
  display: block;
  margin: 20px 16px 0;
  width: calc(100% - 32px);
  padding: 16px;
  background: #635CFB;
  color: #FFFFFF;
  border: none;
  border-radius: 14px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 16px rgba(99, 92, 251, 0.35);
}

.add-btn:active {
  transform: scale(0.97);
}

/* ── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: #FFFFFF;
  border-top: 1px solid #F0F0F5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: #AEAEB2;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s ease;
}

.nav-btn.active {
  color: #635CFB;
}

.nav-btn span {
  font-size: 10px;
}

.nav-add {
  width: 52px;
  height: 52px;
  background: #635CFB;
  border-radius: 50%;
  flex: none;
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(99, 92, 251, 0.4);
  margin-bottom: 8px;
  padding: 0;
}

/* Notification Banner */
.m-notification-banner {
  width: calc(100% - 24px);
  height: 84px;
  min-height: 84px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--Main-collor, #635CFB);
  background: rgba(99, 92, 251, 0.08);
  display: flex;
  align-items: center;
  padding: 10px;
  gap: 16px;
  margin: 4px 12px 4px 12px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.m-notif-avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  background: url('../img/notif_avatar.webp') center/cover;
}

.m-notif-heart-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.m-notif-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1;
}

.m-notif-title {
  color: #000;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.m-notif-subtitle {
  color: #8E8E93;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
}

.m-notif-arrow {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.m-notif-bg-art {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 47px;
  height: 44px;
  opacity: 1;
  z-index: 0;
  pointer-events: none;
}

