/* vai — интерфейс по макету Vai.pdf */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --panel: #020926;
  --bg-top: #050c1f;
  --bg-mid: #0a3f96;
  --blue: #2f91f2;
  --blue-deep: #094ac0;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.14);
  --bubble: #d7d7d7;
  --ink: #010511;
  --radius: 26px;
  --font: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg-top);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, textarea, input { font-family: inherit; }
button { cursor: pointer; }

/* ---------------------------------------------------------------- заставка */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(700px 500px at 70% 30%, rgba(47, 145, 242, 0.35), transparent 60%),
    radial-gradient(600px 420px at 25% 85%, rgba(9, 74, 192, 0.45), transparent 65%),
    linear-gradient(160deg, #020926 0%, #061534 45%, #0a2b63 100%);
  transition: opacity 0.6s ease;
}
#splash.hidden { opacity: 0; pointer-events: none; }
.splash-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 170, 255, 0.45), transparent 65%);
  filter: blur(40px);
  animation: breathe 2.6s ease-in-out infinite;
}
.splash-inner { position: relative; text-align: center; }
.splash-crown {
  width: 150px;
  display: block;
  margin: 0 auto 18px;
  filter: drop-shadow(0 0 26px rgba(120, 190, 255, 0.55));
  animation: crownIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.splash-word {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: fadeUp 0.8s 0.35s ease forwards;
}
.splash-line {
  width: 170px;
  height: 2px;
  margin: 22px auto 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  overflow: hidden;
}
.splash-line span {
  display: block;
  height: 100%;
  width: 40%;
  background: #fff;
  border-radius: 2px;
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes crownIn {
  from { opacity: 0; transform: translateY(14px) scale(0.92); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.65; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* ------------------------------------------------------------------- каркас */
.app { display: flex; height: 100dvh; }

/* ------------------------------------------------------------------ сайдбар */
.sidebar {
  width: 320px;
  flex: 0 0 320px;
  background: var(--panel);
  padding: 28px 26px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  transition: width 0.25s ease, padding 0.25s ease, flex-basis 0.25s ease;
  z-index: 20;
}
.sidebar.collapsed {
  width: 0; flex-basis: 0; padding-left: 0; padding-right: 0;
  overflow: hidden; border-right: 0;
}
.side-top { display: flex; align-items: center; justify-content: space-between; }
.logo { width: 78px; display: block; }
.side-icons { display: flex; gap: 14px; }
.icon-btn {
  background: none; border: 0; padding: 0; color: var(--muted);
  width: 22px; height: 22px; display: grid; place-items: center;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.new-chat {
  margin-top: 34px;
  width: 100%;
  max-width: 240px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.new-chat:hover { background: rgba(255, 255, 255, 0.08); }
.new-chat svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }

.search-row { margin-top: 20px; display: none; }
.search-row.open { display: block; }
.search-row input {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.search-row input::placeholder { color: var(--muted); }

.chat-list {
  margin-top: 26px;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.chat-item {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0;
  background: none;
  text-align: left;
  color: rgba(255, 255, 255, 0.52);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.1px;
  padding: 8px 8px;
  border-radius: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease, background 0.15s ease;
}
.chat-item:hover { color: rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.05); }
.chat-item.active { color: var(--text); }
.chat-empty { color: rgba(255, 255, 255, 0.3); font-size: 14px; padding: 10px 6px; }

.side-foot {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
}
.avatar { width: 36px; height: 36px; display: block; }

/* --------------------------------------------------------------- основная */
.main {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 700px at 84% 10%, rgba(47, 145, 242, 0.45), transparent 60%),
    radial-gradient(900px 620px at 18% 88%, rgba(9, 74, 192, 0.55), transparent 65%),
    linear-gradient(154deg, #03071a 0%, #05122c 32%, #0a3a8c 68%, #0b52cf 100%);
}
.main::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 620px at 6% 0%, rgba(2, 6, 20, 0.88), transparent 58%);
  pointer-events: none;
  z-index: 1;
}
.glow {
  position: absolute;
  inset: -30%;
  background: linear-gradient(112deg,
    transparent 32%,
    rgba(140, 200, 255, 0.12) 43%,
    rgba(255, 255, 255, 0.26) 49%,
    rgba(140, 200, 255, 0.14) 55%,
    transparent 66%);
  filter: blur(42px);
  transform: rotate(-5deg);
  pointer-events: none;
}
.viv {
  position: absolute;
  top: 32px;
  right: 42px;
  width: 96px;
  z-index: 3;
  opacity: 0.95;
}

/* пустой экран */
.empty {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.content { width: min(880px, 92%); }
.empty h1 {
  margin: 0 0 46px;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.04;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 40px rgba(0, 20, 60, 0.35);
}

/* --------------------------------------------------------------- композер */
.composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: rgba(8, 20, 46, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 26px;
  padding: 12px 70px 12px 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.composer:focus-within {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(8, 20, 46, 0.55);
}
.composer--empty { min-height: 132px; align-items: stretch; }
.composer textarea {
  flex: 1;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  max-height: 148px;
  padding: 10px 0;
}
.composer textarea::placeholder { color: rgba(255, 255, 255, 0.55); }
.send {
  position: absolute;
  right: 14px;
  bottom: 7px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: #ffffff;
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.composer--empty .send { bottom: 8px; }
.send svg { width: 20px; height: 20px; fill: none; stroke: #0a1230; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.send:hover { transform: scale(1.05); }
.send:disabled { opacity: 0.5; cursor: default; transform: none; }

/* ------------------------------------------------------------- переписка */
.conversation { display: none; flex: 1; flex-direction: column; min-height: 0; position: relative; z-index: 2; }
.conversation::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 136px;
  background: linear-gradient(180deg,
    #030818 0,
    #030818 76px,
    rgba(3, 8, 24, 0.82) 104px,
    transparent 136px);
  pointer-events: none;
  z-index: 3;
}
.app.chat .empty { display: none; }
.app.chat .conversation { display: flex; }

.chat-head {
  position: absolute;
  top: 34px;
  z-index: 5;
  left: 46px;
  right: 130px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 4;
}
.back {
  border: 0; background: none; padding: 0; color: #fff;
  width: 30px; height: 30px; display: grid; place-items: center;
}
.back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chat-head h2 {
  margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 152px 24px 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
.messages-inner { width: min(880px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 26px; }

.message { display: flex; flex-direction: column; animation: msgIn 0.25s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.message.user { align-items: flex-end; }
.message.user .bubble {
  max-width: 72%;
  background: var(--bubble);
  color: var(--ink);
  border-radius: 26px;
  padding: 15px 22px;
  font-size: 17px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.message.assistant .text {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}
.message.assistant .text p { margin: 0 0 14px; }
.message.assistant .text p:last-child { margin-bottom: 0; }
.message.assistant .text ul, .message.assistant .text ol { margin: 0 0 14px; padding-left: 22px; }
.message.assistant .text li { margin: 6px 0; }
.message.assistant .text strong { font-weight: 700; }
.message.assistant .text h1, .message.assistant .text h2, .message.assistant .text h3 {
  font-size: 18px; font-weight: 700; margin: 4px 0 12px;
}

.sources {
  margin-top: 14px;
  font-size: 12.5px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.45);
}
.sources a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.sources a:hover { color: rgba(255, 255, 255, 0.8); }
.badge {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.typing { display: flex; gap: 6px; padding: 10px 2px; }
.typing span {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.composer-wrap { padding: 0 24px 26px; }
.composer-wrap .composer { width: min(880px, 100%); margin: 0 auto; min-height: 58px; }
.composer-wrap textarea { padding: 6px 0; }

.error { color: #ffb4b4; font-size: 14px; }

/* --------------------------------------------------------------- мобильный */
.mobile-logo {
  display: none;
  position: absolute;
  top: 22px;
  left: 20px;
  z-index: 6;
  border: 0; background: none; padding: 0;
  width: 62px;
}
.mobile-logo img { width: 100%; display: block; }
.close-btn { display: none; }
.arrow-right { display: none; }

.mobile-menu {
  display: none;
  position: absolute;
  top: 26px;
  left: 20px;
  z-index: 6;
  width: 34px;
  height: 34px;
  border: 0;
  background: none;
  padding: 6px;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.mobile-menu span { display: block; height: 2px; background: #fff; border-radius: 2px; }

.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 25;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 86%; max-width: 380px;
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-right: 0;
    padding-top: 34px;
    z-index: 40;
  }
  .sidebar.collapsed { width: 86%; flex-basis: auto; padding: 34px 26px 22px; }
  body.drawer .sidebar { transform: none; }
  body.drawer .backdrop { opacity: 1; pointer-events: auto; }
  .side-icons #sideToggle { display: none; }

  .mobile-logo { display: block; }
  .mobile-menu { display: none; }
  .close-btn { display: grid; }
  .side-icons #searchToggle { display: none; }
  .arrow-up { display: none; }
  .arrow-right { display: block; }
  .main { padding-top: 0; }
  .viv { top: 20px; right: 20px; width: 70px; }
  .empty { align-items: center; padding: 96px 20px 40px; }
  .content { width: 100%; }
  .empty h1 { font-size: 40px; text-align: center; margin-bottom: 34px; }
  .composer--empty {
    min-height: 64px;
    border-radius: 999px;
    padding: 8px 62px 8px 22px;
    align-items: center;
  }
  .composer--empty textarea { padding: 8px 0; }
  .composer--empty .send { bottom: 50%; transform: translateY(50%); }
  .composer--empty .send:hover { transform: translateY(50%) scale(1.05); }

  .chat-head { top: 18px; left: 16px; right: 16px; gap: 10px; }
  .chat-head h2 { font-size: 18px; }
  .back { display: grid; }
  .app.chat .mobile-logo,
  .app.chat .viv { display: none; }
  .app.chat .conversation::before {
    background: linear-gradient(180deg,
      #030818 0, #030818 64px, rgba(3, 8, 24, 0.8) 92px, transparent 124px);
    height: 124px;
  }
  .app.chat .messages { padding-top: 132px; }
  .messages { padding: 78px 16px 18px; }
  .messages-inner { gap: 22px; }
  .message.user .bubble { max-width: 88%; font-size: 16px; }
  .message.assistant .text { font-size: 16px; }
  .composer-wrap { padding: 0 12px 16px; }
  .composer { border-radius: 22px; padding: 8px 60px 8px 20px; }
  .send { width: 40px; height: 40px; right: 10px; bottom: 2px; }
}

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

/* таблицы в ответах */
.message.assistant .text table {
  border-collapse: collapse;
  margin: 4px 0 16px;
  width: 100%;
  font-size: 15px;
}
.message.assistant .text th,
.message.assistant .text td {
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.message.assistant .text th { background: rgba(255, 255, 255, 0.09); font-weight: 600; }
.message.assistant .text tr:nth-child(even) td { background: rgba(255, 255, 255, 0.03); }


/* ------------------------------------------------- потоковый ответ, стрелка */
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  padding: 6px 0 10px;
}
.status-dots { display: inline-flex; gap: 4px; }
.status-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.35;
  animation: statusPulse 1.2s infinite ease-in-out;
}
.status-dots i:nth-child(2) { animation-delay: 0.15s; }
.status-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes statusPulse {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.status-text.swap { animation: statusSwap 0.35s ease; }
@keyframes statusSwap {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.scroll-down {
  position: absolute;
  left: 50%;
  bottom: 132px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(6, 14, 32, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  z-index: 6;
}
.scroll-down.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  animation: bob 1.9s ease-in-out infinite;
}
.scroll-down svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(5px); }
}

.sound-btn {
  margin-left: auto;
  width: 24px; height: 24px;
  border: 0; background: none; padding: 0;
  color: rgba(255, 255, 255, 0.55);
  display: grid; place-items: center;
}
.sound-btn:hover { color: #fff; }
.sound-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound-btn.muted { opacity: 0.35; }
.sound-btn.muted::after {
  content: ''; position: absolute; width: 22px; height: 1.5px;
  background: currentColor; transform: rotate(-45deg);
}

@media (max-width: 900px) {
  .scroll-down { bottom: 86px; width: 40px; height: 40px; }
}

/* ------------------------------------------------------ auth gate / restore sidebar */
.app.auth-required { pointer-events: none; filter: blur(2px) saturate(.7); user-select: none; }
body.auth-required #loginModal .modal-close { display: none; }
.sidebar-restore {
  display: none; position: fixed; left: 18px; top: 18px; z-index: 35;
  align-items: center; gap: 8px; padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.16); border-radius: 11px;
  background: #0d2038; color: #dcecff; font: inherit; font-size: 13px;
  cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.sidebar-restore svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.sidebar-restore:hover { border-color: rgba(120,180,255,.6); color: #fff; }
.app.side-collapsed .sidebar-restore { display: inline-flex; }
@media (max-width: 900px) { .app.side-collapsed .sidebar-restore { display: none !important; } }

/* ------------------------------------------------------ пользователь, модалки */
.user-meta { display: flex; flex-direction: column; line-height: 1.15; gap: 2px; }
.auth-link {
  border: 0; background: none; padding: 0; text-align: left;
  color: rgba(255, 255, 255, 0.5); font-size: 12px;
}
.auth-link:hover { color: #fff; text-decoration: underline; }

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 20, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal.open { display: flex; animation: modalFade 0.2s ease; }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(170deg, #0a1a3c, #07112a);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 24px 24px 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; gap: 14px;
  animation: modalPop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal--wide .modal-card { max-width: 760px; }
#reportModal .modal-card {
  max-width: min(760px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  gap: 16px;
}
#reportModal textarea { min-height: 150px; }
#reportModal .field select { min-height: 44px; }
@keyframes modalPop {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 19px; font-weight: 700; }
.modal-close {
  border: 0; background: none; color: rgba(255, 255, 255, 0.5);
  font-size: 26px; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: rgba(255,255,255,.6); }
.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 11px 13px;
  color: #fff; font-size: 15px; font-family: inherit;
  outline: none; resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(120, 180, 255, 0.65);
  background: rgba(255, 255, 255, 0.09);
}
.field select option { background: #0a1a3c; }
.flags { display: flex; flex-wrap: wrap; gap: 12px 18px; font-size: 14px; }
.flags label { display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.85); }
.flags input { width: 16px; height: 16px; accent-color: #2f91f2; }
.modal-error { color: #ffb4b4; font-size: 13px; min-height: 16px; }
.btn-primary {
  border: 0; border-radius: 999px; padding: 12px 18px;
  background: #fff; color: #07112a; font-weight: 700; font-size: 15px;
}
.btn-primary:hover { background: #e8f0ff; }
.btn-primary:disabled { opacity: 0.6; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: rgba(8, 18, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff; font-size: 14px;
  padding: 11px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 70;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* статистика и Report под ответом */
.msg-footer { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.stats-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: rgba(255, 255, 255, 0.42);
}
.stats-row .dot { opacity: 0.5; }
.report-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: none; color: rgba(255, 255, 255, 0.6);
  font-size: 11.5px; letter-spacing: 0.03em;
  padding: 3px 10px; border-radius: 999px;
}
.report-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.45); }

@media (max-width: 900px) {
  .modal-card { padding: 20px 18px; border-radius: 18px; }
  .modal-head h3 { font-size: 17px; }
}


/* ---------------------------------------------------------- техработы */
.maint {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(700px 500px at 70% 25%, rgba(47,145,242,.35), transparent 60%),
              linear-gradient(160deg, #020926, #061534 55%, #0a2b63);
  padding: 24px;
}
.maint[hidden] { display: none; }
.maint-card { text-align: center; max-width: 560px; }
.maint-crown {
  width: 150px; display: block; margin: 0 auto 10px;
  animation: maintBob 2.4s ease-in-out infinite;
  filter: drop-shadow(0 0 24px rgba(120,190,255,.55));
}
@keyframes maintBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
}
.maint-tools { font-size: 26px; letter-spacing: 8px; margin-bottom: 10px; }
.maint-tools span { display: inline-block; animation: toolSpin 3s linear infinite; }
.maint-tools span:nth-child(2) { animation-direction: reverse; }
@keyframes toolSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.maint h2 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -0.01em; }
.maint p { margin: 0 0 24px; font-size: 17px; line-height: 1.55; color: rgba(255,255,255,.72); }
.maint-dots { display: flex; gap: 8px; justify-content: center; }
.maint-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: #fff; opacity: .35;
  animation: maintPulse 1.3s infinite ease-in-out;
}
.maint-dots i:nth-child(2) { animation-delay: .18s; }
.maint-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes maintPulse {
  0%, 80%, 100% { opacity: .25; transform: scale(.9); }
  40% { opacity: 1; transform: scale(1.15); }
}

/* блок рассуждений */
.message.assistant .text blockquote {
  margin: 4px 0 18px;
  padding: 12px 16px;
  border-left: 2px solid rgba(120, 180, 255, 0.55);
  background: rgba(8, 20, 44, 0.35);
  border-radius: 0 12px 12px 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
}
.message.assistant .text blockquote p { margin: 0 0 6px; }
.message.assistant .text blockquote p:last-child { margin-bottom: 0; }

/* ------------------------------------------------ рассуждение (ChatGPT-style) */
.thoughts {
  margin: 0 0 16px;
  padding: 10px 14px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(8, 20, 44, 0.35);
}
.thoughts summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  list-style: none;
}
.thoughts summary::-webkit-details-marker { display: none; }
.thought-spinner {
  width: 8px; height: 8px; border-radius: 50%;
  background: #7db8ff;
  box-shadow: 0 0 10px rgba(125, 184, 255, 0.8);
  animation: thoughtPulse 1.2s infinite ease-in-out;
}
@keyframes thoughtPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}
.thoughts:not([open]) .thought-spinner { animation: none; opacity: 0.4; }
.thought-item {
  padding: 8px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.55);
}
.thought-item:first-child { border-top: 0; padding-top: 8px; }
.thoughts[open] .thought-item:last-child { padding-bottom: 10px; }


/* компактный тикер мыслей: ровно 1–2 строки, без простыни */
.thought-live {
  margin-top: 8px;
  padding: 8px 2px 2px;
  border-top: 1px dashed rgba(255, 255, 255, 0.16);
  min-height: 44px;
}
.thought-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.62);
}
.thought-text.swap { animation: thoughtSwap 0.22s ease; }
@keyframes thoughtSwap {
  from { opacity: 0.25; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.upload-list { display:flex; flex-direction:column; gap:5px; margin-top:6px; }
.upload-row { display:flex; justify-content:space-between; gap:8px; font-size:12px; color:var(--muted); border:1px solid rgba(255,255,255,.1); border-radius:8px; padding:5px 7px; }
.upload-row b { color:var(--green); font-weight:600; }
#reportFiles { padding:9px 0; font-size:12px; color:var(--muted); }

.report-dashboard-link { display:block; margin-top:8px; color:#ffd166; font-size:12px; text-decoration:underline; }

/* --------------------------------------------------- ссылки в ответах */
.text a.answer-link,
.text a.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  vertical-align: baseline;
  padding: 2px 9px;
  margin: 1px 2px;
  border: 1px solid rgba(125, 184, 255, 0.42);
  border-radius: 9px;
  background: rgba(125, 184, 255, 0.10);
  color: #cfe6ff;
  text-decoration: none;
  line-height: 1.5;
  word-break: break-all;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.text a.answer-link:hover,
.text a.source-link:hover {
  background: rgba(125, 184, 255, 0.24);
  border-color: rgba(160, 210, 255, 0.8);
  color: #ffffff;
}
.text a.answer-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text a.answer-link span { min-width: 0; }
.text a.source-link { border-radius: 7px; padding: 1px 6px; }

/* --------------------------------------------------- меню чата */
.chat-menu {
  position: fixed;
  z-index: 90;
  min-width: 220px;
  padding: 6px;
  background: #0d1d33;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.chat-menu button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #eaf2ff;
  text-align: left;
  padding: 9px 11px;
  font-size: 13px;
}
.chat-menu button:hover { background: rgba(255,255,255,.08); }
.chat-menu button.danger { color: #ff9b9b; }
