/* Inter variable font — встроен локально в APK/web/PWA.
   Один файл вместо 6 отдельных весов. font-display:block — даём шрифту
   до 100мс на загрузку (он локальный, быстро), иначе показываем системный
   фолбэк и swap'аем когда придёт. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/Inter-roman-var.woff2?v=246') format('woff2-variations'),
       url('fonts/Inter-roman-var.woff2?v=246') format('woff2');
}

/* =====================================================================
   Bro-Note Mini App — design v2 (Spotify-base + Stripe-typography)

   Принципы:
   - Глубокая тёмная база (#0A0A14), три уровня поверхностей
   - Aurora-mesh gradient'ы вместо плоских заливок
   - Огромная типографика для display-чисел (tabular-nums везде)
   - Generous whitespace, 4/8 grid
   - Один акцент-фиолетовый + поддерживающие mint/red/gold
   - Spring-easing на интерактивах
   - Cards с тонкой границей + soft glow (вместо жирных теней)
   - Custom SVG для нав-иконок, эмодзи только где они data-driven (категории/ачивки)
   ===================================================================== */

:root {
  /* Hint для нативных контролов (date/time picker, dropdown arrows у <select>,
     scrollbar) — без этого они рендерятся как в светлой теме, иконки чёрные на тёмном. */
  color-scheme: dark light;

  /* === Палитра ламповая ночь === */
  --bn-bg-0: #0A0A14;
  --bn-bg-1: #14141F;
  --bn-bg-2: #1C1C2A;
  --bn-bg-3: #28283A;

  --bn-text-1: #FFFFFF;
  --bn-text-2: #C7C7DB;
  --bn-text-3: #7E7E9A;
  --bn-text-4: #4A4A66;

  --bn-line-1: rgba(255, 255, 255, 0.06);
  --bn-line-2: rgba(255, 255, 255, 0.10);
  --bn-line-3: rgba(255, 255, 255, 0.18);

  /* Акценты — брендовый фиолетовый (violet-600, как в лоадере и маскоте).
     Раньше был #8B5CFF (violet-500) — выглядел дёшево/неоново.
     Текущий #7A5AF8 — глубже, премиальнее, согласован со стикерами. */
  --bn-acc: #7A5AF8;
  --bn-acc-2: #9785FA;
  --bn-acc-deep: #4F2EB6;
  --bn-acc-glow: rgba(122, 90, 248, 0.32);

  /* Унифицированная шкала фоновых tint'ов и border'ов с акцентного цвета.
     Использовать ВЕЗДЕ вместо случайных color-mix N%. Это даёт:
       1) Один источник правды — изменить tint можно в одном месте
       2) Гарантия что violet выглядит одинаково по всему UI
     Используются для: ghost-кнопки, active states, badges, hover, borders. */
  --bn-acc-bg-subtle:   color-mix(in srgb, var(--bn-acc) 4%,  transparent);
  --bn-acc-bg-soft:     color-mix(in srgb, var(--bn-acc) 10%, transparent);
  --bn-acc-bg-medium:   color-mix(in srgb, var(--bn-acc) 16%, transparent);
  --bn-acc-bg-strong:   color-mix(in srgb, var(--bn-acc) 25%, transparent);
  --bn-acc-bd-soft:     color-mix(in srgb, var(--bn-acc) 30%, transparent);
  --bn-acc-bd-medium:   color-mix(in srgb, var(--bn-acc) 45%, transparent);

  --bn-mint: #00E5B0;
  --bn-mint-glow: rgba(0, 229, 176, 0.20);
  --bn-red: #FF6B7A;
  --bn-red-glow: rgba(255, 107, 122, 0.18);
  --bn-gold: #FFB547;
  --bn-gold-glow: rgba(255, 181, 71, 0.18);

  /* Радиусы и пружины */
  --bn-r-sm: 10px;
  --bn-r-md: 14px;
  --bn-r-lg: 20px;
  --bn-r-xl: 28px;
  --bn-r-pill: 999px;

  --bn-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --bn-ease: cubic-bezier(0.32, 0.72, 0, 1);

  /* Высоты системных элементов */
  --bn-tabs-h: 64px;
  --bn-topbar-h: 56px;
}

/* === Light theme через data-theme === */
html[data-theme="light"] {
  --bn-bg-0: #FAFAFC;
  --bn-bg-1: #FFFFFF;
  --bn-bg-2: #F4F4F8;
  --bn-bg-3: #EAEAF0;
  --bn-text-1: #0A0A14;
  --bn-text-2: #4A4A66;
  --bn-text-3: #7E7E9A;
  --bn-text-4: #B4B4C7;
  --bn-line-1: rgba(0, 0, 0, 0.06);
  --bn-line-2: rgba(0, 0, 0, 0.10);
  --bn-line-3: rgba(0, 0, 0, 0.18);
  /* Брендовый фиолет на светлой теме — приглушённый, не электрический.
     #5B3FCC = 60% sat, 53% light — глубокий-мягкий на белом, без неона. */
  --bn-acc: #5B3FCC;
  --bn-acc-2: #7B66E0;
  --bn-acc-deep: #3D2997;
  --bn-acc-glow: rgba(91, 63, 204, 0.18);
  /* На белом фоне 4-10% violet растворяется. Поднимаем интенсивность
     tint'ов чтобы границы и фоны были заметны. */
  --bn-acc-bg-subtle:   color-mix(in srgb, var(--bn-acc) 7%,  transparent);
  --bn-acc-bg-soft:     color-mix(in srgb, var(--bn-acc) 14%, transparent);
  --bn-acc-bg-medium:   color-mix(in srgb, var(--bn-acc) 22%, transparent);
  --bn-acc-bg-strong:   color-mix(in srgb, var(--bn-acc) 32%, transparent);
  --bn-acc-bd-soft:     color-mix(in srgb, var(--bn-acc) 38%, transparent);
  --bn-acc-bd-medium:   color-mix(in srgb, var(--bn-acc) 55%, transparent);
}
html[data-theme="dark"] {
  /* defaults уже выше — здесь оставлено для явной инициации */
}
@media (prefers-color-scheme: light) {
  html[data-theme="auto"]:not([data-tg-themed]) {
    --bn-bg-0: #FAFAFC;
    --bn-bg-1: #FFFFFF;
    --bn-bg-2: #F4F4F8;
    --bn-bg-3: #EAEAF0;
    --bn-text-1: #0A0A14;
    --bn-text-2: #4A4A66;
    --bn-text-3: #7E7E9A;
    --bn-text-4: #B4B4C7;
    --bn-line-1: rgba(0, 0, 0, 0.06);
    --bn-line-2: rgba(0, 0, 0, 0.10);
    --bn-line-3: rgba(0, 0, 0, 0.18);
    --bn-acc: #5B3FCC;
    --bn-acc-2: #7B66E0;
    --bn-acc-deep: #3D2997;
    --bn-acc-glow: rgba(91, 63, 204, 0.18);
    /* Приподнимаем violet-tint'ы для читаемости на белом */
    --bn-acc-bg-subtle:   color-mix(in srgb, var(--bn-acc) 7%,  transparent);
    --bn-acc-bg-soft:     color-mix(in srgb, var(--bn-acc) 14%, transparent);
    --bn-acc-bg-medium:   color-mix(in srgb, var(--bn-acc) 22%, transparent);
    --bn-acc-bg-strong:   color-mix(in srgb, var(--bn-acc) 32%, transparent);
    --bn-acc-bd-soft:     color-mix(in srgb, var(--bn-acc) 38%, transparent);
    --bn-acc-bd-medium:   color-mix(in srgb, var(--bn-acc) 55%, transparent);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*::before, *::after { box-sizing: border-box; }

html, body {
  background: var(--bn-bg-0);
  color: var(--bn-text-1);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Запрет выделения текста по всему app — на Android WebView selection
     magnifier рисует под пальцем кусок DOM с background-image, и наш
     mascot.png из других слоёв (boot-loader / empty-state) появляется
     поверх UI как огромный artifact. Юзеру не нужно выделять тексты в
     виджет-приложении; для <input>/<textarea> разрешаем обратно ниже. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  font-feature-settings: "ss01" on, "cv11" on, "tnum" on;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Возвращаем text-selection там где она реально нужна юзеру: поля ввода
   и textarea. Без этого юзер не может скопировать свой email/ID/чек-сумму. */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

body {
  /* Aurora background — фоновый mesh, очень subtle */
  background:
    radial-gradient(900px 600px at 8% -8%, var(--bn-acc-glow), transparent 70%),
    radial-gradient(700px 500px at 100% 110%, rgba(0, 229, 176, 0.08), transparent 70%),
    var(--bn-bg-0);
  background-attachment: fixed;
}
html[data-theme="light"] body,
html[data-theme="auto"]:not([data-tg-themed]) body {
  background:
    radial-gradient(900px 600px at 8% -8%, var(--bn-acc-bg-soft), transparent 70%),
    radial-gradient(700px 500px at 100% 110%, rgba(0, 229, 176, 0.08), transparent 70%),
    var(--bn-bg-0);
  background-attachment: fixed;
}

button { font-family: inherit; }

#app {
  /* topbar = var(--bn-topbar-h) + env(safe-area-inset-top) — синхронизируем
     padding-top с этой же формулой, иначе контент уходит под топбар на
     устройствах с notch или при overlaysWebView=true (Capacitor native).
     Padding-bottom включает место под FAB-stack (chat + add, fixed справа
     над tabs) — иначе FAB перекрывал последнюю строку контента. */
  padding:
    calc(var(--bn-topbar-h) + env(safe-area-inset-top, 0) + 8px)
    14px
    calc(var(--bn-tabs-h) + env(safe-area-inset-bottom, 0) + 90px);
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  /* НЕ ставим overflow-x: hidden — он превращал #app в scroll-container
     и крал touchmove события у tab-swipe handler в середине экрана. */
}

.hidden { display: none !important; }

/* =================== Loader =================== */
.loading {
  display: grid; place-items: center;
  height: 60vh;
}
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--bn-line-2);
  border-top-color: var(--bn-acc);
  border-radius: 50%;
  animation: bn-spin 0.7s linear infinite;
}
@keyframes bn-spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bn-bg-1), var(--bn-bg-2), var(--bn-bg-1));
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--bn-r-md);
}
.skel-hero { height: 220px; margin-bottom: 12px; border-radius: var(--bn-r-xl); }
.skel-card { height: 88px; margin-bottom: 10px; }
.skel-card.tall { height: 140px; }
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =================== Topbar =================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--bn-topbar-h) + env(safe-area-inset-top, 0));
  padding: env(safe-area-inset-top, 0) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
  background: linear-gradient(to bottom, var(--bn-bg-0) 60%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.topbar .brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 17px;
  letter-spacing: -0.01em;
}
.topbar .brand .dot {
  width: 32px; height: 32px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px var(--bn-acc-glow));
}
.topbar .actions { display: flex; gap: 6px; }

/* Offline / online banner — slim strip под topbar.
   Скрыт по умолчанию (visibility:hidden + opacity:0 + top за topbar'ом),
   slide-down при .show. Не перехватывает клики и не мешает свайпу табов. */
.bn-net-banner {
  position: fixed;
  left: 0; right: 0;
  top: 0;
  z-index: 89;
  padding: 6px 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(120, 90, 60, 0.92);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  visibility: hidden;
  opacity: 0;
  transform: translateY(-100%);
  transition: transform 0.28s var(--bn-spring, cubic-bezier(.2,.9,.3,1.2)),
              opacity 0.2s ease,
              visibility 0s linear 0.28s,
              background 0.2s ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.bn-net-banner.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(calc(var(--bn-topbar-h) + env(safe-area-inset-top, 0)));
  transition: transform 0.28s var(--bn-spring, cubic-bezier(.2,.9,.3,1.2)),
              opacity 0.2s ease,
              visibility 0s linear 0s,
              background 0.2s ease;
}
.bn-net-banner.online {
  background: rgba(0, 168, 120, 0.92);
}
.topbtn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  cursor: pointer;
  transition: transform 0.18s var(--bn-spring), background 0.15s var(--bn-ease);
}
.topbtn:active { transform: scale(0.92); }
.topbtn:hover { background: var(--bn-bg-3); color: var(--bn-text-1); }
.topbtn svg { width: 18px; height: 18px; stroke-width: 1.6; }

/* =================== Bottom tabs =================== */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, var(--bn-bg-0), color-mix(in srgb, var(--bn-bg-0) 85%, transparent));
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-top: 1px solid var(--bn-line-1);
  display: flex;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 80;
}
.tab {
  flex: 1;
  background: none; border: none; outline: none;
  height: 44px;
  display: grid; place-items: center;
  color: var(--bn-text-3);
  cursor: pointer;
  border-radius: var(--bn-r-md);
  transition: color 0.15s var(--bn-ease), background 0.18s var(--bn-ease), transform 0.1s ease;
  position: relative;
}
.tab svg { width: 22px; height: 22px; stroke-width: 1.7; }
.tab:active { transform: scale(0.92); }
.tab.active { color: var(--bn-text-1); }
.tab.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%; transform: translateX(-50%);
  width: 24px; height: 3px;
  background: var(--bn-acc);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 0 12px var(--bn-acc-glow);
}

/* Primary CTA — встроена в navbar центральным слотом (как старый Instagram camera).
   Слот шире (80px), внутри круг 56px чуть приподнят над верхней кромкой панели.
   Без radial-gradient glow под кнопкой — выглядел как засвет, мешал. */
.tab.tab-cta {
  flex: 0 0 80px;
  position: relative;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}
.tab.tab-cta::before { display: none; }    /* не таб — без active-индикатора */
.tab.tab-cta:active { transform: none; }   /* press-state живёт на круге */
.cta-circle {
  display: grid; place-items: center;
  width: 56px; height: 56px;
  margin: -16px auto 0;                    /* приподнят ~8px над верхней кромкой панели */
  border-radius: 50%;
  background: linear-gradient(180deg, #7A5AF8 0%, #4F2EB6 100%);
  color: #F7F5FF;
  /* border убран — рисовал тонкую светлую обводку, при scroll'е navbar'a с blur'ом
     она визуально размазывалась и создавала «засвет» рядом с кнопкой. */
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.14s var(--bn-spring), box-shadow 0.2s var(--bn-ease);
}
.cta-circle svg { width: 24px; height: 24px; stroke-width: 2.1; }
.tab.tab-cta:active .cta-circle {
  transform: translateY(2px) scale(0.96);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

/* =================== FAB =================== */
/* FAB layout (TikTok-style):
   - mic — 5-й слот ВНУТРИ tab-bar по центру, primary CTA с акцентным фоном.
   - ask + text — column справа над tab-bar (для дополнительных способов ввода). */
.fab-stack {
  position: fixed;
  bottom: calc(var(--bn-tabs-h) + 16px + env(safe-area-inset-bottom));
  right: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  z-index: 85;
}
.fab {
  width: 56px; height: 56px;
  border: none; border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  color: white;
  transition: transform 0.16s var(--bn-spring), box-shadow 0.2s var(--bn-ease);
  position: relative;
}
.fab svg { width: 24px; height: 24px; stroke-width: 1.8; }
.fab.text {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--bn-acc), color-mix(in srgb, var(--bn-acc) 70%, #000));
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--bn-acc) 38%, transparent);
}
.fab.text:hover {
  box-shadow: 0 8px 24px color-mix(in srgb, var(--bn-acc) 50%, transparent);
}
.fab.text svg { width: 22px; height: 22px; }
.fab:active { transform: scale(0.92); }
.fab.ask {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #00E5B0, #00B89A);
  color: #0A0A14;
  border: none;
  box-shadow: 0 6px 18px rgba(0,229,176,0.35);
}
.fab.ask svg { width: 20px; height: 20px; }

/* =================== Ask Bro chat sheet =================== */
.ask-chat-card {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.ask-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px;
  margin-bottom: 10px;
}
.ask-reset-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--bn-text-2);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.ask-reset-btn:hover { background: rgba(255,255,255,0.1); }
.ask-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 280px;
  max-height: 56vh;
}
.ask-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--bn-text-3);
  font-size: 13px;
}
.ask-empty-text { margin-bottom: 14px; line-height: 1.5; }
.ask-examples-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  font-weight: 700;
}
.ask-example {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 10px 12px;
  background: rgba(0,229,176,0.10);
  border: 1px solid rgba(0,229,176,0.25);
  border-radius: 10px;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.ask-example:hover { background: rgba(0,229,176,0.18); }
.ask-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 88%;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ask-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--bn-acc), var(--bn-acc-deep));
  color: white;
  border-bottom-right-radius: 4px;
}
.ask-bubble.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--bn-text-1);
  border-bottom-left-radius: 4px;
}
.ask-suggested {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 10px;
}
.ask-suggested-chip {
  background: rgba(151,133,250,0.15);
  border: 1px solid rgba(151,133,250,0.3);
  color: var(--bn-text-1);
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
}
.ask-suggested-chip:hover { background: rgba(151,133,250,0.25); }

/* Action-chips под ответом — открывают entity-actions sheet */
.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ask-action-chip {
  background: rgba(0,229,176,0.12);
  border: 1px solid rgba(0,229,176,0.3);
  color: var(--bn-text-1);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.ask-action-chip:hover { background: rgba(0,229,176,0.2); }

/* =================== Bulk-операции (multi-select) =================== */
.bulk-toolbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-2);
  border-radius: var(--bn-r-lg);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  animation: bulk-toolbar-in 0.22s var(--bn-spring);
}
@keyframes bulk-toolbar-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.bulk-count {
  flex: 1;
  font-size: 13px;
  color: var(--bn-text-2);
  font-weight: 600;
  text-align: center;
}
.bulk-actions-grp {
  display: flex;
  gap: 6px;
}
.bulk-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.bulk-btn:active:not(:disabled) { transform: scale(0.96); }
.bulk-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bulk-btn.cancel {
  background: rgba(255,255,255,0.08);
  color: var(--bn-text-2);
}
.bulk-btn.danger {
  background: #ef4444;
  color: white;
}
.bulk-btn.pin {
  background: var(--bn-gold);
  color: #1a1a00;
}
.bulk-btn.complete {
  background: var(--bn-mint);
  color: #0A0A14;
}

/* Selection visual states — на карточках в режиме selection */
.select-mode {
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.select-mode::before {
  content: '';
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--bn-text-3);
  border-radius: 6px;
  margin-right: 10px;
  vertical-align: middle;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.select-mode.selected::before {
  background: var(--bn-acc);
  border-color: var(--bn-acc);
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>');
  background-size: 14px 14px;
  background-position: center;
  background-repeat: no-repeat;
}
.select-mode.selected {
  background: rgba(151,133,250,0.08);
}
/* Дополнительный отступ снизу контента когда тулбар виден — чтобы не перекрывал последний item */
body:has(.bulk-toolbar) #app { padding-bottom: 88px; }
.ask-input-row {
  display: flex;
  gap: 8px;
  padding: 8px 0 4px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ask-input {
  flex: 1;
  padding: 12px 14px;
  background: var(--bn-bg-1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 14px;
}
.ask-input:focus {
  outline: none;
  border-color: rgba(0,229,176,0.5);
  background: var(--bn-bg-2);
}
.ask-input::placeholder { color: var(--bn-text-3); }
.ask-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bn-acc), var(--bn-acc-deep));
  color: white;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ask-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ask-send-btn svg { width: 18px; height: 18px; }

/* =================== Cards =================== */
.card {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.card.flush { padding: 0; }

.sec-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin: 22px 4px 10px;
}

h2 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 6px 0 16px;
}
h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* =================== HERO =================== */
.hero {
  position: relative;
  border-radius: var(--bn-r-xl);
  padding: 24px 22px 26px;
  margin-bottom: 14px;
  overflow: hidden;
  isolation: isolate;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
}
/* Compact hero: greet+name на одной строке с балансом справа — без графиков и tile'ов */
.hero.compact { padding: 18px 18px 18px; margin-bottom: 12px; overflow: visible; }
/* Aurora-glow ::before унаследован от .hero — там inset:-40% + blur(40px)
   + animation translate(-3,4%). В обычном .hero обрезался overflow:hidden;
   на .hero.compact мы переопределили на visible (для glow/badge), и aurora
   стала вылезать на 40% за hero + animation сдвиг → распирала viewport,
   контент уезжал в сторону. На compact aurora не нужна (нет места для
   декоративного эффекта) — выключаем псевдоэлемент. */
