/* === NAVBAR === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border);
}

/* Фон и blur живут на псевдоэлементе, а не на самом .navbar: backdrop-filter
   делает элемент containing block'ом для position: fixed потомков, и
   мобильный таб-бар (.navbar-menu, fixed bottom: 0) прибивался к низу
   шапки вместо низа экрана, перекрывая логотип. */
.navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg-1) 75%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.navbar-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.navbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

/* Знак бренда — янтарный квадрат перед словом. */
.navbar-logo::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
}

.navbar-logo:hover {
  opacity: 0.75;
}

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

.navbar-link {
  color: var(--text-secondary);
  text-decoration: none;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1;
}

.navbar-link svg,
.navbar-link i {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  margin: 0;
  padding: 0;
}

.navbar-link:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.navbar-link.active {
  color: var(--accent-text);
  background: var(--accent-soft);
}

/* === PROFILE MENU === */
.navbar-profile {
  position: relative;
  margin-left: var(--space-2);
}

.navbar-profile-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-2);
}

.navbar-profile-btn:hover {
  background: var(--bg-3);
}

.navbar-profile-btn[aria-expanded="true"] {
  color: var(--text-primary);
  background: var(--bg-4);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  animation: menuIn 0.15s ease-out;
}

/* Свой display: flex перебивает UA-правило [hidden] — возвращаем его. */
.profile-menu[hidden] {
  display: none;
}

@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease;
}

.profile-menu-item i,
.profile-menu-item svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.profile-menu-item:hover,
.profile-menu-item:focus-visible {
  background: var(--surface-hover);
  outline: none;
}

.profile-menu-item.active {
  background: var(--surface-active);
}

.profile-menu-logout,
.profile-menu-logout i,
.profile-menu-logout svg {
  color: var(--danger);
}

.profile-menu-kbd {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
}

.profile-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 4px 10px;
}

.profile-menu-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.profile-menu-divider {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

.theme-switch {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  border: 1px solid var(--border);
}

.theme-switch-btn {
  width: 32px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.theme-switch-btn:hover {
  color: var(--text-primary);
}

.theme-switch-btn[aria-pressed="true"] {
  color: var(--text-primary);
  background: var(--surface-active);
}

/* Шорткаты — только для мыши/клавиатуры. */
@media (hover: none) {
  .profile-menu-shortcuts {
    display: none;
  }
}

/* === PAGE LAYOUT === */
.page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 72px 32px 40px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.6px;
  color: var(--text-primary);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* === FILTERS === */
/* Строка чипсов вместо панели с селектами. */
.filters {
  margin-bottom: 16px;
}

.filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filters-spacer {
  flex-grow: 1;
}

.filters .btn {
  height: 34px;
  padding: 0 14px;
}

/* Кнопка-чипс: «Фильтры» на телефоне и варианты в шторке. */
.filter-chip {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--border-hover);
}

.filter-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.filter-chip.active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* На десктопе категории видны прямо в строке — кнопка шторки не нужна. */
.filters-sheet-btn {
  display: none;
}

.filter-reset {
  height: 34px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-md);
  background: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.filter-reset:hover {
  color: var(--text-primary);
}

.filter-reset[hidden] {
  display: none;
}

/* MultiSelect в виде чипса (data-variant="chip"). */
.multi-select[data-variant="chip"] {
  min-width: 0;
  height: 34px;
}

.multi-select[data-variant="chip"] .multi-select-toggle {
  width: auto;
  max-width: 240px;
  padding: 0 32px 0 14px;
  border-radius: 999px;
  border-color: var(--border);
  background-position: right 12px center;
  font-weight: 500;
}

.multi-select[data-variant="chip"] .multi-select-toggle[data-empty="true"] {
  color: var(--text-primary);
}

.multi-select[data-variant="chip"] .multi-select-toggle:hover {
  border-color: var(--border-hover);
}

.multi-select[data-variant="chip"].open .multi-select-toggle {
  border-color: var(--accent-line);
}

/* Выбрано значение: чипс подсвечен акцентом, вместо стрелки — ×. */
.multi-select[data-has-value="true"] .multi-select-toggle {
  border-color: var(--accent-line);
  background-color: var(--accent-soft);
  background-image: none;
  color: var(--accent-text);
}

.multi-select-clear {
  display: none;
  position: absolute;
  top: 50%;
  right: 4px;
  width: 26px;
  height: 26px;
  padding: 0;
  transform: translateY(-50%);
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--accent-text);
  cursor: pointer;
}

