/* ── TOKENS ──────────────────────────────── */
:root {
  /* Базовые цвета берем из темы Telegram для автоматической адаптации */
  --bg:      var(--tg-theme-bg-color,        #0a0a0a);
  --bg2:     var(--tg-theme-secondary-bg-color, #141414);
  --text:    var(--tg-theme-text-color,      #f5f5f5);
  --hint:    var(--tg-theme-hint-color,      #666);
  
  /* Главный акцентный цвет — насыщенный электрик-лайм */
  --acc:     #d4f53c; 
  --acc-t:   #0a0a0a; /* Темный текст на акцентном фоне для контраста */
  --acc-dim: rgba(212, 245, 60, 0.14); /* Полупрозрачный акцент */

  /* Второй акцент — cyan для рейтинга, онлайн-бейджей */
  --acc2:    #00e5ff;
  --acc2-dim: rgba(0, 229, 255, 0.12);

  /* Семантические цвета */
  --success: #22c55e;
  --danger:  #ff5a5a;
  --warn:    #ffb648;

  /* Тени */
  --shadow-card: 0 8px 32px rgba(0, 0, 0, .32);
  --shadow-btn:  0 4px 18px rgba(212, 245, 60, .20);
  
  --link:    var(--tg-theme-link-color,      #d4f53c);
  
  /* Разделители: чуть заметнее для чёткости уровней */
  --sep:     color-mix(in srgb, var(--text) 12%, transparent); 
  
  --r: 18px; --rsm: 12px;
  --ff-head: 'Inter', sans-serif;
  --ff-body: 'Manrope', sans-serif;

  /* AI program accents (default: dark theme tuned) */
  --prog-status-bg: var(--acc-dim);
  --prog-status-border: color-mix(in srgb, var(--acc) 30%, transparent);
  --prog-heading: var(--acc);
  --prog-ghost-border: color-mix(in srgb, var(--acc) 50%, transparent);
  --prog-ghost-text: var(--acc);

  /* Кнопка «Удалить» (danger action button) */
  --btn-danger-bg: var(--danger);
  --btn-danger-fg: #fff;
}

/* Светлая тема: акцент глубокий фиолетовый; ощущение спорта без Telegram-синего */
:root[data-tg-scheme="light"] {
  --acc:     #e03030;
  --acc-t:   #ffffff;
  --acc-dim: rgba(224, 48, 48, 0.12);
  --link:    #e03030;

  --acc2:    #0EA5E9;
  --acc2-dim: rgba(14, 165, 233, 0.12);

  --shadow-btn: 0 4px 18px rgba(224, 48, 48, .18);

  --prog-status-bg: color-mix(in srgb, var(--acc) 22%, var(--bg));
  --prog-status-border: color-mix(in srgb, var(--acc) 46%, var(--bg));
  --prog-heading: color-mix(in srgb, var(--acc) 82%, var(--text));
  --prog-ghost-border: color-mix(in srgb, var(--acc) 42%, var(--bg));
  --prog-ghost-text: color-mix(in srgb, var(--acc) 88%, var(--text));

  /* В светлой теме «Удалить»: карточечный фон + красный текст/иконка */
  --btn-danger-bg: var(--bg2);
  --btn-danger-fg: var(--danger);
}

/* color-scheme выставляется в JS из tg.colorScheme — это даёт браузеру
   правильную тему для системных виджетов (выпадающий список <select>,
   полосы прокрутки, autofill, дата-пикеры). На десктопном Telegram (Qt
   WebEngine) без этого <option> рисуется со светлым системным фоном —
   белый текст становится нечитаемым. */
:root { color-scheme: light dark; }

/* Явно красим выпадающий список <select> в нашу тему: даже если конкретная
   сборка WebView проигнорирует color-scheme, опции останутся читаемыми. */
select.finput option {
  background-color: var(--bg2);
  color: var(--text);
}
select.finput option:checked,
select.finput option:hover {
  background-color: var(--acc-dim);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin:0; padding:0; }

body {
  font-family: var(--ff-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: hidden;
  overscroll-behavior: none;
  height: 100dvh;
}

.page {
  max-width: 430px;
  margin: 0 auto;
  /* contentSafeAreaInset (WebApp 8.0) + env(safe-area) как подстраховка; снизу запас под MainButton */
  padding: max(var(--tg-content-safe-top, 0px), env(safe-area-inset-top, 0px))
    var(--tg-content-safe-right, max(0px, env(safe-area-inset-right, 0px)))
    calc(96px + var(--tg-content-safe-bottom, 0px))
    var(--tg-content-safe-left, max(0px, env(safe-area-inset-left, 0px)));
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  /* фиксированные кнопки/якоря не залезают под верхнюю системную полоску */
  scroll-padding-top: max(var(--tg-content-safe-top, 0px), env(safe-area-inset-top, 0px));
}

/* ── LOADING ─────────────────────────────── */
#screen_loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; flex-direction: column; gap: 16px;
}
.spin-ring {
  width: 44px; height: 44px;
  border: 3px solid var(--sep);
  border-top-color: var(--acc);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-label { font-size: 13px; color: var(--hint); font-family: var(--ff-body); }

/* ── HERO HEADER ─────────────────────────── */
.hero {
  padding: 28px 20px 20px;
  position: relative;
}
.hero-logo {
  font-family: var(--ff-head);
  font-size: 36px; font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}
.hero-logo span { color: var(--acc); }
.hero-sub {
  font-size: 13px; color: var(--hint);
  font-weight: 500;
}

/* ── SECTION LABEL ───────────────────────── */
.sec {
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--hint);
  padding: 0 20px; margin-bottom: 8px;
}

/* ── MENU ROWS (iOS grouped) ─────────────── */
.menu-group {
  background: var(--bg2);
  border-radius: var(--r);
  overflow: hidden;
  margin: 0 16px 10px;
  border: 1px solid var(--sep);
}
.mrow {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  cursor: pointer; border: none; background: none; width: 100%;
  text-align: left; color: var(--text);
  font-size: 15px; font-weight: 600;
  font-family: var(--ff-body);
  transition: background .15s;
  position: relative;
}
.mrow:active { background: color-mix(in srgb, var(--text) 4%, transparent); }
.mrow + .mrow::before {
  content: ''; position: absolute; top: 0; left: 56px; right: 0;
  height: 1px; background: var(--sep);
}
.mrow-ico {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--acc);
}
.mrow-ico svg {
  width: 18px; height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}
.mrow-lbl { flex: 1; min-width: 0; }
.mrow-meta { font-size: 12px; color: var(--hint); font-weight: 400; display: block; margin-top: 1px; }
#client_edit_meta_wishes {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mrow-chev { color: var(--hint); opacity: .4; font-size: 19px; margin-left: 4px; }

/* ── STAT STRIP ──────────────────────────── */
.stat-strip {
  display: flex; gap: 8px;
  margin: 0 16px 16px;
}
.stat-pill {
  flex: 1; border: 1px solid var(--sep);
  border-radius: var(--rsm); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
  border-left: 3px solid var(--acc);
  background: linear-gradient(135deg, var(--acc-dim) 0%, var(--bg2) 60%);
}
.stat-val { font-size: 19px; font-weight: 700; font-family: var(--ff-head); line-height: 1; color: var(--text); }
.stat-lbl { font-size: 11px; color: var(--hint); font-weight: 500; }

/* ── CARDS (forms, info) ─────────────────── */
.card {
  background: var(--bg2); border-radius: var(--r);
  border: 1px solid var(--sep);
  margin: 0 16px 10px; overflow: hidden;
}
.card-head {
  padding: 14px 18px 10px;
  font-family: var(--ff-head);
  font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--hint);
  border-bottom: 1px solid var(--sep);
}

/* Form rows inside card */
.frow {
  display: flex; flex-direction: column;
  padding: 12px 18px 10px;
  border-bottom: 1px solid var(--sep);
  position: relative;
}
.frow:last-child { border-bottom: none; }
.search-card { overflow: visible; }
.search-card .frow { overflow: visible; }

/* Анкета тренера: выпадающий список автодополнения не обрезать .card overflow */
.trainer-location-card { overflow: visible; }
.trainer-location-card .frow { overflow: visible; }

/* Баннер: в городе нет тренеров в каталоге */
.search-no-trainers-banner {
  margin: 14px 16px 10px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid color-mix(in srgb, var(--link) 35%, var(--sep));
  background: color-mix(in srgb, var(--link) 10%, var(--bg2));
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--link);
  font-family: var(--ff-body);
}

.flbl {
  font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--hint); margin-bottom: 6px;
}
.finput {
  width: 100%; border: none; outline: none;
  background: transparent;
  color: var(--text); font-size: 16px;
  font-family: var(--ff-body); font-weight: 500;
  padding: 0; line-height: 1.3;
  -webkit-appearance: none; appearance: none;
}
.finput::placeholder { color: var(--hint); opacity: .6; }
/* Подсветка инпута фирменным цветом при фокусе (если добавить border) */
.finput:focus { border-color: var(--acc); } 

textarea.finput {
  resize: none;
  min-height: 100px;
  line-height: 1.55;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
select.finput {
  /* Иконка селекта адаптируется под тему (используем SVG с fill currentColor) */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center;
  padding-right: 18px; cursor: pointer;
}
.fhint { font-size: 11px; color: var(--hint); margin-top: 5px; }

/* ── AUTOCOMPLETE ────────────────────────── */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; top: calc(100% + 6px); left: -18px; right: -18px;
  background: var(--bg2); /* Адаптивный фон */
  border: 1px solid var(--sep);
  border-radius: var(--rsm);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  z-index: 80;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.ac-item {
  padding: 13px 18px; font-size: 15px; font-weight: 500;
  color: var(--text); /* Адаптивный текст */
  cursor: pointer;
  border-bottom: 1px solid var(--sep);
  transition: background .12s;
}
.ac-item:last-child { border-bottom: none; }
.ac-item:active { background: color-mix(in srgb, var(--text) 5%, transparent); }

/* Мульти-страна в анкете тренера */
.countries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.country-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.country-input-wrap {
  flex: 1;
  min-width: 0;
}
.country-row .btn-remove-country {
  flex-shrink: 0;
  margin-top: 4px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--tg-theme-destructive-text-color, var(--danger));
  padding: 4px 8px;
}
.btn-add-country {
  margin-top: 6px;
  width: 100%;
  background: none;
  border: 1px dashed var(--sep);
  border-radius: var(--rsm);
  padding: 10px 12px;
  color: var(--link);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--ff-body), system-ui, sans-serif;
}