.hero.compact::before { display: none; }
.hero.compact .hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
}
.hero.compact .hero-id {
  min-width: 0;
  flex: 1 1 auto;
}
.hero.compact .hero-badge-row {
  margin-top: 6px;
  display: flex;
}
.hero.compact .hero-badge-row .premium-badge { margin-left: 0; }
.hero.compact .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero.compact .hero-bal {
  text-align: right;
  font-feature-settings: "tnum" on, "lnum" on;
  flex: 0 0 auto;
}
.hero.compact .hero-bal-amt {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.hero.compact .hero-bal-amt .counter {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--bn-text-1);
}
.hero.compact .hero-bal-amt .cur {
  font-size: 16px;
  font-weight: 600;
  color: var(--bn-text-3);
}
.hero.compact .hero-bal-lbl {
  font-size: 11px;
  color: var(--bn-text-3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Home search bar */
.home-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.home-search-ic {
  position: absolute;
  left: 14px;
  color: var(--bn-text-3);
  display: flex;
  pointer-events: none;
}
.home-search-ic svg { width: 16px; height: 16px; }
.home-search-input {
  flex: 1;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 10px 36px 10px 38px;
  font-size: 14px;
  font-family: inherit;
  color: var(--bn-text-1);
  outline: none;
  transition: border-color 0.15s var(--bn-ease), background 0.15s var(--bn-ease);
  -webkit-appearance: none;
}
.home-search-input:focus {
  border-color: var(--bn-acc);
  background: var(--bn-bg-1);
}
.home-search-input::-webkit-search-cancel-button { display: none; }
.home-search-input::placeholder { color: var(--bn-text-3); }
.home-search-clear {
  position: absolute;
  right: 8px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  color: var(--bn-text-3);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease);
}
.home-search-clear:hover { background: var(--bn-bg-3); color: var(--bn-text-1); }
.home-search-clear svg { width: 14px; height: 14px; }
.home-search-clear.hidden { display: none; }

/* «Все →» link button в headers секций */
.sec-link-btn {
  background: transparent;
  border: none;
  color: var(--bn-acc);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s var(--bn-ease);
}
.sec-link-btn:hover { background: var(--bn-acc-bg-soft); }
.sec-link-btn:active { transform: scale(0.96); }

/* «Настроить главную» в конце Home */
.home-customize-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 18px;
  background: transparent;
  border: 1px dashed var(--bn-line-2);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-3);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--bn-ease), color 0.15s var(--bn-ease);
}
.home-customize-btn:hover { border-color: var(--bn-acc); color: var(--bn-acc); }
.home-customize-btn:active { transform: scale(0.985); }
.home-customize-btn svg { width: 16px; height: 16px; }

/* =================== Premium sheet =================== */
.prem-card { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.prem-banner {
  position: relative;
  border-radius: var(--bn-r-xl);
  padding: 24px 22px;
  text-align: center;
  margin-bottom: 18px;
  overflow: hidden;
  isolation: isolate;
}
.prem-banner::before {
  content: '';
  position: absolute; inset: 0;
  z-index: -1;
  opacity: 0.6;
  filter: blur(40px);
}
.prem-banner.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--bn-gold, #FFD93D) 22%, var(--bn-bg-1)), color-mix(in srgb, var(--bn-acc) 14%, var(--bn-bg-1)));
  border: 1px solid color-mix(in srgb, var(--bn-gold, #FFD93D) 45%, var(--bn-line-2));
}
.prem-banner.active::before {
  background: radial-gradient(50% 60% at 50% 40%, color-mix(in srgb, var(--bn-gold, #FFD93D) 35%, transparent), transparent 70%);
}
.prem-banner.trial {
  background: linear-gradient(135deg, color-mix(in srgb, var(--bn-acc) 22%, var(--bn-bg-1)), color-mix(in srgb, var(--bn-mint, var(--bn-acc)) 14%, var(--bn-bg-1)));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 45%, var(--bn-line-2));
}
.prem-banner.trial::before {
  background: radial-gradient(50% 60% at 50% 40%, var(--bn-acc-bd-soft), transparent 70%);
}
.prem-banner.warn {
  background: linear-gradient(135deg, color-mix(in srgb, var(--bn-red) 18%, var(--bn-bg-1)), color-mix(in srgb, var(--bn-acc) 10%, var(--bn-bg-1)));
  border: 1px solid color-mix(in srgb, var(--bn-red) 40%, var(--bn-line-2));
}
.prem-banner.warn::before {
  background: radial-gradient(50% 60% at 50% 40%, color-mix(in srgb, var(--bn-red) 30%, transparent), transparent 70%);
}
.prem-banner.inactive {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-2);
}
.prem-banner-em {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 4px 18px var(--bn-acc-bd-soft));
}

/* Анимированная звезда: SVG-звезда c gradient + sparkles (✦, ·) вокруг.
   Звезда мягко покачивается + sparkles мигают по очереди. */
.prem-star {
  position: relative;
  width: 88px; height: 88px;
  margin: 0 auto 14px;
  display: grid; place-items: center;
}
.prem-star-svg {
  width: 76px; height: 76px;
  animation: prem-star-pulse 3.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 22px rgba(255, 181, 71, 0.45));
}
.prem-star-gift .prem-star-emoji {
  font-size: 56px;
  line-height: 1;
  animation: prem-gift-bounce 2.4s ease-in-out infinite;
  filter: drop-shadow(0 6px 20px var(--bn-acc-bd-soft));
}
@keyframes prem-star-pulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%      { transform: scale(1.06) rotate(-3deg); }
}
@keyframes prem-gift-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-3px) rotate(-2deg); }
  75%      { transform: translateY(-2px) rotate(2deg); }
}
.prem-spark {
  position: absolute;
  font-size: 14px;
  color: #FFD93D;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 6px rgba(255, 217, 61, 0.7);
}
.prem-spark-1 { top: 6%;  left: 8%;  font-size: 16px; animation: prem-spark 2.4s ease-in-out infinite; }
.prem-spark-2 { top: 14%; right: 4%; font-size: 12px; animation: prem-spark 2.6s 0.3s ease-in-out infinite; }
.prem-spark-3 { bottom: 18%; left: 6%; font-size: 22px; animation: prem-spark 2.8s 0.6s ease-in-out infinite; }
.prem-spark-4 { bottom: 8%;  right: 10%; font-size: 18px; animation: prem-spark 2.2s 0.9s ease-in-out infinite; }
@keyframes prem-spark {
  0%, 100%  { opacity: 0; transform: scale(0.6); }
  40%, 60%  { opacity: 1; transform: scale(1.1); }
}
.prem-banner-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--bn-text-1);
  margin-bottom: 4px;
}
.prem-banner-sub {
  font-size: 13px;
  color: var(--bn-text-2);
  line-height: 1.45;
}

.prem-features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.prem-feat {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  transition: border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease), transform 0.14s var(--bn-spring);
}
.prem-feat:hover {
  border-color: var(--bn-acc-bd-soft);
  background: linear-gradient(90deg, var(--bn-acc-bg-subtle), var(--bn-bg-2) 30%);
  transform: translateX(2px);
}
.prem-feat .ic {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 1px;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--bn-acc-bg-soft);
  border-radius: var(--bn-r-md);
}
.prem-feat b { font-size: 14px; font-weight: 700; color: var(--bn-text-1); display: block; }
.prem-feat .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }

.prem-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.prem-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--bn-r-md);
  transition: filter 0.15s var(--bn-ease), transform 0.18s var(--bn-spring), background 0.15s var(--bn-ease);
  flex-wrap: wrap;
}
.prem-cta.primary {
  background: linear-gradient(135deg, var(--bn-acc), var(--bn-acc-deep));
  color: #FFFFFF;
  border: none;
  box-shadow: 0 8px 24px var(--bn-acc-bd-soft);
  position: relative;
  overflow: hidden;
}
.prem-cta.primary:hover { filter: brightness(1.08); }
.prem-cta.primary:active { transform: scale(0.985); }
.prem-cta.primary svg { width: 16px; height: 16px; }
/* Shine — диагональная полоса бликует по primary-кнопке каждые 4с */
.prem-cta-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: prem-shine 4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes prem-shine {
  0%   { left: -100%; }
  60%  { left: 100%; }
  100% { left: 100%; }
}
.prem-cta-text { position: relative; z-index: 1; }
.prem-cta-arrow { position: relative; z-index: 1; }
.prem-cta.secondary {
  background: var(--bn-bg-2);
  color: var(--bn-text-1);
  border: 1px solid var(--bn-line-2);
}
.prem-cta.secondary:hover { background: var(--bn-bg-3); }
.prem-cta.secondary:active { transform: scale(0.985); }
.prem-cta.ghost {
  background: transparent;
  color: var(--bn-text-2);
  border: 1px dashed var(--bn-line-2);
}
.prem-cta.ghost:hover { border-color: var(--bn-acc); color: var(--bn-acc); }
.prem-cta-hint {
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 4px;
}
.prem-cta-hint b { font-weight: 700; }
.prem-native-note {
  padding: 14px 16px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  font-size: 13px;
  color: var(--bn-text-2);
  line-height: 1.5;
}
.prem-footer-note {
  font-size: 11px;
  color: var(--bn-text-3);
  text-align: center;
  line-height: 1.45;
  padding-top: 6px;
  border-top: 1px solid var(--bn-line-1);
  margin-top: 4px;
}

/* Settings → Premium row (tappable entry to sheet) */
.prem-entry-row {
  cursor: pointer;
  transition: border-color 0.15s var(--bn-ease), background 0.15s var(--bn-ease);
}
.prem-entry-row:hover { border-color: color-mix(in srgb, var(--bn-acc) 45%, var(--bn-line-2)); }
.prem-entry-row:active { transform: scale(0.99); }
.prem-entry-row .ic { font-size: 22px; flex-shrink: 0; }
.prem-entry-row .body { flex: 1; min-width: 0; }
.prem-entry-row .body .t { font-size: 14px; font-weight: 600; color: var(--bn-text-1); }
.prem-entry-row .body .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }
.prem-entry-chev { width: 16px; height: 16px; color: var(--bn-text-3); flex-shrink: 0; }

/* Бенчмарки сообщества (Аналитика) */
.bench-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bn-line-1);
}
.bench-row:last-child { border-bottom: none; }
.bench-cat { font-size: 14px; font-weight: 600; color: var(--bn-text-1); grid-column: 1; }
.bench-vals { grid-column: 1 / -1; font-size: 12px; color: var(--bn-text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.bench-vals .bench-yours { color: var(--bn-text-1); font-weight: 700; }
.bench-vals .bench-vs b { color: var(--bn-text-2); }
.bench-verdict { grid-column: 2; grid-row: 1; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bench-row.high .bench-verdict { color: var(--bn-red); }
.bench-row.mid .bench-verdict { color: var(--bn-gold, #FFD93D); }
.bench-row.low .bench-verdict { color: var(--bn-mint, var(--bn-acc)); }
.bench-foot { padding: 8px 14px 12px; color: var(--bn-text-3); font-size: 11px; line-height: 1.4; text-align: center; }

/* Виджет budget_forecast — прогноз вылета бюджета */
.forecast-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bn-line-1);
  cursor: pointer;
  transition: background 0.15s var(--bn-ease);
}
.forecast-row:last-child { border-bottom: none; }
.forecast-row:hover { background: var(--bn-bg-2); }
.forecast-row:active { transform: scale(0.99); }
.forecast-row.urgent {
  background: linear-gradient(90deg, color-mix(in srgb, var(--bn-red) 12%, transparent), transparent);
}
.forecast-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.forecast-body { flex: 1; min-width: 0; }
.forecast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--bn-text-1);
  line-height: 1.35;
}
.forecast-title b { color: var(--bn-red); }
.forecast-meta {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 3px;
  line-height: 1.4;
}

/* Виджет balance_full — большая карточка с доход/расход */
.hero-stats-card {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.hero-stats-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 10px;
}
.hero-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hero-stats-grid .hero-stat {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 10px 12px;
}
.hero-stats-grid .hero-stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-3);
  font-weight: 600;
}
.hero-stats-grid .hero-stat .val {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
  font-feature-settings: "tnum" on, "lnum" on;
}
.hero-stats-grid .hero-stat .val.income { color: var(--bn-mint, var(--bn-acc)); }
.hero-stats-grid .hero-stat .val.expense { color: var(--bn-red); }

/* Sheet «Настройка главной» */
.hc-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-3);
  margin: 14px 0 8px;
}
.hc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  transition: border-color 0.15s var(--bn-ease), background 0.15s var(--bn-ease);
}
.hc-row.active { border-color: color-mix(in srgb, var(--bn-acc) 35%, var(--bn-line-2)); }
.hc-row.inactive { opacity: 0.85; }
.hc-row.inactive:hover { opacity: 1; background: var(--bn-bg-3); }
.hc-emoji { font-size: 22px; line-height: 1; flex-shrink: 0; }
.hc-body { flex: 1; min-width: 0; }
.hc-label { font-size: 14px; font-weight: 600; color: var(--bn-text-1); }
.hc-desc { font-size: 11px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.35; }
.hc-actions { display: flex; gap: 4px; flex-shrink: 0; }
.hc-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: 8px;
  color: var(--bn-text-2);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease), transform 0.18s var(--bn-spring), opacity 0.15s var(--bn-ease);
}
.hc-btn:hover:not(.disabled) { background: var(--bn-bg-3); color: var(--bn-text-1); }
.hc-btn:active:not(.disabled) { transform: scale(0.9); }
.hc-btn.disabled { opacity: 0.3; cursor: not-allowed; }
.hc-btn.remove { color: var(--bn-red); border-color: color-mix(in srgb, var(--bn-red) 35%, var(--bn-line-2)); }
.hc-btn.add { color: var(--bn-acc); border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-2)); }
.hc-btn svg { width: 14px; height: 14px; }
.hc-done-btn {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  background: var(--bn-acc);
  color: var(--bn-bg-0, #0A0A14);
  border: none;
  border-radius: var(--bn-r-md);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s var(--bn-ease), transform 0.18s var(--bn-spring);
}
.hc-done-btn:hover { filter: brightness(1.06); }
.hc-done-btn:active { transform: scale(0.985); }
.hero::before {
  content: '';
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(40% 50% at 25% 20%, var(--bn-acc-glow), transparent 70%),
    radial-gradient(30% 40% at 80% 80%, var(--bn-mint-glow), transparent 70%),
    radial-gradient(35% 35% at 80% 0%, rgba(255, 217, 61, 0.10), transparent 70%);
  filter: blur(40px);
  z-index: -1;
  animation: bn-aurora 14s var(--bn-ease) infinite alternate;
}
@keyframes bn-aurora {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-3%, 4%) rotate(8deg); }
}
.hero .greet {
  font-size: 13px;
  color: var(--bn-text-3);
  letter-spacing: 0.02em;
  font-weight: 500;
}
.hero .name {
  font-size: 16px;
  color: var(--bn-text-2);
  font-weight: 600;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.hero .hero-amount {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-feature-settings: "tnum" on, "lnum" on;
}
.hero .hero-amount .counter {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--bn-text-1);
}
.hero .hero-amount .cur {
  font-size: 24px;
  font-weight: 600;
  color: var(--bn-text-3);
  letter-spacing: -0.02em;
}
.hero .hero-sub {
  margin-top: 6px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  color: var(--bn-text-3);
  font-size: 13px;
}
.hero .hero-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.hero-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 10px 12px;
}
.hero-stat .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-3);
  font-weight: 600;
}
.hero-stat .val {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 4px;
  font-feature-settings: "tnum" on;
}
.hero-stat .val.pos { color: var(--bn-mint); }
.hero-stat .val.neg { color: var(--bn-red); }

/* Sparkline footer в hero — полноширинный график расходов за 7 дней */
.hero-spark {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--bn-line-1);
  position: relative;
}
.hero-spark .spark {
  display: block;
  width: 100%;
  height: 48px;
  opacity: 0.7;
}
.hero-spark-lbl {
  position: absolute;
  top: 14px; right: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--bn-r-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--bn-line-1);
  font-size: 11px;
  font-weight: 600;
  color: var(--bn-text-2);
}
.pill.up { background: var(--bn-red-glow); color: var(--bn-red); border-color: rgba(255, 107, 122, 0.25); }
.pill.down { background: var(--bn-mint-glow); color: var(--bn-mint); border-color: rgba(0, 229, 176, 0.25); }

.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--bn-r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #FFD93D, #FFB547);
  color: #2A1A00;
  vertical-align: middle;
  margin-left: 6px;
}
button.premium-badge { border: none; font-family: inherit; }
/* CTA-вариант: для не-Premium юзеров (free / trial). Кликабельный, открывает
   premium-preview sheet. Чуть «дышит» чтобы привлекать внимание без агрессии. */
.premium-badge.premium-badge-cta {
  cursor: pointer;
  transition: transform 0.18s var(--bn-spring), box-shadow 0.18s var(--bn-ease);
  box-shadow: 0 2px 8px rgba(255, 181, 71, 0.25);
}
.premium-badge.premium-badge-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 181, 71, 0.4);
}
.premium-badge.premium-badge-cta:active { transform: scale(0.96); }
/* =================== Trial countdown card =================== */
.trial-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--bn-acc-bg-medium), rgba(101, 69, 245, 0.08));
  border: 1px solid var(--bn-acc-bd-soft);
  border-radius: var(--bn-r-lg);
  cursor: pointer;
  transition: transform 0.15s var(--bn-spring), box-shadow 0.2s var(--bn-ease);
}
.trial-card:active { transform: scale(0.985); }
.trial-card:hover { box-shadow: 0 6px 18px var(--bn-acc-bg-strong); }
.trial-card .em { font-size: 26px; line-height: 1; }
.trial-card .info { flex: 1; min-width: 0; }
.trial-card .info .ttl {
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
  color: var(--bn-text-1);
}
.trial-card .info .sub {
  font-size: 12px; color: var(--bn-text-3); margin-top: 2px;
}
.trial-card .cta {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #7A5AF8 0%, #4F2EB6 100%);
  color: #F7F5FF;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.trial-card.warn {
  background: linear-gradient(135deg, rgba(255, 181, 71, 0.16), rgba(255, 107, 122, 0.08));
  border-color: rgba(255, 181, 71, 0.36);
}
.trial-card.warn .cta {
  background: linear-gradient(180deg, #FFB547 0%, #FF8A47 100%);
  color: #1A1408;
}

/* =================== Focus cards =================== */
.focus-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  margin-bottom: 8px;
  transition: transform 0.15s var(--bn-spring), border-color 0.15s ease;
}
.focus-card:active { transform: scale(0.98); }
.focus-card .ico-lg {
  width: 44px; height: 44px;
  border-radius: var(--bn-r-md);
  background: var(--bn-acc-bg-soft);
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.focus-card .body { flex: 1; min-width: 0; }
.focus-card .body .title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.focus-card .body .meta {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
}
.focus-card .right {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--bn-text-2);
  font-feature-settings: "tnum" on;
}
.focus-card.danger { border-color: rgba(255, 107, 122, 0.30); }
.focus-card.danger .ico-lg { background: var(--bn-red-glow); }
.focus-card.warn { border-color: rgba(255, 181, 71, 0.28); }
.focus-card.warn .ico-lg { background: var(--bn-gold-glow); }
.focus-card.success .ico-lg { background: var(--bn-mint-glow); }
.focus-card.gold .ico-lg { background: var(--bn-gold-glow); }

