/* ============================================================
   RIVER — первый экран (hero). Вёрстка точно по референсу.
   Тёплый almond/vanilla legal-tech. Ориентир: 1445×1088.
   ============================================================ */

:root {
  --olive: #708153;        /* логотип + кнопка отправки */
  --olive-deep: #647548;   /* hover кнопки */
  --matcha: #809671;       /* hover меню */
  --ink: #1F2A1D;          /* меню — очень тёмный olive */
  --carob: #725C3A;        /* текст ввода */
  --bg: #E5D9C8;           /* тёплый бежевый фон */

  --font-ui: "Inter", "Manrope", Arial, sans-serif;
  --font-logo: "Montserrat", "Inter", "Arial Black", sans-serif;
}

/* Убираем серую тап-подсветку на мобиле (мигающий прямоугольник при нажатии на поле/кнопки) */
* { -webkit-tap-highlight-color: transparent; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 900px at 50% 38%, rgba(246, 241, 232, 0.45), rgba(246, 241, 232, 0) 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(112, 129, 83, 0.20); color: var(--ink); }

html { scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar { width: 0; height: 0; display: none; }
body { scrollbar-width: none; -ms-overflow-style: none; }
body::-webkit-scrollbar { width: 0; height: 0; display: none; }

.page {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  overflow-x: clip;   /* без горизонтального скролла, вертикальный — свободно */
}

/* ---------- Hero ---------- */
.hero {
  position: relative;        /* якорь для подсказки прокрутки */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;   /* меню убрано — центрируем по вертикали, меньше отступ сверху */
  padding: 2rem 1.5rem;
  box-sizing: border-box;
}

/* ---------- Логотип ---------- */
.logo {
  margin: 0;
  color: var(--olive);
  font-family: var(--font-logo);
  font-size: 172px;           /* в 2 раза больше */
  font-weight: 900;
  line-height: 0.72;
  letter-spacing: 28px;
  text-indent: 28px;          /* компенсация trailing letter-spacing → строго по центру */
  text-align: center;
  white-space: nowrap;
}
/* Сплющивание вынесено на внутренний спан, чтобы transform самого .logo был свободен под
   морф RIVER→R. .logo__r / .logo__iver — буквы для отдельного замера и гашения «IVER». */
.logo__flat { display: inline-block; transform: scaleY(0.50); transform-origin: center; }
.logo__iver { transition: opacity 0.4s ease; }
/* Морф: логотип временно «плавает» поверх (fixed), чтобы не влиять на layout чата и
   перекрыть .chat-active .logo{display:none} на время анимации. */
.logo.is-morph { position: fixed; z-index: 45; margin: 0; display: block !important; will-change: transform; pointer-events: none; }

/* ---------- Поисковая строка (блок с тулбаром) ---------- */
.search {
  margin-top: 56px;
  width: min(720px, calc(100vw - 48px));
  border-radius: 32px;   /* «стадион»: концы блока скруглены под круглые кнопки attach/send */
  border: 1.5px solid rgba(111, 128, 81, 0.45);
  position: relative;
  isolation: isolate;   /* стекло уносим на ::before (z-index:-1), input НЕ внутри backdrop-filter */
  box-shadow:
    0 18px 34px rgba(114, 92, 58, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 12px;
  box-sizing: border-box;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
/* Стекло (frosted) на псевдоэлементе, а не на .search — иначе iOS Safari рисует
   мигающую каретку input'а ВЫШЕ поля (баг backdrop-filter). */
.search::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(248, 244, 236, 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  z-index: -1;
  pointer-events: none;
}

.search:focus-within {
  border-color: rgba(111, 128, 81, 0.85);
  box-shadow:
    0 18px 34px rgba(114, 92, 58, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 0 0 4px rgba(112, 129, 83, 0.18),
    0 0 40px rgba(112, 129, 83, 0.22);   /* мягкое olive-свечение */
}

/* поле ввода — растягивающийся flex-элемент внутри строки .search__bar */
.search textarea[name="q"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--carob);
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 4px;
  /* авто-рост как в ChatGPT: одна строка по умолчанию, растёт вверх до max, дальше скролл */
  resize: none;
  overflow-y: hidden;              /* JS включит auto при достижении предела */
  max-height: none;                /* предел роста считает JS: ровно 5 строк (_autoGrowInput) */
  line-height: 1.4;
  /* Скроллбар ВНУТРИ поля не рисуем — при длинном тексте он лез серой полосой поверх текста.
     Прокрутка (колесо, тач, каретка) работает как обычно. */
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* старый Edge */
  height: auto;
  display: block;
  /* .search__bar = align-items:flex-end (кнопки внизу при росте). Одну строку центрируем ОТДЕЛЬНО,
     иначе текст «Чем могу помочь?» стоит ниже середины плашки. Многострочный (высокий) — не задет. */
  align-self: center;
}

.search textarea[name="q"]::placeholder { color: rgba(114, 92, 58, 0.72); }
.search textarea[name="q"]::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------- Тулбар поиска ---------- */
.search__bar {
  display: flex;
  align-items: flex-end;   /* поле растёт ВВЕРХ, кнопки остаются внизу на месте */
  justify-content: space-between;
  gap: 10px;
}

.search__bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;               /* не сжимать в тесной строке — иначе «+»/микрофон становятся ОВАЛОМ */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(111, 128, 81, 0.30);
  background: transparent;
  color: var(--carob);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.search__icon:hover {
  background: rgba(112, 129, 83, 0.10);
  border-color: var(--olive);
  color: var(--olive);
}
.search__icon:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
.search__icon svg { width: 18px; height: 18px; display: block; }

.search__mic { border-color: transparent; }
.search__mic svg { width: 24px; height: 24px; }

.search__model {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--carob);
  padding: 8px 6px;
  border-radius: 10px;
  transition: color 160ms ease;
}
.search__model:hover { color: var(--olive); }
.search__model:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
.search__caret {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  opacity: 0.65;
  transform: scaleX(1.45) translateY(2px);   /* шире сверху, чуть ниже */
}

/* ---------- Кнопка отправки ---------- */
.send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--olive);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.send:hover { transform: scale(1.05); background: var(--olive-deep); }
.send:active { transform: scale(0.98); }
.send:focus-visible { outline: 2px solid var(--olive-deep); outline-offset: 3px; }

.send svg { width: 20px; height: 20px; display: block; }
.send .send__stop { width: 22px; height: 22px; }
/* Стрелка → белый квадрат-стоп при генерации ответа.
   Цвет кнопки остаётся оливковым (как в обычном состоянии). */
.send .send__stop { display: none; }
.search.is-busy .send__arrow { display: none; }
.search.is-busy .send__stop { display: block; }
.search.is-busy .send { background: var(--olive); }
.search.is-busy .send:hover { background: var(--olive-deep); transform: none; }

@keyframes sendSpin { to { transform: rotate(360deg); } }

/* Прячем скроллбар внутри выпадашки настроек (визуально-чистый), скролл остаётся работающим */
.settings-pop { scrollbar-width: none; -ms-overflow-style: none; }
.settings-pop::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ---------- Слоган под логотипом ---------- */
.tagline {
  margin: -0.6rem 0 0;
  white-space: nowrap;
  font-size: clamp(15px, 1.6vw, 19px);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: rgba(114, 92, 58, 0.80);
  text-align: center;
}

/* ---------- Примеры-вопросы (чипсы) ---------- */
.chips {
  width: 100%;
  max-width: 720px;
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.chip {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--carob);
  background: rgba(248, 244, 236, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.chip:hover {
  background: rgba(112, 129, 83, 0.12);
  border-color: var(--olive);
  color: var(--olive);
  transform: translateY(-1px);
}

.chip:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }

/* ---------- Подсказка прокрутки ---------- */
.scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  color: rgba(114, 92, 58, 0.55);
  transition: color 180ms ease, opacity 500ms ease, transform 500ms ease;
}

.scroll-hint.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

.scroll-hint:hover { color: var(--olive); }

.scroll-hint:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 4px;
  border-radius: 6px;
}

.scroll-hint__icon {
  display: block;
  animation: bob 1.9s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint__icon { animation: none; }
}

/* ---------- Адаптив (< 900px) ---------- */
@media (max-width: 900px) {
  .hero { padding-left: 16px; padding-right: 16px; }

  .logo {
    font-size: 60px;
    letter-spacing: 8px;
    text-indent: 8px;
  }

  .search {
    margin-top: 40px;
    width: calc(100vw - 32px);
    padding: 14px 14px 12px;
    gap: 14px;
  }
  .search textarea[name="q"] { font-size: 16px; }

  .send { width: 34px; height: 34px; }
  .send svg { width: 18px; height: 18px; }

  .search__icon { width: 34px; height: 34px; }
  .search__model { font-size: 14px; }
}

/* ============================================================
   Контент ниже первого экрана (материалы для презентации)
   ============================================================ */

.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 40px;
  box-sizing: border-box;
}

.band { padding: 96px 0; }
.band--intro { padding-top: 56px; padding-bottom: 72px; }
.band--stats { padding: 56px 0; }
.band--soft { background: rgba(248, 244, 236, 0.45); }

.kicker {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--olive);
}

.band__title {
  margin: 0 0 18px;
  scroll-margin-top: 48px;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.band__lead {
  margin: 0;
  max-width: 720px;
  font-size: 19px;
  line-height: 1.6;
  color: var(--carob);
}

/* Цифры корпуса */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.stat {
  text-align: center;
  padding: 30px 16px;
  background: rgba(248, 244, 236, 0.55);
  border: 1px solid rgba(111, 128, 81, 0.20);
  border-radius: 18px;
}

.stat__num {
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1;
  color: var(--olive);
  white-space: nowrap;
}

.stat__label {
  margin-top: 10px;
  font-size: 15px;
  color: var(--carob);
}

/* Возможности — карточки */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);   /* 4 карточки → гармоничная сетка 2×2 */
  gap: 22px;
  margin-top: 36px;
}

.card {
  padding: 30px 28px;
  background: rgba(248, 244, 236, 0.55);
  border: 1px solid rgba(111, 128, 81, 0.20);
  border-radius: 20px;
  scroll-margin-top: 90px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 34px rgba(114, 92, 58, 0.10);
  border-color: rgba(111, 128, 81, 0.40);
}

.card__num {
  display: block;
  margin-bottom: 12px;
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--olive);
  opacity: 0.7;
}

.card__title {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.card__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--carob);
}

/* Как это работает — шаги */
.steps {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--olive);
  color: #fff;
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: 18px;
}

.step__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.step__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--carob);
}

/* Футер с контактами */
.footer {
  margin-top: 24px;
  background: #DBCDB7;
  border-top: 1px solid rgba(111, 128, 81, 0.25);
  scroll-margin-top: 80px;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
  padding-top: 56px;
  padding-bottom: 40px;
}

/* Бренд-колонка: RIVER + подзаголовок центрируются друг под другом (подзаголовок под серединой RIVER) */
.footer__brand { display: flex; flex-direction: column; align-items: center; }

.footer__logo {
  font-family: var(--font-logo);
  font-weight: 900;
  font-size: 54px;           /* на десктопе крупнее (на мобиле переопределяется ниже) */
  line-height: 0.72;
  letter-spacing: 0.163em;   /* та же пропорция, что в заголовке (28 / 172) */
  transform: scaleY(0.50);   /* тот же приплюснутый вид, что у большого RIVER */
  transform-origin: center;
  color: var(--olive);
  white-space: nowrap;
}

.footer__tagline {
  margin: 3px 0 0;           /* ближе к RIVER */
  max-width: 240px;
  font-size: 15px;
  color: var(--carob);
  text-align: center;        /* по середине слова RIVER */
}

.footer__heading {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.footer__list { list-style: none; margin: 0; padding: 0; }
.footer__list li { margin-bottom: 10px; }

.footer__list a {
  font-size: 16px;
  color: var(--carob);
  text-decoration: none;
  transition: color 180ms ease;
}
.footer__list a:hover { color: var(--olive); }

.footer__email,
.footer__phone {
  font-family: inherit;
  font-size: 16px;
  color: var(--carob);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: color 180ms ease;
}
.footer__email:hover,
.footer__email.is-copied,
.footer__phone:hover,
.footer__phone.is-copied { color: var(--olive); }
.footer__email:focus-visible,
.footer__phone:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  border-radius: 4px;
}

.footer__copied {
  display: block;
  min-height: 1.1em;
  margin-top: 8px;
  font-size: 13px;
  color: var(--olive);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 260ms ease, transform 260ms ease;
}
.footer__copied:not(:empty) { opacity: 1; transform: translateY(0); }

.footer__req {
  font-style: normal;
  font-size: 14px;
  line-height: 1.7;
  color: var(--carob);
}

.footer__bottom { border-top: 1px solid rgba(111, 128, 81, 0.18); }

.footer__bottom-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 18px;
  padding-bottom: 18px;
  font-size: 13px;
  color: rgba(114, 92, 58, 0.72);
}

.footer__powered { margin-left: 10px; font-size: 11px; color: rgba(120, 120, 120, 0.7); }