/* ── TRAINER CARD (Tinder) ───────────────── */
.t-wrap {
  padding: 0 16px;
}
.t-counter {
  text-align: center; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--hint); margin-bottom: 10px;
}
.t-card {
  background: var(--bg2); border-radius: 22px;
  overflow: hidden; border: 1px solid var(--sep);
  box-shadow: var(--shadow-card);
  user-select: none; -webkit-user-select: none;
}
.t-photo-box {
  position: relative; width: 100%;
  aspect-ratio: 4 / 5;            /* портретный дефолт под типичные фото тренеров */
  max-height: 70vh;               /* не больше 70% экрана на больших устройствах */
  background: #000;               /* чтобы blurred bg не «протекал» при загрузке */
  overflow: hidden;
  touch-action: pan-y;
  isolation: isolate;             /* свой стек для z-index с дочерними слоями */
}
/* Размытый фон тем же изображением — заполняет letterbox-полосы вокруг основного фото. */
.t-photo-blur {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(28px) brightness(.7);
  transform: scale(1.15);          /* чтобы края blur'а не подсвечивались */
  z-index: 0;
}
/* Основное фото показывается ЦЕЛИКОМ: ничего важного не обрезается. */
.t-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  z-index: 1;
}
.t-no-photo {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: .18;
  z-index: 1;
}
.t-no-photo svg { width: 72px; height: 72px; stroke-width: 1.5; color: var(--text); }
.t-no-photo.hidden { display: none; }
.t-dots {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; gap: 4px; z-index: 3;
}
.t-dot {
  flex: 1; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.3); transition: background .2s;
  max-width: 48px;
}
.t-dot.on { background: var(--acc); } /* Неоновые точки */
.t-nav-l, .t-nav-r {
  position: absolute; top: 0; bottom: 0; width: 42%; z-index: 4; cursor: pointer;
}
.t-nav-l { left: 0; } .t-nav-r { right: 0; }
.t-grad {
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 220px; z-index: 2;
  /* Градиент оставляем темным, чтобы белый текст на фото читался всегда */
  background: linear-gradient(transparent, rgba(0,0,0,.8));
}
.t-over {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px; z-index: 3;
}
.t-over-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.t-over-name {
  font-family: var(--ff-head); font-size: 28px; font-weight: 800;
  color: #fff; line-height: 1.1;
  text-shadow: 0 1px 8px rgba(0,0,0,.4);
}
.t-over-loc {
  font-size: 13px; color: rgba(255,255,255,.9); font-weight: 500;
}
.t-rating-ov {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--ff-head); font-weight: 700;
  font-size: 14px; color: #fff;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: 4px 10px; border-radius: 999px;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  white-space: nowrap;
}
.t-rating-ov-cnt { color: rgba(255,255,255,.75); font-weight: 500; margin-left: 2px; }
.t-rating-ov-new {
  display: inline-flex; align-items: center;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.32);
  color: #fff;
  border-radius: 999px; padding: 3px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.t-body { padding: 14px 20px 20px; }