.badge {
  padding: 3px 8px;
  border-radius: var(--bn-r-pill);
  background: var(--bn-bg-3);
  font-size: 11px;
  font-weight: 700;
  font-feature-settings: "tnum" on;
}

/* =================== Lists =================== */
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--bn-line-1);
}
.list-item:last-child { border-bottom: none; }
.list-item .ico {
  width: 36px; height: 36px;
  border-radius: var(--bn-r-md);
  background: var(--bn-acc-bg-soft);
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.list-item .body { flex: 1; min-width: 0; }
.list-item .body .title {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .body .meta {
  font-size: 12px; color: var(--bn-text-3);
  margin-top: 2px;
  font-feature-settings: "tnum" on;
}
.list-item .right {
  font-weight: 600;
  font-feature-settings: "tnum" on;
}

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot.high { background: var(--bn-red); box-shadow: 0 0 6px var(--bn-red-glow); }
.dot.low { background: var(--bn-text-4); }

/* Reminder: описание под title (опциональное поле, часто пустое) */
.rem-desc {
  font-size: 12px;
  color: var(--bn-text-2);
  line-height: 1.4;
  margin-top: 2px;
  /* Чтобы длинное описание не растягивало ряд бесконечно: */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Reminder priority — accent-полоска слева у .list-item */
.list-item.rem-prio-high {
  border-left: 3px solid var(--bn-red);
  padding-left: 11px;  /* компенсация border'а: 14 - 3 */
}
.list-item.rem-prio-low {
  border-left: 3px solid var(--bn-text-4);
  padding-left: 11px;
  opacity: 0.85;
}

/* Reminder deadline — оранжевый цвет в meta, красный если просрочен */
.rem-deadline {
  color: var(--bn-gold, #FBBF24);
  font-weight: 600;
}
.rem-deadline.overdue {
  color: var(--bn-red, #DC2626);
}

/* Reminder form — alarms multi-select chips + custom-input.
   Несколько напоминаний на одно событие (например за 1 день + за 1 час). */
.rem-alarms { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.rem-alarms-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rem-alarm-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent;
  border: 1.5px solid var(--bn-acc-bd-soft);
  color: var(--bn-text-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.rem-alarm-chip:hover {
  border-color: var(--bn-acc);
  color: var(--bn-text-1);
}
.rem-alarm-chip.selected {
  background: var(--bn-acc-bg-medium);
  border-color: var(--bn-acc);
  color: var(--bn-acc);
  font-weight: 600;
}
.rem-alarm-chip.preset {
  border-style: dashed;
  color: var(--bn-text-3);
}
.rem-alarm-chip.preset:hover {
  border-style: solid;
  border-color: var(--bn-acc);
  color: var(--bn-acc);
}
.rem-alarm-chip-x {
  opacity: 0.6;
  font-size: 10px;
  margin-left: 2px;
}
.rem-alarm-chip.selected:hover .rem-alarm-chip-x { opacity: 1; }

.rem-alarms-add {
  display: flex; gap: 8px; align-items: stretch;
}
.rem-alarms-add .rem-input {
  margin: 0;  /* override общего margin .rem-input */
}
.rem-alarms-input { max-width: 100px; }
.rem-alarms-unit { max-width: 80px; }

/* ============================================
   Notes — папки (folder chips) + showcase
   ============================================ */
.folder-chips {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 0 10px;
  margin: 0 -4px;  /* выходим за padding контейнера для эффекта edge-to-edge */
  scrollbar-width: thin;
}
.folder-chips::-webkit-scrollbar { height: 4px; }
.folder-chips::-webkit-scrollbar-thumb { background: var(--bn-line-1); border-radius: 2px; }
.folder-chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.folder-chip:hover {
  border-color: var(--bn-acc-bd-medium);
  color: var(--bn-text-1);
}
.folder-chip.active {
  background: var(--bn-acc-bg-medium);
  border-color: var(--bn-acc);
  color: var(--bn-acc);
  font-weight: 600;
}
.folder-chip-count {
  background: rgba(255,255,255,0.08);
  color: var(--bn-text-3);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 2px;
}
.folder-chip.active .folder-chip-count {
  background: var(--bn-acc-bd-soft);
  color: var(--bn-acc);
}
.folder-chip-add {
  border-style: dashed;
  color: var(--bn-text-3);
}

/* Move-to-folder sheet — список папок как cтек кнопок */
.folder-pick {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  margin-bottom: 6px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.folder-pick:hover {
  border-color: var(--bn-acc-bd-medium);
}
.folder-pick.active {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-soft);
}
.folder-pick-add {
  border-style: dashed;
  color: var(--bn-acc);
  font-weight: 600;
}

/* Notes showcase — intro + ghost-карточки с пометкой «пример» */
.notes-showcase-intro {
  padding: 20px 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg,
    var(--bn-acc-bg-soft),
    var(--bn-acc-bg-subtle));
  border: 1px dashed var(--bn-acc-bd-soft);
  border-radius: var(--bn-r-lg);
  text-align: center;
}
.notes-showcase-em { font-size: 36px; margin-bottom: 8px; line-height: 1; }
.notes-showcase-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--bn-text-1);
  margin-bottom: 8px;
}
.notes-showcase-sub {
  font-size: 13px;
  color: var(--bn-text-2);
  line-height: 1.55;
  margin-bottom: 16px;
}
.notes-showcase-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
/* Унифицированный «пример»-бэйдж используется по всему сайту в showcase'ах
   (Home widgets, Notes showcase, и т.п.). Стиль раньше дублировался в трёх
   разных классах (.ghost-label, .example-chip, .note-showcase::before) — теперь
   единый .ghost-label standalone применимый и в absolute (через .ghost-demo
   или .note-showcase wrapper), и inline (просто <span>). */
.ghost-label {
  display: inline-block;
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--bn-line-2);
  pointer-events: none;
  vertical-align: middle;
}
.note-card.note-showcase {
  opacity: 0.75;
  position: relative;
}
.note-card.note-showcase > .ghost-label {
  position: absolute;
  top: -8px; right: 12px;  /* выходит наполовину над карточкой — единообразно с Home widgets */
  z-index: 2;
}
/* Карточка не обрезает label который вылазит наверх */
.note-card.note-showcase { overflow: visible; }

/* Completed-чеклист — карточка в virtual папке «✅ Выполнено»: приглушённая,
   текст title зачёркнут, прогресс «N/N ✅» подкрашен зелёным. */
.note-card.completed {
  opacity: 0.7;
  border-color: color-mix(in srgb, #22C55E 25%, var(--bn-line-1));
}
.note-card.completed .note-text {
  text-decoration: line-through;
  color: var(--bn-text-3);
}
.note-progress.all-done {
  color: #22C55E;
  font-weight: 700;
}

/* Virtual chip «✅ Выполнено» — зеленоватый акцент чтобы отличаться от обычных папок */
.folder-chip.folder-chip-completed {
  border-color: color-mix(in srgb, #22C55E 35%, transparent);
  color: #22C55E;
}
.folder-chip.folder-chip-completed.active {
  background: color-mix(in srgb, #22C55E 18%, transparent);
  border-color: #22C55E;
  color: #22C55E;
}
.folder-chip.folder-chip-completed .folder-chip-count {
  background: color-mix(in srgb, #22C55E 18%, transparent);
  color: #22C55E;
}

/* Folder action sheet — заголовок чуть аккуратнее когда длинное название */
.bn-sheet-card .ent-head .ent-title { word-break: break-word; }

/* ============================================
   Notion-style accordion для папок заметок
   ============================================ */
.notes-flat-list > .sec-title:first-child { margin-top: 8px; }
.folder-acc {
  margin-bottom: 10px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  overflow: hidden;
  transition: border-color 0.18s var(--bn-ease);
}
.folder-acc:hover { border-color: var(--bn-line-2); }
.folder-acc.is-completed {
  border-color: color-mix(in srgb, #22C55E 22%, var(--bn-line-1));
  background: color-mix(in srgb, #22C55E 4%, var(--bn-bg-1));
}

.folder-acc-head {
  display: flex; align-items: stretch; gap: 0;
}
.folder-acc-toggle {
  flex: 1;
  display: flex; align-items: center; gap: 12px;
  background: transparent;
  border: none;
  color: inherit;
  padding: 14px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  min-width: 0;
}
.folder-acc-toggle:hover { background: rgba(255,255,255,0.02); }
.folder-acc-emoji {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bn-acc-bg-medium);
  border-radius: var(--bn-r-md);
  font-size: 20px;
  flex-shrink: 0;
}
.folder-acc.is-completed .folder-acc-emoji {
  background: color-mix(in srgb, #22C55E 16%, transparent);
}
.folder-acc-body { flex: 1; min-width: 0; }
.folder-acc-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--bn-text-1);
  letter-spacing: -0.01em;
}
.folder-acc-sub {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
}
.folder-acc-chev {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  color: var(--bn-text-3);
  transition: transform 0.22s var(--bn-ease), color 0.18s var(--bn-ease);
  flex-shrink: 0;
}
.folder-acc-chev svg { width: 18px; height: 18px; }
.folder-acc.expanded .folder-acc-chev { transform: rotate(180deg); color: var(--bn-acc); }

.folder-acc-act {
  background: transparent;
  border: none;
  color: var(--bn-text-3);
  width: 36px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.folder-acc-act:hover { color: var(--bn-text-1); background: rgba(255,255,255,0.04); }
.folder-acc-act.folder-acc-act-danger:hover { color: var(--bn-red); }
.folder-acc-act svg { width: 16px; height: 16px; }

.folder-acc-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.22s var(--bn-ease);
}
.folder-acc.expanded .folder-acc-content {
  grid-template-rows: 1fr;
}
.folder-acc-content > .folder-acc-notes {
  overflow: hidden;
  min-height: 0;
}
.folder-acc.expanded .folder-acc-content > .folder-acc-notes {
  padding: 4px 12px 14px;
  border-top: 1px solid var(--bn-line-1);
}
.folder-acc-notes .note-card {
  margin-bottom: 8px;
}
.folder-acc-notes .note-card:last-child { margin-bottom: 0; }
.folder-acc-notes .empty-mini {
  background: transparent;
  border: 1px dashed var(--bn-line-1);
  font-size: 12px;
  color: var(--bn-text-3);
  padding: 14px 12px;
  text-align: center;
  border-radius: var(--bn-r-md);
}

/* Inline-picker зодиака для horoscope-widget (когда знак не выбран).
   Grid 4 колонки × 3 ряда — все 12 знаков сразу видны без скролла. */
.zodiac-pick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.zodiac-pick-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  border-radius: var(--bn-r-md);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s ease;
}
.zodiac-pick-tile:hover {
  border-color: var(--bn-acc-bd-medium);
  color: var(--bn-text-1);
  background: var(--bn-acc-bg-subtle);
}
.zodiac-pick-tile:active { transform: scale(0.95); }
.zodiac-pick-tile.selecting {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-medium);
  color: var(--bn-acc);
  pointer-events: none;
  opacity: 0.7;
}
.zodiac-pick-em { font-size: 22px; line-height: 1; }
.zodiac-pick-nm { font-size: 11px; font-weight: 500; line-height: 1.15; }

/* Выбор папки в quick-note sheet — горизонтальный chips-блок под textarea */
.qn-folders {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
}
.qn-folders-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin-bottom: 8px;
}
.qn-folders-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.qn-folder-chip {
  background: transparent;
  border: 1px solid var(--bn-line-2);
  color: var(--bn-text-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.qn-folder-chip:hover {
  border-color: var(--bn-acc-bd-medium);
  color: var(--bn-text-1);
}
.qn-folder-chip.active {
  background: var(--bn-acc-bg-medium);
  border-color: var(--bn-acc);
  color: var(--bn-acc);
  font-weight: 600;
}

/* ✓-кнопка «Готово» для plain-text заметок */
.note-act.note-act-done.on {
  color: #22C55E;
  background: color-mix(in srgb, #22C55E 14%, transparent);
  border-radius: 50%;
}
.note-act.note-act-done:hover { color: #22C55E; }

/* =================== Progress bar =================== */
.progress {
  position: relative;
  background: var(--bn-bg-3);
  border-radius: var(--bn-r-pill);
  height: 6px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bn-mint), var(--bn-acc));
  border-radius: inherit;
  transition: width 0.6s var(--bn-spring);
}
.progress.warn span { background: linear-gradient(90deg, var(--bn-gold), var(--bn-red)); }
.progress.over span { background: linear-gradient(90deg, var(--bn-red), #FF3047); }

/* =================== Chips =================== */
.chips {
  display: flex; gap: 6px;
  overflow-x: auto;
  margin-bottom: 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--bn-r-pill);
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  font-size: 13px;
  font-weight: 500;
  color: var(--bn-text-2);
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease), transform 0.1s ease;
  white-space: nowrap;
}
.chip:active { transform: scale(0.96); }
.chip.active {
  background: var(--bn-text-1);
  color: var(--bn-bg-0);
  border-color: transparent;
  font-weight: 600;
}

/* =================== Empty state =================== */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--bn-text-3);
}
.empty .em {
  font-size: 56px;
  margin-bottom: 14px;
  opacity: 0.7;
}
.empty small { display: block; margin-top: 8px; font-size: 12px; opacity: 0.7; }

.tap-tip {
  display: flex; align-items: center; gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, var(--bn-acc-bg-soft), rgba(151, 133, 250, 0.05));
  border: 1px solid var(--bn-acc-bg-strong);
  border-radius: var(--bn-r-lg);
}
.tap-tip .em { font-size: 36px; }
.tap-tip b { color: var(--bn-text-1); }
.tap-tip i { color: var(--bn-acc-2); font-style: normal; }

/* =================== Empty Home Showcase =================== */
/* Полноценный empty-state когда у юзера нет ни одной записи.
   4 demo-tile карточки имитируют будущие виджеты; тап → создание
   первой записи через POST /api/text → renderHome заново. */
.empty-home-showcase {
  padding: 8px 0 24px;
  animation: ehsFadeIn 0.4s ease;
}
@keyframes ehsFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.ehs-hero {
  text-align: center;
  padding: 12px 16px 28px;
}
.ehs-mascot {
  width: 96px; height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 6px 24px rgba(122, 90, 248, 0.4));
  margin-bottom: 14px;
}
.ehs-greet {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--bn-text-1) 0%, #c4b5fd 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ehs-sub {
  font-size: 14px;
  color: var(--bn-text-3);
  line-height: 1.45;
  max-width: 280px;
  margin: 0 auto;
}

.ehs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 4px;
}
.ehs-tile {
  appearance: none;
  background: linear-gradient(135deg, var(--bn-acc-bg-soft), rgba(151, 133, 250, 0.04));
  border: 1px dashed rgba(151, 133, 250, 0.3);
  border-radius: var(--bn-r-lg);
  padding: 14px 12px;
  display: flex; flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.4,0,.2,1);
  color: inherit;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.ehs-tile:hover, .ehs-tile:active {
  border-style: solid;
  border-color: rgba(151, 133, 250, 0.6);
  background: linear-gradient(135deg, var(--bn-acc-bg-medium), rgba(151, 133, 250, 0.08));
  transform: translateY(-1px);
}
.ehs-tile.processing {
  opacity: 0.6;
  pointer-events: none;
}
.ehs-tile-icon {
  font-size: 24px;
  line-height: 1;
}
.ehs-tile-title {
  font-size: 13px; font-weight: 600;
  color: var(--bn-text-2);
  letter-spacing: -0.01em;
}
.ehs-tile-example {
  font-size: 11px;
  color: var(--bn-text-3);
  font-style: italic;
  line-height: 1.3;
}

.ehs-cta {
  text-align: center;
  margin-top: 20px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--bn-text-3);
  line-height: 1.5;
}

/* =================== Usage chips =================== */
.usage-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.usage-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  border-radius: var(--bn-r-pill);
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  font-size: 11px;
  color: var(--bn-text-2);
  font-weight: 500;
  font-feature-settings: "tnum" on;
}
.usage-chip .ic { font-size: 12px; }
.usage-chip b { color: var(--bn-text-1); font-weight: 700; }
.usage-chip.warn { border-color: rgba(255, 181, 71, 0.35); color: var(--bn-gold); }
.usage-chip.full { border-color: rgba(255, 107, 122, 0.35); color: var(--bn-red); }

.upsell {
  background: linear-gradient(135deg, var(--bn-acc-bg-medium), rgba(255, 217, 61, 0.10));
  border: 1px solid var(--bn-acc-bd-soft);
  border-radius: var(--bn-r-lg);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.15s var(--bn-spring);
  position: relative;
  overflow: hidden;
}
.upsell:active { transform: scale(0.98); }
.upsell::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 100% at 100% 50%, rgba(255, 217, 61, 0.18), transparent 60%);
  pointer-events: none;
}
.upsell .star { font-size: 28px; line-height: 1; }
.upsell .ttl {
  font-weight: 800; font-size: 16px; letter-spacing: -0.01em;
  margin-top: 6px;
}
.upsell .meta {
  font-size: 12px; color: var(--bn-text-2); margin-top: 4px;
}
.upsell b { color: var(--bn-gold); }

/* =================== Sheets (bottom modals) =================== */
.bn-sheet {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end;
  z-index: 200;
  animation: bn-fade 0.18s ease;
  backdrop-filter: blur(2px);
}
.bn-sheet.center { align-items: center; justify-content: center; }
.bn-sheet-card {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-2);
  border-bottom: none;
  border-top-left-radius: var(--bn-r-xl);
  border-top-right-radius: var(--bn-r-xl);
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  animation: bn-slideup 0.28s var(--bn-spring);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.55);
}
@keyframes bn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bn-slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.bn-sheet-handle {
  width: 36px; height: 4px;
  background: var(--bn-line-3);
  border-radius: 2px;
  margin: 0 auto 16px;
  cursor: grab;
  position: relative;
  /* Невидимая большая touch-area вокруг handle для удобства таскания */
}
.bn-sheet-handle::before {
  content: '';
  position: absolute;
  inset: -14px -60px;  /* большая невидимая область для жеста */
}
.bn-sheet-handle:active { cursor: grabbing; background: var(--bn-text-3); }
/* Подсказка что sheet можно тянуть — handle мигает первый раз */
.bn-sheet-card { will-change: transform; }
.bn-sheet-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.bn-sheet-sub {
  color: var(--bn-text-3);
  font-size: 13px;
  margin-bottom: 18px;
}

