/* Голосовой 3D-ассистент — тёмная тема в стиле Apple (стекло, блюр, сдержанность) */
:root {
  --bg0: #060609;
  --bg1: #10101a;
  --glass: rgba(22, 22, 30, .62);
  --glass-strong: rgba(24, 24, 34, .86);
  --bubble: rgba(44, 44, 56, .72);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-soft: rgba(255, 255, 255, .05);
  --txt: #f5f5f7;
  --txt2: rgba(235, 235, 245, .62);
  --txt3: rgba(235, 235, 245, .32);
  --blue: #0a84ff;
  --blue2: #0060df;
  --pink: #ff375f;
  --green: #30d158;
  --amber: #ffd60a;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
}

* { box-sizing: border-box; }
/* Значки интерфейса — только stroke-SVG на currentColor: эмодзи в UI нет нигде
   (см. SVG/ico в app.js). Базовый размер перебивают правила по месту. */
.ico { width: 16px; height: 16px; flex: none; display: block; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  background: radial-gradient(1200px 800px at 28% 20%, #171726 0%, var(--bg1) 45%, var(--bg0) 100%);
  color: var(--txt);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; gap: 0; }

/* ------------------------------------------------------------ правая панель */
#panel {
  width: clamp(400px, 34vw, 520px); flex-shrink: 0;
  margin: 14px 14px 14px 0;
  display: flex; flex-direction: column; min-height: 0;
  position: relative;
  background: var(--glass); border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
}

/* ручка изменения ширины панели (левый край) */
#panelResizer {
  position: absolute; left: 0; top: 0; bottom: 0; width: 12px; z-index: 12;
  cursor: col-resize; touch-action: none;
}
#panelResizer::after {
  content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 3.5px; height: 44px; border-radius: 2px;
  background: rgba(255, 255, 255, .16);
  opacity: 0; transition: opacity .2s, background .2s, height .2s;
}
#panelResizer:hover::after, body.panelResizing #panelResizer::after {
  opacity: 1;
}
body.panelResizing #panelResizer::after { background: var(--blue); height: 72px; }
body.panelResizing { cursor: col-resize; user-select: none; }
body.panelResizing #stage, body.panelResizing #chat { pointer-events: none; }

#panel header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 12px 20px;
}
#panel header .title { font-size: 17px; font-weight: 650; letter-spacing: .2px; flex: 1; min-width: 68px; }
/* подсказку держим в одну строку: рядом встала строка лимитов, и без этого
   подзаголовок разъезжался на 3–5 строк, раздувая всю шапку по высоте */
#panel header .title small {
  display: block; font-size: 11.5px; font-weight: 400; color: var(--txt3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* лимиты подписки Claude — одна строка между заголовком и кнопками.
   Свой flex-базис: у заголовка basis 0, и без него весь запас уходил ему.
   Жадный shrink (20) — когда места мало, жмётся строка, а не пилюля пресета:
   кнопки в шапке должны стоять там же, где стояли до неё. */
#panel header .limits {
  flex: 1 20 140px; min-width: 0;
  font-size: 11px; line-height: 1.35; color: var(--txt3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default; user-select: none;
}
#panel header .limits .sep { opacity: .5; margin: 0 5px; }
#panel header .limits .w { opacity: .7; margin-left: 3px; }
#panel header .limits .warn { color: #e3bd57; }
#panel header .limits .hot { color: #ff7a70; }
/* У мозга этого чата ручки расхода нет вовсе (задача #196). Проценты чужой
   подписки тут показывать нельзя, поэтому на их месте честная строка — и
   приглушённая, чтобы не читалась как тревога. */
#panel header .limits.note { color: var(--txt3); opacity: .75; font-style: italic; }

/* Кружок занятого контекста чата (задача #326). Не .iconbtn: тот круглый и
   36 px, а тут кольцо с цифрой внутри, и в ряду из восьми кнопок ему надо быть
   заметно мельче — иначе шапка на телефоне переполняется.
   flex-shrink: 0 — кольцо не сжимается: сплющенный круг читается как брак
   вёрстки. Место под него отнимает строка лимитов, у неё shrink жадный (20). */
#panel header .ctxring {
  width: 30px; height: 30px; flex-shrink: 0; padding: 0;
  border: 0; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative; color: var(--txt3);
  transition: transform .15s, color .2s;
}
#panel header .ctxring:hover { transform: scale(1.08); }
#panel header .ctxring.on { color: var(--txt2); }
#panel header .ctxring svg { width: 30px; height: 30px; display: block; }
/* Дорожка кольца — та же приглушённая обводка, что у кнопок шапки */
#panel header .ctxring .trk { stroke: rgba(255, 255, 255, .14); }
/* Пороги: спокойный до 70 %, внимание 70–90, тревога свыше 90. Цвета те же,
   что у строки лимитов рядом (warn/hot), — в шапке два индикатора, и «жёлтый»
   у них обязан означать одно и то же. */
#panel header .ctxring .val { stroke: var(--blue); transition: stroke-dashoffset .4s, stroke .3s; }
#panel header .ctxring.warn .val { stroke: #e3bd57; }
#panel header .ctxring.hot .val { stroke: #ff7a70; }
/* Чисел нет вовсе (старый чат, хода ещё не было) — бледное кольцо с прочерком.
   Ноль процентов рисовать нельзя: «не знаем» и «пусто» человек читает
   по-разному, ровно как в строке лимитов. */
#panel header .ctxring.none { opacity: .45; }
#panel header .ctxring .num {
  position: absolute; font-size: 9.5px; font-weight: 700; letter-spacing: -.2px;
  font-variant-numeric: tabular-nums; user-select: none;
}
@media (max-width: 560px) {
  #panel header .ctxring, #panel header .ctxring svg { width: 26px; height: 26px; }
  #panel header .ctxring .num { font-size: 8.5px; }
}

/* Начинка дропдауна расхода. Сам дропдаун — общий #pop (те же скругления,
   тень, фон и анимация, что у меню «Терминалы машин»), тут только строки. */
#pop.ctx-pop { min-width: 238px; padding: 8px 4px 6px; }
#pop.ctx-pop .uh {
  display: flex; align-items: baseline; gap: 8px;
  padding: 2px 12px 8px; font-size: 12px; color: var(--txt3);
}
#pop.ctx-pop .uh b { font-size: 13px; color: var(--txt); font-weight: 650; }
#pop.ctx-pop .ur {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 4px 12px; font-size: 12.5px; color: var(--txt2);
}
#pop.ctx-pop .ur i { font-style: normal; color: var(--txt3); }
#pop.ctx-pop .ur b { font-weight: 600; font-variant-numeric: tabular-nums; }
#pop.ctx-pop .usep { height: 1px; margin: 6px 12px; background: var(--stroke-soft); }
#pop.ctx-pop .uctx { padding: 2px 12px 4px; font-size: 12.5px; color: var(--txt2); }
#pop.ctx-pop .uctx b { font-weight: 600; font-variant-numeric: tabular-nums; }
#pop.ctx-pop .uctx.warn b { color: #e3bd57; }
#pop.ctx-pop .uctx.hot b { color: #ff7a70; }
#pop.ctx-pop .unote { padding: 4px 12px 2px; font-size: 11.5px; color: var(--txt3); }
/* «Разговор тяжелеет» (задача #338): абзац, а не строка — ширину дропдауна
   держат ряды чисел, и подсказка обязана переноситься, а не распирать меню. */
#pop.ctx-pop .uheavy {
  max-width: 250px; margin: 4px 12px 2px; padding: 6px 9px;
  border-radius: 9px; background: rgba(255, 122, 112, .1);
  font-size: 11.5px; line-height: 1.4; color: var(--txt2); white-space: normal;
}
/* Подзаголовок «Последний ход» (задача #337): мельче главного, модель справа
   приглушённой строкой — её имя приходит из ответа и бывает длинным, поэтому
   обрезается многоточием, а не распирает дропдаун. */
#pop.ctx-pop .uh.sub { padding: 2px 12px 4px; justify-content: space-between; min-width: 0; }
#pop.ctx-pop .uh.sub b { font-size: 12px; }
#pop.ctx-pop .uh.sub span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.iconbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--stroke-soft);
  background: rgba(255, 255, 255, .06); color: var(--txt2);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .2s, transform .15s, color .2s;
  font-size: 16px; flex-shrink: 0; padding: 0;
}
.iconbtn:hover { background: rgba(255, 255, 255, .12); color: var(--txt); }
.iconbtn:active { transform: scale(.92); }
.iconbtn.off { color: var(--txt3); }
.iconbtn.on { background: rgba(255, 255, 255, .18); color: var(--txt); }
.iconbtn svg { width: 17px; height: 17px; }
/* та же кнопка, но ссылкой (уход в чаты селфбота): у <a> свой цвет и подчёркивание */
a.iconbtn { text-decoration: none; color: var(--txt2); }

/* Узкий экран: в шапке чата восемь круглых кнопок — ужимаем промежутки,
   диаметр и боковые отступы, иначе ряд переполняется и крайняя кнопка уезжает
   за экран (считано на 390px). Ничего не прячем.
   padding-top не трогаем — его задаёт мобильный блок с safe-area. */
@media (max-width: 560px) {
  #panel header { gap: 5px; padding-left: 12px; padding-right: 10px; }
  #panel header .iconbtn { width: 31px; height: 31px; }
  #panel header .iconbtn svg { width: 15px; height: 15px; }
  #panel header .title { min-width: 40px; font-size: 16px; }
}
/* Телефон с 3D-аватаром (в мобильном Safari он включён по умолчанию): в ряду
   добавляются «Свернуть чат» и «Кастомизация», а с #326 — ещё кружок
   контекста. Девять кнопок, кольцо и заголовок не влезали: на 390 px ряд
   вылезал на 26 px, на 375 — на 41, и крайняя кнопка чатов селфбота уезжала
   за край вместе с бейджем непрочитанного (задача #343, замер песочницей).
   Ужимаем промежутки, диаметр и минимум заголовка («Чат» — 28 px), правый
   отступ оставляем 10 px: в него выступает бейдж (right: -8px). */
@media (max-width: 430px) {
  #panel header { gap: 3px; padding-left: 10px; }
  #panel header .iconbtn { width: 29px; height: 29px; }
  #panel header .title { min-width: 28px; }
}
@media (max-width: 370px) {
  #panel header { gap: 2px; }
}

/* чип активного пресета в настройках */
#fPresets .opt.live:not(.on) { border-color: rgba(48, 209, 88, .5); color: #8fe6ac; }

/* баланс OpenRouter в шапке настроек */
.balpill {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 13px;
  border-radius: 100px; cursor: pointer; flex-shrink: 0;
  background: rgba(48, 209, 88, .12); border: 1px solid rgba(48, 209, 88, .35);
  color: #8fe6ac; font: inherit; font-size: 12.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; transition: background .2s;
}
.balpill:hover { background: rgba(48, 209, 88, .22); }
.balpill.err { background: rgba(255, 69, 58, .1); border-color: rgba(255, 69, 58, .35); color: #ff8a80; }

/* чипы сессий */
/* Полоса характеров — одной строкой: переносы съедали высоту чата, а характеров
   с годами прибавляется. Что не влезло — крутится вбок (пальцем, шифт-колесом),
   полосу прокрутки прячем, у правого края лёгкое затухание: видно, что лента
   продолжается. Чипы не сжимаются — иначе имена превратились бы в кашу. */
#chips {
  display: flex; flex-wrap: nowrap; gap: 8px; padding: 4px 16px 12px;
  overflow-x: auto; overflow-y: hidden; flex-shrink: 0;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 34px), transparent);
}
#chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: flex; align-items: center; gap: 7px;
  padding: 7.5px 14px; border-radius: 100px; cursor: pointer;
  background: rgba(255, 255, 255, .055); border: 1px solid var(--stroke-soft);
  font-size: 13px; font-weight: 500; color: var(--txt2);
  transition: background .22s, color .22s, border-color .22s, transform .12s;
  user-select: none; white-space: nowrap; max-width: 190px;
}
.chip .t { overflow: hidden; text-overflow: ellipsis; }
.chip .chip-ico { width: 15px; height: 15px; opacity: .8; margin-right: -1px; }
.chip:hover { background: rgba(255, 255, 255, .1); }
.chip:active { transform: scale(.96); }
.chip.active { background: var(--txt); color: #111; border-color: transparent; font-weight: 600; }
.chip.inbox.active { background: linear-gradient(135deg, #ff5f7e, var(--pink)); color: #fff; }
.chip .badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--amber); color: #1c1c1e; font-size: 10.5px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}
.chip .badge.on { display: flex; }

/* характер в полосе: кружок с инициалом + счётчик чатов */
.chip.persona { padding: 6px 12px 6px 7px; gap: 8px; }
.chip.persona .pav {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.chip.persona .n {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; flex-shrink: 0;
  background: rgba(255, 255, 255, .12); color: var(--txt3);
  font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* Сколько чатов характера ждут прочтения. Цвет — жёлтый карты работы, потому
   что «непрочитано» и состояние wait («она ответила, человек не читал») — это
   ОДИН факт, а не два: второй пометки под wait в ленте нет вовсе (задача #293).
   Текст тёмный: белым по жёлтому не читается. */
.chip.persona .n.unseen { background: var(--amber, #ffd60a); color: #1c1c1e; }
.chip.persona.open .n.unseen { background: var(--amber, #ffd60a); color: #1c1c1e; }
.chip.persona.live { border-color: rgba(255, 255, 255, .28); }
/* характер удалён, а чаты его остались — дверь к ним, но не в общем ряду */
.chip.persona.gone { opacity: .5; border-style: dashed; }
.chip.persona.gone:hover { opacity: .8; }
.chip.persona.open { background: var(--txt); color: #111; border-color: transparent; font-weight: 600; }
.chip.persona.open .n { background: rgba(0, 0, 0, .16); color: rgba(0, 0, 0, .6); }
/* точка у характера, который сейчас отвечает в открытом чате */
.chip.persona.live .n::after {
  content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--green, #30d158);
  margin-left: 4px;
}
.chip.active .badge { background: rgba(0, 0, 0, .25); }
.chip.inbox.active .badge { background: rgba(255, 255, 255, .25); }
.chip .more {
  display: none; width: 18px; height: 18px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .14); color: inherit; cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0 0 2px;
}
.chip.active .more { display: block; }
.chip.inbox.active .more { background: rgba(255, 255, 255, .22); color: #fff; }
.chip.new { color: var(--txt3); border-style: dashed; }

/* ---------------- состояние работы в ленте чипов (задача #293)
   Те же четыре состояния и те же цвета, что красят узлы на карте работы: идёт
   ход — синим, ход упал — красным, «ждёт тебя» — жёлтым, молчит — ничем.
   Цвета берутся переменными темы, а не подбираются на глаз: «жёлтый» на карте
   и «жёлтый» в ленте обязаны быть одним и тем же жёлтым.
   Состояние характера — сильнейшее среди ВСЕХ его чатов, считает его сервер
   (workmap_core.persona_state), клиент только рисует. */
.chip[data-state="run"] { --wk: var(--blue, #0a84ff); }
.chip[data-state="wait"] { --wk: var(--amber, #ffd60a); }
.chip[data-state="error"] { --wk: var(--pink, #ff375f); }
.chip.persona[data-state], .chip.inbox[data-state] { border-color: var(--wk); }
/* Точка на кружке характера — она видна и когда чип раскрыт или активен, а
   обводка в этих состояниях перекрашена под подсветку выбора. Кольцо вокруг
   точки отделяет её и от белого раскрытого чипа, и от тёмного обычного. */
.chip.persona[data-state] .pav::after {
  content: ''; position: absolute; right: -2px; bottom: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--wk); box-shadow: 0 0 0 2px rgba(10, 10, 14, .8);
}
/* «Входящие» — тот же узел ленты, но кружка с инициалом у них нет: состояние
   берёт на себя значок конверта. */
.chip.inbox[data-state] .chip-ico { color: var(--wk); opacity: 1; }
/* Идущий ход дышит — медленно и только у тех чипов, где он правда идёт (их
   обычно один). Это не мигание: плавная смена прозрачности без скачков. */
@keyframes wk-breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.chip.persona[data-state="run"] .pav::after,
.chip.inbox[data-state="run"] .chip-ico { animation: wk-breathe 1.9s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .chip.persona[data-state="run"] .pav::after,
  .chip.inbox[data-state="run"] .chip-ico { animation: none; }
}
.chip.new:hover { color: var(--txt); }

/* Порядок характеров задаёт человек — чипы тащатся прямо в ленте (задача #171).
   Отдельной «ручки» у чипа нет намеренно: их в ленте бывает под три десятка, и
   значок-грип у каждого съел бы ширину, ради которой лента и однострочная.
   Тянется весь чип, а что он тянется — говорит курсор. */
@media (hover: hover) {
  .chip.persona[data-pname] { cursor: grab; }
  .seg .opt[data-pname] { cursor: grab; }
}
/* долгое нажатие на телефоне — это «взял чип», а не системная лупа с «копировать» */
.chip.persona[data-pname], .seg .opt[data-pname] { -webkit-touch-callout: none; }
/* «за что дёргать»: ручка проступает ПОВЕРХ кружка с инициалом, а не рядом с
   ним — своего места она не занимает, и лента не дёргается при наведении */
.chip.persona .pav { position: relative; }
.chip.persona .pav .pgrip {
  position: absolute; inset: 0; border-radius: 50%; opacity: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .45); color: #fff; transition: opacity .16s;
}
.chip.persona .pav .pgrip svg { width: 15px; height: 15px; display: block; }
@media (hover: hover) { .chip.persona[data-pname]:hover .pav .pgrip { opacity: 1; } }
.chip.persona.drag .pav .pgrip { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .chip.persona .pav .pgrip { transition: none; } }
.chip.drag, .seg .opt.drag {
  cursor: grabbing; touch-action: none; opacity: .98;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .45);
}
.seg .opt[data-pname]:focus-visible { outline: 2px solid var(--pink, #ff5f7e); outline-offset: 2px; }
body.chip-drag { cursor: grabbing; touch-action: none; }
/* у ленты правый край затушёван — тащить чип «в туман» неприятно, на время
   жеста маску снимаем */
body.chip-drag #chips { -webkit-mask-image: none; mask-image: none; }

/* ------------------------------------------------------------------- чат */
/* Шапка — характеры, чаты выбранного характера — блоком слева. Раньше в
   полосе лежали все чаты подряд и на пятом характере она превращалась в
   ленту без смысла. */
#panelBody { flex: 1; display: flex; min-height: 0; position: relative; }

#sideChats {
  position: relative;
  width: 0; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  overflow: hidden; opacity: 0;
  border-right: 1px solid transparent;
  transition: width .26s cubic-bezier(.22, 1, .36, 1), opacity .2s, border-color .26s;
}
#panelBody.open #sideChats {
  width: var(--sc-width, 280px); opacity: 1; border-right-color: var(--stroke-soft);
}
#sideChats .sc-head {
  display: flex; align-items: center; gap: 8px; padding: 2px 10px 8px 16px; flex-shrink: 0;
}
#sideChats .sc-ava {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
#sideChats .sc-name {
  flex: 1; min-width: 0; font-size: 12px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase; color: var(--txt3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iconbtn.sm { width: 24px; height: 24px; font-size: 12px; border: none; background: none; }
#sideChats .sc-search {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-width: 0;
  margin: 0 12px 9px; padding: 0 3px 0 9px; min-height: 34px;
  border: 1px solid var(--stroke); border-radius: 8px;
  background: rgba(255, 255, 255, .025); color: var(--txt3);
}
#sideChats .sc-search:focus-within { border-color: var(--txt3); }
#sideChats .sc-search > .ico { width: 15px; height: 15px; }
#scSearch {
  flex: 1; width: 100%; min-width: 0; box-sizing: border-box; padding: 7px 0;
  border: 0; outline: none; background: transparent; color: var(--txt);
  font: inherit; font-size: 16px; appearance: none; -webkit-appearance: none;
}
#scSearch::placeholder { color: var(--txt3); }
#scSearch::-webkit-search-cancel-button,
#scSearch::-webkit-search-decoration { -webkit-appearance: none; }
#sideChats .sc-search-clear {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--txt2); cursor: pointer;
}
#sideChats .sc-search-clear[hidden] { display: none; }
#sideChats .sc-search-clear:hover { background: rgba(255, 255, 255, .07); color: var(--txt); }
#sideChats .sc-search-clear:focus-visible { outline: 1px solid var(--txt2); }
#sideChats .sc-list {
  flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 6px 12px;
  display: flex; flex-direction: column; gap: 3px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent;
}
#sideChats .sc-list::-webkit-scrollbar { width: 6px; }
#sideChats .sc-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 3px; }
#sideChats .sc-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px;
  border-radius: 9px; cursor: pointer; font-size: 12.5px; color: var(--txt2);
  transition: background .18s, color .18s; user-select: none;
}
#sideChats .sc-item:hover { background: rgba(255, 255, 255, .07); color: var(--txt); }
#sideChats .sc-item.on { background: rgba(255, 255, 255, .13); color: var(--txt); font-weight: 600; }
#sideChats .sc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#sideChats .sc-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* кто ответил последним и когда — по названию этого не понять */
#sideChats .sc-item .sub {
  font-size: 10.5px; font-weight: 400; color: var(--txt3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* сколько суток чат молчит */
#sideChats .sc-days {
  flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .1); color: var(--txt3);
}
#sideChats .sc-days.fresh { background: rgba(48, 209, 88, .18); color: #5fe08a; }
#sideChats .sc-days.old { opacity: .45; }
/* за чатом смотрит сознание и может написать сюда само — метка справа, чтобы
   не открывать чат ради тумблера с глазом. Приглушена: кружок непрочитанного важнее */
#sideChats .sc-eye {
  flex-shrink: 0; line-height: 1; opacity: .45; cursor: inherit;
}
#sideChats .sc-eye .ico { width: 13px; height: 13px; }
#sideChats .sc-item:hover .sc-eye, #sideChats .sc-item.on .sc-eye { opacity: .65; }
/* в чате есть непрочитанное — обычно это отчёт фоновой задачи, прилетевший
   туда, откуда её ставили; вместо счётчика суток горит точка */
#sideChats .sc-item.unseen { color: var(--txt); font-weight: 600; }
/* Жёлтый, а не розовый: «есть непрочитанное» и состояние wait («она ответила,
   человек не читал») — один и тот же факт, и вторую пометку под него мы не
   заводим (задача #293). Точка и полоска состояния слева всегда об одном и том
   же, потому что решает их один предикат — unseenOf. */
#sideChats .sc-item.unseen .sub { color: var(--amber, #ffd60a); }
#sideChats .sc-dot {
  flex-shrink: 0; width: 16px; display: flex; align-items: center; justify-content: center;
}
/* сама точка — кружок стилем, а не символ-кружок: символы-значки на iPhone и в
   Chrome рисуются по-разному, эмодзи в интерфейсе нет (задача #348) */
#sideChats .sc-dot i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber, #ffd60a);
  box-shadow: 0 0 6px rgba(255, 214, 10, .45);
}

/* ---------------- состояние работы в списке чатов (задача #293)
   Полоска у левого края строки — те же четыре состояния и те же цвета, что на
   карте работы: идёт ход — синим, ход упал — красным, «ждёт тебя» — жёлтым,
   молчит — без всякой пометки. Полоска, а не рамка и не фон: строки в списке
   стоят вплотную, и рамка добавила бы им высоты (та же причина, по которой
   обводка мозга ниже рисуется отдельным слоем). Значков нет — цвета довольно,
   а эмодзи в интерфейсе не заводим вовсе. */
#sideChats .sc-item[data-state="run"] { --wk: var(--blue, #0a84ff); }
#sideChats .sc-item[data-state="wait"] { --wk: var(--amber, #ffd60a); }
#sideChats .sc-item[data-state="error"] { --wk: var(--pink, #ff375f); }
#sideChats .sc-item[data-state] { position: relative; }
#sideChats .sc-item[data-state]::before {
  content: ''; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 3px;
  border-radius: 2px; background: var(--wk); pointer-events: none;
}
/* Дышит только идущий ход, и таких строк в списке одна-две. Мигания тут быть не
   должно: полсотни строк, дёргающихся в такт, — это рябь, а не подсветка. */
#sideChats .sc-item[data-state="run"]::before {
  animation: wk-breathe 1.9s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  #sideChats .sc-item[data-state="run"]::before { animation: none; }
}
/* На каком мозге идёт разговор (задача #200). Обведён чат, у которого мозг
   выбран СВОЙ; «как в настройках» — обычное состояние всех чатов, и его не
   метим ничем (то же правило, что у тега на кнопке мозга).
   Рамка рисуется отдельным слоем поверх строки, а не border'ом и не outline'ом:
   border добавил бы строке два пикселя высоты, и соседние чаты дёргались бы при
   каждом переключении мозга, а outline скругления знает не везде (в оболочке на
   iPhone webkit постарше) и лёг бы прямоугольником поверх скруглённой строки.
   Слоем же он ничего не ломает: подсветка активного чата, фон при наведении,
   точка непрочитанного и тень перетаскивания остаются как были.
   Цвет — переменной темы и ПО ИМЕНИ мозга: появится третий — тут добавится
   одна строка, а разметка не изменится вовсе. */
#sideChats .sc-item[data-brain] { position: relative; }
#sideChats .sc-item[data-brain]::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  border: 1px solid transparent; pointer-events: none;
}
#sideChats .sc-item[data-brain="kimi"]::after { border-color: var(--blue); }
/* Третий мозг (задача #213) — свой цвет, иначе на глаз он неотличим от Kimi. */
#sideChats .sc-item[data-brain="openrouter"]::after { border-color: #a78bfa; }
#sideChats .sc-item[data-brain="yandex"]::after { border-color: #b39ddb; }
#sideChats .sc-item .more { opacity: 0; background: none; border: none; color: inherit;
  cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; flex-shrink: 0; }
