:root {
  --bg0: #06080e;
  --bg1: #0b0f18;
  --text: #f7f8fc;
  --muted: rgba(247, 248, 252, 0.58);
  --soft: rgba(247, 248, 252, 0.46);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #4f8cff;
  --accent-2: #8eb6ff;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 22px;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.42);
  --font-display: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* —— Палитра: единственный источник значений для новых компонентов ——
     Значения заданы клиентом и совпадают с нынешней тёмной темой BillPing. */
  --bp-bg: #090e17;
  --bp-text: #f5f5fa;
  --bp-text-2: #989ba5;
  --bp-accent: #9bc5ff;
  --bp-primary: linear-gradient(90deg, #8cc1ff 0%, #2160ed 100%);
  --bp-premium: linear-gradient(90deg, #ffe98b 0%, #ffc329 100%);
  --bp-card: linear-gradient(165deg, #272b37 0%, #151924 100%);
  --bp-card-line: rgba(255, 255, 255, 0.12);

  /* —— Геометрия каркаса (CSS px) ——
     Считается один раз здесь и больше нигде: любая копия высоты шапки
     рано или поздно превращается в мёртвую полосу под навигацией. */
  --bp-shell-pad: 8px;          /* отступ над своей шапкой после safe-area */
  --bp-header-h: 48px;          /* строка логотип · Premium · кнопки */
  --bp-header-gap: 8px;         /* шапка → навигация */
  --bp-nav-h: 52px;             /* панель навигации */
  /* навигация → первый блок страницы. 16 px — эталон из Figma: контент
     начинается сразу под островком навигации, без мёртвой полосы.
     Предел 12–20 px держим именно здесь, а не у каждого экрана. */
  --bp-nav-to-content: 16px;
  --bp-radius-card: 20px;
  --bp-radius-field: 14px;
  --bp-tap: 44px;               /* минимальная область нажатия */

  /* JS (syncTopChrome) кладёт сюда верхний системный отступ Telegram:
     contentSafeArea (кнопки/меню Telegram) поверх safeArea, но НЕ сумму. */
  --shell-top: 0px;
  /* Высота клавиатуры (visualViewport). Нижняя панель шторки формы
     упирается в неё, чтобы кнопка не уходила за клавиатуру. */
  --kb-h: 0px;
  /* Расчётная высота шапки «по константам». Это справочное число для JS и
     для запасного пути ниже; в обычной раскладке .page им НЕ пользуется —
     там нужна РЕАЛЬНАЯ высота (--shell-h). */
  --bp-shell-h: calc(var(--bp-shell-pad) + var(--bp-header-h) + var(--bp-header-gap) + var(--bp-nav-h));
  /* Реальная высота приклеенной шапки от верхней кромки окна до низа
     навигации. Сюда входит --shell-top (Telegram safe area), собственные
     поля шапки, строка бренда и панель навигации — поэтому на разных
     экранах и в разных клиентах Telegram она разная. Кладёт syncTopChrome();
     до его первого вызова работает расчёт по константам. */
  --shell-h: calc(var(--bp-shell-h) + var(--shell-top));

  /* Единый шаг отступов проекта. Всё, что раньше было 12/14/16/44 вразнобой,
     считается от --g: один ритм сверху, снизу и между блоками. */
  --g: 10px;
  --gap-block: var(--g);
  --gap-edge: calc(var(--g) + 6px);
  --gap-after-bar: var(--g);
  --radius-card: 22px;

  /* —— Горизонтальные поля страницы: 24 px от 390 px, 16 px на узких —— */
  --bp-page-x: 24px;
}
@media (max-width: 389px) { :root { --bp-page-x: 16px; } }

* { box-sizing: border-box; }
html {
  height: 100%;
  width: 100%;
  background: #0a0e16;
}
html, body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}
body {
  width: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 70% 42% at 50% -10%, rgba(79,140,255,.24), transparent 64%),
    radial-gradient(ellipse 42% 30% at 100% 18%, rgba(142,182,255,.10), transparent 58%),
    radial-gradient(ellipse 40% 28% at 0% 72%, rgba(120,140,180,.07), transparent 55%),
    linear-gradient(180deg, #0c1220 0%, #080b13 42%, #0a0e16 100%);
  /* fixed breaks Telegram iOS WebView (blank / frozen layer) */
  background-attachment: scroll;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img { display: block; max-width: 100%; }
a { color: var(--accent-2); text-decoration: none; }

.ambient {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.mesh {
  position: absolute; inset: -20% -5%;
  background:
    radial-gradient(ellipse 70% 42% at 50% -10%, rgba(79,140,255,.24), transparent 64%),
    radial-gradient(ellipse 42% 30% at 100% 18%, rgba(142,182,255,.10), transparent 58%),
    radial-gradient(ellipse 40% 28% at 0% 72%, rgba(120,140,180,.07), transparent 55%),
    linear-gradient(180deg, #0c1220 0%, #080b13 42%, #0a0e16 100%);
  animation: meshDrift 22s ease-in-out infinite alternate;
}
.noise {
  position: absolute; inset: 0; opacity: .028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.orb { display: none; }
@keyframes meshDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(0, -18px, 0) scale(1.03); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}
@keyframes shimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.app {
  position: relative; z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh;
  padding:
    calc(12px + var(--safe-t))
    max(12px, env(safe-area-inset-right, 0px))
    calc(28px + var(--safe-b))
    max(12px, env(safe-area-inset-left, 0px));
}
#view-main.app, #view-main {
  padding-top: 0;
}
#view-main.active {
  padding-top: 0;
}
#view-main.active {
  /* Верхний отступ держит .top-shell: он sticky и занимает своё место в потоке.
     Раньше ту же высоту резервировал ещё и .page — отсюда мёртвая полоса. */
  padding:
    0
    0
    calc(24px + var(--safe-b));
  width: 100%;
}
#view-main .page,
#view-main .legal-foot {
  /* Шапка sticky — её высоту уже занимает она сама в потоке. Резервировать
     --shell-h второй раз нельзя: именно это и давало мёртвую полосу в 130+
     px под навигацией. Единственный отступ сверху — ровно 16 px (Figma). */
  padding:
    var(--bp-nav-to-content, 16px)
    var(--bp-page-x, 24px)
    0
    var(--bp-page-x, 24px);
}

/* Анимация входа проигрывается один раз и снимается сама: с fill-mode both
   у .view оставался transform, а трансформированный предок превращает
   position: fixed внутри (шапку .top-shell) в «якорь» к странице — вместе
   с контентом уезжала шапка и схлопывался --top-offset. */
.view { display: none; }
/* Анимация только у того экрана, который JS только что показал (.view-in).
   Постоянная animation на .view держала transform на.предке и первый блок
   страницы мерился вместе со сдвигом — зазор под навигацией «плавал». */
.view.active { display: block; }
#view-main.active.view-in { animation: rise .4s var(--ease) 1; }
.view.center {
  padding-top: 0;
  min-height: calc(100vh - 40px);
  min-height: calc(100dvh - 40px);
  min-height: calc(100svh - 40px);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.view.center.active { display: flex; }

.brand-badge.breathe { animation: breathe 3s ease-in-out infinite; }
.topbar img,
.onboard-mascot img {
  background: transparent !important;
}
.onboard-mascot {
  background: transparent !important;
  border: none !important;
}
.brand-title, .brand-word {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em;
}
.brand-title { font-size: 2rem; margin: 8px 0 0; }
.brand-word { font-size: 1.1rem; }
.boot-sub { margin: 0; color: var(--muted); }

/* ============================================================
   Экран загрузки: только логотип и «Загрузка…», больше ничего.
   ============================================================ */
.boot {
  /* Шапка и навигация в потоке — на время загрузки их просто нет в DOM-потоке
     видимых элементов: #view-boot.active перекрывает всё своим фоном. */
  position: fixed;
  inset: 0;
  z-index: 60;
  grid-auto-rows: min-content;
  align-content: center;
  justify-items: center;
  gap: 0;
  padding:
    calc(var(--safe-t) + 24px)
    24px
    calc(var(--safe-b) + 24px);
  background: var(--bp-bg);
}
.boot.active { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.boot-logo img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
}
.boot-label {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--bp-text-2);
}
.boot-fail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  margin-top: 16px;
  text-align: center;
}
.boot-fail[hidden] { display: none; }
.boot-fail-text {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--bp-text-2);
}
.boot-retry { min-height: 44px; padding: 0 20px; border-radius: var(--bp-radius-field); }

/* —— Шапка: 8 px над строкой, строка 48 px, зазор 8 px, навигация 52 px ——
   Все числа приходят из :root. Один расчёт — одна высота (--shell-h): её же
   читает .page как padding-top. */
.top-shell {
  /* Шапка идёт в потоке и приклеена к верху: под неё не нужно резервировать
     отдельный отступ — место в потоке она уже занимает сама. Раньше был
     position: fixed с --top-offset в padding .page, и любая ошибка в одном
     из двух чисел превращалась в мёртвую полосу под навигацией. */
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  padding:
    calc(var(--bp-shell-pad) + var(--shell-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    /* Нижнего поля у шапки нет: зазор «островок навигации → контент» задаёт
       ровно один источник — --bp-nav-to-content в padding .page. Раньше тут
       было ещё 8 px, и реальный просвет получался 24 px вместо 16. */
    0
    max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(180deg, rgba(10,14,22,.98) 0%, rgba(10,14,22,.94) 72%, rgba(10,14,22,0));
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.top-shell-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.top-shell .brand-top,
.top-shell .tabbar { position: relative; z-index: 2; }
.brand-top {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--bp-header-h);
  min-height: var(--bp-header-h);
  margin: 0 0 var(--bp-header-gap);
  gap: 8px;
  flex-wrap: nowrap;
}
/* Правая группа хедера: каждая кнопка не меньше 44×44 — системное меню
   Telegram справа перестаёт «съедать» аватар, потому что под него теперь
   выделена отдельная безопасная область (contentSafeArea в --shell-top). */
.brand-row { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* —— Бренд-лок-ап: просто знак + слово, без плашек —— */
.brand-lockup {
  display: flex; align-items: center; gap: 9px;
  min-width: 0; flex-shrink: 1;
  white-space: nowrap;
}
.brand-lockup--hero { gap: 12px; }
.brand-lockup .brand-word { white-space: nowrap; flex-shrink: 0; }
.brand-badge {
  flex-shrink: 0;
  display: grid; place-items: center;
  background: transparent;
  border: none;
}
.brand-badge img {
  display: block;
  width: 28px; height: 28px;
  object-fit: contain;
}
.brand-badge--sm img { width: 28px; height: 28px; }
.brand-badge--lg img { width: 104px; height: 104px; }

.brand-word {
  font-family: var(--font-display);
  font-size: 1.06rem; font-weight: 700; line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand-words { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.brand-tagline {
  font-size: .62rem; line-height: 1;
  letter-spacing: .085em; text-transform: uppercase;
  color: rgba(178,200,255,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-lockup--hero .brand-word { font-size: 1.3rem; }

/* Premium-пилюля в хедере: аккуратная, не перебивает бренд */
.brand-lockup .chip.premium {
  margin-left: 3px;
  min-height: 26px; padding: 3px 10px;
  font-size: .68rem; line-height: 1;
  letter-spacing: .01em;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 3px 10px rgba(251,191,36,.18);
}
@media (max-width: 380px) {
  .brand-lockup { gap: 7px; }
  .brand-word { font-size: .99rem; }
  .brand-lockup .chip.premium { padding: 3px 8px; font-size: .64rem; }
}
@media (max-width: 360px) {
  .brand-badge img { width: 30px; height: 30px; }
  .brand-badge--sm img { width: 26px; height: 26px; }
  .brand-words .brand-tagline { display: none; }
}
.icon-btn {
  position: relative;
  width: var(--bp-tap); height: var(--bp-tap); min-width: var(--bp-tap);
  border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  color: #dbeafe; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  transition: transform .15s var(--ease), background .15s ease, border-color .15s ease;
}
.icon-btn .ico { width: 21px; height: 21px; display: block; }
/* Кнопка напоминаний: капсула «таблетка» вместо абстрактной плашки. */
.icon-btn.ico-pill { width: auto; min-width: var(--bp-tap); padding: 0 12px; gap: 6px; display: inline-flex; align-items: center; }
.icon-btn.ico-pill .ico { width: 24px; height: 24px; color: #a7f3d0; }
.icon-btn:active { transform: scale(.94); background: rgba(255,255,255,.13); }
.icon-btn.on { border-color: rgba(147,197,253,.45); background: rgba(96,165,250,.22); }
.icon-btn-dot {
  position: absolute; top: 8px; right: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #f472b6; box-shadow: 0 0 0 2px rgba(10,14,22,.9);
}
#nav-admin.hidden,
#btn-open-admin.hidden,
#page-admin.hidden {
  display: none !important;
}

.glass {
  background: linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.035));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.18);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}
.panel { padding: 18px; margin-bottom: 18px; }
.section-block { margin: 24px 0 12px; }
.section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin: 0 0 12px; gap: 10px;
  flex-wrap: wrap;
}
.section-head.tight { margin-bottom: 10px; }
.section-head h3 {
  margin: 0; font-family: var(--font-display); font-size: 1.05rem; letter-spacing: -.02em;
  min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere;
}
.section-head > .chip,
.section-head > span { flex-shrink: 0; }

.muted, .soft, .hint, .label, .subline { color: var(--muted); }
.hint { font-size: .8rem; margin: 8px 0 0; }
.hint.center { text-align: center; }
.hint.tight { margin: 0; }
.soft { margin: 0 0 12px; line-height: 1.45; }
.lede { color: var(--muted); margin: 0; line-height: 1.45; }

.auth-hero {
  position: relative; overflow: hidden; margin-bottom: 16px; min-height: 200px;
}
.auth-banner { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .22; pointer-events: none; z-index: 0; }
.auth-card, .auth-panel, .auth-tabs, .auth-form { position: relative; z-index: 1; }
.empty-quick { display: grid; gap: 8px; margin-top: 14px; width: min(100%, 320px); }
.abo-dates { grid-template-columns: 1fr !important; }
@media (min-width: 420px) {
  .abo-dates { grid-template-columns: 1fr 1fr !important; }
}
.abo-dates .field input[type="date"] { min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
.auth-hero-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7,9,15,.2), rgba(7,9,15,.92) 78%);
}
.auth-hero-content { position: relative; padding: 18px; }
.auth-hero-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 1.9rem);
  line-height: 1.12; letter-spacing: -.04em; margin: 14px 0 8px;
}