.set-row {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
  /* ВАЖНО: .set-row часто рендерится как <button> — на Android WebView
     дефолтный color у button = системный (тёмный) и игнорирует наследование
     от родителя. Без явного color заголовки внутри выглядят чёрными на
     тёмном фоне. Плюс button по дефолту width:auto (inline-block), а не
     100% — поэтому tz/lang/cur выглядели короче чем остальные строки. */
  color: var(--bn-text-1);
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.set-row .t { color: var(--bn-text-1); font-weight: 600; font-size: 14px; }
.set-row .s { color: var(--bn-text-3); font-size: 12px; margin-top: 2px; }
.set-row .body { flex: 1; min-width: 0; text-align: left; }
.set-row .lbl { font-size: 13px; color: var(--bn-text-3); flex-shrink: 0; }

/* Picker-вариант .set-row — кнопка с текущим значением справа и chevron'ом */
.set-row.set-row-picker { cursor: pointer; text-align: left; }
.set-row.set-row-picker:active { background: var(--bn-bg-3); }
.set-row .set-picker-value {
  flex: 1;
  color: var(--bn-text-1);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.set-row .set-picker-chev {
  color: var(--bn-text-3);
  font-size: 22px;
  line-height: 1;
  margin-left: 2px;
  flex-shrink: 0;
}

/* Picker sheet — список радио-опций (timezone, language, currency и т.п.) */
.bn-picker-card { max-height: 70vh; }
.bn-picker-list {
  margin-top: 8px;
  max-height: 56vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.bn-picker-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.12s ease;
}
.bn-picker-row:hover, .bn-picker-row:active { background: var(--bn-bg-3); }
.bn-picker-row.selected { background: rgba(122, 90, 248, 0.12); }
.bn-picker-label { flex: 1; }
.bn-picker-check {
  color: var(--bn-accent, #7A5AF8);
  font-size: 18px;
  font-weight: 700;
  width: 20px;
  text-align: right;
}
.set-row .ic { font-size: 18px; flex-shrink: 0; opacity: 0.95; }
.set-row select, .set-row input[type="time"] {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--bn-text-1);
  font-size: 14px;
  outline: none;
  text-align: right;
  font-family: inherit;
  font-weight: 500;
}
.set-row select option { background: var(--bn-bg-1); color: var(--bn-text-1); }
.set-row .switch {
  margin-left: auto;
  width: 44px; height: 26px;
  background: var(--bn-bg-3);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.18s var(--bn-ease);
  flex-shrink: 0;
}
.set-row .switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.22s var(--bn-spring);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.set-row .switch.on {
  background: var(--bn-acc);
  box-shadow: 0 0 12px var(--bn-acc-glow);
}
.set-row .switch.on::after { transform: translateX(18px); }
.set-row .body { flex: 1; min-width: 0; }
.set-row .body .t { font-weight: 600; font-size: 14px; }
.set-row .body .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; }

.theme-pick {
  display: flex; gap: 6px;
}

/* Voice/tone picker — несколько кнопок-чипов рядом, могут переносится
   на узких экранах (для TTS-голосов: Nova/Alloy/Echo/Fable/Onyx/Shimmer). */
.tone-pick {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.tone-pick button {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  padding: 8px 14px;
  border-radius: var(--bn-r-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease);
}
.tone-pick button:active { background: var(--bn-bg-3); }
.tone-pick button.active {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  border-color: transparent;
  color: #F7F5FF;
  font-weight: 600;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.theme-pick button {
  flex: 1;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  padding: 10px 6px;
  border-radius: var(--bn-r-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--bn-ease);
}
.theme-pick button.active {
  /* Gradient к --bn-acc-deep — тот же тон что у CTA-микрофона (cta-circle).
     Solid `var(--bn-acc)` выглядел плоско и слишком ярко-violet рядом
     с glassy дизайном остального UI. */
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  border-color: transparent;
  color: #F7F5FF;
  font-weight: 600;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* =================== Timeline rows =================== */
.tl-item {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--bn-line-1);
}
.tl-item:last-child { border-bottom: none; }
.tl-item .ico {
  width: 38px; height: 38px;
  border-radius: var(--bn-r-md);
  background: var(--bn-acc-bg-soft);
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.tl-item.expense .ico { background: var(--bn-red-glow); }
.tl-item.income .ico { background: var(--bn-mint-glow); }
.tl-item.note .ico { background: rgba(151, 133, 250, 0.14); }
.tl-item .body { flex: 1; min-width: 0; }
.tl-item .body .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item .body .m { font-size: 11px; color: var(--bn-text-3); margin-top: 2px; }
.tl-item .right { font-weight: 700; font-size: 14px; flex-shrink: 0; font-feature-settings: "tnum" on; }
.tl-item.expense .right { color: var(--bn-red); }
.tl-item.income .right { color: var(--bn-mint); }

/* =================== Voice / Text input modals =================== */
.text-modal, .voice-modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: bn-fade 0.18s ease;
  backdrop-filter: blur(4px);
}
.text-modal-card, .voice-card {
  width: 100%; max-width: 420px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-2);
  border-radius: var(--bn-r-xl);
  padding: 22px;
  animation: bn-pop 0.22s var(--bn-spring);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.7);
}
@keyframes bn-pop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
#txt-input {
  width: 100%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
  min-height: 84px;
  outline: none;
  transition: border-color 0.15s var(--bn-ease);
}
#txt-input:focus { border-color: var(--bn-acc); box-shadow: 0 0 0 3px var(--bn-acc-glow); }
#txt-input::placeholder { color: var(--bn-text-4); }

.text-modal-actions {
  display: flex; gap: 8px;
  margin-top: 14px;
}

/* Все .voice-btn теперь ghost (outline) — единый стиль для primary actions в
   sheet'ах (Сохранить/Создать/Отправить). Юзер просил убрать full-violet
   везде по сайту. Микрофон (FAB), бэйджи статусов и индикаторы — отдельные
   правила выше/ниже, их не трогаем. */
.voice-btn {
  background: transparent;
  color: var(--bn-acc);
  border: 1.5px solid var(--bn-acc-bd-medium);
  padding: 11px 18px;
  border-radius: var(--bn-r-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s var(--bn-spring), border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease), color 0.18s var(--bn-ease);
}
.voice-btn:active { transform: scale(0.96); }
.voice-btn:hover {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-soft);
}
.voice-btn.send {
  /* .send — primary: идентичный стиль с .bn-ghost-btn для единообразия */
  border-color: var(--bn-acc);
}
.voice-btn.send:hover {
  background: var(--bn-acc-bg-soft);
}
.voice-btn.cancel {
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  border: 1px solid var(--bn-line-2);
}

/* Универсальный filled-CTA: brand gradient + soft shadow. Используется
   для главных кнопок в sheet'ах («Сохранить», «Создать», «Готово»). */
.voice-btn.bn-cta-filled,
.bn-cta-filled {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  color: #F7F5FF;
  border: none;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.voice-btn.bn-cta-filled:hover,
.bn-cta-filled:hover {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  filter: brightness(1.05);
}
.voice-btn.cancel:hover {
  border-color: var(--bn-line-3);
  color: var(--bn-text-1);
}

.voice-mic-big {
  width: 88px; height: 88px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 38px;
  background: linear-gradient(135deg, var(--bn-acc), var(--bn-acc-deep));
  box-shadow: 0 12px 40px var(--bn-acc-glow);
  color: white;
}

/* Voice modal: внутренние элементы (label, visualizer, timer, actions, hint) */
.voice-card .lbl {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin-bottom: 14px;
}
.voice-bars {
  display: flex; gap: 3px;
  height: 40px;
  justify-content: center;
  align-items: center;
  margin: 4px 0 8px;
}
.voice-bars i {
  width: 3px;
  height: 4px;
  background: linear-gradient(180deg, var(--bn-acc-2), var(--bn-acc));
  border-radius: 2px;
  transition: height 0.08s linear;
  flex-shrink: 0;
}
.voice-timer {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" on;
  color: var(--bn-text-1);
  margin: 4px 0 14px;
}
.voice-actions {
  display: flex; gap: 8px;
  margin-bottom: 8px;
}
.voice-actions .voice-btn { flex: 1; }
.voice-btn.stop {
  background: linear-gradient(135deg, var(--bn-red), #DC2626);
  color: white;
  box-shadow: 0 4px 14px var(--bn-red-glow);
}
.voice-btn.stop:hover { box-shadow: 0 8px 22px var(--bn-red-glow); }
.voice-hint {
  text-align: center;
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 6px;
  line-height: 1.45;
}
.voice-mic-big.recording {
  animation: bn-pulse-rec 1.2s ease-in-out infinite;
}
@keyframes bn-pulse-rec {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 40px var(--bn-acc-glow); }
  50% { transform: scale(1.06); box-shadow: 0 12px 60px var(--bn-acc-glow); }
}
.voice-transcript {
  text-align: center;
  color: var(--bn-text-2);
  font-style: italic;
  margin-top: 8px;
  font-size: 14px;
}
.voice-result {
  margin-top: 14px;
  padding: 14px;
  background: var(--bn-bg-2);
  border-radius: var(--bn-r-md);
  font-size: 14px;
  color: var(--bn-text-1);
  white-space: pre-wrap;
}

/* Кнопки действий в showInputResult: Изменить / Удалить / Готово */
.result-actions {
  display: flex; gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.result-actions .voice-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 11px 12px;
  font-size: 13px;
  white-space: nowrap;
}
.result-actions .voice-btn.send { flex: 1.4 1 0; }
.result-actions .result-del:hover {
  background: var(--bn-red-glow);
  color: var(--bn-red);
  border-color: rgba(255, 107, 122, 0.30);
}

/* =================== Stats charts =================== */
.donut-wrap {
  display: flex; align-items: center; gap: 18px;
  padding: 16px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  margin-bottom: 12px;
}
.donut-wrap svg { flex-shrink: 0; width: 120px; height: 120px; }
.donut-legend { flex: 1; }
.donut-legend .row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--bn-text-2);
}
.donut-legend .row .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .row .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend .row .v { color: var(--bn-text-1); font-weight: 600; font-feature-settings: "tnum" on; }

.bars-wrap {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  padding: 14px 14px 12px;
  margin-bottom: 12px;
}
.bars { display: flex; align-items: flex-end; gap: 4px; height: 100px; padding: 6px 0; }
.bar {
  flex: 1;
  min-width: 4px;
  background: linear-gradient(180deg, var(--bn-acc), var(--bn-acc-deep));
  border-radius: 4px 4px 0 0;
  transition: height 0.5s var(--bn-spring);
  cursor: default;
}
.bar.zero {
  background: var(--bn-bg-3);
  opacity: 0.4;
}
/* Подписи дат под барами — flex с тем же gap, чтобы выровнялись с барами */
.bars-labels {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--bn-text-3);
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" on;
}
.bars-labels span {
  flex: 1;
  min-width: 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}
.bars-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--bn-line-1);
  font-size: 12px;
  color: var(--bn-text-2);
  font-feature-settings: "tnum" on;
}
.bars-summary span { color: var(--bn-text-2); }
.bars-summary span::before {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  content: '';
  background: var(--bn-text-3);
}

/* Stats summary tiles & donut legend (улучшенные стили) */
.stats-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.stat-tile {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  padding: 14px 16px;
}
.stat-tile .lbl {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--bn-text-3);
  margin-bottom: 4px;
}
.stat-tile .val {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" on;
}
.stat-tile.inc .val { color: var(--bn-mint); }
.stat-tile.exp .val { color: var(--bn-red); }

.donut-legend .row .dot-c {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.donut-legend .row .vl {
  color: var(--bn-text-1);
  font-weight: 600;
  font-feature-settings: "tnum" on;
  font-size: 12px;
}
.donut-legend .row .pc {
  color: var(--bn-text-3);
  font-size: 11px;
  width: 32px;
  text-align: right;
  font-feature-settings: "tnum" on;
}

/* =================== Calendar: segmented control + month grid =================== */
.seg {
  display: inline-flex;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-pill);
  padding: 4px;
  margin-bottom: 14px;
  gap: 2px;
}
.seg.seg-2,
.seg.seg-3,
.seg.seg-4 {
  display: flex;
  width: 100%;
}

/* Финансы → Аналитика → карточка «Текущий баланс» с кнопкой редактирования */
.bn-balance-card {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 18%, var(--bn-bg-1)),
    var(--bn-bg-1));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 25%, var(--bn-line-1));
  border-radius: var(--bn-r-lg);
  padding: 16px 18px;
  margin: 12px 0 14px;
  position: relative;
}
.bn-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.bn-balance-actions {
  display: flex;
  gap: 8px;
}
.bn-balance-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bn-text-3);
}
.bn-balance-edit {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--bn-line-2);
  color: var(--bn-text-2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
  font-size: 14px;
}
.bn-balance-edit:hover { background: rgba(255, 255, 255, 0.1); }
.bn-balance-edit:active { transform: scale(0.92); }
.bn-balance-amount {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
  color: var(--bn-text-1);
}
.bn-balance-breakdown {
  font-size: 12px;
  color: var(--bn-text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.bn-balance-breakdown .pos { color: var(--bn-mint); }
.bn-balance-breakdown .neg { color: var(--bn-red); }

/* Финансы → Транзакции → кнопка "Фильтры" + badge с количеством активных фильтров */
.fin-filter-btn { position: relative; }
.fin-filter-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--bn-acc-2);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  line-height: 1;
}
.filter-section { margin-bottom: 16px; padding: 0 16px; }
.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin-bottom: 8px;
}
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-row input[type="date"],
.filter-row input[type="number"] {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  color: inherit;
  font-size: 14px;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chips .chip {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.filter-chips .chip.active {
  background: var(--bn-acc-bg-medium);
  border-color: rgba(122, 90, 248, 0.50);
  color: var(--bn-text-1);
}
.filter-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px 20px;
}
.filter-actions .voice-btn { flex: 1; }
/* Фиксированная высота btn 34px → .seg контейнер ровно 42px (с padding 4+4).
   Используем height + box-sizing border-box чтобы content не растягивал. */
.seg.seg-2 .seg-btn,
.seg.seg-3 .seg-btn,
.seg.seg-4 .seg-btn {
  flex: 1; justify-content: center;
  height: 34px; box-sizing: border-box;
  padding-top: 0; padding-bottom: 0;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: none;
  color: var(--bn-text-3);
  padding: 8px 14px;
  border-radius: var(--bn-r-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.18s var(--bn-ease), background 0.2s var(--bn-ease), transform 0.1s ease;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .seg.seg-3 .seg-btn,
  .seg.seg-4 .seg-btn { padding: 7px 6px; font-size: 13px; gap: 4px; }
  .seg.seg-3 .seg-btn svg,
  .seg.seg-4 .seg-btn svg { width: 13px; height: 13px; }
}
/* 4 финансовые таба: на узких экранах показываем .lbl-short вместо .lbl-full.
   Высота 34px (фиксирована выше в seg-2/3/4 общем правиле). */
.seg.seg-4 .seg-btn .lbl-short { display: none; }
@media (max-width: 420px) {
  .seg.seg-4 .seg-btn .lbl-full { display: none; }
  .seg.seg-4 .seg-btn .lbl-short { display: inline; }
  .seg.seg-4 .seg-btn { padding-left: 6px; padding-right: 6px; font-size: 13px; gap: 5px; }
  .seg.seg-4 .seg-btn svg { width: 14px; height: 14px; }
}
/* Очень узкий — оставляем только иконки */
@media (max-width: 340px) {
  .seg.seg-4 .seg-btn .lbl-short { display: none; }
}
.seg-btn:active { transform: scale(0.96); }
.seg-btn svg { width: 15px; height: 15px; }
.seg-btn.active {
  background: var(--bn-bg-3);
  color: var(--bn-text-1);
}

.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0 12px;
  gap: 8px;
}
.month-nav-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-2);
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), transform 0.1s ease;
}
.month-nav-btn:active { transform: scale(0.92); }
.month-nav-btn:hover { background: var(--bn-bg-2); color: var(--bn-text-1); }
.month-nav-btn svg { width: 16px; height: 16px; }
.month-nav-title {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--bn-r-md);
  transition: background 0.15s var(--bn-ease);
}
.month-nav-title:hover { background: var(--bn-bg-1); }

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  padding: 4px 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  text-align: center;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.mc {
  position: relative;
  aspect-ratio: 1;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 6px 0 0 8px;
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease), transform 0.08s ease;
}
.mc:active { transform: scale(0.94); }
.mc:hover:not(.muted) { background: var(--bn-bg-2); }
.mc.muted {
  opacity: 0.32;
  cursor: default;
  background: transparent;
}
.mc.muted:hover { background: transparent; }
.mc.today {
  background: var(--bn-acc-bg-soft);
  border-color: rgba(122, 90, 248, 0.40);
}
.mc.today .mc-num {
  color: var(--bn-acc);
  font-weight: 800;
}
.mc.selected {
  background: var(--bn-acc-bg-medium);
  border-color: var(--bn-acc);
}
.mc.selected .mc-num { color: var(--bn-acc); font-weight: 700; }
.mc.selected .mc-dot { background: var(--bn-acc); }

.mc-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--bn-text-2);
  font-feature-settings: "tnum" on;
  line-height: 1;
}

.mc-dots {
  position: absolute;
  bottom: 6px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
}
.mc-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--bn-text-3);
}
.mc-dot.default { background: var(--bn-acc-2); }
.mc-dot.high { background: var(--bn-red); box-shadow: 0 0 4px var(--bn-red-glow); }
.mc-dot.gcal { background: #4285F4; }
.mc-dot.life-birthday { background: var(--bn-gold); }
.mc-dot.life-anniversary { background: #FF6BC1; }
.mc-dot.life-milestone { background: var(--bn-gold); }
.mc-dot.life-custom { background: var(--bn-text-2); }

.day-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bn-text-2);
  margin: 14px 4px 8px;
  text-transform: capitalize;
}
.day-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  color: var(--bn-acc);
  border: 1.5px solid var(--bn-acc-bd-medium);
  padding: 6px 12px 6px 10px;
  border-radius: var(--bn-r-pill);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  transition: transform 0.12s var(--bn-spring), border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease);
}
.day-add-btn:active { transform: scale(0.96); }
.day-add-btn:hover {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-soft);
}
.day-add-btn svg { width: 14px; height: 14px; }

/* Кнопка-корзина в day-detail списке */
.li-del {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--bn-text-3);
  border-radius: var(--bn-r-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease);
}
.li-del:hover { background: var(--bn-red-glow); color: var(--bn-red); border-color: rgba(255, 107, 122, 0.30); }
.li-del:active { transform: scale(0.92); }
.li-del svg { width: 14px; height: 14px; }

/* =================== Reminder create form =================== */
.rem-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin: 14px 0 6px;
}
/* Amount + compact currency button в форме расхода/дохода */
.ei-amount-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.ei-amount-row .ei-amount {
  flex: 1;
  min-width: 0;       /* fix для flex overflow на узких viewport */
  width: auto;        /* override .rem-input { width: 100% } */
}
.ei-cur-btn {
  flex: 0 0 auto;
  min-width: 68px;
  padding: 11px 14px;
  background: var(--bn-bg-3);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--bn-ease);
}
.ei-cur-btn:active { background: var(--bn-bg-2); }

/* ============== Category manager ============== */
.cm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  margin-bottom: 6px;
  transition: opacity 0.15s var(--bn-ease);
}
.cm-row.is-hidden { opacity: 0.42; }
.cm-em { font-size: 22px; flex-shrink: 0; }
.cm-nm {
  flex: 1; min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--bn-text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  margin-left: 6px;
  background: rgba(122, 90, 248, 0.18);
  color: var(--bn-acc);
  border-radius: 6px;
  text-transform: uppercase;
}
.cm-del {
  background: rgba(220, 38, 38, 0.14);
  border: 0;
  color: #ff7b7b;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: grid; place-items: center;
}
.cm-del:active { background: rgba(220, 38, 38, 0.25); }
.cm-toggle {
  position: relative;
  width: 38px; height: 22px;
  background: var(--bn-bg-3);
  border: 1px solid var(--bn-line-1);
  border-radius: 11px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s var(--bn-ease);
}
.cm-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.22s var(--bn-spring);
}
.cm-toggle.on {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  border-color: transparent;
}
.cm-toggle.on::after { transform: translateX(16px); }