#sideChats .sc-item:hover .more, #sideChats .sc-item.on .more { opacity: .65; }
#sideChats .sc-item .more:hover { opacity: 1; }
#sideChats .sc-item .more .ico { width: 16px; height: 16px; }
#sideChats .sc-item:focus-within .more,
#sideChats .sc-item:focus-within .sc-pin { opacity: .8; }
/* закреплённые чаты: своя группа сверху и ручной порядок внутри неё */
#sideChats .sc-cap {
  padding: 9px 10px 3px; font-size: 9.5px; font-weight: 700; letter-spacing: .7px;
  text-transform: uppercase; color: var(--txt3); user-select: none;
}
#sideChats .sc-list > .sc-cap:first-child { padding-top: 2px; }
#sideChats .sc-pins { display: flex; flex-direction: column; gap: 3px; }
/* Ручка перетаскивания — только у закреплённых, проступает при наведении.
   Лежит в поле слева, а не в строке: встань она в поток, названия закреплённых
   разъехались бы с остальными на её ширину, и две группы читались бы как две
   разные лестницы. */
#sideChats .sc-item.pinned { position: relative; }
#sideChats .sc-grip {
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 13px; height: 13px; opacity: 0; color: var(--txt3);
  cursor: grab; transition: opacity .18s;
}
#sideChats .sc-grip svg { width: 13px; height: 13px; display: block; }
#sideChats .sc-item:hover .sc-grip { opacity: .55; }
/* строку тащат: она приподнята и видно, в какое место группы встанет */
#sideChats .sc-item.drag {
  background: rgba(255, 255, 255, .17); color: var(--txt);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45); cursor: grabbing;
}
#sideChats .sc-item.drag .sc-grip { opacity: .85; }
body.sc-drag, body.sc-drag * { cursor: grabbing !important; user-select: none; }
/* кнопка закрепления: у закреплённого горит всегда — иначе не видно, чем он
   держится наверху; у остальных проступает при наведении */
#sideChats .sc-pin {
  flex-shrink: 0; width: 18px; height: 18px; padding: 0; border: none; background: none;
  color: inherit; cursor: pointer; opacity: 0; transition: opacity .18s;
  display: flex; align-items: center; justify-content: center;
}
#sideChats .sc-pin svg { width: 13px; height: 13px; display: block; }
#sideChats .sc-item:hover .sc-pin, #sideChats .sc-item.on .sc-pin { opacity: .55; }
#sideChats .sc-pin:hover { opacity: 1; }
#sideChats .sc-pin.on, #sideChats .sc-item:hover .sc-pin.on { opacity: .9; color: var(--blue); }
#sideChats .sc-pin.on .head { fill: currentColor; }
/* На телефоне наведения нет: кнопка видна всегда, иначе закрепить нечем.
   А ручку перетаскивания там прячем — тащить всё равно нечем (пальцем этот же
   жест прокручивает список), и обещать её пальцу нечестно. */
@media (hover: none) {
  #sideChats .sc-search { min-height: 44px; }
  #scSearch { font-size: 16px; } /* iPhone не приближает страницу при фокусе */
  #sideChats .sc-search-clear { width: 36px; height: 40px; }
  #sideChats .sc-pin { opacity: .5; width: 30px; height: 30px; }
  #sideChats .sc-item .more { opacity: .5; }
  #sideChats .sc-grip { display: none; }
}
#sideChats .sc-empty { padding: 10px 12px; font-size: 12px; color: var(--txt3); }
#sideChats .sc-search-scope { display: flex; align-items: center; gap: 7px;
  justify-content: center; position: relative; flex: 0 0 30px; width: 30px; height: 30px; margin: 0; cursor: pointer; }
#scSearchAll { appearance: none; -webkit-appearance: none; width: 17px; height: 17px;
  margin: 0; border: 1.5px solid var(--txt3); border-radius: 5px; cursor: pointer;
  background: transparent; transition: background .15s, border-color .15s; }
#scSearchAll:checked { background: var(--blue, #0a84ff); border-color: var(--blue, #0a84ff); }
#scSearchAll:focus-visible { outline: 2px solid var(--txt2); outline-offset: 4px; }
#sideChats .sc-search-scope svg { position: absolute; width: 14px; height: 14px; color: white; pointer-events: none; opacity: 0; }
#scSearchAll:checked + svg { opacity: 1; }
#sideChats .sc-hit { display: flex; flex-direction: column; gap: 5px; width: 100%; min-width: 0;
  box-sizing: border-box; padding: 11px 10px; border: 0; border-bottom: 1px solid rgba(127,127,127,.15);
  background: transparent; color: var(--txt); text-align: left; cursor: pointer; font: inherit; }
#sideChats .sc-hit:hover { background: rgba(127,127,127,.1); }
#sideChats .sc-hit.on { background: rgba(127,127,127,.16); box-shadow: inset 2px 0 var(--blue); }
#sideChats .sc-hit:focus-visible { outline: 1px solid var(--txt2); outline-offset: -2px; }
#sideChats .sc-hit-title { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
#sideChats .sc-hit-info { font-size: 10px; color: var(--txt3); overflow-wrap: anywhere; }
#sideChats .sc-hit-snippet { font-size: 12px; line-height: 1.45; color: var(--txt2); overflow-wrap: anywhere; }
#sideChats .sc-hit mark { background: rgba(210,170,70,.24); color: inherit; border-radius: 2px; }
#sideChats .sc-search-more { width: calc(100% - 16px); margin: 8px; white-space: normal; }
.chat-history-next { display: block; margin: 12px auto; }
#sideChats .sc-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 6px 12px 12px; flex-shrink: 0; font-size: 12.5px; padding: 8px 10px;
}
#scScrim { display: none; }

/* Папки чатов: те же строки, тихие заголовки и один край для resize (#403). */
#scResize { position: absolute; inset: 0 -1px 0 auto; width: 7px; z-index: 6;
  cursor: col-resize; touch-action: none; border-right: 2px solid transparent; }
#scResize:hover, #scResize:focus-visible { border-right-color: var(--blue); outline: none; }
body.scf-resizing, body.scf-resizing * { cursor: col-resize !important; user-select: none !important; }
body.scf-resizing #sideChats { transition: none; }
#sideChats .sc-head button svg { width: 17px; height: 17px; }
#sideChats [hidden] { display: none !important; }
#sideChats .sc-item { flex-shrink: 0; }
#sideChats .sc-item:focus-visible, .scf-folder-row:focus-visible { outline: 1px solid var(--blue); outline-offset: -1px; }
.scf-root, .scf-unfiled { flex-shrink: 0; padding: 10px 8px 6px; font-size: 11px; color: var(--txt3);
  letter-spacing: .03em; border-radius: 6px; }
.scf-unfiled { margin-top: 8px; border-top: 1px solid var(--stroke-soft); }
.scf-folder { flex-shrink: 0; min-width: 0; }
.scf-folder-row { position: relative; display: flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 3px 6px; color: var(--txt2); border-radius: 7px; cursor: pointer; }
.scf-folder-row:hover { background: rgba(127,127,127,.09); }
.scf-folder-row svg { display: block; width: 16px; height: 16px; }
.scf-chevron { flex: 0 0 12px; }
.scf-chevron svg { width: 12px; height: 12px; transition: transform .15s; }
.scf-folder-row[aria-expanded="true"] .scf-chevron svg { transform: rotate(90deg); }
.scf-icon { color: var(--txt3); flex-shrink: 0; }
.scf-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.scf-count { font-size: 10px; color: var(--txt3); font-variant-numeric: tabular-nums; }
.scf-more { display: grid; place-items: center; flex: 0 0 25px; width: 25px; height: 27px;
  padding: 0; background: transparent; border: 0; border-radius: 5px; color: var(--txt2); cursor: pointer; opacity: 0; }
.scf-folder-row:hover .scf-more, .scf-folder-row:focus-within .scf-more { opacity: .8; }
.scf-more:hover { background: rgba(127,127,127,.12); }
.scf-group { margin-left: var(--scf-indent, 12px); padding-left: 2px; border-left: 1px solid var(--stroke-soft); }
.scf-group[hidden] { display: none; }
.scf-group > .sc-item { margin: 2px 0; }
body.scf-drag, body.scf-drag * { user-select: none !important; cursor: grabbing !important; }
.scf-dragging { opacity: .45; }
#scList [data-drop="inside"] { background: rgba(10,132,255,.15); outline: 1px solid var(--blue); outline-offset: -1px; }
#scList [data-drop="before"]::before, #scList [data-drop="after"]::after { content: ''; position: absolute;
  left: 0; right: 0; height: 2px; background: var(--blue); border-radius: 2px; z-index: 3; }
#scList [data-drop="before"]::before { top: -1px; }
#scList [data-drop="after"]::after { bottom: -1px; }
#panelBody[data-drag-kind="folder"] .scf-root, #panelBody[data-drag-kind="chat"] .scf-unfiled {
  outline: 1px dashed var(--txt3); outline-offset: -1px; min-height: 34px; }
.scf-menu { position: fixed; z-index: 15000; min-width: 200px; max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px); overflow-y: auto; padding: 5px; border-radius: 12px;
  border: 1px solid var(--stroke); background: var(--glass-strong, #24242b); color: var(--txt);
  backdrop-filter: blur(24px); box-shadow: 0 12px 40px #0005; }
.scf-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 7px; background: transparent; color: inherit; font: inherit; font-size: 13px;
  text-align: left; cursor: pointer; }
.scf-menu button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .75; }
.scf-menu button:hover, .scf-menu button:focus-visible { background: rgba(127,127,127,.14); outline: none; }
.scf-menu .danger, .scf-dialog .danger { color: var(--pink, #ff375f); }
.scf-dialog { color: var(--txt); background: var(--glass-strong, #24242b); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 22px; width: 420px; max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px); box-sizing: border-box; box-shadow: 0 20px 80px #0005; }
.scf-dialog::backdrop { background: #0007; backdrop-filter: blur(4px); }
.scf-dialog h2 { margin: 0 0 18px; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.scf-dialog p { font-size: 13px; line-height: 1.6; }
.scf-dialog label { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--txt2); }
.scf-dialog input, .scf-dialog select { width: 100%; box-sizing: border-box; padding: 10px 12px;
  border: 1px solid var(--stroke); border-radius: 8px; background: rgba(127,127,127,.07); color: var(--txt); font: inherit; font-size: 16px; }
.scf-dialog option { padding: 8px; background: var(--glass-strong, #24242b); color: var(--txt); }
.scf-dialog input:focus, .scf-dialog select:focus { outline: 1px solid var(--blue); }
.scf-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.scf-dialog-error:empty { display: none; }
.scf-dialog-error { color: var(--pink); }
.scf-error { display: flex; gap: 6px; align-items: center; margin: 0 12px 8px; font-size: 11px; color: var(--pink); }
.scf-error button { background: transparent; border: 0; color: inherit; text-decoration: underline; cursor: pointer; }
@media (pointer: coarse) {
  .scf-more { opacity: .7; width: 32px; height: 36px; }
  .scf-folder-row { min-height: 42px; }
  #scResize { width: 10px; }
}
@media (prefers-reduced-motion: reduce) { .scf-chevron svg { transition: none; } }

/* Узкая панель (аватар включён, места мало) — список накрывает чат, а не
   выжимает его в щель */
#panelBody.narrow.open #sideChats {
  position: absolute; inset: 0 auto 0 0; z-index: 4; width: min(var(--sc-width, 280px), calc(100% - 36px));
  background: rgba(22, 22, 26, .92);
  backdrop-filter: blur(30px) saturate(1.4); -webkit-backdrop-filter: blur(30px) saturate(1.4);
  border-right: 1px solid var(--stroke);
  box-shadow: 18px 0 46px rgba(0, 0, 0, .42);
}
#panelBody.narrow.open #scScrim {
  display: block; position: absolute; inset: 0; z-index: 3;
  background: rgba(0, 0, 0, .34); animation: scrimIn .2s ease;
}
@keyframes scrimIn { from { opacity: 0 } to { opacity: 1 } }

#chat {
  flex: 1; overflow-y: auto; padding: 6px 16px 14px; min-height: 0;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
#chat::-webkit-scrollbar { width: 8px; }
#chat::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
#chat::-webkit-scrollbar-track { background: transparent; }

/* «вниз, к последним репликам»: отмотал историю — кнопка появилась, вернулся
   вниз — уехала. Висит над чатом в углу, поэтому #panelBody и position:relative.
   Не рисуется, пока чат и так внизу: постоянная кнопка над текстом — это шум */
.downbtn {
  position: absolute; right: 18px; bottom: 12px; z-index: 5;
  width: 38px; height: 38px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--txt2); background: var(--glass-strong); border: 1px solid var(--stroke);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .38);
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.9);
  transition: opacity .18s, visibility .18s, transform .18s, background .18s, color .18s;
}
.downbtn.on { opacity: 1; visibility: visible; transform: none; }
.downbtn:hover { color: var(--txt); background: rgba(255, 255, 255, .14); }
.downbtn:active { transform: scale(.92); }
.downbtn .ico { width: 18px; height: 18px; }

#chat .empty {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--txt3); font-size: 13.5px; text-align: center; padding: 0 30px;
}
#chat .empty .big .ico { width: 40px; height: 40px; opacity: .45; stroke-width: 1.2; }

.day-sep {
  text-align: center; font-size: 11px; color: var(--txt3);
  margin: 14px 0 6px; letter-spacing: .6px; font-weight: 500;
}

.msg {
  display: flex; flex-direction: column; margin-top: 10px;
  animation: msgIn .35s cubic-bezier(.2, .9, .3, 1.2);
  max-width: 86%;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; align-items: flex-end; margin-left: auto; }
.msg.assistant, .msg.inject, .msg.error { align-self: flex-start; align-items: flex-start; margin-right: auto; }
#chat { display: flex; flex-direction: column; }

.msg .bubble {
  padding: 10px 14px; border-radius: var(--r-md);
  font-size: 14.5px; line-height: 1.42; white-space: pre-wrap; word-break: break-word;
  position: relative;
}
.msg.user .bubble {
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue2) 120%);
  color: #fff; border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px rgba(10, 132, 255, .22);
}
.msg.assistant .bubble {
  background: var(--bubble); border: 1px solid var(--stroke-soft);
  border-bottom-left-radius: 6px;
}
.msg.inject .bubble {
  background: linear-gradient(160deg, rgba(255, 55, 95, .16), rgba(255, 55, 95, .06));
  border: 1px solid rgba(255, 55, 95, .28); border-bottom-left-radius: 6px;
}
.msg.error .bubble {
  background: rgba(255, 69, 58, .12); border: 1px solid rgba(255, 69, 58, .3);
  color: #ff8a80; font-size: 13px;
}
/* Служебный пузырь со значком (ошибка хода, «остановлено»): значок — тонкий
   stroke-SVG, эмодзи в интерфейсе нет нигде. Не сжимается и держится у первой
   строки, а не уезжает в середину длинного текста ошибки. */