.multi-select-clear:hover {
  background: rgba(var(--accent-rgb), 0.2);
}

.multi-select[data-has-value="true"] .multi-select-clear {
  display: inline-flex;
}

/* === FILTER SHEET (телефон) === */
.filter-sheet {
  position: fixed;
  inset: 0;
  z-index: 1500;
}

.filter-sheet[hidden] {
  display: none;
}

.filter-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease-out;
}

.filter-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0));
  border-radius: 20px 20px 0 0;
  background: var(--bg-1);
  outline: none;
  animation: sheetIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.filter-sheet-handle {
  align-self: center;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-4);
}

.filter-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-sheet-title {
  font-size: 18px;
  font-weight: 600;
}

.filter-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.filter-sheet-group-title {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.filter-sheet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-sheet-chips .filter-chip {
  height: 36px;
  min-width: 44px;
  justify-content: center;
}

.filter-sheet-done {
  flex-shrink: 0;
  height: 48px;
  font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
  .filter-sheet-panel,
  .filter-sheet-backdrop {
    animation: none;
  }
}

.filter-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 220px;
  flex: 1;
}

.filter-search-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-search {
  width: 100%;
  height: var(--control-height);
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.filter-search:hover {
  border-color: var(--border-hover);
  background: var(--bg-3);
}

.filter-search:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.filter-select {
  height: var(--control-height);
  padding: 0 28px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  min-width: 180px;
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.filter-select::-ms-expand {
  display: none;
}

.filter-select:hover {
  border-color: var(--accent);
  background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* === MULTI-SELECT ===
   Кастомный dropdown с чекбоксами для мульти-фильтров (категории /
   подкатегории / возраст). Стили калькированы под .filter-select чтобы
   не выделяться в filters-row. */

/* Панели теперь position: fixed — z-index на .filters и .multi-select
   больше не нужен. Оставлено пусто для читаемости истории. */
.multi-select {
  position: relative;
  min-width: 180px;
  height: var(--control-height);
}
.multi-select-toggle {
  width: 100%;
  height: 100%;
  padding: 0 28px 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--bg-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: var(--transition);
  outline: none;
}
.multi-select-toggle:hover,
.multi-select.open .multi-select-toggle {
  border-color: var(--accent);
}
.multi-select.open .multi-select-toggle {
  box-shadow: var(--focus-ring);
}
/* Оттеняем "пусто" (ничего не выбрано) — как placeholder у select. */
.multi-select-toggle[data-empty="true"] {
  color: var(--text-secondary);
}
.multi-select-panel {
  /* Скрыто по умолчанию. HTML-атрибут `hidden` не работает, потому что
     ниже стоит display: flex — у класса выше специфичность, чем у
     UA-правила [hidden] { display: none }. Открытие/закрытие делаем
     через .multi-select.open в JS.

     position: fixed вместо absolute — раньше absolute-панель клипалась
     .edit-panel-body { overflow-y: auto } и уходила под соседние
     .upload-card в админке (без position: relative на них
     absolute-child позиционировался относительно viewport'а, но overflow
     родителя всё равно её резал). fixed рендерится относительно viewport
     напрямую, никакой ancestor не обрежет и не сложит z-index. Координаты
     рассчитывает MultiSelect.open() из getBoundingClientRect() тогглера.
     При скролле панель закрывается — это стандартное поведение native
     <select>. */
  display: none;
  position: fixed;
  z-index: 10000;
  min-width: 180px;
  max-width: 320px;
  max-height: 320px;
  /* Внутрь ляжет .multi-select-scroll со своим overflow-y. Внешний блок
     не скроллится — так scrollbar не касается скруглённых углов. */
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  flex-direction: column;
}
/* Панель монтируется в <body> (см. MultiSelect._build), поэтому селектор
   на потомок .multi-select.open НЕ сработал бы. Показываем через класс
   .open прямо на панели — синхронизирует MultiSelect.open()/close(). */
.multi-select-panel.open {
  display: flex;
}
/* Внутренний скролл-контейнер. Отступ 6px по всем сторонам оставляет
   зазор между строками и скруглёнными углами внешнего блока, а
   webkit-scrollbar получает свои собственные округлые "рельсы". */
.multi-select-scroll {
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Firefox: тонкий скроллбар, никакого фона под ним. */
  scrollbar-width: thin;
  scrollbar-color: var(--border-hover) transparent;
}
.multi-select-scroll::-webkit-scrollbar { width: 8px; }
.multi-select-scroll::-webkit-scrollbar-track {
  background: transparent;
  /* Отступ сверху/снизу, чтобы бегунок в крайних положениях НЕ доходил
     до скруглённых углов внешней панели. */
  margin: 6px 0;
}
.multi-select-scroll::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.multi-select-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: padding-box; border: 2px solid transparent; }
/* Empty state: когда в setOptions() пришёл пустой список — вместо
   ужасной узкой полоски показываем пояснение. */
.multi-select-empty {
  padding: 16px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  font-style: italic;
}
.multi-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  user-select: none;
  transition: background 0.12s;
}
.multi-select-option:hover {
  background: var(--bg-3);
}
.multi-select-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.multi-select-option.checked {
  color: var(--text-primary);
}

/* Single-режим: строка без чекбокса, слева резервируем место под галочку
   такого же размера как чекбокс — тогда все строки визуально выровнены,
   и выбранная строка получает cheap green чек внутри. */
.multi-select-option.single {
  padding-left: 8px;
}
.multi-select-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: color 0.12s;
}
.multi-select-option.single.checked {
  background: var(--accent-soft);
}
.multi-select-option.single.checked .multi-select-check {
  color: var(--accent-text);
}
.multi-select-option.single:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* На мобильных формы (админка, панель редактирования) раскладываются в
   колонку — multi-select там во всю ширину. Чипсы фильтров галереи
   остаются по содержимому. Ставить flex с процентным basis НЕЛЬЗЯ: в
   column-режиме basis влияет на высоту, что даёт "плоские" тогглеры. */
