/* === V2.CSS === */
/* apps/web/assets/css/v2.css */
/* НАЗНАЧЕНИЕ: новый вид, тестовая страница /v2 (01.10.2026). Грузится после app.css
   и side.css и переопределяет их. ChatGPT: пустой экран с полем по центру, поле-
   таблетка. Claude: меню слева, свернутое "Размышление", граф в панели справа.
   Perplexity: карточки источников над ответом, сноски кружками. Минимализм по
   ui-ux-pro-max (Swiss: воздух, контраст, переходы 200-250 мс). Телефон первым. */
/* СВЯЗИ: v2.html, assets/js/v2.js, app.css и side.css (база) */

/* Токены (цвета "Чернила" темной и светлой темы, шкалы) - в tokens.css. */

body.v2 {
  font: var(--fs-base)/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

/* --- шапка: тонкая, без лишнего, как у ChatGPT --- */
body.v2 .top {
  height: var(--head-h);
  padding: 0 12px;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
}
body.v2 .brand { gap: 10px; }
body.v2 .brand h1 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
/* Шапка на любом телефоне в одну строку (02.10.2026, скриншот владельца: все
   съезжало вправо и обрезалось). Кнопки справа не сжимаются никогда, название
   уступает место и обрезается многоточием. */
body.v2 .top { gap: 8px; min-width: 0; }
body.v2 .brand { flex: 1 1 auto; min-width: 0; align-items: center; }
body.v2 .brand h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.v2 .brand .icon-btn, body.v2 .brand-mark { flex: none; }
body.v2 .top-right { flex: none; min-width: 0; gap: 4px; }
@media (max-width: 360px) {
  body.v2 .top { padding: 0 6px; }
  body.v2 .brand { gap: 6px; }
  body.v2 .brand h1 { font-size: 14px; }
}
body.v2 .brand-mark { display: block; border-radius: 6px; }
/* Значки шапки (08.10.2026, владелец: "лучше видны"): крупнее, цвет текста
   вместо приглушенного, при наведении - подложка. */
body.v2 .icon-btn {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: color-mix(in oklab, var(--text) 82%, var(--muted));
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
body.v2 .icon-btn:hover { background: var(--panel-2); color: var(--text); }
body.v2 .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.v2 .icon-btn svg { width: 22px; height: 22px; }
body.v2 #graph-toggle[aria-pressed="true"] { color: var(--accent); }
body.v2 .corpus { border: 0; background: transparent; color: var(--muted); text-decoration: none; }
/* Метка версии ведет на страницу актуальности базы. */
body.v2 a.corpus:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* --- меню: разделы сверху, чаты, подвал --- */
body.v2 .side { background: var(--panel); }
body.v2 .side-new { border-radius: 10px; background: transparent; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 0; }
.side-tab {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.side-tab svg { width: 18px; height: 18px; flex: none; }
.side-tab:hover { background: var(--panel-2); color: var(--text); }
.side-tab[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
body.v2 .side-item { border-radius: 10px; }
body.v2 .side-item[aria-current="true"] { box-shadow: none; }
.side-link-reg { font-size: 12px; color: var(--muted); display: inline-block; min-height: 24px; }

/* --- каркас: лента по центру, граф справа на широком экране --- */
body.v2 { min-height: 100dvh; }
.shell { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); }
body.v2 main.thread { min-width: 0; max-width: none; margin: 0; padding: 0 16px; }
#panel-search {
  max-width: 760px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--head-h));
  display: flex;
  flex-direction: column;
}
#panel-search[hidden] { display: none; }
body.v2 .audit { max-width: 760px; margin: 0 auto; padding: 16px 0 40px; }

/* Пустой чат: приветствие и поле по центру. Есть ходы - поле прилипает к низу. */
.hero { display: none; text-align: center; padding: 0 0 22px; }
#panel-search:not(:has(.turn)) { justify-content: center; padding-bottom: 6vh; }
#panel-search:not(:has(.turn)) .hero { display: block; }
.hero-mark { display: block; margin: 0 auto 14px; filter: drop-shadow(0 6px 24px color-mix(in oklab, var(--accent) 35%, transparent)); }
.hero-title { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; }
.hero-sub { margin: 8px auto 0; max-width: 420px; font-size: 14px; color: var(--muted); }

/* --- декоративные визуализации над приветствием (01.10.2026) ---
   Тот же язык, что у панели графа и поля ввода: карточка panel без резких рамок,
   радиус 12px, приглушенная подпись. Видны только в пустом чате, как и hero:
   с первым вопросом лента начинается сразу с вопроса. */
body.v2 .showcase {
  max-width: none;
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 18px 0 26px;
}
#panel-search:not(:has(.turn)) .showcase { display: grid; }
body.v2 .fx-box {
  background: var(--panel);
  border: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
  border-radius: var(--radius);
  overflow: hidden;
}
body.v2 .fx-canvas {
  height: 230px;
  background:
    radial-gradient(70% 80% at 50% 50%, color-mix(in oklab, var(--accent) 7%, transparent), transparent 70%),
    var(--bg);
}
/* Пустой экран с блоками выше: поле не центрируем по вертикали жестко,
   иначе на низком экране блоки упирались в шапку. */
#panel-search:not(:has(.turn)) { justify-content: flex-start; padding-top: 6px; }
/* app.css на узком экране ставит .showcase order:1 (вниз, под граф) - это было
   для старой раскладки. Здесь блоки в пустом чате над приветствием. */