.bubble.withico { display: flex; align-items: flex-start; gap: 7px; }
.bubble.withico .ico.mico { width: 14px; height: 14px; flex: none; margin-top: 2px; opacity: .9; }
/* --------------------------------- она заговорила сама, её никто не спрашивал */
.msg.auto .bubble { border-color: rgba(60, 210, 130, .35); }
.msg.auto .bubble::before {
  content: 'сама'; position: absolute; top: -8px; left: 12px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .3px;
  color: #7ee0a8; background: var(--bg2, #16181d); padding: 0 5px; border-radius: 6px;
}
/* --------------------------------- дозасылка: дописано ПОВЕРХ идущего хода */
.msg.nudge .bubble { border-bottom-right-radius: 18px; }
.msg.nudge .bubble::before {
  content: 'дозасылка'; position: absolute; top: -8px; right: 12px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .3px;
  color: #ffd479; background: var(--bg2, #16181d); padding: 0 5px; border-radius: 6px;
}
/* в живой ход не доехало — отвечает следующим */
.msg.nudge.queued .bubble::before { content: 'дозасылка · в очереди'; color: var(--txt3); }

/* --------------------------------- прыжок к реплике по ссылке (?msg= из пуша) */
/* Подсветка нарастает и гаснет сама: это «вот она», а не тревога, поэтому ни
   вспышек, ни морганий. Красим обводкой, а не тенью: у пузыря человека своя
   тень, и анимация box-shadow гасила бы её на все две секунды. Цвет тёплый
   (тот же, что у метки дозасылки): синяя обводка на синем пузыре человека не
   видна вовсе, а его реплику тоже можно открыть по ссылке. */
.msg.jump .bubble { outline: 2px solid transparent; outline-offset: 2px; animation: msgJump 2.4s ease-in-out; }
@keyframes msgJump {
  0%       { outline-color: rgba(255, 212, 121, 0); }
  15%, 65% { outline-color: rgba(255, 212, 121, .65); }
  100%     { outline-color: rgba(255, 212, 121, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .msg.jump .bubble { animation: none; outline-color: rgba(255, 212, 121, .6); }
}

/* --------------------------------- служебная отметка в ленте («остановлено») */
.msg.note { align-self: center; align-items: center; margin: 0 auto; max-width: 92%; }
.msg.note .bubble {
  background: rgba(255, 255, 255, .05); border: 1px dashed var(--stroke-soft);
  color: var(--txt3); font-size: 12px; padding: 5px 12px; border-radius: 999px;
}
.msg.note .meta { justify-content: center; }

/* --------------------------------- вопрос от неё с кнопками ответа */
.askrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.askopt {
  border: 1px solid rgba(60, 210, 130, .4); background: rgba(60, 210, 130, .1);
  color: #9ceec0; border-radius: 14px; padding: 5px 12px; font-size: 12.5px;
  cursor: pointer; transition: background .18s, transform .12s; font-family: inherit;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.askopt:hover { background: rgba(60, 210, 130, .2); color: #fff; }
.askopt:active { transform: scale(.95); }
.askrow.done .askopt { cursor: default; opacity: .4; }
.askrow.done .askopt.picked { opacity: 1; background: rgba(60, 210, 130, .28); color: #fff; }
/* ------------------------------------------- разметка в её ответах */
/* pre-wrap оставлен для обычного текста, но у размеченного пузыря переносы
   делают уже сами абзацы — иначе после каждого блока зияет пустая строка.
   Тем же набором правил просмотрщик рисует md-файлы (.fv-md) — чтобы
   документ выглядел ровно так же, как её ответ в чате */
.bubble.md { white-space: normal; }
:is(.bubble.md, .fv-md) > :first-child { margin-top: 0; }
:is(.bubble.md, .fv-md) > :last-child { margin-bottom: 0; }
:is(.bubble.md, .fv-md) p { margin: 0 0 8px; }
:is(.bubble.md, .fv-md) :is(h3, h4, h5, h6) {
  margin: 14px 0 6px; font-size: 14.5px; font-weight: 650; line-height: 1.3;
}
:is(.bubble.md, .fv-md) h3 { font-size: 16px; }
:is(.bubble.md, .fv-md) :is(ul, ol) { margin: 0 0 8px; padding-left: 20px; }
:is(.bubble.md, .fv-md) li :is(ul, ol) { margin-bottom: 0; }   /* вложенный список */
:is(.bubble.md, .fv-md) li { margin: 2px 0; }
:is(.bubble.md, .fv-md) b { font-weight: 650; color: var(--txt); }
/* Ссылка в ЛЮБОЙ реплике (задача #303): её ответ, моя реплика, служебный пузырь
   и просмотрщик md-файлов — вид один, детектор адреса у них тоже один.
   Подчёркивание тонкое и ПОСТОЯННОЕ, а не по наведению: на телефоне наведения
   нет вовсе, и ссылка была бы неотличима от текста. Цвет — акцент темы; на
   своём (синем) пузыре и в цветных служебных акцент на своём же фоне не
   читается, там ссылка берёт цвет текста пузыря и держится подчёркиванием.
   Длинный адрес переносится ПО СИМВОЛАМ — иначе одна ссылка растягивает пузырь
   на всю ширину ленты. Значок скачивания вложения (.afdl) сюда не попадает: это
   кнопка, а не ссылка в тексте. */
:is(.bubble, .fv-md) a:not(.afdl) {
  color: var(--blue); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
:is(.bubble, .fv-md) a:not(.afdl):hover { text-decoration-thickness: 2px; }
:is(.msg.user, .msg.error) .bubble a:not(.afdl) { color: inherit; }
/* В тихой отметке («остановлено») текст нарочно приглушён до --txt3, и
   ссылка цветом текста была бы почти не видна — там как раз акцент. */
:is(.bubble.md, .fv-md) code {
  background: rgba(255, 255, 255, .09); padding: 1px 5px; border-radius: 5px;
  font-size: 12.5px; font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
:is(.bubble.md, .fv-md) .md-pre {
  margin: 8px 0; padding: 10px 12px; border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--stroke-soft);
  overflow-x: auto;                      /* длинная строка кода не рвёт пузырь */
}
:is(.bubble.md, .fv-md) .md-pre code { background: none; padding: 0; font-size: 12px; line-height: 1.5; }
:is(.bubble.md, .fv-md) blockquote {
  margin: 6px 0; padding: 2px 0 2px 12px; border-left: 2px solid var(--stroke);
  color: var(--txt2);
}
:is(.bubble.md, .fv-md) hr { border: none; border-top: 1px solid var(--stroke-soft); margin: 12px 0; }
:is(.bubble.md, .fv-md) .md-table {
  border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block;
  overflow-x: auto; max-width: 100%;     /* широкая таблица скроллится сама */
}
:is(.bubble.md, .fv-md) .md-table :is(th, td) {
  border: 1px solid var(--stroke-soft); padding: 5px 9px; text-align: left;
}
:is(.bubble.md, .fv-md) .md-table th { background: rgba(255, 255, 255, .06); font-weight: 600; }

.msg .meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 10.5px; color: var(--txt3); margin: 4px 6px 0; letter-spacing: .3px;
}
.msg .meta .tag { color: var(--pink); font-weight: 600; }
/* Каким мозгом отвечено (задача #196): подпись появляется ТОЛЬКО у ответов не
   того мозга, что стоит по умолчанию, — иначе висела бы у каждой реплики.
   Тон спокойный, чуть холоднее времени рядом: это пометка, а не тревога. */
.msg .meta .mbrain {
  color: #97a4d8; padding-left: 6px; border-left: 1px solid var(--stroke-soft);
}

/* удаление сообщения: круглый ✕ в углу пузыря; 1-й клик — взводит, 2-й — удаляет */
.msg .mdel {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; border: none; cursor: pointer; padding: 0; z-index: 3;
  background: rgba(58, 58, 70, .95); color: var(--txt2); font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.7); transition: opacity .18s, transform .18s, background .18s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .4);
}
.msg .bubble:hover .mdel, .msg .mdel.arm { opacity: 1; transform: none; }
.msg .mdel:hover { background: rgba(84, 84, 98, .95); color: #fff; }
.msg .mdel.arm { background: var(--pink); color: #fff; animation: recPulse 1.2s ease-in-out infinite; }
.msg.gone { opacity: 0; transform: translateX(18px) scale(.95); transition: opacity .25s, transform .25s; }

/* аудиоплеер в пузыре */
.player {
  display: flex; align-items: center; gap: 10px;
  margin-top: 9px; padding-top: 9px; border-top: 1px solid rgba(255, 255, 255, .12);
  min-width: 200px;
}
.msg.user .player { border-top-color: rgba(255, 255, 255, .25); }
.player .pbtn {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
  background: rgba(255, 255, 255, .14); color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .2s; padding: 0;
}
.player .pbtn:hover { background: rgba(255, 255, 255, .25); }
.player .pbtn:active { transform: scale(.9); }
.player .pbtn svg { width: 13px; height: 13px; }
.msg.inject .player .pbtn { background: rgba(255, 55, 95, .35); }
.player .track { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .16); cursor: pointer; position: relative; }
.player .track .fill { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 2px; background: #fff; opacity: .9; transition: width .12s linear; }
.msg.inject .player .track .fill { background: var(--pink); }
.player .tm { font-size: 10.5px; color: rgba(255, 255, 255, .55); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.player .pdl {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .6);
  transition: background .2s, color .2s;
}
.player .pdl:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.player .pdl svg { width: 13px; height: 13px; }

/* кнопка «Озвучить» у неозвученных сообщений (режим «только текст») */
.voicebtn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 9px; padding: 6px 13px 6px 10px; border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, .16); cursor: pointer;
  background: rgba(255, 255, 255, .1); color: inherit;
  font: inherit; font-size: 12px; font-weight: 600;
  transition: background .2s;
}
.voicebtn:hover { background: rgba(255, 255, 255, .18); }
.voicebtn:disabled { opacity: .55; cursor: default; }
.voicebtn svg { width: 11px; height: 11px; }
.msg.inject .voicebtn { border-color: rgba(255, 55, 95, .35); }

/* индикатор «печатает» */
.typing { display: flex; gap: 5px; padding: 14px 16px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--txt3);
  animation: tp 1.2s ease-in-out infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tp { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* живой прогресс claude CLI прямо в пузыре: рассуждение, инструменты
   (десктопная оболочка показывает то же самое в думающем облачке) */
.tprog {
  display: none; max-width: 440px;
  font-size: 11.5px; line-height: 1.5; color: var(--txt3);
  white-space: pre-wrap; word-break: break-word;
}
.tprog:not(:empty) { display: block; animation: msgIn .3s ease; }
/* появился прогресс — точки поджимаем к тексту, чтобы пузырь не пустовал */
.bubble:has(.tprog:not(:empty)) .typing,
.bubble:has(.tagents:not(:empty)) .typing { padding: 2px 3px 8px; }
/* строка прогресса со значком вида (эмодзи в интерфейсе нет) */
.tprog .tpl { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.tprog .tpl + .tpl { margin-top: 2px; }
.tprog .tpi { width: 13px; height: 13px; margin-top: 2px; opacity: .6; }
.tprog .tpl span { min-width: 0; overflow-wrap: anywhere; }

/* --------------------------------------------- вложения в пузырях сообщений */
.atts { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }
.atts:last-child { margin-bottom: 0; }
.atts .aimg {
  display: block; border-radius: 12px; overflow: hidden; max-width: 100%;
  border: 1px solid rgba(255, 255, 255, .14); line-height: 0; cursor: pointer;
  transition: transform .15s, box-shadow .2s;
}
.atts .aimg:hover { transform: scale(1.015); box-shadow: 0 8px 26px rgba(0, 0, 0, .35); }
.atts .aimg img { max-width: 240px; max-height: 190px; object-fit: cover; display: block; }
.atts .afile {
  display: flex; align-items: center; gap: 9px; text-decoration: none; cursor: pointer;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px; padding: 7px 8px 7px 7px; color: inherit; max-width: 260px;
  transition: background .2s;
}
.atts .afile:hover { background: rgba(255, 255, 255, .18); }
/* карточка открывает просмотрщик, иконка — сразу скачивает */
.atts .afdl {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px; color: var(--txt3);
  display: flex; align-items: center; justify-content: center; transition: background .2s, color .2s;
}
.atts .afdl svg { width: 15px; height: 15px; }
.atts .afdl:hover { background: rgba(255, 255, 255, .16); color: var(--txt); }
.msg.user .atts .afdl { color: rgba(255, 255, 255, .7); }
.fico {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: rgba(10, 132, 255, .3); color: #bcdcff;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 800; letter-spacing: .3px;
}
.msg.user .fico { background: rgba(255, 255, 255, .22); color: #fff; }
/* ролик/аудио: вместо букв расширения — треугольник, сразу видно, что играется */
.atts .afile.media .fico { background: rgba(10, 132, 255, .42); color: #fff; }
.atts .afile.media .fico svg { width: 13px; height: 13px; margin-left: 1px; }
.msg.user .afile.media .fico { background: rgba(255, 255, 255, .3); }
.finfo { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.finfo .fn { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finfo .fs { font-size: 10.5px; opacity: .65; }

/* ============ окна чатов прямо на карте работы (задача #300) ==============
   Правый клик (пальцем — долгое нажатие) по карточке чата вешает на карту
   плавающее окно с этим чатом. Внутри — КАДР на саму же страницу в узком
   режиме (?embed=win), поэтому тут только рама: шапка, ручки размера и
   шторка на время жеста.

   Z-INDEX. Слой окон лежит внутри .wm-stage, у которой стоит isolation:
   isolate — это собственный контекст наложения, и числа 10…40 внутри него ни
   с чем снаружи не соревнуются. Общий коридор плавающих окон (55…59 у
   терминалов) и меню #pop на 60 не тронуты вовсе: вся карта вместе с окнами
   по-прежнему стоит на 57. Меню, шторки и подсказки ВНУТРИ окна живут в
   документе кадра — перекрыть их нашей разметкой невозможно в принципе,
   поэтому они кликабельны при любом числе открытых окон. Подсказка карты
   (.wm-tip) поднята выше окон: это курсорная подпись, ей положено быть сверху.

   Место И МАСШТАБ окна задаёт transform из chatwin.js (мировая точка карты →
   экран, дальше scale), поэтому в CSS их нет: left/top остаются нулями, а
   собственных переходов у .cwin нет НИ ОДНОГО — иначе окно догоняло бы карту с
   задержкой и на панораме «отставало» от своей карточки.

   TRANSFORM-ORIGIN 0 0 — не украшение, а условие привязки (задача #302): окно
   масштабируется вместе с картой, и его мировая точка — это ЛЕВЫЙ ВЕРХНИЙ
   УГОЛ. С origin по умолчанию (центр) окно росло бы от своей середины, то есть
   при каждом повороте колеса уезжало бы от карточки на половину своего
   размера, а линия к ней ломалась бы на глазах. */
.wm-stage { isolation: isolate; }
.wm-tip { z-index: 60; }
/* слой сквозной: жесты по пустому месту достаются канвасу карты под ним */
.cwin-layer { position: absolute; inset: 0; pointer-events: none; }
.cwin {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  transform-origin: 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .58);
  /* Появление — ТОЛЬКО прозрачностью, и это не вкусовщина: место окна задаёт
     inline-transform (мировая точка карты → экран), а анимация в каскаде
     сильнее inline-стиля. Общий popIn крутит как раз transform — и первые две
     десятых секунды окно стояло бы в левом верхнем углу полотна, а потом
     прыгало на своё место. */
  animation: cwinIn .18s ease-out;
}
@keyframes cwinIn { from { opacity: 0; } to { opacity: 1; } }
/* prefers-reduced-motion: окно встаёт сразу — ровно как узлы карты. Класс
   вешает chatwin.js, медиазапрос страхует его на случай, когда окно построено
   раньше, чем прочитана настройка. */
.cwin.noanim { animation: none; }
@media (prefers-reduced-motion: reduce) { .cwin { animation: none; } }
.cwin-head {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0; height: 38px;
  padding: 0 6px 0 12px; border-bottom: 1px solid var(--stroke-soft);
  background: rgba(255, 255, 255, .04);
  cursor: move; user-select: none; touch-action: none;
}
.cwin-name {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cwin-head .iconbtn { width: 28px; height: 28px; }
.cwin-head .iconbtn .ico { width: 15px; height: 15px; }
/* Свой масштаб окна (задача #302): тег с процентом появляется, ТОЛЬКО когда
   масштаб не единица — обычное состояние всех окон меткой не подписываем (то
   же правило, что у тега мозга на кнопке чата). */
.cwin-z {
  flex-shrink: 0; font-size: 10px; font-weight: 600; letter-spacing: .02em;
  color: var(--txt3); padding: 1px 4px; border-radius: 6px;
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .05);
}
.cwin-z[hidden] { display: none; }
/* Точка непрочитанного — только на СХЛОПНУТОЙ полоске: в открытом окне человек
   и так читает ленту, и метка «есть новое» поверх неё была бы шумом. Цвет тот
   же жёлтый, что у непрочитанного в списке чатов и на карте (задача #293):
   «жёлтый тут» и «жёлтый там» обязаны быть одним жёлтым. */
.cwin-dot {
  display: none; flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber);
}
.cwin.lod.unread .cwin-dot { display: block; }
/* «Чата больше нет» (задача #302): карта не удержала чат, который мы просили
   удержать, — значит его удалили. Строка в шапке, а не тихое зависание окна на
   последней известной точке: по виду это было не отличить от «чат просто
   затих». Кадр при этом остаётся — прочитать то, что уже загружено, никто не
   мешает. */
.cwin-note {
  display: none; flex-shrink: 0; padding: 3px 12px 4px;
  font-size: 11px; line-height: 1.25; color: var(--amber);
  background: rgba(255, 214, 10, .08);
  border-bottom: 1px solid var(--stroke-soft);
}
.cwin.gone .cwin-note { display: block; }
.cwin.gone .cwin-name { color: var(--txt2); }
.cwin-body { position: relative; flex: 1; min-height: 0; }
.cwin-frame { display: block; width: 100%; height: 100%; border: 0; background: transparent; }
/* Шторка поверх кадра на время жеста: без неё pointermove уходит в ДОКУМЕНТ
   кадра, а не к нам (та же причина, что .sterm-shade у терминала). */
.cwin-shade { position: absolute; inset: 0; z-index: 5; display: none; }
.cwin-h { position: absolute; z-index: 6; touch-action: none; }
.cwin-n { top: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.cwin-s { bottom: 0; left: 12px; right: 12px; height: 6px; cursor: ns-resize; }
.cwin-w { left: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.cwin-e { right: 0; top: 12px; bottom: 12px; width: 6px; cursor: ew-resize; }
.cwin-nw { top: 0; left: 0; width: 13px; height: 13px; cursor: nwse-resize; }
.cwin-ne { top: 0; right: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.cwin-sw { bottom: 0; left: 0; width: 13px; height: 13px; cursor: nesw-resize; }
.cwin-se { bottom: 0; right: 0; width: 15px; height: 15px; cursor: nwse-resize; }
/* Свёрнутое — одна шапка: кадр ПРЯЧЕТСЯ display:none, а не удаляется, поэтому
   документ внутри жив и разворачивание не стоит перезагрузки чата. Высота
   auto, а не зашитые 38px: в шапке бывает вторая строка «чата больше нет», и с
   фиксированным числом она оказалась бы обрезанной. Настоящую высоту chatwin.js
   МЕРЯЕТ, а не повторяет отсюда числом. */
.cwin.min { height: auto !important; }
.cwin.min .cwin-body, .cwin.min .cwin-h { display: none; }
/* СХЛОПНУТОЕ МАСШТАБОМ (задача #302) — то же самое, но решает не человек, а
   размер окна на экране: мельче порога карты (LOD_SUB) в чате всё равно ничего
   не прочесть, а мутное пятно на полотне не нужно никому. Остаётся полоска с
   именем чата и точкой непрочитанного — той же формы, что карточки карты, — и
   линия к своей карточке. Кнопки шапки прячем: на таком масштабе по ним не
   попасть, а промах закрыл бы окно. */
.cwin.lod {
  height: auto !important;
  /* Ширину полоска берёт по ИМЕНИ, а не по окну: пустая четырёхсотпиксельная
     полоса накрывала бы соседние ветки, а «компактная» — это про размер
     карточки карты. Потолок чуть шире карточки чата (196px), чтобы имя влезало
     целиком чаще, чем обрезалось. Настоящую ширину chatwin.js МЕРЯЕТ. */
  width: auto !important; min-width: 120px; max-width: 264px;
}
.cwin.lod .cwin-body, .cwin.lod .cwin-h { display: none; }
.cwin.lod .cwin-head .iconbtn { display: none; }
.cwin.lod .cwin-head { border-bottom: none; background: none; padding-right: 12px; }
.cwin.lod .cwin-name { font-size: 13px; flex: 0 1 auto; }
/* Развёрнутое занимает всё полотно карты; линия к карточке при этом не
   рисуется вовсе — окно накрыло бы её целиком (см. place() в chatwin.js). */
.cwin.max {
  left: 0; top: 0; right: 0; bottom: 0;
  width: auto !important; height: auto !important;
  transform: none !important; border-radius: 0; border: none;
}
.cwin.max .cwin-head { cursor: default; }
.cwin.max .cwin-h { display: none; }

/* ---- страница чата ВНУТРИ окна (?embed=win) ----------------------------
   Та же страница ассистента, только без всего, что окну не нужно: 3D-сцены
   нет (её гасит noAvatar — класс ставит шаблон, а app.js по нему же не грузит
   three.js вовсе), шапки нет — имя чата и кнопки живут в шапке ОКНА, ленты
   характеров и списка чатов нет — чат тут один, он выбран открытием окна.
   Раскладка получается мобильной сама собой: окно узкое, и медиазапросы
   считаются по ширине КАДРА, а не экрана. */
body.winmode #panel header,
body.winmode #chips,
body.winmode #sideChats,
body.winmode #scScrim { display: none !important; }
body.winmode #panel {
  margin: 0; border: none; border-radius: 0; box-shadow: none;
  background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
}
body.winmode { background: transparent; }
body.winmode #app { display: block; height: 100dvh; }
body.winmode #chat { padding-top: 12px; }
/* Окно бывает ниже телефона (его тянут за угол), а меню инструментов длинное:
   без потолка список уезжал бы за нижний край кадра и обрывался молча. */
body.winmode #pop { max-height: calc(100dvh - 14px); overflow-y: auto; }

/* ------------------------------------------------- трей вложений композера */
#attTray {
  display: none; flex-wrap: wrap; gap: 8px; flex-shrink: 0;
  padding: 10px 14px 0;
}
#attTray.on { display: flex; }
#turnActivity { padding: 8px 16px 0; color: var(--txt2); font-size: 11px; flex-shrink: 0; }
#turnActivity b { font-weight: 500; }
#turnActivity small { display: block; margin-top: 3px; color: var(--txt3); line-height: 1.4; }
#turnActivity[data-state="running"] b { color: #77b6ff; }
#turnActivity[data-state="waiting"] b { color: #e9c46a; }
#turnActivity[data-state="error"] b { color: #ff8d8d; }
.attCard {
  position: relative; display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--stroke);
  border-radius: 13px; padding: 7px 30px 7px 7px; max-width: 230px;
  overflow: hidden; animation: msgIn .25s ease;
}
.attCard.img { padding: 0; width: 74px; height: 74px; }
.attCard.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attCard.err { border-color: rgba(255, 69, 58, .55); opacity: .65; }
.attCard .ax {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  border-radius: 50%; border: none; cursor: pointer; padding: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s; z-index: 2;
}
.attCard .ax:hover { background: var(--pink); }
.attCard .aprog {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3.5px;
  background: rgba(255, 255, 255, .12);
}
.attCard .aprog i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--blue), #64b5ff);
  border-radius: 0 3px 3px 0;
  transition: width .15s linear;
  box-shadow: 0 0 8px rgba(10, 132, 255, .8);
}
.attCard:not(.img):not(.done):not(.err) .fico { animation: attPulse 1.2s ease-in-out infinite; }
@keyframes attPulse { 50% { opacity: .5; } }

/* приём файлов перетаскиванием */
#panel.dropfiles { box-shadow: inset 0 0 0 2px var(--blue), 0 24px 70px rgba(0, 0, 0, .45); }

/* --------------------------------------------------------------- композер */
#composer {
  display: flex; align-items: flex-end; gap: 9px;
  padding: 12px 14px 14px; flex-shrink: 0;
  border-top: 1px solid var(--stroke-soft);
}
/* min-width:0 у обоих: у flex-элемента минимальная ширина по умолчанию равна
   содержимому, а у textarea содержимое — это её cols (~20 символов). Без этого
   строка ввода распирала композер, и на телефоне крайняя кнопка (та самая, что
   во время хода становится «Стопом») уезжала за край экрана. */
#composer .box {
  flex: 1; min-width: 0; display: flex; align-items: flex-end;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--stroke-soft);
  border-radius: 22px; padding: 4px 6px 4px 16px;
  transition: border-color .25s, box-shadow .25s;
}
#composer .box:focus-within { border-color: rgba(10, 132, 255, .55); box-shadow: 0 0 0 3.5px rgba(10, 132, 255, .14); }
#composer textarea {
  flex: 1; min-width: 0; width: 100%; box-sizing: border-box;
  border: none; outline: none; background: transparent; resize: none;
  color: var(--txt); font: inherit; font-size: 14.5px; line-height: 1.4;
  max-height: 120px; padding: 8px 0; scrollbar-width: none;
}
#composer textarea::placeholder { color: var(--txt3); }
#composer.locked .box { opacity: .45; pointer-events: none; }
/* Узко для одного ряда (класс вешает fitComposer по живому замеру): поле ввода
   занимает верхнюю строку целиком, круглые кнопки уходят под него в том же
   порядке, а микрофон с отправкой прижимаются вправо — туда, где их ищет
   большой палец. Вертикальный зазор берётся из того же gap. */
#composer.wrap { flex-wrap: wrap; }
#composer.wrap .box { order: -1; flex: 1 0 100%; }
#composer.wrap #micWrap { margin-left: auto; }

.roundbtn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .25s, box-shadow .25s; padding: 0;
}
.roundbtn:active { transform: scale(.9); }
.roundbtn svg { width: 18px; height: 18px; }
#sendBtn { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(10, 132, 255, .35); }
#sendBtn:hover { background: #2e95ff; }
#sendBtn:disabled { background: rgba(255, 255, 255, .1); color: var(--txt3); box-shadow: none; cursor: default; }
/* --------------------------------- идёт ход: та же кнопка становится «Стопом» */
#sendBtn .ico-stop { display: none; }
#sendBtn.stop .ico-send { display: none; }
#sendBtn.stop .ico-stop { display: block; }
#sendBtn.stop {
  background: var(--pink); box-shadow: 0 4px 14px rgba(255, 55, 95, .35);
  animation: stopPulse 1.6s ease-in-out infinite;
}
#sendBtn.stop:hover { background: #ff5274; }
@keyframes stopPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(255, 55, 95, .35); }
  50% { box-shadow: 0 4px 18px rgba(255, 55, 95, .6); }
}
#micBtn, #attBtn, #toolsBtn, #watchBtn, #effortBtn, #brainBtn { background: rgba(255, 255, 255, .09); color: var(--txt2); border: 1px solid var(--stroke-soft); }
#micBtn:hover, #attBtn:hover, #toolsBtn:hover, #watchBtn:hover, #effortBtn:hover, #brainBtn:hover { color: var(--txt); background: rgba(255, 255, 255, .15); }