/* Цены */
.price-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }
.price-card {
  background: rgba(248, 244, 236, 0.55);
  border: 1px solid rgba(111, 128, 81, 0.22);
  border-radius: 18px;
  padding: 24px 26px;
}
#tseny .band__title { margin-bottom: 10px; }   /* под «Цены» отступ поменьше */
.price-card--wide { margin-top: 40px; }         /* над «Как это устроено» чуть больше */
.price-card__title { margin: 0 0 14px; font-size: 18px; color: var(--ink); }
.price-list { list-style: none; margin: 0; padding: 0; }
.price-list li { position: relative; padding-left: 22px; margin: 10px 0; color: var(--carob); font-size: 15.5px; line-height: 1.5; }
.price-list li::before { content: "•"; position: absolute; left: 4px; color: var(--olive); font-weight: 700; }
.price-table-scroll { overflow-x: auto; }
.price-table { border-collapse: collapse; width: 100%; font-size: 15px; }
.price-table th, .price-table td { border: 1px solid rgba(111, 128, 81, 0.25); padding: 9px 12px; text-align: left; color: var(--carob); }
.price-table th { background: rgba(112, 129, 83, 0.1); color: var(--ink); font-weight: 600; }
.price-table td small { color: rgba(114, 92, 58, 0.6); font-weight: 400; margin-left: 4px; }
.price-note { margin: 14px 0 0; font-size: 13.5px; color: rgba(114, 92, 58, 0.75); }
.price-legal { margin-top: 24px; font-size: 14.5px; color: var(--carob); }
.price-legal a { color: var(--olive); }
.price-packs { margin-top: 12px; }   /* над «Готовые пакеты» как снизу заголовка (12px) */
.price-packs__title { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--ink); }
.price-packs__row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.price-pack {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 10px; cursor: pointer; font-family: inherit;
  background: rgba(248, 244, 236, 0.6);
  border: 1.5px solid rgba(111, 128, 81, 0.3); border-radius: 14px;
  transition: border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}
.price-pack:hover { border-color: var(--olive); background: rgba(248, 244, 236, 0.92); transform: translateY(-2px); }
.price-pack__sum { font-size: 20px; font-weight: 700; color: var(--olive); }
.price-pack__sub { font-size: 12.5px; color: var(--carob); }
.price-packs__note { margin: 12px 0 0; font-size: 12px; color: rgba(114, 92, 58, 0.75); }
.price-packs__note a { color: var(--olive); }

/* Адаптив для блоков ниже первого экрана */
@media (max-width: 900px) {
  .wrap { padding: 0 20px; }
  .band { padding: 64px 0; }
  .band--intro { padding-top: 40px; padding-bottom: 48px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .band__lead { font-size: 17px; }
  .price-cols { grid-template-columns: 1fr; }
  .price-packs__row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .stats { gap: 14px; }
  .cards { grid-template-columns: 1fr; }
  .chips { gap: 8px; }
  .chip { font-size: 13px; padding: 8px 14px; }
  .footer__inner { flex-direction: column; gap: 24px; }
  .footer__bottom-inner { flex-direction: column; gap: 6px; }
}

/* ============================================================
   Технологичные эффекты: живой фон, появления, скролл-ревил
   ============================================================ */

/* ---------- Живой тёплый фон (аврора + зерно) ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  /* фон прозрачный — сквозь него виден спокойный фон body; .bg даёт только
     еле заметные ванильные пятна поверх */
}

.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  will-change: transform;
}

.bg__blob--1 {
  width: 46vw; height: 46vw;
  left: -6vw; top: -10vw;
  background: radial-gradient(circle, rgba(229, 210, 184, 0.32), rgba(229, 210, 184, 0) 70%);
  animation: drift1 30s ease-in-out infinite alternate;
}

.bg__blob--2 {
  width: 42vw; height: 42vw;
  right: -8vw; top: 12vh;
  background: radial-gradient(circle, rgba(229, 210, 184, 0.28), rgba(229, 210, 184, 0) 70%);
  animation: drift2 36s ease-in-out infinite alternate;
}

.bg__blob--3 {
  width: 44vw; height: 44vw;
  left: 28vw; bottom: -16vh;
  background: radial-gradient(circle, rgba(229, 210, 184, 0.24), rgba(229, 210, 184, 0) 70%);
  animation: drift3 42s ease-in-out infinite alternate;
}

@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(8vw, 6vh) scale(1.15); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-7vw, 8vh) scale(1.12); } }
@keyframes drift3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vw, -7vh) scale(1.2); } }

.bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Плавные появления (hero) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .logo    { animation: riseLogo 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: 0.05s; }
  .tagline { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: 0.18s; }
  .search  { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: 0.30s; }
  .chips   { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; animation-delay: 0.45s; }
  .scroll-hint { animation: fadeIn 0.9s ease backwards; animation-delay: 0.95s; }
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes riseLogo { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Раскрытие блоков при прокрутке ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal .band__title,
  .reveal .band__lead,
  .reveal .stat,
  .reveal .card,
  .reveal .step,
  /* блоки секции «Цены»: карточка «Как это устроено» и пакеты пополнения — раньше
     появлялись рывком, пока заголовок над ними уже выезжал плавно */
  .reveal .price-card,
  .reveal .price-packs {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .reveal .is-visible { opacity: 1; transform: none; }

  .reveal .stat:nth-child(2), .reveal .card:nth-child(2), .reveal .step:nth-child(2) { transition-delay: 0.08s; }
  .reveal .stat:nth-child(3), .reveal .card:nth-child(3), .reveal .step:nth-child(3) { transition-delay: 0.16s; }
  .reveal .stat:nth-child(4), .reveal .card:nth-child(4) { transition-delay: 0.24s; }
  /* пакеты идут следом за карточкой — лёгкая задержка, чтобы читалось как каскад */
  .reveal .price-packs { transition-delay: 0.08s; }
}

/* Меньше движения — выключаем дрейф фона */
@media (prefers-reduced-motion: reduce) {
  .bg__blob { animation: none; }
}

/* ============================================================
   ЧАТ — режим диалога (включается классом body.chat-active)
   ============================================================ */

/* Топбар чата (компактный логотип + «Новый чат») — виден только в чате */
.chat-topbar {
  display: none;
  width: 100%;
  max-width: 860px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 10px;
}

.chat-topbar__logo {
  font-family: var(--font-logo);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 6px;
  text-indent: 6px;
  color: var(--olive);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.chat-new {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--carob);
  background: rgba(248, 244, 236, 0.6);
  border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
/* hover только на устройствах с реальным hover — иначе на тач «залипает» после тапа */
@media (hover: hover) { .chat-new:hover { background: rgba(112, 129, 83, 0.12); border-color: var(--olive); color: var(--olive); } }
.chat-new:active { background: rgba(112, 129, 83, 0.16); }
.chat-new svg { width: 15px; height: 15px; }

/* Лента сообщений — скрыта на лендинге */
.chat { display: none; }

/* ---------- Включённый режим диалога ---------- */
/* touch-action: manipulation — снимает зум по ДВОЙНОМУ ТАПУ (пинч глушится в JS). Прокрутка
   ленты и выделение текста не задеты. */
.chat-active { overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }   /* нет рубер-бенда: поле ввода не «ускользает» */

.chat-active .hero {
  height: 100svh;
  min-height: 0;
  justify-content: flex-start;
  padding-top: 0;
  padding-bottom: 0;
}

/* Прячем «лендинговые» элементы первого экрана */
.chat-active .logo,
.chat-active .tagline,
.chat-active .chips,
.chat-active .scroll-hint { display: none; }

/* Прячем всё, что ниже первого экрана */
.chat-active .band,
.chat-active .footer { display: none; }

.chat-active .chat-topbar { display: flex; }

/* column-reverse: у контейнера начало скролла снизу, поэтому чат открывается
   прибитым к последнему сообщению нативно (scrollTop 0 = низ) и браузер сам
   держит низ при любых reflow (шрифты, картинки). Порядок сообщений остаётся
   обычным благодаря внутреннему стеку .chat__stack. */
.chat-active .chat {
  display: flex;
  flex-direction: column-reverse;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 860px;
  overflow-y: auto;
  padding: 14px 4px 20px;
  scroll-behavior: smooth;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;        /* IE/legacy Edge */
}
/* margin-bottom:auto прижимает короткую переписку к верху; при переполнении
   свободного места нет и низ остаётся нативным началом скролла */
.chat__stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-bottom: auto;
}
.chat-active .chat::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;                   /* Chrome, Safari */
}

/* ---------- Inline-цитаты [N] в ответе ассистента ---------- */
.cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--olive);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;       /* ровно как высота — числа становятся по вертикали */
  text-align: center;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  cursor: pointer;
  user-select: none;
  transition: background 160ms ease, transform 160ms ease;
}
/* Двузначные числа: чуть пошире эллипс */
.cite[data-n^="1"][data-n$="0"],
.cite[data-n^="1"][data-n$="1"],
.cite[data-n^="1"][data-n$="2"],
.cite[data-n^="1"][data-n$="3"],
.cite[data-n^="1"][data-n$="4"],
.cite[data-n^="1"][data-n$="5"],
.cite[data-n^="1"][data-n$="6"],
.cite[data-n^="1"][data-n$="7"],
.cite[data-n^="1"][data-n$="8"],
.cite[data-n^="1"][data-n$="9"],
.cite[data-n^="2"], .cite[data-n^="3"], .cite[data-n^="4"],
.cite[data-n^="5"], .cite[data-n^="6"], .cite[data-n^="7"],
.cite[data-n^="8"], .cite[data-n^="9"] {
  /* однозначные оставляем — стиль выше */
}
.cite:hover, .cite:focus-visible {
  background: var(--olive-deep);
  transform: translateY(-1px);
  outline: none;
}

/* Всплывающее окно с фрагментом источника */
.cite-tip {
  position: fixed;
  z-index: 6000;
  /* Свёрнутый вид: компактная плашка для snippet'а 300 символов */
  max-width: 420px;
  padding: 12px 14px;
  background: #fdf9f1;
  border: 1px solid rgba(111, 128, 81, 0.4);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(31, 42, 29, 0.18);
  color: #1f2a1d;
  font-size: 13px;
  line-height: 1.45;
  pointer-events: auto;       /* tooltip кликабелен — можно навести и нажать «Развернуть» */
  box-sizing: border-box;
}
/* Развёрнутый вид: широкий, формат ближе к 4:3 — комфортнее читать длинный чанк. */
.cite-tip.is-expanded {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  /* высота получается из контента; max-height задаётся в JS под доступную часть экрана */
}
.cite-tip[hidden] { display: none; }
.cite-tip__title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 6px;
  color: #1f2a1d;
}
/* Строка актуальности в тултипе цитаты (редакция + бейдж «недействующий») */
.cite-tip__act {
  font-size: 11.5px;
  opacity: 0.82;
  margin: -2px 0 7px;
  color: var(--carob);
}
.cite-tip__badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 0 6px;
  border-radius: 999px;
  color: #b4292d;
  background: rgba(229, 72, 77, 0.14);
  border: 1px solid rgba(229, 72, 77, 0.3);
}
.cite-tip__unverified {
  font-size: 11px;
  line-height: 1.35;
  margin: -2px 0 7px;
  padding: 4px 7px;
  border-radius: 7px;
  color: #8a6d1f;
  background: rgba(214, 158, 46, 0.13);
  border: 1px solid rgba(214, 158, 46, 0.28);
}
.cite-tip__body {
  font-size: 12.5px;
  color: rgba(31, 42, 29, 0.85);
  max-height: 240px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 9;
  white-space: pre-wrap;
}
.cite-tip__body--full {
  display: block;
  -webkit-line-clamp: unset;
  max-height: none;
  overflow: visible;          /* собственного скролла нет — крутим весь tooltip */
}
.cite-tip__ellip { color: rgba(31, 42, 29, 0.5); font-weight: 600; }
.cite-hl { font-weight: 700; color: rgba(31, 42, 29, 0.95); background: rgba(112, 129, 83, 0.20); border-radius: 3px; padding: 0 1px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.cite-tip__foot {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.cite-tip__btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--olive);
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 160ms ease;
}
.cite-tip__btn:hover { background: var(--olive-deep); }
.cite-tip__btn:disabled { opacity: 0.7; cursor: default; }

/* ---------- Drag-and-drop оверлей (перетаскивание файлов из проводника) ---------- */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(229, 217, 200, 0.55);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  pointer-events: none;            /* оверлей не перехватывает drag/drop события — они идут на document */
  color: var(--carob);
  text-align: center;
  padding: 32px 24px;
}
body.is-dragging .drop-overlay {
  display: flex;
  animation: dropFade 160ms ease backwards;
}
@keyframes dropFade { from { opacity: 0; } to { opacity: 1; } }
.drop-overlay__icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 22px;
}
.drop-overlay__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  color: #fff;
  box-shadow: 0 8px 22px rgba(31, 42, 29, 0.18);
  background: var(--olive);
}
.drop-overlay__chip svg { width: 32px; height: 32px; }
.drop-overlay__chip--a { background: #6F8051; transform: rotate(-10deg) translateX(14px); }
.drop-overlay__chip--b { background: #4D5C82; transform: translateY(-4px); z-index: 1; }
.drop-overlay__chip--c { background: #C0492F; transform: rotate(10deg) translateX(-14px); }
.drop-overlay__title {
  font-family: var(--font-logo, inherit);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1f2a1d;
  margin: 0 0 10px 0;
}
.drop-overlay__hint {
  font-size: 15px;
  background: rgba(255, 255, 255, 0.85);
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 29, 0.08);
  color: #1f2a1d;
  margin: 0;
}
@media (prefers-reduced-motion: reduce) {
  body.is-dragging .drop-overlay { animation: none; }
}

.chat-active .search {
  margin-top: 14px;
  margin-bottom: 16px;
  flex: 0 0 auto;
}

/* Морфинг входа в чат: лента «вырастает» из строки поиска, топбар проявляется */
.chat.chat-enter { opacity: 0; transform: translateY(26px); }
.chat-active .chat { transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.22, 0.7, 0.2, 1); }
.chat-active .chat-topbar { animation: chatTopIn 0.5s ease both; }
@keyframes chatTopIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .chat.chat-enter { opacity: 1; transform: none; }
  .chat-active .chat-topbar { animation: none; }
}

