/*
  Стили Telegram Mini App «Каталог услуг бьюти-мастера».

  Цветовые переменные --tg-* по умолчанию заданы под светлую тему Telegram.
  Если приложение открыто внутри настоящего Telegram — js/telegram.js подставит
  РЕАЛЬНЫЕ цвета темы пользователя поверх этих переменных (через style.setProperty).
  Если Telegram недоступен (обычный браузер) — работают значения по умолчанию
  и медиа-запрос prefers-color-scheme ниже.
*/

:root {
  --tg-bg: #ffffff;
  --tg-secondary-bg: #f4f4f5;
  --tg-text: #111111;
  --tg-hint: #8e8e93;
  --tg-button-text: #ffffff;
  --tg-border: rgba(0, 0, 0, 0.06);

  /* Фирменный акцент — фиксирован по ТЗ, не зависит от темы Telegram */
  --tg-accent: #2AABEE;
  --tg-accent-pressed: #1f8fc9;
  --tg-danger: #e64646;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Тёмная тема по системным настройкам — работает, когда открыто ВНЕ Telegram
   (внутри Telegram тему подставляет JS из реальных ThemeParams) */
@media (prefers-color-scheme: dark) {
  :root {
    --tg-bg: #17212b;
    --tg-secondary-bg: #1f2c38;
    --tg-text: #f0f0f0;
    --tg-hint: #7d8b99;
    --tg-border: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

/* Страховка: элементы с атрибутом hidden должны быть скрыты всегда,
   даже если их класс (например .modal-overlay, .lightbox) задаёт свой display */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--tg-bg);
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, textarea, input {
  font-family: inherit;
}

/* Контейнер приложения — ограничен по ширине под мобильный экран (320–430px),
   на широких экранах (десктоп-тестирование) просто центрируется */
#app {
  position: relative;
  max-width: 430px;
  min-width: 320px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: var(--tg-bg);
}

/* ===================== ЭКРАНЫ И ПЕРЕХОДЫ ===================== */

.screen {
  position: absolute;
  inset: 0;
  padding: calc(16px + var(--safe-top)) 16px calc(110px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateX(100%);
  transition: transform 0.28s ease, opacity 0.28s ease;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }

.screen.active {
  position: relative;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  z-index: 2;
}

/* Экраны нижнего уровня (под нижней панелью вкладок) — им не нужен запас снизу
   под MainButton (там его нет), нужен запас под саму панель вкладок */
.screen.screen--tabbar {
  padding-bottom: calc(78px + var(--safe-bottom));
}

/* Направление "назад": уходящий экран уезжает вправо, новый выезжает слева */
.screen.leaving-back { transform: translateX(100%); opacity: 0; }
.screen.entering-back { transform: translateX(-100%); }

.screen-title {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 12px;
}
.screen-title--center { text-align: center; }

.section-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--tg-hint);
  margin: 20px 2px 10px;
}

.description {
  color: var(--tg-text);
  opacity: 0.85;
  font-size: 15px;
  margin: 0 0 4px;
}

.hint-text {
  color: var(--tg-hint);
  font-size: 14px;
  margin: 0 0 16px;
}

.empty-hint {
  color: var(--tg-hint);
  text-align: center;
  padding: 40px 12px;
  font-size: 14px;
}

/* ===================== ШАПКА КАТАЛОГА ===================== */