.auth-panel { padding-top: 12px; }
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; margin-bottom: 14px; border-radius: 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06);
}
.tab {
  padding: 10px 6px; min-height: 44px; border-radius: 11px; color: var(--muted);
  font-weight: 500; font-size: .86rem;
}
.tab.active {
  color: var(--text); background: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.auth-pane { display: none; }
.auth-pane.active { display: block; }
.auth-switch { margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: .74rem; color: var(--soft); letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(0,0,0,.28); outline: none; color-scheme: dark;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.35; min-height: 48px; box-sizing: border-box;
  /* ≥16px — иначе iOS Safari зумит страницу при фокусе */
  font-size: max(16px, 1rem);
}
.field input.emoji-field {
  /* Keep emoji from clipping / shifting label baseline in TG WebView */
  font-size: max(16px, 1rem); line-height: 1.45; min-height: 52px;
  overflow-x: auto; overflow-y: hidden; white-space: nowrap;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(59,130,246,.65);
  box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: 14px; font-weight: 600;
  transition: transform .15s var(--ease), opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.compact {
  padding: 8px 12px; font-size: .84rem; border-radius: 12px;
  background: rgba(255,255,255,.08); border: 1px solid var(--line);
}
.btn.primary {
  background: linear-gradient(135deg, #93c5fd, #3b82f6 55%, #2563eb);
  color: #fff;
  box-shadow: 0 10px 26px rgba(37,99,235,.32), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn.primary.glow { background-size: 200% 200%; animation: shimmer 3.5s linear infinite; }
.btn.secondary { background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.btn.ghost { color: var(--muted); }
.btn.danger { color: #fca5a5; background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.22); }

.chip {
  display: inline-flex; align-items: center; padding: 4px 10px; min-height: 32px; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
  background: rgba(255,255,255,.08); border: 1px solid var(--line);
}
.chip.premium {
  color: #1a1400;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  border-color: transparent;
}
.hidden { display: none !important; }

.hero-stat { padding: 16px 18px; margin-bottom: 12px; position: relative; overflow: hidden; }
.hero-stat::after {
  content: ""; position: absolute; right: -40px; top: -50px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(96,165,250,.22), transparent 70%);
}
.hero-stat-top { display: flex; justify-content: space-between; gap: 12px; }
.label { margin: 0; font-size: .82rem; }
.big-number {
  font-family: var(--font-display); font-size: 2.35rem; letter-spacing: -.05em;
  margin: 2px 0; line-height: 1;
}
.big-number small { font-size: 1rem; color: var(--muted); font-weight: 500; }
.subline { margin: 0 0 10px; font-size: .84rem; }
.spend-analogy {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(96,165,250,.14), rgba(37,99,235,.06));
  border: 1px solid rgba(147,197,253,.18);
  font-size: .8rem; line-height: 1.45; color: rgba(245,247,251,.88);
}
.spend-analogy b { color: #93c5fd; font-weight: 650; }
.spend-analogy .analogy-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.spend-analogy .analogy-chip {
  padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.08); color: var(--muted);
}
.mini-ring {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(96,165,250,.28), rgba(59,130,246,.12));
  border: 1px solid rgba(255,255,255,.14);
  font-family: var(--font-display); font-weight: 700;
}
.progress-track {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width .4s var(--ease);
}

.metrics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric { padding: 12px 14px; }
.metric span { display: block; color: var(--muted); font-size: .74rem; margin-bottom: 4px; }
.metric b { font-family: var(--font-display); font-size: 1.12rem; }
.metric .metric-trust { display: block; font-size: .96rem; line-height: 1.2; }
.metric .metric-trust-sub { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; }
.metric i { font-style: normal; }
.metric-balance .bal-line {
  display: flex; align-items: center; gap: 8px;
}
.bal-plus {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 1.05rem; font-weight: 700; line-height: 1; color: #dbeafe;
  background: linear-gradient(145deg, rgba(96,165,250,.35), rgba(37,99,235,.22));
  border: 1px solid rgba(147,197,253,.28);
  transition: transform .15s var(--ease), background .15s ease;
}
.bal-plus:active { transform: scale(.94); }

.pay-block {
  margin: 8px 0 0;
  padding: 16px 14px 14px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
    rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 12px 28px rgba(0,0,0,.22);
}
.pay-block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 0 0 12px;
}
.pay-block-head h4 {
  margin: 0; font-family: var(--font-display); font-size: .95rem; font-weight: 700;
  letter-spacing: -.01em;
}
.pay-block-head span { color: var(--muted); font-size: .72rem; }
.pay-methods { display: flex; flex-direction: column; gap: 10px; margin: 0 0 14px; }
.pay-method {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  border-radius: 16px;
  background: rgba(10,14,24,.72);
  border: 1.5px solid rgba(255,255,255,.1);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  transition:
    border-color .18s ease,
    background .18s ease,
    transform .15s var(--ease),
    box-shadow .18s ease;
}
.pay-method:hover {
  border-color: rgba(147,197,253,.28);
  background: rgba(16,22,36,.9);
}
.pay-method.on {
  border-color: rgba(96,165,250,.72);
  background:
    linear-gradient(135deg, rgba(59,130,246,.28), rgba(15,23,42,.55) 55%),
    rgba(12,18,32,.95);
  box-shadow:
    0 0 0 1px rgba(96,165,250,.22),
    0 10px 24px rgba(37,99,235,.18);
}
.pay-method.soon {
  opacity: .58;
  border-style: dashed;
  border-color: rgba(255,255,255,.12);
}
.pay-method.soon:hover { border-color: rgba(255,255,255,.16); background: rgba(10,14,24,.72); }
.pay-method:active:not(.soon) { transform: scale(.985); }
.pm-badge {
  width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 1.05rem;
  background: linear-gradient(145deg, rgba(96,165,250,.32), rgba(37,99,235,.16));
  border: 1px solid rgba(147,197,253,.28); color: #dbeafe;
}
.pm-badge.pm-stars {
  background: linear-gradient(145deg, rgba(251,191,36,.28), rgba(180,83,9,.16));
  border-color: rgba(251,191,36,.35); color: #fde68a;
}
.pm-badge.pm-bal {
  background: linear-gradient(145deg, rgba(52,211,153,.22), rgba(6,95,70,.16));
  border-color: rgba(52,211,153,.28); color: #6ee7b7;
}
.pm-badge.pm-rub {
  background: linear-gradient(145deg, rgba(148,163,184,.22), rgba(51,65,85,.2));
  border-color: rgba(148,163,184,.28); color: #cbd5e1;
}
.pay-method.on .pm-badge {
  transform: scale(1.04);
}
.pm-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pm-txt b { font-size: .92rem; font-weight: 700; letter-spacing: -.01em; }
.pm-txt small { color: var(--muted); font-size: .74rem; line-height: 1.3; }
.pm-meta {
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0;
}
.pm-price {
  font-family: var(--font-display);
  font-size: .88rem; font-weight: 700;
  color: #e8eefc;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.pay-method.on .pm-price {
  color: #0b1220;
  background: #93c5fd;
  border-color: transparent;
}
.pm-soon {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.1);
}
.pm-check {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.22);
  background: transparent;
  position: relative;
}
.pay-method.on .pm-check {
  border-color: #93c5fd;
  background: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96,165,250,.18);
}
.pay-method.on .pm-check::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 50%;
  background: #0b1220;
  clip-path: polygon(14% 52%, 0 66%, 40% 100%, 100% 18%, 84% 4%, 38% 70%);
}
.btn-topup-link {
  display: block; width: 100%; margin-top: 10px;
  padding: 10px 8px; text-align: center;
  color: var(--accent-2); font-size: .84rem; font-weight: 600;
  border-radius: 12px;
  background: rgba(79,140,255,.06);
  border: 1px dashed rgba(147,197,253,.22);
}
.btn-topup-link:active { background: rgba(79,140,255,.12); }
.topup-card { margin-bottom: 12px; }
.topup-balance-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06);
  font-size: .86rem; color: var(--muted);
}
.topup-balance-row b { color: var(--text); font-family: var(--font-display); font-size: 1.05rem; }
.topup-need {
  margin: 0 0 12px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(251,191,36,.14), rgba(0,0,0,.12));
  border: 1px solid rgba(251,191,36,.28); font-size: .84rem; line-height: 1.4;
}
.topup-need b { color: #fde68a; }
.topup-steps {
  display: flex; gap: 8px; margin: 0 0 14px;
}
.topup-steps span {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; color: var(--muted);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}
.topup-steps span.on {
  color: #0b1220; background: #fde68a; border-color: #fde68a;
}
.topup-stars-hint {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 14px;
  background: linear-gradient(135deg, rgba(251,191,36,.12), rgba(0,0,0,.14));
  border: 1px solid rgba(251,191,36,.22);
  font-size: .86rem; color: rgba(245,247,251,.88);
}
.topup-stars-hint b { color: #fde68a; font-family: var(--font-display); font-size: 1.05rem; }
.topup-stars-hint span { color: var(--muted); font-size: .78rem; }
.topup-actions {
  display: flex; gap: 10px; margin-top: 16px;
}
.topup-actions .btn { flex: 1; }
.topup-amount-field {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
  position: relative;
  z-index: 2;
}
.topup-amount-field input {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: .02em;
  padding: 18px 16px;
  min-height: 56px;
  width: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  border: 1px solid rgba(147, 197, 253, .35);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  -webkit-user-select: text;
  user-select: text;
  -webkit-appearance: none;
  appearance: none;
}
.topup-amount-field input:focus {
  outline: none;
  border-color: rgba(96, 165, 250, .7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .2);
}
#topup-presets {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 4px;
}
#topup-presets .chip-opt, #topup-presets button {
  min-height: 40px; padding: 10px 14px; border-radius: 12px;
  font-weight: 600; font-size: .9rem;
}
.topup-confirm-box {
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  font-size: .92rem; line-height: 1.45; color: var(--muted);
}
.topup-confirm-box b { color: var(--text); }
.bind-email-box {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.08);
}
.legal-inapp .glass.panel { margin-bottom: 10px; }
.legal-inapp h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 1rem; }
.legal-inapp p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .9rem; }
.legal-inapp .legal-meta { margin: 0 0 12px; font-size: .78rem; color: var(--muted); }

.seg {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06);
}
.seg-btn {
  position: relative; z-index: 1; padding: 10px 6px; min-height: 44px; border-radius: 11px;
  color: var(--muted); font-weight: 600; font-size: .82rem;
}
.seg-btn.active { color: var(--text); }
.seg-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(33.333% - 4px);
  border-radius: 11px; background: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  transition: transform .3s var(--ease);
  pointer-events: none;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.dense { gap: 8px; margin-top: 8px; }

.sub-card, .lib-card {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px 14px; align-items: center;
  padding: 14px; border-radius: 18px; width: 100%; text-align: left;
  background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,.03));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .18s var(--ease), border-color .18s ease, background .18s ease;
}
.sub-card { animation: rise .3s var(--ease) both; }
.sub-card:active { transform: scale(.985); }
.sub-card.cancelled { opacity: .55; }
.sub-card.is-premium {
  border-color: rgba(251, 191, 36, .32);
  background: linear-gradient(135deg, rgba(251,191,36,.14), rgba(255,255,255,.04) 55%);
  box-shadow: inset 0 1px 0 rgba(251,191,36,.22);
}
.sub-icon, .lib-icon {
  --icon-bg: #3b82f6;
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: .78rem; letter-spacing: -.02em;
  color: #fff; flex-shrink: 0;
  background:
    linear-gradient(160deg, rgba(255,255,255,.3), transparent 46%),
    var(--icon-bg);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    0 8px 18px rgba(0,0,0,.28);
}
.sub-icon span, .lib-icon span {
  line-height: 1; text-shadow: 0 1px 1px rgba(0,0,0,.22);
  max-width: 100%; overflow: hidden; text-align: center;
  padding: 0 2px; font-size: .72rem;
}
.sub-icon.has-logo, .lib-icon.has-logo, .icon-preview.has-logo {
  background: #fff;
  padding: 6px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), 0 6px 14px rgba(0,0,0,.25);
}
.sub-icon.has-logo img, .lib-icon.has-logo img, .icon-preview img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 8px; display: block;
}
.sub-icon.is-premium-ico {
  background: linear-gradient(160deg, rgba(251,191,36,.35), rgba(251,191,36,.08));
  padding: 8px;
}
.icon-pick-field { margin-top: 4px; }
.icon-pick-row { display: flex; gap: 12px; align-items: center; }
.icon-preview {
  --icon-bg: #3b82f6;
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(255,255,255,.28), transparent 46%), var(--icon-bg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
  font-family: var(--font-display); font-weight: 700; color: #fff;
}
.icon-pick-actions { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mini-btn { padding: 8px 12px; font-size: .78rem; border-radius: 12px; }
.sub-main { min-width: 0; }
.sub-side {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  gap: 2px; min-width: 4.5rem;
}
.sub-title, .lib-title {
  font-weight: 600; margin: 0 0 3px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sub-meta, .lib-meta { margin: 0; font-size: .76rem; color: var(--muted); line-height: 1.3; }
.sub-amount, .lib-amount {
  font-family: var(--font-display); font-weight: 600; white-space: nowrap;
  font-size: 1.02rem; letter-spacing: -.01em;
}
.sub-due { font-size: .72rem; color: var(--accent-2); text-align: right; line-height: 1.2; }
.sub-due.soon { color: var(--warn); }
.sub-due.today { color: var(--danger); }
.lib-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 8px;
  padding: 8px 8px 8px 12px;
}
.lib-card-main {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: center;
  width: 100%; text-align: left; padding: 6px 4px; border-radius: 14px;
  background: transparent; border: 0; color: inherit;
  transition: background .16s ease, transform .16s var(--ease);
}
.lib-card-main:active { background: rgba(255,255,255,.05); transform: scale(.99); }
.lib-card .lib-amount {
  align-self: center;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(147,197,253,.12);
  border: 1px solid rgba(147,197,253,.22);
  color: var(--text); font-size: .92rem;
  transition: transform .16s var(--ease), background .16s ease, border-color .16s ease;
}
.lib-card .lib-amount:active:not(:disabled) {
  transform: scale(.96);
  background: rgba(147,197,253,.22);
}
.lib-card .lib-amount:disabled { opacity: .45; }
.lib-card.locked { opacity: .72; }
.lib-hint { margin: 0 0 12px; font-size: .78rem; }

.empty { text-align: center; padding: 34px 22px; margin-top: 8px; }
.empty-icon { font-size: 1.8rem; opacity: .65; margin-bottom: 8px; }
.empty h3 { font-family: var(--font-display); margin: 0 0 6px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

.page { display: none; animation: rise .32s var(--ease) 1; }
.page.active { display: block; padding-bottom: 8px; }

/* TOP floating island — never at bottom */
.tabbar {
  position: relative;
  display: grid; gap: 2px; padding: 4px;
  grid-template-columns: repeat(5, 1fr);
  border-radius: 22px;
  min-height: var(--bp-nav-h);
  /* Увеличенный системный шрифт: панель растёт вниз, подписи не обрезаются */
  height: auto;
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow .35s ease, background .35s ease;
}
.tabbar.island {
  background: linear-gradient(160deg, rgba(255,255,255,.14), rgba(255,255,255,.045));
  border: 1px solid rgba(255,255,255,.14);
  box-shadow:
    0 10px 28px rgba(0,0,0,.34),
    inset 0 1px 0 rgba(255,255,255,.18);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.tabbar.island-up { box-shadow: 0 12px 32px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.22); }
.tabbar.admin-on { grid-template-columns: repeat(6, 1fr); }
.nav-btn span { font-size: .58rem; }
.island-glow {
  position: absolute; inset: 0 8% auto; height: 42%;
  background: radial-gradient(ellipse at center, rgba(59,130,246,.16), transparent 72%);
  pointer-events: none; z-index: 0;
}
.nav-indicator {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: 18%;
  max-width: calc(100% - 10px);
  border-radius: 16px; background: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  transition: left .28s var(--ease), width .28s var(--ease);
  pointer-events: none; z-index: 0;
}
.nav-btn {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px; min-height: 44px; border-radius: 16px; color: var(--muted); font-size: .64rem;
  transition: color .2s ease, transform .2s var(--ease);
}
.nav-btn .nav-ico {
  width: 22px; height: 22px; display: block;
  opacity: .72; transition: opacity .2s ease, transform .2s var(--ease), filter .2s ease;
}
.nav-btn.active { color: var(--text); }
.nav-btn.active .nav-ico {
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(96,165,250,.35));
  transform: translateY(-0.5px);
}
.nav-btn:active .nav-ico { transform: scale(.92); }

.legal-foot {
  position: relative; z-index: 5;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 8px; margin-top: 28px; padding: 18px 8px 8px;
  font-size: .75rem; color: var(--muted);
  pointer-events: auto;
}
.legal-foot a,
.legal-foot .linkish {
  color: rgba(245,247,251,.7);
  background: none; border: 0; padding: 4px 2px;
  font: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.legal-foot a:hover,
.legal-foot .linkish:hover { color: var(--accent-2); }
.dense-stats { margin: 10px 0 14px; }
.dense-stats .stat-card { padding: 10px 12px; }
.dense-stats .stat-card .v { font-size: 1.1rem; }

.paywall { padding: 0; overflow: hidden; margin-bottom: 16px; }
.paywall-art { width: 100%; height: 110px; object-fit: cover; opacity: .75; }
.paywall-body { padding: 18px; }
.paywall-badge {
  display: inline-flex; padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  color: #1a1400; font-weight: 700; font-size: .74rem; margin-bottom: 10px;
}
.paywall h2 {
  font-family: var(--font-display); letter-spacing: -.04em; line-height: 1.15;
  margin: 0 0 8px; font-size: 1.5rem;
}
.perk-list { list-style: none; padding: 0; margin: 22px 0 18px; display: flex; flex-direction: column; gap: 12px; }
.perk-list li {
  display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 14px; align-items: center;
  padding: 14px 14px; border-radius: 16px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06);
}
.perk-ico {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-display); font-weight: 700; color: #dbeafe; font-size: 1.05rem;
  background:
    linear-gradient(160deg, rgba(147,197,253,.28), rgba(37,99,235,.18)),
    rgba(15,23,42,.55);
  border: 1px solid rgba(147,197,253,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 18px rgba(0,0,0,.22);
  line-height: 1; padding: 0; flex-shrink: 0;
}
.perk-ico-lg span {
  display: grid; place-items: center; width: 100%; height: 100%;
  font-size: 1.25rem; letter-spacing: -.02em;
}
.perk-ico-lg { width: 58px; height: 58px; border-radius: 18px; }
.perk-txt { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.perk-list b { display: block; font-size: .9rem; margin: 0; line-height: 1.2; }
.perk-list small { color: var(--muted); font-size: .74rem; line-height: 1.35; }
.admin-wide {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 56px; border-radius: 16px; font-weight: 700; font-size: 1.02rem;
  background: linear-gradient(135deg, rgba(79,140,255,.4), rgba(37,99,235,.62));
  border: 1px solid rgba(142,182,255,.4); color: #fff;
  box-shadow: 0 12px 28px rgba(37,99,235,.28);
  margin: 14px 0 12px; letter-spacing: -.01em;
}
.cat-chips {
  display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 2px;
}
/* Поиск в каталоге: одна строка с иконкой и крестиком — без подписи сверху,
   чтобы не занимать место на телефоне. */
.lib-search {
  position: relative; display: flex; align-items: center;
  margin: 10px 0 2px;
}
.lib-search-ico {
  position: absolute; left: 13px; width: 19px; height: 19px;
  color: var(--muted); pointer-events: none;
}
.lib-search input {
  width: 100%;
  padding: 13px 44px 13px 42px;
  border-radius: 16px;
  font-size: .92rem;
  color: var(--text);
  background: rgba(0, 0, 0, .26);
  border: 1px solid rgba(255, 255, 255, .12);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.lib-search input::placeholder { color: rgba(200, 212, 232, .55); }
.lib-search input:focus {
  border-color: rgba(147, 197, 253, .5);
  background: rgba(0, 0, 0, .34);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .14);
}
.lib-search input::-webkit-search-cancel-button { display: none; }
/* Спиннер живёт в самом поле: 16 px, появляется только на время запроса. */
.lib-search-spin {
  position: absolute;
  right: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(155, 197, 255, .25);
  border-top-color: var(--bp-accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.lib-search.is-loading .lib-search-spin { opacity: 1; animation: bp-spin .8s linear infinite; }
.lib-search.is-loading .lib-search-clear { opacity: 0; pointer-events: none; }
.lib-search.has-error input { border-color: rgba(248, 113, 113, .55); }
@keyframes bp-spin { to { transform: rotate(360deg); } }
.lib-state {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px;
}
.lib-state p { margin: 0; }
.lib-count {
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 18px;
  color: var(--bp-text-2);
}
.lib-count b { color: var(--bp-text); }
.lib-search-clear {
  position: absolute; right: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .82rem; color: #dbeafe;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: opacity .15s ease;
}
.lib-search-clear:active { transform: scale(.92); }
.lib-more { margin-top: 8px; font-size: .8rem; }
.cat-chips::-webkit-scrollbar { display: none; height: 0; }
.cat-chip {
  flex: 0 0 auto; padding: 11px 14px; min-height: 44px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: rgba(0,0,0,.24); border: 1px solid rgba(255,255,255,.1); color: var(--muted);
  transition: transform .14s var(--ease), background .16s ease, color .16s ease, border-color .16s ease;
}
.cat-chip:active { transform: scale(.96); }
.cat-chip.on {
  color: #041018;
  background: linear-gradient(135deg, #93c5fd, #3b82f6);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(59,130,246,.28);
}
.lib-cat-field { margin: 12px 0 0; }
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: "";
  position: absolute; right: 14px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}
.select-wrap select,
#library-cat {
  appearance: none; -webkit-appearance: none;
  width: 100%; padding: 13px 40px 13px 14px; border-radius: 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.12);
  color: var(--text); font-weight: 600;
}
.select-wrap select:focus,
#library-cat:focus {
  outline: none; border-color: rgba(142,182,255,.45);
  box-shadow: 0 0 0 3px rgba(79,140,255,.16);
}
.select-wrap select option { background: #0e1420; color: var(--text); }
.support-chips {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px;
  padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08);
}
.support-chips .cat-chip { cursor: pointer; }
.support-chips .cat-chip:active { transform: scale(.98); }
.user-row .bal { font-variant-numeric: tabular-nums; font-size: .9rem; }
.user-row .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.admin-hr {
  border: 0; height: 1px; margin: 16px 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.14), transparent);
}
.admin-survey {
  white-space: pre-wrap; margin: 0 0 12px; font-size: .72rem; line-height: 1.45;
  max-height: 120px; overflow: auto;
}
#page-admin .glass.panel { margin-bottom: 12px; padding: 14px 16px; }
#page-admin .stack.dense { gap: 8px; max-height: 360px; overflow: auto; }
#admin-balance-sum { font-size: .72rem; }
.compact-panel { padding: 14px 16px; }
.hero-stat { margin-bottom: 12px; }
.section-block { margin-top: 18px; }
.paywall-body { padding-top: 20px; }
.paywall .lede { margin: 0 0 4px; }
.metrics-row { margin-bottom: 10px; }
#page-profile .glass.panel { margin-bottom: 12px; }
#page-premium .section-head { margin-top: 18px; }
.library-hero { margin-bottom: 12px; }
#library-popular .section-head { margin-bottom: 10px; }