/* Мониторинг чата: включена — глаз открыт и тихо пульсирует, значит она смотрит
   сюда сама и может написать первой. Выключена — глаз перечёркнут. */
/* Прячем КЛАССОМ, а не display:none по id: JS показывает кнопку сбросом
   инлайнового стиля (btn.style.display = ''), и правило по id тут же выиграло бы
   у .roundbtn{display:flex} — кнопка не появилась бы никогда. */
#watchBtn { position: relative; }
#watchBtn.hidden { display: none; }
#watchBtn .ico-eye { display: none; }
#watchBtn .ico-eye-off { display: block; }
#watchBtn.on .ico-eye { display: block; }
#watchBtn.on .ico-eye-off { display: none; }
#watchBtn.on { color: #7ee0a8; border-color: rgba(60, 210, 130, .45); box-shadow: 0 0 14px rgba(60, 210, 130, .2); }
#watchBtn .wdot {
  position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green, #35d07f); display: none;
}
#watchBtn.on .wdot { display: block; animation: watchPulse 2.6s ease-in-out infinite; }
#watchBtn.snoozed { color: #d9c07a; border-color: rgba(220, 180, 60, .4); box-shadow: none; }
#watchBtn.snoozed .wdot { background: #d9c07a; animation: none; }
@keyframes watchPulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* кнопка инструментов модели: подсвечена, когда в чате что-то включено */
#toolsBtn { position: relative; }
#toolsBtn.on { color: #ff8fa3; border-color: rgba(255, 55, 95, .45); box-shadow: 0 0 14px rgba(255, 55, 95, .22); }
#toolsBtn .tcnt {
  position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px;
  border-radius: 9px; padding: 0 4px; background: var(--pink); color: #fff;
  font-size: 10px; font-weight: 700; display: none; align-items: center; justify-content: center;
}
#toolsBtn.on .tcnt { display: flex; }

/* Глубина размышлений этого чата (задача #151). Прячем классом — по той же
   причине, что и мониторинг: правило по id выиграло бы у .roundbtn{display:flex}.
   Подпись — текущий уровень: точка при «авто» (уровень унаследован) и короткая
   метка, когда у чата он свой; on — как раз «свой». */
#effortBtn { position: relative; }
#effortBtn.hidden { display: none; }
#effortBtn.on { color: #f2c97d; border-color: rgba(240, 190, 80, .45); box-shadow: 0 0 14px rgba(240, 190, 80, .22); }
#effortBtn .ecnt {
  position: absolute; top: -5px; right: -5px; height: 13px; padding: 0 4px;
  border-radius: 7px; background: rgba(255, 255, 255, .16); color: var(--txt2);
  font-size: 8.5px; font-weight: 700; letter-spacing: .2px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
#effortBtn .ecnt:empty { display: none; }
#effortBtn.on .ecnt { background: #f2c97d; color: #2a1e05; }
/* ultracode (задача #348) — своя пометка в нижнем углу: синий кружок со
   значком узлов. Он стоит при любом уровне, поэтому цвет кнопки и метка
   уровня сверху остаются за уровнем — и свой, и унаследованный читаются, как
   раньше. Появляется и гаснет плавно, с лёгким отскоком, как и сам выбор.
   Размер значка — с id в селекторе: иначе его перебили бы общие правила
   .roundbtn svg и мобильное #composer .roundbtn svg. */
#effortBtn .eult {
  position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px;
  border-radius: 50%; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px rgba(16, 16, 24, .95), 0 0 10px rgba(10, 132, 255, .55);
  opacity: 0; transform: scale(.4); pointer-events: none;
  transition: opacity .2s ease, transform .24s cubic-bezier(.2, .9, .3, 1.4);
}
#effortBtn.ultra .eult { opacity: 1; transform: none; }
#effortBtn .eult svg.ico { width: 10px; height: 10px; stroke-width: 2.2; }

/* Мозг этого чата (задача #196). Прячем классом — по той же причине, что
   мониторинг и усилия. Тег появляется только тогда, когда мозг у чата СВОЙ:
   «как в настройках» — это обычное состояние всех чатов, и метка на каждой
   кнопке была бы шумом. Цвет спокойный, холодный — чтобы не спорить с тёплой
   кнопкой усилий по соседству. */
#brainBtn { position: relative; }
#brainBtn.hidden { display: none; }
#brainBtn.on { color: #a9b8ff; border-color: rgba(120, 140, 255, .45); box-shadow: 0 0 14px rgba(120, 140, 255, .2); }
#brainBtn .bcnt {
  position: absolute; top: -5px; right: -5px; height: 13px; padding: 0 4px;
  border-radius: 7px; background: rgba(255, 255, 255, .16); color: var(--txt2);
  font-size: 8.5px; font-weight: 700; letter-spacing: .2px; line-height: 1;
  max-width: 46px; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; justify-content: center;
}
#brainBtn .bcnt:empty { display: none; }
#brainBtn.on .bcnt { background: #a9b8ff; color: #101634; }
/* строка мозга в меню, которую выбрать нельзя: ключа нет в settings.json */
#pop .trow.off { opacity: .45; cursor: default; }
#pop .trow.off:hover { background: none; }

/* под claude CLI кнопка рисует, а не включает инструменты OpenRouter */
#toolsBtn .ico-brush { display: none; }
#toolsBtn.paint .ico-tools { display: none; }
#toolsBtn.paint .ico-brush { display: block; }
#toolsBtn.paint { color: #c6a4ff; border-color: rgba(160, 110, 255, .4); }
#toolsBtn.paint.on { box-shadow: 0 0 14px rgba(160, 110, 255, .3); }
#toolsBtn.paint .tcnt { display: none; }       /* счётчик инструментов тут не при чём */

/* строки дропдауна инструментов: значок — SVG, отметка — галочка, тоже SVG */
#pop .trow { display: flex; align-items: center; gap: 10px; }
#pop .trow .ticon { flex-shrink: 0; color: var(--txt2); display: flex; }
#pop .trow .ticon .ico { width: 17px; height: 17px; }
#pop .trow.on .ticon { color: var(--txt); }
#pop .trow .tname { flex: 1; text-align: left; display: flex; flex-direction: column; }
#pop .trow .tname small { color: var(--txt3); font-size: 10.5px; margin-top: 1px; white-space: nowrap; }
#pop .trow .tick { width: 15px; flex-shrink: 0; color: var(--green); display: flex; }
#pop .trow .tick .ico { width: 15px; height: 15px; stroke-width: 2.6; }

/* Дропдаун «Терминалы» (#271, #274). Машин в нём уже две, и пункт тут не
   галочка, а карточка машины: название и подпись под ним. Строки разделяет
   волосок — он нарисован псевдоэлементом, а не рамкой, иначе подсветка строки
   под курсором обрезала бы себе скруглённый угол. Ширина меню — по самой
   длинной подписи (её `nowrap` этого и добивается); на узком экране подпись
   переносится, чтобы меню не вылезло за край. */
#pop.term-pop { min-width: 214px; max-width: calc(100vw - 24px); }
#pop.term-pop .trow { position: relative; padding: 10px 12px; }
#pop.term-pop .trow + .trow::before {
  content: ''; position: absolute; left: 12px; right: 12px; top: 0; height: 1px;
  background: var(--stroke);
}
@media (max-width: 460px) {
  #pop.term-pop .trow .tname small { white-space: normal; line-height: 1.35; }
}
#micBtn.rec {
  background: var(--pink); color: #fff; border-color: transparent;
  animation: recPulse 1.4s ease-in-out infinite;
}
@keyframes recPulse { 50% { box-shadow: 0 0 0 9px rgba(255, 55, 95, .18); } }
#recTime {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  background: var(--pink); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; display: none; font-variant-numeric: tabular-nums;
}
#micWrap { position: relative; }
#micBtn.rec + #recTime, #micWrap.rec #recTime { display: block; }

