/* NexusAI. Серо-зелёный «приборный» фон; яркий цвет только у сетей:
   Claude — терракота, Codex — индиго, как в их логотипах. Цвет сети
   окрашивает рельс беседы, кнопку отправки и галочки её настроек. */

@font-face {
  font-family: "Golos Text"; font-weight: 400 900; font-display: swap;
  src: url(vendor/fonts/golos-text-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text"; font-weight: 400 900; font-display: swap;
  src: url(vendor/fonts/golos-text-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap;
  src: url(vendor/fonts/jetbrains-mono-cyrillic-wght-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono"; font-weight: 100 800; font-display: swap;
  src: url(vendor/fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #e4e8e2;   /* панели и рамка */
  --sheet: #f5f7f3;   /* лист беседы */
  --raised: #ffffff;  /* поля, меню, карточки */
  --soft: #d9dfd7;    /* наведение, дорожка полос */
  --line: #c9d0c8;
  --ink: #1c2420;
  --muted: #5b6660;
  --error: #a8261b;
  --claude: #b4532f;
  --codex: #4146dc;
  --on-engine: #ffffff;
  --engine: var(--ink);
  --sans: "Golos Text", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171b19; --sheet: #1d2220; --raised: #252b28; --soft: #2d3430; --line: #353d39;
    --ink: #e1e6e1; --muted: #949f98; --error: #f0a193;
    --claude: #e38c6a; --codex: #9a9dff; --on-engine: #141816;
    color-scheme: dark;
  }
}
[data-engine="claude"] { --engine: var(--claude); }
[data-engine="codex"] { --engine: var(--codex); }
/* В беседе ошибки, лимиты и предупреждения — в цвете её сети; красный — вне бесед. */
#chat[data-engine] { --error: var(--engine); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* Не меньше 16px: iOS приближает страницу при фокусе на поле с более мелким шрифтом */
input, select, textarea { font-size: 16px; }
button, label, a { touch-action: manipulation; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--engine); outline-offset: 2px; }
/* Пальцем или мышью обводка у кнопок и ссылок не нужна: её давал фокус, который окно ставит на
   первый элемент при открытии и возвращает на кнопку при закрытии. С клавиатуры — остаётся. */
/* Поля, куда печатают, обводку сохраняют; галочки и переключатели — как кнопки */
html[data-input="pointer"] :focus-visible:not(textarea, select, input:not([type=checkbox], [type=radio])) { outline: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13.5px; }
.error { color: var(--error); }
input[type=checkbox] { accent-color: var(--engine); width: 16px; height: 16px; margin: 0; }

button, select {
  background: var(--raised); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--engine); color: var(--on-engine); border-color: transparent; font-weight: 500; }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--error); }
button.link { border: 0; background: none; padding: 2px 0; color: var(--muted); font-size: 13.5px; }
button.link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.icon {
  border: 0; background: none; padding: 7px; border-radius: 8px; line-height: 0;
  color: var(--muted); cursor: pointer;
}
.icon:hover { background: var(--soft); color: var(--ink); }
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
input, textarea {
  background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
.logo { width: 16px; height: 16px; flex: none; display: block; }
.engine-label { display: inline-flex; align-items: center; gap: 8px; }
.wordmark { font-weight: 700; letter-spacing: -0.035em; }

/* --- Вход --- */
#login { max-width: 340px; margin: 16vh auto 0; padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }
#login .wordmark { font-size: 44px; line-height: 1; margin: 0; }
#login .lead { margin: 0 0 14px; color: var(--muted); font-size: 16px; }
#login label { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--muted); }
#login label input { color: var(--ink); }
#login button { padding: 11px; margin-top: 6px; }
#login .error { margin: 0; min-height: 1.5em; }

/* --- Боковая панель --- */
#main { display: flex; height: 100%; height: 100dvh; }
#side { width: 272px; flex: none; display: flex; flex-direction: column; background: var(--paper); border-right: 1px solid var(--line); }
.side-head { padding: 18px 18px 14px; font-size: 19px; }
.side-title { display: flex; justify-content: space-between; align-items: center; padding: 0 10px 4px 18px; }
.side-title h2 { margin: 0; font-size: 15px; }
.add { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 180px; padding: 5px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(20, 32, 26, .16);
}
.menu button { display: block; width: 100%; text-align: left; border: 0; padding: 8px 10px; }
.menu button:hover { background: var(--soft); }
.menu .muted { padding: 8px 10px; }

#chats { flex: 1; overflow-y: auto; padding: 4px 10px; }
/* Поиск по беседам: названия и текст сообщений */
.side-search { display: flex; align-items: center; gap: 8px; margin: 0 10px 4px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--sheet); color: var(--muted); }
.side-search svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.side-search input { flex: 1; min-width: 0; border: 0; padding: 7px 0; background: none; font-size: 14px; outline: none; }
#chats a.found { flex-wrap: wrap; row-gap: 2px; }
#chats a .snippet { flex-basis: 100%; padding-left: 30px; color: var(--muted); font-size: 12.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#chats mark, #feed mark.hit { background: color-mix(in srgb, var(--engine) 22%, transparent); color: inherit; border-radius: 3px; }
#chats .muted { padding: 8px 10px; font-size: 13.5px; }
#feed .flash { animation: flash 2s ease-out; }
@keyframes flash { from { background-color: color-mix(in srgb, var(--engine) 16%, transparent); } to { background-color: transparent; } }
#chats a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  color: inherit; text-decoration: none; font-size: 14.5px;
}
#chats a span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chats a:hover { background: var(--soft); }
#chats a.active { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
#chats a.running::after { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--engine); animation: pulse 1.4s ease-in-out infinite; }