.t-price {
  font-family: var(--ff-head); font-size: 16px; font-weight: 700;
  color: var(--text); margin-bottom: 10px; /* Цена теперь цвета текста, не кричит */
}
.t-rating-stars { letter-spacing: 1px; }
.t-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.t-tag {
  background: var(--acc-dim); border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 600; color: var(--text);
  letter-spacing: .03em;
}
.t-bio {
  --bio-scroll-thumb-top: 10px;
  --bio-scroll-thumb-height: 0px;
  font-size: 14px; line-height: 1.65;
  color: var(--text); /* Адаптивный текст описания */
  padding: 14px 18px 14px 14px;
  border: 1px solid var(--sep);
  border-top-color: color-mix(in srgb, var(--text) 18%, transparent);
  border-radius: var(--rsm);
  background:
    linear-gradient(color-mix(in srgb, var(--text) 40%, transparent), color-mix(in srgb, var(--text) 40%, transparent)) right 7px top var(--bio-scroll-thumb-top) / 4px var(--bio-scroll-thumb-height) no-repeat,
    linear-gradient(color-mix(in srgb, var(--text) 10%, transparent), color-mix(in srgb, var(--text) 10%, transparent)) right 7px top 10px / 4px calc(100% - 20px) no-repeat,
    linear-gradient(180deg, color-mix(in srgb, var(--bg2) 94%, var(--text) 6%), var(--bg2));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--text) 10%, transparent),
    inset 0 -16px 22px color-mix(in srgb, var(--bg) 42%, transparent);
  white-space: pre-wrap;
  max-height: 160px; overflow-y: scroll;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.t-bio:not(.is-scrollable) {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg2) 94%, var(--text) 6%), var(--bg2));
}
.t-bio::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* 2-button row */
.t-btns {
  display: flex; gap: 10px; padding: 18px 20px 4px;
}
.t-btn {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 10px; border-radius: 14px; border: none; cursor: pointer;
  font-family: var(--ff-body); font-size: 14px; font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  transition: transform .12s, opacity .12s, filter .12s;
}
.t-btn:active { transform: scale(.94); opacity: .85; }
@media (hover: hover) {
  .t-btn:hover { filter: brightness(1.08); }
}