/* ---------------------------------------------------------------- задачи */
#taskWrap {
  position: fixed; inset: 0; z-index: 56; visibility: hidden; pointer-events: none;
  /* три панели в ряд: доска справа, левее подробности, ещё левее терминал.
     Каждая следующая ширина отсчитывается от соседей — панели всегда прижаты
     друг к другу и не вылезают за экран */
  --tw-box: min(720px, calc(100vw - 24px));
  --tw-detail: min(560px, calc(100vw - var(--tw-box) - 34px));
  --tw-term: min(620px, calc(100vw - var(--tw-box) - var(--tw-detail) - 44px));
}
#taskWrap.open { visibility: visible; }
#taskBox {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: var(--tw-box);
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: -20px 0 70px rgba(0, 0, 0, .5);
  transform: translateX(calc(100% + 30px));
  transition: transform .45s cubic-bezier(.32, .72, .28, 1);
  display: flex; flex-direction: column; pointer-events: auto;
}
#taskWrap.open #taskBox { transform: none; }
#taskBox .shead { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
#taskBox .shead .t { font-size: 17px; font-weight: 650; }
/* Вкладки доски и терминалов (задача #265). Видны ВСЕГДА: это два экрана одной
   модалки, а не запасной путь для тесноты, как у карты памяти. Вид кнопки общий
   с .map-tabs .tab — второй копии стиля нет */
.task-tabs { display: flex; gap: 6px; flex: 0 0 auto; padding: 0 20px 10px; }
.task-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; }
.task-body::-webkit-scrollbar { width: 8px; }
.task-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; }
/* инпуты в flex-строке распирают её content-шириной, если не прижать */
.task-new input.field, .task-new textarea.field { box-sizing: border-box; min-width: 0; }
.task-new .frow { align-items: center; }
.task-new .task-proj { flex: 1 1 120px; min-width: 0; font-size: 12.5px; }
.task-cols { display: flex; gap: 10px; margin-top: 14px; align-items: flex-start; flex-wrap: wrap; }
.task-list-status:not(:empty) { margin-top: 10px; }
/* вкладка «Терминалы»: доска и её кнопки уходят целиком — форма постановки,
   колонки, «убрать в архив» и «Архив» тут не про что */
.task-terms { display: none; margin-top: 10px; }
#taskBox.terms .task-new,
#taskBox.terms .task-list-status,
#taskBox.terms .task-cols,
#taskBox.terms #taskTidy,
#taskBox.terms #taskArc { display: none; }
#taskBox.terms .task-terms { display: block; }
/* Два раздела вкладки (задача #269): окна ccm и живые сессии claude на ПК.
   Подпись честная — произвольные консоли Windows агент не видит вовсе */
.term-note { font-size: 11px; color: var(--txt3); line-height: 1.45; margin: 2px 2px 12px; }
.term-sec + .term-sec { margin-top: 16px; }
.term-h {
  display: flex; align-items: center; gap: 6px; margin: 0 2px 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--txt3);
}
.term-h .term-n { font-weight: 600; color: var(--txt2); letter-spacing: 0; }
/* карточка окна — та же .task-card, что у задач: рамка выбранного, наведение и
   отступы уже описаны там */
.term-card .tt { font-weight: 600; word-break: break-word; }
/* живая сессия: точка состояния перед именем. Цвет значит ТОЛЬКО состояние —
   те же три цвета, что у сессий в разделе «Этот ПК» */
.live-card .tt { display: flex; align-items: center; gap: 7px; min-width: 0; }
.live-card .tt .nm { min-width: 0; word-break: break-word; }
.live-card .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--txt3); }
.live-card .dot.working { background: #30d158; box-shadow: 0 0 0 3px rgba(48, 209, 88, .18); }
.live-card .dot.idle { background: #ffd60a; }
/* чьё окно: задача или рабочая сессия человека. Строка обязана читаться первой —
   от неё зависит, куда человек сейчас напечатает */
.term-card .tw {
  margin-top: 4px; display: flex; align-items: center; gap: 5px; min-width: 0;
  font-size: 11px; color: var(--txt2);
}
.term-card .tw .ico { width: 12px; height: 12px; flex: none; }
.term-card .tw span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-card .tw.mine { color: #8fd0ff; }
/* окно закрыто на машине (задача #275): запись ещё лежит в реестре ccm, а
   консоли за ней уже нет. Карточка приглушена, подпись словами — и клик по
   ней убирает запись, а не поднимает панель ввода: печатать туда некуда.
   Класс именно .dead: .task-card.gone ниже — это УЕЗЖАЮЩАЯ карточка задачи
   (opacity 0), и мёртвое окно с ним стало бы невидимым */
.term-card.dead { opacity: .48; }
.term-card.dead:hover { opacity: .7; }
.term-card .tw.dead { color: var(--txt3); }
.term-card .tp { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
/* ПК не ответил — красная строка с причиной: пустой список читался бы как
   «терминалов нет» */
.term-empty { padding: 6px 2px; }
.term-bad {
  display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px;
  border-radius: var(--r-sm); background: rgba(255, 69, 58, .12);
  border: 1px solid rgba(255, 69, 58, .3); color: #ff8a80; font-size: 12px;
  line-height: 1.4; word-break: break-word;
}
.term-bad .ico { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.task-col { flex: 1 1 160px; min-width: 0; }
/* архив — не доска, а список: одна колонка на всю ширину */
.task-cols.one .task-col { flex: 1 1 100%; }
.task-col > h4 {
  margin: 0 0 7px 2px; font-size: 11px; font-weight: 600; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--txt3);
}
.task-card {
  padding: 9px 11px; margin-bottom: 6px; border-radius: var(--r-sm); cursor: pointer;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke-soft);
  font-size: 12.5px; line-height: 1.35; transition: background .18s, border-color .18s;
}
.task-card:hover { background: rgba(255, 255, 255, .1); }
.task-card.on { border-color: rgba(10, 132, 255, .6); background: rgba(10, 132, 255, .12); }
/* карточка меняет колонку — тот же узел доезжает до места (FLIP из renderTasks),
   поэтому он на время переезда поднимается над соседями */
.task-card.moving { z-index: 2; position: relative; box-shadow: 0 10px 26px rgba(0, 0, 0, .45); }
.task-card.fresh { animation: taskIn .32s cubic-bezier(.2, .9, .3, 1.2); }
.task-card.gone { opacity: 0; transform: scale(.96); transition: opacity .24s, transform .24s; }
@keyframes taskIn {
  from { opacity: 0; transform: translateY(-6px) scale(.97); }
  to { opacity: 1; transform: none; }
}
/* сколько задача уже работает — тикает на клиенте */
.task-card .trun {
  font-variant-numeric: tabular-nums; color: var(--txt2);
  background: rgba(255, 255, 255, .08); padding: 0 5px; border-radius: 5px;
}
.task-card .tt { color: var(--txt); word-break: break-word; }
/* чего задача ждёт от человека: сам вопрос агента одной строкой, с обрезкой —
   карточка в «ждут тебя» обязана объяснять себя, а не только тикать таймером */
.task-card .tq {
  margin-top: 4px; font-size: 11px; color: #ffd60a; display: flex; align-items: center;
  gap: 4px; min-width: 0;
}
.task-card .tq span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card .tq .ico { width: 12px; height: 12px; flex: none; }
.task-card .tq.bad { color: #ff9f8a; }
.task-card .tm { margin-top: 4px; font-size: 10.5px; color: var(--txt3); }
.task-card .tf { color: #7ee2a0; }
/* уровень усилий агента — показываем, только когда он ниже потолка */
.task-card .teff { color: #c6a4ff; }
/* на каком мозге шла задача — только у НЕ-Клода: «Claude» на каждой карточке
   был бы шумом, а «Kimi K3» объясняет разницу в качестве работы (задача #230) */
.task-card .tbrain { color: #ffb86b; display: inline-flex; align-items: center; gap: 3px;
  vertical-align: -2px; }
.task-card .tbrain .ico { width: 12px; height: 12px; }
/* за задачей ещё висит окно на ПК: сколько ему осталось или что оно приколото */
.task-card .tterm { color: #8fd0ff; display: inline-flex; align-items: center; gap: 3px;
  vertical-align: -2px; }
.task-card .tterm .ico { width: 12px; height: 12px; }
.task-col.running .task-card { border-left: 2px solid #30d158; }
.task-col.needs_you .task-card { border-left: 2px solid #ffd60a; }
/* подробности задачи и вывод терминала — две самостоятельные панели слева от
   сайдбара, стекло и тень как у него, у каждой своя шапка с крестиком и свой
   скролл. Ширины — из переменных #taskWrap, панель всегда прижата к соседу */
.task-detail, .task-term {
  position: absolute; top: 12px; bottom: 12px;
  display: flex; flex-direction: column; min-height: 0;
  padding: 12px 14px; font-size: 13px;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: -20px 0 70px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateX(26px); pointer-events: none;
  transition: opacity .3s, visibility .3s, transform .45s cubic-bezier(.32, .72, .28, 1);
}
.task-detail { right: calc(var(--tw-box) + 22px); width: var(--tw-detail); }
.task-term { right: calc(var(--tw-box) + var(--tw-detail) + 32px); width: var(--tw-term); }
/* На вкладке окон панели подробностей нет вовсе, и терминал встаёт на её место —
   вплотную к списку, а не через пустую колонку. Только для широкого экрана: ниже
   1600px терминал и так ложится поверх, и та медиазапись главнее по порядку */
@media (min-width: 1601px) {
  #taskWrap.termstab .task-term { right: calc(var(--tw-box) + 22px); width: var(--tw-detail); }
}
/* видны только при открытом сайдбаре: закрыли его — уехали и они, даже с on.
   Терминал вдобавок ждёт вывода (hasterm) и, на узком экране, кнопки (termopen) */
#taskWrap.open .task-detail.on,
#taskWrap.open.hasterm.termopen .task-term {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
}
.task-detail .shead, .task-term .shead {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 0 0 10px;
}
.task-detail .shead .t, .task-term .shead .t { font-size: 15px; font-weight: 650; }
.task-detail .shead .t { flex: 1; }
.task-term .tid {
  flex: 1; min-width: 0; font-size: 11px; color: var(--txt3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* крестик крупный: в него надо попадать пальцем на телефоне */
.task-detail .xbtn, .task-term .xbtn { width: 40px; height: 40px; margin: -3px -5px -3px 0; }
.td-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
/* скролл этих панелей — тонкий и без нативных стрелок: страница только тёмная,
   поэтому бегунок светлый полупрозрачный. Треку фон не задаём, иначе полоса
   рисуется поверх стекла. scrollbar-width отдаём только Firefox: в Chromium это
   свойство гасит ::-webkit-scrollbar и возвращает системную полосу в 11px.
   Правила общие и второй копии у них нет: `.xterm-viewport` — контейнер
   прокрутки окна терминала (#274). Своим именем он тут не случайно: контейнер
   этот заводит сам xterm, вендорный xterm.css задаёт ему собственные свойства,
   и правила соседних панелей до него не долетают — а системная полоса со
   стрелками на чёрном поле терминала видна лучше всего. */
@supports not selector(::-webkit-scrollbar) {
  .td-body, .td-screen, .xterm-viewport {
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent;
  }
}
.td-body::-webkit-scrollbar, .td-screen::-webkit-scrollbar,
.xterm-viewport::-webkit-scrollbar { width: 6px; height: 6px; }
/* пальцем за полосу всё равно не тянут — на тач-экране она ещё тоньше */
@media (pointer: coarse) {
  .td-body::-webkit-scrollbar, .td-screen::-webkit-scrollbar,
  .xterm-viewport::-webkit-scrollbar { width: 4px; height: 4px; }
}
.td-body::-webkit-scrollbar-track, .td-screen::-webkit-scrollbar-track,
.xterm-viewport::-webkit-scrollbar-track,
.td-body::-webkit-scrollbar-corner, .td-screen::-webkit-scrollbar-corner,
.xterm-viewport::-webkit-scrollbar-corner { background: transparent; }
/* кнопки-стрелки по краям полосы (Windows) — это и есть главная уродливость */
.td-body::-webkit-scrollbar-button, .td-screen::-webkit-scrollbar-button,
.xterm-viewport::-webkit-scrollbar-button {
  display: none; width: 0; height: 0;
}
.td-body::-webkit-scrollbar-thumb, .td-screen::-webkit-scrollbar-thumb,
.xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .14); border-radius: 3px;
}
.td-body::-webkit-scrollbar-thumb:hover, .td-screen::-webkit-scrollbar-thumb:hover,
.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .24);
}
.task-detail .td-prompt { color: var(--txt2); white-space: pre-wrap; word-break: break-word; }
/* почему задача не пошла: красная плашка с причиной, а при отсутствующей папке
   проекта — ещё и кнопка завести её прямо отсюда */
.task-detail .td-err {
  margin-top: 8px; padding: 7px 9px; border-radius: var(--r-sm);
  background: rgba(255, 69, 58, .12); border: 1px solid rgba(255, 69, 58, .3);
  color: #ff8a80; font-size: 12px; line-height: 1.4; word-break: break-word;
}
.task-detail .td-err .frow { margin-top: 6px; }
.task-detail .td-err > .ico { width: 14px; height: 14px; float: left; margin: 1px 6px 0 0; }
/* когда закроется окно задачи — строкой со значком часов */
.task-detail .td-note { margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.task-detail .td-note .ico { width: 12px; height: 12px; }
.task-detail .td-note.bad { color: #ff9f8a; }
/* чем работать и сколько думать (задача #230): две кнопки в ряд, подписи
   ужимаются — у модели OpenRouter имя бывает в полсотни знаков */
/* на узком экране кнопки переносятся, а не выдавливают друг друга за край */
.task-detail .td-brain { margin-top: 6px; flex-wrap: wrap; }
.task-detail .td-brain .btn { min-width: 0; }
.task-detail .td-brain .btn span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* работающей задаче мозг менять нечего: окно уже открыто. Кнопка не исчезает —
   иначе не видно, на чём она идёт, — а гаснет и говорит это словами */
.task-detail .td-brain .btn.off { opacity: .5; }
/* как ТЗ доехало до агента: текстом или файлом (и каким именно) */
.task-detail .td-sends { margin-top: 8px; line-height: 1.5; }
.task-detail .td-sends .tpath {
  font-family: ui-monospace, Consolas, monospace; color: #8fd0ff;
  word-break: break-all; user-select: all;
}
/* экран терминала — на всю свою панель, длинный вывод скроллится внутри */
.td-screen {
  flex: 1 1 auto; min-height: 0; padding: 9px 11px; overflow: auto;
  background: rgba(0, 0, 0, .4); border-radius: var(--r-sm);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.35;
  white-space: pre; color: var(--txt2);
}
/* полоска быстрых клавиш под экраном: строгие подписи, ничего лишнего. Кнопки
   мелкие, но не меньше пальца по высоте — с телефона это единственный способ
   ответить агенту на «1. Yes / 2. No» */
.task-term .td-keys {
  display: flex; flex-wrap: wrap; gap: 5px; flex: 0 0 auto; padding: 8px 0 0;
}
.task-term .kbtn {
  min-width: 34px; height: 30px; padding: 0 9px; border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .07); border: 1px solid var(--stroke);
  color: var(--txt2); font-size: 12px; line-height: 1;
  font-family: ui-monospace, Consolas, monospace; cursor: pointer;
  transition: background .15s, color .15s;
}
.task-term .kbtn:hover { background: rgba(255, 255, 255, .14); color: var(--txt); }
.task-term .kbtn:active { background: rgba(255, 255, 255, .2); }
/* Ручка растягивания панели терминала (задача #269). Тянут за ЛЕВЫЙ край:
   панель прижата к правому и растёт влево, как и все три панели модалки.
   На телефоне её нет вовсе: там панель и так во весь экран, а полоска у края
   съела бы прокрутку пальцем */
.task-term .grip {
  display: none; position: absolute; left: -4px; top: 0; bottom: 0; width: 12px;
  z-index: 3; cursor: ew-resize; touch-action: none;
}
.task-term .grip::before {
  content: ''; position: absolute; left: 5px; top: 50%; width: 2px; height: 44px;
  margin-top: -22px; border-radius: 2px; background: rgba(255, 255, 255, .16);
  transition: background .18s;
}
.task-term .grip:hover::before,
#taskWrap.rzterm .task-term .grip::before { background: rgba(255, 255, 255, .45); }
@media (min-width: 901px) { .task-term .grip { display: block; } }
/* пока тянут — ни выделения текста, ни курсора-каретки над экраном вывода */
#taskWrap.rzterm, #taskWrap.rzterm * { user-select: none; cursor: ew-resize !important; }

/* «Убрать зеркало» в шапке панели (задача #269) — только у наших окон поверх
   чужих консолей. Ввод при этом работает везде: это кнопка про наше окно, а не
   про права. Меньше крестика: закрывают панель чаще, чем снимают зеркало */
#tdMirrorOff { display: none; width: 30px; height: 30px; }
#tdMirrorOff svg { width: 15px; height: 15px; }
#taskWrap.mirterm #tdMirrorOff { display: flex; }
/* своя строка ввода панели терминала: инпут обязан сжиматься, иначе распирает */
.task-term .td-termsay { display: flex; gap: 6px; flex: 0 0 auto; margin-top: 8px; }
.task-term .td-termsay .field { flex: 1 1 100px; min-width: 0; box-sizing: border-box; }
.task-term .td-termsay .btn { flex: 0 0 auto; }
.task-detail .frow { margin-top: 10px; flex-wrap: wrap; gap: 6px; }
/* строка дозаброса: инпут обязан сжиматься, иначе распирает карточку */
.task-detail .td-say { flex-wrap: nowrap; }
.task-detail .td-say .field { flex: 1 1 120px; min-width: 0; box-sizing: border-box; }
.task-detail .td-say .btn { flex: 0 0 auto; }
/* кнопка «Терминал» в карточке — только когда панели терминала не видно
   (узкий экран или закрыли крестиком), а показать есть что */
.td-termrow { display: none; }
#taskWrap.hasterm:not(.termopen) .td-termrow { display: flex; }
/* на три панели не хватает — терминал ложится поверх доски, поднимается кнопкой */
@media (max-width: 1600px) {
  .task-term {
    top: auto; right: 12px; bottom: 12px; z-index: 4;
    width: min(760px, calc(100vw - 24px)); height: min(70vh, 640px);
    transform: translateY(24px);
  }
}
/* узко — слева места уже нет: панель ложится поверх низа сайдбара, шапка и верх
   доски остаются видимыми, так что другую карточку можно выбрать не закрывая */
@media (max-width: 1200px) {
  .task-detail {
    top: auto; right: 12px; bottom: 12px; z-index: 2;
    width: min(720px, calc(100vw - 24px)); max-height: 62vh;
    transform: translateY(24px);
  }
}
/* телефон: подробности и терминал разворачиваются на весь экран друг поверх
   друга, обратно — крестиком в шапке (доска -> карточка -> терминал).
   Отступ сверху с запасом на чёлку */
@media (max-width: 900px) {
  .task-detail, .task-term {
    top: calc(10px + env(safe-area-inset-top)); right: 10px; bottom: 10px; left: 10px;
    width: auto; height: auto; max-height: none;
  }
}

/* ------------------------------------------------------- карта работы
   Что крутится прямо сейчас (задача #164). Коробка — по образцу карты
   памяти, а всё содержимое рисует canvas: подписи, узлы и связи там же,
   поэтому в CSS живут только рама, подсказка и легенда. */
#wmWrap {
  position: fixed; inset: 0; z-index: 57; visibility: hidden; opacity: 0;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px);
  transition: opacity .3s, visibility .3s;
}
#wmWrap.open { visibility: visible; opacity: 1; }
#wmBox {
  position: absolute; inset: 24px; display: flex; flex-direction: column;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  transform: scale(.97); transition: transform .35s cubic-bezier(.2, .9, .3, 1.1);
  overflow: hidden;
}
#wmWrap.open #wmBox { transform: none; }
#wmBox .shead { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
#wmBox .shead .t { font-size: 17px; font-weight: 650; }
/* Атрибут hidden обязан гасить кнопку «собрать окна» (задача #300): у .iconbtn
   стоит display:flex, а правило автора сильнее UA-шного [hidden]{display:none}
   — те же грабли, что в #omBox и #bhBox. Правило одно на всю коробку: точечные
   `.класс[hidden]` разъедутся на первом же новом элементе. */
#wmBox [hidden] { display: none !important; }
/* строка счётчиков: «3 чата · 2 задачи · 6 агентов» — её пишет workmap.js */
.wm-info {
  flex: 1; min-width: 0; font-size: 11.5px; color: var(--txt3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wm-stage { position: relative; flex: 1; min-height: 0; }
/* touch-action: полотно двигают пальцем, и браузер не должен уводить страницу */
#wmCanvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#wmCanvas.drag { cursor: grabbing; }
#wmCanvas.hit { cursor: pointer; }

/* подпись под курсором: коробка следует за узлом, текст пишет canvas-слой */
.wm-tip {
  position: absolute; left: 0; top: 0; max-width: 260px; pointer-events: none;
  padding: 7px 10px; border-radius: 10px; font-size: 11.5px; line-height: 1.45;
  background: rgba(12, 12, 18, .92); border: 1px solid var(--stroke);
  color: var(--txt); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(3px); transition: opacity .14s, transform .14s;
}
.wm-tip.on { opacity: 1; transform: none; }
.wm-tip b { font-weight: 650; }
.wm-tip small { display: block; margin-top: 2px; color: var(--txt3); font-size: 10.5px; }

/* подвал карты: легенда слева, переключатель полного списка справа. Раньше
   легенда висела поверх полотна абсолютом — рядом с ней некуда было поставить
   живую кнопку, а карту она собой закрывала. */
.wm-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px 13px; border-top: 1px solid var(--stroke-soft);
}
.wm-legend {
  display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0;
  font-size: 11px; color: var(--txt3); pointer-events: none; flex-wrap: wrap;
}
.wm-legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: -1px; background: var(--txt3);
}
/* цвет на карте означает ТОЛЬКО состояние работы — тем же цветом и легенда */
.wm-legend i.run { background: var(--blue); }
.wm-legend i.wait { background: var(--amber); }
.wm-legend i.err { background: var(--pink); }
.wm-legend i.idle { background: rgba(235, 235, 245, .34); }
.wm-legend .wm-hint { color: rgba(235, 235, 245, .22); }
/* «все чаты» — тумблер, а не кнопка-действие: включённый виден по заливке */
.wm-all {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px 6px 10px; border-radius: 100px; cursor: pointer;
  background: rgba(255, 255, 255, .055); border: 1px solid var(--stroke-soft);
  color: var(--txt3); font-size: 11.5px; font-weight: 500; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .12s;
}
.wm-all .ico { width: 15px; height: 15px; opacity: .85; }
.wm-all:hover { background: rgba(255, 255, 255, .1); color: var(--txt2); }
.wm-all:active { transform: scale(.96); }
.wm-all.on {
  background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2);
  color: var(--txt); font-weight: 600;
}

@media (max-width: 900px) {
  #wmBox { inset: 8px; }
  #wmBox .shead { padding: 12px 12px 6px; }
  #wmBox .shead .t { font-size: 15.5px; }
  .wm-foot { padding: 8px 10px 10px; gap: 8px; }
  .wm-legend { gap: 9px; font-size: 10.5px; }
  .wm-legend .wm-hint { display: none; }        /* мышиных жестов тут нет */
  .wm-all { padding: 5px 10px 5px 8px; font-size: 11px; }
}
/* поле эмбеддера + кнопка досчёта: инпут не должен распирать строку */
#fMemEmb { flex: 1 1 120px; min-width: 0; }
#memEmbBtn { flex: 0 0 auto; padding: 10px 14px; }

body.noAvatar #panel { width: auto !important; flex: 1; margin: 14px; }
body.noAvatar #chatFab, body.noAvatar #chatCollapse { display: none !important; }
body.noAvatar #panel header .title small { display: none; }
@media (max-width: 900px) {
  #app { display: block; height: 100dvh; }
  #stage { position: absolute; inset: 0; }
  /* чат — фуллскрин-шторка снизу; свёрнут по умолчанию, разворачивается FAB-ом */
  #panel {
    position: fixed; inset: 0; width: auto !important; margin: 0; border-radius: 0;
    z-index: 40; transform: translateY(103%);
    transition: transform .5s cubic-bezier(.32, .72, .28, 1);
  }
  body.chatOpen #panel { transform: none; }
  body.noAvatar #panel { transform: none; margin: 0; }
  #panel header { padding-top: calc(16px + env(safe-area-inset-top)); }
  #panel header .title small { display: none; }
  /* На телефоне в строке пять кнопок (инструменты, файл, глаз, микрофон и
     отправка-она-же-стоп) — ужимаем их и отступы, чтобы полю ввода осталось
     живое место, а крайняя кнопка была под большим пальцем, а не за экраном. */
  #composer { padding: 12px 10px calc(14px + env(safe-area-inset-bottom)); gap: 7px; }
  #composer .roundbtn { width: 36px; height: 36px; }
  #composer .roundbtn svg { width: 17px; height: 17px; }
  #composer .box { padding-left: 13px; }
  #panelResizer { display: none; }
  #nameplate { display: none; }
  #chatFab { display: flex; }
  #chatCollapse { display: flex; }
}

/* Каталог общий для веба, embed=win и desktop. */
#chatFilesBar { display:flex; align-items:center; gap:12px; padding:5px 14px; border-bottom:1px solid var(--stroke-soft); flex-shrink:0; min-width:0; }
#chatFilesTitle { color:var(--txt2); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
#chatFilesBtn, #deskFilesBtn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:34px; flex-shrink:0; padding:5px 10px; background:rgba(128,128,128,.09); color:var(--txt,#ececec); border:1px solid var(--stroke,rgba(255,255,255,.12)); border-radius:8px; font:inherit; font-size:12px; cursor:pointer; }
#chatFilesBtn:hover, #deskFilesBtn:hover { background:rgba(128,128,128,.18); }
#chatFilesBtn svg, #deskFilesBtn svg { width:16px; height:16px; }
/* ---------------------------------------- настройки (сайдбар, без затемнения) */
#sheetWrap {
  position: fixed; inset: 0; z-index: 50; visibility: hidden; pointer-events: none;
}
#sheetWrap.open { visibility: visible; }
#sheetWrap #sheet { pointer-events: auto; }
#sheet {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px));
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: -20px 0 70px rgba(0, 0, 0, .5);
  transform: translateX(calc(100% + 30px));
  transition: transform .45s cubic-bezier(.32, .72, .28, 1);
  display: flex; flex-direction: column; overflow: hidden;
}
#sheetWrap.open #sheet { transform: none; }
#sheet .shead {
  display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; flex-shrink: 0;
}
/* Заголовок ужимается первым: в шапке кроме него баланс, «Сохранить» и крестик,
   и на телефоне ряд обязан остаться одной строкой. */