.profile-card .profile-top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.profile-head h3 { margin: 0 0 4px; font-family: var(--font-display); }
.avatar-img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  border-radius: inherit; display: block;
}
.avatar-btn.has-photo #avatar-letter,
.avatar-lg.has-photo #profile-letter { display: none; }
.avatar-btn, .avatar-lg {
  width: var(--bp-tap); height: var(--bp-tap); border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(96,165,250,.5), rgba(59,130,246,.7));
  border: 1px solid rgba(255,255,255,.22); font-weight: 700;
  overflow: hidden; flex-shrink: 0; position: relative; padding: 0;
  transition: box-shadow .2s ease, border-color .2s ease;
}
/* Единственный вход в профиль: аватар в шапке. Подсвечен, когда страница открыта. */
.avatar-btn.on { border-color: rgba(147,197,253,.7); box-shadow: 0 0 0 2px rgba(96,165,250,.35); }
.avatar-lg { width: 56px; height: 56px; border-radius: 18px; font-size: 1.15rem; }
.kv { display: flex; flex-direction: column; margin: 4px 0 14px; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.07); font-size: .88rem;
}
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }

.balance-hero {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; border-radius: 14px; margin-bottom: 10px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.06);
}
.balance-hero > div { display: flex; flex-direction: column; gap: 2px; }
.balance-hero span { color: var(--muted); font-size: .75rem; }
.balance-hero b { font-family: var(--font-display); font-size: 1.35rem; }
.balance-plus {
  width: 44px; height: 44px; border-radius: 14px; font-size: 1.4rem; font-weight: 700; line-height: 1;
  color: #041018; background: linear-gradient(135deg, #93c5fd, #3b82f6);
  box-shadow: 0 10px 22px rgba(37,99,235,.28); border: 0;
}
.balance-plus:active { transform: scale(.96); }

.btn-premium-cta {
  position: relative; overflow: hidden; width: 100%; min-height: 58px; margin: 6px 0 10px;
  border-radius: 18px; border: 1px solid rgba(251,191,36,.35);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(120deg, #1d4ed8 0%, #2563eb 42%, #f59e0b 160%);
  color: #fff; box-shadow: 0 16px 36px rgba(37,99,235,.35);
}
.btn-premium-cta .cta-glow {
  position: absolute; inset: -40% auto auto -20%; width: 60%; height: 140%;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 70%);
  pointer-events: none; animation: breathe 3.4s ease-in-out infinite;
}
.btn-premium-cta .cta-main { position: relative; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.btn-premium-cta .cta-price {
  position: relative; flex-shrink: 0; padding: 8px 12px; border-radius: 999px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.18);
  font-weight: 700; font-size: .86rem;
}
.btn-premium-cta:active { transform: scale(.985); }

.premium-promo-card {
  background: linear-gradient(145deg, rgba(251,191,36,.12), rgba(0,0,0,.18)) !important;
  border-color: rgba(251,191,36,.22) !important;
}
.promo-panel { margin-top: 18px; }
.promo-enter {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 10px;
}
.promo-enter input {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.1); outline: none;
}
.promo-enter input:focus { border-color: rgba(147,197,253,.45); }
.promo-result {
  margin-top: 10px; padding: 12px 14px; border-radius: 14px;
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.25); color: #a7f3d0; font-size: .86rem;
}
.topup-bonus-box {
  margin: 14px 0 4px; padding: 12px 14px; border-radius: 16px;
  background: rgba(251,191,36,.06); border: 1px dashed rgba(251,191,36,.24);
}
.topup-bonus-line {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.22);
  color: #d1fae5; font-size: .84rem;
}

.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 13px; min-height: 44px; border-radius: 14px; font-size: .8rem; font-weight: 600;
  background: rgba(10,14,24,.78); border: 1.5px solid rgba(255,255,255,.12); color: var(--muted);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .12s var(--ease);
}
.cat-pick-btn:hover { border-color: rgba(147,197,253,.3); color: var(--text); }
.cat-pick-btn i { font-style: normal; opacity: .9; }
.cat-pick-btn.on {
  color: #041018;
  background: linear-gradient(135deg, #93c5fd, #3b82f6);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(37,99,235,.22);
}
.cat-pick-btn:active { transform: scale(.97); }
.cat-pick[hidden] { display: none !important; }
.category-picked {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;
  padding: 10px 13px; border-radius: 14px; text-align: left; cursor: pointer;
  font: inherit; font-size: .82rem; color: var(--text);
  background: rgba(10,14,24,.78); border: 1.5px solid rgba(255,255,255,.12);
}
.category-picked[hidden] { display: none !important; }
.category-picked .cp-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9px; font-style: normal;
  background: linear-gradient(135deg, #93c5fd, #3b82f6); color: #041018;
}
.category-picked .cp-text { flex: 1 1 auto; color: var(--muted); }
.category-picked .cp-text b { color: var(--text); }
.category-picked .cp-edit { color: #93c5fd; font-size: .76rem; font-weight: 600; }
.payment-box {
  margin: 8px 0 4px; padding: 14px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(79,140,255,.12), rgba(0,0,0,.18));
  border: 1px solid rgba(142,182,255,.18);
}
.payment-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.payment-box-head b { font-size: .9rem; }
.sheet-actions .grow { flex: 1; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-del { margin: 8px 18px 0; width: calc(100% - 36px); }
.sub-pay-hint {
  font-size: .66rem; color: var(--muted); text-align: right; line-height: 1.25;
  max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px;
}
.stat-card {
  padding: 14px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.03));
  border: 1px solid var(--line);
}
.stat-card .k { font-size: .7rem; color: var(--muted); margin: 0 0 4px; }
.stat-card .v { font-family: var(--font-display); font-size: 1.28rem; margin: 0; }
.stat-card .s { margin: 4px 0 0; font-size: .7rem; color: var(--accent-2); }

.user-row, .pay-row, .promo-row, .deal-card {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 12px; border-radius: 14px;
  background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.05);
}
.user-row .meta, .pay-row .meta, .promo-row .meta, .deal-card .meta { min-width: 0; }
.user-row b, .pay-row b, .promo-row b, .deal-card b { display: block; font-size: .88rem; }
.user-row small, .pay-row small, .promo-row small, .deal-card small { color: var(--muted); font-size: .7rem; }
.user-row .side, .pay-row .side, .promo-row .side { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.grant-mini, .del-mini {
  padding: 6px 10px; min-height: 36px; border-radius: 10px; font-size: .7rem; font-weight: 600;
}
.grant-mini { background: rgba(59,130,246,.18); border: 1px solid rgba(96,165,250,.25); color: var(--accent-2); }
.del-mini { background: rgba(248,113,113,.12); border: 1px solid rgba(248,113,113,.25); color: #fca5a5; }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt {
  min-width: 44px; padding: 10px 13px; border-radius: 14px;
  background: rgba(10,14,24,.78); border: 1.5px solid rgba(255,255,255,.12);
  color: var(--muted); font-weight: 600; font-size: .82rem;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.chip-opt:hover { border-color: rgba(147,197,253,.3); color: var(--text); }
.chip-opt.on {
  color: #041018; background: linear-gradient(135deg, #93c5fd, #3b82f6); border-color: transparent;
  box-shadow: 0 8px 18px rgba(37,99,235,.2);
}

.status-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px;
  border-radius: 14px;
  background: rgba(0,0,0,.32);
  border: 1px solid rgba(255,255,255,.08);
}
.status-btn {
  padding: 11px 10px; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: .84rem;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.status-btn.active {
  color: #041018;
  background: linear-gradient(135deg, #e2e8f0, #93c5fd);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(147,197,253,.18);
}

.check-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); }
.deal-card .promo-code {
  font-family: var(--font-display); letter-spacing: .04em; color: var(--accent-2); font-size: .82rem;
}

.sheet {
  position: fixed; inset: 0; z-index: 50;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet.open { display: flex; }
.sheet[hidden] { display: none !important; }
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); cursor: pointer;
}
.sheet-panel {
  position: relative; width: min(480px, 100%); max-height: min(88dvh, 820px);
  display: flex; flex-direction: column; overflow: hidden;
  border-top-left-radius: 24px; border-top-right-radius: 24px;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  padding: 8px 0 calc(12px + var(--safe-b)); animation: rise .26s var(--ease) both; z-index: 1;
}
/* Клавиатура открыта: панель мельче, тело прокручивается, кнопки остаются видны. */
.sheet .sheet-panel { max-height: min(88dvh, 820px, calc(100dvh - var(--kb-h, 0px) - 24px)); }
.sheet-head { position: relative; padding: 0 18px 4px; }
.sheet-handle {
  width: 42px; height: 5px; border-radius: 999px;
  background: rgba(255,255,255,.28); margin: 4px auto 10px;
  /* Зона захвата шире самой «таблетки», свайп вниз не прокручивает страницу */
  padding: 9px 0; background-clip: content-box;
  box-sizing: content-box; position: relative; z-index: 2;
  touch-action: none; cursor: grab;
}
.sheet-close {
  position: absolute; right: 10px; top: 6px; width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255,255,255,.1); border: 1px solid var(--line);
}
.sheet-head h3 { margin: 0 40px 8px 0; font-family: var(--font-display); }
.sheet-lead { margin: 0 0 12px; font-size: .84rem; }
.sheet-body { overflow: auto; padding: 0 20px; max-height: none; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.sheet-form .field { margin-bottom: 16px; }
.sheet-form .field > span {
  display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; line-height: 18px; font-weight: 600;
}
.sheet-form input, .sheet-form select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--bp-radius-field);
  background: rgba(10,14,24,.78); border: 1.5px solid rgba(255,255,255,.12); outline: none;
  font-size: 15px; line-height: 22px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}