.t-btn-chat {
  background: var(--acc); color: var(--acc-t);
  box-shadow: var(--shadow-btn);
}
.t-btn-skip {
  /* На темной теме светлая, на светлой темная — инверсия фона */
  background: var(--text);
  color: var(--bg);
  border: 1px solid color-mix(in srgb, var(--bg) 18%, transparent);
}

.t-prev-link {
  text-align: center; padding-bottom: 10px;
}
.t-prev-link button {
  background: none; border: none; color: var(--hint);
  font-size: 13px; font-family: var(--ff-body); font-weight: 500;
  cursor: pointer; padding: 8px 16px;
}

/* ── CONTACTS ────────────────────────────── */
.contact-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
.c-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; background: var(--bg2);
  border-radius: var(--r); border: 1px solid var(--sep);
}
.c-ava {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--acc-dim);
  border: 1px solid color-mix(in srgb, var(--acc) 30%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-head); font-size: 19px; font-weight: 800;
  color: var(--text); flex-shrink: 0;
}
.c-meta { flex: 1; min-width: 0; }
.c-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.c-role { font-size: 12px; color: var(--hint); margin-top: 1px; }
.c-btn {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--sep);
  border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 700;
  font-family: var(--ff-body); cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.c-btn:active { background: color-mix(in srgb, var(--text) 5%, transparent); }

