/* ============================================================
   AI Chat · not.zzot.ru — современный дизайн, тёмная/светлая тема
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter",
          "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
          "Segoe UI Emoji";
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo,
          Consolas, monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 200ms cubic-bezier(.4, 0, .2, 1);

  --accent: #7c6cff;
  --accent-2: #00d4ff;
  --accent-grad: linear-gradient(135deg, #7c6cff 0%, #00d4ff 100%);
}

/* ---------- Тёмная тема (по умолчанию) ---------- */
:root, [data-theme="dark"] {
  --bg: #0b0e14;
  --bg-elev: #12161f;
  --bg-panel: #161b26;
  --bg-hover: #1d2330;
  --bg-input: #141922;
  --border: #242b3a;
  --border-soft: #1c2230;
  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --text-faint: #6b7488;
  --shadow: 0 8px 32px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .3);
  --code-bg: #0d1117;
  --bubble-user: linear-gradient(135deg, #6d5df6, #4d5ef0);
  --scrollbar: #2a3245;
  --danger: #ff5c77;
  --login-bg: #070a10;
  color-scheme: dark;
}

/* ---------- Светлая тема ---------- */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --bg-panel: #ffffff;
  --bg-hover: #eef1f7;
  --bg-input: #f7f8fb;
  --border: #e3e8f0;
  --border-soft: #edf0f6;
  --text: #1a2130;
  --text-dim: #5b6478;
  --text-faint: #98a1b3;
  --shadow: 0 8px 32px rgba(30, 40, 70, .12);
  --shadow-sm: 0 2px 10px rgba(30, 40, 70, .07);
  --code-bg: #f2f4f9;
  --bubble-user: linear-gradient(135deg, #6d5df6, #4d5ef0);
  --scrollbar: #d3d9e4;
  --danger: #e03e5e;
  --login-bg: #eef1f8;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body { overflow: hidden; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ============ Логотип ============ */
.logo-mark {
  display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 15px;
  background: var(--accent-grad);
  color: #fff; font-weight: 800; font-size: 19px; letter-spacing: .5px;
  box-shadow: 0 6px 20px rgba(110, 90, 250, .35);
  user-select: none;
}
.logo-mark.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.logo-mark.lg { width: 68px; height: 68px; border-radius: 20px; font-size: 25px; margin-inline: auto; }

/* ============ Кнопки-иконки ============ */
.icon-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  color: var(--text-dim);
  transition: background var(--transition), color var(--transition), transform var(--transition);
  flex: none;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(.92); }

/* Переключатель темы */
.theme-toggle { position: relative; overflow: hidden; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: none; }

/* ============ ЭКРАН ВХОДА ============ */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--login-bg);
  overflow: hidden;
}

.bg-blobs { position: absolute; inset: 0; filter: blur(90px); opacity: .55; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; animation: float 14s ease-in-out infinite alternate; }
.blob-1 { width: 420px; height: 420px; background: #6d5df6; top: -120px; left: -80px; }
.blob-2 { width: 380px; height: 380px; background: #00d4ff; bottom: -140px; right: -60px; animation-delay: -4s; }
.blob-3 { width: 300px; height: 300px; background: #b96df6; top: 40%; left: 55%; opacity: .6; animation-delay: -8s; }

@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, -50px) scale(1.12); }
}

.login-card {
  position: relative;
  width: min(400px, calc(100vw - 40px));
  padding: 42px 36px 36px;
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  box-shadow: var(--shadow);
  text-align: center;
  animation: card-in .5s cubic-bezier(.2, .8, .3, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.login-logo { margin-bottom: 18px; }

.login-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 28px; }

#login-form { display: flex; flex-direction: column; gap: 16px; text-align: left; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-dim); }

.field input {
  width: 100%; padding: 13px 15px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 44px; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center; font-size: 15px; opacity: .7;
}
.eye:hover { opacity: 1; }

.login-error {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
  font-size: 13.5px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  text-align: center;
}

.btn-primary {
  margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13.5px;
  border-radius: var(--radius-sm);
  background: var(--accent-grad);
  color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(100, 90, 250, .35);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(100, 90, 250, .45); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { filter: saturate(.4) brightness(.8); cursor: default; }

.btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.theme-toggle-float { position: absolute; top: 18px; right: 18px; background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }

/* ============ РАСКЛАДКА ЧАТА ============ */
.app {
  display: flex; height: 100dvh;
}

.sidebar {
  width: 272px; flex: none;
  display: flex; flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border-soft);
  transition: margin-left .3s cubic-bezier(.4, 0, .2, 1);
}

.sidebar-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 15.5px; }

.new-chat-btn {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 12px 10px;
  padding: 11px 15px;
  border-radius: 12px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--text);
  font-size: 14px; font-weight: 600;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.new-chat-btn:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); border-style: solid; }