.side-link {
  display: flex; align-items: center; gap: 10px; margin: 0 10px 10px; padding: 7px 10px; border: 0; border-radius: 8px;
  background: none; color: inherit; font-size: 14.5px; text-align: left; cursor: pointer;
}
.side-link:hover { background: var(--soft); }
.side-link svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-linejoin: round; }

#quota { padding: 14px 18px 4px; border-top: 1px solid var(--line); }
.budget { margin-bottom: 12px; }
.budget > .engine-label { font-size: 13.5px; font-weight: 500; margin-bottom: 4px; }
.meter {
  display: grid; grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 3px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-variant-numeric: tabular-nums;
}
.meter .bar { grid-column: 1 / -1; position: relative; height: 4px; border-radius: 2px; background: var(--soft); }
.meter .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--engine); }
.meter .bar b { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.meter.over { color: var(--error); }
.meter.over .bar i { background: var(--error); }

.side-foot { display: flex; align-items: center; gap: 8px; padding: 8px 10px 12px 18px; border-top: 1px solid var(--line); }
#me { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Беседа --- */
#chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--sheet); }
#chat header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px 10px 24px; border-bottom: 1px solid var(--line); min-height: 57px; }
#title {
  flex: 1; margin: 0; font-size: 17px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Модель и размер сессии — по содержимому, effort занимает всё место между ними. */
#pick:not([hidden]) {
  display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center; gap: 8px; min-width: 0; flex: 1 1 100%; order: 4;
  overflow-x: auto;
}
#model { grid-column: 1; width: auto; }
#effort { grid-column: 2; width: 100%; min-width: 0; text-overflow: ellipsis; }
#pick #chat-size { grid-column: 3; }
/* Лимиты сети беседы — последней строкой шапки во всю ширину: 5 часов, под ними неделя */
#chat-size { color: var(--muted); font-size: 12.5px; white-space: nowrap; cursor: default; }
#limits { order: 9; flex: 1 1 100%; }
#limits:empty { display: none; }
#limits .meter { column-gap: 10px; row-gap: 2px; font-size: 11.5px; margin: 0; line-height: 1.35; }
#limits .meter + .meter { margin-top: 3px; }
#limits .meter .bar { height: 3px; }
#chat header select { background: var(--paper); border-color: transparent; padding: 6px 10px; }
#chat header select:hover { border-color: var(--line); }
#menu { display: none; }

/* Лента — журнал работы: рельс в цвете сети, метки на нём —
   вопрос (квадрат), команда модели (кольцо), ошибка (ромб). */
#feed { flex: 1; overflow-y: auto; padding: 28px 24px 8px; --rail: color-mix(in srgb, var(--engine) 38%, transparent); }
#feed > * {
  max-width: 46rem; margin: 0 auto; position: relative; isolation: isolate;
  padding: 0 0 16px 32px;
  /* Длинные ссылки, пути и хеши без пробелов переносятся, а не вылезают за ленту */
  overflow-wrap: anywhere;
  background: linear-gradient(var(--rail), var(--rail)) 9px 0 / 2px 100% no-repeat;
}
#feed > :first-child { background-position: 9px 26px; }
#feed > *::after { content: ""; position: absolute; }
#feed > .history-more { display: block; background: none; padding: 8px 16px; margin: 0 auto 16px; color: var(--muted); }
#feed > .history-more::after { content: none; }

.msg-user { padding: 24px 18px 30px 50px !important; white-space: pre-wrap; font-weight: 500; }
.msg-user::before { content: ""; position: absolute; inset: 10px 0 16px 32px; z-index: -1; background: var(--raised); border: 1px solid var(--line); border-radius: 12px; }
.msg-user::after { left: 4px; top: 28px; width: 12px; height: 12px; border-radius: 3px; background: var(--ink); }
.msg-user .chips { margin-top: 8px; font-weight: 400; }

