/* VIRTONIX-AI: дизайн «Light Premium Minimal» (концепция владельца 2026-11-26) — только светлая тема.
   Мамы (data-ui="large") — та же палитра, но крупно; остальные (data-ui="min") — боковая панель и плавающая строка вопроса. */
:root {
  --primary: #1A1A2E; --accent: #4F6EF7; --accent-hover: #3B5DE7; --accent-text: #ffffff;
  --accent-soft: #EEF1FE; --accent-tint: rgba(79,110,247,.08); --ring: rgba(79,110,247,.12);
  --bg: #FAFAFA; --surface: #FFFFFF; --border: #E8E8EC; --text: #1A1A2E; --muted: #6B7280; --tertiary: #9CA3AF;
  --success: #10B981; --warning: #F59E0B; --error: #EF4444;
  --warn-bg: #FFFBEB; --warn-text: #92400E; --err-bg: #FEF2F2; --err-text: #B91C1C;
  --shadow-card: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.03);
  --shadow-float: 0 2px 8px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.04);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 18px; --fs: 22px;
  color-scheme: light;
}
:root.font-xl { --fs: 27px; }

* { box-sizing: border-box; }
/* Атрибут hidden сильнее любого display у классов (.view, .stack, .status — flex), иначе скрытые блоки видны */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.45 var(--font); -webkit-font-smoothing: antialiased;
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.top { display: flex; align-items: center; gap: 12px; padding: 14px 0 10px; }
.top h1 { flex: 1; margin: 0; font-size: 1.15em; font-weight: 700; }
.icon-btn {
  min-width: 56px; height: 56px; border-radius: 14px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font: 700 0.95em/1 inherit; cursor: pointer;
}
#btn-home { font-size: 1.5em; }

.status {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px;
  border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-text); font-weight: 600;
}
.status .dot { width: 16px; height: 16px; border-radius: 50%; background: currentColor; flex: none;
  animation: pulse 1.4s ease-in-out infinite; }
.status.down { background: var(--err-bg); color: var(--err-text); }
.status.down .dot { animation: none; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .status .dot { animation: none; } }

main { flex: 1; display: flex; flex-direction: column; max-width: 760px; width: 100%; margin: 0 auto; }
.view { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.lead { font-size: 1.1em; font-weight: 600; margin: 8px 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.lbl { font-weight: 600; margin-bottom: -6px; }

.field {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--radius); padding: 16px 18px; resize: none;
}
.field:focus { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.btn {
  font: 700 1em/1.2 inherit; min-height: 64px; padding: 0 24px; border-radius: var(--radius);
  border: 2px solid transparent; cursor: pointer; background: var(--surface); color: var(--text);
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.big { flex: 1; min-height: 72px; font-size: 1.1em; }
.btn.mic { min-width: 72px; min-height: 72px; font-size: 1.3em; border-color: var(--border); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .icon-btn:focus-visible, .tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 18px;
  min-height: 150px; padding: 20px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font: 700 1em/1.2 inherit; text-align: left; cursor: pointer;
}
.tile .emoji { font-size: 1.8em; line-height: 1; }
.tile small { font-weight: 400; color: var(--muted); font-size: .75em; }

.answers { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }  /* листается вся страница (NL-0061) */
.msg { padding: 16px 18px; border-radius: var(--radius); max-width: 100%; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent-soft); font-weight: 600; }
.msg.bot { background: var(--surface); border: 2px solid var(--border); }
.msg.bot p { margin: 0 0 .6em; } .msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul { margin: 0 0 .6em; padding-left: 1.2em; }
.msg.err { background: var(--err-bg); color: var(--err-text); }
.msg .note { margin: 0 0 .4em; color: var(--muted); font-style: italic; }
.msg .typing::after { content: "▍"; animation: pulse 1s steps(2) infinite; }
/* NL-0159: ожидание — точка, фраза, время */
.msg .wait { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 2px 0; color: var(--muted); }
.wait-dot { flex: none; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: wait-pulse 1.4s ease-in-out infinite; }
.wait-txt.swap { animation: wait-in .3s ease-out; }
.wait-time { color: var(--tertiary); font-size: .85em; font-variant-numeric: tabular-nums; }
@keyframes wait-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: none; } }
@keyframes wait-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wait-dot, .wait-txt.swap { animation: none; } }

.ask { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 12px;
  padding: 12px 0 16px; background: var(--bg); }