.sheet-form input:focus, .sheet-form select:focus {
  border-color: rgba(147,197,253,.55);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.sheet-actions {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 20px 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px;
}

/* ── Форма подписки: валюта рядом с суммой, ошибка — у поля ──────────────── */
.amount-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 8px; }
.amount-row .sub-field { margin-bottom: 0; }
/* Вложенное поле не рисует свою подпись: она одна на весь блок. */
.sheet-form .amount-row .sub-field > span { display: none; }
.cur-field select { font-variant-numeric: tabular-nums; }
.sheet-form input.is-readonly {
  color: var(--muted); background: rgba(255,255,255,.04); cursor: default;
}
.sheet-form .field.has-error input,
.sheet-form .field.has-error select {
  border-color: rgba(255,105,97,.7);
  box-shadow: 0 0 0 3px rgba(255,69,58,.14);
}
.sheet-form .field.has-error > span { color: #FF8178; }
/* Тарифы внутри шторки: сетка в две колонки не даёт кнопкам вылезать за край. */
.cat-pick.sheet-plans { margin-top: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#sub-catalog-pick .category-picked { width: 100%; }
#sub-catalog-btn .cp-icon img { width: 24px; height: 24px; object-fit: contain; border-radius: 6px; }
#sub-catalog-plan { color: var(--muted); font-size: 12px; }
@media (max-width: 360px) {
  .amount-row { grid-template-columns: minmax(0, 1fr) 104px; }
}
.sheet-actions .btn { min-height: 48px; font-weight: 700; }
.sheet-actions .btn.grow { flex: 1; }
.sheet-actions .btn.primary {
  box-shadow: 0 10px 22px rgba(37,99,235,.28);
}
@media (max-width: 389px) {
  .sheet-body { padding: 0 16px; }
  .sheet-actions { padding: 12px 16px 0; }
  .sheet-head { padding: 0 16px 4px; }
}
#btn-delete-sub { margin: 8px 18px 0; width: calc(100% - 36px); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form { margin-top: 4px; display: flex; flex-direction: column; min-height: 0; }

.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px;
  overflow: hidden;
}
.modal[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
/* Высокий контент центрировался и наезжал верхом за край экрана — до верха
   нельзя было доскроллить. Теперь карточка сама скроллится и влезает в кадр
   с учётом клавиатуры (dvh). */
.modal-card {
  position: relative; width: min(400px, 100%); padding: 20px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.modal-card h3 { margin: 0 0 8px; font-family: var(--font-display); }

.error {
  color: #fcd34d; font-size: .84rem; margin: 10px 0 0;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25);
}
.verify-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.dev-code {
  margin: 0 0 12px; padding: 12px 14px; border-radius: 14px;
  background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.28);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.dev-code b { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: .16em; color: var(--accent-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + var(--safe-b));
  transform: translateX(-50%); z-index: 70; padding: 12px 18px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,.14), rgba(16,22,34,.92));
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 12px 32px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.16);
  max-width: min(420px, calc(100% - 28px));
  font-size: .9rem; font-weight: 560; letter-spacing: -.01em;
  text-align: center; line-height: 1.35;
}
.toast.toast-pop { animation: toast-pop .28s var(--ease) both; }
.toast[data-kind="error"] {
  border-color: rgba(255,69,58,.35);
  box-shadow: 0 12px 32px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,69,58,.18);
}
.toast[data-kind="warning"] {
  border-color: rgba(255,159,10,.35);
}
@keyframes toast-pop {
  from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.cat-row { display: flex; justify-content: space-between; margin: 8px 0; font-size: .86rem; }
.cat-bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.07); margin-top: 6px; overflow: hidden; }
.cat-bar > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); font-style: normal;
}

.legal h1 { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -.03em; }
.legal .panel { margin-bottom: 12px; }
.legal .panel h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 1rem; }
.legal .panel p { margin: 0; color: var(--muted); line-height: 1.5; font-size: .92rem; }
.legal-back { display: inline-block; margin-bottom: 14px; color: var(--accent-2); font-weight: 600; }

.lib-main { min-width: 0; }
.lib-price-card .btn.primary { margin-top: 4px; }

.toast {
  bottom: calc(24px + var(--safe-b)) !important;
}
#page-library.lib-busy .lib-card {
  opacity: .55;
  pointer-events: none;
}
.note-card-actions {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
}
.note-card-actions .mini-btn { white-space: nowrap; }
.reveal { animation: rise .45s var(--ease) both; }

@media (max-width: 380px) {
  .big-number { font-size: 2.1rem; }
  .row-2 { grid-template-columns: 1fr; }
  .tabbar.admin-on { font-size: .9em; }
}

/* Abonement date fields: never collide on narrow Telegram WebViews */
#abo-modal .abo-dates {
  grid-template-columns: 1fr;
  gap: 8px;
}
#abo-modal .abo-dates input[type="date"] {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 420px) {
  #abo-modal .abo-dates { grid-template-columns: 1fr 1fr; }
}

.auth-email-links .linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-2, #7dd3fc);
  font: inherit;
  cursor: pointer;
}
#auth-error:not([hidden]) {
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.92em;
}

/* —— Promo strip (first-5) —— */
.promo-strip {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 12px; padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(251, 191, 36, .14), rgba(79, 140, 255, .12));
  border: 1px solid rgba(251, 191, 36, .28);
}
.promo-strip b {
  font-family: var(--font-display); font-size: .82rem; letter-spacing: .02em;
  color: #fbbf24;
}
.promo-strip span { color: var(--muted); font-size: .78rem; line-height: 1.35; }
/* Кликабельная полоса акции: жидкое стекло с бликом, а не плоская плашка. */
.promo-strip-cta {
  position: relative;
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  width: 100%; text-align: left; overflow: hidden; isolation: isolate;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(251, 191, 36, .30);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(251, 191, 36, .20), transparent 58%),
    radial-gradient(120% 150% at 100% 100%, rgba(129, 140, 248, .20), transparent 62%),
    linear-gradient(150deg, rgba(255,255,255,.10), rgba(255,255,255,.035));
  box-shadow:
    0 1px 0 rgba(255,255,255,.20) inset,
    0 8px 22px rgba(3,7,16,.34);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  transition: transform .16s var(--ease), border-color .18s ease, box-shadow .18s ease;
}
/* Верхний блик — то самое «жидкое стекло». */
.promo-strip-cta::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 52%;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0));
  pointer-events: none; z-index: -1;
}
.promo-strip-cta:active {
  transform: scale(.986);
  border-color: rgba(251,191,36,.52);
  box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 4px 14px rgba(3,7,16,.4);
}
.promo-strip-ico {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 12px; font-size: 1.1rem; line-height: 1;
  background: linear-gradient(150deg, rgba(251,191,36,.30), rgba(251,191,36,.10));
  border: 1px solid rgba(251,191,36,.34);
  box-shadow: 0 1px 0 rgba(255,255,255,.24) inset;
}
.promo-strip-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.promo-strip-text b {
  font-family: var(--font-display); font-size: .87rem; color: #fde68a;
  letter-spacing: 0; line-height: 1.2;
}
.promo-strip-text span { color: rgba(226,232,240,.80); font-size: .74rem; line-height: 1.3; }
.promo-strip-go {
  flex-shrink: 0; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #1a1205; font-size: .8rem; font-weight: 800;
  background: linear-gradient(150deg, #fde68a, #fbbf24);
  box-shadow: 0 2px 8px rgba(251,191,36,.35);
}
/* Счётчик мест в акции — отдельной «пилюлей». */
.promo-strip-left {
  align-self: flex-start; margin-top: 1px;
  padding: 2px 8px; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .02em;
  color: #fde68a; background: rgba(251,191,36,.16);
  border: 1px solid rgba(251,191,36,.34);
}

/* —— Channel subscription bonus card —— */
.channel-bonus { padding: 14px 15px; margin: 0 0 12px; display: flex; flex-direction: column; gap: 11px; }
.channel-bonus.hidden { display: none; }
.cb-head { display: flex; gap: 11px; align-items: flex-start; }
.cb-emoji { font-size: 1.35rem; line-height: 1; filter: drop-shadow(0 0 10px rgba(79,140,255,.5)); }
.cb-title { font-family: var(--font-display); font-size: .93rem; font-weight: 650; margin: 0 0 3px; }
.cb-sub { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.38; }
.cb-bar {
  height: 5px; border-radius: 99px; overflow: hidden;
  background: rgba(255,255,255,.09); box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.cb-bar > i {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #4f8cff, #a78bfa 60%, #fbbf24);
  transition: width .45s cubic-bezier(.22,1,.36,1);
}
.cb-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cb-btn {
  appearance: none; border: 0; cursor: pointer; text-align: center; text-decoration: none;
  padding: 11px 10px; border-radius: 13px; font: inherit; font-size: .82rem; font-weight: 600;
  color: #06101f; background: linear-gradient(180deg, #8ab4ff, #4f8cff);
  box-shadow: 0 6px 18px rgba(79,140,255,.32), inset 0 1px 0 rgba(255,255,255,.45);
  transition: transform .12s ease, filter .2s ease;
}
.cb-btn:active { transform: scale(.97); filter: brightness(.95); }
.cb-btn.ghost {
  color: var(--text); background: rgba(255,255,255,.07);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 1px rgba(255,255,255,.09);
}
.cb-btn[disabled] { opacity: .55; pointer-events: none; }
.cb-note { margin: 0; font-size: .74rem; color: var(--muted); line-height: 1.4; }
.cb-note.ok { color: #86efac; }
.cb-note.warn { color: #fcd34d; }

/* —— Tab strips (catalog / abonements) ——
   Всё описание баннера раздела живёт в одном месте — блок «glass7» ниже.
   Здесь оставлен только заголовок секции, чтобы не держать две версии
   одного селектора: раньше aspect-ratio 16/9 отсюда перебивалось ниже. */

.perk-svg svg { width: 22px; height: 22px; color: #93c5fd; display: block; }
.pm-bal { background: linear-gradient(135deg, rgba(251,191,36,.35), rgba(245,158,11,.55)); color: #fde68a; }

/* —— Abonements & notes —— */
.abo-seg {
  grid-template-columns: repeat(2, 1fr);
  margin: 0 0 12px;
}
.abo-seg .abo-seg-pill,
.abo-seg #abo-seg-pill {
  width: calc(50% - 4px);
}
.abo-panel.hidden { display: none !important; }
.abo-head { margin-bottom: 10px; }
.abo-tpl-head { margin-top: 18px; }
.abo-list { margin-top: 10px; gap: 10px; }
.abo-tpl-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.abo-tpl-grid .abo-tpl:last-child:nth-child(odd) { grid-column: 1 / -1; }
.abo-tpl {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 12px; border-radius: 18px; text-align: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .16s var(--ease), border-color .16s ease, background .16s ease;
}
.abo-tpl:active { transform: scale(.98); background: rgba(255,255,255,.07); }
.abo-tpl b { font-size: .86rem; line-height: 1.25; }
.abo-tpl small { color: var(--muted); font-size: .7rem; line-height: 1.35; }
.abo-tpl .abo-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--abo-c, #38bdf8) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--abo-c, #38bdf8) 35%, transparent);
  color: var(--abo-c, #7dd3fc);
  font-size: 1.25rem; margin: 0 0 2px;
}
.abo-card {
  display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 14px; border-radius: 18px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.abo-card-ico {
  width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
  font-size: 1.2rem;
  background: color-mix(in srgb, var(--abo-c, #3b82f6) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--abo-c, #3b82f6) 40%, transparent);
  color: #e2e8f0;
}
.abo-card-title {
  margin: 0; font-weight: 650; font-size: .95rem;
  overflow-wrap: anywhere; word-break: break-word;
}
.abo-card-meta { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.abo-card-amount { font-weight: 700; font-size: .95rem; text-align: right; }
.abo-card-status { color: #60a5fa; font-size: .75rem; text-align: right; margin-top: 4px; }
.abo-card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

#page-admin .stat-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 14px;
}
#page-admin .stat-card {
  padding: 14px 14px 12px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1);
}
#page-admin .stat-card .k { margin: 0; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
#page-admin .stat-card .v { margin: 6px 0 2px; font-family: var(--font-display); font-size: 1.35rem; }
#page-admin .stat-card .s { margin: 0; color: var(--muted); font-size: .75rem; }
.abo-progress {
  height: 6px; border-radius: 999px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden;
}
.abo-progress > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #3b82f6);
}
.notes-panel { margin-top: 14px; }
.notes-lock {
  margin-top: 10px; padding: 12px; border-radius: 14px;
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.22);
}
.notes-lock p { margin: 0 0 10px; color: var(--muted); font-size: .88rem; }
.premium-chip-soft {
  background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.3); color: #fbbf24;
}
.note-card {
  display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 10px; align-items: center;
  padding: 12px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(167,139,250,.12), rgba(255,255,255,.03));
  border: 1px solid rgba(167,139,250,.22);
}
.note-card .note-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: rgba(167,139,250,.18); font-size: 1.2rem; flex-shrink: 0;
  line-height: 1; overflow: hidden;
}
.note-card-main { min-width: 0; }
.note-card-title {
  margin: 0; overflow-wrap: anywhere; word-break: break-word;
  line-height: 1.35;
}
.note-card-meta { margin: 2px 0 0; }
.note-card.multi {
  background: linear-gradient(160deg, rgba(96,165,250,.16), rgba(167,139,250,.08));
  border-color: rgba(96,165,250,.28);
}
.note-multi-chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 99px; font-size: .68rem; font-weight: 600;
  background: rgba(96,165,250,.22); color: #cfe4ff; vertical-align: middle;
}
.note-card-actions .note-edit-btn { min-width: 44px; }

/* Расписание приёмов в модалке */
.note-times-field { margin-bottom: 8px; }
.note-count { display: flex; gap: 8px; margin-top: 6px; }
.note-count-btn {
  flex: 1 1 0; min-height: 44px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  color: var(--text); font-weight: 650; font-size: 1rem;
}
.note-count-btn.on {
  background: linear-gradient(135deg, rgba(96,165,250,.34), rgba(167,139,250,.28));
  border-color: rgba(147,197,253,.55);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}
.note-schedule { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 8px; }
.note-time-row {
  display: grid; grid-template-columns: 84px minmax(0,1fr) 44px; gap: 8px; align-items: center;
}
.note-time-row .note-time-idx { font-size: .82rem; color: var(--muted); }
.note-time-row input[type=time] {
  min-height: 44px; border-radius: 14px; padding: 0 12px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  color: var(--text); font-size: 1rem;
}
.note-time-del {
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255,69,58,.16); border: 1px solid rgba(255,69,58,.3); color: #ffd9d6;
}
.note-time-row:only-child .note-time-del { visibility: hidden; }
.note-add-time { margin-bottom: 10px; }

/* Мягкий лимит в бесплатном режиме — до сохранения, без 403 */
.note-count-btn.count-locked {
  opacity: .45; cursor: not-allowed; position: relative;
}
.note-count-btn.count-locked::after {
  content: "✦"; position: absolute; top: 3px; right: 6px; font-size: .62rem;
  color: rgba(253,224,71,.9);
}
.note-free-hint {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 2px 0 10px; padding: 10px 12px; border-radius: 14px;
  font-size: .84rem; line-height: 1.4; color: var(--muted);
  background: rgba(96,165,250,.1); border: 1px solid rgba(96,165,250,.26);
}
.note-free-hint[hidden] { display: none; }
.note-free-hint .link-btn {
  background: none; border: none; padding: 0; min-height: 0;
  color: #93c5fd; font-size: .84rem; font-weight: 650;
  text-decoration: underline; text-underline-offset: 3px;
}