body.v2 .showcase { order: 0; }
@media (max-width: 700px) {
  body.v2 .showcase { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 8px 0 14px; }
  body.v2 .fx-canvas { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  body.v2 .fx-canvas { background: var(--bg); }
}

body.v2 .out { gap: 28px; padding-top: 20px; margin: 0; }
#panel-search:has(.turn) .out { flex: 1; }

/* --- поле вопроса: таблетка с круглой кнопкой --- */
.dock { padding: 8px 0 calc(10px + env(safe-area-inset-bottom)); }
#panel-search:has(.turn) .dock {
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: linear-gradient(to top, var(--bg) 72%, transparent);
  padding-top: 18px;
}
body.v2 .ask {
  position: static;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  box-shadow: 0 8px 30px oklch(0% 0 0 / 0.18);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
body.v2 .ask:focus-within { border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); }
body.v2 .ask input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font: 16px/1.4 Geist, Inter, system-ui, sans-serif; /* 16px: iPhone не приближает страницу при вводе */
  color: var(--text);
}
body.v2 .ask input:focus-visible { outline: none; }
.ask-row { display: flex; align-items: center; gap: 6px; }
body.v2 .ask select {
  border: 0;
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--muted);
  padding: 7px 8px;
  min-height: 34px;
  font: 500 12px "JetBrains Mono", monospace;
  cursor: pointer;
}
body.v2 .ask .send {
  width: 40px; height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
body.v2 .ask .send svg { width: 19px; height: 19px; }
body.v2 .ask .send:active { transform: scale(0.94); }
body.v2 .ask .send:disabled { opacity: 0.35; }
@media (max-width: 620px) {
  body.v2 .ask { gap: 6px; padding: 5px 5px 5px 16px; }
  body.v2 .ask select { padding: 7px 6px; }
  body.v2 .ask .send { padding: 0; }
}

body.v2 .samples { justify-content: center; gap: 8px; margin-top: 14px; }
body.v2 .samples button {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  min-height: 36px;
  font: 13px/1.3 Geist, Inter, system-ui, sans-serif;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
body.v2 .samples button:hover { color: var(--text); background: var(--panel); border-style: solid; }
.dock-note { margin: 8px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
#panel-search:has(.turn) .dock-note { margin-top: 6px; }

/* --- ход: вопрос пузырем, ответ без рамки --- */
body.v2 .turn { gap: 14px; }
body.v2 .turn-q {
  max-width: 82%;
  padding: 10px 16px;
  border: 0;
  border-radius: 20px;
  background: var(--panel-2);
  font-size: 15px;
}
/* Ответ - главная информация хода: видимая рамка акцентом, мягкая подложка
   и тень (01.10.2026, владелец: "четко видно, что это ответ, видны границы,
   змейка по кругу"). Без рамки ответ сливался с карточками источников и
   нормами ниже. Змейку рисует answer-glow.js поверх этой рамки. */
body.v2 .answer {
  position: relative;
  border: 1px solid color-mix(in oklab, var(--accent) 70%, transparent);
  border-radius: 14px;
  background: color-mix(in oklab, var(--accent) 5%, var(--panel));
  padding: 16px 20px 14px;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 12%, transparent),
              0 8px 28px color-mix(in oklab, var(--accent) 10%, transparent);
}
body.v2 .answer-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.v2 .answer-body { font-size: 16px; line-height: 1.68; }
body.v2 .answer-body p:first-child { font-weight: 500; }
body.v2 .answer .understood {
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in oklab, var(--accent) 55%, transparent);
  font-size: 13px;
  color: var(--muted);
}
/* Сноски кружками, как у Perplexity. Зона нажатия 44px - невидимым ::after
   (12.10.2026): сам кружок компактный, иначе строки ответа разъедутся. */
body.v2 .answer-body a.ref {
  position: relative;
  min-width: 24px; min-height: 24px; line-height: 20px;
  padding: 0 6px;
  margin: 0 1px;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 12px;
  background-color: var(--panel-2);
  color: var(--muted);
  font: 500 12px/20px "JetBrains Mono", monospace;
  vertical-align: 1px;
}
body.v2 .answer-body a.ref::after {
  content: ""; position: absolute; inset: -10px -8px;
}
body.v2 .answer-body a.ref:hover { background-color: color-mix(in oklab, var(--accent) 22%, var(--panel-2)); color: var(--text); }
body.v2 .answer-note { font-size: 12px; margin-top: 10px; }
/* Пометка «Ответ ИИ» над ответом (AI Act art. 50, 14.10.2026). */
.answer-ai {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0 0 10px; padding: 2px 10px;
  border: 1px solid var(--line, color-mix(in oklab, var(--muted) 40%, transparent));
  border-radius: 999px;
  font: 500 12px/20px "JetBrains Mono", monospace;
  color: var(--muted);
}
.answer-ai::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* --- карточки источников над ответом --- */
.src-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 2px 0 6px;
  margin: 0 -2px;
  scrollbar-width: thin;
}
.src-card {
  flex: 0 0 auto;
  width: 172px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  scroll-snap-align: start;
  font: inherit; /* кнопка в Safari не наследует шрифт страницы */
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.src-card:hover { border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); background: var(--panel-2); }
.src-n {
  flex: none;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font: 500 11px "JetBrains Mono", monospace;
}
.src-txt { min-width: 0; display: flex; flex-direction: column; }
.src-title, .src-file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-title { font-size: 13px; font-weight: 500; }
.src-file { font: 11px "JetBrains Mono", monospace; color: var(--muted); }

/* --- "Откуда информация": спокойнее, без рамок-ящиков --- */
body.v2 .sources-title {
  margin: 10px 0 0;
  font: 600 11px "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
body.v2 .basis, body.v2 .why, body.v2 .frag, body.v2 .scope { border-radius: var(--radius); background: var(--panel); }
body.v2 .frag-head { background: transparent; border-bottom-color: var(--line); }
body.v2 .chip { border-radius: 10px; }
body.v2 .notice, body.v2 .refusal, body.v2 .err { border-radius: var(--radius); border-left-width: 1px; }
body.v2 .refusal { background: var(--panel); font-size: 15px; }
.on-graph { align-self: flex-start; gap: 8px; }
.on-graph-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* --- "Размышление": во время поиска список шагов, после ответа одна строка --- */
body.v2 .stages {
  border: 0;
  background: none;
  padding: 2px 0 2px 14px;
  margin: 0;
  border-left: 2px solid var(--line);
}
body.v2 .stage { font: 13px/1.9 Geist, Inter, system-ui, sans-serif; }
body.v2 .stage .mark { font-size: 0; width: 14px; height: 14px; display: grid; place-items: center; }
body.v2 .stage .mark::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
body.v2 .stage.run .mark::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
body.v2 .stage.done .mark::before { background: var(--ok); }
body.v2 .stage.run span:last-child {
  background: linear-gradient(90deg, var(--muted) 20%, var(--text) 50%, var(--muted) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: v2-shimmer 1.8s linear infinite;
}
@keyframes v2-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
body.v2 .stage-note { margin: 0 0 4px 22px; font-size: 13px; }
.think > summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  border-radius: 8px;
}
.think > summary::-webkit-details-marker { display: none; }
.think > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s var(--ease);
  margin: 0 3px 0 2px;
}
.think[open] > summary::before { transform: rotate(45deg); }
.think > summary:hover { color: var(--text); }
.think-name { font-weight: 500; }
/* opacity 0.8 давала 4.48:1 на темном фоне (axe 07.10.2026) - нужно 4.5 */
.think-meta { font: 12px "JetBrains Mono", monospace; opacity: 0.9; }
.think[open] .stages { margin-top: 6px; }

/* --- ГРАФ: наша фишка --- */
body.v2 .col-graph {
  order: 0;
  position: relative;
  top: auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(120% 70% at 50% 40%, color-mix(in oklab, var(--accent) 7%, transparent), transparent 70%),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
body.v2 .graph-head {
  background: transparent;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
  padding: 6px 6px 6px 14px;
  gap: 8px;
}
body.v2 .graph-title { font-size: 13px; font-weight: 600; }
body.v2 .graph-tools { gap: 4px; align-items: center; }
body.v2 .graph-tools .chip { border: 0; background: transparent; min-height: 32px; padding: 6px 9px; }
body.v2 .graph-tools .chip:hover { background: var(--panel-2); }
body.v2 .graph-tools .chip[aria-pressed="true"] { background: var(--panel-2); color: var(--accent); }
body.v2 .graph-tools .icon-btn { width: 32px; height: 32px; }
body.v2 .cy { background: transparent; height: 320px; min-height: 0; }
/* Поиск узла: номер статьи или часть имени документа (05.10.2026). */
.graph-find { padding: var(--sp-2) 14px 0; }
.graph-find input {
  width: 100%;
  min-height: 36px;
  padding: 6px var(--sp-3);
  font: var(--fs-sm)/1.3 var(--font-ui);
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--round);
}
.graph-find input::placeholder { color: var(--muted); }
.graph-find input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
:root[data-theme="light"] .graph-find input:focus-visible { outline-color: var(--gold-ink); }
/* Кнопка "Открыть статью" над описанием узла: путь от узла к тексту в один клик. */
.graph-info .g-open { display: flex; width: fit-content; margin: 0 0 var(--sp-2); min-height: 32px; }
body.v2 .legend { border-top: 0; padding: 6px 14px; gap: 6px 14px; }
body.v2 .graph-info { border-top: 1px solid color-mix(in oklab, var(--line) 70%, transparent); padding: 9px 14px; }