/* =============== Native Paywall sheet (RevenueCat) =============== */
.pw-features {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}
.pw-feat {
  font-size: 13px;
  color: var(--bn-text-2);
  line-height: 1.5;
}
.pw-option {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-1);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease);
}
.pw-option:active { background: var(--bn-bg-3); }
.pw-option.featured {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 14%, var(--bn-bg-1)),
    var(--bn-bg-1));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-1));
}
.pw-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--bn-acc, #7A5AF8);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 8px;
}
.pw-opt-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--bn-text-1);
}
.pw-opt-price {
  font-size: 13px;
  color: var(--bn-text-2);
  margin-top: 2px;
}

.rem-input {
  width: 100%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 11px 14px;
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s var(--bn-ease), box-shadow 0.18s var(--bn-ease);
  font-feature-settings: "tnum" on;
}
textarea.rem-input { resize: vertical; min-height: 60px; font-size: 14px; }
select.rem-input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237E7E9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}
select.rem-input option { background: var(--bn-bg-1); color: var(--bn-text-1); }
.rem-input::placeholder { color: var(--bn-text-4); }
.rem-input:focus {
  border-color: var(--bn-acc);
  box-shadow: 0 0 0 3px var(--bn-acc-glow);
}

.rem-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rem-pills {
  display: flex; gap: 6px;
}
.rem-pill {
  flex: 1;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  padding: 10px 6px;
  border-radius: var(--bn-r-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease), color 0.15s var(--bn-ease);
}
.rem-pill:active { transform: scale(0.96); }
.rem-pill.active {
  /* Тот же gradient что у CTA-микрофона/Settings — единый brand-тон */
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  border-color: transparent;
  color: #F7F5FF;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.rem-pill.high.active {
  background: linear-gradient(180deg, var(--bn-red) 0%, color-mix(in srgb, var(--bn-red) 60%, #000) 100%);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.rem-extra {
  margin-top: 12px;
  padding: 0;
  border-top: 1px dashed var(--bn-line-1);
  padding-top: 4px;
}
.rem-extra summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--bn-text-3);
  padding: 8px 0;
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.rem-extra summary::-webkit-details-marker { display: none; }
.rem-extra summary::before {
  content: '+';
  font-size: 18px;
  font-weight: 300;
  color: var(--bn-text-3);
  transition: transform 0.18s var(--bn-spring);
  display: inline-block;
}
.rem-extra[open] summary::before { transform: rotate(45deg); color: var(--bn-acc-2); }

.rem-actions {
  display: flex; gap: 8px;
  margin-top: 22px;
}
.rem-actions .voice-btn { flex: 1; }

/* =================== Brain-dump button (quick note) =================== */
.brain-dump-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  margin-bottom: 14px;
  background:
    radial-gradient(70% 100% at 100% 50%, rgba(0, 229, 176, 0.10), transparent 60%),
    var(--bn-bg-1);
  border: 1px dashed rgba(0, 229, 176, 0.30);
  border-radius: var(--bn-r-lg);
  color: var(--bn-text-1);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.14s var(--bn-spring), border-color 0.18s var(--bn-ease), background 0.2s var(--bn-ease);
}
.brain-dump-btn:active { transform: scale(0.98); }

/* Search input в Notes tab + результаты по группам */
.notes-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--bn-bg-1);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease);
}
.notes-search-input:focus {
  outline: none;
  border-color: rgba(151,133,250,0.45);
  background: var(--bn-bg-2);
}
.notes-search-input::placeholder { color: var(--bn-text-3); }

.search-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bn-text-3);
  margin: 14px 4px 8px;
}
.search-result-card {
  padding: 12px 14px;
  margin-bottom: 6px;
  background: var(--bn-bg-1);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--bn-r-md);
  font-size: 13px;
  line-height: 1.45;
  color: var(--bn-text-1);
}
.search-result-date {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--bn-text-3);
}
.brain-dump-btn:hover {
  border-color: rgba(0, 229, 176, 0.55);
  border-style: solid;
}
.brain-dump-btn.compact {
  padding: 12px 14px;
}
.brain-dump-btn .bd-icon {
  width: 40px; height: 40px;
  border-radius: var(--bn-r-md);
  background: linear-gradient(135deg, var(--bn-mint), #00B58A);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: white;
  box-shadow: 0 4px 14px var(--bn-mint-glow);
}
.brain-dump-btn .bd-icon svg { width: 20px; height: 20px; }
.brain-dump-btn .bd-body { flex: 1; min-width: 0; }
.brain-dump-btn .bd-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brain-dump-btn .bd-sub {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
}
.brain-dump-btn .bd-arrow {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--bn-bg-3);
  color: var(--bn-text-2);
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.18s var(--bn-ease), color 0.18s var(--bn-ease);
}
.brain-dump-btn:hover .bd-arrow {
  background: var(--bn-mint);
  color: var(--bn-bg-0);
}
.brain-dump-btn .bd-arrow svg { width: 14px; height: 14px; }

/* =================== Note cards (rewritten Notes tab) =================== */
.note-card {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.18s var(--bn-ease);
}
.note-card.pinned {
  border-color: rgba(255, 181, 71, 0.30);
  background:
    radial-gradient(60% 100% at 100% 0%, rgba(255, 181, 71, 0.08), transparent 60%),
    var(--bn-bg-1);
}
.note-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.note-time {
  font-size: 11px;
  color: var(--bn-text-3);
  font-feature-settings: "tnum" on;
  letter-spacing: 0.02em;
}
.note-actions { display: flex; gap: 4px; }
.note-act {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--bn-text-3);
  border-radius: var(--bn-r-sm);
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), color 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease);
}
.note-act:active { transform: scale(0.92); }
.note-act svg { width: 14px; height: 14px; }
.note-act:hover { background: var(--bn-bg-2); color: var(--bn-text-1); border-color: var(--bn-line-2); }
.note-act.on { background: var(--bn-gold-glow); color: var(--bn-gold); border-color: rgba(255, 181, 71, 0.30); }
.note-act.danger:hover { background: var(--bn-red-glow); color: var(--bn-red); border-color: rgba(255, 107, 122, 0.30); }
.note-text {
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--bn-text-1);
}
.note-tags {
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.note-tags span,
.note-tags .note-tag {
  font-size: 11px;
  color: var(--bn-acc-2);
  background: var(--bn-acc-bg-soft);
  border-radius: var(--bn-r-pill);
  border: 1px solid transparent;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease);
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  padding: 0;
  overflow: hidden;
}
.note-tags .note-tag:hover {
  background: var(--bn-acc-bg-medium);
  border-color: color-mix(in srgb, var(--bn-acc) 30%, transparent);
}
.note-tag-label {
  cursor: pointer;
  padding: 2px 4px 2px 8px;
  display: inline-block;
}
.note-tag-del {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--bn-acc-2);
  opacity: 0.55;
  font-size: 14px;
  line-height: 1;
  padding: 0 7px 0 3px;
  font-weight: 700;
  transition: opacity 0.15s var(--bn-ease), color 0.15s var(--bn-ease);
}
.note-tag-del:hover {
  opacity: 1;
  color: var(--bn-red);
}
.note-tag-del:active { transform: scale(0.9); }
.note-checklist {
  margin-top: 10px;
  display: grid; gap: 4px;
}
.check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--bn-r-sm);
  cursor: pointer;
  transition: background 0.14s var(--bn-ease);
}
.check-item:hover { background: var(--bn-bg-2); }
.check-item .box {
  width: 18px; height: 18px;
  border: 1.5px solid var(--bn-line-3);
  border-radius: 5px;
  flex-shrink: 0;
  position: relative;
  transition: background 0.18s var(--bn-ease), border-color 0.18s var(--bn-ease);
}
.check-item.done .box {
  background: var(--bn-acc);
  border-color: var(--bn-acc);
}
.check-item.done .box::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check-item .text {
  flex: 1;
  font-size: 14px;
  color: var(--bn-text-1);
}
.check-item.done .text {
  color: var(--bn-text-3);
  text-decoration: line-through;
  text-decoration-color: var(--bn-text-4);
}
.note-progress {
  margin-top: 8px;
  font-size: 11px;
  color: var(--bn-text-3);
  font-weight: 600;
  font-feature-settings: "tnum" on;
}

/* =================== Section title with inline + button (Бюджеты, Цели и т.п.) =================== */
.sec-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 4px 10px;
}
.sec-add-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: transparent;
  color: var(--bn-acc);
  border: 1.5px solid var(--bn-acc-bd-medium);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s var(--bn-spring), border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease), color 0.18s var(--bn-ease);
}
.sec-add-btn:active { transform: scale(0.92); }
.sec-add-btn:hover {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-soft);
}
.sec-add-btn svg { width: 14px; height: 14px; }

/* Ghost button — secondary CTA с violet outline, без заливки.
   Используется для «Выбрать знак», «Идея в голове?» и подобных вторичных
   действий, чтобы они не конкурировали по визуальному весу с primary
   (микрофон, «Оформить Premium», «Сохранить»). */
.bn-ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  background: transparent;
  color: var(--bn-acc);
  border: 1.5px solid var(--bn-acc-bd-medium);
  border-radius: var(--bn-r-md);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.18s var(--bn-ease), background 0.18s var(--bn-ease), color 0.18s var(--bn-ease);
}
.bn-ghost-btn:hover {
  border-color: var(--bn-acc);
  background: var(--bn-acc-bg-soft);
}
.bn-ghost-btn:active { transform: scale(0.98); }

/* Profile card — карточка сверху Settings sheet с identity + Premium-статусом
   + кнопкой «Повторить обучение». Юзер раньше не знал свой email — теперь
   видит сразу при открытии Settings. */
.profile-card {
  padding: 16px;
  background: linear-gradient(135deg,
    var(--bn-acc-bg-medium),
    var(--bn-acc-bg-subtle));
  border: 1px solid var(--bn-acc-bd-soft);
  border-radius: var(--bn-r-lg);
  margin-bottom: 18px;
}
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--bn-acc), #5B3FCC);
  color: #fff;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--bn-acc-glow);
}
.profile-meta { flex: 1; min-width: 0; }
.profile-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--bn-text-1);
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.profile-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  vertical-align: middle;
}
.profile-badge.premium {
  background: linear-gradient(135deg, #FBBF24, #F59E0B);
  color: #1F2937;
}
.profile-badge.trial {
  background: var(--bn-acc-bg-strong);
  color: var(--bn-acc);
}
.profile-badge.free {
  background: var(--bn-bg-3);
  color: var(--bn-text-3);
}
.profile-status-sub {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
}
.profile-ident {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--bn-acc-bg-medium);
  display: flex; flex-direction: column; gap: 6px;
}
.profile-ident-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--bn-text-2);
}
.profile-ident-row .ic {
  width: 18px;
  text-align: center;
  opacity: 0.85;
}
.profile-ident-row .val { word-break: break-all; }
.profile-replay { font-size: 13px !important; padding: 9px 14px !important; }

/* Subscription detail — компактная карточка под profile-card: trial-row
   (если активен) + Premium upsell с кнопкой «Оформить». Не показывается
   в native-сборке (App Store compliance). */
.sub-detail-card {
  padding: 14px 16px;
  margin-top: -6px;  /* визуально сцеплена с profile-card */
  margin-bottom: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, #FBBF24 12%, transparent),
    var(--bn-acc-bg-subtle));
  border: 1px solid color-mix(in srgb, #FBBF24 22%, transparent);
  border-radius: var(--bn-r-lg);
}
.sub-trial {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, #FBBF24 18%, transparent);
  margin-bottom: 12px;
}
.sub-trial-em { font-size: 24px; line-height: 1; flex-shrink: 0; }
.sub-trial-body { flex: 1; min-width: 0; }
.sub-trial-ttl {
  font-size: 14px;
  font-weight: 700;
  color: var(--bn-text-1);
}
.sub-trial-sub {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
  line-height: 1.4;
}
.sub-upsell-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.sub-upsell-star { font-size: 18px; line-height: 1; }
.sub-upsell-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--bn-text-1);
  letter-spacing: -0.01em;
}
.sub-upsell-meta {
  font-size: 12px;
  color: var(--bn-text-2);
  line-height: 1.45;
}
.sub-upsell-btn { font-size: 14px !important; }

/* Success toast — анимированная галочка после сохранения через голос/текст.
   Auto-dismiss через 1.6с (см. showInputResult). Юзер хочет: ввёл → ушло.
   Кружок появляется (scale+bounce) → галочка рисуется (stroke-dashoffset). */
.toast-check {
  display: flex;
  justify-content: center;
  margin: 8px auto 14px;
}
.toast-check-svg {
  width: 88px; height: 88px;
}
.toast-check-circle {
  fill: #22C55E;
  transform-origin: 28px 28px;
  animation: toast-check-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  filter: drop-shadow(0 6px 18px rgba(34, 197, 94, 0.45));
}
.toast-check-mark {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: toast-check-draw 0.36s 0.28s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
@keyframes toast-check-pop {
  0%   { transform: scale(0.2); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes toast-check-draw {
  to { stroke-dashoffset: 0; }
}
.toast-result {
  text-align: center;
  animation: toast-result-fade 0.32s 0.36s both;
}
@keyframes toast-result-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.empty-mini {
  background: var(--bn-bg-1);
  border: 1px dashed var(--bn-line-2);
  border-radius: var(--bn-r-md);
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--bn-text-2);
  margin-bottom: 12px;
}

/* Ghost-demo — полупрозрачная фейк-карточка с лейблом «🎭 пример» для empty states виджетов.
   Показывает юзеру как виджет будет выглядеть когда появятся данные. */
.ghost-demo {
  position: relative;
  margin-bottom: 10px;
}
.ghost-demo .ghost-label {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--bn-line-2);
  z-index: 2;
  pointer-events: none;
}
.ghost-demo > *:not(.ghost-label) {
  opacity: 0.55;
  filter: saturate(0.65);
  pointer-events: none;
}
/* hero-вариант — лейбл над hero compact (top:-8px). Работает потому что у .hero.compact
   мы переопределили overflow:visible (на основном .hero overflow:hidden ради декораций). */
.hero.compact > .ghost-label {
  position: absolute;
  top: -8px;
  right: 12px;
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--bn-line-2);
  z-index: 2;
  pointer-events: none;
}
.empty-mini small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--bn-text-3);
}
.empty-mini i { color: var(--bn-acc-2); font-style: normal; }

/* Budget rows (rewritten to look cleaner than inline-styles) */
.budget-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bn-line-1);
  cursor: pointer;
  transition: background 0.14s var(--bn-ease);
}
.budget-row:last-child { border-bottom: none; }
.budget-row:hover { background: var(--bn-bg-2); }
.budget-row:active { transform: scale(0.99); }
.budget-row-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}
.budget-row-top .budget-emoji { margin-right: 8px; font-size: 16px; }
.budget-amounts {
  font-size: 13px;
  color: var(--bn-text-2);
  font-feature-settings: "tnum" on;
}
.budget-amounts .div { color: var(--bn-text-4); margin: 0 2px; }

/* Category tile grid (для формы бюджета) */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  border-radius: var(--bn-r-md);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease), transform 0.1s ease;
}
.cat-tile:active { transform: scale(0.95); }
.cat-tile.active {
  background: var(--bn-acc-bg-medium);
  border-color: var(--bn-acc);
  color: var(--bn-text-1);
}
.cat-em { font-size: 22px; line-height: 1; }
.cat-nm { font-size: 11px; font-weight: 500; word-break: break-word; line-height: 1.15; }

/* «В этот день» — блоки лет внутри одной .card.flush */
.ya-year + .ya-year { border-top: 1px solid var(--bn-line-1); }
.ya-year-head {
  padding: 10px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bn-text-2);
  opacity: 0.85;
}

/* Toolbar в Финансы — chips + add button в одну строку */
.fin-toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
  min-height: 35px;   /* подобрано юзером в DevTools — выравнивает «+» между вкладками */
}

/* Custom-category creator sheet — эмодзи-пикер сетка */
.cc-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--bn-line-1);
  border-radius: 12px;
}
.cc-emoji {
  background: rgba(255,255,255,0.04);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 0;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.08s;
  line-height: 1;
}
.cc-emoji:hover { background: rgba(255,255,255,0.08); }
.cc-emoji:active { transform: scale(0.92); }
.cc-emoji.active {
  background: var(--bn-acc-bg-strong);
  border-color: var(--bn-acc);
}

/* «+ Своя» tile в cat-grid */
.cat-tile.add-custom {
  border: 1.5px dashed var(--bn-line-3);
  background: transparent;
  color: var(--bn-text-3);
}
.cat-tile.add-custom .cat-em { opacity: 0.7; }
.cat-tile.add-custom:hover {
  border-color: var(--bn-acc);
  color: var(--bn-acc-2);
}

/* Custom user-category — мелкая violet-точка в правом верхнем углу как indicator
   что эту плитку можно удалить через long-press (500ms). */
.cat-tile.is_custom { position: relative; }
.cat-tile.is_custom::after {
  content: '';
  position: absolute;
  top: 5px; right: 5px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bn-acc);
  opacity: 0.9;
  pointer-events: none;
}

/* Goal row (similar to budget-row) */
.goal-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bn-line-1);
  cursor: pointer;
  transition: background 0.14s var(--bn-ease);
}
.goal-row:last-child { border-bottom: none; }
.goal-row:hover { background: var(--bn-bg-2); }
.goal-row:active { transform: scale(0.99); }
.goal-row-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
  font-size: 14px;
}
.goal-row-meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--bn-text-3);
  font-feature-settings: "tnum" on;
}

/* Subscriptions total banner */
.subs-total {
  background: linear-gradient(135deg, rgba(255, 107, 122, 0.10), rgba(245, 158, 11, 0.06));
  border: 1px solid rgba(255, 107, 122, 0.20);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--bn-text-2);
  text-align: center;
  font-feature-settings: "tnum" on;
}
.subs-total::before {
  content: '🔁 ';
  margin-right: 4px;
}

/* =================== Entity action sheet (универсальное меню действий) =================== */
.ent-actions-card {
  max-width: 480px;
}
.ent-head {
  text-align: center;
  margin-bottom: 16px;
  padding: 0 8px;
}
.ent-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--bn-text-1);
  word-break: break-word;
}
.ent-sub {
  font-size: 13px;
  color: var(--bn-text-3);
  margin-top: 4px;
  white-space: pre-line;  /* поддержка \n для многострочного subtitle */
  line-height: 1.45;
}
.ent-actions-list {
  display: grid;
  gap: 6px;
}
.ent-action {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-1);
  padding: 14px 16px;
  border-radius: var(--bn-r-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease), transform 0.1s ease;
}
.ent-action:active { transform: scale(0.98); }
.ent-action:hover { background: var(--bn-bg-3); border-color: var(--bn-line-2); }
.ent-action .ic { font-size: 18px; flex-shrink: 0; }
.ent-action.danger {
  color: var(--bn-red);
  border-color: rgba(255, 107, 122, 0.20);
}
.ent-action.danger:hover {
  background: var(--bn-red-glow);
  border-color: rgba(255, 107, 122, 0.40);
}
.ent-action.hint {
  background: transparent;
  border: 1px dashed var(--bn-line-2);
  color: var(--bn-text-3);
  font-size: 12px;
  font-style: italic;
  cursor: default;
}
.ent-action.hint:hover { background: transparent; border-color: var(--bn-line-2); }