.new-chat-btn:active { transform: scale(.98); }
.new-chat-btn svg { color: var(--accent); }

.history-label {
  padding: 8px 20px 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--text-faint);
}

.history { flex: 1; overflow-y: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 2px; }

.history-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9.5px 12px;
  border-radius: 10px;
  font-size: 13.8px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.history-item:hover { background: var(--bg-hover); color: var(--text); }
.history-item.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.history-item .hi-title {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-item .hi-del {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 7px;
  color: var(--text-faint); opacity: 0;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
  flex: none;
}
.history-item:hover .hi-del { opacity: 1; }
.history-item .hi-del:hover { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.history-empty {
  padding: 14px 12px; font-size: 13px; color: var(--text-faint); text-align: center;
}

.sidebar-bottom { padding: 10px 12px 14px; border-top: 1px solid var(--border-soft); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
}
.avatar-user {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2bd58b, #0aa571);
  color: #fff; font-weight: 800; font-size: 15px;
}
.user-info { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name { font-size: 13.5px; font-weight: 700; }
.user-status { font-size: 11px; color: var(--text-faint); }

/* ---------- Основная колонка ---------- */
.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  position: relative;
}

.topbar {
  display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 14px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(12px);
  position: relative; z-index: 5;
}

.burger { display: none; }

.model-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  user-select: none;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2bd58b;
  box-shadow: 0 0 0 0 rgba(43, 213, 139, .5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(43, 213, 139, .5); }
  70% { box-shadow: 0 0 0 7px rgba(43, 213, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(43, 213, 139, 0); }
}

.topbar-spacer { flex: 1; }

/* ---------- Лента сообщений ---------- */
.chat-scroll { flex: 1; overflow-y: auto; scroll-behavior: smooth; }

.chat-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 20px;
  display: flex; flex-direction: column; gap: 26px;
}

.welcome {
  margin: auto 0; padding: 40px 0 30px;
  text-align: center;
  animation: card-in .5s cubic-bezier(.2, .8, .3, 1);
}
.welcome h2 { font-size: 27px; font-weight: 750; margin: 20px 0 8px; }
.welcome-sub { color: var(--text-dim); font-size: 15px; margin-bottom: 34px; }

.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px; margin: 0 auto;
}
.suggestion {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 13.8px;
  color: var(--text-dim);
  text-align: left;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition), color var(--transition);
  line-height: 1.45;
}
.suggestion:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* ---------- Сообщения ---------- */
.msg {
  display: flex; gap: 13px;
  animation: msg-in .35s cubic-bezier(.2, .8, .3, 1);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.msg .avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12.5px; color: #fff;
  margin-top: 2px;
  user-select: none;
}
.msg-ai .avatar { background: var(--accent-grad); }
.msg-user .avatar { background: linear-gradient(135deg, #2bd58b, #0aa571); }

.msg-body { flex: 1; min-width: 0; }

.msg-meta {
  display: flex; align-items: baseline; gap: 9px;
  margin-bottom: 6px;
}
.msg-author { font-size: 13.5px; font-weight: 700; }
.msg-time { font-size: 11.5px; color: var(--text-faint); }

.msg-content {
  font-size: 15px; line-height: 1.65;
  word-wrap: break-word; overflow-wrap: anywhere;
}

.msg-user .msg-content {
  display: inline-block;
  background: var(--bubble-user);
  color: #fff;
  padding: 11px 16px;
  border-radius: 16px 16px 16px 5px;
  white-space: pre-wrap;
  box-shadow: 0 3px 12px rgba(90, 90, 250, .25);
}

/* Markdown внутри ответов */
.msg-content p { margin: 0 0 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content ul, .msg-content ol { margin: 4px 0 12px; padding-left: 24px; }
.msg-content li { margin: 4px 0; }
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
  margin: 18px 0 8px; line-height: 1.35; font-weight: 700;
}
.msg-content h1 { font-size: 1.45em; } .msg-content h2 { font-size: 1.25em; } .msg-content h3 { font-size: 1.12em; }
.msg-content a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.msg-content a:hover { border-bottom-color: var(--accent); }
.msg-content blockquote {
  margin: 10px 0; padding: 8px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg-panel); border-radius: 0 10px 10px 0;
  color: var(--text-dim);
}
.msg-content code:not(pre code) {
  font-family: var(--mono); font-size: .88em;
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  padding: 2px 6px; border-radius: 6px;
  color: color-mix(in srgb, var(--accent) 75%, var(--text));
}
.msg-content hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.msg-content table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: .92em; }
.msg-content th, .msg-content td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; }
.msg-content th { background: var(--bg-panel); font-weight: 700; }