/* ---------- Сообщения ---------- */
.msg { display: flex; flex-direction: column; max-width: 100%; animation: msgIn 0.34s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.msg--user { align-items: flex-end; }
.msg--assistant { align-items: flex-start; }
.msg--note { align-items: center; }
.msg__note {
  color: rgba(31, 42, 29, 0.5);          /* тот же серый, что у стадий стриминга */
  font-size: 13.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
}

.msg__bubble {
  border-radius: 18px;
  padding: 13px 17px;
  font-size: 16px;
  line-height: 1.6;
  max-width: 88%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.msg--user .msg__bubble {
  background: var(--olive);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg--assistant .msg__bubble {
  background: rgba(248, 244, 236, 0.7);
  border: 1px solid rgba(111, 128, 81, 0.22);
  color: var(--ink);
  border-bottom-left-radius: 6px;
  max-width: 100%;
}
/* Кнопка «Копировать» под ответом ИИ */
.msg-copy {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 7px; padding: 4px 9px;
  background: transparent; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 8px;
  color: var(--carob); opacity: 0.55; font-size: 12.5px; font-family: inherit; cursor: pointer;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.msg-copy:hover { opacity: 1; background: rgba(111, 128, 81, 0.08); }
.msg-copy:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; }
.msg-copy.is-copied { opacity: 1; color: var(--olive); border-color: var(--olive); background: rgba(112, 129, 83, 0.08); }
.msg-copy svg { flex: none; }
.msg-actions { display: flex; align-items: center; gap: 8px; margin-top: 7px; position: relative; }
.msg-actions .msg-copy { margin-top: 0; }
.msg-dl { position: relative; display: inline-flex; }
/* Меню скачивания открывается ВВЕРХ и выровнено по правому краю кнопки — чтобы влезало над строкой ввода */
.msg-dl__menu { position: absolute; bottom: calc(100% + 6px); top: auto; right: 0; left: auto; z-index: 30; background: #fff; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); overflow: hidden; min-width: 140px; }

/* Подвал ответа В ОДНУ СТРОКУ: источники слева, стоимость + «Копировать»/«Скачать» СПРАВА */
.msg-foot { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; align-self: stretch; }
.msg-foot .sources { margin-top: 0; }
.msg-foot .msg-actions { margin-top: 2px; margin-left: auto; }   /* прижать кнопки к правому краю */
.msg-actions .msg__cost { margin-top: 0; white-space: nowrap; }
.msg-dl__menu[hidden] { display: none; }
.msg-dl__item { display: block; width: 100%; text-align: left; padding: 9px 13px; background: transparent; border: 0; font-family: inherit; font-size: 13px; color: var(--carob); cursor: pointer; white-space: nowrap; }
.msg-dl__item:hover { background: rgba(111, 128, 81, 0.10); }

/* «Отзыв»: кнопка как в подвале + инлайн-панель, открывается ВВЕРХ (как меню «Скачать»).
   Панель якорится к .msg-actions (position: relative), а не к самой кнопке — иначе широкая
   панель уезжала бы за левый край на узких экранах (кнопка не крайняя справа). */
.msg-fb { display: inline-flex; }
.msg-fb__panel {
  position: absolute; bottom: calc(100% + 6px); right: 0; left: auto; z-index: 30;
  width: 280px; max-width: calc(100vw - 32px); box-sizing: border-box;
  background: #fff; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); padding: 12px;
  display: flex; flex-direction: column; gap: 9px; text-align: left;
}
.msg-fb__panel[hidden] { display: none; }
.msg-fb__senti { display: flex; gap: 8px; }
.msg-fb__emoji {
  font-size: 17px; line-height: 1; padding: 6px 12px; cursor: pointer;
  background: transparent; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 8px;
  transition: background .15s, border-color .15s;
}
.msg-fb__emoji:hover { background: rgba(111, 128, 81, 0.08); }
.msg-fb__emoji.is-on { background: rgba(112, 129, 83, 0.16); border-color: var(--olive); }
.msg-fb__text {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 66px;
  font-family: inherit; font-size: 13.5px; line-height: 1.4; color: var(--carob);
  padding: 8px 10px; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 8px; background: #fff;
}
.msg-fb__text:focus { outline: none; border-color: var(--olive); }
.msg-fb__send {
  align-self: flex-end; font-family: inherit; font-size: 13px; cursor: pointer;
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--olive);
  background: var(--olive); color: #fff; transition: opacity .15s;
}
.msg-fb__send:hover { opacity: 0.9; }
.msg-fb__send:disabled { opacity: 0.6; cursor: default; }
.msg-fb__status { font-size: 13px; color: var(--olive); }
/* уже оставленный отзыв: заполненный вид кнопки (как у .is-copied), метка «Отзыв ✓» */
.msg-fb .msg-copy.is-filled { opacity: 1; color: var(--olive); border-color: var(--olive); background: rgba(112, 129, 83, 0.10); }

/* Картинки в сообщении пользователя */
.msg__images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; justify-content: flex-end; }
.msg__images img { width: 116px; height: 116px; object-fit: cover; border-radius: 12px; border: 1px solid rgba(111, 128, 81, 0.3); cursor: zoom-in; }

/* Лайтбокс: картинка на весь экран (× справа-сверху + клик вне = закрыть) */
.img-lightbox {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  background: rgba(18, 18, 18, 0.82);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: lbFade 0.18s ease;
}
.img-lightbox[hidden] { display: none; }
.img-lightbox__img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 10px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: lbZoom 0.18s ease;
}
.img-lightbox__close {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right));
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 28px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.1s ease;
}
.img-lightbox__close:hover { background: rgba(255, 255, 255, 0.28); }
.img-lightbox__close:active { transform: scale(0.94); }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbZoom { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
body.lightbox-open { overflow: hidden; }

/* Действия под сообщением пользователя (копировать / редактировать) */
.msg__actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  padding-right: 4px;
}
.msg__act {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(31, 42, 29, 0.55);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.msg__act:hover { background: rgba(111, 128, 81, 0.12); color: var(--olive); }
.msg__act:focus-visible { outline: 2px solid var(--olive); outline-offset: 1px; }
.msg__act svg { width: 16px; height: 16px; display: block; }

/* Режим редактирования сообщения пользователя */
.msg__bubble--edit {
  background: #F3EEE4 !important;
  color: var(--ink) !important;
  padding: 12px 14px !important;
  border-bottom-right-radius: 18px !important;
  max-width: min(640px, 100%);
  width: min(640px, 100%);
  box-shadow: 0 6px 24px rgba(31, 42, 29, 0.08);
}
.msg__edit-area {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
  min-height: 60px;
}
.msg__edit-area::placeholder { color: rgba(31, 42, 29, 0.45); }
.msg__edit-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.msg__edit-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  border: 0;
  transition: background 140ms ease, color 140ms ease;
}
.msg__edit-btn--ghost {
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border: 1px solid rgba(31, 42, 29, 0.18);
}
.msg__edit-btn--ghost:hover { background: #fff; }
.msg__edit-btn--primary {
  background: var(--olive);
  color: #fff;
}
.msg__edit-btn--primary:hover { background: var(--olive-deep); }

/* Индикатор «думает»: спиннер + стадия конвейера + таймер */
.msg__think {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}
.think__spark {
  flex: 0 0 auto;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(111, 128, 81, 0.28);
  border-top-color: var(--olive);
  animation: thinkSpin 0.75s linear infinite;
}
@keyframes thinkSpin { to { transform: rotate(360deg); } }
.think__line { display: inline-flex; align-items: baseline; }
.think__stage {
  color: rgba(31, 42, 29, 0.5);      /* серый приглушённый текст стриминга */
  font-size: 15px;
}
.think__stage.is-in { animation: thinkStageIn 0.35s ease; }
@keyframes thinkStageIn {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: none; }
}
/* Троеточие после стадии: «.» → «..» → «...» по кругу, серым.
   При смене стадии JS перезапускает анимацию (класс is-anim) — идёт заново. */
.think__dots {
  color: rgba(31, 42, 29, 0.5);
  font-size: 15px;
  min-width: 1.4em;                  /* чтобы текст не «прыгал» при 1/2/3 точках */
  text-align: left;
}
.think__dots::after { content: "."; }
.think__dots.is-anim::after {
  content: ".";
  animation: thinkEllipsis 2s infinite;
}
/* Цикл 2с, три равные трети: «.» → «..» → «...» → по кругу.
   content дискретен — держится значение ближайшего кадра слева. */
@keyframes thinkEllipsis {
  0%,     33.32% { content: "."; }
  33.33%, 66.65% { content: ".."; }
  66.66%, 100%   { content: "..."; }
}
@media (prefers-reduced-motion: reduce) {
  .think__dots.is-anim::after { animation: none; content: "..."; }
}
.think__timer {
  color: rgba(31, 42, 29, 0.45);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  margin-left: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .think__spark { animation: none; border-top-color: var(--olive); }
  .think__stage.is-in { animation: none; }
}

/* ---------- Markdown внутри ответа ---------- */
.msg__bubble > :first-child { margin-top: 0; }
.msg__bubble > :last-child { margin-bottom: 0; }
.msg__bubble h1, .msg__bubble h2, .msg__bubble h3, .msg__bubble h4 {
  margin: 18px 0 8px; line-height: 1.3; color: var(--ink); font-weight: 700;
}
.msg__bubble h1 { font-size: 21px; }
.msg__bubble h2 { font-size: 19px; }
.msg__bubble h3 { font-size: 17px; }
.msg__bubble h4 { font-size: 16px; }
.msg__bubble p { margin: 10px 0; }
.msg__bubble ul, .msg__bubble ol { margin: 10px 0; padding-left: 22px; }
.msg__bubble li { margin: 5px 0; }
.msg__bubble strong { font-weight: 700; color: var(--ink); }
.msg__bubble a { color: var(--olive-deep); text-decoration: underline; text-underline-offset: 2px; }
.msg__bubble a:hover { color: var(--olive); }
.msg__bubble code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em; background: rgba(111, 128, 81, 0.12);
  padding: 1px 6px; border-radius: 6px;
}
.msg__bubble pre {
  background: rgba(31, 42, 29, 0.06); border: 1px solid rgba(111, 128, 81, 0.18);
  border-radius: 12px; padding: 12px 14px; overflow-x: auto; margin: 12px 0;
}
.msg__bubble pre code { background: none; padding: 0; font-size: 13px; }
.msg__bubble blockquote {
  margin: 12px 0; padding: 4px 14px; border-left: 3px solid rgba(111, 128, 81, 0.5);
  color: var(--carob);
}
.msg__bubble table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14.5px; display: block; overflow-x: auto; }
.msg__bubble th, .msg__bubble td { border: 1px solid rgba(111, 128, 81, 0.28); padding: 7px 11px; text-align: left; }
.msg__bubble th { background: rgba(111, 128, 81, 0.1); font-weight: 700; }
.msg__bubble hr { border: 0; border-top: 1px solid rgba(111, 128, 81, 0.25); margin: 16px 0; }