/* Телефон: граф - карточка в ленте; в пустом чате под полем ввода */
.graph-home { padding: 4px 0 24px; }
/* Тапы под палец на телефоне (12.10.2026, taste-skill: зоны ≥44px): визуально
   компактно, зона нажатия - за счет min-height. Шрифты подписей ≥12px.
   Планшет тоже тач (12.10.2026): ступень 768, а не 620. */
@media (max-width: 768px) {
  body.v2 .icon-btn { width: 44px; height: 44px; }
  body.v2 #brand-home { min-height: 44px; }
  body.v2 .top-login, body.v2 .top-login-ghost, body.v2 .top-acct {
    min-height: 44px; min-width: 44px;
  }
  body.v2 .ask .send { width: 44px; height: 44px; }
  body.v2 .ask select { min-height: 44px; }
  body.v2 .samples button { min-height: 44px; }
  body.v2 .graph-tools .chip { min-height: 44px; }
  body.v2 .graph-tools .icon-btn { width: 44px; height: 44px; }
  body.v2 .graph-find input { min-height: 44px; font-size: 16px; }
  body.v2 .graph-info .g-open { min-height: 44px; align-items: center; }
}
/* Мелкие контролы и подписи только на телефоне (620): на планшете места хватает. */
@media (max-width: 620px) {
  body.v2 .legend, body.v2 .graph-info { font-size: 12px; }
  body.v2 .answer-note { font-size: 12px; }
  .src-file, .src-n, .src-count { font-size: 12px; }
  .side-note, .side-guest, .side-group { font-size: 12px; }
  .dock-note { font-size: 12px; }
}
#panel-search:has(.turn) .graph-home { display: none; }
body.v2 .turn > .col-graph { margin: 2px 0; }
@media (max-width: 620px) {
  body.v2 .graph-stat { display: none; }
  body.v2 .cy { height: 280px; }
  body.v2 .legend { font-size: 12px; }
  .hero-title { font-size: 23px; }
  .hero-mark { width: 44px; height: 44px; }
  .src-card { width: 150px; }
}

/* Широкий экран: граф - панель справа во всю высоту, как артефакты у Claude */
@media (min-width: 1100px) {
  .shell { grid-template-columns: minmax(0, 1fr) clamp(380px, 38vw, 620px); }
  body.graph-off .shell { grid-template-columns: minmax(0, 1fr); }
  body.graph-off .shell > .col-graph { display: none; }
  .graph-home { display: none; }
  body.v2 .shell > .col-graph {
    position: sticky;
    top: var(--head-h);
    height: calc(100dvh - var(--head-h));
    border-radius: 0;
    border-width: 0 0 0 1px;
  }
  body.v2 .shell > .col-graph .cy { flex: 1; height: auto; }
}
/* Граф на весь экран (кнопка в шапке графа). После правил панели: они бы его перебили. */
body.v2 .col-graph.full, body.v2 .shell > .col-graph.full {
  position: fixed;
  inset: 0;
  z-index: 40;
  margin: 0;
  border-radius: 0;
  border: 0;
  height: 100dvh;
}
body.v2 .col-graph.full .cy { flex: 1; height: auto; }
body.graph-full-open { overflow: hidden; }