.ask-row { display: flex; gap: 10px; }
.more-btn { margin-top: 10px; }
.retry-btn { margin-top: 8px; min-height: 32px; padding: 0 10px; font-weight: 400; font-size: .9em; }
.msg.user .retry-btn { display: flex; margin-left: auto; }
.ask.drop-on { outline: 3px dashed var(--accent); outline-offset: 4px; border-radius: 16px; background: var(--accent-soft); }
.ask.drop-on::before { content: "Отпустите файл — приложу к вопросу"; color: var(--accent); font-weight: 600; text-align: center; }
/* 4 кнопки на 360 px (NL-0063): значки по 56 px, «Спросить» — остаток, без горизонтальной прокрутки */
.ask-row > .btn.mic { flex: 0 0 56px; min-width: 0; padding: 0; }
.ask-row > .btn.big { flex: 1 1 0; min-width: 0; padding: 0 6px; font-size: 1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
:root.font-xl .ask-row > .btn.big { font-size: .85em; }
/* Компактная панель, когда в чате уже есть ответы (NL-0060): ~на треть ниже; кнопки ≥ 48 px для пальца */
.ask.compact { position: static; gap: 8px; padding: 8px 0 10px; }  /* с ответом — не прилипает, стоит под текстом (NL-0061) */
.ask.compact .field { padding: 10px 14px; field-sizing: content; min-height: 0; max-height: 30vh; }
.ask.compact .ask-row { gap: 8px; }
.ask.compact .btn.big { min-height: 52px; font-size: 1em; }
.ask.compact .ask-row > .btn.mic { flex-basis: 48px; min-height: 52px; font-size: 1.1em; }
.ask.compact #new-btn { min-height: 44px; font-size: .85em; }
/* Голос (NL-0063) */
.btn.mic.rec { background: var(--err-bg); color: var(--err-text); border-color: currentColor; animation: pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .btn.mic.rec { animation: none; } }
.msg .speak { display: block; margin-top: 12px; min-height: 48px; padding: 0 16px; border-radius: 12px;
  border: 2px solid var(--border); background: transparent; color: var(--text); font: 600 .85em/1 inherit; cursor: pointer; }
.msg.user.pending { opacity: .6; font-style: italic; }
.talk-status { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-weight: 700; text-align: center; }
.hint { color: var(--muted); font-size: .85em; text-align: center; margin: 0; }
.hint-left { text-align: left; }
/* спрайт иконок: CSP style-src 'self' запрещает style="…" в разметке — прячем классом (иначе 300×150 пустоты сверху) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { position: relative; }
.photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 2px solid var(--border); display: block; }
.photo button { position: absolute; top: -10px; right: -10px; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: 700 20px/1 inherit; cursor: pointer; }
.photo.loading img { opacity: .4; }
.msg.user img { max-width: 160px; border-radius: 12px; display: block; margin-top: 8px; }

/* Видео (Ф5) */
.seg { display: flex; gap: 12px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 0 12px;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 700; cursor: pointer; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }
.videos { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.vcard { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--border); }
.vcard .vprompt { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.vcard .vstate { margin: 0; color: var(--muted); }
.vcard .vstate.err { color: var(--err-text); }
.vcard .vstate.busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px;
  border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.vcard video { width: 100%; max-height: 70vh; border-radius: 12px; background: #000; display: block; }
.vcard .vrow { display: flex; gap: 10px; }
.vcard .vrow .btn { flex: 1; min-height: 56px; font-size: .9em; display: flex; align-items: center;
  justify-content: center; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .vcard .vstate.busy::before { animation: none; } }
.styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.styles label { display: block; }
.styles input { position: absolute; opacity: 0; pointer-events: none; }
.styles label > span { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 0 14px;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); font-weight: 700; cursor: pointer; }
.styles .em { font-size: 1.4em; line-height: 1; }
.styles.small label > span { min-height: 48px; }
.styles input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.styles input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Кабинет: галерея (NL-0056) */
.ausers { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; }
.auser { border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.auser > summary { padding: 14px 16px; font-weight: 700; cursor: pointer; list-style-position: inside; }
.auser > summary small { font-weight: 400; color: var(--muted); }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 0 12px 14px; }
.atile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 2px solid var(--border);
  border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.atile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.atile .thumb { aspect-ratio: 1; width: 100%; object-fit: cover; display: block; background: #000; }
.atile .ph { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 10px;
  font-size: .8em; text-align: center; background: var(--accent-soft); overflow: hidden; }
.atile .ph.ref { background: var(--err-bg); color: var(--err-text); }
.atile .ph.doc { flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.atile .ph.doc .ext { padding: 4px 10px; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: .9em; }
.atile .cap { padding: 0 8px 8px; font-size: .62em; line-height: 1.3; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.atile .badge { position: absolute; top: 6px; left: 6px; padding: 2px 8px; border-radius: 999px; font-size: .55em;
  font-weight: 700; background: rgba(0,0,0,.65); color: #fff; }
.atile .badge.bad { background: #b3261e; }
.atile .badge.made { background: #1b6e3a; }
.atile .kind { position: absolute; top: 6px; right: 6px; font-size: .8em; }
.adlg { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 16px; border: 2px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); }
.adlg::backdrop { background: rgba(0,0,0,.55); }
.adlg-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.adlg-head h2 { flex: 1; margin: 0; font-size: 1em; }
.adlg video, .adlg img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #000; display: block; }
.adlg dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: .75em; }
.adlg dt { color: var(--muted); } .adlg dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Оживить фото (NL-0065) */
.pick-row { display: flex; gap: 10px; }
.pick-row .pick { flex: 1; min-height: 60px; }
.pick-row .pick.ok { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.pick-preview { display: flex; gap: 10px; }
.pick-preview img, .pick-preview video { width: calc(50% - 5px); max-height: 220px; object-fit: cover; border-radius: 12px; background: #000; }

/* Прогресс видео на кнопке (NL-0066): слева — более тёмная заливка по реальному прогрессу */
.btn.primary.progress:disabled { opacity: 1; cursor: default;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 62%, #000) var(--p, 0%),
                                     color-mix(in srgb, var(--accent) 55%, var(--bg)) var(--p, 0%));
  color: var(--accent-text); transition: background .6s ease; }
/* три режима видео и четыре варианта энергичности — на узком телефоне в одну строку */
#vmode-seg { gap: 8px; }
#vmode-seg span { padding: 4px 6px; text-align: center; font-size: .95em; line-height: 1.2; }

/* документы в чате (NL-0072) */
#photos .photo.doc { width: auto; max-width: 220px; display: flex; align-items: center; padding: 0 34px 0 12px;
  height: 96px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); }
#photos .photo.loading span { opacity: .5; }
#photos .photo.doc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95em; }
.msg .fname { margin: 6px 0 0; font-size: .95em; opacity: .85; }
.msg a.dl, .adlg a.dl { display: flex; align-items: center; justify-content: center; margin-top: 10px; min-height: 52px;
  text-decoration: none; text-align: center; }

/* История разговоров и «Мои файлы» (TD-096) */
.chat-top { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.chat-top .btn { min-height: 44px; padding: 0 14px; font-size: .8em; }
.hlist { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 60dvh; overflow-y: auto; }
.hrow { display: flex; gap: 8px; align-items: stretch; }
.hitem { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; min-height: 56px;
  border: 2px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit;
  text-align: left; text-decoration: none; cursor: pointer; }
.hitem.cur { border-color: var(--accent); background: var(--accent-soft); }
.hitem:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hitem .ht { font-size: .85em; font-weight: 600; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hitem small { font-size: .65em; color: var(--muted); }
.hrow .icon-btn { flex: none; min-width: 52px; }
.msg a.fname { display: block; color: inherit; overflow-wrap: anywhere; }


/* ===== Интерфейс «минимализм» (NL-0085): все, кроме мам (роль elder), в духе Open WebUI ===== */
.side { display: none; }
html[data-ui="min"], html[data-ui="min"].font-xl { --fs: 16px; --radius: 12px; --side: var(--surface); }
html[data-ui="min"] body { line-height: 1.5; padding-left: 16px; padding-right: 16px; }
html[data-ui="min"] #btn-home, html[data-ui="min"] #btn-font { display: none; }
html[data-ui="min"] .top { padding: 10px 0 6px; }
html[data-ui="min"] .top h1 { font-size: 1em; font-weight: 600; }
html[data-ui="min"] main { max-width: 800px; }
html[data-ui="min"] .view { gap: 12px; }
html[data-ui="min"] .lead { font-size: 1em; }
html[data-ui="min"] .btn, html[data-ui="min"] .icon-btn { border-width: 1px; font-weight: 500; }
html[data-ui="min"] .btn { min-height: 40px; padding: 0 16px; border-radius: 10px; }
html[data-ui="min"] .btn.big { min-height: 40px; font-size: 1em; }
html[data-ui="min"] .btn.mic { min-width: 40px; min-height: 40px; font-size: 1.05em; }
html[data-ui="min"] .icon-btn { min-width: 40px; height: 40px; border-radius: 10px; }
html[data-ui="min"] .field { border-width: 1px; padding: 10px 12px; }
html[data-ui="min"] .field { border-radius: 10px; transition: border-color .15s ease-out, box-shadow .15s ease-out; }
html[data-ui="min"] .field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
html[data-ui="min"] .btn:focus-visible, html[data-ui="min"] .icon-btn:focus-visible { outline-width: 2px; outline-offset: 2px; }
html[data-ui="min"] .status { padding: 8px 12px; font-weight: 500; font-size: .9em; }
/* чат: ответ без рамки, вопрос — серая «таблетка» */
html[data-ui="min"] .answers { gap: 18px; }
html[data-ui="min"] .msg { padding: 0; }
html[data-ui="min"] .msg.user { align-self: flex-end; max-width: 85%; padding: 8px 14px; border-radius: 18px; font-weight: 400; background: var(--accent-soft); }
html[data-ui="min"] .msg.bot { border: 0; background: transparent; }
html[data-ui="min"] .msg.err { padding: 10px 14px; border-radius: 12px; }
html[data-ui="min"] .msg .speak { min-height: 32px; padding: 0 12px; border-width: 1px; font-weight: 500; }
/* поле ввода: одна скруглённая плашка; значки слева, «Спросить» справа */
html[data-ui="min"] .ask, html[data-ui="min"] .ask.compact {
  padding: 10px 12px; margin: 8px 0 12px; gap: 6px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); }
html[data-ui="min"] .ask { position: sticky; }
html[data-ui="min"] .ask.compact { position: sticky; }
html[data-ui="min"] .ask .field, html[data-ui="min"] .ask.compact .field { border: 0; background: transparent; padding: 6px 4px; min-height: 0; }
html[data-ui="min"] .ask-row { align-items: center; gap: 4px; }
html[data-ui="min"] .ask-row > .btn.mic, html[data-ui="min"] .ask.compact .ask-row > .btn.mic {
  order: 1; flex: 0 0 40px; min-height: 40px; border: 0; background: transparent; border-radius: 50%; font-size: 1.1em; }
html[data-ui="min"] .ask-row > .btn.big, html[data-ui="min"] .ask.compact .btn.big {
  order: 2; flex: 0 0 auto; margin-left: auto; min-height: 36px; padding: 0 16px; border-radius: 18px; }
html[data-ui="min"] .talk-status { border-radius: 12px; font-weight: 500; }
html[data-ui="min"] .photo img { width: 64px; height: 64px; border-radius: 10px; border-width: 1px; }
html[data-ui="min"] .chat-top .btn { min-height: 32px; font-size: .85em; }
/* плитки, переключатели, карточки */
html[data-ui="min"] .tile { min-height: 0; flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; border-width: 1px; font-weight: 500; }
html[data-ui="min"] .tile .emoji { font-size: 1.3em; }
html[data-ui="min"] .seg span, html[data-ui="min"] .styles label > span { min-height: 40px; border-width: 1px; font-weight: 500; }
html[data-ui="min"] .styles.small label > span { min-height: 36px; }
html[data-ui="min"] .seg input:checked + span, html[data-ui="min"] .styles input:checked + span { border-color: var(--text); }
html[data-ui="min"] .vcard, html[data-ui="min"] .auser, html[data-ui="min"] .adlg { border-width: 1px; }
html[data-ui="min"] .vcard .vrow .btn { min-height: 40px; }
html[data-ui="min"] .hitem { border-width: 1px; }
html[data-ui="min"] .hitem.cur { border-color: var(--text); }
/* боковая панель — ниже, в блоке «VIRTONIX-AI: оболочка» */

/* ---------- Markdown в ответах (marked, как в Open WebUI; NL-0087) ---------- */
.msg.bot .md > :first-child { margin-top: 0; } .msg.bot .md > :last-child { margin-bottom: 0; }
.msg.bot .md + .md, .msg.bot .tool + .md { margin-top: .6em; }
.msg.bot h1, .msg.bot h2, .msg.bot h3, .msg.bot h4 { margin: .9em 0 .4em; line-height: 1.25; font-weight: 700; }
.msg.bot h1 { font-size: 1.3em; } .msg.bot h2 { font-size: 1.18em; } .msg.bot h3 { font-size: 1.06em; } .msg.bot h4 { font-size: 1em; }
.msg.bot ol { margin: 0 0 .6em; padding-left: 1.5em; }
.msg.bot li > p { margin: 0; } .msg.bot li + li { margin-top: .15em; }
.msg.bot blockquote { margin: 0 0 .6em; padding: .1em 0 .1em .9em; border-left: 3px solid var(--border); color: var(--muted); }
.msg.bot hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.msg.bot a { color: var(--accent); }
html[data-ui="min"] .msg.bot a { color: var(--accent); }
.msg code { font-family: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace; font-size: .86em; }
.msg.bot :not(pre) > code { padding: .1em .35em; border-radius: 6px; background: var(--accent-soft); border: 1px solid var(--border); }
.msg.bot pre { margin: 0 0 .7em; padding: 12px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border);
  overflow-x: auto; white-space: pre; line-height: 1.45; }
.msg.bot pre code { font-size: .82em; overflow-wrap: normal; }
.msg.bot .tbl { margin: 0 0 .7em; overflow-x: auto; max-width: 100%; }
.msg.bot table { border-collapse: collapse; font-size: .92em; font-variant-numeric: tabular-nums; }
.msg.bot th, .msg.bot td { padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: normal; }
.msg.bot th { font-weight: 600; border-bottom-width: 2px; white-space: nowrap; }
.msg.bot td[align="right"], .msg.bot th[align="right"] { text-align: right; }
.msg.bot td[align="center"], .msg.bot th[align="center"] { text-align: center; }

/* ---------- Плитка «Код»: хосты и карточки команд ---------- */
body.code-tile main { max-width: 1100px; }
.hosts-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.host-chip { display: inline-flex; align-items: baseline; gap: 2px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); font-size: .85em; color: var(--muted); }
.host-chip.on { color: var(--text); } .host-chip.on::first-letter { color: #22a06b; }
.host-chip small { color: var(--muted); font-size: .9em; }
.tool { margin: .5em 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .9em; }
.tool summary { display: flex; gap: 8px; align-items: center; padding: 7px 12px; cursor: pointer; list-style: none; min-width: 0; }
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before { content: "▸"; color: var(--muted); } .tool[open] summary::before { content: "▾"; }
.tool .tt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .tb { color: var(--muted); font-size: .9em; white-space: nowrap; }
.tool.bad .tb { color: var(--err-text); }
.tool.run .tb::after { content: " ▍"; animation: pulse 1s steps(2) infinite; }
.tool .to { margin: 0; padding: 10px 12px; border-top: 1px solid var(--border); max-height: 420px; overflow: auto;
  white-space: pre; font: .8em/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.msg.bot .tool .tt { padding: 0; border: 0; background: none; font-size: .95em; }

/* ---------- «Код»: подтверждение изменений (TD-097) ---------- */
.tool.waiting { border-color: #d97706; box-shadow: 0 0 0 1px #d97706 inset; }
.tool .ask-box { padding: 10px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.tool .ask-what { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.tool .ask-pre { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  max-height: 360px; overflow: auto; white-space: pre; font: .82em/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tool .diff .del { color: #c2410c; } .tool .diff .add { color: #15803d; }
.tool .appr-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tool .ask-note { font-size: .95em; }
.tool .ask-done { margin: 0; color: var(--muted); }
.tool .to:empty { display: none; }
.tool .ask-note { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg); width: 100%; }

/* ---------- «Код»: подключение хоста (NL-0090) ---------- */
button.host-chip { background: none; cursor: pointer; font: inherit; font-size: .85em; }
button.host-chip:hover { border-color: var(--muted); }
.host-chip.add { color: var(--text); border-style: dashed; }
.adlg .lbl { display: flex; flex-direction: column; gap: 6px; font-size: .95em; }
.adlg .hint-l { margin: 0; color: var(--muted); font-size: .95em; }
.adlg .hint-l.ok { color: var(--text); font-weight: 600; }
#host-update-hint { white-space: pre-wrap; overflow-wrap: anywhere; }
.adlg pre.cmd { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-all; font: .85em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; user-select: all; }
.adlg dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .95em; }
.adlg dl.kv dd { margin: 0; }
.btn.danger { color: var(--err-text); border-color: var(--err-text); }
html[data-ui="min"] .adlg .seg span { min-height: 44px; font-size: .95em; }

/* ---------- «Код»: вкладки хостов, сессии, каталог проекта, журнал (NL-0091) ---------- */
.code-bar { display: flex; flex-direction: column; gap: 8px; }
.code-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 0; }
.code-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid transparent;
  border-bottom: 0; border-radius: 10px 10px 0 0; background: none; color: var(--muted); font: inherit; font-size: .9em;
  cursor: pointer; margin-bottom: -1px; }
.code-tab:hover { color: var(--text); }
.code-tab.active { color: var(--text); font-weight: 600; background: var(--bg); border-color: var(--border); }
.code-tab.arch { opacity: .7; } .code-tab .cnt { color: var(--muted); font-weight: 400; }
.arch-pick { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; vertical-align: middle; }
.arch-pick button { padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: none;
  color: var(--muted); font: inherit; font-size: .9em; cursor: pointer; }
.arch-pick button.cur { color: var(--text); font-weight: 600; border-color: var(--text); }
.ctx-meter { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: .85em; color: var(--muted); margin: 2px 0 6px; }
.ctx-bar { flex: 0 0 120px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.ctx-bar i { display: block; height: 100%; width: 0; background: #22a06b; transition: width .3s; }
.ctx-meter.mid .ctx-bar i { background: #d97706; } .ctx-meter.high .ctx-bar i { background: #dc2626; }
.ctx-meter.high .ctx-text { color: var(--err-text); }
.revoke-row { display: flex; flex-wrap: wrap; gap: 8px; } .code-tab.add { border-style: dashed; border-color: var(--border); border-bottom: 0; }
.code-tab .dot { font-size: .8em; } .code-tab .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.code-head { display: flex; flex-direction: column; gap: 6px; }
.code-host { margin: 0; font-size: .9em; } .code-host .hint { color: var(--muted); }
.code-host .warn-tag { color: #b45309; font-weight: 600; }
.code-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.code-row .sess-select { flex: 1 1 260px; min-width: 0; padding: 6px 10px; font-size: .9em; }
.btn.sm { min-height: 32px !important; padding: 0 10px !important; font-size: .85em; }
.code-row.proj { font-size: .88em; } .code-row.proj code { overflow-wrap: anywhere; }
.code-row.proj code.unset { color: var(--muted); font-style: italic; }
.multi-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .9em; }
.multi-pick .pick { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.host-badge { display: inline-block; padding: 1px 8px; border-radius: 6px; color: #fff; font: 600 .78em/1.6 system-ui, sans-serif;
  white-space: nowrap; flex: none; }
.tool .ask-host { margin: 0; font-weight: 600; } .tool .ask-host .host-badge { font-size: .95em; padding: 2px 10px; }
.adlg.wide { width: min(1000px, calc(100vw - 32px)); }
.j-list { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; max-height: 65dvh; overflow: auto; }
.j-meta { margin: 8px 0 0; font-size: .82em; color: var(--muted); }
.j-meta.link { cursor: pointer; text-decoration: underline dotted; }
#jdlg .code-row .field { flex: 1 1 200px; min-width: 0; padding: 6px 10px; font-size: .9em; }
#jdlg select.field { flex: 0 0 auto; }

/* «Код»: экспорт сессии (TD-107) и пометка ошибочного ответа (TD-108) */
.sess-export { position: relative; display: inline-block; }
.sess-export > summary { list-style: none; cursor: pointer; }
.sess-export > summary::-webkit-details-marker { display: none; }
.exp-menu { position: absolute; z-index: 20; right: 0; top: calc(100% + 4px); min-width: 170px; display: flex; flex-direction: column;
  background: var(--surface); border: 2px solid var(--border); border-radius: 10px; padding: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.exp-menu a { padding: 8px 10px; border-radius: 6px; color: inherit; text-decoration: none; }
.exp-menu a:hover, .exp-menu a:focus-visible { background: var(--border); }
.msg.bot .flag-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.msg.bot .flag-btn { opacity: .55; } .msg.bot .flag-btn:hover, .msg.bot .flag-btn:focus-visible { opacity: 1; }
.msg.bot .flag-note { font-size: .9em; color: #b45309; margin-right: auto; }
.msg.bot.flagged > .md { opacity: .55; }

/* TD-112: «🔋 Глубокий режим» и занятость окна модели */
.chat-top { display: flex; gap: 8px; flex-wrap: wrap; }
.deep-btn.on { background: #fef3c7; border-color: #d97706; color: #92400e; }
.msg.bot .ctx-info { font-size: .8em; opacity: .7; margin: 0 0 6px; }

/* NL-0098: четыре режима агента, «⛔ Стоп» */
.seg.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .seg.modes { grid-template-columns: 1fr; } }
#stop-btn { background: #b91c1c; color: #fff; border-color: #b91c1c; }

/* Иконки Lucide (линейные, цвет — от текста) */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic + span { margin-left: .45em; }
.btn, .code-tab, .side-item, .icon-btn, a.fname, .fname, .ask-done, .flag-note, .warn-tag, .note, .ht, .tb,
.talk-status, #add-wait, .ctx-info, .vprompt, summary.btn { align-items: center; }
.btn, .icon-btn, .code-tab, summary.btn { display: inline-flex; justify-content: center; }
.tile .emoji .ic { width: 1.6em; height: 1.6em; stroke-width: 1.6; color: var(--accent, currentColor); }
html[data-ui="min"] .tile .emoji .ic { width: 1.25em; height: 1.25em; }
.btn.mic .ic { width: 1.35em; height: 1.35em; }
.icon-btn .ic { width: 1.2em; height: 1.2em; }
.tool .ti .ic { width: 1em; height: 1em; opacity: .75; }
.kind .ic { width: 1.1em; height: 1.1em; }
.cnt .ic { width: .95em; height: .95em; vertical-align: -0.15em; }
.code-tab .ic { width: 1em; height: 1em; }
.code-tab .ic + span { margin-left: .35em; }
.code-tab .dot .ic { width: .95em; height: .95em; }
.talk-status[data-state="listening"] .ic { color: #22a06b; }
.flag-btn .ic { color: #b45309; }
.seg label span .ic { width: 1.1em; height: 1.1em; }
.seg label > span > .ic { margin-right: .45em; }

/* Кабинет: пользователи, журнал действий (TD-128, NL-0110) */
.atabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.atab { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); font: inherit; cursor: pointer; }
.atab[aria-selected="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); font-weight: 600; }
.arow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.arow > select, .arow > input { flex: 1 1 120px; min-width: 0; }
.btn-sm { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.btn-sm.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn-sm.danger { color: var(--err-text); }
.btn-sm:disabled { opacity: .5; }
.people { display: flex; flex-direction: column; gap: 10px; }
.person { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.person.off { opacity: .6; }
.person-main { min-width: 0; } .person-main small { color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: .78em; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); }
.tag-code { background: var(--accent); color: var(--accent-text); }
.tag-off { background: var(--err-bg); color: var(--err-text); } .tag-dim { background: transparent; color: var(--muted); padding-left: 0; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; } .chk { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; } .stack-sm h3 { margin: 10px 0 0; font-size: 1em; }
.secret { display: block; padding: 12px; border-radius: 10px; background: var(--accent-soft); font-size: 1.1em; user-select: all; overflow-wrap: anywhere; }
.audit { display: flex; flex-direction: column; gap: 8px; }
.audit-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.audit-ts { color: var(--muted); font-size: .8em; } .audit-det { color: var(--muted); overflow-wrap: anywhere; }

.model-pick { width: 100%; margin-bottom: 8px; }
.model-tag { font-size: .8em; color: var(--muted, #888); margin-bottom: 4px; }
.mrow { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.25)); }
.mrow .mname { flex: 1 1 200px; min-width: 0; }
.brief-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.brief-sum.unset { color: var(--muted); }
.plan-item { padding: 2px 0; } .plan-item.done { color: var(--muted); text-decoration: line-through; }

/* Блоки кода в ответах: шапка с копированием, выделение любой части (NL-0111) */
.msg.bot .codebox { margin: 0 0 .8em; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow: hidden; }
.msg.bot .codebox pre { margin: 0; border: 0; border-radius: 0; user-select: text; -webkit-user-select: text; cursor: text; }
.msg.bot .codebox.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.codebox-head { display: flex; gap: 6px; align-items: center; padding: 4px 8px; background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: .78em; }
.codebox-lang { flex: 1; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.codebox-head button { min-height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; }
.codebox-head button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.files-list { display: flex; flex-direction: column; gap: 10px; }
.file-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px; }
.file-main { min-width: 0; overflow-wrap: anywhere; } .file-main small { color: var(--muted); display: block; }
.file-act { display: flex; gap: 6px; flex-wrap: wrap; }
a.btn-sm { text-decoration: none; }

/* TD-145 Э1: строка роутера под ответом (админ) */
.route-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-top: 6px;
  border-top: 1px dashed var(--border); font-size: .82em; color: var(--muted, #888); }
.route-head { font-weight: 600; cursor: help; }
.route-stars { display: inline-flex; }
.route-star { background: none; border: 0; padding: 2px 3px; font-size: 1.25em; line-height: 1; cursor: pointer;
  color: var(--border); min-width: 28px; min-height: 28px; }
.route-star.on { color: #d4a017; }
.route-row.labeled .route-star.on { color: #b7791f; }
.route-lab { font-weight: 600; }
.route-why { flex-basis: 100%; opacity: .8; }

/* Мой кабинет */
#view-me { display: flex; flex-direction: column; gap: 16px; }
.me-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.me-h { font-size: 1.1em; margin: 0 0 12px; }
#view-me .arow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
#view-me .arow .me-h { margin: 0; }
.me-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.me-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.me-stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.me-stat.paid { border-color: var(--accent); }
.me-stat-t { font-weight: 700; }
.me-stat-s { color: var(--muted); font-size: .85em; margin-top: 2px; }
.me-big { font-size: 1.8em; font-weight: 700; margin: 10px 0 6px; font-variant-numeric: tabular-nums; }
.me-big small { font-size: .5em; font-weight: 400; color: var(--muted); }
.me-dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; font-size: .92em; }
.me-dl dt { color: var(--muted); } .me-dl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.me-note { color: var(--muted); font-size: .85em; margin: 10px 0 0; }
.me-lim-h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.me-lim-v { font-variant-numeric: tabular-nums; color: var(--muted); }
.me-lim progress { width: 100%; height: 10px; accent-color: var(--accent); }
.me-lim.over .me-lim-v, .me-lim-x { color: var(--err-text); }
.me-scroll { overflow-x: auto; }
.me-tbl { border-collapse: collapse; width: 100%; font-size: .92em; font-variant-numeric: tabular-nums; }
.me-tbl th, .me-tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.me-tbl th:first-child, .me-tbl td:first-child { text-align: left; }
.me-tbl th { font-weight: 600; }
.pw-row { display: flex; gap: 8px; align-items: center; }
.pw-row .field { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
#pw-new2 { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.pw-eye.on { color: var(--accent); }
.pw-gen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pw-gen-l { color: var(--muted); font-size: .9em; }
.msg.ok { background: var(--accent-soft); color: var(--text); }

/* ======================= VIRTONIX-AI: оболочка (концепция 2026-11-26) ======================= */
/* Движение: короткие переходы, появление снизу на 8 px; без анимаций, если человек их отключил */
.btn, .btn-sm, .icon-btn, .side-item, .btn-new, .card, .bprimary, .crumb, .atab, .seg span {
  transition: background-color .15s ease-out, color .15s ease-out, border-color .15s ease-out, box-shadow .15s ease-out, transform .1s ease-out; }
.btn:active, .btn-sm:active, .bprimary:active, .btn-new:active, .card:active { transform: scale(.98); }
.btn.primary:hover:not(:disabled), .btn-sm.primary:hover { background: var(--accent-hover); }
.btn.primary:focus-visible, .bprimary:focus-visible, .btn-new:focus-visible, .card:focus-visible, .crumb:focus-visible,
.side-item:focus-visible, .avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view:not([hidden]) { animation: rise .3s ease-out both; }
.cards .card { animation: rise .3s ease-out both; }
.cards .card:nth-child(2) { animation-delay: .05s; } .cards .card:nth-child(3) { animation-delay: .1s; } .cards .card:nth-child(4) { animation-delay: .15s; }
@media (prefers-reduced-motion: reduce) { .view:not([hidden]), .cards .card { animation: none; } * { transition: none !important; } }

/* Знак — лого владельца (NL-0161, `logo.webp` 806×128, прозрачный фон; исходник — docs/design/2026-11-26-virtonix/logo-source.webp) */
.logo { display: block; width: 100%; height: auto; }
.logo.sm { width: 172px; }
.login-logo { margin: 0; width: min(340px, 100%); line-height: 0; }
.top-logo { width: auto; height: 30px; max-width: 100%; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #6A84F9, #4F6EF7); color: #fff; font: 600 13px/1 var(--font); letter-spacing: .02em; border: 0; }
button.avatar { cursor: pointer; }

/* ---------- Вход: слева знак и мягкий градиент, справа карточка формы ---------- */
html.on-login .top, html.on-login .side, html.on-login .side-backdrop, html.on-login .status { display: none !important; }
html.on-login body { padding: 0; }
html.on-login main { max-width: none; margin: 0; }
.login { display: grid; grid-template-columns: 55fr 45fr; min-height: 100dvh; gap: 0; font-size: 16px; }
.login-brand { position: relative; overflow: hidden; padding: 64px 72px;
  background:
    radial-gradient(60% 45% at 15% 85%, rgba(79,110,247,.20), transparent 70%),
    radial-gradient(45% 40% at 70% 70%, rgba(139,124,246,.14), transparent 70%),
    radial-gradient(50% 40% at 85% 15%, rgba(244,180,200,.12), transparent 70%),
    linear-gradient(160deg, #F7F8FF 0%, #F4F5FD 55%, #FBF8FA 100%); }
.login-art { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: rgba(79,110,247,.16); stroke-width: 1.2; }
.login-art path:nth-child(even) { stroke: rgba(139,124,246,.13); }
.login-mark { position: relative; }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 48px 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 480px; padding: 48px 40px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-card); }
.login-h { margin: 0 0 32px; color: var(--primary); font-size: clamp(28px, 2.4vw, 38px); white-space: nowrap; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.flbl { font-size: 14px; color: var(--muted); }
.finput { width: 100%; height: 48px; padding: 0 14px; font: 400 16px/1.5 var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; transition: border-color .15s ease-out, box-shadow .15s ease-out; }
.finput::placeholder { color: var(--tertiary); }
.finput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.finput-wrap { position: relative; }
.finput-wrap .finput { padding-right: 48px; }
.eye { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.eye:hover { color: var(--primary); } .eye:focus-visible { outline: 2px solid var(--accent); }
.ferr { margin: -6px 0 0; font-size: 13px; color: var(--err-text); }
.bprimary { height: 48px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 500 16px/1 var(--font); cursor: pointer; }
.bprimary:hover:not(:disabled) { background: var(--accent-hover); } .bprimary:disabled { opacity: .6; cursor: default; }
.blink { align-self: flex-end; margin-top: -6px; padding: 4px 0; border: 0; background: none; color: var(--accent); font: 400 14px/1.5 var(--font); cursor: pointer; }
.blink:hover { color: var(--accent-hover); text-decoration: underline; }
.fhint { margin: -8px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--primary); font-size: 14px; line-height: 1.5; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-brand { padding: 22px 20px 20px; }
  .login-art { opacity: .6; }
  .login-logo { width: 190px; } .tagline { font-size: 14px; margin-top: 4px; }
  .login-side { align-items: flex-start; padding: 24px 16px 40px; }
  .login-card { padding: 28px 20px; }
  .login-h { margin-bottom: 24px; white-space: normal; }
}

/* ---------- Минимализм: шапка с «хлебными крошками» и аватаром ---------- */
#btn-menu, .crumb, .crumb-sep, .top-avatar { display: none; }
.crumbs { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs h1 { flex: 1; min-width: 0; margin: 0; font-size: 1.15em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ui="min"] .top { min-height: 64px; padding: 12px 0; gap: 12px; }
html[data-ui="min"] .crumbs h1 { flex: 0 1 auto; font-size: 15px; font-weight: 600; color: var(--primary); }
html[data-ui="min"] .crumb:not([hidden]) { display: inline-flex; align-items: center; min-height: 32px; padding: 0 6px; margin-left: -6px; border: 0; border-radius: 8px;
  background: none; color: var(--muted); font: 400 15px/1 var(--font); cursor: pointer; }
html[data-ui="min"] .crumb:hover { color: var(--primary); }
html[data-ui="min"] .crumb-sep:not([hidden]) { display: inline-block; width: 16px; height: 16px; color: var(--tertiary); }
html[data-ui="min"] .top-avatar:not([hidden]) { display: inline-flex; margin-left: auto; }

/* ---------- Минимализм: боковая панель 260 px; уже 1024 px — выезжающая шторка ---------- */
html[data-ui="min"] .side:not([hidden]) { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 260px; display: flex; flex-direction: column; gap: 6px;
  padding: 20px 12px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.side-head { padding: 2px 10px 14px; }
.btn-new { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; margin: 0 0 12px; padding: 0 14px 0 16px;
  border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 500 15px/1 var(--font); cursor: pointer; }
.btn-new:hover { background: var(--accent-hover); } .btn-new .ic { width: 18px; height: 18px; }
html[data-ui="min"] .side-list { display: flex; flex-direction: column; gap: 2px; }
html[data-ui="min"] .side-item { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border: 0; border-radius: 10px;
  background: transparent; color: var(--primary); font: 500 15px/1 var(--font); cursor: pointer; white-space: nowrap; text-align: left; }
html[data-ui="min"] .side-item .ic { width: 20px; height: 20px; stroke-width: 1.5; color: var(--muted); }
html[data-ui="min"] .side-item .ic + span { margin-left: 0; }
html[data-ui="min"] .side-item:hover { background: var(--bg); }
html[data-ui="min"] .side-item.active { background: var(--accent-tint); color: var(--accent); }
html[data-ui="min"] .side-item.active .ic { color: var(--accent); }
.side-recent { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.side-cap { margin: 0 0 6px; padding: 0 16px; font: 500 12px/1.4 var(--font); letter-spacing: .02em; color: var(--muted); }
.recent { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 8px 12px 8px 16px; border: 0; border-radius: 10px;
  background: none; color: var(--primary); font: 500 14px/1.35 var(--font); text-align: left; cursor: pointer; }
.recent:hover { background: var(--bg); } .recent.cur { background: var(--accent-tint); }
.recent .ic { width: 18px; height: 18px; margin-top: 1px; stroke-width: 1.5; color: var(--muted); }
.recent .rt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.recent small { display: block; margin-top: 2px; color: var(--tertiary); font-weight: 400; font-size: 12px; }
html[data-ui="min"] .side-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px 6px 4px 8px; border-top: 1px solid var(--border); }
html[data-ui="min"] .side-foot #side-name { flex: 1; min-width: 0; color: var(--primary); font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-ui="min"] .side-out { min-width: 36px; height: 36px; border: 0; background: none; color: var(--muted); }
html[data-ui="min"] .side-out:hover { color: var(--primary); background: var(--bg); }
.side-backdrop { display: none; }
@media (min-width: 1024px) {
  html[data-ui="min"] body:has(.side:not([hidden])) { padding-left: 292px; padding-right: 32px; }
}
@media (max-width: 1023px) {
  html[data-ui="min"] #btn-menu { display: inline-flex; min-width: 40px; border: 0; background: none; color: var(--primary); }
  html[data-ui="min"] .side:not([hidden]) { transform: translateX(-100%); transition: transform .25s ease-in-out; box-shadow: none; }
  html.side-open[data-ui="min"] .side:not([hidden]) { transform: none; box-shadow: 0 8px 40px rgba(26,26,46,.18); }
  html.side-open[data-ui="min"] .side-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(26,26,46,.28); }
}
html[data-ui="min"] #btn-menu[hidden] { display: none; }

/* ---------- Минимализм: главная — приветствие и подсказки 2×2 ---------- */
html[data-ui="min"] main { max-width: 1040px; }
.hero { display: flex; flex-direction: column; padding: 24px 0 8px; }
.hero-h { margin: 0; color: var(--primary); font-size: clamp(30px, 4vw, 40px); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; }
.hero-sub { margin: 10px 0 32px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-height: 180px; padding: 28px; border: 0; border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-card); color: var(--primary); font: 400 15px/1.5 var(--font); text-align: left; cursor: pointer; }
.card:hover { box-shadow: 0 2px 6px rgba(0,0,0,.05), 0 10px 28px rgba(0,0,0,.06); }
.card-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.card-ic .ic { width: 24px; height: 24px; stroke-width: 1.5; }
.card-text { display: flex; flex-direction: column; gap: 6px; }
.card-t { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.card-d { color: var(--muted); font-size: 15px; max-width: 34ch; }
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; gap: 12px; }
  .card { min-height: 0; padding: 18px 20px; flex-direction: row; align-items: center; gap: 14px; }
  .card-ic { margin: 0; width: 44px; height: 44px; }
  .card-text { gap: 2px; }
  .card-t { font-size: 17px; } .card-d { font-size: 14px; }
  .hero-sub { margin-bottom: 20px; font-size: 16px; }
}

/* ---------- Минимализм: плавающая строка вопроса (720 px, тень, круглая кнопка) ---------- */
.send-ic { display: none; }
html[data-ui="min"] .ask, html[data-ui="min"] .ask.compact {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "photos photos" "talk talk" "input input" "model row" "new new";
  width: 100%; max-width: 720px; margin: 12px auto 16px; padding: 12px 8px 8px 16px; gap: 4px 8px;
  border: 0; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-float); bottom: 16px; }
html[data-ui="min"] #photos { grid-area: photos; padding-top: 4px; }
html[data-ui="min"] .talk-status { grid-area: talk; }
html[data-ui="min"] #ask-input { grid-area: input; font-size: 16px; padding: 6px 4px 4px; }
html[data-ui="min"] #ask-input::placeholder { color: var(--tertiary); }
html[data-ui="min"] .ask .field:focus { box-shadow: none; }
html[data-ui="min"] .ask #model-pick:not([hidden]) { grid-area: model; align-self: center; width: auto; max-width: 220px; height: 32px; margin: 0; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--primary); font-size: 13px; font-weight: 500; cursor: pointer; }
html[data-ui="min"] .ask-row { grid-area: row; justify-content: flex-end; }
html[data-ui="min"] #new-btn { display: none; }   /* новый разговор — «Новый чат» в панели; в «Коде» — «Новая» сессия */
html[data-ui="min"] .ask-row > .btn.mic, html[data-ui="min"] .ask.compact .ask-row > .btn.mic { color: var(--muted); }
html[data-ui="min"] .ask-row > .btn.mic:hover { color: var(--primary); background: var(--bg); }
html[data-ui="min"] #ask-btn { order: 3; flex: 0 0 36px; width: 36px; min-height: 36px; height: 36px; margin-left: 6px; padding: 0; border-radius: 50%; }
html[data-ui="min"] #ask-btn .btn-txt { display: none; }
html[data-ui="min"] #ask-btn .send-ic { display: block; width: 18px; height: 18px; stroke-width: 2.2; }
html[data-ui="min"] #stop-btn { order: 3; flex: 0 0 auto; min-height: 36px; border-radius: 18px; }
html[data-ui="min"] .ask.drop-on { outline: 2px dashed var(--accent); }

/* ---------- Минимализм: карточки, кабинеты, диалоги — тень вместо рамки ---------- */
html[data-ui="min"] .me-card, html[data-ui="min"] .vcard, html[data-ui="min"] .auser, html[data-ui="min"] .person {
  border: 0; border-radius: 16px; box-shadow: var(--shadow-card); background: var(--surface); }
html[data-ui="min"] .me-card { padding: 24px; }
html[data-ui="min"] .adlg { border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(26,26,46,.18); }
html[data-ui="min"] .adlg::backdrop { background: rgba(26,26,46,.35); }
html[data-ui="min"] .msg.user { background: var(--accent-soft); color: var(--primary); }
html[data-ui="min"] .status { border-radius: 12px; }
html[data-ui="min"] .tile { border: 0; box-shadow: var(--shadow-card); border-radius: 16px; }

/* ---------- Мамы (крупный интерфейс): новая палитра, тень у плиток ---------- */
html[data-ui="large"] .tile { border-color: transparent; box-shadow: var(--shadow-card); }
html[data-ui="large"] .msg.bot { border-color: var(--border); }
html[data-ui="min"] #hist-btn { display: none; }   /* «Разговоры» и «Мои файлы» — в боковой панели */