/* ── PROFILE VIEW ────────────────────────── */
.pv-photo-box {
  position: relative; width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 60vh;
  background: #000;
  overflow: hidden;
  border-radius: 0 0 22px 22px;
  touch-action: pan-y;
  isolation: isolate;
}
.pv-photo-blur {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(28px) brightness(.7);
  transform: scale(1.15);
  z-index: 0;
}
.pv-photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  z-index: 1;
}
.pv-grad {
  position: absolute; bottom: 0; left: 0; right: 0; height: 160px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); z-index: 2;
}
.pv-over {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px; z-index: 3;
}
.pv-name {
  font-family: var(--ff-head); font-size: 26px; font-weight: 800;
  color: #fff; line-height: 1.1;
}
.pv-dots {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; gap: 4px; z-index: 3;
}
.pv-nav-l, .pv-nav-r {
  position: absolute; top: 0; bottom: 0; width: 42%; z-index: 4; cursor: pointer;
}
.pv-nav-l { left: 0; } .pv-nav-r { right: 0; }
.pv-info { padding: 18px; }
.pv-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--sep); gap: 12px;
}
.pv-row:last-child { border-bottom: none; }
.pv-lbl { font-size: 12px; color: var(--hint); font-weight: 600; flex-shrink: 0; display: flex; align-items: center; gap: 5px; }
.pv-lbl svg { width: 13px; height: 13px; stroke-width: 2; flex-shrink: 0; color: var(--acc); }
.pv-val { font-size: 14px; font-weight: 700; text-align: right; color: var(--text); }
.pv-bio {
  font-size: 14px; line-height: 1.65;
  padding: 14px 0 0; color: var(--text); /* Адаптивный текст в профиле */
  white-space: pre-wrap;
}
.pv-cta {
  margin: 14px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pv-no-photo {
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 64px; opacity: .1;
}

/* ── ACTION BUTTON ───────────────────────── */
.action-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px;
  background: var(--acc); color: var(--acc-t);
  border: none; border-radius: var(--rsm);
  font-size: 15px; font-weight: 700; font-family: var(--ff-body);
  letter-spacing: .02em;
  box-shadow: var(--shadow-btn);
  cursor: pointer; transition: opacity .15s, transform .12s, filter .12s;
}
.action-btn:active { opacity: .88; transform: scale(.98); }
@media (hover: hover) {
  .action-btn:hover { filter: brightness(1.07); }
}

.action-btn-danger {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-fg);
  box-shadow: none;
}

.action-btn-danger i,
.action-btn-danger svg {
  color: var(--btn-danger-fg);
  stroke: currentColor;
}

@media (hover: hover) {
  .action-btn-danger:hover { filter: brightness(1.06); }
}

/* ── PAGE TITLES ─────────────────────────── */
.page-hd {
  padding: 20px 20px 14px;
}
.page-hd h1 {
  font-family: var(--ff-head); font-size: 28px; font-weight: 800;
  line-height: 1.05; letter-spacing: -.5px; margin-bottom: 3px; color: var(--text);
}
.page-hd p { font-size: 13px; color: var(--hint); font-weight: 500; }

/* ── TOAST ───────────────────────────────── */
#toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg); /* Инвертированный контраст */
  padding: 10px 20px; border-radius: 20px;
  font-size: 13px; font-weight: 700;
  font-family: var(--ff-body);
  pointer-events: none; opacity: 0;
  transition: all .24s; white-space: nowrap; z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── EDGE BACK HINT ──────────────────────── */
.edge-back-hint {
  --edge-back-progress: 0;
  position: fixed;
  top: 50%;
  left: max(var(--tg-content-safe-left, 0px), env(safe-area-inset-left, 0px));
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: calc(24px + 62px * var(--edge-back-progress));
  height: 72px;
  padding: 0 10px 0 5px;
  border: 1px solid color-mix(in srgb, var(--acc) 28%, var(--sep));
  border-left: 3px solid var(--acc);
  border-radius: 0 999px 999px 0;
  background: color-mix(in srgb, var(--bg2) 84%, transparent);
  color: var(--text);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--bg) 36%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translate3d(calc(-18px + 22px * var(--edge-back-progress)), -50%, 0);
  transition:
    opacity .22s ease,
    transform .22s cubic-bezier(.4, 0, .2, 1),
    width .22s cubic-bezier(.4, 0, .2, 1);
}
.edge-back-hint.is-visible {
  opacity: .38;
}
.edge-back-hint.is-peeking {
  opacity: .72;
  transform: translate3d(0, -50%, 0);
}
.edge-back-hint.is-dragging {
  opacity: 1;
  transition: opacity .12s ease;
}
.edge-back-hint__chev {
  flex: 0 0 auto;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--acc);
  transform: translateY(-1px);
}
.edge-back-hint__label {
  min-width: 48px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--ff-body);
  line-height: 1;
  opacity: var(--edge-back-progress);
  transform: translateX(calc(-8px + 8px * var(--edge-back-progress)));
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .edge-back-hint {
    transition: opacity .12s ease;
  }
  .edge-back-hint__label {
    transform: none;
  }
}