@media (max-width: 768px) {
  .multi-select:not([data-variant="chip"]) {
    width: 100%;
    min-width: 0;
  }
  .multi-select-panel {
    /* Панель fixed — координаты выставляет JS. Здесь только уточняем
       максимальную ширину для узких экранов, чтобы содержимое не
       вылезало за края viewport'а. */
    max-width: calc(100vw - 24px);
  }
}

/* === MEDIA GRID === */
.media-grid {
  display: grid;
  /* Card min-width is driven by --card-min so the density picker can
     retune the whole grid via one variable. */
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 200px), 1fr));
  gap: var(--card-gap, 8px);
}

:root[data-density="comfortable"] .media-grid { --card-min: 240px; --card-gap: 12px; }
:root[data-density="compact"]     .media-grid { --card-min: 200px; --card-gap: 8px; }
:root[data-density="dense"]       .media-grid { --card-min: 150px; --card-gap: 4px; }

/* Segmented density control — three iconified buttons in the filter row. */
.density-picker {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 2px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  gap: 2px;
}
.density-btn {
  height: 100%;
  min-width: 32px;
  padding: 0 8px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.density-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}
.density-btn.active {
  color: var(--text-primary);
  background: var(--bg-4);
}

.sentinel {
  height: 1px;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  /* Колонки не переопределяем — иначе density-picker (виден до 768px)
     перестаёт работать. Только чуть ужимаем карточки под планшет. */
  :root[data-density="comfortable"] .media-grid { --card-min: 200px; }
  :root[data-density="compact"]     .media-grid { --card-min: 160px; }
  :root[data-density="dense"]       .media-grid { --card-min: 120px; }

  .modal-prev {
    left: 12px;
  }

  .modal-next {
    right: 12px;
  }
}