#sheet .shead .t {
  font-size: 17px; font-weight: 650; flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* «Сохранить» переехало из подвала простыни в шапку — иначе до кнопки надо было
   докрутить все настройки. Тут она не на всю ширину, а пилюлей вровень с балансом. */
#sheet .shead .btn.primary {
  width: auto; flex-shrink: 0; height: 30px; padding: 0 15px;
  border-radius: 100px; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(10, 132, 255, .28); white-space: nowrap;
}
#sheet .shead .balpill, #sheet .shead .iconbtn { flex-shrink: 0; }
#sheet .sbody { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 20px 20px; }
#sheet .sbody::-webkit-scrollbar { width: 8px; }
#sheet .sbody::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; }
/* Телефон: шторка почти во весь экран, а в шапке четыре элемента — поджимаем
   поля и промежутки, чтобы ряд не сорвался во вторую строку (считано на 390px). */
@media (max-width: 560px) {
  #sheet .shead { gap: 7px; padding: 16px 14px 10px; }
  #sheet .shead .t { font-size: 16px; }
  #sheet .shead .balpill { padding: 0 10px; }
  #sheet .shead .btn.primary { padding: 0 13px; }
  #sheet .sbody { padding: 4px 14px 20px; }
}

.fgroup { margin-top: 18px; }
.fgroup > label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--txt3); margin: 0 2px 7px;
}
.frow { display: flex; gap: 8px; }
/* Ряд настроек сознания: узкие поля в ряд. min-width:0 обязателен — у flex-элемента
   он по умолчанию auto (=ширина контента), и number-инпут распирал бы колонку. */
.brow { display: flex; gap: 8px; align-items: flex-end; }
.brow .bcell { flex: 1 1 0; min-width: 0; }
.brow .bcell label { font-size: 10px; letter-spacing: .6px; margin-bottom: 5px; }
.brow .bcell .field { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px 10px; }
.brow .bcell .seg .opt { padding: 8px 8px; font-size: 11.5px; }
@media (max-width: 520px) { .brow { flex-wrap: wrap; } .brow .bcell { flex: 1 1 46%; } }
.field {
  width: 100%; background: rgba(255, 255, 255, .07); border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm); color: var(--txt); font: inherit; font-size: 13.5px;
  padding: 10px 13px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field:focus { border-color: rgba(10, 132, 255, .55); box-shadow: 0 0 0 3px rgba(10, 132, 255, .13); }
textarea.field { resize: vertical; min-height: 84px; line-height: 1.45; }
.hint { font-size: 11.5px; color: var(--txt3); margin: 6px 2px 0; line-height: 1.5; }
.hint code { color: var(--txt2); background: rgba(255, 255, 255, .07); padding: 1px 5px; border-radius: 5px; font-size: 10.5px; }

/* Полки памяти — под аккордеон: их бывает под сотню, и сплошным перечислением
   через запятую они съедали пол-шторки настроек. Свёрнуто это одна строка,
   раскрыто — сетка «имя (число)» со своей прокруткой. */
.shelves { margin-top: 6px; }
.shelves > summary {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none;
  padding: 5px 11px; border-radius: 100px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke-soft);
  color: var(--txt2); font-size: 11.5px; font-weight: 600;
  transition: background .2s, color .2s;
}
.shelves > summary::-webkit-details-marker { display: none; }
.shelves > summary:hover { background: rgba(255, 255, 255, .11); color: var(--txt); }
.shelves > summary::after { content: '▸'; font-size: 10px; color: var(--txt3); transition: transform .18s; }
.shelves[open] > summary::after { transform: rotate(90deg); }
.shelves .slist {
  margin-top: 7px; max-height: 40vh; overflow-y: auto; padding: 8px 10px;
  border-radius: var(--r-sm); background: rgba(0, 0, 0, .22); border: 1px solid var(--stroke-soft);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 1px 14px;
  font-family: 'SF Mono', ui-monospace, Consolas, monospace; font-size: 10.5px; line-height: 1.7;
}
.shelves .slist::-webkit-scrollbar { width: 8px; }
.shelves .slist::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; }
.shelves .slist .sh { display: flex; gap: 8px; min-width: 0; }
.shelves .slist .sh .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--txt2); }
.shelves .slist .sh .n { margin-left: auto; color: var(--txt3); font-variant-numeric: tabular-nums; }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .opt {
  padding: 8px 15px; border-radius: 100px; cursor: pointer; font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--stroke-soft); color: var(--txt2);
  transition: all .2s; user-select: none;
}
.seg .opt:hover { background: rgba(255, 255, 255, .11); }
.seg .opt.on { background: var(--txt); color: #111; border-color: transparent; font-weight: 600; }
/* значок внутри пункта сегмента (карандаш «вписать вручную», глаз, динамик…) */
.seg .opt { display: inline-flex; align-items: center; gap: 6px; }
.seg .opt .ico { width: 14px; height: 14px; }
/* строка состояния сознания начинается с треугольника-предупреждения */
.hint > .ico { width: 13px; height: 13px; display: inline-block; vertical-align: -2px;
  margin-right: 5px; }

.codebox {
  position: relative; margin-top: 8px;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--stroke-soft); border-radius: var(--r-sm);
  padding: 11px 40px 11px 13px; font-family: 'SF Mono', ui-monospace, Consolas, monospace;
  font-size: 11px; color: var(--txt2); line-height: 1.55;
  word-break: break-all; white-space: pre-wrap;
}
.codebox .copy {
  position: absolute; top: 7px; right: 7px; width: 26px; height: 26px;
  border-radius: 8px; border: none; background: rgba(255, 255, 255, .08); color: var(--txt2);
  cursor: pointer; font-size: 12px; transition: background .2s;
}
.codebox .copy:hover { background: rgba(255, 255, 255, .16); color: var(--txt); }

/* поиск моделей */
#modelResults { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mrow {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 12px;
  animation: msgIn .25s ease; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.mrow:hover { background: rgba(255, 255, 255, .1); border-color: rgba(10, 132, 255, .4); }