/* Tip / support tiers */
.onboard-card { text-align: center; }
.onboard-mascot {
  width: 112px; height: 112px; margin: 0 auto 12px;
  border-radius: 28px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(147,197,253,.35), rgba(15,23,42,.55));
  border: 1px solid rgba(147,197,253,.25);
  animation: onboardFloat 2.8s ease-in-out infinite;
}
.onboard-mascot img { width: 72px; height: 72px; object-fit: contain; }
.onboard-points {
  list-style: none; padding: 0; margin: 0 0 16px;
  text-align: left; display: grid; gap: 8px;
}
.onboard-points li {
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  font-size: .9rem; color: var(--muted);
}
@keyframes onboardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.prem-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 4px;
}
.prem-months .chip-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 58px; padding: 10px 12px; border-radius: 14px;
  text-align: left; font-weight: 600;
}
.prem-months .chip-opt small {
  color: var(--muted); font-weight: 500; font-size: .75rem;
}
.prem-months .prem-m-top {
  display: flex; align-items: center; gap: 6px; width: 100%;
}
.prem-months .disc-badge {
  margin-left: auto;
  font-size: .68rem; font-weight: 700;
  color: #86efac; background: rgba(34,197,94,.15);
  padding: 2px 6px; border-radius: 999px;
}
.prem-months .chip-opt s { opacity: .55; margin-right: 2px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.tip-lede { margin: 0 0 10px; font-size: .82rem; }
.prem-tip-field { margin: 0 0 4px; }
.prem-tip-field select {
  width: 100%; min-height: 48px; font-weight: 600;
}
.prem-buy-burst {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(96,165,250,.28), transparent 55%);
  animation: premBurstFade .9s ease forwards;
}
.prem-buy-burst .burst-mark {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  color: #e0f2fe; text-shadow: 0 8px 30px rgba(59,130,246,.45);
  transform: scale(.7); animation: premBurstPop .7s cubic-bezier(.2,1.4,.3,1) forwards;
}
.prem-buy-burst.supporter {
  background: radial-gradient(circle at center, rgba(251,191,36,.32), transparent 58%);
}
.prem-buy-burst.supporter .burst-mark { color: #fef3c7; }
@keyframes premBurstPop {
  to { transform: scale(1); }
}
@keyframes premBurstFade {
  70% { opacity: 1; }
  to { opacity: 0; }
}
.tip-lede { margin: 0 0 10px; font-size: .8rem; line-height: 1.35; }
.tip-options {
  display: flex; flex-direction: column; gap: 8px; margin: 0 0 4px;
  max-height: min(42vh, 320px); overflow: auto; padding: 2px;
  scrollbar-width: thin; scrollbar-color: rgba(147,197,253,.35) transparent;
}
.tip-opt {
  display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 16px; text-align: left; color: inherit;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(96,165,250,.14), transparent 55%),
    linear-gradient(160deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.11);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition: border-color .16s ease, background .16s ease, transform .14s var(--ease), box-shadow .16s ease;
}
.tip-opt:active { transform: scale(.985); }
.tip-opt.on {
  border-color: rgba(96,165,250,.62);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(96,165,250,.28), transparent 58%),
    linear-gradient(135deg, rgba(59,130,246,.22), rgba(255,255,255,.04));
  box-shadow: 0 0 0 1px rgba(59,130,246,.22), 0 10px 28px rgba(15,23,42,.28), inset 0 1px 0 rgba(255,255,255,.16);
}
.tip-opt.tip-opt-hot.on {
  border-color: rgba(251,191,36,.55);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(251,191,36,.22), transparent 58%),
    linear-gradient(135deg, rgba(251,191,36,.16), rgba(59,130,246,.1));
}
.tip-badge {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  font-family: var(--font-display); font-size: .7rem; font-weight: 700;
  color: #bfdbfe; letter-spacing: -.02em;
  background: linear-gradient(145deg, rgba(59,130,246,.28), rgba(255,255,255,.04));
  border: 1px solid rgba(147,197,253,.28);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.tip-opt.on .tip-badge {
  color: #eff6ff;
  background: linear-gradient(145deg, rgba(59,130,246,.48), rgba(37,99,235,.22));
  border-color: rgba(191,219,254,.45);
}
.tip-opt.tip-opt-hot .tip-badge {
  color: #fde68a;
  background: linear-gradient(145deg, rgba(251,191,36,.28), rgba(59,130,246,.12));
  border-color: rgba(251,191,36,.35);
}
.tip-copy { min-width: 0; }
.tip-opt b { display: block; font-size: .9rem; letter-spacing: -.01em; }
.tip-opt small { color: var(--muted); font-size: .72rem; }
.tip-opt .tip-price {
  font-family: var(--font-display); font-weight: 650; white-space: nowrap;
  font-size: .84rem; color: #e2e8f0;
}
.tip-opt.on .tip-price { color: #f8fafc; }

.paywall-art { height: auto !important; object-fit: contain !important; object-position: center; background: #0b0f18; }

/* —— Съезды/обрезка: арт-картинки и длинные подписи —— */
img { max-width: 100%; height: auto; }
.auth-banner, .auth-hero img { object-position: center; }
.library-hero img, .notes-panel img { border-radius: 14px; }
.note-card-title, .sub-title, .lib-name, .deal-card b, .user-row b, .pay-row b {
  overflow-wrap: anywhere; word-break: break-word;
}
.abo-tpl b, .abo-tpl small { overflow-wrap: anywhere; }
.tab-strip, .paywall, .glass.panel, .chip { overflow-wrap: anywhere; }
/* Ни один блок в контенте не должен выезжать за экран на узких телефонах. */
#view-main .page,
#view-main .page * { max-width: 100%; }
#view-main .page img,
#view-main .page svg { height: auto; }
.top-shell-inner, #view-main .page { box-sizing: border-box; }

/* ============================================================
   Scrollbars — glass capsules, matching the Liquid Glass shell
   ============================================================ */
:root {
  --sb-thumb: rgba(178, 200, 255, 0.34);
  --sb-thumb-hover: rgba(198, 216, 255, 0.52);
  --sb-track: rgba(255, 255, 255, 0.035);
}

/* Firefox + new Chromium engines */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--sb-thumb) transparent;
}

/* На телефоне полоса прокрутки рисовалась поверх контента посередине экрана
   (видно на скриншоте профиля) — на тач-устройствах прячем её совсем. */
@media (hover: none) and (pointer: coarse) {
  * { scrollbar-width: none; }
  ::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none; }
}

/* WebKit / Blink — Telegram Android WebView and Telegram Desktop */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
  background: transparent;
}
::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(214, 228, 255, 0.46), rgba(120, 155, 230, 0.34));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  background-clip: padding-box;
  min-height: 36px;
}
::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, rgba(226, 238, 255, 0.66), rgba(140, 176, 255, 0.54));
}
::-webkit-scrollbar-corner { background: transparent; }

/* Panels with their own scroll container get a tiny inset so the capsule floats */
.glass,
.sheet-body,
.tip-options,
.cat-chips,
.admin-log,
.scroll-y {
  scrollbar-width: thin;
  scrollbar-color: var(--sb-thumb) transparent;
  overscroll-behavior: contain;
}

/* —— Модалки: клик по фону закрывает только «настоящий» `.modal` —— */
.modal-backdrop { z-index: 0; }
.modal-card { z-index: 1; }

/* —— Скелетоны вместо ложных нулей до первого ответа /dashboard —— */
.skel{display:inline-block;min-width:3ch;height:1em;border-radius:6px;vertical-align:-2px;
  background:linear-gradient(90deg,rgba(255,255,255,.06),rgba(255,255,255,.16),rgba(255,255,255,.06));
  background-size:200% 100%;animation:bp-skel 1.2s linear infinite}
@keyframes bp-skel{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.skel{animation:none}}

/* —— Шторка: затемнение при свайпе вниз —— */
.sheet-panel.dragging { animation: none; transition: none; }
.sheet.dragging .sheet-backdrop { opacity: calc(1 - var(--drag, 0) * .6); }

/* Horizontal chip rows: keep iOS-style hidden rail, but show a thin line on desktop */
@media (hover: hover) and (pointer: fine) {
  .cat-chips { scrollbar-width: thin; }
  .cat-chips::-webkit-scrollbar { display: block; height: 4px; }
  .cat-chips::-webkit-scrollbar-thumb { min-height: 0; background: rgba(147, 197, 253, 0.3); }
}

/* —— Readability pass —— */
.soft, .lib-hint, .subline, .cb-note { letter-spacing: 0.005em; }
.promo-strip span, .cb-sub { font-size: .8rem; }
button, .btn, .chip { -webkit-tap-highlight-color: transparent; }
:where(button, a, [role="button"]):focus-visible {
  outline: 2px solid rgba(142, 182, 255, 0.75);
  outline-offset: 2px;
  border-radius: 12px;
}

/* —— Шторка настройки цены/даты из Каталога (Liquid Glass) —— */
.lib-price-card { display: flex; flex-direction: column; gap: 12px; }
.lib-price-card h3 { margin: 0 0 2px; }
.lp-chips { gap: 7px; }
.lp-chips .chip {
  padding: 9px 12px; border-radius: 13px; font-size: .78rem; font-weight: 600;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--muted);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.lp-chips .chip:hover { border-color: rgba(147,197,253,.34); color: var(--text); }
.lp-chips .chip.on {
  color: #041018; background: linear-gradient(135deg, #93c5fd, #3b82f6); border-color: transparent;
  box-shadow: 0 8px 18px rgba(37,99,235,.2);
}
.lp-row { display: grid; gap: 10px; }
#lib-date-input { color-scheme: dark; }
#lib-price-hint { min-height: 1.2em; }

/* —— Виджет канала @billpingnews в Профиле —— */
.news-card { margin-top: 6px; }
.news-card .cb-actions { grid-template-columns: 1fr 1fr; }
.news-card .cb-btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* —— Опрос: полоски вместо сырого JSON —— */
#admin-survey-stats { display: grid; gap: 14px; }
.survey-block { display: grid; gap: 7px; }
.survey-block-title { margin: 0; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.survey-bar-row { display: grid; grid-template-columns: minmax(72px, 34%) 1fr auto; align-items: center; gap: 9px; }
.survey-bar-label { font-size: .8rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.survey-bar-track {
  height: 9px; border-radius: 999px; overflow: hidden;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09);
}
.survey-bar-track > i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #93c5fd, #3b82f6);
  box-shadow: 0 0 14px rgba(59,130,246,.35);
  transition: width .35s cubic-bezier(.22,1,.36,1);
}
.survey-bar-val { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--muted); }

/* —— Карточка подписки: явная аффорданс-подсказка при нажатии —— */
.sub-card::after {
  content: "изменить";
  position: absolute; right: 14px; bottom: 8px;
  font-size: .62rem; letter-spacing: .04em; text-transform: lowercase;
  color: var(--muted); opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}
.sub-card:active::after, .sub-card:focus-visible::after { opacity: .75; }

/* —— Шаги пополнения: пройдено ≠ текущий —— */
.topup-steps { align-items: center; }
.topup-steps span { position: relative; transition: all .2s ease; }
.topup-steps span.done {
  color: #86efac; border-color: rgba(134,239,172,.45);
  background: rgba(34,197,94,.14);
  font-size: 0; /* номер прячем, показываем галочку */
}
.topup-steps span.done::after {
  content: "✓"; font-size: .8rem; font-weight: 800;
}
.topup-steps span.current {
  color: #0b1220; background: linear-gradient(135deg, #fde68a, #fbbf24);
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(251,191,36,.16), 0 6px 16px rgba(251,191,36,.22);
  transform: scale(1.06);
}
.topup-steps span:not(.done):not(.current) { opacity: .55; }
/* Соединительные линии между шагами */
.topup-steps span + span::before {
  content: ""; position: absolute; left: -9px; top: 50%;
  width: 8px; height: 1px; background: rgba(255,255,255,.16);
}

/* —— Палец должен попадать: крестик удаления ≥ 44×44 px —— */
.note-card-actions .note-del-btn {
  min-width: 44px; min-height: 44px;
  display: grid; place-items: center;
  font-size: .95rem; line-height: 1;
  padding: 0;
}
.note-card-actions .mini-btn { min-height: 44px; }

/* —— Premium 12 мес: «1 362 ₽ • 1045 ★» не переносится —— */
.prem-months .chip-opt small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: clamp(.68rem, 2.6vw, .76rem);
}
.prem-months .chip-opt { min-width: 0; }

/* —— Баннеры разделов: тонкая подстройка цвета кадра ——
   Геометрия (радиус, обрезка, поля) — только в блоке «glass7» ниже.
   Текст поверх кадра больше не рисуем, поэтому градиентных плашек нет. */
.tab-strip img { filter: brightness(.97) saturate(1.04); }

/* —— Все разделы ниже шапки: маленький зазор, основной отступ уже в .page —— */
.page > .section-head:first-child,
.page > .abo-seg:first-child,
.page > .library-hero:first-child,
.page > .topup-card:first-child {
  margin-top: 0;
}
#page-topup, #page-pills, #page-abonements, #page-legal {
  padding-top: 0;
}
#page-topup.active, #page-abonements.active, #page-legal.active {
  padding-top: 0;
}
.page > .section-head { align-items: center; }
.page > .section-head h3 { margin: 0; }

/* —— Кнопки профиля: одна стеклянная семья вместо разношёрстных —— */
#page-profile .btn.block {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  box-shadow: 0 1px 0 rgba(255,255,255,.09) inset, 0 10px 24px rgba(3,7,16,.22);
  min-height: 48px;
  font-weight: 600;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
#page-profile .btn.block:active { transform: scale(.985); }
#page-profile .btn.block.secondary {
  border-color: rgba(147,197,253,.34);
  background: linear-gradient(135deg, rgba(59,130,246,.22), rgba(59,130,246,.1));
  color: #e8f1ff;
}
#page-profile .btn.block.ghost:not(.primary) {
  border-color: rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(226,232,240,.92);
}
#page-profile #btn-logout {
  border-color: rgba(248,113,113,.26);
  background: rgba(248,113,113,.08);
  color: #fecaca;
}
#page-profile .btn.block.hidden { display: none; }

/* —— Ссылка реферала: не обрезается, читается целиком —— */
#referral-link {
  font-size: .8rem;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  min-width: 0;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
#referral-link:focus { text-overflow: clip; }


/* —— Планы и пробные периоды в карточке цены —— */
#lib-plans { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 6px; }
#lib-plans[hidden] { display: none !important; }
.lib-plans-title {
  margin: 0;
  font-size: .78rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: rgba(148,163,184,.9);
}
.lib-plans-title small {
  text-transform: none;
  letter-spacing: 0;
  font-size: .8rem;
  color: rgba(180,193,210,.85);
}
.lib-plan-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: rgba(226,232,240,.92);
  font-size: .88rem;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.plan-chip:active { transform: scale(.97); }