.msg-text { font-size: 16px; line-height: 1.6; overflow-x: auto; }
.msg-text > :first-child { margin-top: 0; }
.msg-text > :last-child { margin-bottom: 0; }
.msg-text h1, .msg-text h2, .msg-text h3 { font-size: 17px; margin: 1.2em 0 .4em; }
.msg-text code { font: 0.86em/1.5 var(--mono); background: var(--paper); border-radius: 5px; padding: 1px 5px; }
.msg-text pre { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.msg-text pre code { padding: 0; background: none; font-size: 13.5px; }
/* Широкая таблица прокручивается сама; в ячейках break-word не сжимает столбцы до буквы */
.msg-text table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 14.5px; overflow-wrap: break-word; }
.msg-text td, .msg-text th { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.msg-text th { background: var(--paper); font-weight: 600; }
.msg-text a { color: var(--engine); }

/* Подряд идущие команды — одна группа с одним кольцом на рельсе */
.msg-tools { font: 12.5px/1.5 var(--mono); color: var(--muted); }
.msg-tool { cursor: pointer; }
.msg-tool b { color: var(--engine); font-weight: 600; }
.msg-tools:not(.open) .msg-tool:not(:last-child) { display: none; }
.msg-tools:not(.open) .msg-tool { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-tools.open .msg-tool { white-space: pre-wrap; padding-bottom: 6px; }
.msg-tools.open .msg-tool:last-child { padding-bottom: 0; }
.tools-more { display: block; font: inherit; color: var(--engine); background: none; border: 0; padding: 0 0 2px; cursor: pointer; }
.tools-more::before { content: "▸ "; }
.msg-tools.open .tools-more::before { content: "▾ "; }
.tools-more[hidden] { display: none; }
/* * { box-sizing } на псевдоэлементы не действует: рамку считаем в размере явно, центр — на рельсе */
.msg-tools::after { box-sizing: border-box; left: 3px; top: 4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--engine); background: var(--sheet); }

.msg-error { color: var(--error); white-space: pre-wrap; }
.msg-error::after { left: 5px; top: 6px; width: 10px; height: 10px; background: var(--error); transform: rotate(45deg); }
.msg-note { color: var(--muted); font-size: 13.5px; }
/* Под репликой и под ответом ИИ — кнопка «Копировать», прижатая к сообщению */
/* Только y: x рельса задаёт общее правило, на телефоне оно другое */
#feed > .msg-actions { margin-top: -14px; padding-bottom: 10px; padding-left: 28px; background-position-y: 14px; }
.msg-actions .icon { padding: 5px; }
.msg-actions .icon svg { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 13px; background: var(--raised); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; color: inherit; text-decoration: none;
}
a.chip:hover { border-color: var(--engine); }

.thinking::before { content: "Думает…"; color: var(--muted); font-size: 14px; }
.thinking::after { left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--engine); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

#feed > .empty { width: 100%; max-width: 640px; margin: clamp(24px, 9vh, 100px) auto 32px; background: none; padding: 0; }
#feed > .empty::after { content: none; }
.empty-eyebrow { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .16em; }
.empty h2 { font-size: clamp(28px, 4vw, 38px); line-height: 1.15; margin: 0; letter-spacing: -.045em; text-wrap: balance; }
.empty-intro { max-width: 420px; margin: 16px 0 30px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.empty-engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.empty-engines .welcome-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px; min-width: 0;
  padding: 24px; border-radius: 20px; text-align: left; background: var(--raised);
  border: 1px solid var(--line); box-shadow: 0 4px 16px rgb(0 0 0 / .025);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.welcome-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: color-mix(in srgb, var(--engine) 10%, var(--raised)); }
.welcome-mark .logo { width: 28px; height: 28px; }
.welcome-body { display: grid; gap: 8px; }
.welcome-name { font-size: 21px; line-height: 1.3; font-weight: 600; letter-spacing: -.025em; }
.welcome-about { color: var(--muted); font-size: 14px; line-height: 1.6; font-weight: 400; }
.welcome-action { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); color: var(--engine); font-size: 13px; font-weight: 600; }
.welcome-arrow { font-size: 20px; line-height: 1; }
@media (hover: hover) {
  .empty-engines .welcome-card:hover { border-color: var(--engine); box-shadow: 0 8px 24px color-mix(in srgb, var(--engine) 9%, transparent); transform: translateY(-2px); }
}
.empty-engines .welcome-card:active { transform: scale(.985); }
.empty-hint { margin: 22px 0 0; color: var(--muted); font-size: 12px; }
.empty-unavailable { padding: 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); line-height: 1.6; }
@media (max-width: 520px) {
  #feed > .empty { width: auto; margin: 24px 8px; }
  .empty h2 { font-size: 30px; }
  .empty-intro { margin: 14px 0 24px; }
  .empty-engines { grid-template-columns: 1fr; gap: 12px; }
  .empty-engines .welcome-card { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 20px; border-radius: 18px; }
  .welcome-mark { width: 44px; height: 44px; border-radius: 13px; }
  .welcome-name { font-size: 19px; }
  .welcome-action { grid-column: 1 / -1; padding-top: 14px; }
}