/* ---------- Источники под ответом ---------- */
.sources { margin-top: 10px; max-width: 100%; }
.sources__toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--carob);
  background: rgba(248, 244, 236, 0.55); border: 1px solid rgba(111, 128, 81, 0.28);
  border-radius: 999px; padding: 6px 13px; cursor: pointer; transition: background-color 160ms ease, color 160ms ease;
}
.sources__toggle:hover { background: rgba(112, 129, 83, 0.12); color: var(--olive); }
.sources__toggle .search__caret { font-size: 13px; transition: transform 200ms ease; }
.sources.is-open .sources__toggle .search__caret { transform: scaleX(1.45) rotate(180deg); }
.sources__list { display: none; margin-top: 10px; flex-direction: column; gap: 8px; }
.sources.is-open .sources__list { display: flex; }
.source-item {
  background: rgba(248, 244, 236, 0.55); border: 1px solid rgba(111, 128, 81, 0.2);
  border-radius: 12px; padding: 10px 13px; font-size: 13.5px; color: var(--carob);
}
.source-item__title { font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.source-item__meta { font-size: 12px; opacity: 0.75; margin-bottom: 5px; }
.source-item__snippet { line-height: 1.5; }
/* Бейдж «недействующий» источник (утратил силу / недействующая редакция) */
.source-item__badge {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  font-size: 11px; font-weight: 600; line-height: 1.45;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  color: #b4292d; background: rgba(229, 72, 77, 0.12);
  border: 1px solid rgba(229, 72, 77, 0.28);
}

/* Таблицы внутри сниппета источника (распознанные pipe-таблицы) */
.src-table-wrap { margin-top: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.src-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.src-table th, .src-table td {
  border: 1px solid rgba(111, 128, 81, 0.32);
  padding: 4px 7px; vertical-align: top;
  text-align: left; word-break: break-word; min-width: 60px;
}
.src-table th { background: rgba(112, 129, 83, 0.10); font-weight: 600; color: var(--ink); }
.src-table tr:nth-child(even) td { background: rgba(248, 244, 236, 0.45); }
/* «Битые» таблицы из чанков: показываем как монотекст со скроллом, без ложной сетки */
.src-pre {
  margin: 6px 0 0; padding: 8px 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.4; color: var(--carob);
  background: rgba(248, 244, 236, 0.55); border: 1px solid rgba(111, 128, 81, 0.22);
  border-radius: 8px;
  /* Переносим по словам, а не горизонтальный скролл: длинные строки-проза больше не уезжают вправо */
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; overflow-x: hidden;
  max-width: 100%;
}

/* ---------- Результат проверки (Аудитор / Ревизор) ---------- */
.audit-note { margin-top: 10px; border-radius: 12px; padding: 10px 13px; font-size: 13.5px; border: 1px solid; max-width: 100%; }
.audit-note.is-ok   { background: rgba(112, 129, 83, 0.10); border-color: rgba(112, 129, 83, 0.45); }
.audit-note.is-warn { background: rgba(210, 171, 128, 0.16); border-color: rgba(176, 128, 58, 0.5); }
.audit-note.is-err  { background: rgba(192, 73, 47, 0.10); border-color: rgba(192, 73, 47, 0.45); }
.audit-note__head { font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.audit-note__summary { color: var(--carob); line-height: 1.5; }
.audit-note__issues { margin: 6px 0 0; padding-left: 18px; color: var(--carob); }
.audit-note__issues li { margin: 3px 0; }

/* По каким запросам искал (переформулировка под поиск) */
.search-queries { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--carob); opacity: 0.7; }

/* ---------- Лоток вложений (превью прикреплённых картинок) ---------- */
.attach-tray { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 4px 2px; }
.attach-thumb { position: relative; width: 60px; height: 60px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(111, 128, 81, 0.35); }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-thumb__x {
  position: absolute; top: 2px; right: 2px; width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: rgba(31, 42, 29, 0.72); color: #fff;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0;
}
.attach-thumb__x:hover { background: rgba(31, 42, 29, 0.92); }

/* Не-картиночные вложения (DOCX/PDF/XLSX/...) пилюля с иконкой и именем файла */
.attach-thumb--file {
  width: auto; max-width: 240px; height: 60px; padding: 8px 36px 8px 10px;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 12px;
}
.attach-thumb__ico {
  width: 26px; height: 26px; flex: 0 0 26px;
  color: var(--accent-strong, #6F8051);
  display: flex; align-items: center; justify-content: center;
}
.attach-thumb__ico svg { width: 22px; height: 22px; display: block; }
.attach-thumb__meta { min-width: 0; flex: 1 1 auto; }
.attach-thumb__name {
  font-size: 12.5px; color: #1f2a1d; line-height: 1.15;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}
.attach-thumb__size { font-size: 11px; color: rgba(31, 42, 29, 0.6); margin-top: 2px; }

/* Файловые пилюли в сообщении пользователя */
.msg__docs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; justify-content: flex-end; }
.msg__doc {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(111, 128, 81, 0.3);
  border-radius: 10px; padding: 6px 10px; max-width: 260px;
  color: #1f2a1d;
}
.msg__doc svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--accent-strong, #6F8051); }
.msg__doc-name { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg__doc-size { font-size: 11px; color: rgba(31, 42, 29, 0.55); }

/* ---------- Выпадающие настройки (кнопка «Модель») ---------- */
.search__model-wrap { position: relative; }

/* атрибут hidden должен побеждать display:flex у этих блоков */
.settings-pop[hidden], .attach-tray[hidden] { display: none; }

.settings-pop {
  position: fixed;                 /* координаты ставит JS — умное позиционирование под экран */
  width: min(360px, calc(100vw - 24px));   /* одна колонка: 3 простые оси + «Тонкая настройка» */
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: #F6F1E8;             /* сплошной фон, без прозрачности */
  border: 1.5px solid rgba(111, 128, 81, 0.45);
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(60, 50, 30, 0.28);
  padding: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: popIn 0.16s ease backwards;
}
.settings-col { display: flex; flex-direction: column; gap: 14px; }   /* совместимость, если где-то остался */
@media (max-width: 540px) {
  .settings-pop { gap: 12px; width: min(340px, calc(100vw - 24px)); }
}
/* «Тонкая настройка» — раскрывающийся блок с техническими параметрами */
.settings-pop__label-note {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: rgba(31, 42, 29, 0.5); font-size: 10.5px; margin-left: 6px;
}
.settings-pop__more {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--olive); background: transparent;
  border: 0; border-top: 1px solid rgba(111, 128, 81, 0.22);
  padding: 13px 2px 2px; cursor: pointer;
}
.settings-pop__more[hidden] { display: none; }
.settings-adv { display: flex; flex-direction: column; gap: 14px; }
.settings-adv[hidden] { display: none; }
.settings-adv__hint {
  margin: 0; font-size: 11.5px; line-height: 1.4; color: rgba(31, 42, 29, 0.62);
  background: rgba(111, 128, 81, 0.09); border-radius: 8px; padding: 8px 10px;
}
@keyframes popIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.settings-pop__group { display: flex; flex-direction: column; gap: 9px; }
.settings-pop__label {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--olive);
}

/* Сегментированный переключатель */
.seg { display: flex; gap: 6px; }
.seg__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: var(--carob);
  background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(111, 128, 81, 0.28);
  border-radius: 11px; padding: 7px 4px; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.seg__btn small { font-size: 10.5px; font-weight: 500; opacity: 0.7; }
.seg__btn:hover { border-color: var(--olive); }
.seg__btn.is-active { background: var(--olive); color: #fff; border-color: var(--olive); }
.seg__btn.is-active small { opacity: 0.85; }

/* Тумблеры точности */
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.opt__text { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; color: var(--ink); }
.opt__text small { font-size: 11.5px; font-weight: 400; color: var(--carob); opacity: 0.8; }
.opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt__switch {
  flex: 0 0 auto; position: relative; width: 40px; height: 23px; border-radius: 999px;
  background: rgba(111, 128, 81, 0.3); transition: background-color 180ms ease;
}
.opt__switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; transition: transform 180ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.opt input:checked + .opt__switch { background: var(--olive); }
.opt input:checked + .opt__switch::after { transform: translateX(17px); }
.opt input:focus-visible + .opt__switch { outline: 2px solid var(--olive); outline-offset: 2px; }

/* числовые настройки (top K и т.п.) */
.num-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: default; }
.num-opt__text { display: flex; flex-direction: column; font-size: 14px; font-weight: 500; color: var(--ink); }
.num-opt__text small { font-size: 11.5px; font-weight: 400; color: var(--carob); opacity: 0.8; }
.num-opt input {
  flex: 0 0 auto; width: 58px; padding: 6px 8px; font-family: inherit; font-size: 14px; text-align: center;
  border: 1px solid rgba(111, 128, 81, 0.35); border-radius: 8px; background: rgba(255, 255, 255, 0.5);
  color: var(--ink); outline: none;
}
.num-opt input:focus { border-color: var(--olive); }

/* Слайдер температуры генерации */
.range-opt { display: flex; align-items: center; gap: 12px; margin-top: 8px; cursor: default; }
.range-opt input[type="range"] {
  flex: 1 1 auto; height: 22px; margin: 0; padding: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: pointer; outline: none;
}
.range-opt input[type="range"]::-webkit-slider-runnable-track {
  height: 5px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(111,128,81,0.55), rgba(111,128,81,0.18));
}
.range-opt input[type="range"]::-moz-range-track {
  height: 5px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(111,128,81,0.55), rgba(111,128,81,0.18));
}
.range-opt input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px;
  border-radius: 50%; background: var(--olive); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.12s ease;
}
.range-opt input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--olive);
  border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.range-opt input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
.range-opt input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(111,128,81,0.28); }
.range-opt__val {
  flex: 0 0 auto; min-width: 34px; text-align: center; font-size: 14px; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
  padding: 3px 7px; border-radius: 8px; background: rgba(111,128,81,0.12);
}
.range-opt__scale { display: flex; justify-content: space-between; margin-top: 4px; padding: 0 2px; }
.range-opt__scale span { font-size: 11px; color: var(--carob); opacity: 0.75; }

/* Микрофон во время записи */
.search__mic.is-recording { background: #c0492f; border-color: #c0492f; color: #fff; animation: micPulse 1.3s ease-in-out infinite; }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192, 73, 47, 0.4); } 50% { box-shadow: 0 0 0 7px rgba(192, 73, 47, 0); } }

/* Панель записи голоса: осциллограмма + отмена/готово (оверлей поверх ввода) */
.search { position: relative; }
.rec-bar {
  position: absolute; inset: 0; border-radius: 20px; background: #F3EEE4;
  display: none; align-items: center; gap: 12px; padding: 0 14px 0 22px; z-index: 6;
  animation: popIn 0.16s ease backwards;
}
.search.is-recording .rec-bar { display: flex; }
.rec-wave { flex: 1 1 auto; min-width: 0; width: 100%; height: 40px; display: block; }
.rec-btn {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(111, 128, 81, 0.30); background: transparent; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.rec-btn svg { width: 20px; height: 20px; }
.rec-cancel { color: #b23b2a; border-color: rgba(178, 59, 42, 0.40); }
.rec-cancel:hover { background: rgba(178, 59, 42, 0.10); }
.rec-confirm { color: #fff; background: var(--olive); border-color: var(--olive); position: relative; }
.rec-confirm:hover { background: var(--olive-deep); }

/* Спиннер в кнопке-галочке: показывается на время транскрибации. */
.rec-confirm__spin { display: none; }
.search.is-transcribing .rec-confirm__check { display: none; }
.search.is-transcribing .rec-confirm__spin {
  display: block;
  animation: sendSpin 0.9s linear infinite;
}
/* Только галочка-«готово» блокируется (превращается в спиннер).
   Крестик остаётся кликабельным — он отменяет ИДУЩЕЕ распознавание. */
.search.is-transcribing .rec-confirm {
  pointer-events: none;
  opacity: 0.95;
}
/* Поле ввода под recBar — на всякий случай, плюс нативный input.disabled из JS. */
.search.is-transcribing .search__bar {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}
.search.is-transcribing input[name="q"]::placeholder { color: rgba(31, 42, 29, 0.5); }
/* recBar накрывает форму поверх — тускнее становятся ОН и осциллограмма,
   кнопки (крестик активный, спиннер крутится) оставляем непрозрачными. */
.search.is-transcribing .rec-bar { background: #ECE6DB; }
.search.is-transcribing .rec-wave { opacity: 0.55; }
@media (prefers-reduced-motion: reduce) {
  .search.is-transcribing .rec-confirm__spin { animation: none; }
}

@media (max-width: 540px) { .rec-btn { width: 36px; height: 36px; } }

/* ============================================================
   ЧАТ — двухпанельный layout (боковая панель + основная область)
   ============================================================ */
.chat-main { display: contents; }            /* на лендинге обёртка прозрачна */
.chat-collapsed-bar { display: none; }
.chat-sidebar { display: none; }

.chat-active .hero { flex-direction: row; align-items: stretch; padding: 0; }

.chat-active .chat-main {
  display: flex; flex-direction: column; align-items: center;
  flex: 1 1 auto; min-width: 0; min-height: 0; height: 100svh;
  padding: 0 16px;
}
/* строку ввода и ленту центрируем, ограничиваем ширину */
.chat-active .chat { max-width: 840px; }
/* Плавное затухание ленты у нижнего края (над полем ввода): вместо резкой границы
   сообщения мягко растворяются в фоне при подходе к строке ввода. Маска покрывает
   в основном нижний padding ленты, поэтому текст не обрезается. */
.chat-active .chat {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent);
}
.chat-active .search { width: min(840px, 100%); margin-top: 4px; margin-bottom: 8px; }
/* чипсы — под вводом (переопределяем скрытие на лендинге) */
.chat-active .chips { display: flex; margin-top: 0; margin-bottom: 16px; flex: 0 0 auto; }

/* Серая подпись над полем ввода (напр. «зрение недоступно»). В зоне над полем,
   где сообщения не рисуются: малый отступ, плавное появление/затухание по opacity
   + сглаженное раскрытие по высоте, чтобы поле не «прыгало». */
.input-hint {
  width: min(840px, 100%);
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(31, 42, 29, 0.5);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.45s ease, max-height 0.45s ease, padding 0.45s ease;
}
.input-hint.is-show { opacity: 1; max-height: 60px; padding: 2px 10px 4px; }
@media (prefers-reduced-motion: reduce) { .input-hint { transition: none; } }

/* ---------- Боковая панель ---------- */
.chat-active .chat-sidebar {
  display: flex; flex-direction: column; gap: 4px;
  width: 264px; flex: 0 0 264px; height: 100svh; box-sizing: border-box;
  background: #E1D6C3; border-right: 1px solid rgba(111, 128, 81, 0.25);
  padding: 12px 10px;
  /* Плавное выдвигание/схлопывание: на мобиле едет transform (translateX), на десктопе — flex-basis/width.
     flex-basis ОБЯЗАТЕЛЬНО в transition, иначе на десктопе размер прыгал мгновенно (flex-basis не анимировался). */
  transition: transform 0.30s cubic-bezier(0.32, 0.72, 0, 1),
              width 0.30s cubic-bezier(0.32, 0.72, 0, 1),
              flex-basis 0.30s cubic-bezier(0.32, 0.72, 0, 1),
              padding 0.30s cubic-bezier(0.32, 0.72, 0, 1);
}
@media (prefers-reduced-motion: reduce) { .chat-active .chat-sidebar { transition: none; } }
.chat-sidebar__head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; min-height: 40px; }
.chat-sidebar__logo {
  font-family: var(--font-logo); font-weight: 900; font-size: 42px; line-height: 0.7;
  color: var(--olive); background: none; border: 0; cursor: pointer; padding: 0;
  transform: scaleY(0.55); transform-origin: left center;
}
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent;
  color: var(--carob); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 150ms ease, color 150ms ease; flex: 0 0 auto;
}
@media (hover: hover) { .icon-btn:hover { background: rgba(111, 128, 81, 0.14); color: var(--olive); } }
.icon-btn:active { background: rgba(111, 128, 81, 0.16); }
.icon-btn svg { width: 19px; height: 19px; }

.chat-sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.side-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  font-family: inherit; font-size: 14.5px; font-weight: 500; color: var(--ink);
  background: transparent; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer;
  text-align: left; transition: background-color 150ms ease;
}
@media (hover: hover) { .side-btn:hover { background: rgba(111, 128, 81, 0.12); } }
.side-btn:active { background: rgba(111, 128, 81, 0.14); }
.side-btn svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--carob); }