/* ── EMPTY / LOADER ──────────────────────── */
.loader {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px;
  color: var(--hint); font-size: 13px;
}
.empty {
  text-align: center; padding: 60px 20px; color: var(--hint);
}
.empty-ico { font-size: 48px; margin-bottom: 10px; opacity: .4; }
.empty-txt { font-size: 15px; font-weight: 500; }

/* ── UTILS ───────────────────────────────── */
.hidden { display: none !important; }
@keyframes fadeUp { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }
.fade-up { animation: fadeUp .3s cubic-bezier(.4,0,.2,1) both; }

/* ── PAGE TRANSITIONS ────────────────────── */
@keyframes slideIn  { from { opacity:0; transform:translateX(32px); } to { opacity:1; transform:none; } }
@keyframes slideOut { from { opacity:0; transform:translateX(-32px); } to { opacity:1; transform:none; } }
.slide-in  { animation: slideIn  .26s cubic-bezier(.4,0,.2,1) both; }
.slide-out { animation: slideOut .26s cubic-bezier(.4,0,.2,1) both; }

/* ── AI PROGRAM ──────────────────────────── */
.prog-loading {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 60px 20px; text-align: center;
}
.prog-loading .spin-ring { width: 38px; height: 38px; }
.prog-loading-title { font-size: 16px; font-weight: 700; color: var(--text); }
.prog-loading-sub   { font-size: 13px; color: var(--hint); max-width: 280px; line-height: 1.45; }
.prog-status {
  margin: 14px 18px 0; padding: 12px 14px;
  background: var(--prog-status-bg);
  border: 1px solid var(--prog-status-border);
  border-radius: var(--rsm); font-size: 13px; color: var(--text); line-height: 1.4;
}
.prog-status.is-warn {
  background: color-mix(in srgb, #ffb648 18%, transparent);
  border-color: color-mix(in srgb, #ffb648 50%, transparent);
}
.prog-status.is-error {
  background: color-mix(in srgb, #ff5a5a 14%, transparent);
  border-color: color-mix(in srgb, #ff5a5a 45%, transparent);
}
.prog-content {
  margin: 0 18px 20px; padding: 18px 20px;
  background: var(--bg2); border: 1px solid var(--sep);
  border-radius: var(--r);
  font-size: 14.5px; line-height: 1.55; color: var(--text);
  white-space: pre-wrap; word-wrap: break-word;
  max-height: min(70vh, 1200px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.prog-content strong {
  display: block; margin-top: 14px; margin-bottom: 4px;
  font-size: 15px; color: var(--prog-heading);
  font-weight: 700;
}
.prog-content strong:first-child { margin-top: 0; }
.prog-actions {
  margin: 8px 18px 0; padding: 0 0 10px;
}
.prog-cta-ghost {
  display: block; width: 100%;
  padding: 12px 18px; background: transparent;
  color: var(--prog-ghost-text); border: 1px solid var(--prog-ghost-border);
  border-radius: 14px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.prog-cta-ghost:active { opacity: .9; transform: scale(.99); }
.prog-empty {
  text-align: center; padding: 48px 24px; color: var(--hint);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.prog-empty-ico { opacity: .5; }
.prog-empty-ico svg { width: 52px; height: 52px; stroke-width: 1.5; }
.prog-empty-title { font-size: 17px; font-weight: 700; color: var(--text); }
.prog-empty-sub   { font-size: 14px; line-height: 1.5; max-width: 300px; }
.prog-cta {
  display: inline-block; margin-top: 6px;
  padding: 12px 22px; background: var(--acc); color: var(--acc-t);
  border-radius: 14px; font-size: 14px; font-weight: 700;
  letter-spacing: .02em;
  border: none; cursor: pointer;
  box-shadow: var(--shadow-btn);
}
.prog-cta:active { transform: scale(.97); }