#composer { padding: 8px 24px 18px; }
#composer > * { max-width: 46rem; margin: 0 auto; }
#attached:not(:empty) { margin-bottom: 8px; }
#attached .chip { cursor: pointer; }
.row { display: flex; gap: 6px; align-items: flex-end; }
#composer .row { background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
#composer .row:focus-within { border-color: var(--engine); }
#text { flex: 1; resize: none; max-height: 40vh; border: 0; background: none; padding: 7px 4px; }
#text:focus-visible { outline: none; }
.attach { cursor: pointer; }
#send { flex: none; width: 38px; height: 38px; padding: 0; border-radius: 10px; display: grid; place-items: center; }
#send svg { width: 20px; height: 20px; fill: currentColor; }
#send.stop { background: none; color: var(--ink); border-color: var(--line); }
/* Предложение сжать беседу — над полем ввода */
#compact-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px !important; padding: 8px 8px 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--muted); font-size: 13.5px;
}
#compact-bar[hidden], #edit-bar[hidden] { display: none; }
#edit-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px !important; padding: 8px 8px 8px 12px;
  border: 1px solid var(--engine); border-radius: 10px; color: var(--engine); font-size: 13.5px;
}
#edit-bar span { flex: 1; min-width: 0; }
#edit-bar button { flex: none; color: var(--ink); }
#composer.editing .attach { display: none; }
#compact-bar span { flex: 1; min-width: 0; }
#compact-bar button { flex: none; white-space: nowrap; color: var(--ink); }

/* --- Голосовые --- */
/* Удержание микрофона: без прокрутки, выделения и меню iOS */
#send[data-mode="mic"] { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#rec { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 0 6px; }
#rec[hidden] { display: none; }
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #d63a2f; animation: pulse 1s ease-in-out infinite; }
#rec-time { flex: none; min-width: 3.2em; font: 500 15px/1 var(--mono); font-variant-numeric: tabular-nums; }
.rec-hint {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  color: var(--muted); font-size: 14px; white-space: nowrap; opacity: var(--fade, 1); animation: nudge 1.4s ease-in-out infinite;
}
.rec-hint svg { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes nudge { 50% { transform: translateX(-4px); } }
#composer.recording #text, #composer.recording .attach { display: none; }
/* Во время записи кнопка — большой круг под пальцем; scale и translate отдельно, чтобы тянулась без задержки */
#send { transition: scale .15s, border-radius .15s, box-shadow .15s; }
#composer.recording #send {
  /* Круг растёт к центру; сдвиг вверх-влево не даёт ему уйти за край экрана */
  position: relative; z-index: 2; border-radius: 50%; scale: 1.8; translate: calc(var(--drag, 0px) - 14px) -14px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--engine) 22%, transparent);
}

.msg-voice { display: flex; align-items: center; gap: 10px; white-space: normal; }
.voice-play {
  flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--engine); color: var(--on-engine); cursor: pointer;
}
.voice-play:hover { filter: brightness(1.08); }
.voice-play svg { width: 16px; height: 16px; fill: currentColor; }
.voice-wave { --played: 0%; position: relative; flex: 1; min-width: 0; max-width: 320px; height: 30px; }
.voice-bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.voice-bars span { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--muted) 40%, transparent); }
/* Цветной слой поверх серого, открыт до текущей секунды */
.voice-bars.played { clip-path: inset(0 calc(100% - var(--played)) 0 0); }
.voice-bars.played span { background: var(--engine); }
.voice-time { flex: none; min-width: 3em; text-align: right; color: var(--muted); font: 400 12.5px/1 var(--mono); font-variant-numeric: tabular-nums; }