.chat-sidebar__filter {
  margin: 2px 4px 4px; padding: 9px 13px; font-family: inherit; font-size: 16px;   /* 16px → iOS не зумит (не сбивает вьюпорт) */
  border: 1.5px solid rgba(111, 128, 81, 0.45); border-radius: 12px;
  background: rgba(248, 244, 236, 0.55);     /* как у поля ввода сообщения для ИИ */
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--carob); outline: none;
}
.chat-sidebar__filter::placeholder { color: rgba(114, 92, 58, 0.72); }
.chat-sidebar__filter:focus { border-color: rgba(111, 128, 81, 0.85); }

.chat-recents { margin-top: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.chat-recents::-webkit-scrollbar { display: none; }   /* прячем полосу прокрутки списка чатов, скролл работает */
.chat-recents__title {
  /* линия-разделитель = border-top; margin 10px по бокам → линия начинается на уровне «Недавние»
     и заканчивается на таком же отступе справа; padding-top отделяет линию от текста */
  margin: 0 10px 6px; padding-top: 12px;
  border-top: 1px solid rgba(111, 128, 81, 0.22);
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--carob); opacity: 0.75;
}
.chat-recents__list { display: flex; flex-direction: column; gap: 1px; }
.chat-sidebar__credit { flex: 0 0 auto; padding: 8px 6px 2px; font-size: 11px; color: rgba(120, 120, 120, 0.7); }
.recent-item {
  display: flex; align-items: center; gap: 2px; width: 100%;
  border-radius: 9px; padding: 0 6px 0 0; cursor: default;
  transition: background-color 150ms ease;
}
.recent-item:hover { background: rgba(111, 128, 81, 0.12); }
.recent-item.is-active { background: rgba(112, 129, 83, 0.20); }
.recent-item__open {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center;
  font-family: inherit; font-size: 14px; color: var(--ink); background: transparent;
  border: 0; padding: 8px 4px 8px 10px; cursor: pointer; text-align: left;
}
.recent-item__title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item__rename {
  flex: 1 1 auto; min-width: 0; font-family: inherit; font-size: 16px; color: var(--ink);
  background: rgba(248, 244, 236, 0.55);   /* как у поля «Поиск по чатам» (.chat-sidebar__filter) */
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--olive); border-radius: 6px;
  padding: 4px 8px; outline: none;
}
.recent-item__edit, .recent-item__del {
  flex: 0 0 auto; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent;
  color: var(--carob); cursor: pointer; opacity: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
}
.recent-item__edit svg { width: 14px; height: 14px; }
.recent-item__del { font-size: 16px; line-height: 1; }
.recent-item:hover .recent-item__edit, .recent-item:hover .recent-item__del { opacity: 0.65; }
.recent-item__edit:hover { opacity: 1; background: rgba(111, 128, 81, 0.18); color: var(--olive); }
.recent-item__del:hover { opacity: 1; background: rgba(178, 59, 42, 0.15); color: #b23b2a; }

/* ---------- Модалка подтверждения удаления ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31, 42, 29, 0.42); z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: modalFade 0.15s ease both;
}
.modal {
  background: #F6F1E8; border: 1.5px solid rgba(111, 128, 81, 0.45);
  border-radius: 18px; padding: 22px 24px; max-width: 420px; width: 100%;
  box-shadow: 0 28px 60px rgba(60, 50, 30, 0.32);
  animation: modalPop 0.18s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.modal__title { margin: 0 0 8px; font-size: 18px; font-weight: 700; color: var(--ink); }
.modal__chat-title { margin: 0 0 20px; font-size: 15px; color: var(--carob); word-break: break-word; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal__btn {
  font-family: inherit; font-size: 14.5px; font-weight: 600;
  border-radius: 10px; padding: 9px 18px; cursor: pointer; border: 1px solid transparent;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.modal__btn--ghost { background: transparent; color: var(--carob); border-color: rgba(111, 128, 81, 0.35); }
.modal__btn--ghost:hover { background: rgba(111, 128, 81, 0.12); border-color: var(--olive); color: var(--olive); }
.modal__btn--danger { background: #c0492f; color: #fff; border-color: #c0492f; }
.modal__btn--danger:hover { background: #a73a23; border-color: #a73a23; }
.modal__btn--primary { background: var(--olive); color: #fff; border-color: var(--olive); }
.modal__btn--primary:hover { background: var(--olive-deep); border-color: var(--olive-deep); }
.modal__btn--primary:disabled { opacity: 0.6; cursor: default; }
.topup__sub { color: rgba(31, 42, 29, 0.6); font-size: 14px; margin: 2px 0 12px; }
.topup__row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; border: 1.5px solid rgba(111, 128, 81, 0.4); border-radius: 12px; padding: 10px 14px; background: rgba(248, 244, 236, 0.6); }
.topup__row:focus-within { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(112, 129, 83, 0.15); }
.topup__input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 18px; font-weight: 600; color: var(--carob); font-family: inherit; }
.topup__input::-webkit-outer-spin-button, .topup__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.topup__cur { color: rgba(31, 42, 29, 0.5); font-size: 16px; }
.topup__err { color: #c0492f; font-size: 13px; margin-top: 8px; }
.topup__promo { margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(111, 128, 81, 0.18); }
.topup__promo-lbl { font-size: 13px; color: var(--carob); opacity: 0.85; margin-bottom: 8px; }
.topup__promo-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.topup__promo-input { flex: 1 1 auto; min-width: 0; border: 1.5px solid rgba(111, 128, 81, 0.4); border-radius: 12px; padding: 10px 14px; background: rgba(248, 244, 236, 0.6); font-size: 16px; font-weight: 600; color: var(--carob); font-family: inherit; text-transform: uppercase; letter-spacing: 0.4px; outline: 0; }
.topup__promo-input::placeholder { text-transform: none; font-weight: 500; letter-spacing: 0; color: rgba(114, 92, 58, 0.5); }
.topup__promo-input:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(112, 129, 83, 0.15); }
.topup__promo-go { flex: 0 0 auto; white-space: nowrap; padding-left: 16px; padding-right: 16px; }
.topup__promo-toggle { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; margin: 0; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--carob); opacity: 0.85; cursor: pointer; }
.topup__promo-toggle:hover { opacity: 1; color: var(--olive); }
.topup__promo-toggle:hover span { text-decoration: underline; }
.topup__promo-body { margin-top: 10px; }
.topup__promo-body[hidden] { display: none; }

/* ---------- Вход / регистрация ---------- */
.auth__form { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 4px; }
.auth__field { display: block; }
.auth__label { display: block; font-size: 12.5px; font-weight: 600; color: rgba(31, 42, 29, 0.66); margin-bottom: 5px; }
.auth__box { display: flex; align-items: center; gap: 6px; border: 1.5px solid rgba(111, 128, 81, 0.4); border-radius: 12px; padding: 9px 12px; background: rgba(248, 244, 236, 0.6); }
.auth__box:focus-within { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(112, 129, 83, 0.15); }
.auth__input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15.5px; font-weight: 500; color: var(--carob); font-family: inherit; }
.auth__input::placeholder { color: rgba(31, 42, 29, 0.38); font-weight: 400; }
.auth__eye { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; cursor: pointer; padding: 2px; color: rgba(31, 42, 29, 0.45); transition: color 150ms ease; }
.auth__eye:hover { color: var(--olive); }
.auth__eye svg { display: block; }
/* Поле, к которому относится ошибка: красная рамка + фокус на нём. Без этого сообщение
   («Логин: от 3 до 32 символов…») показывалось общей плашкой внизу, под полями пароля,
   и выглядело как ошибка пароля. */
.auth__box--bad { border-color: #c0492f; background: rgba(192, 73, 47, 0.06); }
.auth__box--bad:focus-within { border-color: #c0492f; box-shadow: 0 0 0 3px rgba(192, 73, 47, 0.15); }
/* снизу отступ больше верхнего: длинная подсказка про формат логина иначе прилипает к кнопкам */
.auth__err { color: #c0492f; font-size: 13px; line-height: 1.4; margin: 10px 0 16px; }
.auth__switch { text-align: center; font-size: 13px; color: rgba(31, 42, 29, 0.6); margin-top: 14px; }
.auth__link { border: 0; background: transparent; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; color: var(--olive); padding: 0; }
.auth__link:hover { color: var(--olive-deep); text-decoration: underline; }
.account-menu__sep { height: 1px; background: rgba(111, 128, 81, 0.2); margin: 6px 8px; }
.topup__packs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.topup__pack {
  flex: 1 1 auto; min-width: 62px; padding: 9px 10px; cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 600; color: var(--carob);
  background: rgba(248, 244, 236, 0.6);
  border: 1.5px solid rgba(111, 128, 81, 0.3); border-radius: 10px;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}
.topup__pack:hover { border-color: var(--olive); color: var(--olive); }
.topup__pack.is-active { border-color: var(--olive); background: var(--olive); color: #fff; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- Тост «Чат удалён» с круговым таймером отмены ---------- */
.undo-toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 18px);
  background: var(--ink); color: #fff; border-radius: 14px;
  padding: 8px 8px 8px 18px; display: inline-flex; align-items: center; gap: 14px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28); z-index: 1200;
  opacity: 0; transition: opacity 220ms ease, transform 220ms ease; max-width: 90vw;
}
.undo-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.undo-toast__text { font-size: 14px; line-height: 1.4; }
.undo-toast__btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; color: #fff;
  background: rgba(255, 255, 255, 0.10); border: 0; border-radius: 10px;
  padding: 8px 14px 8px 10px; cursor: pointer;
  transition: background-color 150ms ease;
}
.undo-toast__btn:hover { background: rgba(255, 255, 255, 0.18); }
.undo-ring { width: 22px; height: 22px; transform: rotate(-90deg); flex: 0 0 auto; }
.undo-ring__bg { fill: none; stroke: rgba(255, 255, 255, 0.22); stroke-width: 3; }
.undo-ring__fg {
  fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 100.53;          /* 2π·r при r=16 */
  stroke-dashoffset: 0;
  animation: undoRing 5s linear forwards;
}
@keyframes undoRing { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 100.53; } }
@media (prefers-reduced-motion: reduce) { .undo-ring__fg { animation: none; } }

/* ---------- Аккаунт-чип в правом верхнем углу ---------- */
.account-chip {
  position: fixed; top: 16px; right: 16px; z-index: 90;
  display: inline-flex; align-items: center; gap: 10px;
  transition: filter 0.22s ease;
}
.account-chip__user {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit; background: transparent; border: 0; padding: 4px 6px 4px 4px;
  border-radius: 999px; cursor: pointer; color: var(--ink);
  transition: background-color 150ms ease;
}
/* Наведение подсвечивает ВСЮ плашку .account-chip (правило с :hover ниже), а не только __user */
.account-chip--guest .account-chip__user { display: none; }   /* гость: в плашке только «Войти» — без аватара «ГС» и имени «Гость» */
.account-chip__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #5dbf95, #2fa777);
  background-repeat: no-repeat; background-size: cover; background-position: center;
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px; overflow: hidden;
}