.fgroup > label .catlink {
  float: right; cursor: pointer; color: #7cbaff;
  text-transform: none; letter-spacing: .2px; font-weight: 500;
}
.fgroup > label .catlink:hover { color: #fff; }

/* список анимаций */
#animList { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; max-height: 42vh; overflow-y: auto; }
#animList::-webkit-scrollbar { width: 8px; }
#animList::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }
.arow {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm); padding: 6px 9px; font-size: 12px;
}
.arow.assigned { border-color: rgba(48, 209, 88, .35); }
.arow .aplay {
  width: 27px; height: 27px; border-radius: 9px; border: none; cursor: pointer; flex-shrink: 0;
  background: rgba(255, 255, 255, .1); color: var(--txt); font-size: 11px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: background .2s;
}
/* «слушать» и «стоп» — тонкие SVG вместо символов-значков (задача #348) */
.arow .aplay .ico { width: 13px; height: 13px; }
.arow .aplay:hover { background: rgba(10, 132, 255, .4); }
.arow .aplay.on { background: var(--pink); }
.arow .aname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.arow .aset { display: flex; gap: 3px; flex-shrink: 0; }
.arow .aset .opt { padding: 4px 8px; font-size: 10px; border-radius: 8px; }
.mrow .info { flex: 1; min-width: 0; }
.mrow .mid { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .sub { color: var(--txt3); font-size: 11px; margin-top: 2px; }
.mrow .sub .free { color: var(--green); font-weight: 600; }
.mrow .use {
  border-radius: 8px; padding: 6px 10px;
  background: rgba(10, 132, 255, .18); color: #7cbaff; font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.mrow:hover .use { background: rgba(10, 132, 255, .4); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px; padding: 12px 22px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600;
  transition: transform .15s, background .25s, box-shadow .25s;
}
.btn:active { transform: scale(.97); }
.btn .ico { width: 15px; height: 15px; margin-right: -2px; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 6px 20px rgba(10, 132, 255, .3); width: 100%; }
.btn.primary:hover { background: #2e95ff; }
.btn.ghost { background: rgba(255, 255, 255, .07); color: var(--txt2); border: 1px solid var(--stroke-soft); }
.btn.ghost:hover { color: var(--txt); background: rgba(255, 255, 255, .12); }
/* включённый тумблер-кнопка (например «окно остаётся») */
.btn.ghost.on { color: var(--txt); background: rgba(255, 214, 10, .18); border-color: rgba(255, 214, 10, .45); }
/* кнопка взведена — второй клик сделает необратимое (прервать агента) */
.btn.ghost.arm { color: #ff8a80; background: rgba(255, 69, 58, .18); border-color: rgba(255, 69, 58, .5); }

/* ---------------------------------------------------------------- память */
#memWrap { position: fixed; inset: 0; z-index: 56; visibility: hidden; pointer-events: none; }
#memWrap.open { visibility: visible; }
#mem {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(680px, calc(100vw - 24px));
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: -20px 0 70px rgba(0, 0, 0, .5);
  transform: translateX(calc(100% + 30px));
  transition: transform .45s cubic-bezier(.32, .72, .28, 1);
  display: flex; flex-direction: column; pointer-events: auto;
}
#memWrap.open #mem { transform: none; }
#mem .shead { display: flex; align-items: center; gap: 10px; padding: 18px 20px 12px; }
#mem .shead .t { font-size: 17px; font-weight: 650; flex: 1; }
#mem .memcnt { font-size: 11.5px; color: var(--txt3); }
.mem-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 4px 16px 16px; }
/* инпуты в flex-строках: без этого распирают контейнер своей content-шириной */
.mem-body input.field { box-sizing: border-box; min-width: 0; }
.mem-new .frow { align-items: center; }
.mem-new .mem-slot { flex: 1 1 90px; min-width: 0; font-size: 12.5px; }
.mem-new .mem-pin { flex: 0 0 auto; padding: 10px 12px; }
.mem-new .mem-pin.on { background: rgba(255, 214, 10, .22); border-color: rgba(255, 214, 10, .5); }
.mem-new .mem-go { flex: 0 0 auto; }
.mem-tools { margin-top: 14px; align-items: center; }
.mem-tools .field { flex: 1 1 120px; min-width: 0; }
.mem-tools .seg { flex: 0 0 auto; }
.mem-kinds { margin-top: 8px; }
#memList {
  flex: 1; min-height: 90px; overflow-y: auto; margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
#memList::-webkit-scrollbar { width: 8px; }
#memList::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 4px; }
.mrow {
  display: flex; align-items: flex-start; gap: 9px; padding: 9px 11px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm); font-size: 13px; line-height: 1.4;
}
.mrow.dead { opacity: .42; }
.mrow .mkind {
  font-size: 9.5px; font-weight: 700; padding: 3px 7px; border-radius: 7px;
  flex-shrink: 0; text-transform: uppercase; margin-top: 1px;
}
.mrow .mkind.fact { background: rgba(10, 132, 255, .2); color: #7cbaff; }
.mrow .mkind.rule { background: rgba(255, 214, 10, .18); color: #ffd60a; }
.mrow .mkind.episode { background: rgba(191, 90, 242, .18); color: #d8a4ff; }
.mrow .mkind.project { background: rgba(48, 209, 88, .18); color: #7ee2a0; }
.mrow .mmain { flex: 1; min-width: 0; }
.mrow .mtext { color: var(--txt); word-break: break-word; }
.mrow[contenteditable] { outline: none; }
.mrow .mmeta { margin-top: 3px; font-size: 10.5px; color: var(--txt3); display: flex; gap: 8px; flex-wrap: wrap; }
.mrow .mmeta .slot { color: #7ee2a0; }
.mrow .mact { display: flex; gap: 4px; flex-shrink: 0; }
.mrow .mact button {
  width: 26px; height: 26px; border-radius: 8px; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .08); color: var(--txt2); font-size: 12px; transition: all .18s;
}
.mrow .mact button { display: flex; align-items: center; justify-content: center; padding: 0; }
.mrow .mact button .ico { width: 14px; height: 14px; }
.mrow .mact button:hover { background: rgba(255, 255, 255, .18); color: #fff; }
/* секретная запись: ключ + подпись одной строкой */
.mrow .msec { color: #ffd60a; display: inline-flex; align-items: center; gap: 4px;
  vertical-align: -2px; }
.mrow .msec .ico { width: 12px; height: 12px; }
/* закреплена, но в лоток закреплённых не влезла (задача #333); на узком экране
   подпись ложится в несколько строк — значок держится первой, а не середины */
.mrow .mover { color: #ff9f0a; display: inline-flex; align-items: flex-start; gap: 4px;
  vertical-align: -2px; }
.mrow .mover .ico { width: 12px; height: 12px; flex: 0 0 auto; margin-top: 1px; }
/* сводка диалога начинается со значка скрепки */
.mrow .mmeta > .ico { width: 12px; height: 12px; display: inline-block; vertical-align: -2px;
  margin-right: 4px; }
.mrow .mact button.on { background: rgba(255, 214, 10, .25); color: #ffd60a; }
.mrow .mact button.del:hover { background: rgba(255, 69, 58, .35); color: #fff; }
.mem-check { margin-top: 12px; flex-shrink: 0; }
.mem-check > label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--txt3); margin: 0 2px 7px;
}
.mem-block {
  margin: 8px 0 0; padding: 10px 12px; max-height: 22vh; overflow: auto;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--stroke-soft);
  border-radius: var(--r-sm); font-size: 11.5px; line-height: 1.5; color: var(--txt2);
  white-space: pre-wrap; word-break: break-word;
}
.mem-block:empty { display: none; }

/* Каталог общий для веба, embed=win и desktop. */
#chatFilesBar { display:flex; align-items:center; gap:12px; padding:5px 14px; border-bottom:1px solid var(--stroke-soft); flex-shrink:0; min-width:0; }
#chatFilesTitle { color:var(--txt2); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
#chatFilesBtn, #deskFilesBtn { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-height:34px; flex-shrink:0; padding:5px 10px; background:rgba(128,128,128,.09); color:var(--txt,#ececec); border:1px solid var(--stroke,rgba(255,255,255,.12)); border-radius:8px; font:inherit; font-size:12px; cursor:pointer; }
#chatFilesBtn:hover, #deskFilesBtn:hover { background:rgba(128,128,128,.18); }
#chatFilesBtn svg, #deskFilesBtn svg { width:16px; height:16px; }
.cf-wrap { position:fixed; inset:0; z-index:180; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.48); backdrop-filter:blur(5px); color:var(--txt,#ececec); animation:cf-in .16s ease; }
.cf-wrap * { box-sizing:border-box; }
.cf-box { width:min(1200px,100%); height:min(820px,90dvh); display:flex; flex-direction:column; overflow:hidden; background:var(--glass-strong,#202124); border:1px solid var(--stroke,rgba(255,255,255,.13)); border-radius:18px; box-shadow:0 24px 80px #0005; }
.cf-wrap button, .cf-wrap input, .cf-wrap select { font:inherit; color:inherit; }
.cf-wrap button, .cf-wrap a { -webkit-tap-highlight-color:transparent; }
.cf-wrap button { cursor:pointer; }
.cf-wrap button:hover, .cf-wrap a:hover { background:rgba(128,128,128,.13); }
.cf-wrap :is(button,a,select):focus-visible, .cf-scroll:focus-visible, #chatFilesBtn:focus-visible, #deskFilesBtn:focus-visible { outline:2px solid var(--blue,#8bb4ea); outline-offset:2px; }
.cf-head { display:flex; align-items:center; justify-content:space-between; padding:14px 18px 0; flex-shrink:0; }
.cf-heading { display:flex; align-items:center; gap:10px; font-size:18px; font-weight:600; }
.cf-wrap svg { width:18px; height:18px; flex-shrink:0; }
.cf-scope { padding:2px 20px 16px; font-size:12px; color:var(--txt2,#a5a6aa); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex-shrink:0; }
.cf-tools { display:flex; gap:14px; align-items:center; padding:0 20px; flex-shrink:0; }
.cf-search { min-width:0; flex:1; display:flex; align-items:center; gap:8px; padding:0 8px 0 12px; border:1px solid var(--stroke,rgba(255,255,255,.12)); border-radius:10px; background:rgba(128,128,128,.06); }
.cf-search input { min-width:0; width:100%; height:42px; border:0; outline:0; background:transparent; font-size:13px; }
.cf-search input::-webkit-search-cancel-button { display:none; }
.cf-search:focus-within { border-color:var(--blue,#8bb4ea); }
.cf-sort { display:flex; gap:8px; align-items:center; font-size:12px; color:var(--txt2,#a5a6aa); }
.cf-sort select { max-width:190px; min-height:40px; border:1px solid var(--stroke,rgba(255,255,255,.12)); border-radius:8px; padding:4px 8px; background:var(--glass-strong,#202124); }
.cf-sort option { background:var(--glass-strong,#202124); }
.cf-filters { display:flex; gap:4px; flex-wrap:wrap; padding:14px 20px 4px; flex-shrink:0; }
.cf-filters button { min-height:34px; padding:5px 10px; border:1px solid transparent; border-radius:8px; background:transparent; font-size:12px; color:var(--txt2,#a5a6aa); }
.cf-filters button[aria-pressed="true"] { color:var(--txt,#ececec); background:rgba(128,128,128,.17); border-color:var(--stroke,rgba(255,255,255,.13)); }
.cf-count { padding:8px 20px 12px; font-size:12px; color:var(--txt2,#a5a6aa); min-height:34px; flex-shrink:0; }
.cf-scroll { overflow:auto; overscroll-behavior:contain; flex:1; min-height:0; scrollbar-width:thin; }
.cf-scroll table { width:100%; border-collapse:collapse; table-layout:fixed; font-size:12px; }
.cf-scroll th { text-align:left; color:var(--txt2,#a5a6aa); font-size:11px; font-weight:500; background:var(--glass-strong,#202124); position:sticky; top:0; z-index:1; padding:10px 12px; }
.cf-scroll th:first-child { width:auto; padding-left:20px; }
.cf-scroll th:nth-child(2) { width:150px; }
.cf-scroll th:nth-child(3) { width:85px; }
.cf-scroll th:last-child { width:184px; text-align:right; padding-right:20px; }
.cf-scroll td { border-top:1px solid var(--stroke-soft,rgba(255,255,255,.07)); padding:10px 12px; }
.cf-scroll tr:hover td { background:rgba(128,128,128,.04); }
.cf-scroll td.cf-name { padding-left:20px; }
.cf-name-text { display:inline-flex; flex-direction:column; vertical-align:middle; width:calc(100% - 44px); min-width:0; gap:5px; }
.cf-name button { display:block; width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; padding:0; border:0; background:none; font-size:13px; }
.cf-name small { color:var(--txt2,#a5a6aa); font-size:11px; }
.cf-type { display:inline-flex; width:32px; height:36px; align-items:center; justify-content:center; margin-right:10px; vertical-align:middle; color:var(--txt2,#a5a6aa); background:rgba(128,128,128,.08); border-radius:7px; }
.cf-date, .cf-size { color:var(--txt2,#a5a6aa); font-variant-numeric:tabular-nums; }
.cf-date time { white-space:nowrap; }
.cf-actions { white-space:nowrap; text-align:right; }
.cf-icon { display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border:0; border-radius:8px; color:inherit; background:transparent; vertical-align:middle; text-decoration:none; flex-shrink:0; }
.cf-state { text-align:center; padding:42px 20px; color:var(--txt2,#a5a6aa); font-size:13px; line-height:1.6; }
.cf-state:empty { display:none; }
.cf-more { display:block; margin:16px auto 24px; min-height:42px; padding:8px 22px; border:1px solid var(--stroke,rgba(255,255,255,.12)); background:transparent; border-radius:9px; font-size:13px !important; }
.cf-wrap [hidden] { display:none !important; }
.hmsg.file-jump { outline:2px solid #a7b9d0; outline-offset:3px; border-radius:10px; }
@keyframes cf-in { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
@media (max-width:700px) {
  .cf-wrap { padding:8px; padding-top:max(8px,env(safe-area-inset-top)); padding-bottom:max(8px,env(safe-area-inset-bottom)); }
  .cf-box { height:100%; max-height:100dvh; border-radius:14px; }
  .cf-tools { flex-wrap:wrap; gap:8px; padding:0 14px; }
  .cf-search { flex-basis:100%; }
  .cf-sort { width:100%; justify-content:space-between; }
  .cf-filters { padding:10px 14px 0; gap:2px; }
  .cf-filters button { min-height:40px; padding:5px 9px; }
  .cf-count { padding-left:14px; }
  .cf-scroll thead { display:none; }
  .cf-scroll tr { display:grid; grid-template-columns:minmax(0,1fr) auto; padding:12px 14px; gap:6px 8px; border-top:1px solid var(--stroke-soft,rgba(255,255,255,.07)); }
  .cf-scroll td, .cf-scroll td.cf-name { border:0; padding:0; }
  .cf-name { grid-column:1 / -1; min-width:0; }
  .cf-date { grid-column:1; align-self:end; font-size:11px; }
  .cf-size { grid-column:1; font-size:11px; }
  .cf-actions { grid-column:2; grid-row:2 / 4; align-self:center; }
  .cf-icon { width:44px; height:44px; }
}
@media (prefers-reduced-motion:reduce) { .cf-wrap, .fv-wrap, .fv-box { animation:none !important; } }

/* Избранное: общий UI библиотеки и кнопки у исходных вложений (#384). */
.cf-tabs { display:flex; gap:22px; padding:0 20px; border-bottom:1px solid var(--stroke-soft, #8883); flex-shrink:0; }
.cf-tabs [role=tab] { display:flex; align-items:center; gap:8px; min-height:46px; padding:0 2px; border:0; border-bottom:2px solid transparent; background:transparent; color:var(--txt2,#a5a6aa); font-size:13px; }
.cf-tabs [aria-selected=true] { color:var(--txt,#eee); border-bottom-color:var(--blue,#8bb4ea); }
.cf-layout { display:flex; flex:1; min-height:0; }
.cf-main { flex:1; display:flex; flex-direction:column; min-width:0; padding-top:16px; }
.cf-sidebar { width:224px; flex-shrink:0; padding:20px 10px 12px; display:flex; flex-direction:column; border-right:1px solid var(--stroke-soft,#8883); background:rgba(128,128,128,.025); overflow:auto; scrollbar-width:thin; }
.cf-sidebar-title { padding:0 12px 14px; color:var(--txt2,#aaa); font-size:11px; letter-spacing:.06em; text-transform:uppercase; }
.cf-tree-help { color:var(--txt2,#aaa); font-size:11px; line-height:1.7; margin:auto 12px 0; padding-top:28px; }
.cf-tree [role=treeitem] { outline:0; border-radius:7px; font-size:12px; cursor:pointer; }
.cf-tree-row { display:flex; align-items:center; gap:8px; min-height:42px; border-radius:7px; padding:5px 8px 5px calc(8px + min(var(--depth,0), 6) * 12px); }
.cf-tree-name { min-width:0; flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cf-tree-row small { font-size:10px; color:var(--txt2,#aaa); font-variant-numeric:tabular-nums; }
.cf-tree [role=treeitem]:hover > .cf-tree-row { background:rgba(128,128,128,.08); }
.cf-tree [aria-selected=true] > .cf-tree-row { background:rgba(128,128,128,.16); color:var(--txt,#eee); }
.cf-tree [role=treeitem]:focus-visible > .cf-tree-row { outline:2px solid var(--blue,#8bb4ea); outline-offset:-2px; }
.cf-tree-toggle { display:inline-flex; width:12px; align-items:center; justify-content:center; }
.cf-tree-toggle svg { width:12px; height:12px; transition:transform .15s; }
.cf-tree [aria-expanded=true] > .cf-tree-row > .cf-tree-toggle svg { transform:rotate(90deg); }
.cf-leaf { visibility:hidden; }
.cf-tree [data-folder=all], .cf-tree [data-folder=root] { margin-bottom:4px; }
.cf-tree .cf-drop > .cf-tree-row { outline:2px solid var(--blue,#8bb4ea); background:rgba(100,150,220,.16); }
.cf-folder-tools { display:flex; align-items:center; gap:8px; min-height:44px; margin:0 16px 12px 20px; }
.cf-breadcrumbs { display:flex; align-items:center; gap:4px; flex:1; min-width:0; overflow:hidden; font-size:12px; }
.cf-breadcrumbs button { min-width:0; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding:8px 2px; border:0; background:transparent; color:var(--txt2,#aaa); }
.cf-breadcrumbs [aria-current=page] { color:var(--txt,#eee); font-weight:500; }
.cf-breadcrumbs span { display:inline-flex; flex-shrink:0; }
.cf-breadcrumbs svg { width:12px; height:12px; color:var(--txt2,#aaa); }
.cf-breadcrumbs strong { font-weight:500; white-space:nowrap; }
.cf-folder-actions { display:flex; }
.cf-mobile-folders { display:none !important; }
.cf-search-scope { display:flex; align-items:center; gap:10px; padding:4px 20px; color:var(--txt2,#aaa); font-size:11px; }
.cf-search-scope span { min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.cf-search-scope button { border:0; background:transparent; color:var(--blue,#8bb4ea); padding:8px 0; flex-shrink:0; font-size:11px; }
.cf-selection { display:flex; align-items:center; gap:8px; padding:6px 20px 0; min-height:44px; }
.cf-selection > label { display:flex; align-items:center; gap:8px; flex:1; font-size:11px; min-width:0; }
.cf-selection input, .cf-check input { width:16px; height:16px; accent-color:var(--blue,#8bb4ea); cursor:pointer; flex-shrink:0; }
.cf-selection input, .cf-check input { appearance:none; position:relative; border:1px solid var(--txt2,#aaa); border-radius:4px; background:transparent; }
.cf-selection input:checked, .cf-check input:checked { background:var(--blue,#8bb4ea); border-color:var(--blue,#8bb4ea); }
.cf-selection input:checked::after, .cf-check input:checked::after { content:''; position:absolute; left:5px; top:2px; width:4px; height:8px; border:solid #fff; border-width:0 2px 2px 0; transform:rotate(45deg); }
.cf-selection input:indeterminate::after { content:''; position:absolute; top:6px; left:3px; width:8px; border-bottom:2px solid var(--txt,#eee); }
.cf-selection input:focus-visible, .cf-check input:focus-visible { outline:2px solid var(--blue,#8bb4ea); outline-offset:3px; }
.cf-check { display:inline-flex; align-items:center; justify-content:flex-start; width:28px; min-height:38px; vertical-align:middle; }
.cf-button { display:inline-flex; align-items:center; justify-content:center; gap:7px; border:1px solid var(--stroke,#8885); background:transparent; border-radius:9px; min-height:38px; padding:6px 12px; font-size:12px !important; cursor:pointer; }
.cf-wrap button:disabled, .cf-wrap [aria-disabled=true] { opacity:.4; cursor:default; }
.cf-favorites .cf-scroll th:last-child { width:218px; }
.cf-favorites .cf-name-text { width:calc(100% - 74px); }
.cf-name small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cf-selected td { background:rgba(110,145,190,.1); }
.cf-scroll tr.cf-selected:hover td { background:rgba(110,145,190,.16); }
.cf-dragging { opacity:.45; }
.cf-unavailable { color:var(--txt2,#bcb0a3); }
.cf-notice { min-height:32px; padding:8px 20px; font-size:12px; background:rgba(128,128,128,.06); border-top:1px solid var(--stroke-soft,#8882); }
.cf-notice:empty { padding:0; min-height:8px; background:none; }
.cf-error, .cf-dialog-error { color:var(--danger,#ef9c96); }
.cf-star { color:var(--txt2,#a5a6aa); transition:background .15s,color .15s; }
.cf-star svg { width:18px; height:18px; }
.cf-star[aria-pressed=true] { color:var(--blue,#8bb4ea); }
.cf-star[aria-pressed=true] svg { fill:currentColor; fill-opacity:.18; }
.cf-star:focus-visible { outline:2px solid var(--blue,#8bb4ea); outline-offset:2px; }
.atts .aimg { position:relative; }
.atts .aimg .cf-star { position:absolute; right:5px; top:5px; background:var(--glass-strong,#202124); box-shadow:0 1px 5px #0004; }
.atts .afile .cf-star { margin-left:2px; }
.atts .afile .finfo { min-width:0; }
.cf-attachment { display:flex; align-items:center; gap:4px; min-width:0; max-width:100%; }
.cf-attachment > button:first-child { min-width:0; }
.hatts .cf-attachment > .cf-star { display:inline-flex; padding:0; border:0; background:transparent; width:38px; height:38px; }
.cf-sub-wrap { z-index:205; }
.cf-dialog { width:min(440px,100%); max-height:calc(100dvh - 32px); overflow:auto; padding:20px; border:1px solid var(--stroke,#8885); border-radius:16px; background:var(--glass-strong,#202124); box-shadow:0 24px 80px #0005; }
.cf-dialog header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.cf-dialog h2 { font-size:16px; font-weight:600; line-height:1.4; margin:0; overflow-wrap:anywhere; }
.cf-dialog p { font-size:13px; line-height:1.65; color:var(--txt2,#aaa); margin:12px 0 18px; }
.cf-dialog p:empty { display:none; }
.cf-dialog .cf-dialog-error { color:var(--danger,#ef9c96); }
.cf-dialog footer { display:flex; gap:8px; justify-content:flex-end; margin-top:20px; }
.cf-primary { background:var(--txt,#ececec); color:var(--bg1,#202124) !important; border-color:transparent; }
.cf-wrap .cf-primary:hover { background:var(--txt2,#bbb); }
.cf-wrap .cf-danger { background:#a94442; color:#fff !important; }
.cf-field { display:flex; flex-direction:column; gap:8px; font-size:12px; }
.cf-field input { width:100%; min-width:0; height:44px; background:rgba(128,128,128,.05); border:1px solid var(--stroke,#8886); border-radius:9px; padding:8px 12px; outline:0; }
.cf-field input:focus { border-color:var(--blue,#8bb4ea); box-shadow:0 0 0 2px #8bb4ea22; }
.cf-picker-tree { max-height:45dvh; overflow:auto; padding:2px; border:1px solid var(--stroke-soft,#8883); border-radius:9px; }
@media (max-width:1000px) and (min-width:701px) {
  .cf-sidebar { width:190px; }
  .cf-favorites .cf-scroll th:nth-child(2), .cf-favorites .cf-date { display:none; }
  .cf-tools { gap:8px; }
  .cf-sort { font-size:0; }
  .cf-sort select { font-size:12px; max-width:160px; }
}
@media (max-width:700px) {
  .cf-box { height:100%; max-height:100%; }
  .cf-main { padding-top:12px; }
  .cf-sidebar { display:none; }
  .cf-mobile-folders { display:inline-flex !important; }
  .cf-tabs { padding:0 14px; }
  .cf-folder-tools { margin:0 10px 8px 14px; flex-wrap:wrap; gap:4px; }
  .cf-breadcrumbs { order:0; flex-basis:0; padding:2px 0; }
  .cf-breadcrumbs > :not(:last-child) { display:none; }
  .cf-breadcrumbs button { min-height:44px; }
  .cf-folder-actions { margin-left:auto; }
  .cf-search-scope { padding:0 14px; min-height:32px; }
  .cf-search-scope button { min-height:44px; }
  .cf-selection { padding:2px 10px 0 14px; gap:4px; }
  .cf-selection > label { min-height:44px; }
  .cf-selection .cf-button { padding:5px 8px; font-size:11px !important; }
  .cf-selection .cf-button svg { width:16px; }
  .cf-button, .cf-filters button { min-height:44px; }
  .cf-check { min-height:44px; width:44px; justify-content:center; }
  .cf-favorites .cf-name-text { width:calc(100% - 90px); }
  .cf-name-text { width:calc(100% - 44px); }
  .cf-name button { white-space:normal; overflow-wrap:anywhere; min-height:44px; }
  .cf-sort select, .cf-search input { min-height:44px; }
  .cf-scroll tr { gap:6px; }
  .cf-scroll .cf-date { grid-column:1; grid-row:2; }
  .cf-scroll .cf-size { grid-column:2; grid-row:2; text-align:right; }
  .cf-scroll .cf-actions { grid-column:1 / -1; grid-row:3; text-align:right; }
  .cf-dialog { padding:16px; max-height:calc(100dvh - 16px); }
  .cf-dialog h2 { font-size:15px; }
  .cf-tree-row { min-height:44px; }
  .cf-tree-toggle { width:44px; height:44px; margin:-5px 0; flex-shrink:0; }
  .cf-dialog footer { gap:6px; }
  .cf-dialog footer button { padding:6px 10px; }
  .cf-notice { padding:8px 14px; font-size:11px; }
  .atts .cf-star, .hatts .cf-attachment > .cf-star { width:44px; height:44px; }
  #chatFilesBtn, #deskFilesBtn { min-height:44px; }
}
@media (prefers-reduced-motion:reduce) {
  .cf-wrap *, .cf-star { transition:none !important; animation:none !important; scroll-behavior:auto !important; }
}

/* ===================== выбор модели OpenRouter (задача #213) ===============
   Полноэкранная шторка по образцу ленты агента: моделей четыре сотни, в меню
   кнопки они не помещаются. Значки — только тонкий stroke-SVG. */
#omWrap {
  position: fixed; inset: 0; z-index: 59; visibility: hidden; opacity: 0;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px);
  transition: opacity .28s, visibility .28s;
}
#omWrap.open { visibility: visible; opacity: 1; }
#omBox {
  position: absolute; inset: 24px; display: flex; flex-direction: column;
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); backdrop-filter: blur(50px) saturate(1.7);
  -webkit-backdrop-filter: blur(50px) saturate(1.7);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  transform: scale(.97); transition: transform .3s cubic-bezier(.2, .9, .3, 1.1);
  overflow: hidden;
}
#omWrap.open #omBox { transform: none; }
/* АТРИБУТ hidden ОБЯЗАН ПОБЕЖДАТЬ НАШ display. У элемента с классом правило
   автора (`display:flex`) сильнее UA-шного `[hidden]{display:none}`, поэтому
   `el.hidden = true` в шторке не прятало НИЧЕГО: ряд «обход при падении» висел
   и при обычном режиме (задача #284), а «Сделать моделью по умолчанию» — рядом
   с меткой «по умолчанию» (поймано снимком песочницы, задача #285). Правило
   одно на всю шторку: точечные `.класс[hidden]` разъедутся на первом же новом
   блоке. */
#omBox [hidden] { display: none !important; }
#omBox .shead {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 14px 16px 10px;
}
#omBox .shead .t { flex: 1; font-size: 16px; font-weight: 650; }

/* Поиск и фильтры. Инпут в flex обязан уметь сжиматься: без min-width:0 он
   берёт свою content-ширину и распирает шторку. */
.om-tools {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 0 16px 10px;
}
.om-search {
  flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 7px;
  padding: 0 11px; height: 34px; border-radius: 100px;
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .05);
  color: var(--txt3);
}
.om-search svg { flex: none; width: 15px; height: 15px; }
.om-search input {
  box-sizing: border-box; width: 100%; min-width: 0; flex: 1 1 auto;
  border: 0; background: none; outline: none; color: var(--txt);
  font: inherit; font-size: 13px;
}
.om-search input::-webkit-search-cancel-button { filter: invert(.6); }
.om-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.omf {
  padding: 0 11px; height: 30px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .04);
  color: var(--txt3); font: inherit; font-size: 12px; line-height: 1;
  transition: background .18s, color .18s, border-color .18s;
}
.omf:hover { color: var(--txt2); }
.omf.on {
  background: rgba(10, 132, 255, .16); border-color: rgba(10, 132, 255, .42);
  color: #cfe6ff;
}
/* Сортировка (#237) отделена от фильтров тонкой чертой; чипы — те же .omf,
   одиночный выбор: не нажат ни один — порядок умолчания сервера. */
.om-sortsep { flex: none; align-self: center; width: 1px; height: 20px;
              background: var(--stroke-soft); }
.omdate, .omrating { color: var(--txt3); }
.om-err {
  flex: none; margin: 0 16px 8px; padding: 6px 10px; border-radius: var(--r-sm);
  background: rgba(232, 139, 132, .12); border: 1px solid rgba(232, 139, 132, .3);
  color: #e88b84; font-size: 11.5px;
}

/* Выбранная модель и «сделать моделью по умолчанию» (задача #285). Полоска
   над блоком провайдеров: имя, цена и контекст словами — голый id не говорит
   ни того, ни другого, а именно за цену модель и выбирают. */
.om-cur {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin: 0 16px 8px; padding: 7px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .04);
  font-size: 12px;
}
.omc-name {
  min-width: 0; color: var(--txt); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omc-meta { flex: 1 1 auto; min-width: 0; color: var(--txt3); font-size: 11.5px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Метка «по умолчанию» — тихая и в стиле соседних меток строки модели:
   тонкий stroke-значок и слово, никаких эмодзи и никакой заливки. */
.omc-badge, .ombadge.def {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  color: var(--txt3); font-size: 10.5px;
}
.omc-badge .ico, .omc-badge svg, .ombadge.def .ico { width: 12px; height: 12px; }
.omc-def {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 0 11px; height: 27px; border-radius: 100px; cursor: pointer;
  border: 1px solid rgba(10, 132, 255, .42); background: rgba(10, 132, 255, .12);
  color: #cfe6ff; font: inherit; font-size: 11.5px;
  transition: background .18s, color .18s;
}
.omc-def:hover { background: rgba(10, 132, 255, .22); color: #eaf4ff; }
.omc-def .ico, .omc-def svg { width: 13px; height: 13px; }

/* Список */
.om-list {
  flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain;
  margin: 0 16px; padding-bottom: 6px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.om-list::-webkit-scrollbar { width: 7px; }
.om-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 4px; }
.omrow {
  display: grid; width: 100%; gap: 2px 12px; margin-bottom: 6px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-areas: 'name meta tick' 'badges badges tick';
  align-items: center; text-align: left; cursor: pointer;
  padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .04);
  color: var(--txt2); font: inherit;
  transition: background .18s, border-color .18s;
}
.omrow:hover { background: rgba(255, 255, 255, .08); }
.omrow.on { border-color: rgba(10, 132, 255, .45); background: rgba(10, 132, 255, .12); }
.omname {
  grid-area: name; min-width: 0; display: block;
  font-size: 13.5px; font-weight: 600; color: var(--txt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omname small {
  display: block; font-weight: 400; font-size: 11px; color: var(--txt3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ommeta {
  grid-area: meta; display: flex; align-items: center; gap: 10px; flex: none;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.omctx { color: var(--txt2); }
.omprice { color: var(--txt3); }
.omprice.free { color: var(--green); }
.ombadges { grid-area: badges; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.ombadge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--txt3);
}
.ombadge .ico, .ombadge svg { width: 12px; height: 12px; }
/* «без инструментов» — предупреждение, а не украшение: такой модели недоступны
   ни память, ни задачи, ни переписка, и знать об этом надо ДО выбора. */
.ombadge.warn { color: #e0a44a; }
.omtick { grid-area: tick; display: flex; flex: none; color: var(--blue); }
.omtick .ico, .omtick svg { width: 17px; height: 17px; }
.om-none { padding: 14px 4px; color: var(--txt3); font-size: 12.5px; }

.om-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 14px; color: var(--txt3); font-size: 11.5px;
}
.om-foot > span { flex: 1; min-width: 0; }
.ommore, .om-reset {
  padding: 0 11px; height: 28px; border-radius: 100px; cursor: pointer;
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .05);
  color: var(--txt2); font: inherit; font-size: 11.5px;
}
.ommore:hover, .om-reset:hover { color: var(--txt); background: rgba(255, 255, 255, .1); }
.om-reset { flex: none; }

@media (max-width: 640px) {
  #omBox { inset: 8px; }
  #omBox .shead { padding: 10px 12px 8px; }
  #omBox .shead .t { font-size: 14.5px; }
  .om-tools { padding: 0 10px 8px; }
  .om-cur { margin: 0 10px 8px; }
  /* Кнопка на своей строке: рядом с именем модели ей на 360 px места нет,
     а ужимать её значит показать «Сделать моделью по…». */
  .omc-def { width: 100%; justify-content: center; }
  .om-list { margin: 0 10px; }
  .om-foot { padding: 8px 10px 10px; }
  .omrow { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 10px;
           grid-template-areas: 'name tick' 'meta tick' 'badges badges'; }
  .ommeta { grid-area: meta; }
}

/* ===== провайдеры выбранной модели и маршрут (задача #283) =================
   Живёт над списком моделей и своей высоты не занимает больше трети шторки:
   выбирают всё-таки модель, а провайдеры — довесок к ней. Таблица прокручивается
   ВНУТРИ себя (девять колонок на телефон не влезают никак), а сама шторка вбок
   не едет — то же правило, что у широких таблиц во всех наших отчётах. */
.om-prov {
  flex: none; margin: 0 16px 8px; border-radius: var(--r-sm);
  border: 1px solid var(--stroke-soft); background: rgba(255, 255, 255, .03);
  overflow: hidden;
}
.omp-head {
  display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer;
  padding: 8px 10px; border: 0; background: none; color: var(--txt2);
  font: inherit; font-size: 12.5px; text-align: left;
}
.omp-head:hover { background: rgba(255, 255, 255, .05); }
.omp-chev {
  flex: none; width: 14px; height: 14px; color: var(--txt3);
  transition: transform .2s;
}
.om-prov.open .omp-chev { transform: rotate(90deg); }
.omp-t { flex: none; font-weight: 600; color: var(--txt); }
.omp-model {
  flex: 1 1 auto; min-width: 0; color: var(--txt3); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.omp-cnt { flex: none; color: var(--txt3); font-size: 11.5px; }
.omp-body { display: none; padding: 0 10px 9px; }
.om-prov.open .omp-body { display: block; }
.omp-modes { margin-bottom: 8px; }
.omp-note {
  margin-bottom: 8px; padding: 6px 9px; border-radius: var(--r-sm);
  background: rgba(224, 164, 74, .1); border: 1px solid rgba(224, 164, 74, .28);
  color: #e0a44a; font-size: 11.5px;
}
.omp-scroll {
  max-height: 30vh; overflow: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.omp-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.omp-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 4px; }
.omp-tab {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.omp-tab th, .omp-tab td {
  padding: 5px 8px; text-align: right; white-space: nowrap; color: var(--txt2);
  border-bottom: 1px solid var(--stroke-soft);
}
.omp-tab th {
  position: sticky; top: 0; z-index: 1; font-weight: 500; color: var(--txt3);
  background: var(--glass-strong); backdrop-filter: blur(8px);
}
.omp-tab th:first-child, .omp-tab td:first-child { text-align: left; }
.omp-tab td.who { color: var(--txt); }
/* Вариант эндпоинта под именем (задача #291): у google/gemini-3.7-flash шесть
   строк и два имени, а хвост tag'а — это уровень обслуживания и регион, и
   стоит он разных денег. Подписью, а не десятой колонкой: на 360 px таблица и
   так съедает пол-экрана. */
.omp-var { font-size: 10px; line-height: 1.25; color: var(--txt3); margin-top: 1px; }
.omp-tab tr.cheap td.pin .omp-var { color: var(--green); opacity: .8; }
.omp-tab tr:last-child td { border-bottom: 0; }
/* Самый дешёвый подсвечен — и подсвечены ВСЕ равные ему: у GLM 5.3 Flash их
   четверо по одной цене, и один «победитель» врал бы о том, кого возьмёт
   OpenRouter. Тот же приём, что у .omprice.free — цветом, а не значком. */
.omp-tab tr.cheap td { background: rgba(48, 209, 88, .09); }
.omp-tab tr.cheap td.pin { color: var(--green); }
.omp-tab td.dim { color: var(--txt3); }
.omp-pick {
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--stroke-soft);
  color: var(--txt3); font-size: 11.5px;
}
/* Что уедет В ТЕЛО запроса (задача #284). Моноширинный: это не фраза, а поле
   json, и человек сверяет его глазами со строкой в документации OpenRouter. */
.omp-wire {
  margin-top: 5px; color: var(--txt3); font-size: 11px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}
.omp-none { padding: 10px 2px; color: var(--txt3); font-size: 12px; }

/* ===== галочки провайдеров (задача #284) ==================================
   Порядок кликов И ЕСТЬ порядок order, поэтому в клетке не «птичка», а НОМЕР:
   у OpenRouter order это порядок предпочтения, и два отмеченных без номеров
   выглядели бы равными. Птичка остаётся у неотмеченного — как приглашение. */
.omp-pins {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px;
}
.omp-max {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  color: var(--txt3); font-size: 11.5px;
}
.omp-max input {
  box-sizing: border-box; width: 116px; min-width: 0; padding: 4px 7px;
  border-radius: var(--r-sm); border: 1px solid var(--stroke-soft);
  background: var(--glass); color: var(--txt); font: inherit; font-size: 11.5px;
  text-align: right;
}
.omp-max input:focus { outline: none; border-color: var(--blue); }
.omp-tab th.omp-box, .omp-tab td.omp-box { width: 26px; padding: 3px 4px 3px 6px; }
.omp-chk {
  display: flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; padding: 0; cursor: pointer;
  border-radius: 5px; border: 1px solid var(--stroke-soft);
  background: none; color: var(--txt3);
}
.omp-chk:hover { border-color: var(--blue); color: var(--txt2); }
.omp-chk .ico { width: 13px; height: 13px; opacity: .35; }
.omp-chk.on {
  border-color: var(--blue); background: var(--blue); color: #fff; opacity: 1;
}
.omp-num { font-size: 10.5px; font-weight: 600; line-height: 1; }
.omp-tab tr.picked td { background: rgba(10, 132, 255, .1); }
.omp-tab tr.picked td.pin { color: var(--txt); }

/* Тег маршрута в списке чатов: только у чата со СВОИМ маршрутом — «как в
   настройках» это обычное состояние, и метка на каждой строке была бы шумом
   (то же правило, что у обводки мозга и у тега кнопки). */
.sc-route {
  flex: none; padding: 1px 7px; border-radius: 100px;
  border: 1px solid rgba(48, 209, 88, .32); background: rgba(48, 209, 88, .1);
  color: var(--green); font-size: 10px; line-height: 15px;
}

@media (max-width: 640px) {
  .om-prov { margin: 0 10px 8px; }
  .omp-scroll { max-height: 26vh; }
}


#pop.paint button {
  display: flex; width: 100%; border: none; background: none; color: var(--txt);
  font: inherit; font-size: 13.5px; padding: 9px 12px; border-radius: 9px;
  cursor: pointer; transition: background .15s;
}
#pop.paint button:hover { background: rgba(255, 255, 255, .09); }
#pop.paint {
  width: 360px; max-width: calc(100vw - 24px); padding: 12px;
  max-height: calc(100vh - 24px); overflow-y: auto;    /* на низком экране скроллится сама */
}
.pn-h { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt2);
  margin: 2px 2px 8px; }
.pn-h b { color: var(--txt); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; }
.pn-h b .ico { width: 15px; height: 15px; }
#pop.paint .pn-en .ico { width: 14px; height: 14px; }
.pn-h .pn-cost, .pn-h #pnCur {
  margin-left: auto; color: var(--txt3); font-size: 11px; max-width: 200px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pn-lbl { font-size: 11px; color: var(--txt3); margin: 10px 2px 5px; letter-spacing: .02em; }
#pop.paint textarea, #pop.paint input {
  box-sizing: border-box; width: 100%; min-width: 0; font: inherit; font-size: 13px;
  color: var(--txt); background: rgba(255, 255, 255, .06);
  border: 1px solid var(--stroke); border-radius: 10px; padding: 8px 10px; outline: none;
}
#pop.paint textarea { resize: vertical; min-height: 62px; line-height: 1.45; }
#pop.paint textarea:focus, #pop.paint input:focus { border-color: rgba(160, 110, 255, .55); }
.pn-models { max-height: 122px; overflow: auto; margin-top: 6px;
  border: 1px solid var(--stroke-soft); border-radius: 10px; }
#pop.paint .pn-models button {
  padding: 7px 10px; border-radius: 0; font-size: 12.5px; align-items: center; gap: 8px;
}
.pn-models .pm-n { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.pn-models .pm-v { color: var(--txt3); font-size: 10.5px; flex-shrink: 0; }
#pop.paint .pn-models button.on { background: rgba(160, 110, 255, .18); color: #e6d9ff; }
.pn-asp { display: flex; flex-wrap: wrap; gap: 5px; }
.pn-asp .a {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 3px; cursor: pointer; width: 36px; height: 44px; box-sizing: border-box;
  padding: 4px 3px 3px; border-radius: 9px; border: 1px solid var(--stroke-soft);
  background: rgba(255, 255, 255, .04); font-size: 9.5px; color: var(--txt3);
  transition: background .15s, border-color .15s, color .15s;
}
.pn-asp .a:hover { background: rgba(255, 255, 255, .09); color: var(--txt2); }
.pn-asp .a.on { border-color: rgba(160, 110, 255, .6); background: rgba(160, 110, 255, .16);
  color: #e6d9ff; }
.pn-asp .a i { display: block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .8; }
/* на низком экране панель скроллится внутри — кнопку держим на виду */
.pn-foot {
  display: flex; align-items: center; gap: 8px; margin: 11px -12px -12px;
  padding: 8px 12px 12px; position: sticky; bottom: -12px;
  background: linear-gradient(rgba(24, 24, 34, 0), rgba(24, 24, 34, .97) 22%);
}
#pop.paint .pn-foot button { width: auto; }
#pop.paint .pn-en {
  flex: 1; justify-content: flex-start; gap: 6px; font-size: 12px; color: var(--txt3);
  padding: 7px 8px; border: 1px solid var(--stroke-soft); border-radius: 9px;
}
#pop.paint .pn-en.on { color: #ffd60a; border-color: rgba(255, 214, 10, .35); }
#pop.paint .pn-go {
  background: linear-gradient(135deg, #7b5cff, #b45cff); color: #fff; font-weight: 600;
  padding: 8px 16px; border-radius: 10px; justify-content: center;
  box-shadow: 0 4px 14px rgba(140, 80, 255, .35);
}
#pop.paint .pn-go:disabled { opacity: .55; cursor: default; box-shadow: none; }