.msg-transcribing { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.msg-transcribing::after { left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--engine); animation: pulse 1.4s ease-in-out infinite; }
.eq { display: inline-flex; align-items: center; gap: 2px; height: 16px; }
.eq span { width: 3px; height: 100%; border-radius: 2px; background: var(--engine); animation: eq 1s ease-in-out infinite; }
.eq span:nth-child(2) { animation-delay: -.8s; }
.eq span:nth-child(3) { animation-delay: -.6s; }
.eq span:nth-child(4) { animation-delay: -.4s; }
.eq span:nth-child(5) { animation-delay: -.2s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.shimmer {
  background: linear-gradient(90deg, var(--muted) 30%, var(--ink) 50%, var(--muted) 70%) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.transcript-label { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; }
.transcript-label svg { width: 14px; height: 14px; fill: currentColor; }
.transcript-text {
  padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--engine); border-radius: 10px;
  background: var(--raised); white-space: pre-wrap; font-size: 15.5px; line-height: 1.5;
}
.transcript-ask { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 14px; }
.transcript-ask span { margin-right: auto; }
.transcript-ask button { padding: 6px 18px; }

.banner { color: var(--error); border: 1px solid currentColor; border-radius: 10px; padding: 8px 12px; margin-bottom: 8px !important; font-size: 13.5px; }

#scrim { display: none; }

/* --- Окна --- */
dialog {
  background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(20, 32, 26, .25);
}
dialog::backdrop { background: rgba(20, 28, 24, .4); }
dialog h3 { margin-top: 4px; }
dialog form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
#chat-settings { padding: 0; width: min(440px, calc(100vw - 32px)); overflow: hidden; }
.chat-settings-content { padding: 20px; }
.chat-settings-content > button { display: inline-flex; align-items: center; gap: 8px; }
.chat-settings-content svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#chat-settings-name { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.chat-transfer { margin: 20px 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.chat-transfer label { display: block; margin-bottom: 8px; font-weight: 500; }
#chat-transfer-target { width: 100%; }
#chat-transfer-status { margin-bottom: 0; line-height: 1.5; }
#chat-transfer-confirm { width: min(480px, calc(100vw - 32px)); }
#chat-transfer-confirm p { overflow-wrap: anywhere; line-height: 1.5; }
/* Не наследуем цвет текущей сети для прежних сообщений. */
#feed > [data-engine] { --rail: color-mix(in srgb, var(--engine) 38%, transparent); --error: var(--engine); }
.msg-user[data-engine]::after { background: var(--engine); }
.msg-text[data-engine]::after { left: 5px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--engine); }
.msg-engine-change { color: var(--engine); padding-top: 12px !important; border-top: 1px solid var(--line); }
#delete-chat .delete-hint { margin: 6px 0 0 24px; }
#library, #files { padding: 0; width: min(760px, calc(100vw - 32px)); max-height: min(740px, calc(100vh - 32px)); }
#files { width: min(520px, calc(100vw - 32px)); }
#library[open], #files[open] { display: flex; flex-direction: column; }
.library-tools { display: flex; align-items: center; gap: 12px; padding: 12px 20px 8px; }
.library-tools input { flex: 1; min-width: 0; }
.library-filters { display: flex; gap: 8px; padding: 0 20px 8px; }
.library-filters select { flex: 1 1 0; min-width: 0; padding-left: 10px; text-overflow: ellipsis; }
.library-filters button { flex: none; }
.selecting .library-filters button { background: var(--engine); color: var(--on-engine); border-color: transparent; }
/* Выбор нескольких: кружок с галочкой вместо крестика, внизу — сколько выбрано и «Удалить» */
.library-bar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.library-bar[hidden] { display: none; }
.library-bar .muted { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-pick {
  position: absolute; top: 0; right: 0; width: 24px; height: 24px; display: none; place-items: center;
  border-radius: 50%; border: 2px solid var(--muted); background: var(--sheet); color: var(--on-engine);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); pointer-events: none;
}
.file-pick svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.selecting .file-pick { display: grid; }
.selecting .file-del, .selecting .file-sub .icon { display: none; }
.selecting .file-grid > li { cursor: pointer; user-select: none; -webkit-user-select: none; border-radius: 10px; }
.selecting .file-grid > li.picked { background: color-mix(in srgb, var(--engine) 14%, transparent); }
.selecting .file-grid > li .file-tile:hover { background: none; }
.file-grid > li.picked .file-pick { background: var(--engine); border-color: var(--engine); }
.file-grid > li.picked .file-pick svg { visibility: visible; }