@media (max-width: 600px) {
  .modal-nav {
    width: 42px;
    height: 42px;
  }

  .modal-nav svg {
    width: 20px;
    height: 20px;
  }

  .modal-prev {
    left: 8px;
  }

  .modal-next {
    right: 8px;
  }

  .modal-close,
  .modal-edit {
    width: 40px;
    height: 40px;
    top: 12px;
  }

  .modal-close {
    right: 12px;
  }

  .modal-edit {
    left: 12px;
  }

  .modal-close svg,
  .modal-edit svg {
    width: 20px;
    height: 20px;
  }

  /* Мобильные правки .modal-bottom-bar живут в components.css, потому что
     этот файл грузится ПОСЛЕ layout.css и переопределяет любое правило
     .modal-bottom-bar с одинаковой специфичностью — раньше media query
     здесь молча съедался. */
}

@media (max-width: 768px) {
  /* Mobile: navbar stays a top strip (logo + brand only), and the menu
     items dock as a fixed bottom tab bar. Bottom-nav is the standard
     pattern for media apps because it keeps thumbs on primary actions. */
  .navbar-menu {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    background: color-mix(in srgb, var(--bg-1) 88%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
    border-bottom: none;
    flex-direction: row;
    justify-content: space-around;
    padding: var(--space-2) var(--space-3) calc(var(--space-2) + env(safe-area-inset-bottom, 0));
    gap: var(--space-2);
    z-index: 1000;
  }

  .navbar-menu .navbar-link {
    flex: 1;
    flex-direction: column;
    gap: 0;
    height: 44px;
    padding: 0 4px;
    /* На мобильных подписи под иконками съедают место и мешают
       касаться. Убираем текст через font-size:0 — SVG с явным
       width/height атрибутами от этого не страдает. */
    font-size: 0;
    line-height: 0;
    justify-content: center;
    text-align: center;
    min-width: 0;
  }

  .navbar-menu .navbar-link .icon-md {
    width: 24px;
    height: 24px;
  }

  /* Профиль — четвёртая вкладка таб-бара. Меню всплывает над таб-баром:
     .navbar-profile здесь static, поэтому absolute-меню позиционируется
     от самого .navbar-menu (он position: fixed). */
  .navbar-profile {
    position: static;
    flex: 1;
    display: flex;
    margin-left: 0;
  }
  .navbar-profile-btn {
    width: 100%;
    border-radius: var(--radius-md);
    background: none;
  }
  .navbar-container {
    padding: 0 16px;
  }
  .profile-menu {
    top: auto;
    bottom: calc(100% + 8px);
    right: var(--space-3);
    width: min(260px, calc(100vw - 24px));
    animation-name: menuInUp;
  }
  .profile-menu-item {
    padding: 12px 10px;
    font-size: 15px;
  }

  @keyframes menuInUp {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .page-container {
    /* Extra bottom padding so the last row of cards isn't hidden under
       the fixed bottom-nav. */
    padding: 64px 16px calc(88px + env(safe-area-inset-bottom, 0));
  }

  .page-title {
    font-size: 24px;
  }

  /* Сетка почти от края до края: 4px вместо 16px отступа контейнера. */
  .media-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin: 0 -12px;
  }

  /* Одна прокручиваемая строка: «Фильтры · N» (шторка), сортировка и
     действия. Категории/подкатегории/возраст живут в шторке. */
  .filters {
    margin: 0 -16px 12px;
  }

  .filters-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 16px;
    scrollbar-width: none;
  }

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

  .filters-row > * {
    flex-shrink: 0;
  }

  .filters-sheet-btn {
    display: inline-flex;
  }

  #categoryFilter,
  #subcategoryFilter,
  #ageFilter,
  .filters-spacer {
    display: none;
  }

  .filter-chip,
  .filters .btn,
  .filters .filter-reset,
  .multi-select[data-variant="chip"] {
    height: 36px;
  }

  .filter-select,
  .filter-search-wrapper {
    width: 100%;
    min-width: 0;
  }

  .filter-search {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .card-favorite {
    width: 32px;
    height: 32px;
  }

  .card-play {
    width: 44px;
    height: 44px;
  }

  .page-title {
    font-size: 20px;
  }
}