/* Выпадающее меню аккаунта (вход через Яндекс / выход) */
.account-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 200;
  min-width: 210px; padding: 6px;
  background: #fdf9f1; border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 14px; box-shadow: 0 14px 34px rgba(31, 42, 29, 0.16);
  animation: acctMenuIn 140ms ease;
}
.account-menu[hidden] { display: none; }
@keyframes acctMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.account-menu__email {
  font-size: 12px; color: rgba(31, 42, 29, 0.55);
  padding: 6px 10px 8px; word-break: break-all;
  border-bottom: 1px solid rgba(111, 128, 81, 0.15); margin-bottom: 4px;
}
/* iOS Data Detectors авто-оборачивает e-mail в mailto-ссылку (синяя, ПОДЧЁРКНУТА) → сбрасываем */
.account-menu__email a, a[x-apple-data-detectors] {
  color: inherit !important; text-decoration: none !important; -webkit-text-decoration: none !important; pointer-events: none;
}
.account-menu__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink);
  background: transparent; border: 0; border-radius: 9px;
  padding: 10px 12px; cursor: pointer; text-align: left;
  transition: background 130ms ease;
}
.account-menu__item:hover { background: rgba(111, 128, 81, 0.12); }
.account-menu__item--danger { color: #b23b2a; }
.account-menu__item--danger:hover { background: rgba(178, 59, 42, 0.1); }
.account-menu__yandex .ya-logo {
  width: 20px; height: 20px; flex: 0 0 20px; display: block;
}
.account-menu__yandex .ya-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%;
  background: #fc3f1d; color: #fff; font-weight: 800; font-size: 14px;
  font-family: Arial, sans-serif;
}
.account-menu__vk .vk-logo {
  width: 22px; height: 22px; flex: 0 0 22px; display: block; border-radius: 5px;
}
.account-menu__vk .vk-mark {   /* фолбэк, если фавикон VK не загрузился */
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px;
  background: #0077ff; color: #fff; font-weight: 800; font-size: 11px;
  letter-spacing: 0.2px; font-family: Arial, sans-serif;
}
.account-chip__info { display: inline-flex; flex-direction: column; line-height: 1.1; text-align: left; }
.account-chip__name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.account-chip__balance { font-size: 12px; font-weight: 600; color: var(--olive); margin-top: 1px; }
.account-chip__balance[hidden] { display: none; }
.account-chip__balance.balance--neg { color: #e5484d; font-weight: 700; }
.account-chip__balance.balance--low { color: #d9820b; font-weight: 700; }
/* Баланс теперь показан в самой плашке (кнопка вместо «Пополнить») → дубль в info прячем */
.account-chip__balance { display: none; }
/* Цвета баланса на плашке аккаунта: красный при минусе, жёлтый при низком */
.account-chip__upgrade.balance--neg { color: #e5484d; }
.account-chip__upgrade.balance--low { color: #d9820b; }

/* Акцент списания за запрос: кратко пульсируем плашку баланса + всплывает «−X ₽»,
   чтобы трата была видна сразу после ответа (а не только при F5/пополнении). */
.account-chip__upgrade.balance--spend { animation: balSpendPulse 0.75s ease; }
@keyframes balSpendPulse {
  0%   { transform: scale(1); }
  28%  { transform: scale(1.14); color: #e5484d; }
  100% { transform: scale(1); }
}
.balance-delta {
  position: absolute; top: calc(100% + 2px); right: 12px;
  font-size: 12.5px; font-weight: 700; color: #e5484d;
  pointer-events: none; white-space: nowrap; z-index: 210;
  animation: balDeltaFloat 1.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes balDeltaFloat {
  0%   { opacity: 0; transform: translateY(-6px); }
  18%  { opacity: 1; transform: translateY(0); }
  62%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-12px); }
}
@media (prefers-reduced-motion: reduce) {
  .account-chip__upgrade.balance--spend { animation: none; }
  .balance-delta { animation: balDeltaRM 1.5s linear forwards; }
  @keyframes balDeltaRM { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
}

/* Постоянная плашка над чатом: «средств не хватит / пополните». По умолчанию янтарная
   (мало средств), модификатор --neg делает красной (отрицательный баланс). */
.balance-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 10px auto 4px; max-width: 760px; width: calc(100% - 32px);
  padding: 10px 14px; border-radius: 14px;
  background: rgba(217, 130, 11, 0.12);
  border: 1px solid rgba(217, 130, 11, 0.35);
  color: #8a5a08; font-size: 14px; font-weight: 500;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  animation: bannerIn 0.22s ease;
}
.balance-banner[hidden] { display: none; }
/* На ГЛАВНОМ экране (лендинг, не режим чата) плашку баланса не показываем — только в чатах */
body:not(.chat-active) .balance-banner { display: none; }
.balance-banner__icon { flex: 0 0 auto; width: 20px; height: 20px; }
.balance-banner__text { flex: 1 1 auto; line-height: 1.35; }
.balance-banner__btn {
  flex: 0 0 auto; padding: 7px 16px; border-radius: 999px; border: none; cursor: pointer;
  background: #d9820b; color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600;
  transition: background 0.15s ease, transform 0.1s ease; white-space: nowrap;
}
.balance-banner__btn:hover { background: #bf7109; }
.balance-banner__btn:active { transform: translateY(1px); }
.balance-banner--neg {
  background: rgba(229, 72, 77, 0.12); border-color: rgba(229, 72, 77, 0.38); color: #b3282c;
}
.balance-banner--neg .balance-banner__btn { background: var(--olive); }         /* кнопка «Пополнить» оливковая, а не красная */
.balance-banner--neg .balance-banner__btn:hover { background: var(--olive-deep); }
@keyframes bannerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (max-width: 560px) {
  .balance-banner { flex-wrap: wrap; font-size: 13px; }
  .balance-banner__text { flex: 1 1 100%; order: 2; }
  .balance-banner__btn { order: 3; }
  .balance-banner__icon { order: 1; }
}
.msg__cost { font-size: 11px; color: rgba(31, 42, 29, 0.45); margin-top: 6px; user-select: none; }
.account-chip__plan { font-size: 11.5px; color: var(--carob); opacity: 0.75; }
.account-chip__upgrade {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; box-sizing: border-box; line-height: 1;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--carob);
  background: rgba(248, 244, 236, 0.7); border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 999px; padding: 0 18px; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
/* hover только для мыши (на тач «залипал» и красил ОТРИЦАТЕЛЬНЫЙ баланс оливой при открытии меню);
   и БЕЗ смены color — иначе перебивал красный/жёлтый цвет баланса. Только лёгкий фон. */
@media (hover: hover) { .account-chip__upgrade:hover { background: rgba(112, 129, 83, 0.12); } }

/* Кнопка перехода в «Чаты» в ЛЕВОМ верхнем углу лендинга.
   Отступ совпадает с большой буквой R на странице чатов (sidebar pad 10px + head 4px). */
.chats-nav-btn {
  position: fixed; top: 16px; left: 14px; z-index: 90;
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--carob);
  background: rgba(248, 244, 236, 0.75); border: 1.5px solid rgba(111, 128, 81, 0.4);
  border-radius: 999px; padding: 10px 16px 10px 13px; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.chats-nav-btn:hover { background: rgba(112, 129, 83, 0.12); border-color: var(--olive); color: var(--olive); }
.chats-nav-btn svg { width: 18px; height: 18px; }
.chat-active .chats-nav-btn { display: none; }   /* в режиме чата слева уже есть R и боковая панель */

/* в режиме чата чип может перекрываться панелями — поднимаем z-index выше попапов настроек */
.chat-active .account-chip { z-index: 105; }
@media (max-width: 760px) {
  .account-chip__info { display: none; }      /* на узких — только аватар + кнопка */
  .account-chip__upgrade { padding: 0 14px; font-size: 13px; }
}
.chat-recents__empty { padding: 10px; font-size: 13px; color: var(--carob); opacity: 0.6; }

/* ---------- Свёрнутая панель ---------- */
body.sidebar-collapsed .chat-active .chat-sidebar,
.chat-active.sidebar-collapsed .chat-sidebar { width: 0; flex-basis: 0; padding: 0; border: 0; overflow: hidden; }
.chat-active.sidebar-collapsed .chat-collapsed-bar { display: flex; }
/* Вынесен из .hero на уровень .page → позиционируется фиксированно (десктоп: верх-лево). */
.chat-collapsed-bar { position: fixed; top: 14px; left: 16px; z-index: 91; align-items: center; gap: 4px; }
/* Единая стеклянная панель сверху — только на мобиле (см. @media) */
.topbar-glass { display: none; }

/* ---------- Мобильный: панель как выезжающий оверлей ---------- */
@media (max-width: 760px) {
  .chat-active .chat-sidebar {
    position: fixed; left: 0; top: 0; z-index: 80; width: 100vw; max-width: 100vw;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
    padding-top: calc(12px + env(safe-area-inset-top));   /* под чёлку */
  }
  .chat-active.sidebar-collapsed .chat-sidebar { transform: translateX(-100%); width: 100vw; flex-basis: 100vw; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; border-right: 0; }
  .chat-active.sidebar-collapsed .chat-collapsed-bar { display: flex; }
  /* затемнение под открытой панелью */
  .chat-active:not(.sidebar-collapsed) .chat-main::before {
    content: ""; position: fixed; inset: 0; background: rgba(0,0,0,0.32); z-index: 70;
  }
  /* пока сайдбар ОТКРЫТ — чип «Пополнить» НЕ прячем, а приглушаем как остальной фон под затемнением
     (brightness ≈ 1 − 0.32 overlay) и делаем некликабельным: тап по нему закрывает панель, как по фону */
  /* Сайдбар теперь на ВСЮ ширину → чип не «дымим», а прячем (иначе торчал бы поверх панели) */
  .chat-active:not(.sidebar-collapsed) .account-chip { display: none; }
  /* КЛАВИАТУРА (iOS): interactive-widget iOS Safari ИГНОРИРУЕТ → Safari скроллит видимую область
     при клавиатуре. Поэтому чат-область СЛЕДУЕТ за визуальным вьюпортом: top=его смещение (--vvtop),
     высота=его высота (--vvh), их пишет rAF-цикл (script.js) КАЖДЫЙ КАДР пока движется клавиатура →
     гладко, без рывков. Верх (в потоке вверху) и композер (внизу) остаются в видимой области. */
  /* ⚠️ БЕЗ will-change/transform/filter на .hero — это ПРЕДОК поля ввода, и любой из них даёт
     на iOS отдельный композитный слой → каретка «|» рисуется выше поля. Следуем только через top/height. */
  .chat-active .hero { position: fixed; top: var(--vvtop, 0px); left: 0; right: 0; height: var(--vvh, 100svh); }
  .chat-active .chat-main { height: 100%; }
}

/* Тост-уведомление (ошибки/статус) */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff; font-size: 14px; padding: 11px 18px; border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22); z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease; max-width: min(440px, 90vw);
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .chat-active .chat, .chat-topbar { max-width: 100%; }
  .chat-topbar__logo { font-size: 26px; }
  .msg__bubble { font-size: 15px; }
}

/* ══ Верхние контролы-плашки — на ВСЕХ ширинах (десктоп КАК мобила): равновысокие стеклянные плашки ══
   Аккаунт (аватар+баланс), «Чаты» (лендинг), ⊟+ (чат). safe-area/vvtop=0 на десктопе → top:12px.
   Follow за клавой через top (НЕ transform/will-change — ломают backdrop-filter стекла). */
/* Имя видно на ДЕСКТОПЕ (чип = аватар+имя+баланс); на мобиле скрыто (правило в @media ≤760) */
.account-chip,
.chats-nav-btn,
.chat-collapsed-bar {
  top: calc(12px + env(safe-area-inset-top) + var(--vvtop, 0px));
  height: 48px; align-items: center; box-sizing: border-box; z-index: 105;
  background: rgba(248, 244, 236, 0.42);
  -webkit-backdrop-filter: blur(9px) saturate(1.12); backdrop-filter: blur(9px) saturate(1.12);
  border: 1.5px solid rgba(111, 128, 81, 0.34);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(114, 92, 58, 0.08);
  transition: background-color 150ms ease;
}
.account-chip   { right: calc(10px + env(safe-area-inset-right)); padding: 0 6px; gap: 2px; }
.chats-nav-btn  { left: calc(10px + env(safe-area-inset-left)); padding: 0 18px 0 14px; }
.chat-collapsed-bar { left: calc(10px + env(safe-area-inset-left)); padding: 0 8px; gap: 2px; }
/* Подсветка всей плашки только при нажатии на сам чип (аватар/баланс — прямые дети), НЕ на пункты меню */
.account-chip:has(> .account-chip__user:active),
.account-chip:has(> .account-chip__upgrade:active) { background: rgba(112, 129, 83, 0.20); }
/* Наведение мышью подсвечивает ВСЮ плашку целиком (поля и зазор между кнопками тоже),
   как при клике. Кроме случая, когда курсор над открытым меню аккаунта (оно — потомок плашки).
   Только для мыши (hover: hover), чтобы на тач-экранах не «залипало». */
@media (hover: hover) {
  .account-chip:hover:not(:has(.account-menu:hover)) { background: rgba(112, 129, 83, 0.12); }
}
.chats-nav-btn:active { background: rgba(112, 129, 83, 0.20); }
/* «Пополнить»/баланс БЕЗ обводки и своего фона — выделяется вся плашка целиком */
.account-chip__upgrade {
  height: 38px; background: transparent; border: 0; box-shadow: none; padding: 0 12px; border-radius: 999px;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
@media (hover: hover) { .account-chip__upgrade:hover { background: transparent; } }
/* ⊟/+ → круглое выделение, гармонично с закруглениями плашки */
.chat-collapsed-bar .icon-btn { border-radius: 50%; }
.chat-collapsed-bar .icon-btn:active { background: rgba(112, 129, 83, 0.20); }

/* ============================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (телефоны). Слой в КОНЦЕ файла → по каскаду
   переопределяет ранние правила. Дух сохраняем: оливка, стекло, glow,
   reveal. Тач-паттерны — через (hover:none),(pointer:coarse), а не
   только по ширине (тач-ноутбук / крупный телефон).
   ============================================================ */

/* ---- Тач-устройства: то, что было спрятано под :hover ---- */
@media (hover: none), (pointer: coarse) {
  /* Действия по чату (переименовать/удалить) всегда видимы — на тач нет hover — и КРУПНЕЕ */
  .recent-item__edit, .recent-item__del { opacity: 0.6; width: 40px; height: 40px; border-radius: 10px; }
  .recent-item__edit svg { width: 19px; height: 19px; }
  .recent-item__del { font-size: 22px; }
  .recent-item__edit:active { opacity: 1; background: rgba(111,128,81,0.18); color: var(--olive); }
  .recent-item__del:active { opacity: 1; background: rgba(178,59,42,0.15); color: #b23b2a; }
  /* Крупнее тап-цели (мин. ~42px) */
  .search__icon, .send { width: 42px; height: 42px; }
  .cite { padding: 1px 4px; }
  .msg-copy { min-height: 36px; }
}

/* ---- Общая мобильная раскладка (телефоны) ---- */
@media (max-width: 640px) {
  /* Верхние плашки (чип/Чаты/⊟+) вынесены в ОБЩИЙ CSS (десктоп как мобила) — см. выше. */
  /* Контент чата не под плавающими плашками (мобиле-only: на десктопе чат центрирован, не задет) */
  .chat-active .chat { padding-top: calc(env(safe-area-inset-top) + 64px); }

  /* Лендинг: заголовок в верхней ЧЕТВЕРТИ (посередине между полем и верхом),
     поле ввода — по ЦЕНТРУ экрана. В чате перебивается `.chat-active ...`. */
  .hero { justify-content: flex-start; padding-top: 0; }
  .logo { font-size: clamp(70px, 22.5vw, 90px); letter-spacing: 5px; text-indent: 5px; margin-top: 21vh; }
  .tagline { white-space: normal; padding: 0 16px; }   /* размер подзаголовка НЕ трогаем */
  .search { margin-top: 16vh; margin-bottom: 0; }

  /* ФОН БЕЗ ГРАДИЕНТА. Радиальная подсветка body центрирована на 38% высоты и считается от
     ПОЛНОГО вьюпорта, а .hero в чате — fixed по ВИЗУАЛЬНОМУ (top:--vvtop, height:--vvh).
     При открытой клавиатуре это два разных участка градиента → видимый шов между лентой,
     композером и полосой над клавиатурой. Плоский тон = шва нет ни при какой клавиатуре. */
  body { background: var(--bg); }

  /* iOS-баг каретки: backdrop-filter (даже на ::before в isolated-контексте) рисует мигающий
     курсор «|» ВЫШЕ поля. На мобиле убираем стекло у композера → плотный фон. Визуально почти
     то же (композер и так над контентом), а каретка встаёт ровно в поле. */
  .search::before { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(248, 244, 236, 0.94); }

  /* Один тон на все слои (мобила): hero фиксирован по ВИЗУАЛЬНОМУ вьюпорту, а .page/body — по
     полному, поэтому незакрашенный слой давал стык на границе. <html> — область ЗА body
     (overscroll, полоса под клавиатурой). */
  /* ГАРАНТИЯ РОВНОГО ФОНА. hero закрывает только ВИЗУАЛЬНЫЙ вьюпорт (height: --vvh), поэтому зону
     за клавиатурой красят слои под ним — и промах любого из них виден полосой. Кладём ОДИН
     фиксированный слой на весь экран под контентом: показать ниже него уже нечего.
     position:fixed на iOS считается от ЛАЙАУТ-вьюпорта, он с клавиатурой не сжимается → накрывает
     и зону под ней. Если после этого полоса осталась — красит не страница, а системная панель iOS. */
  .chat-active::before {
    content: ""; position: fixed; inset: 0; z-index: -1;
    background: var(--bg); pointer-events: none;
  }

  html,
  .page,
  .chat-active .hero,
  .chat-active .chat-main { background: var(--bg); }

  /* Композер как в ChatGPT: поле ввода СВЕРХУ во всю ширину (≈в 2 раза выше), кнопки СНИЗУ отдельным рядом.
     flex-wrap + order: textarea (order -1, flex 100%) занимает верхний ряд один, attach(слева) и правые
     кнопки(gear/mic/send) уходят на нижний ряд (justify-content:space-between разводит их по краям). */
  .search__bar { gap: 6px; flex-wrap: wrap; align-items: center; row-gap: 10px; }
  .search__bar-right { gap: 4px; order: 2; }
  #attachBtn { order: 1; }
  .search textarea[name="q"] {
    font-size: 16px; order: -1; flex: 1 1 100%; align-self: stretch;
    min-height: 40px;   /* одна строка по умолчанию (композер = 2 уровня: поле + ряд кнопок); растёт по мере ввода */
  }
  /* Кнопка настроек = оливковая шестерёнка (текст модели скрыт, влезает лучше).
     Иконка на ::before (маской) — JS перезаписывает innerHTML кнопки, псевдоэлемент цел. */
  .search__model {
    font-size: 0; gap: 0; padding: 0; flex: none;
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 50%; justify-content: center; color: var(--olive);
  }
  .search__model .search__caret { display: none; }
  .search__model::before {
    content: ""; flex: none; width: 22px; height: 22px;
    background-color: var(--olive);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  .search__model:hover::before, .search__model:active::before { background-color: var(--olive-deep); }
  /* Композер ВЫШЕ нижнего края (не впритык) + над safe-area */
  .chat-active .search { margin-bottom: calc(16px + env(safe-area-inset-bottom)); }
  /* Скролл только внутри ленты, без цепного мотания страницы (верх поля не ускользает) */
  .chat-active .chat { overscroll-behavior: contain; }
  .chat-active .chat-main { overscroll-behavior: none; }

  /* Подвал ответа: разрешаем перенос, не режем «Скачать» */
  .msg-foot { flex-wrap: wrap; }
  .msg-foot .msg-actions { margin-left: auto; }
  /* Меню скачивания: не уезжает за правый край */
  .msg-dl__menu { right: 0; max-width: calc(100vw - 24px); }

  /* Модалки: меньше воздуха по краям + safe-area снизу */
  .modal-overlay { padding: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* Лендинг: статистика в одну колонку, числа не переполняют */
  .wrap.stats { grid-template-columns: 1fr; }
  .stat__num { white-space: normal; font-size: clamp(26px, 9vw, 40px); }

  /* Футер: сетка 2×2 — [RIVER | Контакты] / [Документы | Реквизиты] */
  .footer__inner { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; align-items: start; }
  .footer__inner > :nth-child(1) { order: 1; }   /* RIVER-бренд */
  .footer__inner > :nth-child(3) { order: 2; margin-top: 8px; }   /* Контакты — справа от бренда, верх на уровне RIVER */
  .footer__inner > :nth-child(2) { order: 3; }   /* Документы */
  .footer__inner > :nth-child(4) { order: 4; }   /* Реквизиты — справа от документов */
  .footer__logo { font-size: 44px; }   /* на мобиле RIVER как был (крупнее только на десктопе) */
  .footer__tagline { font-size: 12px; }
  .footer__list a { font-size: 13px; }
  .footer__req { font-size: 11.5px; line-height: 1.5; }
}

/* ---- Очень узкие (мелкие телефоны) ---- */
@media (max-width: 380px) {
  .chats-nav-btn span { display: none; }               /* только иконка «Чаты» */
  .chats-nav-btn { padding: 8px; }
}

/* ---- Настройки как нижняя шторка (bottom-sheet) на мобиле ----
   Класс вешает positionSettings() при (max-width:640px). */
.settings-pop.settings-pop--sheet {
  left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important;
  width: 100% !important; max-width: 100%;
  max-height: 85svh;
  flex-direction: column; gap: 4px;
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  animation: sheetUp 0.24s ease backwards;
}
.settings-pop.settings-pop--sheet::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 3px;
  background: rgba(111,128,81,0.4); margin: 2px auto 10px;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* ---- Бережём батарею/плавность: тяжёлые блобы мягче на мобиле ---- */
@media (max-width: 640px) {
  .bg__blob { filter: blur(42px); animation-duration: 60s !important; }
}

/* ═══ План 20: интерактивные анкеты (уточнение/реквизиты) под ответом ИИ ═══ */
.doc-form {
  margin-top: 12px; max-width: 640px;
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 14px;
  background: rgba(253, 249, 241, 0.75); padding: 14px 16px;
  animation: msgIn 0.3s ease backwards;
}
.doc-form__title { font-size: 15px; font-weight: 700; color: var(--ink); }
.doc-form__intro { font-size: 13px; color: rgba(31, 42, 29, 0.68); margin-top: -6px; }
/* Подсказка «есть сохранённые данные» — это ПРЕДЛОЖЕНИЕ, а не автозаполнение:
   поля подставляются только по клику пользователя. */
.doc-form__suggest {
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(111, 128, 81, 0.09); border-radius: 11px; padding: 10px 12px;
}
.doc-form__suggest-title { font-size: 12.5px; color: rgba(31, 42, 29, 0.7); }
/* группа: организация + вложенные под ней работники */
.doc-form__suggest-org { display: flex; flex-direction: column; gap: 6px; }
.doc-form__suggest-btn {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px;
  align-self: flex-start; font: inherit; cursor: pointer; text-align: left;
  background: #fff; border: 1px solid rgba(111, 128, 81, 0.35); border-radius: 10px;
  padding: 7px 12px; transition: border-color 130ms ease, background 130ms ease;
}
.doc-form__suggest-btn:hover { background: rgba(111, 128, 81, 0.08); border-color: var(--olive); }
.doc-form__suggest-btn.is-used { border-color: var(--olive); background: rgba(111, 128, 81, 0.16); }
.doc-form__suggest-kind {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px;
  color: rgba(31, 42, 29, 0.5);
}
.doc-form__suggest-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
/* под-подсказка: работники этой организации (визуально «веткой» от неё) */
.doc-form__suggest-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-left: 14px; padding-left: 12px;
  border-left: 2px solid rgba(111, 128, 81, 0.28);
}
.doc-form__suggest-sub--free { margin-left: 0; padding-left: 0; border-left: 0; }
.doc-form__suggest-sublabel { font-size: 11.5px; color: rgba(31, 42, 29, 0.5); }
.doc-form__suggest-chip {
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
  background: #fff; border: 1px dashed rgba(111, 128, 81, 0.45); border-radius: 999px;
  padding: 4px 11px; transition: border-color 130ms ease, background 130ms ease;
}
.doc-form__suggest-chip:hover { background: rgba(111, 128, 81, 0.08); border-color: var(--olive); }
.doc-form__suggest-chip.is-used {
  border-style: solid; border-color: var(--olive); background: rgba(111, 128, 81, 0.16);
}
.doc-form__field { display: flex; flex-direction: column; gap: 6px; }
.doc-form__label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.doc-form__hint { font-size: 12px; color: rgba(31, 42, 29, 0.55); }
/* поле предзаполнено заверёнными данными пользователя (план 26, п.2) */
.doc-form__from-saved {
  font-size: 11px; color: var(--olive); margin-top: 3px; display: flex; align-items: center; gap: 4px;
}
.doc-form__from-saved::before {
  content: ""; width: 12px; height: 12px; flex: none;
  background-color: var(--olive);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* GHOST-подсказка (захваченное из карточки, план 26 1.1): значение призраком в пустом поле */
.doc-form__ghost-wrap { position: relative; }
.doc-form__ghost-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; pointer-events: none;   /* клики идут в поле; кликабельна только кнопка */
}
.doc-form__ghost-val {
  color: rgba(31, 42, 29, 0.34); font-size: 14px; font-style: italic;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
/* значок «распознано с изображения» — минималистичная метка ненадёжного источника */
.doc-form__ghost-warn, .mydata__warn {
  flex: none; font-size: 11px; line-height: 1; color: #b8860b; cursor: help;
  opacity: 0.75; transition: opacity 130ms ease;
}
.doc-form__ghost-warn:hover, .mydata__warn:hover { opacity: 1; }
.mydata__warn { margin-left: 5px; }
.doc-form__ghost-accept {
  margin-left: auto; flex: none; pointer-events: auto; cursor: pointer; font: inherit;
  font-size: 11px; color: var(--olive); background: rgba(111, 128, 81, 0.14);
  border: 1px solid rgba(111, 128, 81, 0.4); border-radius: 999px; padding: 2px 10px;
  transition: background 130ms ease;
}
.doc-form__ghost-accept:hover { background: rgba(111, 128, 81, 0.24); }
.doc-form__input {
  font: inherit; font-size: 14px; color: var(--ink); width: 100%; box-sizing: border-box;
  background: rgba(248, 244, 236, 0.55);   /* как у поля «Поиск по чатам» */
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 10px; padding: 9px 12px; transition: border-color 130ms ease;
}
.doc-form__input:focus { outline: none; border-color: var(--olive); }
textarea.doc-form__input { resize: vertical; min-height: 64px; }
.doc-form__err { font-size: 12px; font-weight: 600; color: #e5484d; }

/* карточки-выбор: подпись + описание слева, номер справа */
.doc-form__choices { display: flex; flex-direction: column; gap: 8px; }
.doc-choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; cursor: pointer;
  background: #fff; border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 12px;
  padding: 12px 14px; transition: border-color 130ms ease, background 130ms ease;
}
.doc-choice:hover { background: rgba(111, 128, 81, 0.06); }
.doc-choice.is-sel { border-color: var(--olive); background: rgba(111, 128, 81, 0.13); }
.doc-choice__body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.doc-choice__label { font-size: 14px; font-weight: 600; color: var(--ink); }
.doc-choice__desc { font-size: 12.5px; color: rgba(31, 42, 29, 0.6); }
.doc-choice__num {
  flex: 0 0 auto; min-width: 18px; text-align: right;
  font-size: 13px; font-weight: 700; color: rgba(31, 42, 29, 0.35);
}
.doc-choice--other { cursor: default; flex-direction: column; align-items: stretch; gap: 8px; }
.doc-choice--other .doc-choice__label { cursor: default; }
.doc-choice__other {
  font: inherit; font-size: 14px; color: var(--ink); width: 100%; box-sizing: border-box;
  background: rgba(248, 244, 236, 0.55);   /* как у поля «Поиск по чатам» */
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(111, 128, 81, 0.35);
  border-radius: 9px; padding: 8px 11px;
}
.doc-choice__other:focus { outline: none; border-color: var(--olive); }

.doc-form__gap-note {
  font-size: 12px;
  color: rgba(31, 42, 29, 0.58);
  margin: 4px 0 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(122, 132, 96, 0.09);
  border: 1px solid rgba(122, 132, 96, 0.16);
}
.doc-form__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
/* «Пока не знаю» в поле выбора: тихая пунктирная карточка. Значение подберёт ИИ по найденным
   документам. Активна — приглушает и блокирует остальные варианты ЭТОГО поля. */
.doc-choice--unknown { border-style: dashed; }
.doc-choice--unknown .doc-choice__label { font-weight: 500; color: rgba(31, 42, 29, 0.72); }
.doc-choice--unknown.is-sel { border-color: var(--olive); background: rgba(111, 128, 81, 0.13); }
.doc-choice--unknown.is-sel .doc-choice__label { color: var(--ink); }
.doc-form__choices.is-locked .doc-choice:not(.doc-choice--unknown) { opacity: 0.4; pointer-events: none; }
.doc-form__submit {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--olive); border: 0; border-radius: 10px;
  padding: 10px 20px; transition: background 130ms ease;
}
.doc-form__submit:hover { background: var(--olive-deep); }
.doc-form__submit:disabled { opacity: 0.55; cursor: default; }
.doc-form.is-submitting { opacity: 0.7; pointer-events: none; }

/* Свёрнутая плашка после «Продолжить» (переживает перезагрузку): клик раскрывает
   ТОЛЬКО выбранные пользователем ответы, без списка вариантов. */
.doc-form--collapsed { padding: 0; gap: 0; overflow: hidden; max-width: 440px; }
.doc-form__toggle {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  font: inherit; font-size: 13px; color: rgba(31, 42, 29, 0.8);
  background: transparent; border: 0; cursor: pointer; padding: 10px 14px;
  transition: background 130ms ease;
}
.doc-form__toggle:hover { background: rgba(111, 128, 81, 0.07); }
.doc-form__toggle-mark {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  background: var(--olive); color: #fff; font-size: 11px; font-weight: 700;
}
.doc-form__toggle-text { flex: 1 1 auto; font-weight: 600; }
.doc-form__toggle-caret {
  flex: 0 0 auto; font-size: 11px; color: rgba(31, 42, 29, 0.45);
  transition: transform 150ms ease;
}
.doc-form--collapsed.is-open .doc-form__toggle-caret { transform: rotate(180deg); }
.doc-form__answers {
  display: flex; flex-direction: column; gap: 7px;
  padding: 6px 14px 12px;
  border-top: 1px solid rgba(111, 128, 81, 0.18);
}
.doc-form__answers[hidden] { display: none; }
.doc-form__answer { display: flex; flex-direction: column; gap: 1px; }
.doc-form__answer-label { font-size: 11.5px; color: rgba(31, 42, 29, 0.55); }
.doc-form__answer-value { font-size: 13.5px; font-weight: 600; color: var(--ink); }
/* кнопка-карандаш «Изменить» на свёрнутой плашке */
.doc-form__collapsed-head { display: flex; align-items: center; }
.doc-form__collapsed-head .doc-form__toggle { flex: 1 1 auto; }
.doc-form__edit {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-right: 6px; cursor: pointer;
  background: transparent; border: 0; border-radius: 8px; color: rgba(31, 42, 29, 0.55);
  transition: background 130ms ease, color 130ms ease;
}
.doc-form__edit:hover { background: rgba(111, 128, 81, 0.12); color: var(--olive); }
/* предпросмотр подстановок (№4) */
.docs-out__preview-toggle {
  align-self: flex-start; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--olive); background: transparent; border: 0; cursor: pointer; padding: 2px;
}
.docs-out__preview {
  display: flex; flex-direction: column; gap: 5px;
  background: rgba(111, 128, 81, 0.06); border-radius: 9px; padding: 8px 11px; margin-top: -2px;
}
.docs-out__preview[hidden] { display: none; }
.docs-out__preview-row { display: flex; flex-direction: column; gap: 1px; }
.docs-out__preview-label { font-size: 11px; color: rgba(31, 42, 29, 0.5); }
.docs-out__preview-value { font-size: 13px; color: var(--ink); }

/* ═══ План 21: ИИ сам предлагает подготовить документы в конце ответа ═══ */
.doc-offer {
  margin-top: 12px; max-width: 640px;
  display: flex; flex-direction: column; gap: 10px;
  border: 1px dashed rgba(111, 128, 81, 0.45); border-radius: 14px;
  background: rgba(111, 128, 81, 0.06); padding: 13px 15px;
}
.doc-offer__text { font-size: 13.5px; color: var(--ink); }
.doc-offer__list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.doc-offer__item { font-size: 13px; color: rgba(31, 42, 29, 0.78); }
.doc-offer__btn {
  align-self: flex-start; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--olive); border: 0; border-radius: 10px; padding: 9px 18px;
  transition: background 130ms ease;
}
.doc-offer__btn:hover { background: var(--olive-deep); }
/* анкета, раскрытая внутри предложения, не дублирует рамку */
.doc-offer .doc-form { margin-top: 0; border: 0; background: transparent; padding: 0; max-width: none; }

/* ═══ План 32: документ, которого нет в базе — система составит его сама ═══ */
.doc-offer__sub {
  font-size: 12.5px; font-weight: 600; color: rgba(31, 42, 29, 0.62);
  margin-top: 4px; letter-spacing: 0.01em;
}
/* «составить» визуально отличается от «подготовить готовые»: это другое действие */
.doc-offer__btn--new {
  background: transparent; color: var(--olive-deep);
  border: 1px solid rgba(111, 128, 81, 0.55);
}
.doc-offer__btn--new:hover { background: rgba(111, 128, 81, 0.12); }
.doc-offer__btn:disabled { opacity: 0.6; cursor: default; }
.doc-offer__done { font-size: 13px; color: var(--olive-deep); font-weight: 600; }

.doc-edit { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.doc-edit__toggle {
  align-self: flex-start; font: inherit; font-size: 13px; cursor: pointer;
  background: none; border: 0; padding: 0; color: var(--olive-deep);
  text-decoration: underline; text-underline-offset: 3px;
}
.doc-edit__panel { display: flex; flex-direction: column; gap: 8px; }
.doc-edit__input {
  font: inherit; font-size: 13.5px; color: var(--ink); resize: vertical;
  border: 1px solid rgba(31, 42, 29, 0.18); border-radius: 10px; padding: 9px 11px;
  background: #fff; width: 100%; box-sizing: border-box;
}
.doc-edit__input:focus { outline: 0; border-color: var(--olive); }
.doc-edit__apply {
  align-self: flex-start; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--olive); border: 0; border-radius: 10px; padding: 8px 16px;
}
.doc-edit__apply:disabled { opacity: 0.6; cursor: default; }
.doc-edit__note { font-size: 12.5px; color: rgba(31, 42, 29, 0.72); }
.doc-edit__warn {
  font-size: 12.5px; color: #8a5a00; background: rgba(255, 176, 32, 0.12);
  border-left: 3px solid rgba(255, 176, 32, 0.75); border-radius: 6px; padding: 7px 10px;
}

/* ═══ План 21: готовые документы — кнопка на каждый + «скачать всё» (ZIP) ═══ */
.docs-out { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; max-width: 560px; }
.docs-out__btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; font-size: 14px; color: var(--ink); cursor: pointer;
  background: #fff; border: 1px solid rgba(111, 128, 81, 0.3); border-radius: 12px;
  padding: 11px 14px; transition: border-color 130ms ease, background 130ms ease;
}
.docs-out__btn:hover { background: rgba(111, 128, 81, 0.07); border-color: var(--olive); }
.docs-out__name { flex: 1 1 auto; font-weight: 600; }
.docs-out__act {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; color: var(--olive);
  border: 1px solid rgba(111, 128, 81, 0.35); border-radius: 8px; padding: 4px 10px;
}
.docs-out__btn--zip { background: rgba(111, 128, 81, 0.10); border-color: var(--olive); }
.docs-out__btn--zip:hover { background: rgba(111, 128, 81, 0.16); }
/* В документе остались незаполненные места — предупреждаем явно */
.docs-out__warn {
  font-size: 12.5px; color: #8a5200; line-height: 1.35;
  background: rgba(217, 130, 11, 0.12); border: 1px solid rgba(217, 130, 11, 0.32);
  border-radius: 9px; padding: 8px 11px; margin-top: -2px;
}

/* ─────────── Экран «Мои данные» (план 26, 3.1) ─────────── */
.mydata { max-width: 540px; width: 100%; }
.mydata__intro { font-size: 12.5px; color: rgba(31, 42, 29, 0.6); margin: 0 0 12px; line-height: 1.45; }
.mydata__list {
  max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: none; -ms-overflow-style: none;   /* без полосы прокрутки */
}
.mydata__list::-webkit-scrollbar { width: 0; height: 0; display: none; }
.mydata__group {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: rgba(31, 42, 29, 0.45); font-weight: 700; margin-top: 2px;
}
.mydata__empty { font-size: 13px; color: rgba(31, 42, 29, 0.55); padding: 18px 0; text-align: center; }
.mydata__card {
  border: 1px solid rgba(111, 128, 81, 0.28); border-radius: 12px; padding: 10px 12px;
  background: rgba(248, 244, 236, 0.4);
}
.mydata__card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.mydata__card-title { font-size: 14px; font-weight: 700; color: var(--ink); min-width: 0; }
.mydata__card-org { font-weight: 400; color: rgba(31, 42, 29, 0.5); font-size: 12.5px; }
.mydata__card-del {
  font: inherit; font-size: 11.5px; color: #b23b2a; background: transparent;
  border: 1px solid rgba(178, 59, 42, 0.35); border-radius: 999px; padding: 2px 10px;
  cursor: pointer; flex: none;
}
.mydata__card-del:hover { background: rgba(178, 59, 42, 0.1); }
.mydata__field { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
.mydata__flabel {
  flex: 0 0 40%; font-size: 12px; color: rgba(31, 42, 29, 0.65);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mydata__finput {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 13px; color: var(--ink);
  background: rgba(248, 244, 236, 0.55);   /* как у поля «Поиск по чатам» / полей анкеты */
  border: 1px solid rgba(111, 128, 81, 0.3); border-radius: 8px; padding: 5px 9px;
}
.mydata__finput:focus { outline: none; border-color: var(--olive); }
.mydata__saved { flex: none; color: var(--olive); font-weight: 700; transition: opacity 0.3s ease; }
.mydata__fdel {
  flex: none; font-size: 16px; line-height: 1; color: rgba(31, 42, 29, 0.4);
  background: transparent; border: 0; cursor: pointer; padding: 2px 4px;
}
.mydata__fdel:hover { color: #b23b2a; }


/* ═══ Страницы аккаунта и восстановления пароля (план 30) ═══ */
.pageview {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto;
  background: var(--bg);
  background-image: radial-gradient(1200px 900px at 50% 30%, rgba(246, 241, 232, 0.55), rgba(246, 241, 232, 0));
  padding: 28px 18px 56px;
}
body.pageview-open { overflow: hidden; }
.pv-wrap { max-width: 620px; margin: 0 auto; }
.pv-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.pv-back { color: var(--olive); text-decoration: none; font-size: 14px; font-weight: 600; }
.pv-back:hover { text-decoration: underline; }
.pv-logo { font-family: var(--font-logo); font-weight: 900; font-size: 30px; color: var(--olive); line-height: 1; }
.pv-title { font-size: 26px; font-weight: 700; color: var(--carob); margin: 0 0 18px; }
.pv-card {
  background: rgba(248, 244, 236, 0.72);
  border: 1.5px solid rgba(111, 128, 81, 0.28);
  border-radius: 18px; padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: 0 10px 26px rgba(114, 92, 58, 0.07);
}
.pv-card__title { font-size: 15px; font-weight: 700; color: var(--carob); margin: 0 0 12px; }
.pv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 7px 0; font-size: 14.5px; border-bottom: 1px solid rgba(111, 128, 81, 0.12); }
.pv-row:last-of-type { border-bottom: 0; }
.pv-row span { color: rgba(31, 42, 29, 0.6); }
.pv-row b { color: var(--carob); font-weight: 600; text-align: right; word-break: break-word; }
.pv-ok { color: #4b7a3a; }
.pv-warn { color: #a8761c; }
.pv-hint { font-size: 13px; line-height: 1.45; color: rgba(31, 42, 29, 0.62); margin: 10px 0 0; }
.pv-err { color: #c0492f; font-size: 13px; line-height: 1.4; margin: 10px 0 2px; }
.pv-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 14px; }
.pv-actions--spread { justify-content: space-between; }
.pv-actions .modal__btn { text-decoration: none; display: inline-flex; align-items: center; }
.modal__btn--danger { background: rgba(192, 73, 47, 0.1); border-color: rgba(192, 73, 47, 0.35); color: #a63c26; }
.modal__btn--danger:hover { background: rgba(192, 73, 47, 0.16); }
.pv-note {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 80; background: var(--carob); color: #f6f1e8;
  padding: 11px 18px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 12px 28px rgba(31, 42, 29, 0.22); transition: opacity 400ms ease;
}
.pv-note.is-out { opacity: 0; }
@media (max-width: 560px) {
  .pv-title { font-size: 22px; }
  .pv-actions { justify-content: stretch; }
  .pv-actions .modal__btn { flex: 1 1 auto; justify-content: center; }
}