/* Tappable hint для focus-card / list-item: cursor + chevron справа.
   Без явного chevron'а юзер не видит что строки кликабельны и думает «нет
   возможности взаимодействовать». Chevron — мягкий visual hint. */
.focus-card.tappable, .list-item.tappable {
  cursor: pointer;
  position: relative;
}
.focus-card.tappable:active, .list-item.tappable:active {
  transform: scale(0.98);
}
.list-item.tappable {
  padding-right: 28px;  /* место для chevron'а */
}
.list-item.tappable::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px; height: 8px;
  border-right: 1.6px solid var(--bn-text-3);
  border-top: 1.6px solid var(--bn-text-3);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.18s var(--bn-ease), border-color 0.18s var(--bn-ease);
}
.list-item.tappable:hover {
  background: var(--bn-bg-2);
  border-radius: var(--bn-r-sm);
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 34px;
}
.list-item.tappable:hover::after {
  opacity: 1;
  border-color: var(--bn-acc);
}

/* =================== Quick-note sheet =================== */
.quick-note-card {
  max-width: 600px;
}
.qn-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 999px;
  padding: 3px;
  margin: 10px 0 12px;
  width: fit-content;
}
.qn-mode-btn {
  background: transparent;
  border: none;
  color: var(--bn-text-3);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.qn-mode-btn:hover { color: var(--bn-text-2); }
.qn-mode-btn.active {
  background: var(--bn-acc-bg-medium);
  color: var(--bn-acc);
}

.quick-note-area {
  width: 100%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-1);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 14px 16px;
  min-height: 160px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s var(--bn-ease), box-shadow 0.18s var(--bn-ease);
}
.quick-note-area:focus {
  border-color: var(--bn-mint);
  box-shadow: 0 0 0 3px var(--bn-mint-glow);
}
.quick-note-area::placeholder { color: var(--bn-text-4); white-space: pre-wrap; }
.qn-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
}
.qn-pin {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--bn-text-2);
  cursor: pointer;
  user-select: none;
}
.qn-pin input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--bn-line-3);
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease);
  flex-shrink: 0;
}
.qn-pin input[type="checkbox"]:checked {
  background: var(--bn-gold);
  border-color: var(--bn-gold);
}
.qn-pin input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 2px; left: 5px;
  width: 4px; height: 8px;
  border: solid var(--bn-bg-0);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.qn-hint {
  margin-top: 10px;
  font-size: 11px;
  color: var(--bn-text-4);
  text-align: center;
  letter-spacing: 0.02em;
}

/* =================== Onboarding coach-tour =================== */
/* Корневой контейнер тура — фиксирован поверх всего */
.tour-root {
  position: fixed; inset: 0;
  z-index: 320;
  pointer-events: none;
  animation: bn-fade 0.22s ease;
}
.tour-root.closing { animation: bn-fade 0.2s ease reverse forwards; }

/* «Дырка» вокруг таргета: позиционирована абсолютно, фон прозрачный,
   огромный box-shadow создаёт затемнение всего вокруг. Анимация плавная. */
.tour-spot {
  position: fixed;
  pointer-events: none;
  background: transparent;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.72),
    0 0 0 1px color-mix(in srgb, var(--bn-acc) 60%, transparent) inset;
  transition:
    left 0.34s var(--bn-spring),
    top 0.34s var(--bn-spring),
    width 0.34s var(--bn-spring),
    height 0.34s var(--bn-spring),
    border-radius 0.34s var(--bn-spring),
    opacity 0.2s ease;
  opacity: 0;
}
/* Когда таргета нет (welcome / go) — затемняем экран целиком отдельным слоем */
.tour-root.no-spot::before {
  content: '';
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  pointer-events: none;
  animation: bn-fade 0.22s ease;
}

/* Пульсирующее кольцо вокруг таргета — привлекает внимание */
.tour-pulse {
  position: fixed;
  pointer-events: none;
  border: 2px solid var(--bn-acc);
  box-shadow: 0 0 24px color-mix(in srgb, var(--bn-acc) 55%, transparent);
  opacity: 0;
  transition:
    left 0.34s var(--bn-spring),
    top 0.34s var(--bn-spring),
    width 0.34s var(--bn-spring),
    height 0.34s var(--bn-spring),
    border-radius 0.34s var(--bn-spring),
    opacity 0.2s ease;
  animation: tour-pulse 1.6s ease-in-out infinite;
}
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bn-acc) 55%, transparent), 0 0 24px var(--bn-acc-bd-soft); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bn-acc) 0%, transparent),  0 0 28px var(--bn-acc-bd-medium); }
}

/* Прозрачный «click-eater» — ловит клики по затемнению (продвигает шаг)
   и блокирует случайные тапы по реальным элементам апки. */
.tour-blocker {
  position: fixed; inset: 0;
  pointer-events: auto;
  background: transparent;
  cursor: pointer;
}

/* Skip-кнопка — всегда видна сверху справа */
.tour-skip {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0) + 14px);
  right: 14px;
  z-index: 2;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px 0 16px;
  background: rgba(20, 20, 28, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s var(--bn-spring), background 0.15s var(--bn-ease);
}
.tour-skip:hover { background: rgba(40, 40, 56, 0.92); }
.tour-skip:active { transform: scale(0.94); }
.tour-skip svg { width: 14px; height: 14px; opacity: 0.85; }

/* Тултип — баббл с подсказкой, привязан к таргету (или центрирован) */
.tour-tip {
  position: fixed;
  z-index: 2;
  pointer-events: auto;
  width: max-content;
  max-width: 380px;
  background: var(--bn-bg-1);
  color: var(--bn-text-1);
  border: 1px solid var(--bn-line-2);
  border-radius: var(--bn-r-lg, 16px);
  padding: 16px 16px 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--bn-acc-bg-strong);
  animation: tour-tip-in 0.32s var(--bn-spring);
}
@keyframes tour-tip-in {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.tour-tip.appear { animation: tour-tip-in 0.32s var(--bn-spring); }

/* Центрированный тултип (welcome / go) — полная карточка по центру */
.tour-tip.center {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 32px));
  max-width: none;
  text-align: center;
  padding: 26px 22px 20px;
  animation: tour-pop 0.32s var(--bn-spring);
}
@keyframes tour-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Стрелочка тултипа — указывает на таргет */
.tour-tip[data-arrow="up"]::before,
.tour-tip[data-arrow="down"]::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-2);
  transform: rotate(45deg);
  left: var(--arrow-x, 50%);
  margin-left: -7px;
}
.tour-tip[data-arrow="up"]::before {
  top: -8px;
  border-right: none;
  border-bottom: none;
}
.tour-tip[data-arrow="down"]::before {
  bottom: -8px;
  border-left: none;
  border-top: none;
}
.tour-tip.center::before { display: none; }

.tour-tip-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.tour-tip.center .tour-tip-head {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.tour-tip-em {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 10px var(--bn-acc-bd-soft));
}
.tour-tip.center .tour-tip-em {
  font-size: 56px;
  margin-bottom: 4px;
}
.tour-tip-counter {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-acc);
  font-feature-settings: "tnum" on;
  margin-bottom: 2px;
}
.tour-tip.center .tour-tip-counter { color: var(--bn-text-3); }
.tour-tip-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.tour-tip.center .tour-tip-title { font-size: 22px; }
.tour-tip-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--bn-text-2);
  margin-bottom: 14px;
}
.tour-tip.center .tour-tip-text { margin-bottom: 16px; }

.tour-tip-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-bottom: 12px;
}
.tour-dot {
  width: 6px; height: 6px;
  background: var(--bn-bg-3);
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: width 0.22s var(--bn-spring), background 0.15s var(--bn-ease);
}
.tour-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--bn-acc);
}
.tour-dot:not(.active):hover { background: var(--bn-text-3); }

.tour-tip-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tour-tip-prev {
  width: 40px; height: 40px;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.18s var(--bn-spring), background 0.15s var(--bn-ease), opacity 0.15s var(--bn-ease);
  font-family: inherit;
}
.tour-tip-prev:hover:not(.disabled) { background: var(--bn-bg-3); color: var(--bn-text-1); }
.tour-tip-prev:active:not(.disabled) { transform: scale(0.92); }
.tour-tip-prev.disabled { opacity: 0.35; cursor: not-allowed; }
.tour-tip-prev svg { width: 16px; height: 16px; }

.tour-tip-cta {
  flex: 1;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--bn-acc);
  color: var(--bn-bg-0, #0A0A14);
  border: none;
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.18s var(--bn-spring), filter 0.15s var(--bn-ease);
  box-shadow: 0 6px 18px var(--bn-acc-bd-soft);
}
.tour-tip-cta:hover { filter: brightness(1.06); }
.tour-tip-cta:active { transform: scale(0.97); }
.tour-tip-cta svg { width: 14px; height: 14px; }

/* Tg-connect шаг: вертикальный stack из двух кнопок (CTA + skip), не круглая prev */
.tour-tip-nav-stack { flex-direction: column; align-items: stretch; gap: 10px; }
.tour-tip-nav-stack .tour-tip-cta { width: 100%; flex: none; height: 44px; }
.tour-tip-nav-stack .tour-tip-skip {
  width: 100%; height: 40px; border-radius: 12px;
  background: transparent; color: var(--bn-text-3); font-weight: 600;
}
.tour-tip-nav-stack .tour-tip-skip:hover { background: var(--bn-bg-2); color: var(--bn-text-1); }

/* CTA-кнопка «пройти экскурсию» в шапке help-sheet */
.help-tour-cta {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 18%, var(--bn-bg-2)),
    color-mix(in srgb, var(--bn-acc) 6%, var(--bn-bg-2)));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 35%, var(--bn-line-2));
  border-radius: var(--bn-r-md);
  cursor: pointer;
  text-align: left;
  color: var(--bn-text-1);
  transition: transform 0.18s var(--bn-spring), border-color 0.15s var(--bn-ease);
  font-family: inherit;
}
.help-tour-cta:hover { border-color: var(--bn-acc); }
.help-tour-cta:active { transform: scale(0.985); }
.help-tour-cta .ic { font-size: 24px; line-height: 1; flex-shrink: 0; }
.help-tour-cta .body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.help-tour-cta .body .t { font-size: 14px; font-weight: 700; }
.help-tour-cta .body .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }
.help-tour-cta .chev { width: 18px; height: 18px; color: var(--bn-acc); flex-shrink: 0; }

/* =================== Tab swipe transitions =================== */
/* Раньше use translateX(±28px) → opacity-fade. Проблема: если у юзера в
   системе включён prefers-reduced-motion (Android Settings → Accessibility),
   animation НЕ играет → element остаётся в начальной позиции (translateX±28px)
   — контент уезжает за бордер. Теперь только opacity-fade без transform —
   нечему «застревать». Меньше «движухи», но надёжно. */
@keyframes bn-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
#app.slide-from-right,
#app.slide-from-left {
  animation: bn-fade-in 0.22s var(--bn-ease);
}

/* =================== Anim helpers =================== */
.anim-stagger > * {
  animation: bn-fadein-up 0.42s var(--bn-spring) backwards;
}
.anim-stagger > *:nth-child(1) { animation-delay: 0.02s; }
.anim-stagger > *:nth-child(2) { animation-delay: 0.06s; }
.anim-stagger > *:nth-child(3) { animation-delay: 0.10s; }
.anim-stagger > *:nth-child(4) { animation-delay: 0.14s; }
.anim-stagger > *:nth-child(5) { animation-delay: 0.18s; }
.anim-stagger > *:nth-child(6) { animation-delay: 0.22s; }
.anim-stagger > *:nth-child(7) { animation-delay: 0.26s; }
.anim-stagger > *:nth-child(8) { animation-delay: 0.30s; }
.anim-stagger > *:nth-child(9) { animation-delay: 0.34s; }
.anim-stagger > *:nth-child(n+10) { animation-delay: 0.38s; }
@keyframes bn-fadein-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =================== Admin =================== */
.admin-stat {
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.admin-stat .lbl { font-size: 12px; color: var(--bn-text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.admin-stat .v { font-size: 20px; font-weight: 800; font-feature-settings: "tnum" on; }

.admin-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bn-bg-1);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  margin-bottom: 6px;
}
.admin-user .av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bn-acc), var(--bn-acc-deep));
  color: white;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.admin-user .info { flex: 1; min-width: 0; }
.admin-user .info .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-user .info .meta { font-size: 11px; color: var(--bn-text-3); }
.admin-user .info .meta .pr { color: var(--bn-gold); }
.admin-user .info .meta .ba { color: var(--bn-red); }
.admin-user .acts { display: flex; gap: 4px; flex-shrink: 0; }
.admin-user .acts button {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-2);
  color: var(--bn-text-2);
  padding: 5px 10px;
  border-radius: var(--bn-r-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.admin-user .acts button:active { transform: scale(0.96); }

.admin-msg {
  padding: 10px 0;
  border-bottom: 1px solid var(--bn-line-1);
  font-size: 12px;
}
.admin-msg:last-child { border-bottom: none; }
.admin-msg .top { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 4px; align-items: baseline; }
.admin-msg .top .who { font-weight: 600; color: var(--bn-text-1); }
.admin-msg .top .when { color: var(--bn-text-4); font-size: 10px; }
.admin-msg .body { color: var(--bn-text-2); white-space: pre-wrap; word-break: break-word; }
.admin-msg .tags { margin-top: 4px; font-size: 10px; color: var(--bn-text-3); }
.admin-msg .tags .err { color: var(--bn-red); }
.admin-msg .tags .ok { color: var(--bn-mint); }

/* =================== Stats · продвинутая аналитика =================== */
.stats-hero {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 14%, var(--bn-bg-1)),
    color-mix(in srgb, var(--bn-acc) 4%, var(--bn-bg-1)));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 30%, var(--bn-line-2));
  border-radius: var(--bn-r-lg, 16px);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.stats-hero-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bn-text-3);
  font-weight: 700;
  margin-bottom: 6px;
}
.stats-hero-amount {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.stats-hero-amount .v {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-feature-settings: "tnum" on, "lnum" on;
  color: var(--bn-text-1);
}
.stats-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-feature-settings: "tnum" on;
}
.stats-delta.up { background: color-mix(in srgb, var(--bn-red) 18%, transparent); color: var(--bn-red); }
.stats-delta.down { background: color-mix(in srgb, var(--bn-mint, var(--bn-acc)) 18%, transparent); color: var(--bn-mint, var(--bn-acc)); }
.stats-delta.flat { background: var(--bn-bg-3); color: var(--bn-text-3); }
.stats-hero-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.stats-hero-meta .item {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 8px 10px;
}
.stats-hero-meta .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bn-text-3);
  font-weight: 600;
}
.stats-hero-meta .v {
  font-size: 14px;
  font-weight: 700;
  color: var(--bn-text-1);
  font-feature-settings: "tnum" on;
  margin-top: 2px;
}

.stats-insights {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.stats-insight {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
}
.stats-insight .ic { font-size: 20px; flex-shrink: 0; }
.stats-insight .body { flex: 1; min-width: 0; }
.stats-insight .t { font-size: 13px; font-weight: 600; color: var(--bn-text-1); }
.stats-insight .s { font-size: 11px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }
.stats-insight .v {
  font-size: 14px;
  font-weight: 700;
  color: var(--bn-text-1);
  font-feature-settings: "tnum" on;
  flex-shrink: 0;
}

.cat-trend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bn-line-1);
  font-size: 13px;
}
.cat-trend-row:last-child { border-bottom: none; }
.cat-trend-row .cat { flex: 1; min-width: 0; color: var(--bn-text-1); }
.cat-trend-row .v { font-weight: 700; font-feature-settings: "tnum" on; }
.cat-trend-row .delta {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  font-feature-settings: "tnum" on;
}
.cat-trend-row .delta.up { background: color-mix(in srgb, var(--bn-red) 18%, transparent); color: var(--bn-red); }
.cat-trend-row .delta.down { background: color-mix(in srgb, var(--bn-mint, var(--bn-acc)) 18%, transparent); color: var(--bn-mint, var(--bn-acc)); }
.cat-trend-row .delta.flat { background: var(--bn-bg-3); color: var(--bn-text-3); }

.merchant-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bn-line-1);
}
.merchant-row:last-child { border-bottom: none; }
.merchant-row .rank {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--bn-bg-3);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: var(--bn-text-3);
  flex-shrink: 0;
}
.merchant-row.top-1 .rank { background: color-mix(in srgb, var(--bn-gold, var(--bn-acc)) 30%, var(--bn-bg-3)); color: var(--bn-text-1); }
.merchant-row .nm { flex: 1; font-size: 13px; font-weight: 600; color: var(--bn-text-1); min-width: 0; }
.merchant-row .cnt { font-size: 11px; color: var(--bn-text-3); margin-right: 8px; flex-shrink: 0; }
.merchant-row .v { font-weight: 700; font-feature-settings: "tnum" on; flex-shrink: 0; }

/* =================== Admin · Premium codes =================== */
.adm-codes-controls { display: flex; flex-direction: column; gap: 12px; }
.adm-codes-summary { min-height: 50px; }
.adm-codes-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.adm-codes-stat {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 10px 12px;
  text-align: center;
}
.adm-codes-stat .lbl {
  font-size: 11px;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.adm-codes-stat .val {
  font-size: 22px;
  font-weight: 800;
  color: var(--bn-text-1);
  font-feature-settings: "tnum" on;
}
.adm-codes-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.adm-codes-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--bn-text-2);
}
.adm-codes-form select {
  background: var(--bn-bg-2);
  color: var(--bn-text-1);
  border: 1px solid var(--bn-line-1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}
.adm-codes-go {
  background: var(--bn-acc);
  color: var(--bn-bg-0, #0A0A14);
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s var(--bn-ease), transform 0.18s var(--bn-spring);
  font-family: inherit;
}
.adm-codes-go:hover:not(:disabled) { filter: brightness(1.06); }
.adm-codes-go:active:not(:disabled) { transform: scale(0.97); }
.adm-codes-go:disabled { opacity: 0.55; cursor: not-allowed; }
.adm-codes-hint {
  font-size: 12px;
  color: var(--bn-text-3);
  line-height: 1.45;
}

.adm-codes-fresh {
  background: color-mix(in srgb, var(--bn-acc) 14%, var(--bn-bg-1));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-2));
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: bn-pop 0.32s var(--bn-spring);
}
.adm-codes-fresh-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--bn-text-1);
}
.adm-codes-fresh-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.adm-codes-fresh-list code {
  background: var(--bn-bg-0);
  border: 1px solid var(--bn-line-2);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--bn-acc);
  letter-spacing: 0.02em;
}
.adm-code-copy-all {
  align-self: flex-start;
  background: transparent;
  color: var(--bn-acc);
  border: 1px solid var(--bn-acc);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s var(--bn-ease);
}
.adm-code-copy-all:hover { background: var(--bn-acc-bg-medium); }

