/* app.css v0.1.3 — 04.09.2026 — лента ответов резиновая: --content = 96 % ширины (до 1800 px), схема из пяти узлов
   помещается на любом экране и масштабе; v0.1.2 — --content 820 → 1360 px */
/* v0.1.1 — 30.08.2026 — кнопки списка диалогов без сдвига строки (visibility), запрет переноса в кнопках */
/* v0.1.0 — 29.08.2026 — первый выпуск: светлая тема, токены, макет, лента, композер, вход */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e3e8ee;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #0e7490;
  --accent-2: #0891b2;
  --accent-soft: #e0f2fe;
  --good: #15803d;
  --bad: #b91c1c;
  --warn: #b45309;
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 10px 28px -14px rgba(15, 23, 42, .22);
  --font: "Inter", "Segoe UI", "Noto Sans Armenian", "Noto Sans", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "DejaVu Sans Mono", monospace;
  --sidebar: 300px;
  --content: min(1800px, 96%);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
::selection { background: rgba(15, 118, 110, .28); }
/* В пузыре сотрудника фон и был --accent-soft — выделение сливалось и казалось, что текст не выделяется (07.09) */
.msg.user .bubble::selection, .msg.user .bubble *::selection { background: #0f766e; color: #fff; }
.msg.user .bubble::-moz-selection, .msg.user .bubble *::-moz-selection { background: #0f766e; color: #fff; }
/* ---------- кнопки ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 9px 16px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(8, 145, 178, .7);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text-2);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
/* ---------- бренд ---------- */
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 8px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; letter-spacing: .5px;
  box-shadow: 0 8px 18px -8px rgba(8, 145, 178, .8);
}
.brand-name { font-weight: 700; letter-spacing: .1em; font-size: 14px; }
.brand-big { justify-content: center; padding-bottom: 20px; }
.brand-big .brand-mark { width: 44px; height: 44px; border-radius: 13px; font-size: 16px; }
.brand-big .brand-name { font-size: 17px; }
/* ---------- макет ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  height: 100vh;
  height: 100dvh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 0;
}
.sidebar-title {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
  padding: 8px 6px 0;
}
.dialogs { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -6px; padding: 0 6px; }
.dialog-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-s);
  color: var(--text-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s;
}
.dialog-item:hover { background: var(--surface-2); color: var(--text); }
.dialog-item.active { background: var(--accent-soft); color: var(--accent); border-color: #bae6fd; }
.dialog-item .title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
.dialog-item .tools { display: flex; gap: 2px; flex: 0 0 auto; visibility: hidden; }
.dialog-item:hover .tools, .dialog-item.active .tools { visibility: visible; }
.dialog-item .tools button {
  border: 0; background: transparent; color: inherit; opacity: .7;
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
}
.dialog-item .tools button:hover { opacity: 1; background: rgba(15, 23, 42, .06); }
.dialogs-empty { color: var(--text-3); font-size: 13px; padding: 10px; }
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.user { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 58px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: rgba(244, 246, 248, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lang { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  padding: 5px 10px; border-radius: 999px;
}
.lang button.active { background: var(--accent); color: #fff; }
.lang-center { margin: 18px auto 0; }
/* ---------- лента ---------- */
.messages { flex: 1; overflow-y: auto; padding: 24px 20px 8px; scroll-behavior: smooth; }
.hero {
  max-width: 520px; margin: 14vh auto 0; text-align: center; color: var(--text-2);
}
.hero-mark {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 20px;
  box-shadow: 0 18px 36px -16px rgba(8, 145, 178, .9);
}
.hero h1 { font-size: 26px; margin: 0 0 8px; color: var(--text); letter-spacing: -.01em; }
.hero p { margin: 0; }
.msg { max-width: var(--content); margin: 0 auto 18px; display: flex; gap: 12px; }
.msg.user { justify-content: flex-end; }
.msg .bubble {
  max-width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--accent-soft);
  border-color: #bae6fd;
  color: #0c4a6e;
  max-width: 80%;
  white-space: pre-wrap;
}
.msg.assistant .body { flex: 1; min-width: 0; }
.msg.assistant .mark {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 11px;
  margin-top: 4px;
}
.bubble.streaming::after {
  content: ""; display: inline-block; width: 7px; height: 15px;
  margin-left: 3px; vertical-align: -2px;
  background: var(--accent-2); border-radius: 2px;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { to { opacity: 0; } }
.meta { font-size: 12px; color: var(--text-3); margin: 6px 4px 0; display: flex; gap: 12px; }
.meta .bad { color: var(--bad); }
details.think {
  margin: 0 0 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
}
details.think summary { cursor: pointer; padding: 7px 12px; font-weight: 600; user-select: none; }
details.think .think-body { padding: 0 12px 10px; white-space: pre-wrap; }
.msg.error .bubble { border-color: #fecaca; background: #fef2f2; color: var(--bad); }
/* markdown внутри ответа */
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3 { margin: 14px 0 8px; line-height: 1.25; }
.bubble h1 { font-size: 20px; } .bubble h2 { font-size: 17px; } .bubble h3 { font-size: 15px; }
.bubble ul, .bubble ol { margin: 0 0 10px; padding-left: 22px; }
.bubble li { margin: 2px 0; }
.bubble code {
  font-family: var(--mono); font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}
.bubble pre {
  background: #0f172a; color: #e2e8f0;
  border-radius: var(--radius-s); padding: 12px 14px;
  overflow-x: auto; margin: 0 0 10px;
}
.bubble pre code { background: none; border: 0; padding: 0; color: inherit; }
.bubble blockquote {
  margin: 0 0 10px; padding: 4px 14px;
  border-left: 3px solid var(--accent-2); color: var(--text-2);
}
.bubble hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.acc-good { color: var(--good); font-weight: 600; }
.acc-bad { color: var(--bad); font-weight: 600; }
.acc-warn { color: var(--warn); font-weight: 600; }
/* ---------- композер ---------- */
.composer { padding: 8px 20px 18px; background: linear-gradient(to top, var(--bg) 75%, transparent); }
.composer-box {
  max-width: var(--content); margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 10px 12px 8px;
  transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(8, 145, 178, .12), var(--shadow); }
.composer-box textarea {
  width: 100%; border: 0; outline: 0; resize: none;
  background: transparent; padding: 6px 6px 2px;
  max-height: 220px; line-height: 1.5;
}
.composer-box textarea::placeholder { color: var(--text-3); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 10px; }
.composer-buttons { display: flex; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; padding-left: 6px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px;
  background: var(--line-strong); position: relative; transition: background .15s;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--accent-2); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
/* ---------- вход ---------- */
.login {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(600px 400px at 20% 10%, #e0f2fe 0%, transparent 70%),
    radial-gradient(600px 400px at 90% 90%, #ccfbf1 0%, transparent 70%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.field input {
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 10px 12px; background: var(--surface); font-weight: 400; font-size: 15px;
}
.field input:focus { outline: 0; border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(8, 145, 178, .12); }
.error { color: var(--bad); font-size: 13px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-s); padding: 8px 12px; }
/* ---------- узкие экраны ---------- */
.scrim { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: var(--sidebar); z-index: 30;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .msg.user .bubble { max-width: 92%; }
}
@media (min-width: 901px) { #toggleSidebar { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
