/* Мини-апп клиента. Тёмная тема «ночной синий» — фирменный стиль сервиса. */
:root {
  --bg: #0a1024;
  --bg-2: #0e1631;
  --surface: #131c3b;
  --surface-2: #19244a;
  --surface-3: #202d5a;
  --line: rgba(120, 150, 220, .14);
  --line-2: rgba(120, 150, 220, .24);
  --text: #f4f7ff;
  --text-2: rgba(226, 232, 248, .68);
  --text-3: rgba(226, 232, 248, .46);
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --accent-soft: rgba(59, 130, 246, .16);
  --gold: #e0b45e;
  --violet: #8b6cff;
  --teal: #2dd4bf;
  --green: #34c759;
  --red: #ff5a52;
  --radius: 20px;
  --radius-sm: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; overflow-x: hidden; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(120% 60% at 50% -10%, #1b2852 0%, var(--bg) 55%, #070c1d 100%) fixed; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ── Иконки-плитки ───────────────────────────────────────────────── */
.tile-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.tile-icon.small { width: 38px; height: 38px; border-radius: 12px; }
.tile-icon.big { width: 64px; height: 64px; border-radius: 20px; }
.tile-icon.violet { background: linear-gradient(140deg, #9b7dff, #6a4cf0); box-shadow: 0 8px 22px -8px rgba(139, 108, 255, .7); }
.tile-icon.blue { background: linear-gradient(140deg, #4f8ff8, #2257d6); box-shadow: 0 8px 22px -8px rgba(59, 130, 246, .7); }
.tile-icon.gold { background: linear-gradient(140deg, #f0c878, #c48b2c); box-shadow: 0 8px 22px -8px rgba(224, 180, 94, .6); color: #1d1405; }
.tile-icon.slate { background: var(--surface-3); color: var(--text-2); }
.tile-icon.teal { background: linear-gradient(140deg, #3fe0c6, #0f9e8a); color: #032621; }
.tile-icon.red { background: rgba(255, 90, 82, .14); color: var(--red); }
.brand-mark { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; color: #1d1405;
  background: linear-gradient(140deg, #f3d08a, #c48b2c); box-shadow: 0 8px 22px -10px rgba(224, 180, 94, .8); }
.brand-mark.big { width: 72px; height: 72px; border-radius: 22px; }

/* ── Кнопки, поля ───────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; font-weight: 600; font-size: 15.5px; transition: transform .1s, opacity .15s, background .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 10px 26px -12px rgba(37, 99, 235, .9); }
.btn.ghost { background: var(--surface-2); color: var(--text); }
.btn.danger { background: rgba(255, 90, 82, .14); color: var(--red); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.wide { width: 100%; }
.field { width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--text); font: 15px/1.4 var(--font); outline: none; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); flex-shrink: 0; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.round { border-radius: 50%; background: var(--surface-2); color: var(--text-2); width: 42px; height: 42px; }
.unread { position: absolute; top: 12px; right: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 3px var(--bg); }
.list-row .unread, .row-card .unread { position: static; box-shadow: none; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .14); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); display: inline-block; margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 199, 89, .18); }

/* ── Главная ────────────────────────────────────────────────────── */
.app { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(96px + var(--safe-b)); }
.tab { display: none; animation: fade .25s var(--ease); }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.brand-sub { font-size: 12.5px; color: var(--text-3); }
.avatar-btn { border-radius: 50%; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, #4f8ff8, #2257d6); }
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; margin: 0 auto; box-shadow: 0 14px 36px -14px rgba(59, 130, 246, .8); }
.hello h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.6px; font-weight: 750; }
.hello p { color: var(--text-2); margin-top: 6px; font-size: 15px; }
.hello { margin-bottom: 18px; }

.hero-card { position: relative; display: block; padding: 18px; border-radius: 24px; overflow: hidden; margin-bottom: 12px;
  background: radial-gradient(120% 120% at 100% 0%, rgba(139, 108, 255, .45) 0%, rgba(139, 108, 255, 0) 55%),
              linear-gradient(150deg, #23306a 0%, #172152 60%, #121a40 100%);
  border: 1px solid rgba(139, 108, 255, .28); box-shadow: 0 18px 40px -22px rgba(76, 56, 200, .8); transition: transform .12s; }
.hero-card:active, .tile:active, .row-card:active, .list-row:active { transform: scale(.985); }
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hero-title { font-size: 21px; font-weight: 750; letter-spacing: -.4px; }
.hero-text { color: var(--text-2); margin-top: 4px; font-size: 14.5px; max-width: 34ch; }
.hero-cta { display: inline-flex; align-items: center; gap: 4px; margin-top: 14px; height: 38px; padding: 0 14px; border-radius: 12px;
  background: rgba(255, 255, 255, .12); font-weight: 600; font-size: 14px; }
.hero-card .unread { top: 18px; right: 18px; }
.card-last { margin-top: 8px; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-last:empty { display: none; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius); min-height: 156px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); transition: transform .12s; }
.tile .tile-icon { margin-bottom: 6px; }
.tile-title { font-weight: 700; font-size: 16px; letter-spacing: -.2px; }
.tile-text { color: var(--text-2); font-size: 13px; line-height: 1.4; }

.section { margin-top: 22px; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .7px; margin: 0 4px 8px; }
.list { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.list-row { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; transition: background .15s; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row:not(.static):hover { background: var(--surface-2); }
.row-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--radius); margin-top: 12px;
  background: var(--surface); border: 1px solid var(--line); transition: transform .12s; }
.row-card.cta { margin-top: 18px; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; }
.row-text { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chevron { color: var(--text-3); display: grid; }
.disclaimer { color: var(--text-3); font-size: 12px; text-align: center; margin: 22px 12px 0; line-height: 1.5; }

/* ── Частые вопросы ─────────────────────────────────────────────── */
.page-head { margin: 6px 4px 6px; }
.page-head h2 { font-size: 26px; letter-spacing: -.6px; font-weight: 750; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.faq-item + .faq-item { border-top: 1px solid var(--line); }
.faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 14px; text-align: left; font-weight: 600; font-size: 15px; }
.faq-arrow { color: var(--text-3); display: grid; transition: transform .25s var(--ease); flex-shrink: 0; }
.faq-item.open .faq-arrow { transform: rotate(180deg); color: var(--accent); }
.faq-answer { display: none; padding: 0 14px 16px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; user-select: text; }
.faq-item.open .faq-answer { display: block; animation: fade .2s var(--ease); }

/* ── Профиль ────────────────────────────────────────────────────── */
.profile-head { text-align: center; padding: 14px 0 4px; }
.profile-name { font-size: 22px; font-weight: 750; margin-top: 12px; letter-spacing: -.4px; }
.profile-username { color: var(--text-3); margin-top: 2px; }

/* ── Нижнее меню ────────────────────────────────────────────────── */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + var(--safe-b)); background: rgba(10, 16, 36, .88);
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); border-top: 1px solid var(--line); }
.tabbar-btn { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 12px;
  color: var(--text-3); font-size: 11.5px; font-weight: 600; transition: color .15s, background .15s; }
.tabbar-btn.active { color: var(--accent); background: var(--accent-soft); }
.tabbar-btn [data-icon] { display: grid; }

/* ── Загрузка, вне Telegram ─────────────────────────────────────── */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.outside { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 32px; text-align: center; }
.outside h1 { font-size: 26px; letter-spacing: -.5px; }
.outside p { color: var(--text-2); max-width: 32ch; }

/* ── Тост, шторка, лайтбокс, меню ───────────────────────────────── */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); z-index: 300; width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 14px; background: rgba(25, 36, 74, .97); border: 1px solid var(--line-2); color: var(--text);
  font-size: 14px; line-height: 1.4; text-align: center; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .8);
  opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 90, 82, .45); }
.chat-body .toast { bottom: calc(110px + var(--safe-b)); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 6, 18, .55); opacity: 0; transition: opacity .2s; }
.sheet-backdrop.show { opacity: 1; }
.sheet { width: 100%; max-width: 560px; max-height: 86dvh; overflow: auto; padding: 8px 16px calc(18px + var(--safe-b));
  background: var(--bg-2); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 24px 24px 0 0;
  transform: translateY(24px); transition: transform .25s var(--ease); }
.sheet-backdrop.show .sheet { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--surface-3); margin: 0 auto 12px; }
.sheet-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; text-align: center; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-text { color: var(--text-2); font-size: 15px; line-height: 1.5; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; }
.lightbox { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; background: rgba(0, 0, 0, .92); opacity: 0; transition: opacity .2s; }
.lightbox.show { opacity: 1; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff; }
.ctx-backdrop { position: fixed; inset: 0; z-index: 210; background: rgba(3, 6, 18, .35); }
.ctx { position: fixed; min-width: 210px; padding: 6px; border-radius: 16px; background: rgba(25, 36, 74, .98); border: 1px solid var(--line-2);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .9); animation: pop .16s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.ctx-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: 15px; text-align: left; color: var(--text); }
.ctx-item:hover, .ctx-item:active { background: var(--surface-3); }
.ctx-item.danger { color: var(--red); }

/* ── Чат ────────────────────────────────────────────────────────── */
.chat-body { overflow: hidden; }
.chat { height: var(--app-height, 100dvh); display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; position: relative; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 6px; background: rgba(10, 16, 36, .92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); flex-shrink: 0; }
.in-telegram .chat-head .back { display: none; }
.in-telegram .chat-head { padding-left: 14px; }
.chat-meta { flex: 1; min-width: 0; }
.chat-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub.online { color: var(--green); }
.chat-sub.typing { color: var(--accent); }
.pinned { display: flex; align-items: center; gap: 10px; padding: 8px 14px; text-align: left; background: rgba(14, 22, 49, .95); border-bottom: 1px solid var(--line); flex-shrink: 0; width: 100%; }
.pinned-icon { color: var(--accent); display: grid; }
.pinned-body { display: flex; flex-direction: column; min-width: 0; }
.pinned-label { font-size: 12px; font-weight: 700; color: var(--accent); }
.pinned-text { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed { flex: 1; overflow-y: auto; padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.jump { position: absolute; right: 14px; bottom: calc(86px + var(--safe-b)); z-index: 10; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); box-shadow: 0 10px 26px -10px rgba(0, 0, 0, .8); }
.jump-count { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.day { align-self: center; margin: 12px 0 8px; }
.day span { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-2); background: rgba(19, 28, 59, .75); }
.sys { align-self: center; max-width: 90%; margin: 6px 0; text-align: center; }
.sys span { display: inline-block; padding: 7px 12px; border-radius: 14px; font-size: 13px; line-height: 1.4; color: #9cc2ff; background: rgba(59, 130, 246, .1); border: 1px solid rgba(59, 130, 246, .18); }

.msg { display: flex; max-width: 86%; position: relative; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; }
.msg.pop { animation: pop .22s var(--ease); }
.msg.flash .bubble { box-shadow: 0 0 0 2px var(--accent); }
.msg.selected .bubble { filter: brightness(1.15); }
.bubble { padding: 9px 12px 7px; border-radius: 18px; font-size: 15px; line-height: 1.45; word-break: break-word; min-width: 72px;
  user-select: text; -webkit-user-select: text; }
.msg.in .bubble { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.out .bubble { background: linear-gradient(140deg, #3b82f6, #2257d6); color: #fff; border-bottom-right-radius: 6px; }
.msg.ai .bubble { background: linear-gradient(160deg, rgba(139, 108, 255, .16), rgba(139, 108, 255, .05)), var(--surface); border: 1px solid rgba(139, 108, 255, .28); }
.msg.media-only .bubble { padding: 4px; }
.msg.media-only .meta { position: absolute; right: 12px; bottom: 10px; padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; opacity: 1; }
.who { font-size: 12.5px; font-weight: 700; color: #9db8ff; margin-bottom: 3px; }
.msg.ai .who { color: #b9a6ff; }
.fwd { font-size: 12px; font-style: italic; opacity: .75; margin-bottom: 4px; }
.text { white-space: pre-wrap; }
.text a, .md a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.caption { margin-top: 6px; }
.meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 3px; font-size: 11px; opacity: .62; font-variant-numeric: tabular-nums; }
.meta-pin { display: grid; }
.quote { display: flex; flex-direction: column; gap: 1px; width: 100%; margin-bottom: 6px; padding: 5px 10px; text-align: left; border-radius: 8px;
  border-left: 3px solid rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .12); }
.msg.in .quote { border-left-color: var(--accent); background: rgba(59, 130, 246, .12); }
.quote-who { font-size: 12.5px; font-weight: 700; }
.quote-text { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

/* Ответ ИИ (Markdown) */
.md p + p, .md p + ul, .md p + ol, .md ul + p, .md ol + p, .md h4 + p { margin-top: 8px; }
.md h4 { font-size: 15px; font-weight: 700; margin: 10px 0 4px; }
.md h4:first-child { margin-top: 0; }
.md ul, .md ol { padding-left: 20px; margin: 6px 0; }
.md li + li { margin-top: 4px; }
.md strong { font-weight: 700; color: #fff; }
.md code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.md blockquote { margin: 8px 0; padding: 4px 10px; border-left: 3px solid var(--violet); color: var(--text-2); }
.dots { display: flex; gap: 5px; padding: 6px 2px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: #b9a6ff; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.caret { display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: #b9a6ff; animation: caret 1s steps(2) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* Вложения */
.m-img { display: block; border-radius: 14px; overflow: hidden; }
.m-img img { display: block; max-width: min(280px, 72vw); max-height: 340px; min-width: 120px; min-height: 90px; object-fit: cover; background: var(--surface-3); }
.m-video { display: block; max-width: min(300px, 74vw); max-height: 340px; border-radius: 14px; background: #000; }
.vp { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.vp-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, .92); color: #2257d6; }
.msg.in .vp-btn { background: var(--accent); color: #fff; }
.vp-track { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .3); position: relative; overflow: hidden; cursor: pointer; }
.msg.in .vp-track { background: var(--surface-3); }
.vp-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: currentColor; border-radius: 4px; }
.msg.in .vp-fill { background: var(--accent); }
.vp-time { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; min-width: 34px; }
.m-file { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 4px 2px; }
.m-file-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: rgba(255, 255, 255, .16); }
.msg.in .m-file-icon { background: var(--accent-soft); color: var(--accent); }
.m-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.m-file-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.m-file-size { font-size: 12px; opacity: .7; }
.m-file-dl { opacity: .8; display: grid; }
.pending .bubble { min-width: 200px; }
.up-name { font-size: 13.5px; font-weight: 600; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.up-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.up-fill { height: 100%; width: 0; background: #fff; transition: width .2s; }
.pv-img { width: 100%; max-height: 46dvh; object-fit: contain; border-radius: 14px; background: var(--surface); }
.pv-file { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface); }

/* Пустой чат */
.empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 24px 12px; max-width: 360px; }
.empty-title { font-size: 19px; font-weight: 750; margin-top: 6px; }
.empty-text { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.chips-q { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 10px; }
.chip-q { padding: 11px 14px; border-radius: 14px; text-align: left; font-size: 14px; background: var(--surface); border: 1px solid var(--line-2); color: var(--text); }
.chip-q:active { background: var(--surface-2); }

/* Поле ввода */
.composer { flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px 10px calc(8px + var(--safe-b));
  background: rgba(10, 16, 36, .94); border-top: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.row { display: flex; align-items: flex-end; gap: 8px; }
.input { flex: 1; min-height: 42px; max-height: 140px; padding: 10px 14px; border-radius: 21px; resize: none; outline: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 15.5px/1.4 var(--font); }
.input:focus { border-color: rgba(59, 130, 246, .6); }
.input::placeholder { color: var(--text-3); }
.send-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff;
  background: linear-gradient(140deg, #3b82f6, #2257d6); box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .9); transition: transform .1s, opacity .15s; }
.send-btn:disabled { opacity: .4; box-shadow: none; }
.send-btn:active { transform: scale(.92); }
.bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-radius: 12px; background: var(--surface); border-left: 3px solid var(--accent); }
.bar-icon { color: var(--accent); display: grid; }
.bar-body { flex: 1; min-width: 0; }
.bar-title { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.bar-text { font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; }
.rec-time { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 40px; }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 24px; overflow: hidden; }
.rec-wave i { width: 3px; height: 6px; border-radius: 3px; background: var(--accent); transition: height .15s; }
.composer-hint { font-size: 11.5px; color: var(--text-3); text-align: center; padding: 0 8px; }
body.offline .chat-head::after { content: 'нет связи…'; margin-left: auto; font-size: 11.5px; color: #ffb340; padding-right: 8px; }

@media (min-width: 700px) {
  .msg { max-width: 72%; }
  .app { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Демо из портфолио ── */
.demo-card { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; margin: 0 0 12px; padding: 13px 14px;
  border-radius: var(--radius); text-align: left; color: var(--text); cursor: pointer;
  background: linear-gradient(135deg, rgba(245, 158, 11, .16), rgba(251, 146, 60, .08)); border: 1px solid rgba(245, 158, 11, .38); transition: transform .15s; }
.demo-card:active { transform: scale(.985); }
.demo-tag { flex-shrink: 0; align-self: flex-start; padding: 3px 7px; border-radius: 6px; background: linear-gradient(90deg, #f59e0b, #fb923c);
  color: #1f1300; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; }
.demo-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.demo-card-title { font-weight: 700; font-size: 15px; }
.demo-card-text { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.demo-card .row-chevron { color: var(--text-3); }
.demo-note { margin: 10px 4px 0; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.sys.demo span { color: #fcd34d; background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .3); }