.adm-code-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bn-line-1);
}
.adm-code-row:last-child { border-bottom: none; }
.adm-code-row.used { opacity: 0.7; }
.adm-code-val {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--bn-text-1);
  background: var(--bn-bg-2);
  padding: 5px 9px;
  border-radius: 6px;
  flex-shrink: 0;
}
.adm-code-row.active .adm-code-val { color: var(--bn-acc); }
.adm-code-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  min-width: 0;
}
.adm-code-status { font-weight: 600; color: var(--bn-text-2); display: inline-flex; align-items: center; gap: 6px; }
.adm-code-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.adm-code-badge.promo {
  background: var(--bn-acc-bg-medium);
  color: var(--bn-acc);
  border: 1px solid var(--bn-acc-bd-medium);
}
.adm-code-badge.family {
  background: color-mix(in srgb, var(--bn-gold, var(--bn-acc)) 18%, transparent);
  color: var(--bn-gold, var(--bn-acc));
  border: 1px solid color-mix(in srgb, var(--bn-gold, var(--bn-acc)) 35%, transparent);
}
.adm-code-when { color: var(--bn-text-3); font-size: 11px; }
.adm-code-by { color: var(--bn-text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-code-by .muted { opacity: 0.6; }
.adm-code-copy {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s var(--bn-ease), transform 0.18s var(--bn-spring);
  flex-shrink: 0;
}
.adm-code-copy:hover { background: var(--bn-bg-3); }
.adm-code-copy:active { transform: scale(0.92); }

/* =================== Help sheet =================== */
.help-card { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.help-input-modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 18px;
}
.help-mode {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
}
.help-mode .ic { font-size: 22px; line-height: 1; flex-shrink: 0; padding-top: 1px; }
.help-mode b { font-size: 14px; font-weight: 700; color: var(--bn-text-1); }
.help-mode .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }

.help-cats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.help-cat {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  overflow: hidden;
  transition: border-color 0.15s var(--bn-ease);
}
.help-cat[open] {
  border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-2));
  background: color-mix(in srgb, var(--bn-bg-2) 92%, var(--bn-acc) 8%);
}
.help-cat-head {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.help-cat-head::-webkit-details-marker { display: none; }
.help-cat-emoji {
  grid-row: 1 / 3;
  font-size: 22px;
  line-height: 1;
}
.help-cat-title {
  grid-column: 2;
  grid-row: 1;
  font-size: 15px;
  font-weight: 700;
  color: var(--bn-text-1);
  letter-spacing: -0.01em;
}
.help-cat-sub {
  grid-column: 2;
  grid-row: 2;
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
  line-height: 1.35;
}
.help-cat-chev {
  grid-column: 3;
  grid-row: 1 / 3;
  width: 16px; height: 16px;
  color: var(--bn-text-3);
  transition: transform 0.2s var(--bn-spring);
}
.help-cat[open] .help-cat-chev { transform: rotate(180deg); color: var(--bn-acc); }

.help-cat-body {
  padding: 4px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: bn-fade 0.2s ease;
}
.help-ex {
  position: relative;
  padding: 8px 10px 8px 26px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--bn-text-2);
  background: var(--bn-bg-1);
  border-left: 2px solid color-mix(in srgb, var(--bn-acc) 60%, transparent);
  border-radius: 0 var(--bn-r-sm, 8px) var(--bn-r-sm, 8px) 0;
  font-style: italic;
}
.help-ex::before {
  content: '"';
  position: absolute;
  left: 8px;
  top: 4px;
  font-size: 18px;
  font-weight: 700;
  font-style: normal;
  color: color-mix(in srgb, var(--bn-acc) 70%, transparent);
  line-height: 1;
}
.help-tip {
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--bn-text-2);
  background: color-mix(in srgb, var(--bn-acc) 10%, var(--bn-bg-1));
  border-radius: var(--bn-r-sm, 8px);
}

.help-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px solid var(--bn-line-1);
}
.help-foot-block {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 4px;
}
.help-foot-block .ic { font-size: 18px; line-height: 1; flex-shrink: 0; padding-top: 2px; }
.help-foot-block b { font-size: 13px; font-weight: 700; color: var(--bn-text-1); display: block; }
.help-foot-block .s { font-size: 12px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.4; }
/* Кликабельный вариант (стикерпак / соц-ссылки) — выделяем подложкой */
a.help-foot-link {
  text-decoration: none;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  margin-top: 4px;
  transition: border-color 0.15s var(--bn-ease), transform 0.18s var(--bn-spring);
}
a.help-foot-link:hover { border-color: color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-2)); }
a.help-foot-link:active { transform: scale(0.985); }
a.help-foot-link > div { flex: 1; min-width: 0; }
.help-foot-arrow { width: 16px; height: 16px; color: var(--bn-acc); flex-shrink: 0; align-self: center; }

/* ============================================
   Streak system — карточка на Home + bottom-sheet
   ============================================ */

.streak-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--bn-r-md);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 10%, var(--bn-bg-1)),
    var(--bn-bg-1) 70%);
  border: 1px solid color-mix(in srgb, var(--bn-acc) 22%, var(--bn-line-1));
  margin-bottom: 12px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s var(--bn-spring), border-color 0.18s var(--bn-ease);
}
.streak-card:active { transform: scale(0.985); }
.streak-card:hover { border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-2)); }
.streak-emoji {
  font-size: 32px;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 14px;
  background: var(--bn-bg-2);
}
.streak-emoji[data-stage="top"] {
  background: linear-gradient(135deg, #FFD93D 0%, #FFB547 100%);
}
.streak-emoji[data-stage="on"] {
  background: color-mix(in srgb, var(--bn-acc) 18%, var(--bn-bg-2));
}
.streak-body { flex: 1; min-width: 0; }
.streak-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--bn-text-1);
  margin-bottom: 2px;
}
.streak-sub {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-bottom: 8px;
  line-height: 1.3;
}
.streak-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bn-bg-2);
  overflow: hidden;
}
.streak-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bn-acc), color-mix(in srgb, var(--bn-acc) 50%, #FFB547));
  border-radius: 3px;
  transition: width 0.4s var(--bn-ease);
}
.streak-chevron {
  width: 18px;
  height: 18px;
  color: var(--bn-text-3);
  flex-shrink: 0;
}

/* --- Sheet --- */
.streak-sheet { padding-bottom: 8px; }
.streak-sheet-header {
  text-align: center;
  padding: 6px 8px 18px;
}
.streak-sheet-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 8px;
}
.streak-sheet-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--bn-text-1);
  margin-bottom: 4px;
}
.streak-sheet-sub {
  font-size: 13px;
  color: var(--bn-text-3);
}
.streak-tiers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.streak-tier {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--bn-r-md);
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  transition: background 0.18s var(--bn-ease), border-color 0.18s var(--bn-ease);
}
.streak-tier.reached {
  background: color-mix(in srgb, var(--bn-acc) 8%, var(--bn-bg-2));
  border-color: color-mix(in srgb, var(--bn-acc) 35%, var(--bn-line-1));
}
.streak-tier.next {
  border-color: color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-1));
}
.streak-tier-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}
.streak-tier-body { flex: 1; min-width: 0; }
.streak-tier-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--bn-text-1);
  margin-bottom: 2px;
}
.streak-tier-desc {
  font-size: 12px;
  color: var(--bn-text-3);
  line-height: 1.35;
  margin-bottom: 4px;
}
.streak-tier-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--bn-acc);
}
.streak-tier-status.next {
  color: var(--bn-text-3);
  font-weight: 500;
}
.streak-tier.pending { opacity: 0.7; }
.streak-sheet-footer {
  font-size: 11px;
  color: var(--bn-text-3);
  text-align: center;
  padding: 8px 12px;
  line-height: 1.4;
}

/* ============================================
   Custom Date/Time pickers — заменяют native <input type="date|time">
   ============================================ */

/* Trigger-button — стилизован как input, но клик открывает bottom-sheet */
.bn-dt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--bn-r-md, 12px);
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  /* min-width убран — на узких экранах две trigger-кнопки рядом
     (например, тихие часы 23:00–08:00) переполняли строку. Content sizing
     достаточен — иконка + текст уместятся в ~90px. */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s var(--bn-ease), background 0.15s var(--bn-ease);
  -webkit-tap-highlight-color: transparent;
}
.bn-dt-trigger:hover {
  border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-2));
}
.bn-dt-trigger:active {
  transform: scale(0.985);
}
.bn-dt-trigger.empty {
  color: var(--bn-text-3);
  font-weight: 400;
}
.bn-dt-trigger .ic {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}
.bn-dt-trigger .bn-dt-value {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bn-dt-trigger .bn-dt-placeholder {
  flex: 1;
  color: var(--bn-text-3);
}
/* Когда trigger унаследовал .rem-input — выравниваем как все формовые поля */
.bn-dt-trigger.rem-input {
  width: 100%;
  font-size: 14px;
}

/* --- Date picker sheet --- */
.bn-dp-card { padding-bottom: 8px; max-height: 90vh; overflow: hidden; }
.bn-dp-presets {
  display: flex;
  gap: 6px;
  padding: 4px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.bn-dp-presets::-webkit-scrollbar { display: none; }
.bn-dp-preset {
  flex-shrink: 0;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bn-text-1);
  cursor: pointer;
}
.bn-dp-preset:active { transform: scale(0.95); }
.bn-dp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 8px;
  gap: 12px;
}
.bn-dp-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bn-text-1);
  flex-shrink: 0;
}
.bn-dp-nav-btn:hover { border-color: color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-2)); }
.bn-dp-nav-btn:active { transform: scale(0.92); }
.bn-dp-nav-btn svg { width: 16px; height: 16px; }
.bn-dp-month {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--bn-text-1);
}
.bn-dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 6px 16px 6px;
}
.bn-dp-wd {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bn-dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 4px 16px 10px;
}
.bn-dp-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--bn-text-1);
  cursor: pointer;
  transition: background 0.12s var(--bn-ease), border-color 0.12s var(--bn-ease), transform 0.12s var(--bn-ease);
  -webkit-tap-highlight-color: transparent;
}
.bn-dp-cell:hover {
  background: color-mix(in srgb, var(--bn-acc) 8%, transparent);
}
.bn-dp-cell:active { transform: scale(0.92); }
.bn-dp-cell.dim { color: var(--bn-text-3); opacity: 0.55; }
.bn-dp-cell.today {
  border-color: color-mix(in srgb, var(--bn-acc) 60%, var(--bn-line-1));
  font-weight: 700;
}
.bn-dp-cell.selected {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  color: #F7F5FF;
  border-color: transparent;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.bn-dp-cell.selected.today {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bn-acc) 30%, transparent);
}
.bn-dp-cell.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.bn-dp-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px 16px;
}
.bn-dp-actions .voice-btn {
  flex: 1;
}

/* --- Time picker sheet --- */
.bn-tp-card { padding-bottom: 8px; }
.bn-tp-display {
  font-size: 36px;
  font-weight: 800;
  text-align: center;
  color: var(--bn-text-1);
  padding: 8px 0 14px;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
}
.bn-tp-presets {
  display: flex;
  gap: 6px;
  padding: 0 16px 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.bn-tp-preset {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--bn-text-1);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.bn-tp-preset:active { transform: scale(0.95); }
.bn-tp-wheels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
}
.bn-tp-col {
  background: var(--bn-bg-2);
  border-radius: var(--bn-r-md, 12px);
  border: 1px solid var(--bn-line-1);
  overflow: hidden;
}
.bn-tp-col-head {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--bn-text-3);
  padding: 8px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bn-tp-col-list {
  height: 220px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  padding: 6px 0 80px;  /* Доп. padding снизу чтобы последние элементы скроллились в центр */
}
.bn-tp-col-list::-webkit-scrollbar { display: none; }
.bn-tp-cell {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 10px 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--bn-text-1);
  cursor: pointer;
  scroll-snap-align: center;
  font-variant-numeric: tabular-nums;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.bn-tp-cell:hover {
  background: color-mix(in srgb, var(--bn-acc) 6%, transparent);
}
.bn-tp-cell.active {
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  color: #F7F5FF;
  font-weight: 700;
}

/* ============================================
   Notes monthly summary — кнопка + sheet
   ============================================ */

.notes-summary-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--bn-r-md, 12px);
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 12%, var(--bn-bg-1)),
    var(--bn-bg-1) 70%);
  border: 1px solid color-mix(in srgb, var(--bn-acc) 25%, var(--bn-line-1));
  color: var(--bn-text-1);
  cursor: pointer;
  margin-bottom: 12px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.18s var(--bn-spring), border-color 0.18s var(--bn-ease);
}
.notes-summary-btn:active { transform: scale(0.985); }
.notes-summary-btn:hover { border-color: color-mix(in srgb, var(--bn-acc) 45%, var(--bn-line-2)); }
.notes-summary-btn .ic {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.notes-summary-btn .lbl { flex: 1; }
.notes-summary-btn .arr {
  width: 16px;
  height: 16px;
  color: var(--bn-text-3);
}

/* Sheet */
.notes-sum-card { max-height: 92vh; display: flex; flex-direction: column; padding-bottom: 8px; }
.notes-sum-header {
  display: flex;
  align-items: center;
  padding: 4px 14px 14px;
  gap: 10px;
}
.notes-sum-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bn-text-1);
  flex-shrink: 0;
}
.notes-sum-nav:hover { border-color: color-mix(in srgb, var(--bn-acc) 50%, var(--bn-line-2)); }
.notes-sum-nav:active { transform: scale(0.92); }
.notes-sum-nav svg { width: 16px; height: 16px; }
.notes-sum-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.notes-sum-title .emoji { font-size: 28px; line-height: 1; }
.notes-sum-title .t {
  font-size: 17px;
  font-weight: 700;
  color: var(--bn-text-1);
}
.notes-sum-title .s {
  font-size: 12px;
  color: var(--bn-text-3);
  text-transform: capitalize;
}

#notes-sum-body {
  overflow-y: auto;
  flex: 1;
  padding: 0 16px;
  min-height: 200px;
}
.notes-sum-loading {
  text-align: center;
  padding: 36px 16px;
}
.notes-sum-loading .spinner { margin: 0 auto 14px; }
.notes-sum-loading .t {
  font-size: 14px;
  font-weight: 600;
  color: var(--bn-text-1);
  margin-bottom: 4px;
}
.notes-sum-loading .s {
  font-size: 12px;
  color: var(--bn-text-3);
}
.notes-sum-meta {
  font-size: 12px;
  color: var(--bn-text-3);
  padding: 0 0 10px;
}
.notes-sum-content p {
  font-size: 14px;
  line-height: 1.55;
  color: var(--bn-text-1);
  margin: 0 0 14px;
  white-space: pre-wrap;
}
.notes-sum-cached {
  display: block;
  font-size: 11px;
  color: var(--bn-text-3);
  text-align: center;
  padding: 8px 0;
  font-style: italic;
}
.notes-sum-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px 16px;
  border-top: 1px solid var(--bn-line-1);
}
.notes-sum-actions .voice-btn { flex: 1; }


/* ============================================
   Custom scrollbar — тонкий violet-accent вместо толстого native
   Применяется глобально + усиленный стиль внутри bottom-sheet'ов.
   ============================================ */

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--bn-line-2) transparent;
}

/* WebKit/Blink (Chrome/Edge/Safari) */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--bn-text-3) 50%, transparent);
  border-radius: 8px;
  border: 1px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--bn-acc) 60%, var(--bn-text-3));
  background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* Bottom-sheets — у .bn-sheet-card border-radius + overflow:auto. webkit
   scrollbar не уважает border-radius контейнера, поэтому при rounded углах
   полоса визуально "отрезается" — выглядит криво. Решение: полностью
   скрываем скроллбар на самой card (как делают iOS/Material sheets — scroll
   свайпом/колесом без видимой полосы). Внутренние scroll-контейнеры
   (без rounded углов) — оставляем с тонким серым thumb'ом. */
.bn-sheet-card {
  scrollbar-width: none;  /* Firefox */
}
.bn-sheet-card::-webkit-scrollbar {
  display: none;  /* Chrome/Safari/Edge */
}

/* Внутренние scrollable элементы внутри sheet'а — у них чаще всего нет
   rounded углов, скроллбар выглядит нормально. */
.bn-sheet-card * {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--bn-text-3) 30%, transparent) transparent;
}
.bn-sheet-card *::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
.bn-sheet-card *::-webkit-scrollbar-track {
  background: transparent;
}
.bn-sheet-card *::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--bn-text-3) 35%, transparent);
  border-radius: 8px;
}
.bn-sheet-card *::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--bn-text-3) 60%, transparent);
}

/* ============================================
   Scroll-hint в bottom-sheet — анимированная стрелка-вниз + «Листай».
   Появляется автоматом если .bn-sheet-card scrollable, исчезает при первом
   скролле/touch. JS управляет .show и .hide классами.
   ============================================ */
.bn-sheet-scroll-hint {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0) + 18px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  /* Gradient тот же что у CTA-микрофона + active кнопок Settings —
     согласовано с brand-цветом по всему UI. */
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  color: #F7F5FF;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
  opacity: 0;
  z-index: 250;  /* выше .bn-sheet (200) */
  box-shadow:
    0 4px 14px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  transition: opacity 0.32s var(--bn-ease), transform 0.32s var(--bn-spring);
}
.bn-sheet-scroll-hint.show {
  opacity: 1;
}
.bn-sheet-scroll-hint.show .arrow-wrap {
  animation: bn-scroll-hint-bounce 1.4s ease-in-out 0.5s infinite;
}
.bn-sheet-scroll-hint.hide {
  opacity: 0;
  transform: translate(-50%, 14px);
}
.bn-sheet-scroll-hint .arrow-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bn-sheet-scroll-hint .arrow {
  width: 14px;
  height: 14px;
  stroke-width: 2.6;
}
@keyframes bn-scroll-hint-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ============================================
   Admin · тестовые кнопки дайджестов
   ============================================ */
.admin-test-block {
  padding: 14px;
}
.admin-test-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.adm-test-btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--bn-r-md, 12px);
  background: linear-gradient(180deg, var(--bn-acc) 0%, var(--bn-acc-deep) 100%);
  color: #F7F5FF;
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: filter 0.15s var(--bn-ease), transform 0.12s var(--bn-spring);
}
.adm-test-btn:hover { filter: brightness(1.05); }
.adm-test-btn:active { transform: scale(0.97); }
.adm-test-btn:disabled { opacity: 0.6; cursor: progress; }
.adm-test-btn .ic { font-size: 20px; line-height: 1; flex-shrink: 0; }
.adm-test-btn .lbl { flex: 1; }
.admin-test-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--bn-text-2);
  min-height: 18px;
}

/* ============================================
   Admin · grid и tile (раньше отсутствовали в CSS, sec-title рендерился
   а сами плитки были невидимы).
   ============================================ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 4px 0 14px;
}
.admin-tile {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md, 12px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-tile .lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.admin-tile .val {
  font-size: 22px;
  font-weight: 800;
  color: var(--bn-text-1);
  font-feature-settings: "tnum" on;
  font-variant-numeric: tabular-nums;
}
.admin-tile.success { border-color: color-mix(in srgb, var(--bn-mint) 30%, var(--bn-line-1)); }
.admin-tile.success .val { color: var(--bn-mint); }
.admin-tile.accent { border-color: color-mix(in srgb, var(--bn-acc) 30%, var(--bn-line-1)); }
.admin-tile.accent .val { color: var(--bn-acc-2, var(--bn-acc)); }
.admin-tile.danger { border-color: color-mix(in srgb, var(--bn-red) 30%, var(--bn-line-1)); }
.admin-tile.danger .val { color: var(--bn-red); }

/* ============================================
   Faceted search — filter chips + clickable tags
   ============================================ */
.home-search-chips {
  margin: 4px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}
.home-search-chips::-webkit-scrollbar { display: none; }
.home-search-chips .chip {
  flex-shrink: 0;
  white-space: nowrap;
}