.plan-chip.on {
  border-color: rgba(96,165,250,.6);
  background: rgba(96,165,250,.14);
  color: #e2e8f0;
}
.plan-chip small { font-size: .76rem; color: rgba(226,232,240,.72); }
.plan-chip.on small { color: #bfdbfe; }
.plan-chip .plan-price { font-variant-numeric: tabular-nums; color: rgba(226,232,240,.7); }
.plan-chip.on .plan-price { color: #bfdbfe; }
.plan-chip .plan-save {
  font-size: .74rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(52,211,153,.2);
  color: #a7f3d0;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.plan-chip.trial {
  border-style: dashed;
  border-color: rgba(251,191,36,.32);
  background: rgba(251,191,36,.07);
  color: #fde68a;
}
.plan-chip.trial.on {
  border-color: rgba(251,191,36,.7);
  background: rgba(251,191,36,.16);
}
.trial-note {
  margin: 2px 0 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(251,191,36,.09);
  border: 1px solid rgba(251,191,36,.22);
  color: #fde68a;
  font-size: .84rem;
  line-height: 1.45;
}
.trial-note[hidden] { display: none !important; }

/* —— Напоминания: вкладка в нижнем меню, точка-счётчик на иконке —— */
.nav-btn .nav-dot {
  position: absolute; top: 6px; right: 50%; transform: translateX(16px);
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: .58rem; font-weight: 700; line-height: 1; color: #fff;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  box-shadow: 0 0 0 2px rgba(10,14,22,.9);
}
.nav-btn .nav-dot.hidden { display: none; }

/* Premium: «разовая оплата» стоит прямо под плюсами — это главный ответ на вопрос «а не спишут ли» */
.perk-once {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: .84rem;
  line-height: 1.35;
  color: var(--text);
  background: rgba(79, 140, 255, 0.1);
  border: 1px solid rgba(79, 140, 255, 0.28);
}
.perk-once b { color: var(--accent-2); }

/* Лайфхаки живут в своей модалке и больше не раздувают страницу Premium */
.deals-card {
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 18px 18px 22px;
}
/* —— Лайфхаки: читаемые карточки вместо строки «сервис · совет» —— */
.deals-sum {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 0 14px; padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(52,211,153,.16), rgba(16,185,129,.06));
  border: 1px solid rgba(52,211,153,.3);
}
.deals-sum span { color: var(--muted); font-size: .78rem; }
.deals-sum b { font-family: var(--font-display); font-size: 1.24rem; color: #6ee7b7; }
.deals-list .deal-card {
  position: relative;
  display: flex; gap: 12px; padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
}
.deals-list .deal-card.locked { opacity: .92; }
.deal-icon {
  width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: .84rem; font-weight: 700; color: #fff;
}
.deal-body { min-width: 0; flex: 1; }
.deal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.deal-top b { font-size: .9rem; line-height: 1.25; }
.deal-save { color: #6ee7b7; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.deal-service { margin: 3px 0 0; color: var(--muted); font-size: .74rem; }
.deal-tip { margin: 7px 0 0; font-size: .82rem; line-height: 1.42; color: var(--text); }
.deal-lock {
  position: absolute; top: 10px; right: 10px;
  font-size: .8rem; color: #fbbf24;
}
.deal-empty {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 28px 18px; border-radius: 18px;
  background: rgba(255,255,255,.035); border: 1px dashed rgba(255,255,255,.14);
}
.deal-empty-ico { font-size: 1.8rem; }
.deal-empty p { margin: 0; max-width: 30ch; color: var(--muted); font-size: .82rem; line-height: 1.4; }
/* Тихая строка-вход на Главной */
.metric-deals {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-top: 12px;
}
.metric-deals-body { display: flex; align-items: center; gap: 11px; min-width: 0; }
.metric-deals-ico { font-size: 1.15rem; }
.metric-deals b { display: block; font-size: .88rem; }
.metric-deals p { margin: 2px 0 0; color: var(--muted); font-size: .74rem; line-height: 1.3; }
.deals-teaser-body { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.deals-teaser-ico { font-size: 1.3rem; }
.deals-head { margin-bottom: 6px; }
.deals-headline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }

/* Мягкий лимит бесплатного режима — строка, а не огромный замок */
.rem-limit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: .8rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--line);
}
.rem-limit[hidden] { display: none; }

.reminders-jump { margin-top: 10px; }

/* Полоса акции «Первые 15» с живым счётчиком */
.promo-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.promo-strip [data-promo-count] {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.16);
  color: var(--warn);
  white-space: nowrap;
}
.promo-strip[hidden] { display: none; }

/* —— Рефералка: уровни и процент —— */
.ref-legend b { color: var(--text); }
.ref-box { display: flex; flex-direction: column; gap: 12px; }
.ref-now { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ref-now div {
  padding: 10px 8px;
  border-radius: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.ref-now span { display: block; font-size: .7rem; color: var(--muted); line-height: 1.2; }
.ref-now b { display: block; margin-top: 4px; font-size: 1.02rem; font-family: var(--font-display); }
.ref-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ref-tier {
  padding: 8px 4px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--line);
  opacity: .55;
}
.ref-tier b { display: block; font-size: .95rem; }
.ref-tier small { display: block; font-size: .66rem; color: var(--muted); line-height: 1.15; }
.ref-tier.done { opacity: 1; border-color: rgba(52, 211, 153, .45); background: rgba(52, 211, 153, .1); }
.ref-tier.next { opacity: 1; border-color: rgba(79, 140, 255, .55); background: rgba(79, 140, 255, .1); }
.ref-hint { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.ref-hint.ok { color: var(--ok); }

/* ============================================================
   Сотрудники и панель поддержки
   ============================================================ */
.staff-role-pick {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 10px 0 12px;
}
.staff-role-pick .cat-chip { min-height: 40px; }
.staff-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
}
.staff-row .meta { min-width: 0; flex: 1 1 auto; }
.staff-row .meta b { display: block; font-size: .9rem; }
.staff-row .meta small { display: block; color: var(--muted); font-size: .72rem; line-height: 1.35; overflow-wrap: anywhere; }
.staff-actions { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.staff-actions .chip { min-height: 32px; padding: 5px 10px; font-size: .74rem; }
.chip.danger { color: #fca5a5; border-color: rgba(248,113,113,.42); }

/* Хелперу показываем только очередь тикетов */
#page-admin.support-only .glass.panel.helper-hidden,
#page-admin.support-only .stat-grid.helper-hidden,
#page-admin.support-only .admin-pane.helper-hidden { display: none !important; }
/* Хелпер не должен видеть ни статистику аккаунтов, ни вкладки разделов. */

/* —— Админка: разделы вместо ленты из десяти блоков —— */
.admin-head { align-items: flex-start; }
.admin-sub { margin: 2px 0 0; font-size: .78rem; }
.admin-seg {
  display: flex; gap: 6px; margin: 14px 0 16px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-seg::-webkit-scrollbar { display: none; }
.admin-seg-btn {
  flex: 1 0 auto;
  padding: 10px 12px; border-radius: 13px;
  font-size: .78rem; font-weight: 600; color: var(--muted);
  white-space: nowrap;
  transition: background .16s ease, color .16s ease;
}
.admin-seg-btn.on {
  color: var(--text);
  background: rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.admin-seg-btn:active { transform: scale(.97); }
.admin-pane.hidden { display: none !important; }
.admin-search { margin-bottom: 12px; }
/* Простая таблица приходов с рекламы */
.admin-table { display: flex; flex-direction: column; gap: 8px; }
.admin-table-row {
  display: grid; grid-template-columns: 1.4fr .6fr .6fr .6fr; gap: 8px;
  align-items: center;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,.035);
  border: 1px solid var(--line);
  font-size: .78rem;
}
.admin-table-row.head {
  background: transparent; border: none; padding: 0 12px;
  color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
}
.admin-table-row b { font-size: .82rem; }
.admin-table-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table-empty {
  padding: 18px; text-align: center; color: var(--muted); font-size: .8rem;
  border-radius: 14px; border: 1px dashed rgba(255,255,255,.14);
}
#page-admin.support-only { padding-top: var(--bp-nav-to-content, 16px); }

/* —— Панель поддержки: шапка со счётчиками, клиент, заметки —— */
.support-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  margin: 4px 0 12px;
}
.support-stats .stat-card {
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.09);
}
.support-stats .stat-card .k { font-size: .64rem; color: var(--muted); margin: 0; }
.support-stats .stat-card .v { font-size: 1.05rem; font-weight: 700; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.support-stats .stat-card .s { font-size: .6rem; color: var(--muted); margin: 1px 0 0; }

#ticket-client {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  margin: 2px 0 10px; font-size: .72rem;
}
#ticket-client span {
  padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.ticket-msg.system { background: transparent; border-color: transparent; padding: 4px 2px; }
.ticket-msg.system p { color: var(--muted); font-style: italic; font-size: .76rem; }
.ticket-msg.note {
  background: rgba(250,204,21,.1);
  border-color: rgba(250,204,21,.28);
}
.ticket-msg.note p { color: #fde68a; }

.ticket-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  /* 48 px по высоте и запрет переноса — «запаянные» строки не плывут на узком экране */
  min-height: 56px; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  width: 100%; text-align: left; cursor: pointer;
  padding: 12px 13px; border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.1);
  color: inherit; font: inherit;
  transition: transform .14s var(--ease), background .16s ease;
}
@media (hover: hover) { .ticket-row:hover { background: rgba(255,255,255,.075); } }
.ticket-row:active { transform: scale(.99); }
.ticket-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; }
.ticket-main b { font-size: .88rem; }
.ticket-main small { color: var(--muted); font-size: .71rem; }
.ticket-preview {
  color: var(--muted); font-size: .78rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ticket-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: 0 0 auto; }
.ticket-row .chip { flex: 0 0 auto; align-self: flex-start; font-size: .68rem; }
.ticket-row.mine { border-color: rgba(96,165,250,.38); background: rgba(37,99,235,.1); }
.ticket-row.closed { opacity: .78; }
.ticket-main small em.wait { font-style: normal; color: #fbbf24; font-weight: 600; }
.ticket-busy-hint,
.ticket-closed-box {
  padding: 10px 12px; border-radius: 14px; margin-bottom: 10px;
  font-size: .78rem; line-height: 1.45; color: var(--muted);
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1);
}
.ticket-busy-hint { color: #fcd34d; border-color: rgba(251,191,36,.28); background: rgba(251,191,36,.08); }
.ticket-closed-box { display: flex; flex-direction: column; gap: 3px; }
.ticket-closed-box b { color: var(--text); }
.ticket-busy-hint[hidden],
.ticket-closed-box[hidden] { display: none !important; }

/* «Написать в @BillPingsupbot»: из карточки тикета — сразу в тот чат клиента */
.sup-tg {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 10px; text-decoration: none;
  color: #93c5fd; border-color: rgba(96,165,250,.32); background: rgba(96,165,250,.08);
}
.sup-tg[hidden] { display: none !important; }
.sup-tg-ico { width: 17px; height: 17px; }

/* Раскрыть вкладки «Тикеты», когда панель уже открыта на другом разделе */
@keyframes flash-now {
  0% { box-shadow: 0 0 0 0 rgba(96,165,250,.55); }
  100% { box-shadow: 0 0 0 12px rgba(96,165,250,0); }
}
.flash-now { animation: flash-now .6s ease-out 2; }
.accent-tip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-bottom: 12px; border-radius: 14px;
  font-size: .78rem; color: var(--muted);
  background: rgba(96,165,250,.08); border: 1px solid rgba(96,165,250,.24);
}
.accent-tip button { flex: none; min-height: 32px; padding: 0 12px; }
.accent-tip[hidden] { display: none !important; }

.ticket-thread {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 44vh; overflow-y: auto; padding: 4px 2px 6px;
  margin-bottom: 10px;
}
.ticket-msg {
  max-width: 86%; padding: 9px 12px; border-radius: 15px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  overflow-wrap: anywhere;
}
.ticket-msg.mine {
  align-self: flex-end;
  background: linear-gradient(165deg, rgba(79,140,255,.28), rgba(79,140,255,.14));
  border-color: rgba(79,140,255,.36);
}
.ticket-msg .tmeta { display: block; font-size: .66rem; color: var(--muted); margin-bottom: 3px; }
.ticket-msg p { margin: 0; font-size: .86rem; line-height: 1.4; white-space: pre-wrap; }