/* Плитки файлов: превью или значок, под ним имя. В беседе — два столбца, в библиотеке — сколько влезет */
.file-grid {
  list-style: none; margin: 0; padding: 4px 14px 14px; overflow-y: auto;
  display: grid; gap: 8px; align-content: start;
}
#files-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#library-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.file-grid > li { position: relative; }
/* Удаление — красный кружок с белым крестиком в правом верхнем углу превью */
.file-del {
  position: absolute; top: 0; right: 0; width: 24px; height: 24px; padding: 0;
  display: grid; place-items: center; border-radius: 50%; cursor: pointer;
  background: #d63a2f; color: #fff; border: 2px solid var(--sheet); box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.file-del:hover { border-color: var(--sheet); filter: brightness(1.15); }
.file-del svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.file-grid li.muted { grid-column: 1 / -1; padding: 8px 6px; }
/* Прокручиваемый список браузер делает фокусируемым и обводит при открытии окна */
.file-grid:focus { outline: none; }
.file-card { display: flex; flex-direction: column; min-width: 0; padding-bottom: 4px; border-radius: 10px; }
.file-card:hover { background: var(--paper); }
.file-card .file-tile:hover { background: none; }
.file-chats, .file-sub { padding: 0 6px; font-size: 12px; line-height: 1.35; text-align: center; }
.file-chats { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chats .muted { font-size: inherit; }
.file-chats a { color: var(--engine); text-decoration: none; }
.file-chats a:hover { text-decoration: underline; text-underline-offset: 2px; }
.file-sub { display: flex; align-items: center; justify-content: center; gap: 2px; white-space: nowrap; }
.file-sub .icon { padding: 4px; }
.file-sub .icon svg { width: 16px; height: 16px; }
.file-tile { display: flex; flex-direction: column; gap: 6px; padding: 6px; border-radius: 10px; color: inherit; text-decoration: none; }
.file-tile:hover { background: var(--paper); }
.file-thumb {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 8px; background: var(--raised);
  color: var(--muted); overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linejoin: round; }
.file-ext { font: 600 11px/1 var(--mono); letter-spacing: .04em; }
.file-name {
  font-size: 13px; line-height: 1.3; text-align: center; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
#file-share-name { word-break: break-all; }

/* Окно просмотра файла: во весь экран, сверху имя и «Назад», снизу «Поделиться» */
#viewer {
  width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0; padding: 0;
  border: 0; border-radius: 0; box-shadow: none; background: var(--paper);
}
#viewer[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 8px; background: var(--sheet); flex: none; }
.viewer-top { padding: calc(6px + env(safe-area-inset-top)) 16px 6px 6px; border-bottom: 1px solid var(--line); }
.viewer-top h3 { flex: 1; min-width: 0; margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-actions { justify-content: center; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.viewer-actions button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; }
.viewer-actions button[hidden] { display: none; }
.viewer-actions svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#viewer-body:focus { outline: none; }
#viewer-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.viewer-wait { margin: auto; }
#viewer-body[data-kind="image"], #viewer-body[data-kind="video"] { background: #101411; }
.viewer-image { margin: auto; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
#viewer-body.zoomed { display: block; }
#viewer-body.zoomed .viewer-image { max-width: none; max-height: none; cursor: zoom-out; }
.viewer-video { margin: auto; max-width: 100%; max-height: 100%; }
.viewer-audio { margin: auto; width: min(480px, calc(100% - 32px)); }
.viewer-code { margin: 0; padding: 16px 20px; font: 13px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--raised); flex: 1; }
.viewer-doc { width: min(46rem, 100%); margin: 0 auto; padding: 20px; background: var(--raised); flex: 1; }
.viewer-doc table { display: table; }
.viewer-pages { display: flex; flex-direction: column; gap: 10px; padding: 12px; align-items: center; }
.viewer-page { width: min(900px, 100%); background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
.viewer-page canvas { display: block; width: 100%; height: 100%; }
.viewer-icon { margin: auto; padding: 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 420px; }
.viewer-icon .file-thumb { width: 160px; }
.viewer-icon-name { font-weight: 500; overflow-wrap: anywhere; }

dialog.wide { width: min(1000px, calc(100vw - 32px)); height: min(740px, calc(100vh - 32px)); padding: 0; }
dialog.wide[open] { display: flex; flex-direction: column; }
.dialog-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px 8px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.dialog-bar h3 { flex: 1; margin: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-bar form { margin: 0; }
#settings-back { display: none; margin-left: -10px; }
/* Обычный участник видит только свой аккаунт: окно узкое, без списка и карточки */
#settings:not(.admin) { width: min(420px, calc(100vw - 32px)); height: fit-content; }
#settings:not(.admin) .people, #settings:not(.admin) #card, #settings:not(.admin) #skills-open,
#settings:not(.admin) #general-open { display: none; }
/* Общие настройки: имя параметра, поле, описание; «Сохранить» — внизу, когда что-то изменили */
.general-settings { display: block; flex: 1; margin: 0; padding: 0 24px 0; overflow-y: auto; }
.general-settings > .muted { margin-top: 0; }
.engine-settings { max-width: 560px; margin: 20px 0 24px; }
.engine-settings > h4 { margin: 0 0 4px; }
.engine-settings > .muted { margin: 0 0 10px; font-size: 12.5px; }
.engine-state { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); background: var(--raised); }
.engine-state + .engine-state { border-top: 0; }
.engine-state:first-of-type { border-radius: 10px 10px 0 0; }
.engine-state:last-child { border-radius: 0 0 10px 10px; }
.engine-state > div:first-child { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 8px; min-width: 0; }
.engine-state .state { font-size: 12px; color: var(--muted); }
.engine-state.login .state, .engine-state.error .state { color: var(--error); }
.engine-state.install_error .state { color: var(--error); }
.engine-state { flex-wrap: wrap; }
.engine-state > div:first-child { flex: 1 1 210px; }
.engine-state .actions { flex-wrap: wrap; }
.engine-state small { grid-column: 1 / -1; overflow-wrap: anywhere; }
.engine-state .actions { flex: 0 0 auto; margin: 0; }
.general-settings .setting { display: grid; gap: 4px; margin: 0 0 14px; max-width: 560px; }
.general-settings .setting-name { font-size: 14px; font-weight: 500; }
.general-settings .setting input, .general-settings .setting select { width: 100%; }
.general-settings .setting small { font-size: 12.5px; line-height: 1.4; }
.general-settings .setting.changed :is(input, select) { border-color: var(--ink); }
/* Несколько значений: строки-переключатели с галочкой справа */
.general-settings .setting-list { cursor: default; }
/* Зависит от отмеченной сети — сдвинуто под список сетей */
.general-settings .setting.dependent { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line); max-width: 532px; }
.general-settings .setting[hidden] { display: none; }
.general-settings .toggles { display: grid; max-width: 560px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.general-settings .toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; border-radius: 0; padding: 10px 12px; background: var(--raised); text-align: left; font-weight: 400; }
.general-settings .toggle + .toggle { border-top: 1px solid var(--line); }
.general-settings .toggle:hover { background: var(--soft); }
.general-settings .toggle .tick { display: grid; place-items: center; width: 18px; height: 18px; visibility: hidden; }
.general-settings .toggle .tick svg { fill: none; stroke: currentColor; stroke-width: 2.2; }
.general-settings .toggle.on .tick { visibility: visible; }
.general-settings .setting-list.changed .toggles { border-color: var(--ink); }
.general-settings .save-bar { position: sticky; bottom: 0; padding: 12px 0 20px; background: var(--sheet); border-top: 1px solid var(--line); }
.general-settings .save-bar[hidden] { display: none; }
#settings:not(.admin) .users-side { flex: 1; width: auto; border: 0; }
.users-layout { flex: 1; display: flex; min-height: 0; }
.users-side { width: 220px; flex: none; padding: 16px 12px; background: var(--paper); border-right: 1px solid var(--line); overflow-y: auto; }
.account { padding: 0 6px 16px; }
#account-name { font-weight: 600; font-size: 16px; }
.account .actions { margin-top: 12px; }
.people { border-top: 1px solid var(--line); padding-top: 14px; }
.people-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 6px 6px; }
.people h4 { margin: 0; font-size: 14px; color: var(--muted); font-weight: 500; }
#users-list { list-style: none; padding: 0; margin: 0 0 12px; }
#users-list button { width: 100%; text-align: left; margin-bottom: 2px; border-color: transparent; background: none; }
#users-list button:hover { background: var(--soft); }
#users-list button.active { background: var(--sheet); border-color: var(--line); font-weight: 500; }
#general-open, #skills-open { width: 100%; margin-top: 12px; }
#general-open + #skills-open { margin-top: 8px; }
#skills-open + .actions { margin-top: 8px; }
#tg-account { display: grid; gap: 8px; margin-top: 12px; }
#tg-account + .actions { margin-top: 8px; }
.tg-head { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
#chats a .tg { width: 14px; height: 14px; opacity: .75; }
#tg-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
          max-width: 46rem; margin: 0 auto; width: 100%; box-sizing: border-box; padding: 8px 24px 18px; }
#card { flex: 1; display: flex; min-width: 0; }
#card > .muted { padding: 20px; }
.tabs { width: 150px; flex: none; display: flex; flex-direction: column; gap: 2px; padding: 18px 8px; border-right: 1px solid var(--line); }
.tabs button { text-align: left; border-color: transparent; background: none; }
.tabs button:hover { background: var(--soft); }
.tabs button.active { background: var(--raised); border-color: var(--line); font-weight: 500; }
.panel { flex: 1; padding: 0 24px; overflow-y: auto; }
.panel > h3 { margin: 20px 0 12px; font-size: 20px; }
.panel > .muted { max-width: 60ch; }
table.info { width: 100%; border-collapse: collapse; }
table.info th { text-align: left; font-weight: 400; color: var(--muted); padding: 7px 12px 7px 0; width: 45%; }
table.info td, table.info th { border-bottom: 1px solid var(--line); }
table.info td { padding: 7px 0; font-variant-numeric: tabular-nums; }
table.info .logo { width: 14px; height: 14px; }
.actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.actions.save { position: sticky; bottom: 0; background: var(--sheet); padding: 12px 0; border-top: 1px solid var(--line); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.num { font-size: 14px; }
.num input { width: 84px; padding: 5px 9px; margin-left: 4px; }
.option { margin-bottom: 14px; }
.option .muted { margin-left: 24px; max-width: 60ch; }
.option .sub { margin: 10px 0 0 24px; padding-left: 12px; border-left: 2px solid var(--line); }
.option .sub .option { margin-bottom: 10px; }
.option .sub > .muted { margin-left: 0; }
.list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0 24px; max-width: 60ch; font-size: 13.5px; color: var(--muted); }
.danger-zone { border: 1.5px solid var(--error); border-radius: 10px; padding: 10px 14px 4px; margin: 6px 0 12px; }
.danger-zone h4 { margin: 0 0 6px; color: var(--error); font-size: 14px; }
.danger-zone > p:not(.muted) { margin: 0 0 12px; font-size: 13.5px; max-width: 60ch; }
.list textarea { color: var(--ink); font-family: var(--mono); resize: vertical; }
fieldset.engine {
  border: 1px solid var(--line); border-top: 3px solid var(--engine); border-radius: 12px;
  margin: 0 0 16px; padding: 12px 16px 6px; background: var(--raised);
}
fieldset.engine legend { font-weight: 600; padding: 0 6px; }
fieldset.engine > p.muted { margin: 0 0 12px; }
.limits { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.model { padding: 8px 0; border-top: 1px solid var(--line); }
.efforts { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 0 24px; font-size: 13.5px; }
progress { width: 100%; margin: 12px 0; accent-color: var(--ink); }
.site-skills { padding: 0 24px 24px; overflow-y: auto; }
.site-skills .option .muted { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.new-user { display: flex; flex-direction: column; gap: 10px; padding: 0 24px; max-width: 380px; }
input:disabled + *, label:has(input:disabled) { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- Телефон: беседа на весь экран, панель бесед выезжает слева,
   настройки — на весь экран по шагам. Отступы env() — под вырез и полоску «Домой». --- */
@media (max-width: 760px) {
  #side {
    position: fixed; inset: 0 auto 0 0; z-index: 10; transform: translateX(-100%); transition: transform .2s;
    width: min(320px, 86vw); padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }
  #side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  #scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(20, 28, 24, .4); }
  #menu { display: block; margin-left: -4px; }
  /* Шапка в две строки: ☰ название 📁 🗑, ниже — модель и уровень размышления */
  #chat header { flex-wrap: wrap; gap: 6px 4px; padding: calc(6px + env(safe-area-inset-top)) 6px 8px 10px; min-height: 0; }
  #chat header::after { content: ""; order: 3; flex-basis: 100%; }
  #title { order: 1; flex: 1; min-width: 0; font-size: 16px; }
  #files-open, #chat-settings-open, #delete { order: 2; }
  #chat header select { min-width: 0; padding: 5px 8px; }
  #feed { padding: 18px 12px 8px; }
  #feed > * { padding-left: 26px; background-position-x: 7px; }
  #feed > :first-child { background-position: 7px 26px; }
  .msg-user { padding-left: 40px !important; }
  .msg-user::before { left: 26px; }
  .msg-user::after { left: 2px; }
  .msg-error::after, .thinking::after, .msg-transcribing::after { left: 3px; }
  .msg-tools::after { left: 1px; }
  #composer { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  #tg-bar { padding: 6px 16px calc(10px + env(safe-area-inset-bottom)); }
  #tg-bar button { width: 100%; }

  dialog.wide, #settings:not(.admin) {
    width: 100%; height: 100%; max-width: 100%; max-height: 100%; margin: 0;
    border: 0; border-radius: 0; box-shadow: none;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  }
  .dialog-bar { padding: 6px 6px 6px 16px; }
  #settings:not([data-level="list"]) #settings-back { display: block; }
  #settings[data-level="list"] #card,
  #settings:not([data-level="list"]) .users-side,
  #settings[data-level="user"] .panel,
  #settings[data-level="section"] .tabs { display: none; }
  .users-layout, #card { flex-direction: column; }
  .users-side { flex: 1; width: auto; border: 0; background: var(--sheet); padding: 16px; }
  .account { padding: 0 0 18px; }
  .people-head { margin: 0 0 4px; }
  /* Список участников и разделов — строки во всю ширину со стрелкой, как в iOS */
  #users-list button, .tabs button {
    display: flex; justify-content: space-between; align-items: center; width: 100%;
    padding: 13px 2px; margin: 0; font-size: 16px; font-weight: 400;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none;
  }
  #users-list button::after, .tabs button::after { content: "›"; color: var(--muted); font-size: 22px; line-height: 1; }
  #users-list button.active, .tabs button.active { background: none; border-color: var(--line); font-weight: 400; }
  #card { flex: 1; min-height: 0; }
  .tabs { width: auto; flex: 1; flex-direction: column; gap: 0; border: 0; padding: 4px 16px; }
  .panel { padding: 0 16px; }
  .panel > h3 { margin-top: 14px; }
}

/* Уведомления в «Настройках» */
#push-account { margin-top: 10px; display: grid; gap: 4px; font-size: 14px; }
#push-account:empty { display: none; }
#push-account .check { align-items: flex-start; }
#push-account .check input { margin-top: 3px; flex: none; }
#push-account .muted { font-size: 12.5px; padding-left: 26px; }

/* Перетаскивание файлов: поле ввода подсвечено, поверх — подсказка */
#composer { position: relative; }
#drop-hint { display: none; }
#composer.dropping #drop-hint {
  display: grid; place-items: center; position: absolute; inset: 2px 16px 12px; z-index: 3; margin: 0 !important; max-width: none;
  border: 2px dashed var(--engine); border-radius: 14px; background: color-mix(in srgb, var(--sheet) 88%, transparent);
  color: var(--engine); font-weight: 500; pointer-events: none;
}