.search-result-tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.search-result-tag {
  font-size: 10px;
  color: var(--bn-acc-2);
  padding: 2px 7px;
  background: var(--bn-acc-bg-soft);
  border-radius: var(--bn-r-pill);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.search-result-tag:hover {
  background: var(--bn-acc-bg-medium);
}

/* ============================================
   Note edit sheet — tag editor (add/remove)
   ============================================ */
.nes-card { padding-bottom: 8px; }
.nes-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  margin: 8px 0;
}
.nes-tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--bn-acc-2);
  background: var(--bn-acc-bg-soft);
  border: 1px solid color-mix(in srgb, var(--bn-acc) 22%, transparent);
  border-radius: var(--bn-r-pill);
  padding: 0 4px 0 10px;
  font-weight: 600;
}
.nes-tag-del {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--bn-acc-2);
  opacity: 0.6;
  font-size: 16px;
  line-height: 1;
  padding: 2px 7px;
  font-weight: 700;
  transition: opacity 0.15s, color 0.15s;
}
.nes-tag-del:hover { opacity: 1; color: var(--bn-red); }
.nes-tag-add {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.nes-tag-add input { flex: 1; }

/* ============================================
   Финансы → Подписки — карточки + сводка
   ============================================ */
.sub-totals {
  display: flex;
  justify-content: space-around;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.sub-totals-row {
  text-align: center;
  flex: 1;
}
.sub-totals-row.dim { opacity: 0.6; }
.sub-totals-lbl {
  font-size: 11px;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 4px;
}
.sub-totals-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--bn-acc-2, var(--bn-acc));
  font-variant-numeric: tabular-nums;
}

.sub-list { padding: 4px 8px; }
.sub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--bn-line-1);
}
.sub-row:last-child { border-bottom: none; }
.sub-emoji {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--bn-acc-bg-soft);
  border-radius: var(--bn-r-md);
  flex-shrink: 0;
}
.sub-body { flex: 1; min-width: 0; }
.sub-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--bn-text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
}
.sub-meta {
  font-size: 12px;
  color: var(--bn-text-3);
  margin-top: 2px;
}
.sub-amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--bn-text-1);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.sub-del {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--bn-text-3);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.sub-del:hover {
  opacity: 1;
  color: var(--bn-red);
  background: color-mix(in srgb, var(--bn-red) 10%, transparent);
}

/* ============================================
   Share-note sheet
   ============================================ */
.share-card { padding-bottom: 8px; }
.share-url-box {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.share-url-box input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  color: var(--bn-text-1);
  font-size: 13px;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}
.share-copy {
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-1);
  border-radius: var(--bn-r-md);
  padding: 0 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.share-copy:hover {
  border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-2));
}
.share-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.share-actions .voice-btn { width: 100%; }
.share-revoke {
  background: transparent;
  color: var(--bn-red);
  border: 1px solid color-mix(in srgb, var(--bn-red) 30%, var(--bn-line-2));
}
.share-revoke:hover {
  background: color-mix(in srgb, var(--bn-red) 10%, transparent);
  border-color: var(--bn-red);
}
.share-hint {
  font-size: 11px;
  color: var(--bn-text-3);
  line-height: 1.5;
  padding: 4px 0 8px;
}

/* Folder chip — drag state + drop target */
.folder-chip {
  transition: transform 0.15s var(--bn-ease), border-color 0.15s var(--bn-ease), background 0.15s var(--bn-ease);
  touch-action: pan-y;  /* позволяет вертикальный скролл, горизонтальный — для drag */
  user-select: none;
}
.folder-chip.dragging {
  opacity: 0.85;
  z-index: 100;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border-color: var(--bn-acc) !important;
  cursor: grabbing;
}
.folder-chip.drop-target {
  border-color: var(--bn-acc) !important;
  background: var(--bn-acc-bg-medium) !important;
  transform: scale(1.05);
}

/* ============================================
   Light theme — точечные overrides для читаемости.
   Hardcoded color-mix(--bn-acc N%, var(--bn-bg-1)) с малым N (10-14%)
   на белом превращается в очень бледный gradient — практически невидимый.
   Поднимаем интенсивность для конкретных видимых компонентов.
   ============================================ */
html[data-theme="light"] .streak-card,
html[data-theme="auto"]:not([data-tg-themed]) .streak-card {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 18%, var(--bn-bg-1)),
    var(--bn-bg-1) 75%);
  border-color: color-mix(in srgb, var(--bn-acc) 35%, var(--bn-line-1));
}

html[data-theme="light"] .notes-summary-btn,
html[data-theme="auto"]:not([data-tg-themed]) .notes-summary-btn {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 22%, var(--bn-bg-1)),
    var(--bn-bg-1) 70%);
  border-color: color-mix(in srgb, var(--bn-acc) 40%, var(--bn-line-1));
}

/* Tag chips — bn-acc-2 (#7B66E0) на белом даёт contrast только 3.96 (под порогом
   WCAG AA 4.5 для small text). Используем основной --bn-acc для лучшей читаемости. */
html[data-theme="light"] .note-tags span,
html[data-theme="light"] .note-tag,
html[data-theme="light"] .note-tag-label,
html[data-theme="light"] .note-tag-del,
html[data-theme="light"] .search-result-tag,
html[data-theme="light"] .nes-tag,
html[data-theme="light"] .nes-tag-del,
html[data-theme="auto"]:not([data-tg-themed]) .note-tags span,
html[data-theme="auto"]:not([data-tg-themed]) .note-tag,
html[data-theme="auto"]:not([data-tg-themed]) .note-tag-label,
html[data-theme="auto"]:not([data-tg-themed]) .note-tag-del,
html[data-theme="auto"]:not([data-tg-themed]) .search-result-tag,
html[data-theme="auto"]:not([data-tg-themed]) .nes-tag,
html[data-theme="auto"]:not([data-tg-themed]) .nes-tag-del {
  color: var(--bn-acc);
}

/* Subscription totals — то же */
html[data-theme="light"] .sub-totals-val,
html[data-theme="auto"]:not([data-tg-themed]) .sub-totals-val {
  color: var(--bn-acc);
}

/* Streak emoji wrapper — на белом фоне светлый violet тон лучше виден */
html[data-theme="light"] .streak-emoji[data-stage="on"],
html[data-theme="auto"]:not([data-tg-themed]) .streak-emoji[data-stage="on"] {
  background: color-mix(in srgb, var(--bn-acc) 25%, var(--bn-bg-2));
}

/* Premium-related backgrounds, чтобы карточки не сливались с белым */
html[data-theme="light"] .prem-banner.inactive,
html[data-theme="light"] .prem-banner.trial,
html[data-theme="light"] .prem-banner.warn,
html[data-theme="auto"]:not([data-tg-themed]) .prem-banner.inactive,
html[data-theme="auto"]:not([data-tg-themed]) .prem-banner.trial,
html[data-theme="auto"]:not([data-tg-themed]) .prem-banner.warn {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 16%, var(--bn-bg-1)),
    var(--bn-bg-1));
  border-color: color-mix(in srgb, var(--bn-acc) 30%, var(--bn-line-1));
}

/* Тихие часы — двухстрочный layout: лейбл сверху, два time-input'а под ним */
.qh-row .body { width: 100%; }
.qh-inputs {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px;
}
.qh-inputs input[type="time"] {
  flex: 1;
  min-width: 0;
  background: var(--bn-bg-3);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 8px 10px;
  color: var(--bn-text-1);
  font-size: 14px;
  font-feature-settings: "tnum" on, "lnum" on;
  outline: none;
}
.qh-inputs input[type="time"]:focus { border-color: var(--bn-acc); }
.qh-dash { color: var(--bn-text-3); flex-shrink: 0; }

/* =================== Email verification banner =================== */
.verify-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--bn-acc) 14%, var(--bn-bg-1)),
    var(--bn-bg-1));
  border: 1px solid color-mix(in srgb, var(--bn-acc) 28%, var(--bn-line-1));
  border-radius: var(--bn-r-md);
  cursor: pointer;
  transition: transform 0.15s var(--bn-ease), border-color 0.15s;
}
.verify-banner:hover {
  border-color: color-mix(in srgb, var(--bn-acc) 42%, var(--bn-line-1));
  transform: translateY(-1px);
}
.verify-banner:active { transform: scale(0.99); }
.verify-banner .vb-ic { font-size: 22px; line-height: 1; flex-shrink: 0; }
.verify-banner .vb-body { flex: 1; min-width: 0; }
.verify-banner .vb-title {
  font-size: 13px; font-weight: 700; color: var(--bn-text-1);
  letter-spacing: -0.01em;
}
.verify-banner .vb-sub {
  font-size: 11px; color: var(--bn-text-3); margin-top: 2px; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.verify-banner .vb-btn {
  flex-shrink: 0;
  background: var(--bn-acc);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
}
.verify-banner .vb-btn:hover { background: var(--bn-acc-deep, var(--bn-acc)); }
.verify-banner .vb-close {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: transparent; border: none;
  color: var(--bn-text-3);
  font-size: 14px; cursor: pointer;
  border-radius: 999px;
  transition: background 0.15s;
}
.verify-banner .vb-close:hover { background: var(--bn-bg-3); color: var(--bn-text-1); }

/* =================== Balance management sheet =================== */
.bn-sheet-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.bn-sheet-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-2);
  border-radius: 999px;
  font-size: 16px;
  cursor: pointer;
  transition: transform 0.15s var(--bn-ease);
}
.bn-sheet-close:active { transform: scale(0.92); }
.bn-sheet-body { padding-bottom: 6px; }

.balance-actions { display: flex; flex-direction: column; gap: 10px; }
.balance-action {
  width: 100%;
  text-align: left;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.15s var(--bn-ease), border-color 0.15s, background 0.15s;
}
.balance-action:hover {
  border-color: color-mix(in srgb, var(--bn-acc) 35%, var(--bn-line-1));
  background: var(--bn-bg-3);
}
.balance-action:active { transform: scale(0.99); }
.balance-action .ba-label {
  font-weight: 700; font-size: 15px; color: var(--bn-text-1);
  margin-bottom: 3px;
}
.balance-action .ba-desc {
  font-size: 12px; color: var(--bn-text-3); line-height: 1.4;
}

.bn-back-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  color: var(--bn-text-1);
  border-radius: 999px;
  font-size: 16px;
  cursor: pointer;
}
.bn-back-btn:active { transform: scale(0.92); }

.bn-field-label {
  display: block;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--bn-text-3); margin-bottom: 6px;
}
.bn-field-hint { color: var(--bn-text-3); }

.bn-amount-input-wrap {
  display: flex; align-items: baseline; gap: 6px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
}
.bn-amount-input-wrap:focus-within {
  border-color: var(--bn-acc);
  background: var(--bn-bg-3);
}
.bn-amount-input {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  font-size: 24px; font-weight: 800;
  color: var(--bn-text-1);
  font-feature-settings: "tnum" on, "lnum" on;
  letter-spacing: -0.02em;
}
.bn-amount-input::placeholder { color: var(--bn-text-3); opacity: 0.5; }
.bn-amount-cur { font-size: 16px; font-weight: 600; color: var(--bn-text-3); }

.bn-text-input {
  width: 100%;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: var(--bn-r-md);
  padding: 12px 14px;
  font-size: 14px; color: var(--bn-text-1);
  outline: none;
}
.bn-text-input:focus {
  border-color: var(--bn-acc);
  background: var(--bn-bg-3);
}

/* Scroll-hint «Листай» — на белом всё нормально, gradient уже тёмный */

/* ===== Челлендж: Home widget + Notes section + Detail sheet =====
   Layout (по ТЗ Стаса):
     [ карточка: иконка + название + день/серия + прогресс + ghost-badge ]
     gap 10px
     [ панель действий: 3 кнопки в ряд, высота 40, radius 12 ]
     margin-bottom 18px между разными челленджами
*/
.ch-block {
  margin: 0 2px 18px;  /* +2px по бокам поверх #app 14px → effective 16px */
  position: relative;
}
.ch-block.ch-example .challenge-card,
.ch-block.ch-example .ch-actions-panel {
  opacity: 0.6;
  filter: saturate(0.7);
  pointer-events: none;
}
/* Бейдж «пример» — onboarding-style: вылетает наполовину над карточкой как в .ghost-demo .ghost-label */
.ch-ghost-badge {
  position: absolute;
  top: -8px; right: 12px;
  background: var(--bn-bg-2);
  color: var(--bn-text-2);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--bn-line-2);
  z-index: 2; pointer-events: none;
  opacity: 1; filter: none;
}
/* Резервный отступ под badge не нужен (он сверху, не справа) */
.challenge-card .ch-head { padding-right: 0; }
/* Specificity boost: .card.flush (2 classes) перебивает .challenge-card (1 class) →
   padding обнулялся. Здесь даём .card.flush.challenge-card = 3 классов, побеждаем. */
.card.flush.challenge-card,
.challenge-card {
  position: relative;
  padding: 16px;
  margin-bottom: 10px;  /* gap между карточкой и actions-panel */
  overflow: visible;     /* чтобы ghost-badge top:-8px не клипался */
}
.challenge-card .ch-head {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; margin-bottom: 12px;
}
.challenge-card .ch-em { font-size: 28px; line-height: 1; flex-shrink: 0; }
.challenge-card .ch-info { flex: 1; min-width: 0; }
.challenge-card .ch-title {
  font-size: 15px; font-weight: 700; color: var(--bn-text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.challenge-card .ch-meta {
  font-size: 12px; color: var(--bn-text-3); margin-top: 2px;
}
/* Прогресс-бар идентичен .streak-bar (один визуальный язык) */
.ch-progress {
  height: 6px;
  background: var(--bn-bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.ch-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bn-acc), color-mix(in srgb, var(--bn-acc) 50%, #FFB547));
  border-radius: 3px;
  transition: width 0.4s var(--bn-ease);
}
/* Панель действий — отдельный блок ПОД карточкой, не часть её */
.ch-actions-panel {
  display: flex; gap: 8px;
}
.ch-btn {
  flex: 1 1 0; min-width: 0; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px; padding: 0 8px;
  border-radius: 12px;
  border: 1px solid var(--bn-line-1); background: var(--bn-bg-2);
  color: var(--bn-text-1); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform 0.12s, background 0.15s;
}
.ch-btn:active { transform: scale(0.96); }
.ch-btn.ch-ok { background: rgba(0, 200, 150, 0.12); border-color: rgba(0, 200, 150, 0.35); color: #00c896; }
.ch-btn.ch-fail { background: rgba(255, 107, 122, 0.12); border-color: rgba(255, 107, 122, 0.35); color: #ff6b7a; }
.ch-btn.ch-skip { background: var(--bn-bg-2); }
.ch-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Деталь-sheet: stats + calendar */
.ch-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 14px 0;
}
.ch-stat {
  text-align: center; padding: 10px 4px;
  background: var(--bn-bg-2); border: 1px solid var(--bn-line-1);
  border-radius: 10px;
}
.ch-stat .n { display: block; font-weight: 700; font-size: 18px; color: var(--bn-text-1); }
.ch-stat .lbl { display: block; font-size: 11px; color: var(--bn-text-3); margin-top: 2px; }
.ch-stat.ok .n { color: #00c896; }
.ch-stat.fail .n { color: #ff6b7a; }
.ch-stat.skip .n { color: var(--bn-text-3); }
.ch-stat.pct .n { color: var(--bn-acc); }

.ch-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; margin-top: 10px;
}
.ch-day {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-size: 11px; color: var(--bn-text-3);
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 6px;
}
.ch-day-ok { background: rgba(0, 200, 150, 0.25); border-color: rgba(0, 200, 150, 0.5); color: var(--bn-text-1); }
.ch-day-fail { background: rgba(255, 107, 122, 0.25); border-color: rgba(255, 107, 122, 0.5); color: var(--bn-text-1); }
.ch-day-skip { background: rgba(255, 200, 0, 0.18); border-color: rgba(255, 200, 0, 0.35); color: var(--bn-text-1); }
.ch-day-future { opacity: 0.4; }
.ch-day-pending { background: var(--bn-bg-2); }

.ch-cal-legend {
  display: flex; gap: 14px; justify-content: center;
  margin-top: 10px; font-size: 11px; color: var(--bn-text-3);
}
.ch-cal-legend .dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 4px; vertical-align: middle;
}
.ch-cal-legend .dot.ok { background: rgba(0, 200, 150, 0.6); }
.ch-cal-legend .dot.fail { background: rgba(255, 107, 122, 0.6); }
.ch-cal-legend .dot.skip { background: rgba(255, 200, 0, 0.45); }

.bn-danger-btn {
  padding: 10px 16px; border-radius: 12px;
  background: rgba(255, 107, 122, 0.12);
  border: 1px solid rgba(255, 107, 122, 0.35);
  color: #ff6b7a; font-weight: 600; cursor: pointer;
  font-family: inherit; font-size: 14px;
  transition: background 0.15s, transform 0.12s;
}
.bn-danger-btn:active { transform: scale(0.97); }
.bn-danger-btn:hover { background: rgba(255, 107, 122, 0.18); }

/* ===== Challenge create-form (sheet) ===== */
.ch-form { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.ch-field { display: flex; flex-direction: column; gap: 6px; }
.ch-field-label {
  font-size: 12px; font-weight: 600;
  color: var(--bn-text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Pill-кнопки для kind / duration / start. Не используем .seg — он требует
   фиксированной структуры с .seg-btn внутри. Делаем свои pill'ы. */
.ch-pill-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ch-pill {
  flex: 1 1 auto; min-width: 60px;
  padding: 10px 14px;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 10px;
  color: var(--bn-text-2);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s;
}
.ch-pill:active { transform: scale(0.96); }
.ch-pill.active {
  background: color-mix(in srgb, var(--bn-acc) 18%, transparent);
  border-color: var(--bn-acc);
  color: var(--bn-text-1);
}

/* Эмодзи-grid: 6 в ряд на широких, 5 на узких. Активный с обводкой. */
.ch-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
@media (max-width: 380px) {
  .ch-emoji-grid { grid-template-columns: repeat(5, 1fr); }
}
.ch-emoji {
  aspect-ratio: 1;
  display: grid; place-items: center;
  background: var(--bn-bg-2);
  border: 1px solid var(--bn-line-1);
  border-radius: 10px;
  font-size: 22px; cursor: pointer;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.ch-emoji:active { transform: scale(0.92); }
.ch-emoji.active {
  background: color-mix(in srgb, var(--bn-acc) 22%, transparent);
  border-color: var(--bn-acc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bn-acc) 30%, transparent);
}

/* Footer-кнопки: ровно 2 рядом, CTA шире (flex:2). Pill-форма — как у fab-stack. */
.ch-actions-row {
  display: flex; gap: 8px; margin-top: 16px;
  padding-top: 12px; border-top: 1px solid var(--bn-line-1);
}
.ch-actions-row .bn-ghost-btn,
.ch-actions-row .bn-cta-filled {
  border-radius: 999px;
  padding: 13px 18px;
}
.ch-actions-row .bn-ghost-btn { flex: 1; }
.ch-actions-row .bn-cta-filled { flex: 2; }

/* (старый .ghost-demo патч для challenge-card убран — теперь .ch-block.ch-example
   использует свой .ch-ghost-badge внутри карточки, без overflow-фокусов) */
/* CTA-кнопка под ghost'ом — pill, цвет от .bn-cta-filled gradient. */
.ch-ghost-cta {
  margin-top: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.12s;
}
.ch-ghost-cta:active { transform: scale(0.97); }

/* Notes-секция «Челленджи» — даём место под bottom-FAB.
   #app даёт 14px по бокам — добавляем 2px для эффективных 16px (ТЗ Стаса). */
#challenges-section { padding: 0 2px 24px; }