/* Префиксы ролей: цвет — единственное, что отличает хелпера от владельца в чате. */
.role-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px; margin-right: 5px;
  font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  border: 1px solid transparent; vertical-align: 1px;
}
.role-badge.r-owner { color: #fde68a; background: rgba(250, 204, 21, .16); border-color: rgba(250, 204, 21, .38); }
.role-badge.r-helper { color: #6ee7b7; background: rgba(16, 185, 129, .16); border-color: rgba(16, 185, 129, .38); }
.role-badge.r-tester { color: #c4b5fd; background: rgba(139, 92, 246, .18); border-color: rgba(139, 92, 246, .42); }
.role-badge.r-admin  { color: #93c5fd; background: rgba(59, 130, 246, .16); border-color: rgba(59, 130, 246, .38); }
.ticket-sheet #ticket-claim-row { margin-bottom: 10px; }
.ticket-sheet #ticket-claim-row button { min-height: 44px; }

/* Ранний доступ тестировщиков — бейдж на карточке каталога */
.lib-badge {
  display: inline-block;
  margin-left: 6px; padding: 2px 7px;
  border-radius: 8px;
  font-size: .64rem; font-weight: 650; letter-spacing: .01em;
  color: #bbf7d0;
  background: rgba(52, 211, 153, .16);
  border: 1px solid rgba(52, 211, 153, .38);
  vertical-align: middle;
}

/* —— Показать весь каталог: второстепенная кнопка под полкой —— */
.lib-show-all {
  display: block; width: 100%; margin: 10px 0 0;
  padding: 12px 14px; border-radius: 16px;
  font-size: .82rem; font-weight: 600; letter-spacing: .01em;
  color: #c7d7ff;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  transition: background .16s ease, border-color .16s ease, transform .16s var(--ease);
}
.lib-show-all:active { transform: scale(.99); background: rgba(255,255,255,.09); border-color: rgba(147,197,253,.4); }
.lib-show-all.hidden { display: none; }

/* —— Узкие экраны: шапка и вывеска акции не должны распирать вьюпорт —— */
@media (max-width: 380px) {
  .brand-word { font-size: 1rem; }
  .promo-strip-cta { gap: 9px; padding: 11px 12px; }
  .promo-strip-ico { width: 30px; height: 30px; border-radius: 10px; font-size: 1rem; }
  .promo-strip-text b { font-size: .8rem; }
  .promo-strip-text span { font-size: .7rem; }
  .promo-strip-go { width: 23px; height: 23px; font-size: .72rem; }
}

/* —— Подсказка после «добавить в один тап» —— */
.sub-added-hint {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  margin: 10px 0 0; padding: 13px 14px; border-radius: 18px;
  border: 1px solid rgba(16, 185, 129, .32);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(16,185,129,.18), transparent 60%),
    linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 22px rgba(3,7,16,.32);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  animation: rise .3s var(--ease) both;
}
.sub-added-hint.hidden { display: none; }
.sub-added-hint b { font-family: var(--font-display); font-size: .84rem; color: #6ee7b7; }
.sub-added-hint span { color: rgba(226,232,240,.82); font-size: .76rem; line-height: 1.4; }
.sub-added-hint-x {
  align-self: flex-end; margin-top: 2px;
  padding: 5px 12px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  color: #6ee7b7; background: rgba(16,185,129,.14);
  border: 1px solid rgba(16,185,129,.34);
}

/* Слой тикета в админке: своя шторка, чтобы разговор не делил место с формой подписки */
.ticket-layer {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: flex-end; justify-content: center;
}
.ticket-layer.open { display: flex; }
.ticket-layer[hidden] { display: none !important; }
.ticket-layer-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.58); backdrop-filter: blur(6px); cursor: pointer;
}
/* Открытая карточка тикета — самостоятельный слой: гасим прокрутку страницы
   под ним, иначе фон уезжает и кажется, что панель «съехала». */
.ticket-layer-panel {
  position: relative; width: min(560px, 100%); max-height: min(92vh, 860px);
  display: flex; flex-direction: column; overflow: hidden;
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  padding: 8px 0 calc(12px + var(--safe-b)); animation: rise .26s var(--ease) both; z-index: 1;
  overscroll-behavior: contain;
}
/* Ширину панель забирает целиком (width: 100% перебивается раскладкой flex),
   поэтому на неё не надо опираться: только на собственный overflow. */
.ticket-layer-panel .sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 18px; }
.ticket-layer-panel .sheet-head .sheet-close { flex: 0 0 auto; }
.ticket-layer-panel .sheet-head h3 { margin: 0; flex: 1; min-width: 0; }
.ticket-sheet {
  overflow-y: auto; padding: 0 18px; display: flex; flex-direction: column; gap: 10px;
  /* Держим собственную высоту: иначе при открытии клавиатуры тело схлопывается
     и окно кажется уехавшим вверх. */
  flex: 1 1 auto; min-height: 0; max-height: calc(92vh - 130px);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.ticket-sheet > .btn { flex: 0 0 auto; }
.ticket-sheet .field { margin: 0; }

/* ============================================================
   Liquid Glass · шаг «баннеры разделов» (glass7)
   Один блок: отступы страниц, мини-бар, баннеры-шапки, промо на
   Главной, карточки денег и вторичный блок экономии.
   ============================================================ */

/* —— 1. Отступы: первый блок страницы сразу под мини-баром —— */
/* Верхний зазор держит только padding .page (16 px после навигации), первый
   блок идёт без собственного margin-top: иначе к 16 px добавлялась вторая
   «шовная» полоса. */
#view-main .page > * { margin-top: 0; margin-bottom: 0; }
#view-main .page > * + * { margin-top: var(--gap-block); }
#view-main .page > .tab-strip { margin: 0 0 var(--gap-after-bar); }
.stack { gap: var(--gap-block); }
#view-main .glass.panel,
#view-main .metric { margin-bottom: 0; }
#page-admin .glass.panel,
#page-profile .glass.panel { margin-bottom: 0; }
.admin-pane > * + * { margin-top: var(--gap-block); }

/* —— 2. Верхний мини-бар: одна сетка, одинаковые ячейки —— */
.tabbar.island {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
  border-radius: 20px;
}
.tabbar.admin-on { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nav-btn {
  min-width: 0;
  height: auto;
  min-height: calc(var(--bp-nav-h) - 8px);
  padding: 4px 1px 4px;
  gap: 3px;
  justify-content: center;
  border-radius: 16px;
  transition: color .2s ease, background .2s ease;
}
.nav-btn .nav-ico { width: 21px; height: 21px; flex-shrink: 0; }
.nav-btn .nav-lbl {
  display: block;
  max-width: 100%;
  font-size: .56rem;
  line-height: 1.1;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.tabbar.admin-on .nav-btn .nav-lbl { font-size: .53rem; }
@media (max-width: 359px) {
  .nav-btn .nav-lbl { font-size: .52rem; letter-spacing: -.02em; }
}
/* Активная вкладка — тонкая стеклянная подложка, а не заливка */
.nav-indicator {
  border-radius: 15px;
  background: linear-gradient(170deg, rgba(255,255,255,.16), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.20), 0 2px 8px rgba(3,7,16,.22);
}
.nav-btn:focus-visible,
.icon-btn:focus-visible,
.avatar-btn:focus-visible { outline: 2px solid rgba(147,197,253,.7); outline-offset: 2px; }
.nav-btn[hidden] { display: none !important; }

/* —— 3. Баннер раздела: PNG-карточка вровень с соседними панелями —— */
/* Единственное место, где описана геометрия баннера. Холст PNG подрезан
   скриптом scripts/trim_banner_png.py (ultimately 1 px полупрозрачной кромки),
   поэтому картинка занимает всю ширину страницы и встаёт по тем же полям,
   что и .glass-карточки: page-side = --gap-edge, radius = --radius.
   height приходит из пропорций файла, атрибуты width/height в index.html
   нужны только чтобы не прыгала вёрстка до загрузки. */
.tab-strip {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: none;
  box-shadow: none;
  margin: 0 0 var(--gap-after-bar);
  filter: drop-shadow(0 10px 22px rgba(2, 6, 14, .38));
}
.tab-strip img {
  display: block;
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  background: none;
}
.abo-strip, .lib-strip, .rem-strip, .prem-strip, .adm-strip {
  margin-bottom: var(--gap-after-bar);
}

/* —— 4. Промо-карточка «Premium на месяц бесплатно» ——
   Одна карточка на Главную: рабочий баннер 3:1 сверху, под ним счётчик акции,
   пояснение и одно действие в канал. Раньше их было две — отдельная полоса
   promo-premium.png и карточка с растянутым promo-glass.png (447 px по высоте
   на 3:1-холсте), отсюда огромный «битый» прямоугольник под баннером. */
.promo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;      /* ровно 16 px до блока расходов */
  padding: 16px;
  border-radius: var(--bp-radius-card);
  border: 1px solid var(--bp-card-line);
  background: var(--bp-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 10px 26px rgba(3, 7, 16, .38);
  isolation: isolate;
  overflow: hidden;
}
.promo-card.hidden,
.promo-card[hidden] { display: none !important; }
#page-home > .promo-card + .hero-stat { margin-top: 16px; }

/* Баннер: ширина 100%, высота из исходных пропорций файла (3:1). Никакого
   cover — из картинки не вырезается ни одна строка акции. */
.promo-card-art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 986 / 275;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
}
/* Резервное оформление, если баннер не загрузился: композиция из текста
   акции и действия, без иконки сломанной картинки и без пустоты. */
.promo-card-fallback {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 986 / 275;
  padding: 16px 18px;
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 88% 10%, rgba(255, 195, 41, .22), transparent 62%),
    linear-gradient(160deg, #272b37, #151924);
  border: 1px solid rgba(255, 233, 139, .22);
}
.promo-card.is-broken .promo-card-art { display: none; }
.promo-card.is-broken .promo-card-fallback { display: flex; }
.promo-card-fallback b {
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--bp-text);
}
.promo-card-fallback span { font-size: .8rem; line-height: 1.35; color: var(--bp-text-2); }

.promo-card-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  max-width: 100%;
  margin: 0;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  color: #fff3cf;
  background: rgba(255, 195, 41, .14);
  border: 1px solid rgba(255, 233, 139, .34);
}
.promo-card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.28;
  letter-spacing: -.02em;
  color: var(--bp-text);
  text-wrap: balance;
}
.promo-card-sub {
  margin: 0;
  font-size: .82rem;
  line-height: 1.42;
  color: var(--bp-text-2);
  max-width: 40ch;
}
.promo-card-cta {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--bp-radius-field);
  text-align: left;
  font-size: .88rem;
  font-weight: 650;
  letter-spacing: -.01em;
  color: #071022;
  background: var(--bp-primary);
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 6px 16px rgba(33, 96, 237, .30), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .16s var(--ease), filter .16s ease;
}
.promo-card-cta > span:first-of-type {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.promo-card-tg { width: 19px; height: 19px; flex-shrink: 0; color: #0b1a33; }
.promo-card-go {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: .82rem;
  font-weight: 800;
  color: #f8fafc;
  background: rgba(9, 14, 23, .55);
}
.promo-card-cta:hover { filter: brightness(1.03); }
.promo-card-cta:active { transform: scale(.985); filter: brightness(.98); }
.promo-card-cta:focus-visible { outline: 2px solid var(--bp-accent); outline-offset: 3px; }

/* Телефон: карточка акции не должна съедать первый экран. Баннер и текст
   сжимаются, кнопка остаётся полноценной. */
@media (max-width: 640px) {
  .promo-card { padding: 12px; gap: 10px; }
  .promo-card-title { font-size: .92rem; line-height: 1.22; }
  .promo-card-sub { display: none; }
  .promo-card-cta { min-height: 48px; font-size: .82rem; }
}

/* Старая полоса акции на втором экране не нужна: промо живёт на Главной */
#promo-first5-banner { display: none !important; }

/* —— 5. Деньги: карточка расходов, баланс с «+» внутри, статус —— */
.hero-stat { padding: 16px 18px; }
.hero-stat .label { margin: 0 0 2px; }
.big-number { margin: 2px 0 0; }
.metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0 0;
  align-items: stretch;
}
.metric {
  padding: 12px 14px 13px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}
.metric-head > span { color: var(--muted); font-size: .74rem; }
.metric i { font-style: normal; }
.metric .metric-amount {
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.25;
  margin-top: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric .metric-trust { display: block; font-size: .92rem; line-height: 1.2; margin-top: 2px; }
.metric .metric-trust-sub { display: block; margin-top: 2px; color: var(--muted); font-size: .72rem; line-height: 1.3; }
/* «+» внутри карточки баланса: компактное стекло 30×30, зона нажатия 44×44
   за счёт невидимого ::after. Логику пополнения не трогаем. */
.bal-plus {
  position: relative;
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #e0ecff;
  background: linear-gradient(160deg, rgba(255,255,255,.20), rgba(255,255,255,.06));
  border: 1px solid rgba(147,197,253,.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 2px 8px rgba(3,7,16,.24);
  transition: transform .15s var(--ease), background .15s ease, border-color .15s ease;
}
.bal-plus::after { content: ""; position: absolute; inset: -7px; border-radius: 14px; }
.bal-plus svg { width: 16px; height: 16px; display: block; }
.bal-plus:hover { background: linear-gradient(160deg, rgba(255,255,255,.26), rgba(255,255,255,.10)); }
.bal-plus:active { transform: scale(.92); }
.bal-plus:focus-visible { outline: 2px solid rgba(147,197,253,.8); outline-offset: 3px; }

/* —— 6. «Экономьте на подписках»: вторичная карточка действия —— */
.metric-deals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  margin: 12px 0 0;
  border-radius: 18px;
  border: 1px solid rgba(147, 165, 255, .20);
  background:
    radial-gradient(130% 160% at 0% 0%, rgba(99, 102, 241, .18), transparent 62%),
    linear-gradient(150deg, rgba(255,255,255,.085), rgba(255,255,255,.025));
}
.metric-deals-body { display: flex; align-items: center; gap: 11px; min-width: 0; }
.metric-deals-ico--svg {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 11px;
  color: #c7d2fe;
  background: linear-gradient(160deg, rgba(129,140,248,.34), rgba(79,70,229,.16));
  border: 1px solid rgba(165,180,252,.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.metric-deals-ico--svg svg { width: 18px; height: 18px; display: block; }
.metric-deals b { display: block; font-size: .86rem; letter-spacing: -.01em; }
.metric-deals p { margin: 2px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.35; }
.deals-go {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 650;
  color: #e0e7ff;
  background: linear-gradient(160deg, rgba(255,255,255,.16), rgba(255,255,255,.055));
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transition: transform .15s var(--ease), background .15s ease;
}
.deals-go::after { content: "→"; font-size: .86rem; opacity: .9; }
.deals-go:active { transform: scale(.95); }
.deals-go:focus-visible { outline: 2px solid rgba(165,180,252,.8); outline-offset: 3px; }

/* —— 7. Лимит бесплатного тарифа: только FREE, без пустой высоты —— */
.free-limit-note {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 13px;
  font-size: .76rem;
  line-height: 1.35;
  color: rgba(226,232,240,.78);
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(255,255,255,.12);
}
.free-limit-note[hidden] { display: none !important; }
.free-limit-note b { color: #dbeafe; font-weight: 650; }
.free-limit-note .fln-go { color: #93c5fd; font-weight: 650; cursor: pointer; }

/* —— 8. Premium-страница: шапка-баннер вместо обрезанного арта —— */
.paywall { padding: 0; overflow: hidden; margin-bottom: 0; }
.paywall-art { display: none !important; }
.paywall-body { padding: 18px; }
.paywall-body .paywall-badge { margin-bottom: 10px; }

/* —— 9. Ширины: аккуратные поля на планшете, ничего не вылезает —— */
@media (min-width: 600px) {
  #view-main .page {
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
  }
}
#view-main .page .promo-card,
#view-main .page .metric-deals { max-width: 100%; }
@media (max-width: 360px) {
  .promo-card { padding: 13px 13px 14px; }
  .promo-card-title { font-size: .98rem; }
  .promo-card-cta { font-size: .8rem; }
  .metrics-row { gap: 10px; }
  .metric { padding: 11px 12px 12px; }
}

/* Шапка sticky и занимает своё место в потоке: сверху ровно 16 px, без
   повторного резерва --shell-h (он же и был источником мёртвой полосы). */
#view-main .page { padding-top: var(--bp-nav-to-content, 16px); }

/* —— Баннер раздела — первый блок экрана ——
   Сверху только поле страницы (--top-offset), снизу один шаг сетки.
   Раньше к нему прибавлялся «-отступ соседнего блока» из #view-main .page > * + *,
   отсюда лишняя полоса над баннером. Селектор ниже по файлу и специфичнее,
   поэтому работает и для баннера внутри main, и на Главной с промо-карточкой. */
#view-main .page > .tab-strip,
#view-main .page > .tab-strip + * {
  margin-top: 0;
  margin-bottom: var(--gap-block);
}

/* —— Напоминания: пустое состояние, тихий режим, дни приёма —— */
.rem-empty { display: grid; gap: 14px; padding: 14px 2px 4px; }
.rem-empty-hero { display: flex; gap: 14px; align-items: flex-start; }
.rem-empty-ico {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.35rem;
  background: color-mix(in srgb, var(--accent, #4b8bff) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #4b8bff) 28%, transparent);
}
.rem-empty-hero h3 { font-family: var(--font-display); margin: 2px 0 6px; }
.rem-empty-hero p { color: var(--muted); margin: 0; max-width: 46ch; line-height: 1.45; }
.rem-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rem-empty-actions .btn { padding: 10px 16px; }
.rem-empty-hint { font-size: .86rem; }
.rem-silent-note {
  margin: 10px 0 0; font-size: .86rem; color: var(--muted);
  display: flex; gap: 8px; align-items: flex-start;
}
.note-weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.note-weekdays .chip { min-width: 44px; justify-content: center; }
.note-weekdays .chip.on {
  background: color-mix(in srgb, var(--accent, #4b8bff) 26%, transparent);
  border-color: color-mix(in srgb, var(--accent, #4b8bff) 48%, transparent);
  color: var(--text, #fff);
}

/* —— 5b. Главная: расходы по категориям и ровные отступы карточек ——— */
/* Одна сетка отступов на всю карточку: 16px по краям и между блоками.
   Раньше «В месяц уходит» дышало 18px, а карточки под ним — 14px. */
.hero-stat { padding: 15px 16px 14px; }
.hero-stat .hero-stat-top { align-items: flex-start; gap: 12px; }
.hero-stat .label { margin: 0; font-size: .76rem; letter-spacing: .01em; }
.hero-stat .big-number { margin: 3px 0 0; }
.hero-stat .subline { margin: 4px 0 0; font-size: .8rem; }
.hero-stat .mini-ring { width: 44px; height: 44px; border-radius: 14px; flex: 0 0 auto; }

.spend-cats { display: grid; gap: 8px; margin-top: 12px; }
.spend-cats-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: .72rem; color: var(--muted); letter-spacing: .01em;
}
.spend-cats-head button {
  border: 0; background: none; color: #93c5fd; font-size: .72rem; font-weight: 600;
  padding: 2px 0; cursor: pointer;
}
.cat-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  column-gap: 10px; row-gap: 5px;
}
.cat-line .cat-name {
  font-size: .76rem; color: rgba(245,247,251,.86);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cat-line .cat-sum {
  font-size: .76rem; font-variant-numeric: tabular-nums;
  color: rgba(245,247,251,.94); font-weight: 600;
}
.cat-line .cat-mini {
  grid-column: 1 / -1;
  height: 5px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden;
}
.cat-line .cat-mini > i { display: block; height: 100%; border-radius: inherit; }
.cat-line.is-rest .cat-name, .cat-line.is-rest .cat-sum { color: var(--muted); font-weight: 500; }
.cat-line.is-rest .cat-mini > i { background: rgba(255,255,255,.24); }
/* Аналогия — тот же 12px ритм, без «шва» внизу карточки. */
.hero-stat .spend-analogy { margin: 12px 0 0; padding: 10px 12px; }
.hero-stat .spend-analogy:last-child { margin-bottom: 0; }

.metrics-row { gap: 10px; margin: 10px 0 0; }
.metric { padding: 11px 13px 12px; gap: 3px; border-radius: 18px; }
.metric-label { display: block; color: var(--muted); font-size: .74rem; line-height: 1.2; }
/* Баланс: число слева, «+» справа, одинаковые отступы по вертикали и слева.
   Раньше «+» висел сверху, а число прижималось к низу — карточка читалась криво. */
.metric-balance .metric-bal-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: auto; min-height: 32px;
}
.metric-balance .metric-amount { margin: 0; font-size: 1.06rem; line-height: 1.2; }
.bal-plus { width: 28px; height: 28px; min-width: 28px; border-radius: 9px; }
.bal-plus svg { width: 15px; height: 15px; }
.metric-trust-card { justify-content: flex-start; }
.metric-trust-card .metric-trust { margin-top: auto; }

/* ============================================================
   fix9 · этап 1: косметика
   —— Мёртвая полоса под контентом на длинных экранах
   ============================================================ */
/* #view-main.active задавал padding 0 0 calc(24px + safe) — это ПЕРЕБИВАЛО
   боковые поля из #view-main .page (одинаковая специфичность, но ниже в файле),
   поэтому .page оставался без горизонтальных отступов, а снизу висел пустой
   блок высотой с один экран и больше. Убираем конкурирующий padding. */
#view-main.active { padding: 0; }
#view-main .legal-foot { margin-top: 20px; padding: 10px 4px 2px; }
#view-main .page { padding-bottom: 8px; }

/* —— Зазоры между блоками: один ритм 12px сверху и снизу —— */
#view-main .page > * + * { margin-top: 12px; }
#view-main .page > .section-block,
#view-main .page > .stack {
  margin-top: 12px;
}

/* —— Карточка «Промо на канал»: не занимает пол-экрана у тех, кто уже подписан —— */
#channel-bonus-card.is-done .cb-bar { display: none; }
#channel-bonus-card.is-done .cb-btn[disabled] {
  background: rgba(52,211,153,.16); color: #a7f3d0; border-color: rgba(52,211,153,.3);
  cursor: default;
}

/* —— Premium: чаевые — только после покупки, промокод переехал в профиль —— */
#premium-promo-panel,
.deals-teaser,
#home-deals-row { display: none !important; }
.tip-block { margin-top: 14px; }
.tip-block .pay-block-head { margin-top: 0; }
.promo-hint { margin: 6px 0 0; font-size: .76rem; color: var(--muted); }

/* —— Иконка BillPing Premium: ровно по центру, без «съехавшего» логотипа —— */
.sub-icon.is-premium-ico {
  position: relative;
  background:
    radial-gradient(circle at 30% 26%, rgba(253,230,138,.55), transparent 62%),
    linear-gradient(160deg, #fbbf24, #b45309);
  padding: 0;
  overflow: hidden;
}
.sub-icon.is-premium-ico img {
  width: 68%; height: 68%; object-fit: contain;
  border-radius: 0; display: block; margin: auto;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.sub-icon.has-logo.is-premium-ico { background: radial-gradient(circle at 30% 26%, rgba(253,230,138,.55), transparent 62%), linear-gradient(160deg, #fbbf24, #b45309); }

/* —— Кнопка «Сохранить» в шторке цены: без бегущего блеска и лишнего свечения —— */
.btn.primary.glow { animation: none; background-size: auto; }
#btn-lib-price-save { margin-top: 4px; }

/* —— Шторка цены: пропорции, поля, одна ширина у чипов —— */
.lib-price-card { padding: 18px 16px 14px; }
.lib-price-card h3 { margin: 0 0 6px; }
.lib-price-card > .soft { margin: 0 0 12px; }
.lib-price-card .field { margin: 0; }
.lib-price-card .field + .field,
.lib-price-card .field + .lp-chips,
.lib-price-card .lp-chips + .field,
.lib-price-card .lp-chips + .lp-row { margin-top: 12px; }
.lib-price-card .lp-row { margin: 12px 0 0; }
.lib-price-card .lp-chips { margin-top: 8px; gap: 6px; }
.lib-price-card .lp-chips .chip { flex: 0 0 auto; }
.lib-price-card .hint { margin: 10px 0 2px; }
.lib-price-card > .btn { margin-top: 12px; }
.lib-price-card > .btn + .btn { margin-top: 8px; }

/* —— Категория у своей подписки —— */
.cat-pick { margin-top: 12px; }
.cat-pick .chip-select { gap: 6px; }

/* —— Каталог: карточка-превью сервиса перед добавлением —— */
.lib-preview-card { padding: 18px 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.lib-preview-card > * { margin: 0; }
.lib-preview-head { display: flex; align-items: center; gap: 12px; }
.lib-preview-headtext { min-width: 0; }
.lib-preview-headtext h3 { margin: 0; font-size: 1.12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-preview-headtext .soft { margin: 2px 0 0; font-size: .76rem; }
.lib-icon.is-preview { width: 52px; height: 52px; flex: 0 0 52px; }
.lib-preview-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-preview-facts.hidden, .lib-preview-desc.hidden, .lib-preview-catspend.hidden { display: none; }
.lp-fact {
  display: flex; align-items: baseline; gap: 6px;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid var(--stroke, rgba(255,255,255,.08));
  font-size: .76rem;
}
.lp-fact span { color: var(--soft); }
.lp-fact b { font-weight: 600; }
.lib-preview-desc { font-size: .82rem; line-height: 1.45; color: var(--text, #e7e9ee); opacity: .85; }
.lib-preview-catspend {
  font-size: .78rem; line-height: 1.45;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(96,165,250,.10); border: 1px solid rgba(96,165,250,.22);
}
.lib-preview-catspend button {
  background: none; border: 0; padding: 0; color: var(--accent-2, #60a5fa);
  font: inherit; cursor: pointer; text-decoration: underline;
}
.lib-preview-card #btn-lib-preview-add { margin-top: 2px; }

/* —— Абонементы: продление и расписание занятий —— */
.abo-card-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.abo-card-sched {
  margin-top: 6px; padding: 6px 10px; border-radius: 10px;
  background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.24);
  color: #93c5fd; font-size: .72rem; font-weight: 600; cursor: pointer;
  align-self: stretch; text-align: center;
}
.abo-card-sched:hover { background: rgba(96,165,250,.2); }
.abo-renew-card, .abo-sched-card { padding: 18px 16px 14px; }
.abo-renew-card h3, .abo-sched-card h3 { margin: 0 0 6px; }
.abo-renew-card > .soft, .abo-sched-card > .soft { margin: 0 0 12px; font-size: .8rem; }
.abo-renew-card .field, .abo-sched-card .field { margin: 0 0 12px; }
.abo-renew-card .row-2, .abo-sched-card .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.abo-renew-card .row-2 .field, .abo-sched-card .row-2 .field { margin: 0 0 12px; }
.abo-renew-card .lp-chips, .abo-sched-card .lp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.abo-renew-card .lp-chips .chip, .abo-sched-card .lp-chips .chip { cursor: pointer; }
.abo-renew-card .lp-chips .chip.is-on, .abo-sched-card .lp-chips .chip.is-on {
  background: rgba(96,165,250,.25); border-color: rgba(96,165,250,.55); color: #dbeafe;
}
.abo-sched-card #abo-sched-weekdays .chip.on {
  background: rgba(96,165,250,.25); border-color: rgba(96,165,250,.55); color: #dbeafe;
}
.abo-sched-list { gap: 6px; margin: 4px 0 12px; }
.abo-sched-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  font-size: .8rem;
}
.abo-sched-when { font-weight: 600; }
.abo-sched-rem { color: var(--muted); font-size: .74rem; margin-left: auto; }
.abo-sched-del {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: .8rem; padding: 4px 6px; border-radius: 8px;
}
.abo-sched-del:hover { color: #fca5a5; background: rgba(248,113,113,.12); }
.abo-sched-card #abo-sched-times-field .note-time-row { display: flex; align-items: center; gap: 8px; }
@media (max-width: 420px) {
  .abo-card-side { align-items: flex-end; }
  .abo-card-actions { width: 100%; }
}

/* —— Напоминания: восемь шаблонов, ровно 2 ряда по 4 —— */
.rem-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  align-items: stretch;
}
.rem-presets[hidden] { display: none; }
.rem-preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  min-height: 136px;
  min-width: 0;
  padding: 8px;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--line);
  color: inherit;
  font: inherit;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.rem-preset:hover { background: rgba(96, 165, 250, .12); border-color: rgba(96, 165, 250, .35); }
.rem-preset:active { transform: scale(.98); }
.rem-preset-ico { font-size: 24px; line-height: 24px; }
.rem-preset b {
  margin-top: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.rem-preset small {
  margin-top: 6px;
  font-size: 11px;
  line-height: 14px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
/* На 320 px четыре колонки остаются: карточка ~66 px, подписи переносятся. */
@media (max-width: 340px) {
  .rem-presets { gap: 6px; }
  .rem-preset { padding: 8px 6px; }
  .rem-preset b { font-size: 11px; }
  .rem-preset small { font-size: 10px; }
}

/* —— Комуналка и платежи по расписанию —— */
.ping-empty[hidden] { display: none; }
.ping-empty-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.ping-quick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
  color: inherit; font: inherit; font-size: .74rem; text-align: center;
  transition: background .15s ease, border-color .15s ease;
}
.ping-quick:hover { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.35); }
.ping-quick span { line-height: 1.2; }
.ping-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 14px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
}
.ping-ico { font-size: 1.15rem; line-height: 1.2; }
.ping-main { flex: 1; min-width: 0; }
.ping-title { margin: 0; font-weight: 650; font-size: .9rem; overflow-wrap: anywhere; }
.ping-meta { margin: 3px 0 0; color: var(--muted); font-size: .74rem; }
.ping-daysrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ping-day { font-size: .68rem; padding: 2px 7px; border-radius: 999px; background: rgba(96,165,250,.16); color: #bfdbfe; }
.ping-del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.ping-del:hover { color: #fca5a5; background: rgba(248,113,113,.12); }
.ping-card .lp-chips, .abo-renew-card .lp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ping-card .chip.is-on { background: rgba(96,165,250,.25); border-color: rgba(96,165,250,.55); color: #dbeafe; }
.ping-card .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ping-modal .chip.is-on { background: rgba(96,165,250,.25); border-color: rgba(96,165,250,.55); color: #dbeafe; }
#ping-modal .chip { cursor: pointer; }
#ping-modal .lp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#ping-modal .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#ping-modal .row-2 .field { margin-bottom: 12px; }
@media (max-width: 380px) {
  .ping-empty-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* —— Главная: карточка «В месяц уходит» — равные отступы и ритм —— */
.hero-stat { padding: 16px; }
.hero-stat-top { align-items: center; }
.hero-stat .label { font-size: .8rem; letter-spacing: .01em; }
.hero-stat .big-number { font-size: 2.2rem; margin: 4px 0 2px; }
.hero-stat .subline { margin: 0; font-size: .82rem; line-height: 1.35; }
.mini-ring { width: 46px; height: 46px; border-radius: 14px; flex: 0 0 46px; font-size: .95rem; }
.hero-stat #spend-cats { margin-top: 12px; }
.hero-stat #spend-analogy { margin: 12px 0 0; }
.hero-stat > :last-child { margin-bottom: 0; }

/* —— Баланс: плюс по центру высоты карточки, тот же отступ, что у текста —— */
.metric-balance { padding: 10px; }
.metric-balance .metric-label { margin: 0 0 2px 4px; }
.metric-balance .metric-bal-line {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0;
}
.metric-balance .metric-amount { font-size: 1.16rem; line-height: 1.2; padding-left: 4px; white-space: nowrap; }
.bal-plus {
  width: 34px; height: 34px; border-radius: 11px; align-self: center;
}
.bal-plus svg { width: 16px; height: 16px; }
.metric-trust-card { padding: 10px 12px; }
.metric-trust-card .metric-label { margin-bottom: 2px; }
.metric-trust-card .metric-trust-sub { margin-top: 1px; }
.metrics-row .metric { min-height: 0; }

/* ── Подтверждение покупки Premium ─────────────────────────────────────────
   Нижняя панель: подъём на 16px + прозрачность за 240 мс, мягкое золотое
   свечение вокруг короны. Всё закрывается кнопкой, само не исчезает. */
.prem-success {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: flex-end; justify-content: center;
}
.prem-success.open { display: flex; }
.prem-success[hidden] { display: none !important; }
.prem-success-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,.55);
  opacity: 0; transition: opacity 240ms var(--ease);
}
.prem-success.open .prem-success-backdrop { opacity: 1; }
.prem-success-panel {
  position: relative; z-index: 1;
  width: calc(100% - 24px); max-width: 420px;
  margin: 0 12px 0;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #272B37 0%, #151924 100%);
  border: 1px solid rgba(255,255,255,.12); border-bottom: 0;
  box-shadow: 0 -18px 48px rgba(0,0,0,.55);
  opacity: 0; transform: translateY(16px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.prem-success.open .prem-success-panel { opacity: 1; transform: translateY(0); }
.prem-success-close {
  position: absolute; right: 10px; top: 10px; width: 44px; height: 44px;
  border-radius: 14px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06); color: var(--text);
}
.prem-success-crown {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center; color: #1b1405;
  background: linear-gradient(135deg, #FFE98B, #FFC329);
  box-shadow: 0 0 0 0 rgba(255,201,41,.55);
  animation: premCrownGlow 1.8s ease-out 1;
}
.prem-success-title {
  margin: 16px 0 0; font-family: var(--font-display); font-size: 24px; line-height: 30px; font-weight: 700;
}
.prem-success-thanks { margin: 8px 0 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.prem-success-until { margin: 12px 0 0; font-size: 15px; line-height: 22px; font-weight: 600; color: #FFE98B; }
.prem-success-perks {
  list-style: none; margin: 12px 0 0; padding: 0; width: 100%;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.prem-success-perks li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; line-height: 18px; color: var(--text-2);
}
.prem-success-perks li::before { content: "✦"; color: #9BC5FF; flex: 0 0 auto; }
.prem-success-btn { margin-top: 20px; width: 100%; min-height: 48px; }
@keyframes premCrownGlow {
  0% { box-shadow: 0 0 0 0 rgba(255,201,41,.55); }
  60% { box-shadow: 0 0 0 14px rgba(255,201,41,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,201,41,0); }
}
@media (prefers-reduced-motion: reduce) {
  .prem-success-panel, .prem-success-backdrop { transition: none; }
  .prem-success-panel { transform: none; }
  .prem-success-crown { animation: none; }
}

/* ── Настройки интерфейса в Профиле ─────────────────────────────────────── */
.prefs {
  margin: 16px 0;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, #272B37 0%, #151924 100%);
}
.prefs-title {
  margin: 0 0 4px;
  font-size: 15px; line-height: 22px; font-weight: 600; color: var(--text);
}
.prefs-row {
  width: 100%; min-height: 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0; background: none; border: 0; border-radius: 14px;
  color: var(--text); text-align: left; cursor: pointer;
}
.prefs-row + .prefs-row { border-top: 1px solid rgba(255,255,255,.08); }
.prefs-lbl { font-size: 15px; line-height: 22px; flex: 0 0 auto; }
.prefs-val {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 18px; color: var(--text-2);
  min-width: 0; text-align: right;
}
.prefs-val > span:first-child {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px;
}
.prefs-arrow { color: var(--text-2); font-size: 18px; line-height: 1; }
.prefs-hint { margin: 8px 0 0; font-size: 12px; line-height: 17px; color: var(--text-2); }
.prefs-options { display: flex; flex-direction: column; gap: 4px; padding-bottom: calc(8px + var(--safe-b)); }
.prefs-option {
  min-height: 52px; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; color: var(--text); font-size: 15px; text-align: left; cursor: pointer;
}
.prefs-option-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prefs-option small { font-size: 12px; line-height: 17px; color: var(--text-2); }
.prefs-option[aria-selected="true"] { background: rgba(155,197,255,.12); border-color: rgba(155,197,255,.28); }
.prefs-option .prefs-check { color: var(--accent); font-weight: 700; }
