/* Stage 1 Home / Chats port. Values and component names come from
   chatsFrame-DECODED.html and zametki-chats.css. */
.chats-root.chats-stage1-active .phone-shell[data-unified-shell] { position:relative; margin:0; }
.chats-root.chats-stage1-active .phone-shell[data-unified-shell] > .unified-shell-flow { overflow:hidden; }
.chats-root.chats-stage1-active .phone-shell[data-unified-shell] > .unified-shell-flow > .unified-screen-title { display:none; }
.chats-root.chats-stage1-active .phone-shell[data-unified-shell] > .unified-hotbar { display:none; }
.chats-root.chats-stage1-active .phone-shell[data-unified-shell] .unified-screen {
  flex:1;
  min-height:0;
  overflow:hidden;
  padding:0;
}

.chats-final-stage {
  --ink:#23262B;
  --ink-soft:#66707B;
  --ink-faint:#98A1AB;
  --line:rgba(140,155,150,.18);
  --glass:rgba(255,255,255,.55);
  --accent:#3E9B5F;
  --accent-soft:rgba(62,155,95,.10);
  --accent-line:rgba(62,155,95,.35);
  --overdue:#E5484D;
  --overdue-soft:rgba(229,72,77,.09);
  --prio-high:#E5484D;
  --prio-mid:#E3873C;
  --divider-black:var(--ink);
  --divider-yellow:var(--prio-mid);
  --divider-green:var(--accent);
  --r-lg:20px;
  --r-md:14px;
  --bg:#F2F6F4;
  position:relative;
  display:flex;
  flex:1;
  min-height:0;
  height:100%;
  color:var(--ink);
  font-family:var(--font-text);
}
.chats-final-stage * { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
.chats-final-stage button,
.chats-final-stage textarea,
.chats-final-stage input { font:inherit; }
.chats-final-stage button { color:inherit; }
.chats-final-stage .content { flex:1; min-height:0; overflow-y:auto; padding:8px 16px var(--app-section-content-bottom); scrollbar-width:thin; }

/* This greeting lives inside .content — the actual scroll container — so it scrolls fully off,
   unlike the shared .unified-screen-title, which is hidden on this screen. */
.chats-final-stage .greeting-row { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin:6px 2px 14px; }
.chats-final-stage .greeting h1 { margin:0; font-family:var(--font-display); font-size:26.5px; font-weight:700; letter-spacing:-.02em; line-height:1.1; }
.chats-final-stage .greeting h1 span { color:var(--accent); text-transform:uppercase; }
.chats-final-stage .greeting .date { font-size:13px; font-weight:500; color:var(--ink-faint); margin-top:6px; text-transform:capitalize; }
.chats-final-stage .section-head { display:flex; align-items:center; justify-content:space-between; margin:20px 2px 6px; }
.chats-final-stage .section-head h2 { margin:0; font-size:12.5px; font-weight:600; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.06em; }
.chats-final-stage .section-head .right { display:flex; align-items:center; gap:12px; }
.chats-final-stage .pin-count { font-size:12px; color:var(--ink-faint); font-weight:500; }
.chats-final-stage .section-collapse { border:0; padding:0; background:transparent; font-size:11.5px; color:var(--ink-faint); cursor:pointer; }
/* Круглый «+» в заголовке секции экрана категории — одинаковый для «Чатов» и «Подкатегорий».
   Заменил две пунктирные плашки .create-chat-btn: они занимали половину экрана и разрывали
   список, из-за чего кнопка создания читалась как элемент списка, а не как действие секции. */
.chats-final-stage .cat-sec-head { margin:18px 2px 8px; }
.chats-final-stage .section-add { width:32px; height:32px; padding:0; border:1.5px solid var(--accent-line); border-radius:50%; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; transition:background .15s, color .15s, transform .1s; }
.chats-final-stage .section-add svg { width:18px; height:18px; }
.chats-final-stage .section-add:active { background:var(--accent); color:#fff; transform:scale(.94); }

/* Путь категории. Базовые правила лежат в app.css (общие с Заметками) и рисуют путь обычным
   текстом, хотя каждый его элемент — рабочая кнопка навигации. Здесь путь становится набором
   чипов с откликом на тап; текущий уровень намеренно приглушён. */
.chats-final-stage .chats-category-breadcrumb { padding:2px 0 12px; gap:2px; }
.chats-final-stage .chats-category-breadcrumb button { padding:5px 10px; border-radius:11px; background:var(--accent-soft); color:var(--accent); font-size:12.5px; font-weight:600; white-space:nowrap; }
.chats-final-stage .chats-category-breadcrumb button:active { background:var(--accent); color:#fff; }
.chats-final-stage .chats-category-breadcrumb [aria-current="page"] { background:transparent; color:var(--ink-soft); font-weight:700; }
.chats-final-stage .chats-category-breadcrumb [aria-current="page"]:active { background:rgba(140,155,150,.15); color:var(--ink-soft); }
.chats-final-stage .chats-category-breadcrumb > span { color:var(--ink-faint); display:flex; align-items:center; flex:none; }
.chats-final-stage .chats-category-breadcrumb > span svg { width:14px; height:14px; }
/* Кнопка настройки блока — значения один в один из .gear-btn вкладки «Заметки». */
.chats-final-stage .gear-btn { width:26px; height:26px; padding:0; border:none; border-radius:8px; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .gear-btn svg { width:16px; height:16px; }
.chats-final-stage .gear-btn:active { background:rgba(140,155,150,.15); color:var(--ink-soft); }
/* Ползунок настройки — значения из блока «Настройка недавних» вкладки «Заметки». */
.chats-final-stage .slider-row { padding:12px 4px; }
.chats-final-stage .slider-row .lbl { display:flex; justify-content:space-between; font-size:13.5px; margin-bottom:8px; }
.chats-final-stage .slider-row .lbl b { color:var(--accent); }
.chats-final-stage .slider-row input[type=range] { width:100%; -webkit-appearance:none; appearance:none; height:5px; border-radius:3px; background:rgba(140,155,150,.2); outline:none; }
.chats-final-stage .slider-row input[type=range]::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:20px; height:20px; border-radius:50%; background:#fff; border:2px solid var(--accent); box-shadow:0 2px 6px rgba(60,80,70,.2); cursor:pointer; }

/* Inline two-row QuickCaptureComposer. */
.chats-final-stage .qc { margin:0 0 14px; background:rgba(255,255,255,.42); backdrop-filter:blur(11px); -webkit-backdrop-filter:blur(11px); border:1px solid rgba(255,255,255,.55); border-radius:20px; padding:10px 14px 8px; box-shadow:0 1px 5px rgba(60,80,70,.045); }
/* min-height здесь обязателен: глобальное `textarea { min-height: 96px }` из app.css протекало
   в это поле и давало 96px пустоты при одной строке текста. Глобальное правило не трогаем —
   на него опираются другие legacy-экраны. max-height:110px сохраняем, длинный текст растит поле. */
.chats-final-stage .qc-field { width:100%; border:none; background:transparent; font-family:inherit; font-size:14.5px; color:var(--ink); resize:none; min-height:40px; max-height:110px; overflow-y:auto; outline:none; line-height:1.4; padding:2px 0 8px; }
.chats-final-stage .qc-field::placeholder { color:var(--ink-faint); }
.chats-final-stage .qc-actions { display:flex; align-items:center; gap:6px; padding-top:8px; border-top:1px solid var(--line); }
.chats-final-stage .qc-ico { width:34px; height:34px; padding:0; border-radius:10px; border:none; background:transparent; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:13px; font-weight:700; }
.chats-final-stage .qc-ico:active { background:rgba(140,155,150,.12); }
.chats-final-stage .qc-ico svg { width:19px; height:19px; }
.chats-final-stage .qc-dest { display:flex; align-items:center; gap:4px; border:none; background:var(--accent-soft); color:var(--accent); font-size:12.5px; font-weight:600; padding:7px 11px; border-radius:12px; cursor:pointer; max-width:150px; overflow:hidden; }
.chats-final-stage .qc-dest span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .qc-dest svg { width:12px; height:12px; flex:none; }
.chats-final-stage .qc-mic { margin-left:auto; width:38px; height:38px; padding:0; border-radius:50%; border:none; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .qc-mic svg { width:18px; height:18px; }

/* chatLine + themeHeaderRow primitives. */
.chats-final-stage .chat-line { display:flex; gap:13px; padding:9px 0; cursor:pointer; align-items:center; transition:opacity .12s; }
.chats-final-stage .chat-line:active { opacity:.55; }
.chats-final-stage .chat-line,
.chats-final-stage .rj-row,
.chats-final-stage .other-row,
.chats-final-stage .full-chat {
  -webkit-tap-highlight-color:transparent;
}
.chats-final-stage .chat-line:focus-visible,
.chats-final-stage .rj-row:focus-visible,
.chats-final-stage .other-row:focus-visible,
.chats-final-stage .full-chat:focus-visible { outline:2px solid var(--accent); outline-offset:3px; border-radius:12px; }
.chats-final-stage .cl-ava { width:56px; height:56px; border-radius:18px; flex:none; display:flex; align-items:center; justify-content:center; font-size:25px; color:#fff; border:1.5px solid rgba(255,255,255,.72); box-shadow:0 1px 6px rgba(60,80,70,.13); }
.chats-final-stage .cl-ava.big,
.chats-final-stage .rj-ava.big { width:60px; height:60px; border-radius:19px; font-size:26px; }
.chats-final-stage .cl-body { flex:1; min-width:0; }
.chats-final-stage .cl-top { display:flex; align-items:center; gap:7px; }
.chats-final-stage .cl-title { font-size:16px; font-weight:600; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .cl-title.bold { font-weight:700; }
.chats-final-stage .cl-time { font-size:12px; font-weight:500; color:var(--ink-faint); flex:none; }
.chats-final-stage .cl-unread { min-width:19px; height:19px; padding:0 6px; border-radius:10px; background:var(--accent); color:#fff; font-size:11.5px; font-weight:700; display:flex; align-items:center; justify-content:center; flex:none; }
.chats-final-stage .cl-last { font-size:14.5px; font-weight:400; line-height:1.4; color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.chats-final-stage .cl-path { font-size:12px; font-weight:500; color:var(--ink-faint); margin-top:3px; }
.chats-final-stage .draft-label { color:var(--accent); font-weight:600; }
.chats-final-stage .closed-tag { font-size:10.5px; color:var(--overdue); font-weight:700; background:var(--overdue-soft); padding:1px 6px; border-radius:8px; }
.chats-final-stage .pin-ico { width:13px; height:13px; color:var(--accent); flex:none; display:flex; }
.chats-final-stage .pin-ico svg { width:13px; height:13px; }
/* Kebab по системе Notes (.note-plate__menu): 44×44 зона нажатия, радиус 12, иконка 23px, тот же
   фон при нажатии. Отрицательные margin компенсируют рост с 30 до 44, чтобы высота строк не менялась. */
.chats-final-stage .row-dots { width:44px; height:44px; padding:0; border:none; background:transparent; color:var(--ink-faint); border-radius:12px; display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; margin:-11px -13px -11px 0; }
.chats-final-stage .row-dots:active { background:rgba(140,155,150,.15); }
.chats-final-stage .row-dots svg { width:23px; height:23px; }

/* Половина аватара нужна, чтобы центрировать kebab категории по «основной строке» без магических
   чисел: значение меняется вместе с брейкпоинтом ниже. */
.chats-final-stage { --ava-big:60px; }

/* Kebab строки чата — по вертикальному центру всей строки. Абсолютное позиционирование задаётся
   явно (right/top/transform), общий отрицательный margin при этом снимается. */
.chats-final-stage .chat-line,
.chats-final-stage .other-row,
.chats-final-stage .rj-row { position:relative; }
.chats-final-stage .chat-line .row-dots,
.chats-final-stage .other-row .row-dots,
.chats-final-stage .rj-row .row-dots { position:absolute; right:0; top:50%; transform:translateY(-50%); margin:0; }
/* Колонка под кнопку: длинное название упирается в неё и не сдвигает кнопку.
   В «Прочем» колонку резервирует margin-right у шеврона, поэтому там отступ не нужен — иначе место
   под кнопку вычиталось бы дважды и текст сжимался зря. */
.chats-final-stage .chat-line .cl-body,
.chats-final-stage .rj-row .rj-body { padding-right:46px; }

/* Kebab категории — по вертикальному центру аватара, а не строки целиком: строка темы выше из-за
   пилюль подтем, и центр строки уходил бы под них. */
.chats-final-stage .theme-row .row-dots { top:calc(9px + var(--ava-big) / 2); transform:translateY(-50%); }

.chats-final-stage .pinned-wrap { background:linear-gradient(180deg,rgba(62,155,95,.06),rgba(62,155,95,.03)); border:1px solid rgba(62,155,95,.14); border-radius:20px; padding:4px 14px 8px; margin-bottom:4px; }
.chats-final-stage .pinned-wrap .chat-line { padding:10px 0; }
.chats-final-stage .pin-pager { display:flex; align-items:center; justify-content:center; gap:14px; margin:2px 0 8px; }
/* Видимый кружок остаётся 30px, зона нажатия доводится до 44 через прозрачную рамку: при 30×30
   промах пальцем читался как «кнопка не сработала», а повторный тап срабатывал. Логика пагинации
   при этом детерминирована и не менялась. */
.chats-final-stage .pin-arrow { width:30px; height:30px; padding:0; border-radius:50%; border:1px solid var(--line); background:var(--glass); background-clip:padding-box; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:15px; position:relative; }
.chats-final-stage .pin-arrow::after { content:''; position:absolute; top:50%; left:50%; width:44px; height:44px; transform:translate(-50%,-50%); }
.chats-final-stage .pin-arrow:active { background:var(--accent-soft); color:var(--accent); }
.chats-final-stage .pin-dots { display:flex; gap:6px; align-items:center; }
.chats-final-stage .pin-dot { width:6px; height:6px; border-radius:50%; background:rgba(140,155,150,.35); transition:all .2s; }
.chats-final-stage .pin-dot.on { width:16px; border-radius:3px; background:var(--accent); }

.chats-final-stage .recent-journal { padding:0; background:none; border:none; box-shadow:none; }
.chats-final-stage .rj-row { display:flex; align-items:center; gap:13px; padding:9px 0; cursor:pointer; transition:opacity .12s; }
.chats-final-stage .rj-row:active { opacity:.55; }
.chats-final-stage .rj-row.div { border-top:1px solid var(--line); }
.chats-final-stage .rj-ava { width:56px; height:56px; border-radius:18px; flex:none; display:flex; align-items:center; justify-content:center; font-size:25px; color:#fff; border:1.5px solid rgba(255,255,255,.72); box-shadow:0 1px 6px rgba(60,80,70,.13); }
.chats-final-stage .rj-body { flex:1; min-width:0; }
.chats-final-stage .rj-top { display:flex; align-items:center; gap:8px; }
.chats-final-stage .rj-title { font-size:16px; font-weight:600; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .rj-time { font-size:12px; font-weight:500; color:var(--ink-faint); flex:none; }
.chats-final-stage .rj-path { font-size:12px; font-weight:500; color:var(--ink-faint); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .rj-msg { font-size:14.5px; font-weight:400; line-height:1.4; color:var(--ink-soft); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .rj-msg svg { vertical-align:-1px; opacity:.6; }
.chats-final-stage .recent-dots { align-self:center; }

/* Граница «недавняя активность → категории».
   Волосяная линия здесь не работала: она повторяла приём разделителей внутри самой ленты недавних
   (.rj-row.div, тот же var(--line) на всю ширину), поэтому не читалась как граница блоков. Теперь
   границу держат сами карточки категорий: у каждой своя рамка по периметру и зазор сетки. */
.chats-final-stage .section-head.cats-head { margin-top:22px; }
.chats-final-stage .cats-wrap {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

/* Открытая скобка категории по системе .sub-sec: линия 2px слева на всю высоту, короткий верхний
   сегмент, стык радиусом 6px, прозрачный фон, без правой и нижней рамки. Рисуется одним
   псевдоэлементом, поэтому закрытый контейнер не образуется; pointer-events:none — чтобы скобка
   не перехватывала нажатия по строке. */
.chats-final-stage .theme-cat {
  position:relative;
  padding:6px 12px 8px 12px;
  margin-bottom:0;
  background:rgba(255,255,255,.42);
  backdrop-filter:blur(11px); -webkit-backdrop-filter:blur(11px);
  border:1px solid var(--tc-line);
  border-radius:var(--r-lg);
  box-shadow:0 1px 5px rgba(60,80,70,.045);
  overflow:hidden;
}
/* Вид карточки задаётся в настройках блока и хранится в localStorage.
   «Широкая» — на всю ширину сетки, как .cat-card.wide в Заметках. */
.chats-final-stage .theme-cat.wide { grid-column:1 / -1; }
/* «Имя» — только аватар, название и кебаб: остальное скрыто, чтобы карточка встала в одну
   колонку. Значок закрепления остаётся видимым, иначе непонятно, почему категория наверху. */
.chats-final-stage .theme-cat.compact { padding:9px 10px; }
.chats-final-stage .theme-cat.compact .cl-last,
.chats-final-stage .theme-cat.compact .sub-pills,
.chats-final-stage .theme-cat.compact .cl-time,
.chats-final-stage .theme-cat.compact .cl-unread { display:none; }
.chats-final-stage .theme-cat.compact .cl-ava.big { width:28px; height:28px; font-size:15px; }
.chats-final-stage .theme-cat.compact .chat-line { gap:9px; align-items:center; }
.chats-final-stage .theme-cat.compact .cl-title { font-size:13px; }
.chats-final-stage .theme-cat.compact .theme-row .row-dots { top:50%; }
.chats-final-stage .theme-row { align-items:flex-start; }
.chats-final-stage .theme-row .cl-top { align-items:flex-start; }
.chats-final-stage .theme-row .cl-title { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; line-height:1.25; }
.chats-final-stage .sub-pills { display:flex; flex-wrap:wrap; gap:7px; margin-top:8px; }
.chats-final-stage .sub-pill { font-size:13px; font-weight:600; color:var(--ink-soft); background:var(--glass); backdrop-filter:blur(10px); border:1.5px solid var(--line); padding:7px 12px; border-radius:16px; cursor:pointer; white-space:nowrap; }
.chats-final-stage .sub-pill b { color:var(--accent); font-weight:700; margin-left:2px; }
.chats-final-stage .sub-pill.more { color:var(--ink-faint); font-weight:700; }
.chats-final-stage .sub-pill:active { background:var(--accent-soft); }
.chats-final-stage .other-row { display:flex; gap:13px; align-items:center; padding:9px 0; margin-top:4px; cursor:pointer; }
/* Шеврон уходит левее kebab: при абсолютном kebab у правого края он оказывался целиком внутри его
   прямоугольника, и тап по стрелке открывал меню вместо перехода в «Прочее». */
.chats-final-stage .other-row .row-chev { width:18px; height:18px; color:var(--ink-faint); flex:none; margin-right:44px; }
.chats-final-stage .other-row .row-chev svg { width:18px; height:18px; }

/* Focused Topic page: decoded screen-topic / renderTopicPage primitives. */
.chats-root.chats-topic-active .phone-shell[data-unified-shell] > .unified-header,
.chats-root.chats-topic-active .phone-shell[data-unified-shell] > .unified-tabs { display:none; }
.chats-final-stage.topic-stage { flex-direction:column; }
.chats-final-stage .page-head { display:flex; align-items:center; gap:11px; padding:calc(env(safe-area-inset-top) + 10px) 14px 10px; position:relative; z-index:5; }
.chats-final-stage .ph-back { width:38px; height:38px; padding:0; border:none; background:transparent; color:var(--ink); border-radius:11px; display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .ph-back:active { background:rgba(140,155,150,.14); }
.chats-final-stage .ph-back svg { width:22px; height:22px; }
.chats-final-stage .ph-ava { width:46px; height:46px; border-radius:15px; display:flex; align-items:center; justify-content:center; font-size:23px; flex:none; box-shadow:0 4px 12px rgba(40,60,50,.12); }
.chats-final-stage .ph-ava.circle { border-radius:50%; }
.chats-final-stage .ph-txt { flex:1; min-width:0; }
.chats-final-stage .ph-txt h2 { margin:0; font-family:var(--font-display); font-size:21px; font-weight:700; line-height:1.2; letter-spacing:-.01em; overflow-wrap:anywhere; }
.chats-final-stage .ph-stat { font-size:12.5px; font-weight:500; color:var(--ink-faint); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .ph-stat b { color:var(--ink-soft); font-weight:600; }
.chats-final-stage .ph-btn { width:38px; height:38px; padding:0; border:none; background:transparent; color:var(--ink-soft); border-radius:11px; display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .ph-btn:active { background:rgba(140,155,150,.14); }
.chats-final-stage .ph-btn svg { width:21px; height:21px; }

.chats-final-stage .gen-row { display:flex; align-items:center; gap:12px; padding:11px 12px; margin:2px 0 4px; border-radius:16px; background:var(--glass); border:1px solid var(--line); cursor:pointer; transition:background .15s; }
.chats-final-stage .gen-row:active { background:var(--accent-soft); }
.chats-final-stage .gen-ava { width:46px; height:46px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:22px; color:#fff; flex:none; }
.chats-final-stage .gen-body { flex:1; min-width:0; }
.chats-final-stage .gen-body h4 { margin:0; font-size:16px; font-weight:600; display:flex; align-items:center; gap:8px; min-width:0; }
/* Чип-маркер ленты: сама карточка названа именем категории, а «Лента» отличает её от обычных
   чатов той же категории, не занимая место в заголовке. */
.chats-final-stage .gen-tag { font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--accent); background:var(--accent-soft); border-radius:7px; padding:2px 7px; flex:none; }
/* Приглашение завести ленту — показывается только у подкатегорий, у которых её ещё нет.
   Круглая «+»-аватарка держит ту же строку, что и будущая карточка ленты, поэтому появление
   ленты не сдвигает остальной экран. */
.chats-final-stage .gen-create { width:100%; display:flex; align-items:center; gap:12px; padding:11px 12px; margin:2px 0 4px; border-radius:16px; border:1.5px dashed var(--accent-line); background:transparent; cursor:pointer; text-align:left; transition:background .15s; }
.chats-final-stage .gen-create:active { background:var(--accent-soft); }
.chats-final-stage .gen-create-ava { width:46px; height:46px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent); flex:none; }
.chats-final-stage .gen-create-ava svg { width:22px; height:22px; }
.chats-final-stage .gen-create-body { display:flex; flex-direction:column; min-width:0; }
.chats-final-stage .gen-create-title { font-size:15.5px; font-weight:600; color:var(--accent); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .gen-create-note { font-size:12.5px; color:var(--ink-faint); margin-top:1px; }
.chats-final-stage .gen-body .gen-last { font-size:14.5px; font-weight:400; line-height:1.4; color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.chats-final-stage .gen-meta { display:flex; flex-direction:column; align-items:flex-end; gap:4px; flex:none; }
.chats-final-stage .gen-meta .gt { font-size:12px; font-weight:500; color:var(--ink-faint); }
.chats-final-stage .gen-meta .gu { background:var(--accent); color:#fff; font-size:10.5px; font-weight:700; min-width:18px; height:18px; padding:0 5px; border-radius:9px; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .gen-chev { color:var(--ink-faint); width:18px; height:18px; flex:none; }
.chats-final-stage .gen-chev svg { width:18px; height:18px; }

.chats-final-stage .qa-head { font-size:12px; font-weight:700; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.04em; margin:12px 4px 8px; }
.chats-final-stage .qa-tabs-wrap { position:sticky; top:0; z-index:4; background:linear-gradient(180deg,var(--bg) 70%,transparent); padding:4px 14px 6px; }
.chats-final-stage .qa-tabs { display:flex; gap:6px; background:rgba(140,155,150,.1); border-radius:14px; padding:4px; }
.chats-final-stage .qa-tab { flex:1; border:0; background:transparent; text-align:center; font-size:13.5px; font-weight:600; color:var(--ink-soft); padding:8px 4px; border-radius:11px; cursor:pointer; transition:all .15s; }
.chats-final-stage .qa-tab.on { background:#fff; color:var(--accent); box-shadow:0 2px 8px rgba(40,60,50,.1); }

/* Категорийная скобка: верх + лево одной непрерывной линией, без низа.
   Раньше форма собиралась из трёх несвязанных фрагментов — плавающего ::before на 30% ширины,
   прямой левой границы и нижней границы со скруглением 14px, которые не сходились в одну фигуру.
   Теперь это настоящий угол, как у скобки категории в заметке (.note-plate::before). */
.chats-final-stage .sub-sec { position:relative; margin:12px 2px 4px; padding:10px 12px 12px 14px; border-left:2px solid var(--sc-line); border-top:2px solid var(--sc-line); border-top-left-radius:6px; }
.chats-final-stage .sub-sec-head { display:flex; align-items:center; gap:9px; cursor:pointer; padding-bottom:4px; }
.chats-final-stage .sub-sec-head .sh-em { width:30px; height:30px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:16px; flex:none; background:var(--sc-soft); }
.chats-final-stage .sub-sec-head h4 { margin:0; font-size:16px; font-weight:700; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .sub-sec-head .sh-cnt { font-size:12px; color:var(--ink-faint); font-weight:500; }
.chats-final-stage .mini-chat { display:flex; align-items:center; gap:11px; padding:8px 2px; cursor:pointer; }
.chats-final-stage .mini-chat .mc-ava { width:42px; height:42px; border-radius:13px; display:flex; align-items:center; justify-content:center; font-size:19px; color:#fff; flex:none; }
.chats-final-stage .mini-chat .mc-body { flex:1; min-width:0; }
.chats-final-stage .mini-chat .mc-body h5 { margin:0; font-size:15.5px; font-weight:600; display:flex; align-items:center; gap:5px; }
.chats-final-stage .mini-chat .mc-body .mc-last { font-size:14px; font-weight:400; line-height:1.4; color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.chats-final-stage .mini-chat .mc-time { font-size:12px; font-weight:500; color:var(--ink-faint); flex:none; }
.chats-final-stage .all-chats-row { display:flex; align-items:center; gap:6px; font-size:13.5px; color:var(--accent); font-weight:600; padding:8px 2px 2px; cursor:pointer; }
.chats-final-stage .all-chats-row svg { width:15px; height:15px; }
.chats-final-stage .sub-empty { font-size:13.5px; color:var(--ink-faint); padding:6px 2px 4px; }
.chats-final-stage .sub-empty .se-btn { margin-top:8px; }
.chats-final-stage .pill-btn { border:none; background:var(--accent); color:#fff; font-size:13.5px; font-weight:600; padding:11px 22px; border-radius:22px; cursor:pointer; }
.chats-final-stage .pill-btn.ghost { background:transparent; color:var(--accent); border:1.5px dashed var(--accent-line); }

.chats-final-stage .feed-group-label { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.06em; color:var(--ink-faint); margin:14px 4px 6px; }
.chats-final-stage .feed-row { display:flex; gap:11px; padding:9px 2px; cursor:pointer; border-bottom:1px solid var(--line); }
.chats-final-stage .feed-ico { width:34px; height:34px; border-radius:10px; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; flex:none; }
.chats-final-stage .feed-ico svg { width:17px; height:17px; }
.chats-final-stage .feed-body { flex:1; min-width:0; }
.chats-final-stage .feed-body h5 { margin:0; font-size:15.5px; font-weight:600; }
.chats-final-stage .feed-body .fp { font-size:11.5px; color:var(--accent); margin-top:1px; cursor:pointer; }
.chats-final-stage .feed-body .fx { font-size:14px; font-weight:400; line-height:1.4; color:var(--ink-soft); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .feed-time { font-size:12px; font-weight:500; color:var(--ink-faint); flex:none; }
.chats-final-stage .task-check { width:22px; height:22px; padding:0; border-radius:7px; border:2px solid var(--line); background:transparent; flex:none; cursor:pointer; display:flex; align-items:center; justify-content:center; margin-top:5px; }
.chats-final-stage .task-check.done { background:var(--accent); border-color:var(--accent); }
.chats-final-stage .task-check svg { width:13px; height:13px; color:#fff; }
.chats-final-stage .task-row.done h5 { text-decoration:line-through; color:var(--ink-faint); }
.chats-final-stage .expand-btn { width:100%; border:0; background:transparent; text-align:center; font-size:13.5px; font-weight:600; color:var(--accent); padding:12px; cursor:pointer; }
.chats-final-stage .tab-empty { text-align:center; padding:32px 20px; color:var(--ink-faint); font-size:13.5px; line-height:1.5; }
.chats-final-stage .create-chat-btn { width:100%; margin:16px 0 8px; padding:13px; border:1.5px dashed var(--accent-line); background:transparent; color:var(--accent); font-size:14px; font-weight:600; border-radius:15px; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:7px; transition:background .15s; }
.chats-final-stage .create-chat-btn:active { background:var(--accent-soft); }
.chats-final-stage .create-chat-btn svg { width:18px; height:18px; }

/* Decoded screen-subtopic / renderSubtopicPage / fullChatRow primitives. */
.chats-final-stage.subtopic-stage { flex-direction:column; }
.chats-final-stage .full-chat { display:flex; gap:13px; padding:10px 2px 10px 0; cursor:pointer; align-items:center; position:relative; }
.chats-final-stage .full-chat .fc-ava { width:58px; height:58px; border-radius:18px; display:flex; align-items:center; justify-content:center; font-size:25px; color:#fff; flex:none; }
.chats-final-stage .full-chat .fc-body { flex:1; min-width:0; border-bottom:1px solid var(--line); padding-bottom:10px; margin-bottom:-10px; display:flex; flex-direction:column; justify-content:center; min-height:58px; }
.chats-final-stage .full-chat:last-of-type .fc-body { border-bottom:none; }
.chats-final-stage .full-chat .fc-top { display:flex; align-items:center; gap:6px; }
.chats-final-stage .full-chat .fc-title { font-size:16px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0; }
.chats-final-stage .full-chat .fc-title.pinnedt { font-weight:700; }
.chats-final-stage .full-chat .fc-time { font-size:12px; font-weight:500; color:var(--ink-faint); flex:none; }
.chats-final-stage .full-chat .fc-last { font-size:14.5px; font-weight:400; line-height:1.4; color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.chats-final-stage .full-chat.closed { opacity:.62; }
.chats-final-stage .fc-unread { background:var(--accent); color:#fff; font-size:10.5px; font-weight:700; min-width:18px; height:18px; padding:0 5px; border-radius:9px; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .closed-block-head { width:100%; display:flex; align-items:center; gap:8px; padding:12px 2px 8px; margin-top:8px; cursor:pointer; color:var(--ink-soft); font-size:13px; font-weight:600; border:0; border-top:1px solid var(--line); background:transparent; text-align:left; }
.chats-final-stage .closed-block-head .cbh-chev { margin-left:auto; transition:transform .2s; }
.chats-final-stage .closed-block-head.open .cbh-chev { transform:rotate(180deg); }
.chats-final-stage .closed-block-head svg { width:16px; height:16px; }
.chats-final-stage .subtopic-empty { padding-top:48px; }
.chats-final-stage .subtopic-empty .empty-emoji { font-size:34px; margin-bottom:10px; }
.chats-final-stage .sub-empty.no-active { padding:14px 2px; }
.chats-final-stage .loc-btn.selected-location { color:var(--accent); border-color:var(--accent-line); opacity:1; cursor:default; }

/* Decoded screen-chat / renderChat / renderRow primitives. */
.chats-final-stage.chat-stage { flex-direction:column; position:relative; overflow:hidden; background-color:#E6EBE8; background-image:radial-gradient(rgba(35,38,43,.06) 1px, transparent 1px); background-size:20px 20px; }
.chats-final-stage .chat-top-solid { position:relative; z-index:6; flex:none; background:rgba(255,255,255,.55); box-shadow:0 1px 0 rgba(35,38,43,.05); backdrop-filter:blur(20px) saturate(1.4); -webkit-backdrop-filter:blur(20px) saturate(1.4); }
.chats-final-stage .chat-header { display:flex; align-items:center; gap:9px; padding:calc(env(safe-area-inset-top) + 10px) 12px 10px; flex:none; position:relative; z-index:6; }
.chats-final-stage .hbtn { width:38px; height:38px; padding:0; border-radius:50%; border:1px solid rgba(255,255,255,.8); background:var(--glass); backdrop-filter:blur(14px); color:var(--ink); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; transition:background .15s,transform .15s; }
.chats-final-stage .hbtn:active { background:rgba(140,155,150,.16); transform:scale(.94); }
.chats-final-stage .hbtn svg { width:19px; height:19px; }
.chats-final-stage .chat-plate { flex:1; min-width:0; display:flex; align-items:center; gap:9px; background:var(--glass); border:1px solid rgba(255,255,255,.8); backdrop-filter:blur(14px); border-radius:20px; padding:6px 10px 6px 6px; cursor:pointer; text-align:left; transition:background .15s; }
.chats-final-stage .chat-plate:active { background:rgba(140,155,150,.1); }
.chats-final-stage .chat-plate .ce { width:36px; height:36px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:16px; color:#fff; flex:none; }
.chats-final-stage .chat-plate .info { flex:1; min-width:0; display:block; }
.chats-final-stage .chat-plate .info h3 { margin:0; font-size:16px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .chat-plate .info .crumb { display:block; font-size:12px; font-weight:500; color:var(--ink-faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .chat-header-actions { display:flex; gap:8px; flex:none; }

.chats-final-stage .pinned-block { display:flex; align-items:stretch; gap:10px; margin:6px 12px 4px; padding:9px 12px 9px 13px; background:var(--glass); border:1px solid rgba(255,255,255,.85); backdrop-filter:blur(14px); border-radius:16px; cursor:pointer; position:relative; flex:none; }
.chats-final-stage .pinned-block::before { content:''; position:absolute; left:4px; top:8px; bottom:8px; width:2.5px; background:var(--accent); border-radius:2px; }
.chats-final-stage .pinned-block .pb-body { flex:1; min-width:0; margin-left:6px; padding:0; border:0; background:transparent; display:flex; flex-direction:column; align-items:flex-start; text-align:left; cursor:pointer; }
.chats-final-stage .pinned-block .pb-label { font-size:11px; font-weight:700; color:var(--accent); letter-spacing:.05em; margin-bottom:2px; }
.chats-final-stage .pinned-block .pb-text { max-width:100%; font-size:13.5px; font-weight:500; color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .pinned-block .pb-side { display:flex; flex-direction:column; align-items:flex-end; justify-content:space-between; flex:none; gap:6px; }
.chats-final-stage .pinned-block .pb-count { font-size:11.5px; color:var(--ink-faint); font-weight:600; }
.chats-final-stage .pinned-block .pb-close { width:22px; height:22px; padding:0; border-radius:50%; border:none; background:rgba(140,155,150,.14); color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; }

.chats-final-stage .chat-feed { flex:1; min-height:0; overflow-y:auto; overscroll-behavior-y:contain; padding:14px 10px calc(78px + var(--app-safe-bottom)); display:flex; flex-direction:column; position:relative; background:transparent; }
.chats-final-stage.chat-stage:has(.composer-quick-panel.show) .chat-feed { padding-bottom:calc(150px + var(--app-safe-bottom)); }
.chats-final-stage .chat-feed-inner { display:flex; flex-direction:column; gap:11px; margin-top:auto; }
.chats-final-stage .history-loading { text-align:center; font-size:11px; color:var(--ink-faint); padding:6px 0 2px; align-items:center; justify-content:center; gap:6px; }
.chats-final-stage .history-loading[hidden] { display:none; }
.chats-final-stage .chat-empty { margin:auto 0; }
.chats-final-stage .chat-empty .eico { font-size:34px; margin-bottom:10px; }
.chats-final-stage .chat-empty span { font-size:13.5px; }
.chats-final-stage .date-pill-row { display:flex; justify-content:center; margin:4px 0; }
.chats-final-stage .date-pill { font-size:12.5px; font-weight:600; color:var(--ink-soft); background:rgba(255,255,255,.3); border:1px solid var(--line); padding:5px 14.5px; border-radius:13px; }
.chats-final-stage .row-wrap { position:relative; display:flex; padding:3px 4px; border-radius:12px; transition:background .15s; }
.chats-final-stage .row-wrap.flash { animation:chat-row-flash 1.3s ease; }
@keyframes chat-row-flash { 0% { background:rgba(62,155,95,.35); } 100% { background:transparent; } }
.chats-final-stage .row-dot { width:36px; height:36px; padding:0; border-radius:10px; border:none; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; margin:-8px -3px; }
.chats-final-stage .row-dot:active { background:rgba(140,155,150,.16); }
.chats-final-stage .row-dot svg { width:18px; height:18px; }
.chats-final-stage .irr-divider-row { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:11.5px; color:var(--ink-faint); font-weight:600; }
.chats-final-stage .irr-divider-row .idl-line { flex:1; height:1px; background:var(--line); }
.chats-final-stage .irr-divider-row .idot { width:24px; height:24px; padding:0; border-radius:8px; border:none; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .irr-divider-row .idot svg { width:14px; height:14px; }
.chats-final-stage .divider-row { display:flex; align-items:center; gap:8px; margin:6px 0; font-size:11.5px; color:var(--accent); font-weight:600; }
.chats-final-stage .divider-row::before,.chats-final-stage .divider-row::after { content:''; flex:1; height:1px; background:var(--accent-line); }

.chats-final-stage .divider-line-row { display:flex; align-items:center; gap:0; width:100%; padding:14px 0; margin:0; cursor:pointer; }
.chats-final-stage .divider-line-row .dl-ring { width:var(--divider-ring-size); height:var(--divider-ring-size); box-sizing:border-box; border:var(--divider-ring-border) solid var(--divider-color); border-radius:50%; background:transparent; flex:none; }
.chats-final-stage .divider-line-row .dl-seg { flex:1; display:flex; align-items:center; min-width:0; }
.chats-final-stage .divider-line-row .dl-line { display:block; width:100%; height:0; }
.chats-final-stage .divider-line-row .dl-wave { display:block; width:100%; height:10px; }
.chats-final-stage .divider-line-row .dl-title { flex:none; max-width:60%; margin:0 10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--divider-color); font-size:12.5px; font-weight:700; }
.chats-final-stage .chat-block { position:relative; margin:12px 0; border-radius:18px; padding:8px; overflow:hidden; background:color-mix(in srgb, var(--block-color) 9%, transparent); }
.chats-final-stage .block-created-date { display:block; margin:0 0 7px; color:var(--ink-faint); font-size:9px; line-height:1; text-align:center; font-variant-numeric:tabular-nums; }
.chats-final-stage .block-top-line,.chats-final-stage .block-bottom-line { display:flex; align-items:center; gap:6px; min-width:0; }
.chats-final-stage .block-line-seg { flex:1; display:flex; align-items:center; min-width:0; }
.chats-final-stage .block-line-title { flex:none; max-width:48%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:color-mix(in srgb,var(--block-color) 72%,var(--ink)); font-size:17.5px; font-weight:600; line-height:1; }
.chats-final-stage .block-top-line,.chats-final-stage .block-bottom-line { border-radius:14px; overflow:hidden; }
.chats-final-stage .block-border-line { border-radius:999px; }
/* 9px владелец попросил «трошки увеличить» — на телефоне счётчик читался с трудом. */
.chats-final-stage .block-count { flex:none; color:var(--ink-faint); font-size:11px; line-height:1; white-space:nowrap; }
.chats-final-stage .block-border-line { display:block; width:100%; height:0; }
.chats-final-stage .block-border-wave { display:block; width:100%; height:8px; }
.chats-final-stage .block-head-action { width:31px; height:31px; flex:none; padding:0; border:0; border-radius:50%; background:var(--block-color); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .block-head-action svg { width:21px; height:21px; }
.chats-final-stage .chat-block-items { display:flex; flex-direction:column; gap:4px; }
.chats-final-stage .chat-block .row-wrap { margin:0; }
.chats-final-stage .chat-block.collapsed .chat-block-items { margin-bottom:2px; }
.chats-final-stage .block-bottom-line { padding-top:8px; }
.chats-final-stage .block-bottom-short { width:22px; flex:none; display:flex; align-items:center; }
.chats-final-stage .chat-block .block-collapse { display:flex; flex:none; margin:0; padding:0; border:0; background:transparent; color:var(--block-color); font:500 9.5px/1 Inter,Arial,sans-serif; cursor:pointer; }
.chats-final-stage .chat-block .block-collapse-label { display:flex; align-items:center; gap:3px; }
.chats-final-stage .chat-block .block-collapse-chevron { display:block; width:9px; height:9px; fill:none; stroke:currentColor; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.chats-final-stage .block-collapse-chevron.up { transform:rotate(180deg); }
.chats-final-stage .block-settings-sheet,.chats-final-stage .block-delete-sheet { padding:18px 18px calc(18px + env(safe-area-inset-bottom)); }
.chats-final-stage .block-delete-sheet h3 { margin:8px 0 14px; }
.chats-final-stage .sheet-back { display:flex; align-items:center; gap:5px; padding:0; border:0; background:transparent; color:var(--ink-soft); font:500 13px/1 inherit; }
.chats-final-stage .sheet-back svg { width:16px; height:16px; }
.chats-final-stage .message-menu-controls { display:flex; align-items:center; gap:1px; }
.chats-final-stage .row-block-dot { opacity:.72; }
.chats-final-stage .row-block-dot svg { width:18px; height:18px; display:block; }
.chats-final-stage .block-original-time { display:block; align-self:flex-end; margin-top:4px; font-size:11px; color:var(--ink-faint); text-align:right; }
.chats-final-stage .sheet-option { display:block; width:100%; padding:14px; border:0; border-top:1px solid var(--line); background:transparent; text-align:left; font:inherit; color:var(--ink); }
.chats-final-stage .sheet-option.danger { color:#b43b3b; }

.chats-final-stage .msg-row { display:flex; align-items:center; gap:8px; max-width:100%; flex:1; }
.chats-final-stage .msg-row.right { align-self:flex-end; flex-direction:row-reverse; }
.chats-final-stage .msg-col-wrap { display:flex; align-items:center; gap:3px; min-width:0; max-width:96%; }
.chats-final-stage .msg-row.right .msg-col-wrap { flex-direction:row-reverse; }
.chats-final-stage .msg-row .m-ava { width:22px; height:22px; border-radius:50%; flex:none; color:#fff; font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; margin-top:2px; }
.chats-final-stage .msg-row.right .m-ava { display:none; }
.chats-final-stage .msg-col { display:flex; flex-direction:column; gap:3px; min-width:0; }
.chats-final-stage .msg-meta { font-size:12px; font-weight:500; color:var(--ink-faint); display:flex; gap:6px; align-items:center; }
.chats-final-stage .msg-row.right .msg-meta { flex-direction:row-reverse; }
.chats-final-stage .bubble { display:flex; flex-direction:column; padding:9px 12px; border-radius:16px; font-size:15px; line-height:1.4; position:relative; word-break:break-word; }
.chats-final-stage .msg-row.left .bubble { background:rgba(255,255,255,.75); border:1px solid var(--line); border-top-left-radius:5px; }
.chats-final-stage .msg-row.right .bubble { background:linear-gradient(135deg,var(--accent),#4EAF6E); color:#fff; border-top-right-radius:5px; }
.chats-final-stage .bubble.failed { background:var(--overdue-soft); border:1px solid rgba(229,72,77,.4); color:var(--ink); }
.chats-final-stage .bubble-author { font-size:12.5px; font-weight:700; color:var(--accent); margin-bottom:2px; }
.chats-final-stage .bubble-time { align-self:flex-end; font-size:11px; font-weight:500; color:var(--ink-faint); opacity:.85; margin-top:2px; }
.chats-final-stage .msg-row.right .bubble-time { color:rgba(255,255,255,.8); }
.chats-final-stage .row-wrap:has(.task-item-toggle) .msg-row { padding-left:25px; }
.chats-final-stage .task-item-toggle { position:absolute; left:1px; top:50%; z-index:1; width:21px; height:21px; padding:0; border:2px solid var(--accent); border-radius:50%; background:rgba(255,255,255,.42); color:#fff; box-shadow:0 2px 7px rgba(46,155,104,.22); transform:translateY(-50%); cursor:pointer; }
.chats-final-stage .task-item-toggle.done { border-color:var(--accent); background:var(--accent); box-shadow:0 2px 8px rgba(46,155,104,.32); }
.chats-final-stage .task-item-toggle svg { width:13px; height:13px; display:block; margin:auto; stroke-width:3; }
.chats-final-stage .bubble.task-item:not(.task-item-done) { box-shadow:0 0 16px 4px rgba(46,155,104,.58); }
/* Владелец решил оставить зачёркивание — держим его вместе с новыми сигналами (притухание
   строки + подпись времени ниже), а не вместо них. opacity — на саму .bubble, а не только на
   текст, чтобы притухла целиком строка (аватар/цитата/время внутри неё), а не только подпись. */
.chats-final-stage .bubble.task-item.task-item-done { box-shadow:0 0 16px 4px rgba(111,124,117,.46); opacity:.6; }
.chats-final-stage .task-item-text.task-item-done { color:var(--ink-soft); text-decoration:line-through; text-decoration-thickness:1px; text-decoration-color:#fff; }
.chats-final-stage .msg-row.right .task-item-text.task-item-done { color:#fff; text-decoration-color:#fff; }
/* Когда выполнено — дополнительно показываем когда именно: своя строка под текстом дела. */
.chats-final-stage .task-item-done-caption { display:block; font-size:11px; color:var(--ink-faint); margin-top:2px; }
.chats-final-stage .msg-row.right .task-item-done-caption { color:rgba(255,255,255,.8); }
/* Было inline: подзадача могла стоять посреди предложения на одной строке с остальным текстом.
   Теперь у выполненной подзадачи под ней появляется подпись времени (.message-subtask-done-caption)
   — ей нужна собственная строка, поэтому подзадача стала блоком. На практике подзадачи и раньше
   писали по одной на строку (чек-лист внутри сообщения), так что для типичного случая ничего не
   меняется — меняется только для маркера посреди предложения, что не был основным сценарием. */
.chats-final-stage .message-subtask { display:block; margin:2px 0; }
.chats-final-stage .message-subtask-toggle { display:inline-flex; width:14.5px; height:14.5px; margin:0 3px 1px 2px; padding:0; border:1.5px solid var(--accent); border-radius:50%; background:rgba(255,255,255,.46); color:#fff; vertical-align:middle; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .message-subtask-toggle.done { background:var(--accent); }
.chats-final-stage .message-subtask-toggle svg { width:9px; height:9px; stroke-width:3; }
.chats-final-stage .message-subtask-text.done { color:var(--ink-soft); text-decoration:line-through; text-decoration-thickness:1px; text-decoration-color:#fff; }
.chats-final-stage .msg-row.right .message-subtask-text.done { color:rgba(35,38,43,.56); }
/* Отступ слева — под текстом поддела, а не под кружком-тумблером: 2px margin + 14.5px ширина +
   3px margin у .message-subtask-toggle = 19.5px до начала текста. */
.chats-final-stage .message-subtask-done-caption { display:block; font-size:11px; color:var(--ink-faint); margin:1px 0 0 19.5px; }
.chats-final-stage .msg-row.right .message-subtask-done-caption { color:rgba(35,38,43,.5); }
.chats-final-stage .edited-tag {
  display:inline-flex;
  align-items:center;
  gap:2px;
  margin-right:4px;
  color:inherit;
  font-size:10px;
  font-weight:500;
  line-height:1;
  opacity:.72;
  white-space:nowrap;
}
.chats-final-stage .edited-tag svg {
  width:10px;
  height:10px;
  flex:none;
}
.chats-final-stage .bubble code { font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,"Liberation Mono",monospace; font-size:13px; background:rgba(35,38,43,.08); padding:1px 5px; border-radius:5px; }
.chats-final-stage .msg-row.right .bubble code { background:rgba(255,255,255,.22); }
.chats-final-stage .bubble ul, .chats-final-stage .bubble ol { margin:2px 0; padding-left:20px; }
.chats-final-stage .bubble li { margin:2px 0; }
.chats-final-stage .send-status { padding:0; border:0; background:transparent; font-size:11px; color:var(--ink-faint); margin-top:2px; display:flex; align-items:center; gap:3px; }
.chats-final-stage .send-status.failed { color:var(--overdue); cursor:pointer; font-weight:600; }
.chats-final-stage .send-status.failed svg { width:11px; height:11px; }
.chats-final-stage .reply-quote { width:100%; border:0; font-size:12.5px; padding:5px 8px; border-left:2.5px solid var(--accent-line); border-radius:6px; background:rgba(140,155,150,.10); margin-bottom:5px; cursor:pointer; text-align:left; }
.chats-final-stage .reply-quote b { display:block; color:var(--accent); font-weight:700; margin-bottom:1px; }
.chats-final-stage .msg-row.right .reply-quote { background:rgba(255,255,255,.18); border-left-color:rgba(255,255,255,.6); color:#fff; }
.chats-final-stage .msg-row.right .reply-quote b { color:#fff; }

.chats-final-stage .card-row { display:flex; align-items:center; gap:3px; max-width:88%; }
.chats-final-stage .entity-card { align-self:flex-start; background:var(--glass); border:1.5px solid var(--accent-line); border-radius:var(--r-md); padding:10px 12px 10px 15px; cursor:pointer; position:relative; flex:1; min-width:0; text-align:left; }
.chats-final-stage .entity-card::before { content:''; position:absolute; left:0; top:50%; transform:translateY(-50%); height:44%; width:9px; border:1.6px solid var(--accent); border-right:none; border-radius:8px 0 0 8px; }
.chats-final-stage .entity-card .elabel { display:block; font-size:11px; font-weight:700; color:var(--accent); letter-spacing:.04em; margin-bottom:3px; }
.chats-final-stage .entity-card h4 { margin:0 0 4px; font-size:15px; font-weight:700; display:flex; align-items:center; }
.chats-final-stage .entity-card .emeta { font-size:12px; font-weight:500; color:var(--ink-soft); display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.chats-final-stage .entity-card .entity-path { margin-top:4px; color:var(--ink-faint); }
.chats-final-stage .entity-card .prio { font-weight:700; }
.chats-final-stage .entity-card .prio.high { color:var(--prio-high); }
.chats-final-stage .entity-card .prio.mid { color:var(--prio-mid); }
.chats-final-stage .entity-card .ecircle { width:14px; height:14px; border-radius:50%; border:2px solid var(--accent-line); flex:none; margin-right:6px; }
.chats-final-stage .sys-update { align-self:flex-start; background:transparent; border:1px dashed var(--line); border-radius:var(--r-md); padding:8px 12px; cursor:pointer; flex:1; min-width:0; text-align:left; }
.chats-final-stage .sys-update .slabel { display:block; font-size:11px; font-weight:700; color:var(--ink-faint); letter-spacing:.04em; margin-bottom:3px; }
.chats-final-stage .sys-update h5 { margin:0 0 3px; font-size:14px; font-weight:600; }
.chats-final-stage .sys-update ul { margin:0; padding:0; list-style:none; font-size:13px; color:var(--ink-soft); }
.chats-final-stage .sys-update ul li { padding:1px 0; }

.chats-final-stage .voice-bubble { display:flex; align-items:center; gap:8px; min-width:150px; }
.chats-final-stage .voice-bubble .vplay { width:26px; height:26px; padding:0; border:0; border-radius:50%; background:rgba(255,255,255,.3); flex:none; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:11px; }
.chats-final-stage .msg-row.left .voice-bubble .vplay { background:var(--accent-soft); color:var(--accent); }
.chats-final-stage .voice-bubble .wave { flex:1; height:18px; background:repeating-linear-gradient(90deg,currentColor 0 2px,transparent 2px 5px); opacity:.5; border-radius:4px; }
.chats-final-stage .voice-bubble .vdur { font-size:11.5px; flex:none; opacity:.85; }
.chats-final-stage .file-bubble { display:flex; align-items:center; gap:8px; border:0; background:transparent; padding:0; margin:0; font:inherit; color:inherit; text-align:left; cursor:pointer; }
.chats-final-stage .file-bubble .fico { width:32px; height:32px; border-radius:9px; background:rgba(255,255,255,.3); flex:none; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .file-bubble .fico svg { width:16px; height:16px; }
.chats-final-stage .file-bubble .fmeta { min-width:0; display:flex; flex-direction:column; }
.chats-final-stage .file-bubble .fname { font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:150px; }
.chats-final-stage .file-bubble .fsize { font-size:11px; opacity:.8; }
.chats-final-stage .file-caption,.chats-final-stage .photo-caption { font-size:13px; margin-top:4px; color:var(--ink); }
/* object-fit:cover раньше кадрировало любое фото под квадрат 260x260 — длинный портрет терял
   верх и низ. contain показывает фото целиком, вписанным и отцентрованным в тот же квадрат;
   background — под пустые поля по бокам/сверху-снизу, которые остаются у не-квадратных фото
   (и тот же фон служит плейсхолдером, пока фото ещё грузится). */
.chats-final-stage .photo-bubble { border:0; border-radius:16px; overflow:hidden; position:relative; width:260px; height:260px; display:flex; align-items:flex-end; justify-content:flex-end; cursor:pointer; background:rgba(140,155,150,.12); }
.chats-final-stage .photo-bubble .photo-img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; display:block; }
.chats-final-stage .photo-bubble.load-failed { background:linear-gradient(135deg,#B8C6D6,#8FA3B8); }
.chats-final-stage .msg-row.right .photo-bubble:not(.in-bubble) { box-shadow:0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.chats-final-stage .msg-row.left .photo-bubble:not(.in-bubble) { box-shadow:0 0 0 3px #fff, 0 0 0 5px rgba(140,155,150,.55); }
.chats-final-stage .bubble.photo-message { padding:4px; }
.chats-final-stage .bubble.photo-message .bubble-author { padding:4px 6px 2px; margin-bottom:0; }
.chats-final-stage .bubble.photo-message .photo-bubble.in-bubble { width:260px; height:260px; border-radius:12px; }
.chats-final-stage .bubble.photo-message .photo-caption { display:flex; flex-direction:column; margin-top:0; padding:6px 6px 2px; color:inherit; }
.chats-final-stage .bubble .file-caption { color:inherit; }
.chats-final-stage .photo-bubble .ph-time { font-size:10px; color:#fff; background:rgba(0,0,0,.35); padding:2px 7px; border-radius:8px; margin:8px; }
.chats-final-stage .photo-group { padding:0; border:0; display:grid; grid-template-columns:1fr 1fr; gap:3px; width:180px; border-radius:16px; overflow:hidden; cursor:pointer; }
/* Кладка через CSS-колонки: высота ячейки диктуется самой картинкой, поэтому скриншоты не
   режутся в квадрат, а пустых слотов (и цветных «дырок» от них) не бывает в принципе.
   min-height держит место, пока blob-URL ещё грузится — иначе колонки схлопываются в ноль
   и лента прыгает при подгрузке. Обводка живёт на ячейке, а не на контейнере: между колонками
   фон контейнера просвечивал бы сплошными полосами. */
.chats-final-stage .media-group { columns:2; column-gap:6px; width:260px; }
.chats-final-stage .mg-cell { position:relative; display:block; width:100%; min-height:78px; margin:0 0 6px; padding:0; border:0; border-radius:10px; overflow:hidden; cursor:pointer; background:rgba(140,155,150,.15); break-inside:avoid; }
.chats-final-stage .mg-cell .photo-img,.chats-final-stage .mg-cell .video-thumb { width:100%; height:auto; display:block; }
.chats-final-stage .mg-more { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(20,26,23,.55); color:#fff; font-size:19px; font-weight:700; }
.chats-final-stage .mg-cell .vb-play { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:30px; height:30px; border-radius:50%; background:rgba(255,255,255,.9); display:flex; align-items:center; justify-content:center; color:var(--accent); font-size:11px; }
.chats-final-stage .photo-group .pg-cell { height:86px; position:relative; }
.chats-final-stage .photo-group .pg-cell:first-child { grid-row:span 2; height:175px; }
.chats-final-stage .photo-group .pg-more { position:absolute; inset:0; background:rgba(20,30,25,.45); color:#fff; font-size:15px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .video-bubble { width:260px; height:260px; padding:0; border:0; border-radius:16px; overflow:hidden; position:relative; cursor:pointer; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#7C8A9A,#4E5D6E); }
.chats-final-stage .video-bubble .video-thumb { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.chats-final-stage .video-bubble.load-failed .video-thumb { display:none; }
.chats-final-stage .msg-row.right .video-bubble { box-shadow:0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.chats-final-stage .msg-row.left .video-bubble { box-shadow:0 0 0 3px #fff, 0 0 0 5px rgba(140,155,150,.55); }
.chats-final-stage .msg-row.right .mg-cell { box-shadow:0 0 0 1.5px var(--accent); }
.chats-final-stage .msg-row.left .mg-cell { box-shadow:0 0 0 1.5px rgba(140,155,150,.55); }
.chats-final-stage .video-bubble .vb-play { position:relative; z-index:1; width:44px; height:44px; border-radius:50%; background:rgba(255,255,255,.9); display:flex; align-items:center; justify-content:center; color:var(--accent); }
.chats-final-stage .video-bubble .vb-dur { position:absolute; right:8px; bottom:8px; font-size:10px; color:#fff; background:rgba(0,0,0,.4); padding:2px 7px; border-radius:8px; }
.chats-final-stage .link-card { width:220px; padding:0; border-radius:16px; overflow:hidden; background:rgba(255,255,255,.6); border:1px solid var(--line); cursor:pointer; text-align:left; }
.chats-final-stage .msg-row.right .link-card { background:rgba(255,255,255,.22); border-color:rgba(255,255,255,.4); }
.chats-final-stage .link-card .lc-img { height:96px; background:linear-gradient(135deg,#B8C6D6,#8FA3B8); display:flex; align-items:center; justify-content:center; color:#fff; }
.chats-final-stage .link-card .lc-img svg { width:26px; height:26px; }
.chats-final-stage .link-card .lc-body { display:flex; flex-direction:column; padding:8px 10px; }
.chats-final-stage .link-card .lc-title { font-size:14px; font-weight:700; margin-bottom:2px; }
.chats-final-stage .link-card .lc-desc { font-size:13px; color:var(--ink-soft); line-height:1.3; margin-bottom:4px; }
.chats-final-stage .link-card .lc-domain { font-size:11px; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.03em; }
.chats-final-stage .link-plain { padding:9px 12px; border-radius:16px; background:rgba(255,255,255,.75); border:1px solid var(--line); font-size:14px; color:var(--accent); cursor:pointer; }
.chats-final-stage .msg-links { display:flex; flex-direction:column; gap:5px; margin-top:5px; align-items:flex-start; }
.chats-final-stage .msg-row.right .msg-links { align-items:flex-end; }
.chats-final-stage .relation-label { max-width:220px; padding:0; border:0; background:transparent; font-size:11.5px; color:var(--ink-faint); display:flex; align-items:center; gap:4px; cursor:pointer; text-align:left; }
.chats-final-stage .relation-label svg { width:11px; height:11px; flex:none; }

.chats-final-stage .down-jump { position:absolute; right:14px; bottom:calc(86px + var(--app-safe-bottom)); width:36px; height:36px; padding:0; border-radius:50%; background:rgba(255,255,255,.92); border:1px solid var(--line); box-shadow:0 3px 10px rgba(60,80,70,.15); display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--accent); flex-direction:column; z-index:20; opacity:0; pointer-events:none; transform:translateY(8px); transition:opacity .18s,transform .18s; }
.chats-final-stage .down-jump.show { opacity:1; pointer-events:auto; transform:none; }
.chats-final-stage .down-jump svg { width:16px; height:16px; }
.chats-final-stage .down-jump .dj-count { font-size:9px; font-weight:700; line-height:1; }
.chats-final-stage .composer-wrap { position:absolute; left:0; right:0; bottom:0; z-index:5; flex:none; padding:8px 12px calc(12px + var(--app-safe-bottom)); background:transparent; pointer-events:none; }
.chats-final-stage .composer-wrap > * { pointer-events:auto; }
.chats-final-stage .composer-bar { display:flex; align-items:flex-end; gap:5px; background:rgba(255,255,255,.82); border:1px solid rgba(255,255,255,.85); border-radius:22px; padding:5px 5px 5px 6px; box-shadow:0 4px 18px rgba(60,80,70,.10); backdrop-filter:blur(18px) saturate(1.3); -webkit-backdrop-filter:blur(18px) saturate(1.3); }
.chats-final-stage .composer-bar .cbtn { width:32px; height:32px; padding:0; border-radius:50%; border:none; background:transparent; color:var(--ink-soft); flex:none; align-self:center; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .composer-bar .cbtn:active { background:rgba(140,155,150,.14); }
.chats-final-stage .composer-bar .cbtn svg { width:17.5px; height:17.5px; }
.chats-final-stage .composer-bar .chat-aa { font-size:13px; }
/* Зелёная капсула-триггер есть теперь в двух композерах: нижнем в чате (.composer-bar) и в
   «Быстрой мысли» на главной (.qc-actions). Геометрия одна, поэтому селектор общий. */
.chats-final-stage .composer-bar .qtrigger,
.chats-final-stage .qc-actions .qtrigger { width:26px; height:26px; padding:0; border-radius:50%; border:none; background:var(--accent-soft); color:var(--accent); flex:none; align-self:center; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .15s,color .15s; }
.chats-final-stage .composer-bar .qtrigger svg,
.chats-final-stage .qc-actions .qtrigger svg { width:13px; height:13px; }
.chats-final-stage .composer-bar .qtrigger.open,
.chats-final-stage .qc-actions .qtrigger.open { background:var(--accent); color:#fff; }
/* Чип выбранного чекбокса подсвечивается, чтобы было видно, что мысль уйдёт не просто в чат. */
.chats-final-stage .qp-item.on { border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent); }
.chats-final-stage .composer-bar textarea { flex:1; border:none !important; background:transparent !important; font-family:inherit; font-size:15px; resize:none; min-height:40px; max-height:200px; outline:none; padding:8px 2px; line-height:1.35; min-width:0; }
.chats-final-stage .composer-bar .send-btn { width:34px; height:34px; padding:0; border-radius:50%; border:none; background:var(--accent); color:#fff; flex:none; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .composer-bar .send-btn svg { width:15px; height:15px; }
.chats-final-stage .composer-quick-panel { display:flex; gap:6px; max-height:0; opacity:0; overflow:hidden; margin-top:0; transition:max-height .22s ease, opacity .18s ease, margin-top .22s ease; }
.chats-final-stage .composer-quick-panel.show { max-height:64px; opacity:1; margin-top:8px; }
/* var(--glass) — 55% прозрачности, сквозь пилюлю просвечивал цвет сообщения под ней. Как и
   .format-bar ниже, делаем непрозрачным белым — тем же паттерном, что .reply-preview/.edit-preview. */
.chats-final-stage .qp-item { display:flex; align-items:center; gap:6px; flex:1; min-width:0; border:1px solid rgba(255,255,255,.8); border-radius:14px; background:#fff; color:var(--ink-soft); padding:8px 10px; cursor:pointer; }
.chats-final-stage .qp-item:active { background:rgba(140,155,150,.14); }
.chats-final-stage .qp-item .qp-ico { display:flex; flex:none; }
.chats-final-stage .qp-item .qp-ico svg { width:16px; height:16px; }
.chats-final-stage .qp-item .qp-label { overflow:hidden; font-size:12.5px; font-weight:600; white-space:nowrap; text-overflow:ellipsis; }
.chats-final-stage .closed-composer { display:flex; align-items:center; justify-content:space-between; padding:12px 14px; background:var(--overdue-soft); border-radius:16px; margin:0 12px 12px; flex:none; }
.chats-final-stage .closed-composer span { font-size:13.5px; color:var(--ink-soft); font-weight:600; }
.chats-final-stage .closed-composer button { border:none; background:var(--accent); color:#fff; font-size:13px; font-weight:700; padding:8px 12px; border-radius:12px; cursor:pointer; }
.chats-final-stage .reply-preview,.chats-final-stage .edit-preview { display:flex; align-items:center; gap:8px; padding:7px 10px; background:#fff; border-radius:12px; margin:0 2px 6px; font-size:12.5px; box-shadow:0 2px 10px rgba(60,80,70,.08); }
.chats-final-stage .attach-preview { display:flex; flex-direction:column; gap:6px; padding:2px; margin:0 2px 6px; font-size:12.5px; }
.chats-final-stage .attach-preview .ap-count { font-size:11.5px; font-weight:700; color:var(--ink-soft); }
.chats-final-stage .attach-preview .ap-grid { display:flex; flex-wrap:wrap; gap:6px; max-height:124px; overflow-y:auto; }
.chats-final-stage .reply-preview[hidden],.chats-final-stage .edit-preview[hidden],.chats-final-stage .attach-preview[hidden] { display:none; }
.chats-final-stage .attach-preview .ap-thumb { position:relative; width:56px; height:56px; border-radius:12px; flex:none; display:flex; align-items:center; justify-content:center; background:#fff; border:1px solid rgba(255,255,255,.9); box-shadow:0 2px 8px rgba(60,80,70,.08); color:var(--ink-soft); overflow:hidden; }
.chats-final-stage .attach-preview .ap-thumb svg { width:20px; height:20px; }
.chats-final-stage .attach-preview .ap-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.chats-final-stage .attach-preview .ap-remove { position:absolute; top:-5px; right:-5px; width:19px; height:19px; padding:0; border:1.5px solid #fff; border-radius:50%; background:rgba(35,38,43,.72); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .attach-preview .ap-remove svg { width:10px; height:10px; }
.chats-final-stage .pop-group-label { padding:7px 10px 3px; font-size:11px; font-weight:700; color:var(--ink-faint); letter-spacing:.04em; text-transform:uppercase; }

/* Exact decoded speed dial: fixed 96px above the bottom, no hotbar. */
.chats-final-stage .fab-dial { position:fixed; right:18px; bottom:var(--app-floating-action-bottom); z-index:22; display:flex; flex-direction:column-reverse; align-items:flex-end; gap:12px; pointer-events:none; }
.chats-final-stage .fab-main { width:56px; height:56px; padding:0; border-radius:18px; background:rgba(62,155,95,.94); backdrop-filter:blur(8px); color:#fff; border:1px solid rgba(255,255,255,.5); cursor:pointer; display:flex; align-items:center; justify-content:center; box-shadow:0 8px 22px rgba(62,155,95,.35); transition:transform .22s cubic-bezier(.3,.9,.3,1); pointer-events:auto; }
.chats-final-stage .fab-main svg { width:24px; height:24px; transition:transform .22s; }
.chats-final-stage .fab-dial.open .fab-main { background:rgba(255,255,255,.9); color:var(--ink-soft); box-shadow:0 8px 22px rgba(60,80,70,.2); }
.chats-final-stage .fab-dial.open .fab-main svg { transform:rotate(135deg); }
.chats-final-stage .dial-items { display:flex; flex-direction:column; align-items:flex-end; gap:10px; margin-bottom:2px; opacity:0; transform:translateY(10px) scale(.96); pointer-events:none; transition:opacity .2s,transform .2s; }
.chats-final-stage .fab-dial.open .dial-items { opacity:1; transform:none; pointer-events:auto; }
.chats-final-stage .dial-pill { display:flex; align-items:center; gap:10px; padding:11px 16px; border-radius:22px; background:rgba(255,255,255,.92); backdrop-filter:blur(16px); border:1px solid rgba(255,255,255,.8); box-shadow:0 6px 18px rgba(60,80,70,.14); font-size:14.5px; font-weight:600; color:var(--ink); cursor:pointer; white-space:nowrap; }
.chats-final-stage .dial-pill:active { transform:scale(.94); }
.chats-final-stage .dial-pill .dp-ico { width:30px; height:30px; border-radius:10px; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; flex:none; }
.chats-final-stage .dial-pill .dp-ico svg { width:17px; height:17px; }

/* Sheets, floating menus and placeholder forms use decoded primitives. */
/* Единый скрим на все оверлеи: шторки, контекстное меню, каскад, попап плюса. z-index 30 держит его
   ниже любого из них. Плотность фона переключается классом .strong, поэтому шторки и меню выглядят
   так же, как раньше при двух отдельных слоях. */
.chats-final-stage .overlay-scrim { position:fixed; inset:0; background:rgba(20,28,24,.10); opacity:0; pointer-events:none; transition:opacity .18s; z-index:30; }
.chats-final-stage .overlay-scrim.strong { background:rgba(35,38,43,.28); backdrop-filter:blur(2px); transition:opacity .25s; }
.chats-final-stage .overlay-scrim.show { opacity:1; pointer-events:auto; }
.chats-final-stage .sheet { font-family:var(--font-popup); position:fixed; left:0; right:0; bottom:0; width:100%; max-width:400px; margin:0 auto; background:rgba(255,255,255,.94); backdrop-filter:blur(24px); border-radius:20px 20px 0 0; padding:12px 20px calc(24px + var(--app-safe-bottom)); transform:translateY(105%); transition:transform .3s cubic-bezier(.3,.9,.3,1); z-index:31; max-height:82dvh; overflow-y:auto; }
.chats-final-stage .sheet.show { transform:translateY(0); }
.chats-final-stage .sheet .grip { width:38px; height:4px; border-radius:2px; background:rgba(140,155,150,.3); margin:0 auto 14px; }
.chats-final-stage .sheet h3 { font-size:16px; font-weight:700; margin:0 0 12px; }
.chats-final-stage .catlist .crow { width:100%; display:flex; align-items:center; gap:13px; padding:12px 8px; border:0; border-radius:14px; background:transparent; cursor:pointer; text-align:left; }
.chats-final-stage .catlist .crow:active { background:var(--accent-soft); }
.chats-final-stage .catlist .ci { width:40px; height:40px; border-radius:13px; display:flex; align-items:center; justify-content:center; flex:none; color:#fff; font-size:18px; }
.chats-final-stage .catlist .cn { font-weight:600; font-size:16px; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .catlist .cc { font-size:12px; color:var(--ink-faint); font-weight:500; max-width:110px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .catlist .cchev { width:16px; height:16px; opacity:.4; flex:none; }
.chats-final-stage .catlist .cchev svg { width:16px; height:16px; }
.chats-final-stage .catlist .backrow { display:flex; align-items:center; gap:8px; border:0; background:transparent; color:var(--ink-soft); font-weight:600; font-size:14px; margin-bottom:8px; cursor:pointer; }
.chats-final-stage .catlist .backrow svg { width:17px; height:17px; }
/* Строка категории + колонка стрелок порядка справа. Стрелки вынесены из .crow, потому что
   .crow сама кнопка (открывает уровень), а вложенная кнопка в кнопку — невалидная разметка. */
.chats-final-stage .catlist .crow-wrap { display:flex; align-items:center; gap:2px; }
.chats-final-stage .catlist .crow-wrap .crow { flex:1; min-width:0; }
.chats-final-stage .catlist .dest-ord-col { display:flex; flex-direction:column; gap:2px; flex:none; }
.chats-final-stage .catlist .dest-ord { display:flex; align-items:center; justify-content:center; width:26px; height:22px; border-radius:7px; color:var(--ink-faint); cursor:pointer; }
.chats-final-stage .catlist .dest-ord:active { background:rgba(140,155,150,.16); color:var(--accent); }
.chats-final-stage .catlist .dest-ord svg { width:14px; height:14px; }
/* Поиск по чатам и категориям в шторке выбора. */
.chats-final-stage .catlist .dest-search { display:flex; align-items:center; gap:8px; height:42px; padding:0 12px; margin-bottom:8px; border:1.5px solid var(--line); border-radius:14px; background:rgba(255,255,255,.6); }
.chats-final-stage .catlist .dest-search-ico { display:flex; flex:none; color:var(--ink-faint); }
.chats-final-stage .catlist .dest-search-ico svg { width:16px; height:16px; }
.chats-final-stage .catlist .dest-search input { flex:1; min-width:0; border:0; background:transparent; outline:none; font-family:inherit; font-size:14px; color:var(--ink); }
/* «До этого: <чат>, <время>» живёт подписью под кнопкой получателя, а не отдельной строкой над
   полем ввода: там она перехватывала внимание в момент, когда мысль надо успеть записать.
   Отдельной кнопкой (а не текстом внутри .qc-dest), потому что действия разные: сама кнопка
   открывает выбор получателя, подпись — открывает тот чат. */
.chats-final-stage .qc-actions .qc-dest-col { display:flex; flex-direction:column; align-items:flex-end; gap:1px; margin-left:auto; min-width:0; }
/* margin-left:auto перенесён с .qc-mic на колонку: два auto-отступа в одном ряду поделили бы
   свободное место пополам и получатель уехал бы в середину. */
.chats-final-stage .qc-actions .qc-dest-col + .qc-mic { margin-left:8px; }
.chats-final-stage .qc-last { max-width:100%; padding:2px 2px 1px; border:0; background:transparent; color:var(--ink-faint); font-family:inherit; font-size:10px; line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer; }
.chats-final-stage .qc-last:active { color:var(--accent); }
.chats-final-stage .empty-state { text-align:center; padding:20px; color:var(--ink-faint); font-size:13.5px; }

.chats-final-stage .ctx-menu,
.chats-final-stage .plus-pop { font-family:var(--font-popup); position:fixed; z-index:38; background:rgba(255,255,255,.97); backdrop-filter:blur(20px); border:1px solid rgba(255,255,255,.8); border-radius:16px; box-shadow:0 12px 30px rgba(20,30,25,.2); padding:6px; min-width:206px; max-width:260px; display:none; }
.chats-final-stage .plus-pop { width:230px; max-width:calc(100% - 24px); }
.chats-final-stage .ctx-menu.show,
.chats-final-stage .plus-pop.show { display:block; }
.chats-final-stage .ctx-item { width:100%; display:flex; align-items:center; gap:11px; padding:10px; border:0; background:transparent; font-size:14px; border-radius:10px; cursor:pointer; color:var(--ink); text-align:left; }
.chats-final-stage .ctx-item:active { background:rgba(140,155,150,.12); }
.chats-final-stage .ctx-item.danger { color:var(--overdue); }
.chats-final-stage .ctx-item.disabled { color:var(--ink-faint); cursor:default; opacity:.68; }
.chats-final-stage .ctx-item.danger .ci-svg { color:var(--overdue); }
.chats-final-stage .ctx-item .ci-svg { width:18px; height:18px; flex:none; color:var(--ink-soft); display:flex; }
.chats-final-stage .ctx-item .ci-svg svg { width:18px; height:18px; }
.chats-final-stage .ctx-item .ci-txt { flex:1; display:flex; flex-direction:column; line-height:1.2; }
.chats-final-stage .ctx-item .ci-hint { font-size:11.5px; font-weight:500; color:var(--ink-faint); margin-top:2px; }

.chats-final-stage .modal-back { position:fixed; inset:0; background:rgba(35,38,43,.34); backdrop-filter:blur(3px); z-index:44; display:none; align-items:center; justify-content:center; padding:20px; }
.chats-final-stage .modal-back.show { display:flex; }
.chats-final-stage .modal-card { font-family:var(--font-popup); width:100%; max-width:340px; background:rgba(255,255,255,.97); backdrop-filter:blur(24px); border-radius:20px; padding:20px; box-shadow:0 24px 60px rgba(20,30,25,.28); max-height:82dvh; overflow-y:auto; }
.chats-final-stage .modal-card h3 { font-size:16px; font-weight:700; margin:0 0 14px; }
.chats-final-stage .field-row { display:flex; gap:10px; align-items:center; margin-bottom:14px; }
.chats-final-stage .emoji-btn { width:52px; height:52px; border-radius:16px; border:1.5px solid var(--line); background:var(--glass); font-size:24px; cursor:pointer; flex:none; display:flex; align-items:center; justify-content:center; }
/* .emoji-btn задуман под <button>, где содержимое центрирует флекс. В формах редактирования тот
   же класс висит на <input>, а собственное значение инпута флекс не центрирует — нужен
   text-align. Из-за этого эмодзи в «Изменить чат» прижимался влево, хотя в форме создания
   (.emoji-field .emoji-btn) он центрирован. Селектор с тегом слабее, чем .emoji-field .emoji-btn,
   так что форма создания со своими размерами остаётся как была. */
.chats-final-stage input.emoji-btn { text-align:center; line-height:1; padding:0; cursor:text; caret-color:var(--accent); }
.chats-final-stage input.emoji-btn:focus { outline:none; border-color:var(--accent-line); background:var(--accent-soft); }
.chats-final-stage .modal-input { flex:1; height:46px; border:1.5px solid var(--line); border-radius:14px; padding:0 14px; font-size:14.5px; background:rgba(255,255,255,.6); outline:none; min-width:0; }
.chats-final-stage .modal-input:focus { border-color:var(--accent-line); }
/* Счётчик символов для полей с maxlength (сейчас — название полоски): наложен поверх поля
   справа, поле получает свой padding-right, чтобы текст не залезал под цифры. */
.chats-final-stage .field-with-counter { position:relative; }
.chats-final-stage .field-with-counter .modal-input.full { padding-right:52px; }
.chats-final-stage .field-char-counter { position:absolute; right:14px; top:23px; transform:translateY(-50%); font-size:11px; color:var(--ink-faint); pointer-events:none; }
/* Поле с счётчиком рядом со значком: без flex:1 оно не занимает остаток строки и
   счётчик уезжает на середину. */
.chats-final-stage .field-with-counter.grow { flex:1; min-width:0; }
/* Значок в шапке чекбокса. Ширина шапки жёстко поделена между линиями и названием,
   поэтому значок сидит внутри титула и не отъедает у декоративных линий. */
.chats-final-stage .block-line-emoji { margin-right:5px; font-size:15px; line-height:1; }
.chats-final-stage .modal-label { font-size:11.5px; font-weight:700; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.03em; margin:6px 2px 8px; }
.chats-final-stage .loc-btn { width:100%; display:flex; align-items:center; gap:8px; min-height:46px; border:1.5px solid var(--line); border-radius:14px; padding:0 14px; background:rgba(255,255,255,.6); font-size:14px; color:var(--ink); cursor:pointer; margin-bottom:6px; }
.chats-final-stage .loc-btn .lb-chev { margin-left:auto; color:var(--ink-faint); }
.chats-final-stage .loc-btn .lb-chev svg { width:16px; height:16px; }
.chats-final-stage .loc-btn.placeholder { color:var(--ink-faint); }
.chats-final-stage .color-row { display:flex; flex-wrap:wrap; gap:10px; margin:2px 2px 16px; }
.chats-final-stage .color-dot { width:30px; height:30px; border-radius:50%; border:2px solid transparent; }
.chats-final-stage .color-dot.on { border-color:var(--ink); transform:scale(1.08); }
.chats-final-stage .stage1-form-note { margin:12px 0; padding:9px 11px; border-radius:12px; background:rgba(140,155,150,.08); color:var(--ink-soft); font-size:12.5px; line-height:1.4; }
/* Перенос чекбокса — отдельной строкой над рядом Удалить/Отмена/Сохранить: в самом ряду
   четвёртая кнопка уже не помещалась по ширине телефона. */
.chats-final-stage .block-move-btn { display:block; width:100%; margin-top:10px; text-align:center; }
/* Выбор чата для переноса рисуется внутри самой шторки (см. renderBlockMoveSheet), поэтому
   строки повторяют геометрию .cascade-item, но живут в обычном потоке, а не в плавающей панели.
   Список свой скроллящийся: у .sheet есть свой max-height, и без него длинное дерево тем
   вытолкнуло бы кнопку «Отмена» за нижний край. */
.chats-final-stage .sheet-pick-list { max-height:46dvh; overflow-y:auto; margin:2px -4px 4px; }
.chats-final-stage .sheet-pick { width:100%; min-height:44px; display:flex; align-items:center; gap:10px; padding:10px 8px; border:0; background:transparent; color:var(--ink); font-family:inherit; font-size:14px; line-height:1.25; text-align:left; border-radius:10px; cursor:pointer; }
.chats-final-stage .sheet-pick:active { background:rgba(140,155,150,.12); }
.chats-final-stage .sheet-pick.disabled { color:var(--ink-faint); cursor:default; }
.chats-final-stage .sheet-pick .sp-ico { flex:none; display:flex; align-items:center; justify-content:center; width:22px; font-size:16px; }
.chats-final-stage .sheet-pick .sp-ico svg { width:17px; height:17px; }
.chats-final-stage .sheet-pick .sp-txt { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chats-final-stage .sheet-pick .sp-chev { flex:none; display:flex; color:var(--ink-faint); }
.chats-final-stage .sheet-pick .sp-chev svg { width:15px; height:15px; }
.chats-final-stage .sheet-pick-sep { height:1px; background:var(--line); margin:5px 8px; }
.chats-final-stage .block-move-sheet .sheet-back { margin-bottom:10px; }
.chats-final-stage .modal-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:6px; }
.chats-final-stage .m-btn { border:none; border-radius:13px; padding:11px 18px; font-size:13.5px; font-weight:600; cursor:pointer; }
.chats-final-stage .m-btn.sec { background:rgba(140,155,150,.14); color:var(--ink-soft); }
.chats-final-stage .m-btn.pri { background:var(--accent); color:#fff; }
.chats-final-stage .m-btn.danger { background:var(--overdue); color:#fff; margin-right:auto; }

.chats-final-stage .divider-pattern-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-bottom:14px; }
.chats-final-stage .divider-pattern-swatch { display:flex; align-items:center; justify-content:center; height:44px; border:1.5px solid var(--line); border-radius:12px; background:rgba(255,255,255,.5); padding:0 8px; cursor:pointer; }
.chats-final-stage .divider-pattern-swatch.selected { border-color:var(--accent); background:var(--accent-soft); }
.chats-final-stage .divider-pattern-swatch .dpp-line { display:block; width:100%; }
.chats-final-stage .divider-pattern-swatch .dpp-wave { display:block; width:100%; height:10px; }

/* flex-wrap — страховка: цветов стало пять, и на самых узких экранах ряд должен
   переноситься, а не выдавливать модалку по горизонтали. */
.chats-final-stage .divider-color-row { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.chats-final-stage .divider-color-swatch { display:flex; align-items:center; justify-content:center; width:36px; height:36px; padding:3px; border:2px solid transparent; border-radius:50%; background:transparent; cursor:pointer; }
.chats-final-stage .divider-color-swatch.selected { border-color:var(--ink); }
.chats-final-stage .divider-color-swatch .dcs-dot { display:block; width:100%; height:100%; border-radius:50%; }

.chats-final-stage .divider-weight-row { display:flex; gap:10px; margin-bottom:6px; }
.chats-final-stage .divider-weight-swatch { display:flex; align-items:center; justify-content:center; flex:1; height:40px; border:1.5px solid var(--line); border-radius:12px; background:rgba(255,255,255,.5); cursor:pointer; }
.chats-final-stage .divider-weight-swatch.selected { border-color:var(--accent); background:var(--accent-soft); }
.chats-final-stage .divider-weight-swatch .dwp-bar { display:block; width:26px; border-radius:2px; background:var(--ink-soft); }
.chats-final-stage .create-element-tabs { display:flex; justify-content:center; gap:20px; margin:0 0 16px; border-bottom:1px solid var(--line); }
.chats-final-stage .create-element-tab { position:relative; padding:0 2px 9px; border:0; background:transparent; color:var(--ink-soft); font-weight:600; cursor:pointer; }
.chats-final-stage .create-element-tab.active { color:var(--ink); }
.chats-final-stage .create-element-tab.active::after { content:""; position:absolute; right:0; bottom:-1px; left:0; height:2px; border-radius:2px; background:var(--accent); }
.chats-final-stage .block-pattern-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin-bottom:14px; }
.chats-final-stage .block-pattern-swatch { height:44px; border:1.5px solid var(--line); border-radius:12px; background:rgba(255,255,255,.5); padding:0 8px; cursor:pointer; }
.chats-final-stage .block-pattern-swatch.selected { border-color:var(--accent); background:var(--accent-soft); }
.chats-final-stage .block-pattern-swatch .dpp-line,.chats-final-stage .block-pattern-swatch .dpp-wave { display:block; width:72%; margin:0 auto; }
.chats-final-stage .block-pattern-placeholder { height:44px; }

.chats-final-stage .toast { position:fixed; left:50%; bottom:28px; transform:translateX(-50%) translateY(10px); max-width:calc(100vw - 32px); background:rgba(35,38,43,.92); color:#fff; font-size:12.5px; line-height:1.35; padding:9px 16px; border-radius:20px; opacity:0; pointer-events:none; transition:opacity .25s,transform .25s; z-index:50; text-align:center; }
.chats-final-stage .photo-viewer { position:fixed; inset:0; z-index:95; background:rgba(10,14,12,.92); display:none; align-items:center; justify-content:center; }
.chats-final-stage .photo-viewer.show { display:flex; }
.chats-final-stage .photo-viewer img { max-width:92%; max-height:88%; object-fit:contain; border-radius:8px; }
.chats-final-stage .photo-viewer .pv-close { position:absolute; top:calc(14px + var(--app-safe-top, 0px)); right:14px; width:38px; height:38px; border:0; border-radius:50%; background:rgba(255,255,255,.15); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .photo-viewer .pv-close svg { width:18px; height:18px; }
.chats-final-stage .photo-viewer video { max-width:92%; max-height:88%; border-radius:8px; background:#000; }
.chats-final-stage .toast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* Stage 5: decoded composer, cascade, search, info and confirmation surfaces. */
.chats-final-stage .chat-aa { font-size:12px; font-weight:700; }
/* Панель раньше не имела своего фона, а кнопки внутри были почти прозрачными
   (rgba(140,155,150,.10)) — сквозь них было видно сообщение под панелью, и она выглядела не
   отдельной панелью, а мусором, налипшим на последнее сообщение. Теперь непрозрачная белая
   карточка, тем же паттерном что .reply-preview/.edit-preview — кнопки внутри прозрачные на
   фоне уже опрятной белой панели, подсветка нажатия (:active/.active) осталась как была. */
.chats-final-stage .format-bar { display:flex; gap:5px; padding:5px; margin:0 2px 6px; background:#fff; border-radius:12px; box-shadow:0 2px 10px rgba(60,80,70,.08); }
.chats-final-stage .format-bar[hidden] { display:none; }
.chats-final-stage .fb-btn { width:34px; height:32px; border:none; border-radius:10px; background:transparent; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .fb-btn:active,.chats-final-stage .fb-btn.active { background:var(--accent-soft); color:var(--accent); }
.chats-final-stage .reply-preview .rp-body { flex:1; min-width:0; }
.chats-final-stage .reply-preview .rp-title { color:var(--accent); font-weight:700; display:block; }
.chats-final-stage .reply-preview .rp-text { color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
.chats-final-stage .reply-preview .rp-close { width:26px; height:26px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .reply-preview .rp-close svg { width:15px; height:15px; }
.chats-final-stage .edit-preview .rp-body { flex:1; min-width:0; }
.chats-final-stage .edit-preview .rp-title { color:var(--accent); font-weight:700; display:block; }
.chats-final-stage .edit-preview .rp-text { color:var(--ink-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
.chats-final-stage .edit-preview .rp-close { width:26px; height:26px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; }
.chats-final-stage .edit-preview .rp-close svg { width:15px; height:15px; }

.chats-final-stage .chat-search-bar { display:flex; align-items:center; gap:9px; padding:calc(env(safe-area-inset-top) + 10px) 12px 10px; flex:none; }
.chats-final-stage .chat-search-bar .sfield { flex:1; display:flex; align-items:center; gap:8px; background:var(--glass); border:1px solid rgba(255,255,255,.8); backdrop-filter:blur(14px); border-radius:20px; padding:0 6px 0 14px; height:42px; }
.chats-final-stage .chat-search-bar .sfield input { flex:1; border:none; background:transparent; font-family:inherit; font-size:15px; outline:none; min-width:0; }
.chats-final-stage .chat-search-bar .sclear { width:26px; height:26px; border-radius:50%; border:none; background:rgba(140,155,150,.14); color:var(--ink-faint); display:flex; align-items:center; justify-content:center; cursor:pointer; flex:none; }
.chats-final-stage .chat-search-bar .sclear svg { width:13px; height:13px; }
.chats-final-stage .search-nav-bar { flex:none; display:flex; align-items:center; justify-content:space-between; padding:10px 16px; min-height:53px; background:var(--glass); backdrop-filter:blur(16px); border-top:1px solid var(--line); margin:0 2px; }
.chats-final-stage .search-nav-bar .snb-count { font-size:12.5px; color:var(--ink-soft); font-weight:600; }
.chats-final-stage .search-nav-bar .snb-arrows { display:flex; gap:6px; }
.chats-final-stage .search-nav-bar .snb-arrow { width:32px; height:32px; border-radius:10px; border:1px solid var(--line); background:rgba(255,255,255,.5); display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--ink-soft); }
.chats-final-stage .search-nav-bar .snb-arrow svg { width:16px; height:16px; }
.chats-final-stage .highlighted { animation:stage5Highlight 1.6s ease; }
@keyframes stage5Highlight { 0%{background:rgba(62,155,95,.35);} 100%{background:transparent;} }
.chats-final-stage .select-bar { display:flex; align-items:center; gap:9px; padding:calc(env(safe-area-inset-top) + 10px) 12px 10px; flex:none; }
.chats-final-stage .select-bar .sel-count { flex:1; text-align:center; font-size:15px; font-weight:700; }
.chats-final-stage .select-bar .select-spacer { width:38px; }
.chats-final-stage .select-toolbar { display:flex; flex:none; padding:8px 6px calc(var(--app-safe-bottom) + 8px); background:rgba(255,255,255,.5); backdrop-filter:blur(16px); border-top:1px solid var(--line); }
.chats-final-stage .select-toolbar .st-btn { flex:1; display:flex; flex-direction:column; align-items:center; gap:4px; padding:6px 2px; border:0; background:transparent; cursor:pointer; border-radius:12px; color:var(--ink-soft); font-size:11.5px; font-weight:600; }
.chats-final-stage .select-toolbar .st-btn:active { background:rgba(140,155,150,.12); }
.chats-final-stage .select-toolbar .st-btn svg { width:19px; height:19px; }
.chats-final-stage .select-toolbar .st-btn.danger { color:var(--overdue); }
.chats-final-stage .row-wrap.menu-active,
.chats-final-stage .row-wrap.selected {
  background:rgba(62,155,95,.10);
}
.chats-final-stage .sel-circle {
  width:20px;
  height:20px;
  border-radius:50%;
  border:2px solid var(--line);
  background:#fff;
  color:#fff;
  flex:none;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.chats-final-stage .sel-circle.on {
  background:var(--accent);
  border-color:var(--accent);
}
.chats-final-stage .sel-circle svg {
  width:12px;
  height:12px;
  color:#fff;
}

.chats-final-stage .sheet-group-label { padding:10px 8px 4px; font-size:11px; font-weight:700; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.05em; }
.chats-final-stage .menu-item { width:100%; display:flex; align-items:center; gap:11px; padding:10px 8px; border:0; border-radius:12px; background:transparent; color:var(--ink); text-align:left; cursor:pointer; }
.chats-final-stage .menu-item:active { background:rgba(140,155,150,.10); }
.chats-final-stage .menu-item .mi-ico { width:34px; height:34px; border-radius:11px; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; flex:none; }
.chats-final-stage .menu-item .mi-ico svg { width:17px; height:17px; }
.chats-final-stage .menu-item .mi-txt { flex:1; display:flex; flex-direction:column; font-size:14px; font-weight:600; }
.chats-final-stage .menu-item .mi-txt small { margin-top:2px; font-size:11.5px; font-weight:500; color:var(--ink-faint); }
.chats-final-stage .menu-item .mi-chev { width:16px; color:var(--ink-faint); }
.chats-final-stage .menu-item .mi-chev svg { width:16px; height:16px; }

.chats-final-stage .ctx-item .ci-next {
  width:16px;
  height:16px;
  color:var(--ink-faint);
  flex:none;
}
.chats-final-stage .ctx-item .ci-next svg {
  width:16px;
  height:16px;
}

/* Точный каскад из CASCADE-CSS.css, ограниченный областью Chats. */
.chats-final-stage .cascade-layer {
  position:fixed;
  inset:0;
  z-index:38;
  pointer-events:none;
  display:none;
}
.chats-final-stage .cascade-layer.show {
  display:block;
}
.chats-final-stage .cascade-panel {
  font-family:var(--font-popup);
  position:absolute;
  pointer-events:auto;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  width:214px;
  min-width:214px;
  max-width:214px;
  padding:6px;
  background:rgba(255,255,255,.97);
  -webkit-backdrop-filter:blur(20px);
  backdrop-filter:blur(20px);
  border:1px solid rgba(255,255,255,.85);
  border-radius:16px;
  box-shadow:0 14px 34px rgba(20,30,25,.22);
  animation:stage5CascadeIn .14s ease;
}
@keyframes stage5CascadeIn {
  from { opacity:0; transform:scale(.96); }
  to { opacity:1; transform:scale(1); }
}
.chats-final-stage .cascade-item {
  width:100%;
  min-height:40px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 10px;
  border:0;
  background:transparent;
  color:var(--ink);
  font-family:inherit;
  font-size:13px;
  line-height:1.2;
  text-align:left;
  border-radius:10px;
  cursor:pointer;
}
.chats-final-stage .cascade-item:active {
  background:rgba(140,155,150,.12);
}
.chats-final-stage .cascade-item.danger {
  color:var(--overdue);
}
.chats-final-stage .cascade-item.disabled {
  opacity:.55;
  cursor:default;
}
.chats-final-stage .cascade-item .cs-svg {
  width:17px;
  height:17px;
  flex:none;
  color:var(--ink-soft);
  display:flex;
}
.chats-final-stage .cascade-item.danger .cs-svg {
  color:var(--overdue);
}
.chats-final-stage .cascade-item .cs-svg svg {
  width:17px;
  height:17px;
}
.chats-final-stage .cascade-item .cs-txt {
  flex:1;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.chats-final-stage .cascade-item .cs-chev {
  width:15px;
  height:15px;
  color:var(--ink-faint);
  flex:none;
}
.chats-final-stage .cascade-item .cs-chev svg {
  width:15px;
  height:15px;
}
.chats-final-stage .cascade-item.cascade-back {
  flex:none;
  font-weight:700;
  color:var(--ink-soft);
}
.chats-final-stage .cascade-item.cascade-back .cs-svg {
  color:var(--ink-soft);
}
.chats-final-stage .cascade-sep {
  flex:none;
  height:1px;
  background:var(--line);
  margin:4px 6px;
}
.chats-final-stage .cascade-search {
  min-height:38px;
  margin:2px 3px 5px;
  padding:0 9px;
  display:flex;
  align-items:center;
  gap:7px;
  flex:none;
  color:var(--ink-faint);
  background:rgba(140,155,150,.10);
  border:1px solid var(--line);
  border-radius:10px;
}
.chats-final-stage .cascade-search-icon {
  width:15px;
  height:15px;
  display:flex;
  flex:none;
}
.chats-final-stage .cascade-search-icon svg {
  width:15px;
  height:15px;
}
.chats-final-stage .cascade-search input {
  width:100%;
  min-width:0;
  padding:0;
  border:0;
  outline:0;
  background:transparent;
  color:var(--ink);
  font:inherit;
  font-size:13px;
}
.chats-final-stage .cascade-search input::placeholder {
  color:var(--ink-faint);
}
.chats-final-stage .cascade-search input::-webkit-search-cancel-button {
  opacity:.55;
}
.chats-final-stage .cascade-scroll {
  min-height:0;
  flex:1 1 auto;
  overflow-x:hidden;
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
}
.chats-final-stage .cascade-empty {
  padding:13px 10px;
  color:var(--ink-faint);
  font-size:12px;
  text-align:center;
}

.chats-final-stage .confirm-backdrop { position:fixed; inset:0; z-index:41; background:rgba(35,38,43,.30); backdrop-filter:blur(2px); opacity:0; pointer-events:none; transition:opacity .2s; }
.chats-final-stage .confirm-backdrop.show { opacity:1; pointer-events:auto; }
.chats-final-stage .confirm-sheet { z-index:42; }
.chats-final-stage .confirm-sheet p { font-size:14px; color:var(--ink-soft); line-height:1.45; margin:0 0 18px; }
.chats-final-stage .confirm-actions { display:flex; gap:8px; }
.chats-final-stage .confirm-btn { flex:1; border:none; border-radius:14px; padding:11px; font-family:inherit; font-size:13.5px; font-weight:600; cursor:pointer; }
.chats-final-stage .confirm-btn.secondary { background:rgba(140,155,150,.12); color:var(--ink-soft); }
.chats-final-stage .confirm-btn.primary { background:var(--accent); color:#fff; }
.chats-final-stage .confirm-btn.danger { background:var(--overdue); color:#fff; }

.chats-final-stage.chat-info-stage { display:flex; flex-direction:column; height:100%; min-height:0; }
.chats-final-stage .info-topbar { display:flex; align-items:center; justify-content:space-between; padding:calc(env(safe-area-inset-top) + 10px) 14px 6px; position:relative; z-index:5; flex:none; }
.chats-final-stage .info-topbar .it-right { display:flex; gap:8px; }
.chats-final-stage .info-cover { margin:6px 14px 0; height:150px; border-radius:26px; display:flex; align-items:center; justify-content:center; position:relative; overflow:hidden; }
.chats-final-stage .info-cover .ic-glow { position:absolute; inset:0; background:radial-gradient(circle at 50% 42%,rgba(255,255,255,.55),rgba(255,255,255,0) 60%); }
.chats-final-stage .info-cover .ic-emoji { font-size:52px; position:relative; z-index:1; filter:drop-shadow(0 3px 10px rgba(0,0,0,.12)); }
.chats-final-stage .info-main { text-align:center; padding:12px 20px 0; }
.chats-final-stage .info-main h2 { font-size:21px; font-weight:700; line-height:1.2; margin:0 0 3px; }
.chats-final-stage .info-main .im-path { font-size:12.5px; font-weight:500; color:var(--ink-faint); margin-bottom:6px; }
.chats-final-stage .info-main .im-status { font-size:13px; color:var(--ink-soft); display:flex; align-items:center; justify-content:center; gap:6px; font-weight:600; }
.chats-final-stage .im-status .dot { width:7px; height:7px; border-radius:50%; background:var(--accent); }
.chats-final-stage .im-status.closed .dot { background:var(--ink-faint); }
.chats-final-stage .info-quick { display:flex; gap:8px; padding:16px 14px 4px; }
.chats-final-stage .iq-btn { flex:1; display:flex; flex-direction:column; align-items:center; gap:5px; padding:11px 4px; border-radius:16px; background:var(--glass); border:1px solid var(--line); cursor:pointer; }
.chats-final-stage .iq-btn svg { width:18px; height:18px; color:var(--ink-soft); }
.chats-final-stage .iq-btn span { font-size:12px; font-weight:600; color:var(--ink-soft); }
.chats-final-stage .iq-btn.on { background:var(--accent-soft); border-color:var(--accent-line); }
.chats-final-stage .iq-btn.on svg,.chats-final-stage .iq-btn.on span { color:var(--accent); }
.chats-final-stage .iq-btn.resume { background:var(--accent); border-color:var(--accent); }
.chats-final-stage .iq-btn.resume svg,.chats-final-stage .iq-btn.resume span { color:#fff; }
.chats-final-stage .info-list-block { margin:10px 14px 0; background:var(--glass); border:1px solid var(--line); border-radius:18px; padding:4px 6px; }
.chats-final-stage .info-list-title { font-size:11.5px; font-weight:700; color:var(--ink-faint); letter-spacing:.04em; text-transform:uppercase; padding:9px 10px 3px; }
.chats-final-stage .info-entity-row { width:100%; display:flex; align-items:center; gap:9px; padding:9px 10px; border:0; background:transparent; cursor:pointer; border-radius:12px; text-align:left; }
.chats-final-stage .info-entity-row:active { background:rgba(140,155,150,.10); }
.chats-final-stage .info-entity-row .ier-body { flex:1; min-width:0; display:flex; flex-direction:column; }
.chats-final-stage .info-entity-row .ier-title { font-size:15px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chats-final-stage .info-entity-row .ier-meta { font-size:12px; font-weight:500; color:var(--ink-faint); margin-top:1px; }
.chats-final-stage .info-entity-row .ier-chev { width:15px; height:15px; color:var(--ink-faint); flex:none; }
.chats-final-stage .info-entity-row.done .ier-title { color:var(--ink-faint); text-decoration:line-through; }
.chats-final-stage .info-empty-block { padding:14px 12px; font-size:13.5px; color:var(--ink-soft); line-height:1.5; }
.chats-final-stage .info-desc-block { margin:12px 14px 0; background:var(--glass); border:1px solid var(--line); border-radius:18px; padding:12px 14px; }
.chats-final-stage .info-desc-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.chats-final-stage .info-desc-head h4 { font-size:13px; font-weight:700; margin:0; }
.chats-final-stage .info-desc-head .idh-edit { width:26px; height:26px; border-radius:9px; border:none; background:transparent; color:var(--ink-faint); cursor:pointer; display:flex; align-items:center; justify-content:center; }
.chats-final-stage .info-desc-head .idh-edit svg { width:15px; height:15px; }
.chats-final-stage .info-desc-text { font-size:14px; font-weight:400; color:var(--ink-soft); line-height:1.5; white-space:pre-wrap; }
.chats-final-stage .info-desc-text.empty { color:var(--ink-faint); font-style:italic; }
.chats-final-stage .info-loc-block { width:calc(100% - 28px); margin:10px 14px 0; background:var(--glass); border:1px solid var(--line); border-radius:18px; padding:12px 14px; display:flex; align-items:center; gap:8px; cursor:pointer; text-align:left; color:var(--ink); }
.chats-final-stage .info-loc-block.disabled { cursor:default; }
.chats-final-stage .info-loc-block .ilb-body { flex:1; min-width:0; display:flex; flex-direction:column; }
.chats-final-stage .info-loc-block .ilb-title { font-size:13.5px; font-weight:700; margin-bottom:2px; }
.chats-final-stage .info-loc-block .ilb-path { font-size:12.5px; color:var(--ink-soft); }
.chats-final-stage .info-loc-block svg { width:16px; height:16px; color:var(--ink-faint); flex:none; }
.chats-final-stage .info-meta-block { margin:10px 14px 20px; background:var(--glass); border:1px solid var(--line); border-radius:18px; padding:12px 14px; display:flex; flex-direction:column; gap:10px; }
.chats-final-stage .info-meta-row .imr-label { font-size:11.5px; font-weight:700; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.03em; margin-bottom:2px; }
.chats-final-stage .info-meta-row .imr-val { font-size:14px; font-weight:600; }
.chats-final-stage .info-meta-div { height:1px; background:var(--line); }

.chats-final-stage .entity-select-list { max-height:280px; overflow-y:auto; margin:0 -4px; }
.chats-final-stage .entity-select-row { width:100%; display:flex; align-items:center; gap:10px; padding:9px 6px; border:0; background:transparent; cursor:pointer; border-radius:12px; text-align:left; }
.chats-final-stage .entity-select-row:active { background:rgba(140,155,150,.10); }
.chats-final-stage .entity-select-row .esr-ico { width:32px; height:32px; border-radius:10px; background:var(--accent-soft); color:var(--accent); display:flex; align-items:center; justify-content:center; flex:none; }
.chats-final-stage .entity-select-row .esr-ico svg { width:15px; height:15px; }
.chats-final-stage .entity-select-row .esr-body { flex:1; min-width:0; display:flex; flex-direction:column; }
.chats-final-stage .entity-select-row .esr-title { font-size:15px; font-weight:600; }
.chats-final-stage .entity-select-row .esr-meta { font-size:12px; font-weight:500; color:var(--ink-faint); }
.chats-final-stage .modal-input.full { width:100%; display:block; margin-bottom:10px; }
.chats-final-stage .modal-textarea { width:100%; height:auto; min-height:88px; padding:10px 14px; resize:none; font-family:inherit; line-height:1.4; }
.chats-final-stage .toast .undo { border:0; background:transparent; color:#9FE1B6; font:inherit; font-weight:700; cursor:pointer; padding:0 0 0 3px; }
.chats-final-stage .toast.show { pointer-events:auto; }

body[data-chats-preview] .chats-final-stage .cascade-layer,
body[data-chats-preview] .chats-final-stage .confirm-backdrop { position:absolute; }

body[data-chats-preview] { min-height:100dvh; display:flex; justify-content:center; background:#dfe5e2; }
body[data-chats-preview] .phone-shell[data-unified-shell] { width:min(100vw,400px); height:100dvh; margin:0; border-radius:0; }
body[data-chats-preview] .unified-screen { padding:0; overflow:hidden; }
body[data-chats-preview] .unified-hotbar { display:none; }

@media (min-width:401px) {
  .chats-final-stage .fab-dial { position:absolute; }
  body[data-chats-preview] .phone-shell[data-unified-shell] { height:min(100dvh - 24px,920px); margin:12px 0; border-radius:25px; }
  body[data-chats-preview] .chats-final-stage .overlay-scrim,
  body[data-chats-preview] .chats-final-stage .modal-back { position:absolute; }
  body[data-chats-preview] .chats-final-stage .sheet { position:absolute; }
}

@media (max-width:370px) {
  .chats-final-stage .content { padding-right:12px; padding-left:12px; }
  .chats-final-stage { --ava-big:54px; }
  .chats-final-stage .cl-ava.big,
  .chats-final-stage .rj-ava.big { width:54px; height:54px; border-radius:18px; }
  .chats-final-stage .sub-pill { padding:6px 9px; font-size:12px; }
}

.chats-root .sheet-item.chats-toggle-row{display:flex;align-items:center;justify-content:space-between;width:100%;border:0;border-top:1px solid rgba(140,155,150,.16);background:transparent;color:inherit;padding:12px 3px;text-align:left}.chats-root .chats-toggle-row .switch{margin-left:auto;flex:none;width:42px;height:24px;border-radius:12px;background:rgba(140,155,150,.25);position:relative;transition:background .2s}.chats-root .chats-toggle-row .switch::after{content:"";position:absolute;top:2.5px;left:3px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 1px 4px rgba(60,80,70,.25);transition:left .2s}.chats-root .chats-toggle-row .switch.on{background:var(--accent)}.chats-root .chats-toggle-row .switch.on::after{left:20px}
.chats-final-stage .pinned-block.strip-tabs{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 8px;padding:7px 10px}.chats-final-stage .strip-tabs-head{grid-column:1/-1;display:flex;gap:4px;min-width:0}.chats-final-stage .strip-tab{flex:1;min-width:0;display:flex;align-items:center;justify-content:center;gap:3px;border:0;border-radius:10px;background:rgba(140,155,150,.14);color:var(--ink-faint);padding:5px 3px;font-size:10px;white-space:nowrap}.chats-final-stage .strip-tab svg{width:11px;height:11px;flex:none}.chats-final-stage .strip-tab.on{background:var(--accent);color:#fff}.chats-final-stage .strip-tabs .pb-body{margin-left:6px}.chats-final-stage .strip-tabs .pb-text{font-size:13px}.chats-final-stage .strip-tabs .pb-text.done{text-decoration:line-through;color:var(--ink-faint)}

/* Настройка блока категорий: строка на категорию с переключателем вида карточки.
   Значения .layout-toggle перенесены из вкладки «Заметки» без изменений — в Чатах вариантов два
   («Широкая» и «Имя»), варианта «½» нет. */
.chats-final-stage .cats-settings-row { display:flex; align-items:center; gap:10px; padding:12px 3px; font-size:14px; border-top:1px solid rgba(140,155,150,.16); }
.chats-final-stage .cats-settings-row:first-of-type { border-top:none; }
.chats-final-stage .cats-settings-row .sw { width:10px; height:10px; border-radius:3px; flex:none; }
.chats-final-stage .cats-settings-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chats-final-stage .layout-toggle {
  display:flex; gap:4px; flex:none;
  background:rgba(140,155,150,.10);
  border-radius:10px; padding:3px;
}
.chats-final-stage .layout-toggle button {
  border:none; background:transparent;
  font-family:inherit; font-size:10px; font-weight:600;
  padding:6px 9px; border-radius:8px;
  color:var(--ink-faint); cursor:pointer;
}
.chats-final-stage .layout-toggle button.on {
  background:#fff; color:var(--accent);
  box-shadow:0 1px 4px rgba(60,80,70,.12);
}

/* Перемещение категорий в настройках блока: вверх/вниз рядом с переключателем вида. */
.chats-final-stage .cats-settings-actions { margin-left:auto; display:flex; gap:8px; align-items:center; }
.chats-final-stage .order-btns { display:flex; gap:2px; flex:none; }
.chats-final-stage .order-btns button {
  width:24px; height:24px;
  border:none; border-radius:7px;
  background:rgba(140,155,150,.10);
  color:var(--ink-soft); cursor:pointer;
  font-size:11px;
  display:flex; align-items:center; justify-content:center;
}
.chats-final-stage .order-btns button:active { background:var(--accent-soft); color:var(--accent); }
.chats-final-stage .order-btns button:disabled { opacity:.3; cursor:default; }

/* Пометки в строке настройки категорий: закрепление и принадлежность блоку «Прочее».
   .pin-ico уже описан глобально (13x13, цвет --accent) — здесь только запрет на сжатие. */
.chats-final-stage .cats-settings-row .pin-ico { flex:none; }
.chats-final-stage .cats-settings-flag {
  flex:none;
  font-size:10px; font-weight:600;
  color:var(--ink-faint);
  background:rgba(140,155,150,.14);
  padding:2px 7px; border-radius:8px;
}
/* Шестерёнка на экране «Прочее» стоит в .page-head, где нет justify-content:space-between —
   отступ слева прижимает её к правому краю, как в заголовках блоков на главной. */
.chats-final-stage .page-head .gear-btn { margin-left:auto; }


/* ==========================================================================================
   Экран категории/подкатегории — единая визуальная система.

   Все правила ниже завязаны на #screen-category. Это тот же самый узел, что несёт класс
   .chats-final-stage, но id перевешивает базовые правила выше и при этом не задевает главный
   экран, открытый чат и legacy-экраны, где те же классы (.full-chat, .gen-row, .page-head)
   живут в другом контексте.
   ========================================================================================== */

/* --- шапка --------------------------------------------------------------------------------- */
#screen-category .page-head { gap:12px; padding-bottom:6px; }
#screen-category .ph-txt h2 { font-family:var(--font-display); font-size:23.5px; font-weight:700; line-height:1.15; letter-spacing:-.015em; }
#screen-category .ph-stat { font-family:var(--font-text); font-size:13.5px; font-weight:500; color:var(--ink-faint); margin-top:4px; }
#screen-category .ph-stat b { font-weight:600; color:var(--ink-soft); }
/* Подложка эмодзи приходит инлайном (градиент категории), перебить её сменой background нельзя.
   Поэтому гасим не фон, а кладём поверх него полупрозрачную белую вуаль: inset-тень рисуется
   над фоном, но под содержимым, так что сам эмодзи остаётся контрастным. Заодно снимается
   тяжёлая внешняя тень — она и делала плитку «неоновой». */
#screen-category .ph-ava { border-radius:16px; box-shadow:inset 0 0 0 999px rgba(255,255,255,.44); }

/* --- хлебные крошки ------------------------------------------------------------------------ */
#screen-category .chats-category-breadcrumb { padding:6px 0 0; gap:1px; }
/* Крошки снова зелёные: серые читались как неактивная подпись, хотя это рабочая навигация. */
#screen-category .chats-category-breadcrumb button { padding:4px 9px; border-radius:10px; background:var(--accent-soft); color:var(--accent); font-size:12px; font-weight:600; }
#screen-category .chats-category-breadcrumb button:active { background:var(--accent); color:#fff; }
#screen-category .chats-category-breadcrumb [aria-current="page"] { background:transparent; color:var(--ink-soft); font-weight:700; }
#screen-category .chats-category-breadcrumb [aria-current="page"]:active { background:rgba(140,155,150,.15); color:var(--ink-soft); }
#screen-category .chats-category-breadcrumb > span { color:rgba(152,161,171,.6); }
#screen-category .chats-category-breadcrumb > span svg { width:13px; height:13px; }

/* --- карточка ленты ------------------------------------------------------------------------ */
/* Это функциональный вход в ленту, а не второй заголовок страницы: стекло, тонкая граница,
   без тени. */
#screen-category .gen-row { margin:18px 0 0; padding:12px 14px; gap:13px; border-radius:18px; background:rgba(255,255,255,.5); border:1px solid rgba(255,255,255,.72); backdrop-filter:blur(14px); box-shadow:none; }
#screen-category .gen-row:active { background:rgba(255,255,255,.74); }
#screen-category .gen-ava { width:44px; height:44px; border-radius:14px; font-size:21px; box-shadow:inset 0 0 0 999px rgba(255,255,255,.44); }
#screen-category .gen-body h4 { display:block; font-family:var(--font-text); font-size:16px; font-weight:600; overflow-wrap:anywhere; }
#screen-category .gen-body .gen-last { font-size:13.5px; margin-top:2px; }
#screen-category .gen-tag { flex:none; align-self:center; }

/* Тот же чип, что у карточки ленты, в шапке открытого чата и в карточке информации —
   чтобы метка, по которой в ленту зашли, никуда не пропадала. */
.chats-final-stage .lenta-tag { display:inline-flex; align-items:center; margin-left:8px; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--accent); background:var(--accent-soft); border-radius:7px; padding:2px 7px; flex:none; vertical-align:middle; }

/* --- заголовки разделов -------------------------------------------------------------------- */
#screen-category .cat-sec-head { margin:26px 2px 10px; }
/* Между двумя разделами воздуха чуть больше, чем между карточкой ленты и первым
   заголовком: там сверху уже стоит сама карточка, а здесь два блока надо развести. */
#screen-category .chat-list + .cat-sec-head,
#screen-category .cats-wrap + .cat-sec-head,
#screen-category .sub-empty + .cat-sec-head { margin-top:30px; }
#screen-category .cat-sec-head h2 { font-family:var(--font-text); font-size:12px; font-weight:600; letter-spacing:.07em; color:var(--ink-faint); }
/* «+» стеклянный и негромкий, но размер зоны нажатия прежний. */
#screen-category .section-add { background:rgba(255,255,255,.55); border:1px solid rgba(255,255,255,.82); color:var(--accent); box-shadow:0 1px 4px rgba(40,60,50,.06); }
#screen-category .section-add:active { background:var(--accent); border-color:var(--accent); color:#fff; }

/* --- список чатов -------------------------------------------------------------------------- */
/* Категорийной скобки здесь нет: слева она читалась как рамка вокруг списка и мешала.
   Список держат разделители между строками. */
#screen-category .chat-list { padding:2px 0; }
#screen-category .chat-list .full-chat { padding:11px 2px 11px 0; gap:13px; min-height:82px; }
#screen-category .chat-list .fc-ava { width:56px; height:56px; border-radius:18px; font-size:25px; box-shadow:inset 0 0 0 999px rgba(255,255,255,.4); }
/* Разделитель живёт на .fc-body, поэтому он начинается после аватара и не пересекает скобку. */
#screen-category .chat-list .fc-body { min-height:56px; border-bottom-color:rgba(140,155,150,.26); }
#screen-category .chat-list .fc-title { font-size:16.5px; font-weight:600; white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
#screen-category .chat-list .fc-time { font-size:12.5px; }
/* Превью в две строки; многоточие ставится только после второй. */
#screen-category .chat-list .fc-last { font-size:15px; line-height:1.38; margin-top:3px; white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
#screen-category .chat-list .expand-btn { padding:12px 0 2px; font-size:13px; }

/* --- подкатегории: карточки той же системы, что и категории на главном экране --------------- */
/* Здесь только зазоры: сама карточка (.theme-cat / .chat-line.theme-row / .sub-pill) описана
   выше и намеренно переиспользуется без изменений — подкатегория должна выглядеть ровно как
   категория на главной, иначе появится третий тип карточки. */
/* Две карточки в ряд, каждая — только аватар и имя. Базовый .theme-cat.compact уже прячет
   превью, дату и пилюли; здесь только подгонка размеров под этот экран. */
#screen-category .cats-wrap { gap:8px; }
/* Владелец попросил чуть просторнее под новую раскладку (кебаб над папкой, стрелка по центру
   плитки) — было 9px 11px. */
#screen-category .cats-wrap .theme-cat.compact { padding:10px 12px; }
#screen-category .cats-wrap .theme-cat.compact .cl-ava.big { width:34px; height:34px; font-size:17px; border-radius:11px; box-shadow:none; }
/* Не более двух строк: в сетке карточки растягиваются по высоте самой длинной, и одно
   предельное название раздувало соседнюю карточку вместе с собой. */
/* Обёртки .cl-top в плитке нет намеренно: как флекс-контейнер она ужималась по содержимому и
   отдавала названию 43px из доступных 89 — имя переносилось после двух слогов. Заголовок лежит
   прямо в .cl-body и занимает всю её ширину. */
#screen-category .cats-wrap .theme-cat.compact .cl-title { width:100%; font-size:14px; font-weight:600; line-height:1.25;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
/* Раскрытая плитка занимает обе колонки — «раскрытие вправо». Содержимое идёт двумя блоками
   (чаты, затем вложенные папки) с линией между ними. */
#screen-category .cats-wrap .theme-cat.compact.tile-open { grid-column:1 / -1; }
/* Стрелка прижата к правому краю и по вертикали стоит по центру. Отсчёт — от .chat-line
   (заголовочный блок: кебаб+папка+имя), а не от всей .theme-cat: в раскрытом состоянии карточка
   вырастает вниз под .tile-reveal, и центр по всей карточке уехал бы в раскрытый список.
   .chat-line своей высоты при раскрытии не меняет, поэтому стрелка остаётся на месте. */
#screen-category .cats-wrap .tile-expand { position:absolute; top:50%; right:0; transform:translateY(-50%); margin-left:0; display:flex; align-items:center; justify-content:center; width:26px; height:26px; padding:0; border:0; border-radius:50%; background:rgba(140,155,150,.14); color:var(--ink-soft); cursor:pointer; transition:background .15s; }
#screen-category .cats-wrap .tile-expand svg { width:13px; height:13px; }
#screen-category .cats-wrap .tile-expand.open { transform:translateY(-50%) rotate(90deg); background:var(--accent-soft); color:var(--accent); }
#screen-category .cats-wrap .tile-reveal { display:flex; flex-direction:column; gap:8px; margin-top:9px; padding-top:9px; border-top:1px solid var(--tc-line); }
#screen-category .cats-wrap .tile-sect { display:flex; flex-direction:column; gap:3px; }
#screen-category .cats-wrap .tile-sect-head { color:var(--ink-faint); font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; }
#screen-category .cats-wrap .tile-sect-item { overflow:hidden; color:var(--ink); font-size:12.5px; font-weight:500; white-space:nowrap; text-overflow:ellipsis; }
#screen-category .cats-wrap .tile-sect-empty { color:var(--ink-faint); font-size:12px; }
#screen-category .cats-wrap .tile-sect-divider { height:1px; background:var(--tc-line); }
/* Плитка в столбик: кебаб, под ним папка, под ней имя на всю ширину. Раньше был флекс-ряд с
   переносом (кебаб слева от папки в одну строку) — теперь по просьбе владельца кебаб садится
   отдельной строкой прямо над папкой, а стрелка-раскрытие (.tile-expand выше) центрируется на
   этом блоке — ему нужен position:relative как точке отсчёта. */
#screen-category .cats-wrap .theme-cat.compact .chat-line { position:relative; display:flex; flex-direction:column; align-items:flex-start; gap:4px; padding:0; }
/* Кебаб был инлайновым первым элементом строки (флекс-ряд); в столбике он просто первая строка —
   сохраняем только компенсацию отступа, чтобы 36px хит-зона не отодвигала папку от левого края
   карточки (был -11px слева под старую раскладку, тут тот же принцип, но и сверху). */
#screen-category .cats-wrap .tile-dots { position:static; transform:none; width:36px; height:36px; margin:-11px 0 0 -11px; color:var(--ink-faint); }
#screen-category .cats-wrap .tile-dots svg { width:18px; height:18px; }
/* flex:0 0 100% растягивал .cl-body по высоте в столбике (flex-basis в column — это высота, не
   ширина) — раньше это работало только потому что .chat-line был flex-row. Теперь просто
   width:100%.
   padding-right отводит место под стрелку у правого края: она absolute и потока не занимает,
   без отступа длинное название заезжало бы прямо под неё. 30px, а не 46px как было в старой
   раскладке — там название на 168px плитке переносилось после двух слогов. */
#screen-category .cats-wrap .theme-cat.compact .cl-body { width:100%; padding-right:30px; }
/* Аватар подкатегории получает язычок сверху слева и превращается в папку. Значок-папку сделали
   самой плиткой эмодзи, а не отдельной иконкой рядом: на плитке шириной 168px лишние 20px
   съели бы название, а форма читается ровно так же однозначно. */
/* Селектор намеренно длинный: базовое правило .theme-cat.compact .cl-ava.big задаёт
   border-radius:11px и весит больше короткого .folder-ava. */
#screen-category .cats-wrap .theme-cat.compact .cl-ava.big.folder-ava { position:relative; width:44px; height:34px; border-radius:3px 10px 10px 10px; overflow:visible; margin-top:5px; }
#screen-category .cats-wrap .theme-cat.compact .cl-ava.big.folder-ava::before { content:""; position:absolute; left:0; top:-5px; width:22px; height:7px; border-radius:3px 3px 0 0; background:inherit; }

/* ==========================================================================================
   Окно создания подтемы/чата.
   ========================================================================================== */
.chats-final-stage .modal-head { margin-bottom:16px; }
.chats-final-stage .modal-head h3 { margin:0; font-size:18px; font-weight:700; }
.chats-final-stage .modal-head p { margin:3px 0 0; font-size:12.5px; font-weight:500; color:var(--ink-faint); }

/* Значок — обычное текстовое поле: символ ставится с клавиатуры, пикера нет. Текст по центру,
   иначе эмодзи прижимается к левому краю квадрата и выглядит как опечатка. */
.chats-final-stage .emoji-field { display:flex; flex-direction:column; align-items:center; gap:4px; flex:none; }
.chats-final-stage .emoji-field .emoji-btn { width:56px; height:56px; text-align:center; font-size:26px; line-height:1; padding:0; cursor:text; caret-color:var(--accent); }
.chats-final-stage .emoji-field .emoji-btn:focus { outline:none; border-color:var(--accent-line); background:var(--accent-soft); }
.chats-final-stage .emoji-field .emoji-hint { font-size:10.5px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-faint); }
.chats-final-stage .field-row { align-items:flex-start; }
.chats-final-stage .field-row .modal-input { margin-top:2px; }

/* Путь по категориям — те же чипы, что на экране категории. */
.chats-final-stage .unified-category-picker { display:grid; gap:10px; padding:2px 0 0; }
.chats-final-stage .tx-path { display:flex; align-items:center; gap:2px; overflow-x:auto; white-space:nowrap; scrollbar-width:none; }
.chats-final-stage .tx-path::-webkit-scrollbar { display:none; }
.chats-final-stage .tx-path button { border:0; padding:5px 10px; border-radius:10px; background:var(--accent-soft); color:var(--accent); font-family:inherit; font-size:12.5px; font-weight:600; cursor:pointer; flex:none; }
.chats-final-stage .tx-path button:active { background:var(--accent); color:#fff; }
.chats-final-stage .tx-path .tx-sep { color:var(--ink-faint); display:flex; align-items:center; flex:none; }
.chats-final-stage .tx-path .tx-sep svg { width:13px; height:13px; }

/* Расположение — одна строка-результат. Пикера в форме не видно, пока он не нужен. */
.chats-final-stage .tx-where { display:flex; align-items:center; gap:10px; width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:14px; background:var(--glass); font-family:inherit; text-align:left; cursor:pointer; }
.chats-final-stage .tx-where:active { background:var(--accent-soft); }
.chats-final-stage .tx-where .tx-where-ico { width:22px; height:22px; flex:none; color:var(--accent); display:flex; align-items:center; justify-content:center; }
.chats-final-stage .tx-where .tx-where-ico svg { width:20px; height:20px; }
.chats-final-stage .tx-where .tx-where-path { flex:1; min-width:0; font-size:14px; font-weight:600; color:var(--ink); overflow-wrap:anywhere; }
.chats-final-stage .tx-where .tx-where-chev { width:16px; height:16px; flex:none; color:var(--ink-faint); display:flex; align-items:center; transition:transform .18s; }
.chats-final-stage .tx-where .tx-where-chev svg { width:16px; height:16px; }
.chats-final-stage .tx-where.open .tx-where-chev { transform:rotate(90deg); }
.chats-final-stage .tx-where.empty { border-style:dashed; border-color:var(--accent-line); }
.chats-final-stage .tx-where.empty .tx-where-path { color:var(--accent); }

.chats-final-stage .tx-here { width:100%; border:1.5px solid var(--accent-line); background:transparent; color:var(--accent); font-family:inherit; font-size:13.5px; font-weight:600; padding:11px; border-radius:13px; cursor:pointer; }
.chats-final-stage .tx-here:active { background:var(--accent-soft); }

.chats-final-stage .tx-children { display:grid; gap:6px; max-height:210px; overflow-y:auto; }
.chats-final-stage .tx-child { display:flex; align-items:center; gap:11px; width:100%; border:0; padding:9px 11px; border-radius:13px; background:rgba(127,138,148,.08); font-family:inherit; text-align:left; cursor:pointer; }
.chats-final-stage .tx-child:active { background:rgba(127,138,148,.16); }
.chats-final-stage .tx-child .tx-em { width:32px; height:32px; flex:none; border-radius:10px; background:rgba(255,255,255,.7); display:flex; align-items:center; justify-content:center; font-size:16px; }
.chats-final-stage .tx-child .tx-body { flex:1; min-width:0; display:flex; flex-direction:column; }
.chats-final-stage .tx-child .tx-name { font-size:14.5px; font-weight:600; color:var(--ink); overflow-wrap:anywhere; }
.chats-final-stage .tx-child .tx-meta { font-size:11.5px; font-weight:500; color:var(--ink-faint); margin-top:1px; }
.chats-final-stage .tx-child .tx-chev { width:16px; height:16px; flex:none; color:var(--ink-faint); display:flex; align-items:center; }
.chats-final-stage .tx-child .tx-chev svg { width:16px; height:16px; }
.chats-final-stage .tx-empty { font-size:12.5px; color:var(--ink-faint); padding:8px 2px; }

/* --- пустые состояния и нижний воздух ------------------------------------------------------ */
#screen-category .sub-empty { padding:2px; font-size:13.5px; }
#screen-category .gen-create { margin-top:18px; }
#screen-category .content { padding-bottom:24px; }