/* Блоки кода */
.codeblock {
  margin: 12px 0;
  border-radius: 13px;
  border: 1px solid var(--border-soft);
  background: var(--code-bg);
  overflow: hidden;
}
.codeblock-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px 7px 14px;
  background: color-mix(in srgb, var(--bg-panel) 60%, transparent);
  border-bottom: 1px solid var(--border-soft);
}
.codeblock-lang {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--text-faint); text-transform: uppercase; letter-spacing: .5px;
}
.codeblock-copy {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 7px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-dim);
  transition: background var(--transition), color var(--transition);
}
.codeblock-copy:hover { background: var(--bg-hover); color: var(--text); }
.codeblock pre {
  margin: 0; padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono); font-size: 13.2px; line-height: 1.6;
}

/* «Мысли» модели (reasoning) */
.thinking {
  margin: 2px 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-panel) 55%, transparent);
  overflow: hidden;
  font-size: 13.5px;
}
.thinking summary {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px;
  cursor: pointer; user-select: none;
  color: var(--text-faint); font-weight: 600; font-size: 12.5px;
  list-style: none;
}
.thinking summary::-webkit-details-marker { display: none; }
.thinking summary:hover { color: var(--text-dim); }
.thinking .chev { transition: transform .25s; display: grid; }
.thinking[open] summary .chev { transform: rotate(90deg); }
.thinking-body {
  padding: 4px 15px 12px;
  color: var(--text-faint);
  white-space: pre-wrap;
  line-height: 1.55;
  max-height: 300px; overflow-y: auto;
  border-top: 1px dashed var(--border-soft);
}

.thinking.live summary .think-label::after {
  content: '';
  display: inline-block;
  margin-left: 8px;
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .15; } }

.thinking-dots { display: inline-flex; gap: 4px; align-items: center; margin-left: 2px; }
.thinking-dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.2s infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Курсор печати */
.typing-cursor {
  display: inline-block;
  width: 7px; height: 16px;
  margin-left: 2px; vertical-align: -2px;
  background: var(--accent);
  border-radius: 2px;
  animation: blink .9s steps(1) infinite;
}

/* Действия под сообщением */
.msg-actions {
  display: flex; gap: 4px;
  margin-top: 7px;
  opacity: 0;
  transition: opacity var(--transition);
}
.msg:hover .msg-actions, .msg:last-child .msg-actions.streaming-done { opacity: 1; }
.action-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4.5px 9px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--text-faint);
  transition: background var(--transition), color var(--transition);
}
.action-btn:hover { background: var(--bg-hover); color: var(--text); }

.stream-error {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 13.5px;
}

/* ---------- Поле ввода ---------- */
.composer-zone {
  padding: 8px 20px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 65%, transparent);
}

.composer { max-width: 820px; margin: 0 auto; }

.composer-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 9px 9px 9px 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.composer-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow-sm);
}

#input {
  flex: 1;
  border: none; outline: none; background: none; resize: none;
  font-size: 15px; line-height: 1.55;
  max-height: 180px;
  padding: 7px 0;
  color: var(--text);
}
#input::placeholder { color: var(--text-faint); }

.send-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(100, 90, 250, .35);
  transition: transform var(--transition), filter var(--transition), background var(--transition);
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:active { transform: scale(.9); }
.send-btn:disabled { background: var(--bg-hover); color: var(--text-faint); box-shadow: none; cursor: default; }
.send-btn.stop-mode { background: var(--danger); box-shadow: 0 4px 14px rgba(255, 92, 119, .35); }

.composer-hint {
  margin-top: 9px;
  text-align: center;
  font-size: 11.5px; color: var(--text-faint);
  user-select: none;
}
.composer-hint kbd {
  font-family: var(--font); font-size: 10.5px;
  padding: 1.5px 5px; border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13.5px; font-weight: 600;
  z-index: 200;
  animation: toast-in .3s cubic-bezier(.2, .8, .3, 1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Мобильная адаптация ---------- */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    margin-left: -272px;
    box-shadow: none;
  }
  .app.sidebar-open .sidebar { margin-left: 0; box-shadow: var(--shadow); }
  .app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .burger { display: grid; }
  .sidebar-close { display: grid; }
  .suggestions { grid-template-columns: 1fr; }
  .chat-inner { padding: 20px 14px 14px; }
  .composer-zone { padding-inline: 12px; }
  .msg .avatar { display: none; }
}

/* Первое сообщение-приветствие на очень узких экранах */
@media (max-width: 480px) {
  .welcome h2 { font-size: 22px; }
  .model-badge { display: none; }
}

/* Плавная смена темы */
body, .sidebar, .topbar, .composer-box, .login-card, .login-screen,
.history-item, .user-chip, .suggestion, .icon-btn, .model-badge {
  transition-property: background-color, border-color, color;
  transition-duration: .25s;
  transition-timing-function: ease;
}