@media (max-width: 1099px) {
  #graph-toggle { display: none; }
}
@media (max-width: 700px) {
  body.v2 .corpus { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body.v2 .stage.run span:last-child { animation: none; color: var(--text); background: none; }
}

/* --- иконки Phosphor regular: тонкий контур цветом текста --- */
body.v2 svg.ph { width: 20px; height: 20px; flex: none; }
body.v2 .side-new svg.ph { width: 18px; height: 18px; }
body.v2 .ask .send svg.ph { width: 19px; height: 19px; }
.src { display: flex; flex-direction: column; gap: 8px; }
.src-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.src-head svg.ph { width: 17px; height: 17px; }
.src-count { font: 500 11px "JetBrains Mono", monospace; padding: 1px 7px; border-radius: 10px; background: var(--panel-2); }
.on-graph svg.ph { width: 16px; height: 16px; color: var(--ok); }

/* --- граф "нейросеть": глубина фона и свечение ядра --- */
body.v2 .col-graph {
  background:
    radial-gradient(60% 45% at 50% 45%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(40% 30% at 70% 70%, color-mix(in oklab, var(--warn) 5%, transparent), transparent 70%),
    var(--panel);
}
:root[data-theme="light"] body.v2 .col-graph { background: radial-gradient(60% 45% at 50% 45%, color-mix(in oklab, var(--accent) 8%, transparent), transparent 70%), var(--panel); }
body.v2 .sw { width: 9px; height: 9px; }
body.v2 .sw-art { background: color-mix(in oklab, var(--accent) 45%, transparent); border-color: transparent; }
body.v2 .sw-bridge { box-shadow: 0 0 8px var(--accent); }
body.v2 .sw-file { border-radius: 50%; background: var(--bg); border: 2px solid var(--warn); }
body.v2 .sw-found { box-shadow: 0 0 8px var(--ok); }

/* --- язык интерфейса: одна кнопка в шапке (08.10.2026) --- */
body.v2 .ask select[hidden] { display: none; }
body.v2 .icon-btn.top-lang { width: auto; min-width: 40px; padding: 0 8px; }
.top-lang-code {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 4px;
  font: 700 12px/1 "JetBrains Mono", monospace; letter-spacing: 0.02em;
  border: 1.5px solid currentColor; border-radius: 6px;
}

/* --- низ меню: тарифы на виду и строка аккаунта, как у ChatGPT --- */
.side-bottom { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.side-guest { margin: 2px 10px 6px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.side-guest-link {
  padding: 0; border: 0; background: none; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.side-guest-link:hover { color: var(--text); }
/* Светлые палитры: акцент на белом ниже 4.5:1, ссылку темним текстом. */
:root[data-theme="light"] .side-guest-link { color: color-mix(in oklab, var(--accent) 55%, var(--text)); }
.save-bar { margin: 0 0 10px; }
/* Справка (07.10.2026): была бледной мелкой ссылкой - теперь строка меню с иконкой */
.side-help {
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 10px; border-radius: 10px;
  font-size: 13px; color: var(--text); text-decoration: none;
}
.side-help::before {
  content: "?"; width: 18px; height: 18px; flex: none; display: grid; place-items: center;
  font: 600 11px/1 var(--font-ui, inherit); color: var(--accent);
  border: 1.5px solid currentColor; border-radius: 50%;
}
.side-help:hover { background: var(--panel-2); }
/* Приветствие после регистрации */
.welcome-plan { margin: 0 0 10px; font-weight: 500; }
.welcome-steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.welcome-actions .auth-submit { width: auto; padding: 0 16px; }
@media (max-width: 520px) { .save-bar span { flex-basis: 100%; } }
.side-billing {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 0 10px;
  border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px;
  border: 1px solid color-mix(in oklab, var(--accent) 40%, var(--line));
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  transition: background 0.2s var(--ease);
}
.side-billing:hover { background: color-mix(in oklab, var(--accent) 16%, transparent); }
.side-billing svg.ph { width: 18px; height: 18px; color: var(--accent); }
.side-billing-tag { margin-left: auto; font: 500 11px "JetBrains Mono", monospace; color: var(--muted); }
.acct {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 6px 10px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: background 0.2s var(--ease);
}
.acct:hover, .acct:focus-visible { background: var(--panel-2); }
.acct-ava { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: color-mix(in oklab, var(--accent) 22%, var(--panel-2)); color: var(--accent); }
.acct-ava svg.ph { width: 22px; height: 22px; }
.acct-txt { display: grid; min-width: 0; line-height: 1.25; }
.acct-name { font-size: 14px; font-weight: 500; }
.acct-txt small { font-size: 12px; color: var(--muted); }
/* Длинная почта и строка "обновится" не наезжают на шестеренку (07.10.2026) */
.acct .acct-name, .acct .acct-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-top .acct-name { overflow-wrap: anywhere; }
.acct-gear { margin-left: auto; color: var(--muted); }
body.v2 .side.locked .side-bottom { pointer-events: auto; opacity: 1; }

/* меню аккаунта: всплывает над строкой аккаунта (Popover API) */
.acct-menu {
  position: fixed; inset: auto auto 64px 10px; margin: 0;
  width: 264px; max-width: calc(100vw - 20px);
  padding: 6px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 18px 50px oklch(0% 0 0 / 0.45);
}
.acct-menu:popover-open { display: flex; flex-direction: column; }
/* Меню не выходит за экран (12.10.2026): на ноутбуке высотой ~870 px "Выйти" уходил за край. */
.acct-menu { max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; }
.acct-menu.from-top { max-height: calc(100dvh - var(--head-h) - 14px); }
/* Политика и оферта - мелкими ссылками внизу: нужны редко, место в меню не занимают. */
.acct-legal { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 0; padding: 6px 10px 4px; }
.acct-legal a { font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; border-radius: 4px; }
.acct-legal a:hover { color: var(--text); }
.acct-legal a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acct-top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.acct-sep { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }
.acct-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.acct-item:hover, .acct-item:focus-visible { background: var(--panel-2); }
.acct-item svg.ph { width: 19px; height: 19px; color: var(--muted); }
.acct-item-hl svg.ph { color: var(--accent); }
.acct-item .side-billing-tag { margin-left: auto; }
/* Кабинет (07.10.2026): подписка с датой, язык интерфейса в меню */
.acct-sub-txt { display: grid; line-height: 1.25; }
/* Поддержка у клиента (08.10.2026): значок непрочитанного и переписка */
.sup-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center;
  font: 700 11px/1 "JetBrains Mono", monospace; color: var(--accent-ink); background: var(--accent); border-radius: 999px;
}
.top-acct { position: relative; }
.top-acct-dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--bg); }
:root[data-theme="light"] .sup-badge { background: var(--gold); color: var(--on-gold); }
/* У значка свой display - без этого правила hidden его не прятал и висел «0». */
.sup-badge[hidden], .top-acct-dot[hidden] { display: none; }
.sup-new { width: 100%; margin-bottom: 12px; }
.sup-threads { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sup-thread {
  width: 100%; display: grid; gap: 4px; padding: 10px 12px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
}
.sup-thread.is-unread { border-color: var(--accent); }
.sup-thread-top { font-size: 12px; color: var(--muted); }
.sup-thread-txt { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-thread-new { font: 600 11px/1 "JetBrains Mono", monospace; color: var(--accent); }
:root[data-theme="light"] .sup-thread-new { color: var(--gold-ink); }
/* Переписка (08.10.2026): лента с днями, пузыри, фото и файлы, поле со скрепкой. */
.sup-msgs {
  display: flex; flex-direction: column; gap: 2px; margin: 12px 0; padding: 4px 12px 14px;
  height: min(52vh, 520px); overflow-y: auto; border: 1px solid var(--line); border-radius: 14px;
  background: radial-gradient(circle at 1px 1px, color-mix(in oklab, var(--line) 55%, transparent) 1px, transparent 0) 0 0 / 22px 22px, var(--bg);
}
.sup-day {
  align-self: center; margin: 12px 0 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line);
}
.sup-row { display: flex; margin-top: 8px; }
.sup-row.is-cont { margin-top: 3px; }
.sup-row.from-client { justify-content: flex-end; }
.sup-msg {
  max-width: 82%; padding: 7px 11px 5px; border-radius: 16px; font-size: 14px; line-height: 1.5;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 2px oklch(0% 0 0 / 0.16);
}
.from-admin .sup-msg { border-bottom-left-radius: 6px; }
.from-client .sup-msg { border-bottom-right-radius: 6px; border-color: transparent; background: color-mix(in oklab, var(--accent) 22%, var(--panel)); }
:root[data-theme="light"] .from-client .sup-msg { background: var(--teal-soft); }
.is-cont.from-admin .sup-msg { border-top-left-radius: 6px; }
.is-cont.from-client .sup-msg { border-top-right-radius: 6px; }
.sup-author { display: block; margin-bottom: 1px; font-size: 12px; font-weight: 600; color: var(--accent); }
:root[data-theme="light"] .sup-author { color: var(--gold-ink); }
.sup-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sup-time { display: block; margin-top: 1px; text-align: right; font: 11px/1.4 "JetBrains Mono", monospace; color: var(--muted); }
.from-client .sup-time { color: color-mix(in oklab, var(--text) 72%, transparent); }
.sup-closed { align-self: center; margin: 14px 0 4px; font-size: 13px; color: var(--muted); text-align: center; }
.sup-files { display: grid; gap: 6px; margin-top: 6px; }
.sup-photo { display: block; max-width: 280px; border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.sup-photo img { display: block; width: 100%; max-height: 240px; object-fit: cover; }
.sup-file {
  display: flex; align-items: center; gap: 10px; min-width: 200px; max-width: 280px; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none;
}
.sup-file:hover { border-color: var(--accent); }
.sup-file svg, .sup-chip svg, .sup-ibtn svg, .sup-sendbtn svg {
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none;
}
.sup-file svg { width: 22px; height: 22px; color: var(--accent); }
.sup-file-txt { display: grid; min-width: 0; }
.sup-file-txt b { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-file-txt small { font-size: 12px; color: var(--muted); }
.sup-photo:focus-visible, .sup-file:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sup-reply { position: relative; display: grid; gap: 6px; }
.sup-reply[hidden] { display: none; }
.sup-box {
  display: flex; align-items: flex-end; gap: 4px; padding: 5px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--bg);
}
.sup-box:focus-within { border-color: var(--accent); }
.sup-box textarea {
  flex: 1; min-height: 36px; max-height: 160px; padding: 8px 4px; border: 0; background: none; resize: none;
  font: inherit; font-size: 14px; line-height: 1.45; color: var(--text);
}
.sup-box textarea:focus-visible { outline: none; }
.sup-ibtn, .sup-sendbtn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer;
}
.sup-ibtn { background: none; color: var(--muted); }
.sup-ibtn:hover { background: var(--panel-2); color: var(--text); }
.sup-sendbtn { background: var(--accent); color: var(--accent-ink); }
.sup-sendbtn:disabled { opacity: 0.55; cursor: progress; }
:root[data-theme="light"] .sup-sendbtn { background: var(--gold); color: var(--on-gold); }
.sup-ibtn svg, .sup-sendbtn svg { width: 20px; height: 20px; }
.sup-ibtn:focus-visible, .sup-sendbtn:focus-visible, .sup-chip-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sup-hint { margin: 0 2px; font-size: 12px; color: var(--muted); }
.sup-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sup-chips[hidden], .sup-drop[hidden] { display: none; }
.sup-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px; padding: 3px 4px 3px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px;
}
.sup-chip svg { width: 14px; height: 14px; color: var(--accent); }
.sup-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-chip small { color: var(--muted); white-space: nowrap; }
.sup-chip.is-pending { opacity: 0.7; }
.sup-chip-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }
.sup-chip-x:hover { background: var(--line); color: var(--text); }
.sup-drop {
  position: absolute; inset: -4px; z-index: 2; display: grid; place-items: center; border-radius: 14px;
  border: 2px dashed var(--accent); background: color-mix(in oklab, var(--panel) 90%, transparent);
  font-weight: 600; pointer-events: none;
}
.acct-sub-txt small { font-size: 12px; color: var(--muted); }
.ask-dlg-fields textarea, .ask-dlg-fields select {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
}
.ask-dlg-fields textarea { resize: vertical; min-height: 110px; }
.ask-dlg-text { white-space: pre-line; }

/* окно настроек */
.settings {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--panel); color: var(--text);
  box-shadow: 0 24px 70px oklch(0% 0 0 / 0.5);
}
.settings::backdrop { background: oklch(0% 0 0 / 0.55); backdrop-filter: blur(2px); }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--line); }
.set-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.set-body { padding: 6px 20px 18px; overflow: auto; }
.set-sec { padding: 14px 0; border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent); }
.set-sec:last-child { border-bottom: 0; }
.set-sec h3, .settings .pv-head { margin: 0 0 10px; font: 600 11px "JetBrains Mono", monospace; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.settings .pal { padding: 0; }
.settings .pal-title { display: none; }
.settings .pal-btn { width: 34px; height: 34px; }
.settings .side-privacy { border: 0; padding: 0; margin: 0; background: none; }
.settings .pv-row { font-size: 14px; padding: 6px 0; }
.settings .pv-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; }
.settings .pv-links a, .settings .side-link-reg { color: var(--muted); font-size: 13px; }
.settings .side-note { border: 0; padding: 0 0 8px; margin: 0; font-size: 13px; color: var(--muted); }
@media (max-width: 620px) {
  .settings { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* === Телефон: читабельно и без обрезаний, обе темы (02.10.2026) ===
   Скриншот владельца: на телефоне часть ответа уходила за правый край. Главная
   причина - шапка (правила вверху файла); здесь порядок в остальном ходе. */
/* Свечение змейки (answer-glow.js) рисуется на 14px шире рамки ответа: при
   узких полях оно выходило за экран и давало прокрутку вбок. Лишнее срезаем. */
body.v2 main.thread { overflow-x: clip; }
@media (max-width: 620px) {
  body.v2 main.thread { padding: 0 12px; }
  body.v2 .out { gap: 18px; }
  body.v2 .turn { gap: 12px; }
  body.v2 .turn-q { max-width: 88%; overflow-wrap: anywhere; }
  /* Ответ: поля меньше - строке больше места; длинные слова (адреса, номера)
     переносятся, а не растягивают рамку. */
  body.v2 .answer { padding: 14px 16px 12px; }
  body.v2 .answer-body { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
  body.v2 .answer-body ul { padding-left: 18px; }
  body.v2 .answer-note { font-size: 12.5px; line-height: 1.5; }
  /* Нормы закона: кнопка статьи слева, название справа колонкой - раньше
     название падало под кнопку и список разваливался на куски. */
  .basis-row { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
  .basis-art { flex: none; min-width: 56px; min-height: 36px; }
  .basis-title { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.4; padding-top: 8px; }
  .basis .hint { font-size: 13px; }
  /* Фрагменты: файл - своей строкой, текст крупнее. */
  body.v2 .frag-head { flex-wrap: wrap; row-gap: 2px; }
  body.v2 .frag-head .file { margin-left: 0; flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.v2 .frag-body { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
  body.v2 .frag-actions .chip { min-height: 40px; }
  /* Мелкие подписи не меньше 12px. */
  .src-file, .src-n, .src-count, .scope .k { font-size: 12px; }
  body.v2 .legend { font-size: 12px; }
  body.v2 .graph-info { font-size: 13px; }
}
/* Очень узкие телефоны (до 360px): карточка ответа почти во всю ширину. */
@media (max-width: 360px) {
  body.v2 main.thread { padding: 0 8px; }
  body.v2 .answer { padding: 12px 12px 10px; }
  body.v2 .answer-body { font-size: 15.5px; }
  .basis-art { min-width: 50px; }
}

/* Логотип и название - ссылка на главную (02.10.2026): выглядят как раньше,
   курсор-рука и легкая подсветка при наведении показывают, что можно нажать. */
.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 36px;
  padding: 2px 8px 2px 4px;
  margin-left: -4px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: background 0.2s var(--ease);
}
.brand-home:hover { background: var(--panel-2); }
.brand-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-home h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 360px) { .brand-home { gap: 6px; padding-right: 4px; } }

/* --- Дизайн 06.10.2026 --- */

/* Заглушка вместо пустого полотна графа (graph.js blank): сбой загрузки или
   пустая база. По центру полотна, с кнопкой "Повторить". */
.col-graph:has(.cy-blank) .cy { display: none; }
.cy-blank {
  flex: 1;
  min-height: 240px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.cy-blank p { margin: 0; max-width: 320px; }
.cy-blank .cy-blank-title { color: var(--text); font-size: 15px; font-weight: 600; }
.cy-blank .chip { margin-top: 6px; min-height: 34px; }

/* Подсказка под графом: читаемый текст на сплошной подложке, а не бледная
   плашка поверх узлов. */
body.v2 .graph-info {
  color: color-mix(in oklab, var(--text) 78%, var(--muted));
  background: var(--panel);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Плашки-факты над приветствием - в обеих темах (раньше только в светлой). */
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
}
:root:not([data-theme="light"]) .hero-pill-gold { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 40%, transparent); background: color-mix(in oklab, var(--warn) 8%, var(--panel)); }
:root:not([data-theme="light"]) .hero-pill-teal { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 35%, transparent); background: color-mix(in oklab, var(--accent) 7%, var(--panel)); }
:root:not([data-theme="light"]) .hero-pill-ok { color: var(--ok); border-color: color-mix(in oklab, var(--ok) 35%, transparent); background: color-mix(in oklab, var(--ok) 7%, var(--panel)); }

/* Строка "База обновлена ..." в шапке: ссылка на /status. */
body.v2 .corpus:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Примеры вопросов: ровная сетка одной ширины вместо рваного переноса. */
body.v2 .samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
body.v2 .samples[hidden] { display: none; }
body.v2 .samples button { text-align: left; border-radius: 12px; }
/* Телефон: одна горизонтальная лента с прокруткой, без трех рядов кнопок. */
@media (max-width: 620px) {
  body.v2 .samples {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  body.v2 .samples::-webkit-scrollbar { display: none; }
  body.v2 .samples button { flex: 0 0 78%; scroll-snap-align: start; }
}

/* Карточка источника, к которой привел клик по узлу графа. */
.src-card.flash { animation: flash 1.2s var(--ease); }

/* Телефон, пустой чат: граф за кнопкой "Показать граф связей" (v2.js). */
.graph-open { display: flex; margin: 4px auto 10px; min-height: 36px; }
.graph-home:not(.open) > .col-graph { display: none; }
@media (min-width: 1100px) { .graph-open { display: none; } }

/* --- Первый экран помещается без прокрутки (06.10.2026) ---
   Пустой чат: декоративные блоки, приветствие, поле и примеры - в один экран
   при любой высоте окна (и при увеличенном масштабе браузера). Высота панели
   ровно по окну; приветствие, поле и примеры не сжимаются, а блоки с
   анимацией забирают оставшееся место (не больше прежних 230px). На низком
   окне уходит значок, на совсем низком - сами блоки. Чат с ответами это не
   трогает: всё внутри :not(:has(.turn)). */
@media (min-width: 1100px) {
  #panel-search:not(:has(.turn)) {
    min-height: 0;
    height: calc(100dvh - var(--head-h));
    padding-bottom: 0;
    justify-content: center;
  }
  #panel-search:not(:has(.turn)) > * { flex: none; }
  #panel-search:not(:has(.turn)) > .showcase {
    flex: 0 1 252px;
    min-height: 100px;
    margin: 12px 0 18px;
  }
  #panel-search:not(:has(.turn)) .fx-box { display: flex; flex-direction: column; min-height: 0; }
  #panel-search:not(:has(.turn)) .fx-canvas,
  :root[data-theme="light"] #panel-search:not(:has(.turn)) .fx-canvas { flex: 1; height: auto; min-height: 0; }
  #panel-search:not(:has(.turn)) .hero { padding-bottom: 18px; }
}
@media (min-width: 1100px) and (max-height: 820px) {
  :root[data-theme="light"] #panel-search:not(:has(.turn)) .hero-title { font-size: clamp(26px, 2.6vw, 34px); }
  #panel-search:not(:has(.turn)) .hero-mark { width: 40px; height: 40px; margin-bottom: 10px; }
}
@media (min-width: 1100px) and (max-height: 740px) {
  #panel-search:not(:has(.turn)) .hero-mark { display: none; }
  #panel-search:not(:has(.turn)) .hero-pills { margin-bottom: 10px; }
}
@media (min-width: 1100px) and (max-height: 560px) {
  #panel-search:not(:has(.turn)) > .showcase { display: none; }
}

/* --- Аккаунт и оплата (06.10.2026) --- */
.auth-form { display: grid; gap: 12px; padding-top: 16px; }
.auth-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-field input, .team-link input {
  min-height: 42px; padding: 8px 12px; font: 15px/1.3 var(--font-ui); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.auth-field input:focus-visible, .team-link input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.auth-consent input { margin-top: 3px; }
.auth-consent a { color: var(--text); }
.auth-err { margin: 0; min-height: 1em; font-size: 13px; color: var(--warn); }
.auth-submit {
  min-height: 44px; border: 0; border-radius: 999px; font: 600 15px var(--font-ui);
  background: var(--accent); color: var(--bg); cursor: pointer;
}
.auth-submit:disabled { opacity: 0.6; cursor: progress; }
.auth-link { justify-self: center; border: 0; background: none; color: var(--muted); font: 13px var(--font-ui); text-decoration: underline; cursor: pointer; padding: 4px; }
.auth-help { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
/* «Забыли пароль?» (12.10.2026): пояснение и итог в окне входа. */
.auth-lead { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.auth-done { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.auth-done-title { margin: 0; font: 600 15px var(--font-ui); color: var(--text); }
.auth-done .auth-help { text-align: left; line-height: 1.5; }
.plans { width: min(760px, calc(100vw - 24px)); }
/* Моя подписка (07.10.2026) */
.sub-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); margin-bottom: 14px; }
.sub-plan { margin: 0 0 4px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sub-plan b { font-size: 22px; }
.sub-plan span { font-size: 14px; color: var(--muted); }
.sub-status { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.sub-status.is-ok { color: var(--ok, var(--accent)); }
.sub-status.is-warn { color: var(--warn); }
.sub-status.is-bad { color: oklch(70% 0.18 25); }
.sub-usage { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.sub-h { margin: 12px 0 6px; font-size: 13px; font-weight: 600; }
.sub-h[hidden], .sub-feat[hidden], .sub-main[hidden] { display: none; }
.sub-feat { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.sub-feat li { display: flex; gap: 8px; line-height: 1.4; }
.sub-feat li::before { content: "✓"; flex: none; width: 16px; color: var(--ok, var(--accent)); font-weight: 700; }
.sub-feat-off li { color: var(--muted); }
.sub-feat-off li::before { content: "+"; color: var(--muted); }
.sub-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.sub-main { width: auto; padding: 0 18px; }
/* Закрыть - той же высоты, что главная кнопка, но спокойная */
#sub-done { min-height: 44px; padding: 0 18px; font: 500 14px var(--font-ui, inherit); border-radius: 999px; }
:root[data-theme="light"] .sub-status.is-ok, :root[data-theme="light"] .sub-feat li::before { color: var(--gold-ink); }
:root[data-theme="light"] .sub-feat-off li::before { color: var(--muted); }
.plans-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding-top: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.plan-card.is-current { border-color: var(--accent); }
.plan-name { margin: 0; font-size: 16px; }
.plan-price { margin: 0; color: var(--muted); font-size: 13px; }
.plan-price b { font-size: 26px; color: var(--text); }
.plan-line { margin: 0; font-size: 13px; }
.plan-what { color: var(--muted); flex: 1; }
.plan-buy { margin-top: 8px; justify-content: center; min-height: 38px; }
.plans-trial { margin-top: 14px; min-height: 38px; }
.plans-note { min-height: 1em; margin: 10px 0 0; font-size: 13px; color: var(--warn); }
.plans-legal { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.plans-legal a { color: var(--muted); }
.team-seats { margin: 14px 0 4px; font-weight: 600; }
/* Окно команды (07.10.2026): общий лимит полосой, роли, объяснение на Демо */
.team-sum { margin-bottom: 12px; }
.team-usage { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.team-bar { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.team-bar[hidden] { display: none; }
.team-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.3s var(--ease); }
.team-bar.is-hot span { background: var(--warn); }
.team-warn { margin: 8px 0 0; padding: 8px 10px; font-size: 13px; border: 1px solid var(--warn); border-radius: 10px; }
.team-warn[hidden], .team-locked[hidden], .team-leave[hidden], #team-new[hidden], #team-full[hidden] { display: none; }
.team-who { flex: 1; min-width: 0; display: grid; gap: 2px; }
.team-role { font-size: 11px; color: var(--muted); }
.team-role-owner { color: var(--accent); }
.team-row-inv { border-style: dashed; }
.team-locked { margin: 4px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; line-height: 1.45; }
.team-locked p { margin: 0 0 10px; }
.team-copied { margin: 0 0 6px; font-size: 13px; color: var(--ok, var(--accent)); }
.team-copied:empty { display: none; }
.team-leave { margin-top: 4px; color: var(--warn); }
#team-new { margin-bottom: 12px; }
.team-link { margin-bottom: 12px; }
.team-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.team-mail { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.team-row-inv .team-mail { flex: 1; }
.team-q { font-size: 12px; color: var(--muted); }
.team-link { display: grid; gap: 8px; margin: 12px 0; }
.set-acct { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.set-danger { color: var(--warn); }
.import-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0;
  padding: 10px 14px; border: 1px solid var(--accent); border-radius: 12px; font-size: 14px; background: var(--panel);
}
.import-bar[hidden], .set-acct[hidden], .side-guest[hidden] { display: none; }
.import-bar span { flex: 1; min-width: 200px; }
:root[data-theme="light"] .auth-submit { background: var(--gold); color: var(--on-gold); }
:root[data-theme="light"] .auth-field input:focus-visible { outline-color: var(--gold-ink); }
/* hidden у элементов с display из правил выше: иначе правило перебивает атрибут. */
.auth-consent[hidden], .auth-link[hidden], .auth-help[hidden], .plans-trial[hidden], .auth-lead[hidden],
.auth-done[hidden], .auth-field[hidden], .auth-remember[hidden], .auth-submit[hidden],
.team-link[hidden], [data-acct][hidden] { display: none; }

/* Вход в шапке справа (06.10.2026) */
.top-login {
  margin-left: 6px; min-height: 34px; padding: 6px 16px; border: 0; border-radius: 999px;
  font: 600 14px var(--font-ui); background: var(--accent); color: var(--bg); cursor: pointer; white-space: nowrap;
}
.top-login:hover { filter: brightness(1.08); }
.top-login:focus-visible, .top-acct:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.top-acct {
  margin-left: 6px; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font: 600 15px var(--font-ui);
  background: color-mix(in oklab, var(--accent) 22%, var(--panel-2)); color: var(--accent);
}
.top-acct:hover { background: color-mix(in oklab, var(--accent) 32%, var(--panel-2)); }
.top-login[hidden], .top-acct[hidden] { display: none; }
:root[data-theme="light"] .top-login { background: var(--gold); color: var(--on-gold); }
:root[data-theme="light"] .top-acct { background: var(--teal-soft); color: var(--accent-text); }
:root[data-theme="light"] .top-login:focus-visible, :root[data-theme="light"] .top-acct:focus-visible { outline-color: var(--gold-ink); }
@media (max-width: 420px) { .top-login { padding: 6px 12px; font-size: 13px; } }
/* "Войти" - заметная вторая кнопка (06.10.2026: тонкая рамка терялась на
   темной шапке): рамка и текст цветом акцента, подложка с оттенком акцента. */
.top-login-ghost {
  margin-left: 6px; min-height: 34px; padding: 6px 16px; border-radius: 999px;
  border: 1.5px solid color-mix(in oklab, var(--accent) 75%, transparent);
  font: 600 14px var(--font-ui); cursor: pointer; white-space: nowrap;
  background: color-mix(in oklab, var(--accent) 14%, var(--panel)); color: var(--text);
}
.top-login-ghost:hover { background: color-mix(in oklab, var(--accent) 24%, var(--panel)); border-color: var(--accent); }
:root[data-theme="light"] .top-login-ghost {
  border-color: var(--gold-ink); color: color-mix(in oklab, var(--gold-ink) 80%, #000);
  background: color-mix(in oklab, var(--gold) 10%, var(--panel));
}
:root[data-theme="light"] .top-login-ghost:hover { background: color-mix(in oklab, var(--gold) 22%, var(--panel)); }
.top-login-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.top-login-ghost[hidden] { display: none; }
/* «В кабинет» (14.10.2026) - ссылка, а не кнопка: выравниваем как кнопки шапки. */
.top-admin { display: inline-flex; align-items: center; text-decoration: none; }
.top-admin[hidden] { display: none; }
.top-login { margin-left: 4px; }
.acct-menu.from-top { inset: calc(var(--head-h) + 4px) 10px auto auto; }
@media (max-width: 520px) {
  .top-login-ghost, .top-login { padding: 5px 10px; font-size: 13px; min-height: 32px; }
}
/* Узкий телефон: две кнопки входа и название не помещаются - название прячем,
   но значок-ссылка "домой" остается всегда (12.10.2026: иначе с телефона нет
   пути на главную, кроме меню). "Новый чат" ужимается до значка 44px. */
@media (max-width: 420px) {
  body.v2:has(#top-register:not([hidden])) .brand h1 { display: none; }
  body.v2:has(#top-register:not([hidden])) #brand-home { min-width: 44px; min-height: 44px; justify-content: center; }
}
/* Румынские "Autentificare" и "Înregistrare" длинные: на 360px и уже прячем
   только текст логотипа (он уже скрыт выше), сам значок-домой остается. */
@media (max-width: 380px) {
  body.v2:has(#top-register:not([hidden])) .brand h1 { display: none; }
}
@media (max-width: 340px) {
  body.v2 .top-right { gap: 2px; }
  body.v2:has(#top-register:not([hidden])) #theme { display: none; }
}
.acct-top .acct-name { overflow-wrap: anywhere; }
/* Подсказка исправленного адреса почты под ошибкой входа/регистрации */
.auth-fix { margin-top: 6px; padding: 4px 10px; border: 1px solid var(--accent); border-radius: 999px; background: transparent; color: var(--accent); font: 600 13px var(--font-ui); cursor: pointer; }
:root[data-theme="light"] .auth-fix { border-color: var(--gold-ink); color: var(--gold-ink); }
.auth-pass-wrap { position: relative; display: block; }
.auth-pass-wrap input { width: 100%; padding-right: 48px; }
/* Глазик в поле пароля: открытый - показать, перечеркнутый - скрыть. */
.auth-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 36px; padding: 0; border: 0; border-radius: 8px;
  display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer;
}
.auth-eye:hover { color: var(--text); background: var(--panel); }
.auth-eye:focus-visible { outline: 2px solid var(--accent); }
.auth-eye svg { width: 20px; height: 20px; }
.auth-eye .eye-off, .auth-eye[aria-pressed="true"] .eye-on { display: none; }
.auth-eye[aria-pressed="true"] .eye-off { display: block; }
.auth-remember { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--text); cursor: pointer; }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Окно вопросов и сообщений сайта (вместо prompt/alert браузера), по центру */
.ask-dlg { width: min(440px, calc(100vw - 24px)); margin: auto; }
.ask-dlg-body { display: grid; gap: 12px; padding: 22px 22px 20px; }
.ask-dlg-title { margin: 0; font-size: 17px; font-weight: 600; }
.ask-dlg-title:empty { display: none; }
.ask-dlg-text { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.ask-dlg-text[hidden] { display: none; }
.ask-dlg-fields { display: grid; gap: 12px; }
.ask-dlg-fields:empty { display: none; }
.ask-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ask-dlg-actions .auth-submit { min-width: 120px; padding: 0 20px; }
.ask-dlg-cancel { min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: 500 14px var(--font-ui); cursor: pointer; }
.ask-dlg-cancel:hover { background: var(--panel-2); }
.ask-dlg-cancel[hidden] { display: none; }
.ask-dlg-ok.is-danger { background: var(--warn); color: var(--bg); }
/* Окно вопросов - по центру и на телефоне (остальные окна там - шторка снизу) */
@media (max-width: 620px) {
  .settings.ask-dlg { margin: auto; width: calc(100vw - 24px); border-radius: 18px; padding-bottom: 0; }
}

/* --- Обратная связь на вход и выход (06.10.2026) --- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80;
  display: flex; align-items: center; gap: 10px;
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px 12px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); color: var(--text); font: 500 14.5px var(--font-ui);
  box-shadow: 0 18px 50px oklch(0% 0 0 / 0.45);
  transform: translate(-50%, 24px); opacity: 0;
  transition: transform 0.28s var(--ease), opacity 0.28s var(--ease);
}
.toast[hidden] { display: none; }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.toast-text { overflow-wrap: anywhere; }
.toast-ico { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.toast-ok { border-color: color-mix(in oklab, var(--ok) 55%, transparent); }
.toast-ok .toast-ico { background: var(--ok); color: var(--bg); }
.toast-ok .toast-ico::before { content: "✓"; }
.toast-out { border-color: color-mix(in oklab, var(--accent) 55%, transparent); }
.toast-out .toast-ico { background: var(--accent); color: var(--bg); }
.toast-out .toast-ico::before { content: "→"; }
:root[data-theme="light"] .toast-out .toast-ico { background: var(--gold); color: var(--on-gold); }
:root[data-theme="light"] .toast-out { border-color: color-mix(in oklab, var(--gold) 55%, transparent); }
/* Кнопки в шапке "выпрыгивают" при смене состояния */
@keyframes top-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.top-login.is-pop, .top-login-ghost.is-pop, .top-acct.is-pop { animation: top-pop 0.45s var(--ease) both; }
.top-login-ghost.is-pop + .top-login.is-pop { animation-delay: 0.08s; }
/* Пока идет выход - лента тускнеет, как переход */
body.is-leaving main.thread { opacity: 0.35; transition: opacity 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .top-login.is-pop, .top-login-ghost.is-pop, .top-acct.is-pop { animation: none; }
}
/* Телефон: уведомление во всю ширину, текст не дробится на 4 строки */
@media (max-width: 620px) {
  .toast { left: 12px; right: 12px; bottom: 16px; max-width: none; transform: translateY(24px); }
  .toast.is-on { transform: translateY(0); }
  .toast-text { overflow-wrap: break-word; word-break: break-word; }
}

/* Обучающие подсказки (08.10.2026, tour.js): затемнение с «окном» вокруг элемента и карточка шага. */
.tour[hidden] { display: none; }
.tour { position: fixed; inset: 0; z-index: calc(var(--z-modal) + 5); }
.tour-shade { position: absolute; inset: 0; }
.tour-shade i { position: fixed; background: oklch(0% 0 0 / 0.62); }
:root[data-theme="light"] .tour-shade i { background: oklch(22% 0.02 60 / 0.55); }
.tour-ring {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 24px color-mix(in oklab, var(--accent) 40%, transparent);
}
:root[data-theme="light"] .tour-ring { box-shadow: 0 0 0 3px var(--gold); }
.tour-card {
  position: fixed; padding: 16px 18px 14px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  box-shadow: 0 18px 50px oklch(0% 0 0 / 0.45);
  transition: left 0.25s var(--ease, ease), top 0.25s var(--ease, ease);
}
.tour-step { margin: 0 0 4px; font: 600 11px/1.4 "JetBrains Mono", monospace; color: var(--accent); letter-spacing: 0.02em; }
:root[data-theme="light"] .tour-step { color: var(--gold-ink); }
.tour-title { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.tour-text { margin: 0 0 14px; font-size: 14px; line-height: 1.5; color: var(--muted); }
:root[data-theme="light"] .tour-text { color: var(--text); }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-dots { display: flex; gap: 5px; margin-right: auto; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { width: 16px; border-radius: 3px; background: var(--accent); }
:root[data-theme="light"] .tour-dots i.on { background: var(--gold); }
.tour-skip { padding: 6px 4px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.tour-skip:hover { color: var(--text); }
.tour-foot .auth-submit { width: auto; min-height: 36px; padding: 0 16px; margin: 0; }
.tour-back[hidden] { display: none; }
.tour-skip:focus-visible, .tour-foot button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .tour-card { transition: none; } }

/* Телефон (14.10.2026, скриншот владельца: логотип налезал на значок «Новый чат»).
   Справа у гостя пять кнопок, и вместе с меню и логотипом они не помещались до
   430px: логотип сжимался и ложился поверх соседей. Логотип и так открывает новый
   чат, плюс «Новый чат» есть в меню - значок в шапке на телефоне лишний. */
@media (max-width: 480px) {
  body.v2 #chat-new-top { display: none; }
}
/* До 420px у гостя в шапке одна кнопка - «Регистрация»: обе вместе с логотипом,
   языком и темой не помещались (логотип налезал на «RU»). «Войти» - ссылкой в окне
   регистрации («Уже есть аккаунт? Войти») и в меню слева. */
@media (max-width: 420px) {
  body.v2 #top-login { display: none; }
}
/* Администратор с кнопкой «В кабинет»: название рядом с логотипом обрезалось до
   «G..» - на телефоне оставляем только значок-домой, как у гостя. */
@media (max-width: 480px) {
  body.v2:has(#top-admin:not([hidden])) .brand h1 { display: none; }
  body.v2:has(#top-admin:not([hidden])) #brand-home { min-width: 44px; justify-content: center; }
}
@media (max-width: 340px) {
  body.v2:has(#top-admin:not([hidden])) #theme { display: none; }
}
