/* ============================================================
   dashboard-tiles-20261112.css — плитки-иконки на Главной
   ============================================================ */

/* Прокрутка на десктопе: приложение ставит html/body
   overscroll-behavior-y: none — в Chrome это отключает колесо мыши.
   Оставляем защиту от горизонтального свайпа, вертикаль возвращаем. */
html, body {
  overscroll-behavior-y: auto !important;
  overscroll-behavior-x: none !important;
}

/* И обёртка с contain тоже больше не мешает прокрутке. */
.overscroll-behavior-y-contain,
[class*="overscroll-behavior-y-contain"] {
  overscroll-behavior-y: auto !important;
}

.bf-tiles {
  margin: 8px 0 20px;
  opacity: 0;
  transition: opacity .2s ease;
}
.bf-tiles--ready { opacity: 1; }

.bf-tiles__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.bf-tiles__title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}
.bf-tiles__edit {
  border: 0;
  background: transparent;
  color: #7c3aed;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 10px;
}
.bf-tiles__edit:hover { background: rgba(124, 58, 237, .08); }

.bf-tiles__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.bf-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 8px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .28);
  background: #fff;
  text-decoration: none;
  color: #0f172a;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.bf-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, .45);
  box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
}
.bf-tile__icon {
  font-size: 30px;
  line-height: 1.1;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, .16));
}
.bf-tile__img {
  width: 46px;
  height: 46px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, .18));
}
.bf-tile__label {
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  font-weight: 500;
}

/* Тёмная тема */
html.dark .bf-tiles__title,
.dark .bf-tiles__title { color: #e5e7eb; }
html.dark .bf-tile,
.dark .bf-tile {
  background: rgba(30, 41, 59, .65);
  border-color: rgba(148, 163, 184, .22);
  color: #e5e7eb;
}
html.dark .bf-tile:hover,
.dark .bf-tile:hover {
  border-color: rgba(167, 139, 250, .55);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
}
html.dark .bf-tiles__edit,
.dark .bf-tiles__edit { color: #c4b5fd; }

/* Карточка настройки иконок */
.bf-tiles-settings {
  border: 1px solid rgba(148, 163, 184, .3);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: #fff;
}
html.dark .bf-tiles-settings,
.dark .bf-tiles-settings { background: rgba(30, 41, 59, .6); border-color: rgba(148, 163, 184, .22); }

.bf-tiles-settings h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.bf-tiles-settings p {
  margin: 0 0 12px;
  font-size: 13px;
  opacity: .72;
}
.bf-tiles-settings__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 14px;
}
.bf-tiles-settings__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.bf-tiles-settings__item input {
  width: 16px;
  height: 16px;
  accent-color: #7c3aed;
  cursor: pointer;
}

@media (max-width: 480px) {
  .bf-tiles__grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .bf-tile__icon { font-size: 26px; width: 38px; height: 38px; }
  .bf-tile__img { width: 40px; height: 40px; }
}

/* Плитки-«app icon» (наши три): иконка закрывает всю плитку, подпись поверх. */
.bf-tile--fill {
  position: relative;
  padding: 0;
  overflow: hidden;
  gap: 0;
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(148, 163, 184, .28);
  background: transparent;
}
.bf-tile--fill .bf-tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
  filter: none;
  display: block;
}
.bf-tile--fill .bf-tile__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 16px 6px 7px;
  margin: 0;
  font-size: 11.5px;
  line-height: 1.15;
  color: #0f172a;
  text-align: center;
  border-radius: 0 0 15px 15px;
  background: linear-gradient(to top, rgba(255, 255, 255, .94), rgba(255, 255, 255, 0));
}
.dark .bf-tile--fill .bf-tile__label {
  color: #f8fafc;
  background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
}

/* В ряду с «app icon»-плитками остальные центрируем по высоте. */
.bf-tile:not(.bf-tile--fill) {
  justify-content: center;
  min-height: 96px;
}

/* Тёмная тема, определённая оверлеем (класс .bf-dark на своей секции):
   не зависим от того, куда приложение вешает .dark. */
.bf-tiles.bf-dark .bf-tiles__title { color: #e5e7eb; }
.bf-tiles.bf-dark .bf-tiles__edit { color: #c4b5fd; }
.bf-tiles.bf-dark .bf-tile {
  background: rgba(30, 41, 59, .55);
  border-color: rgba(148, 163, 184, .22);
  color: #e5e7eb;
}
.bf-tiles.bf-dark .bf-tile:hover { background: rgba(51, 65, 85, .7); }
.bf-tiles.bf-dark .bf-tile--fill .bf-tile__label {
  color: #f8fafc;
  background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, 0));
}
.bf-tiles.bf-dark .bf-tile--fill { background: transparent; border-color: rgba(148, 163, 184, .22); }

/* --- ровная раскладка плиток по рядам (15.11.2026) -------------------
   Много плиток — два ряда поровну, мало — один ряд. Работает только через
   CSS-сетку контейнера: узлы не переносим, React не ломается. */
main .gt-gallery .gt-row.bf-tile-grid {
  display: grid;
  grid-template-columns: repeat(var(--bf-cols, 4), minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  height: auto;
  scroll-snap-type: none;
}
main .gt-gallery .gt-row.bf-tile-grid .gt-tile {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  flex: none !important;
  scroll-snap-align: none;
}
main .gt-gallery .gt-row.bf-tile-grid .gt-tile img.gt-tile-card,
main .gt-gallery .gt-row.bf-tile-grid .gt-tile .gt-tile-card {
  width: 100%;
  height: auto;
  max-height: 88px;
  object-fit: contain;
}