.master-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 4px;
}
.master-header__info { flex: 1; min-width: 0; }
.master-header__name {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.master-header__specialty {
  font-size: 14px;
  color: var(--tg-hint);
  margin: 2px 0 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.icon-btn:active { transform: scale(0.92); opacity: 0.8; }

/* ===================== АВАТАРЫ (плейсхолдер вместо фото) ===================== */

.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--avatar-gradient, linear-gradient(135deg, #667eea, #764ba2));
}
.avatar--sm { width: 40px; height: 40px; font-size: 14px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.avatar--xl { width: 88px; height: 88px; font-size: 28px; margin: 0 auto 12px; }

/* ===================== ЧИПЫ КАТЕГОРИЙ ===================== */

.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 4px 0;
  margin-bottom: 4px;
  scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.chip:active { transform: scale(0.95); }
.chip.active { background: var(--tg-accent); color: #fff; }

/* ===================== КАРТОЧКИ УСЛУГ ===================== */

.services-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  background: var(--tg-secondary-bg);
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: left;
  transition: transform 0.12s ease;
}
.service-card:active { transform: scale(0.98); }

.service-card__photo {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--photo-gradient, linear-gradient(135deg, #667eea, #764ba2));
}

.service-card__body { flex: 1; min-width: 0; }
.service-card__name {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-card__meta {
  font-size: 14px;
  color: var(--tg-hint);
  display: flex;
  gap: 8px;
}
.service-card__price {
  font-weight: 700;
  color: var(--tg-accent);
  font-size: 15px;
  flex-shrink: 0;
}

.services-list--compact .service-card { padding: 10px 12px; }
.services-list--compact .service-card__photo { width: 44px; height: 44px; font-size: 20px; }

/* ===================== ЭКРАН УСЛУГИ ===================== */

.back-to-catalog {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  color: var(--tg-accent);
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 4px;
  margin: 0 0 4px -4px;
  cursor: pointer;
}
.back-to-catalog:active { opacity: 0.6; }

.photo-banner {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: var(--photo-gradient, linear-gradient(135deg, #667eea, #764ba2));
  margin-bottom: 16px;
  box-shadow: var(--shadow-soft);
}

.price-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.price-tag {
  font-size: 20px;
  font-weight: 700;
  color: var(--tg-accent);
}
.duration-tag {
  font-size: 14px;
  color: var(--tg-hint);
  background: var(--tg-secondary-bg);
  padding: 4px 10px;
  border-radius: 999px;
}

.mini-master-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: 16px;
  border-radius: var(--radius-lg);
  background: var(--tg-secondary-bg);
  border: none;
  width: 100%;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.mini-master-card:active { transform: scale(0.98); }
.mini-master-card__text { flex: 1; text-align: left; }
.mini-master-card__name { font-weight: 600; font-size: 14px; }
.mini-master-card__rating { font-size: 14px; color: var(--tg-hint); margin-top: 2px; }
.chevron { color: var(--tg-hint); flex-shrink: 0; }

/* ===================== ПРОФИЛЬ МАСТЕРА ===================== */

.about-share-btn { margin-top: 24px; }

.master-profile { text-align: center; padding-top: 4px; }
.master-profile__specialty { color: var(--tg-hint); margin: 0 0 8px; font-size: 14px; }

.rating-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  color: var(--tg-hint);
  margin-bottom: 8px;
}
.rating-row__stars { color: #f5a623; letter-spacing: 1px; }

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.portfolio-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--photo-gradient, linear-gradient(135deg, #667eea, #764ba2));
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.portfolio-item:active { transform: scale(0.94); }

/* ===================== ВЫБОР ДАТЫ И ВРЕМЕНИ ===================== */

.date-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px 0;
  scrollbar-width: none;
}
.date-scroll::-webkit-scrollbar { display: none; }

.date-chip {
  flex-shrink: 0;
  width: 56px;
  min-height: 68px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.date-chip:active { transform: scale(0.94); }
.date-chip.active { background: var(--tg-accent); color: #fff; }
.date-chip__weekday { font-size: 14px; opacity: 0.75; text-transform: uppercase; }
.date-chip__day { font-size: 18px; font-weight: 700; }

.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slot-btn {
  min-height: 44px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.slot-btn:active { transform: scale(0.93); }
.slot-btn.active { background: var(--tg-accent); color: #fff; }

/* ===================== ПОДТВЕРЖДЕНИЕ ЗАПИСИ ===================== */

.summary-card {
  background: var(--tg-secondary-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}
.summary-card__row { display: flex; align-items: center; gap: 12px; }
.summary-card__master { font-weight: 700; font-size: 15px; }
.summary-card__specialty { font-size: 14px; color: var(--tg-hint); }
.summary-card__divider {
  height: 1px;
  background: var(--tg-border);
  margin: 12px 0;
}
.summary-card__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 14px;
  color: var(--tg-hint);
}
.summary-card__item strong { color: var(--tg-text); font-size: 14px; font-weight: 600; }
.summary-card__item--total strong { color: var(--tg-accent); font-size: 18px; }

.comment-label {
  display: block;
  font-size: 14px;
  color: var(--tg-hint);
  margin-bottom: 6px;
}
.comment-input {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--tg-border);
  background: var(--tg-secondary-bg);
  color: var(--tg-text);
  padding: 12px;
  font-size: 15px;
  resize: none;
  margin-bottom: 12px;
}
.comment-input:focus { outline: 2px solid var(--tg-accent); }

.link-btn {
  display: block;
  margin: 0 auto;
  background: none;
  border: none;
  color: var(--tg-accent);
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
}
.link-btn:active { opacity: 0.6; }

/* ===================== ЭКРАН УСПЕХА ===================== */

.success-block {
  text-align: center;
  padding-top: 15%;
}
.success-icon { margin-bottom: 16px; animation: pop-in 0.4s ease; }
@keyframes pop-in {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.success-text { font-size: 16px; margin: 0 auto 8px; max-width: 300px; }
.success-hint { font-size: 14px; color: var(--tg-hint); max-width: 260px; margin: 0 auto; }

/* ===================== МОИ ЗАПИСИ ===================== */

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--tg-secondary-bg);
  padding: 4px;
  border-radius: var(--radius-md);
}
.tab {
  flex: 1;
  min-height: 40px;
  border: none;
  background: transparent;
  color: var(--tg-hint);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab.active { background: var(--tg-bg); color: var(--tg-text); box-shadow: var(--shadow-soft); }

.bookings-list { display: flex; flex-direction: column; gap: 10px; }

.booking-card {
  background: var(--tg-secondary-bg);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.booking-card__top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.booking-card__service { font-weight: 700; font-size: 15px; }
.booking-card__when { font-size: 14px; color: var(--tg-hint); margin-top: 2px; }
.booking-card__status {
  font-size: 14px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.booking-card__status--upcoming { background: rgba(42, 171, 238, 0.15); color: var(--tg-accent); }
.booking-card__status--done { background: rgba(120, 120, 128, 0.15); color: var(--tg-hint); }
.booking-card__status--cancelled { background: rgba(230, 70, 70, 0.12); color: var(--tg-danger); }

.booking-card__actions { display: flex; gap: 8px; margin-top: 10px; }
.booking-card__btn {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.booking-card__btn:active { transform: scale(0.96); }
.booking-card__btn--reschedule { background: var(--tg-bg); color: var(--tg-text); }
.booking-card__btn--cancel { background: rgba(230, 70, 70, 0.1); color: var(--tg-danger); }

/* ===================== ЛАЙТБОКС ФОТО ПОРТФОЛИО ===================== */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 0.2s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.lightbox__photo {
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
}
.lightbox__caption { color: #fff; margin-top: 16px; font-size: 14px; text-align: center; }
.lightbox__close {
  position: absolute;
  top: calc(20px + var(--safe-top));
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

/* ===================== МОДАЛЬНОЕ ПОДТВЕРЖДЕНИЕ ===================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s ease;
}
.modal-card {
  width: 100%;
  max-width: 430px;
  background: var(--tg-bg);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom));
}
.modal-text { font-size: 15px; text-align: center; margin: 0 0 18px; }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-btn {
  min-height: 48px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.modal-btn:active { transform: scale(0.97); }
.modal-btn--ghost { background: var(--tg-secondary-bg); color: var(--tg-text); }
.modal-btn--danger { background: var(--tg-danger); color: #fff; }

/* ===================== ЭКРАН-ОФФЕР (при первом открытии) ===================== */

.offer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 80; /* поверх лайтбокса (50) и модалки отмены (60) — оффер главнее всего */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s ease;
}

.offer-card {
  width: 100%;
  max-width: 340px;
  background: var(--tg-bg);
  border-radius: 24px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: offer-pop 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}
@keyframes offer-pop {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.offer-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 12px;
}

.offer-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
}

.offer-subtitle {
  font-size: 15px;
  color: var(--tg-hint);
  margin: 0 0 18px;
}

.offer-bullets {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.offer-bullets li {
  font-size: 14px;
  padding-left: 20px;
  position: relative;
}
.offer-bullets li::before {
  content: "•";
  color: var(--tg-accent);
  font-weight: 700;
  position: absolute;
  left: 4px;
}

.offer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  background: var(--tg-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
}
.offer-btn:active { transform: scale(0.97); background: var(--tg-accent-pressed); }

.offer-skip {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--tg-hint);
  font-size: 14px;
  cursor: pointer;
}
.offer-skip:active { opacity: 0.6; }

/* ===================== ТОСТ ===================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 70;
  animation: fade-in 0.2s ease;
  max-width: 85%;
  text-align: center;
}

/* ===================== ФОЛБЭК-КНОПКИ (ТОЛЬКО ВНЕ TELEGRAM) ===================== */

.fallback-main {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + var(--safe-bottom));
  max-width: 398px;
  margin: 0 auto;
  min-height: 50px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--tg-accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  z-index: 40;
  box-shadow: 0 6px 20px rgba(42, 171, 238, 0.35);
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
}
.fallback-main:active { transform: scale(0.97); background: var(--tg-accent-pressed); }
.fallback-main[disabled] { opacity: 0.4; pointer-events: none; }

.fallback-back {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(120, 120, 128, 0.16);
  backdrop-filter: blur(6px);
  color: var(--tg-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 41;
  transition: transform 0.12s ease;
}
.fallback-back:active { transform: scale(0.9); }

/* Пока показана фолбэк-кнопка "назад" (только вне Telegram) — сдвигаем контент экрана вниз,
   чтобы круглая кнопка не перекрывала заголовок в левом верхнем углу */
#app.fallback-back-visible .screen.active {
  padding-top: calc(64px + var(--safe-top));
}

/* Общее правило доступности: у всех интерактивных элементов минимум 44px по высоте,
   кроме дат/чипов, где ширина тапа компенсируется отступами между элементами */
button { min-height: 44px; }

/* ===================== НИЖНЯЯ ПАНЕЛЬ ВКЛАДОК ===================== */
/* Цвета берутся из тех же переменных темы Telegram, что и весь остальной интерфейс
   (--tg-bg/--tg-text/--tg-hint/--tg-border), поэтому тёмная тема работает автоматически.
   Активная вкладка подсвечивается фирменным акцентом --tg-accent. */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  background: var(--tg-bg);
  border-top: 1px solid var(--tg-border);
  padding-bottom: var(--safe-bottom);
  z-index: 35;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 62px;
  padding: 4px 2px;
  border: none;
  background: none;
  color: var(--tg-hint);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.12s ease;
}
.tab-item:active { transform: scale(0.94); }
.tab-item.active { color: var(--tg-accent); font-weight: 600; }
.tab-item span { line-height: 1.15; }
