/* VOCA — две темы: тёмная «Эфир» и светлая «Светлый». По умолчанию — как в системе. */
:root {
  --bg: #0C1712; --sheet: #0F1E17; --card: #13241C; --card-2: #1A3126; --hover: #183024;
  --line: #20382C; --line-2: #2B4A3B; --field: #13241C;
  --text: #E8F2EC; --muted: #A9C4B6; --faint: #8FAE9E;
  --accent: #3EE0A0; --accent-ink: #06251A;
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-text: var(--accent);
  --bubble-in: #13241C; --bubble-in-text: var(--text);
  --bubble-out: color-mix(in srgb, var(--accent) 30%, #0C1712); --bubble-out-text: #EEF7F2; --bubble-out-meta: #B5D9C8;
  --danger: #C8324F; --danger-text: #FF8197; --on: #3EE0A0; --gold: #F2C14E;
  --chip-on-bg: var(--accent); --chip-on-text: var(--accent-ink);
  --shadow: 0 12px 36px rgba(0,0,0,.5); --scrim: rgba(3,8,6,.66);
  --n0: #8CD867; --n1: #5BC8E8; --n2: #F2B544; --n3: #C9A2F5; --n4: #F58FA8; --n5: #5FE0D0; --n6: #B8E655; --n7: #FF9F6B;
  --font: "Onest", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F2F5F3; --sheet: #FFFFFF; --card: #FFFFFF; --card-2: #E2F3EA; --hover: #EAF0EC;
  --line: #E3E9E5; --line-2: #C7D3CC; --field: #E3E9E5;
  --text: #0F1A15; --muted: #56665E; --faint: #5F6F67;
  --accent: #087A4D; --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #FFFFFF);
  --accent-text: var(--accent);
  --bubble-in: #FFFFFF; --bubble-in-text: var(--text);
  --bubble-out: var(--accent); --bubble-out-text: #FFFFFF; --bubble-out-meta: rgba(255,255,255,.82);
  --danger: #C42B47; --danger-text: #B4233F; --on: #1FA463; --gold: #8A5A00;
  --chip-on-bg: #0F1A15; --chip-on-text: #FFFFFF;
  --shadow: 0 12px 36px rgba(15,26,21,.14); --scrim: rgba(15,26,21,.42);
  --n0: #2E7D32; --n1: #1F6A9C; --n2: #8A5A0C; --n3: #6A3FB5; --n4: #A8324F; --n5: #0F766E; --n6: #4D7C0F; --n7: #B4461A;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F2F5F3; --sheet: #FFFFFF; --card: #FFFFFF; --card-2: #E2F3EA; --hover: #EAF0EC;
    --line: #E3E9E5; --line-2: #C7D3CC; --field: #E3E9E5;
    --text: #0F1A15; --muted: #56665E; --faint: #5F6F67;
    --accent: #087A4D; --accent-ink: #FFFFFF;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, #FFFFFF);
    --accent-text: var(--accent);
    --bubble-in: #FFFFFF; --bubble-in-text: var(--text);
    --bubble-out: var(--accent); --bubble-out-text: #FFFFFF; --bubble-out-meta: rgba(255,255,255,.82);
    --danger: #C42B47; --danger-text: #B4233F; --on: #1FA463; --gold: #8A5A00;
    --chip-on-bg: #0F1A15; --chip-on-text: #FFFFFF;
    --shadow: 0 12px 36px rgba(15,26,21,.14); --scrim: rgba(15,26,21,.42);
    --n0: #2E7D32; --n1: #1F6A9C; --n2: #8A5A0C; --n3: #6A3FB5; --n4: #A8324F; --n5: #0F766E; --n6: #4D7C0F; --n7: #B4461A;
    color-scheme: light;
  }
}

/* Premium: цвет акцента (свой оттенок для тёмной и светлой темы) */
:root[data-accent="lime"]   { --accent: #B8E655; --accent-ink: #172400; }
:root[data-accent="sky"]    { --accent: #5BC8E8; --accent-ink: #032536; }
:root[data-accent="violet"] { --accent: #B9A2FF; --accent-ink: #1B0B3A; }
:root[data-accent="amber"]  { --accent: #F7B955; --accent-ink: #2A1A00; }
:root[data-theme="light"][data-accent="lime"]   { --accent: #4D7C0F; --accent-ink: #FFFFFF; }
:root[data-theme="light"][data-accent="sky"]    { --accent: #0B6E99; --accent-ink: #FFFFFF; }
:root[data-theme="light"][data-accent="violet"] { --accent: #6D4BD8; --accent-ink: #FFFFFF; }
:root[data-theme="light"][data-accent="amber"]  { --accent: #A15C07; --accent-ink: #FFFFFF; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"])[data-accent="lime"]   { --accent: #4D7C0F; --accent-ink: #FFFFFF; }
  :root:not([data-theme="dark"])[data-accent="sky"]    { --accent: #0B6E99; --accent-ink: #FFFFFF; }
  :root:not([data-theme="dark"])[data-accent="violet"] { --accent: #6D4BD8; --accent-ink: #FFFFFF; }
  :root:not([data-theme="dark"])[data-accent="amber"]  { --accent: #A15C07; --accent-ink: #FFFFFF; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased;
  font-size: 15px; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; background: none; border: 0; outline: none; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.ico { display: inline-flex; flex-shrink: 0; }
.ico svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.logo { font-weight: 900; font-size: 26px; letter-spacing: .05em; color: var(--accent-text); line-height: 1; }
.logo.big { font-size: 40px; text-align: center; }
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; }
.boot-text { color: var(--muted); font-size: 14px; text-align: center; max-width: 320px; line-height: 1.5; }

/* ---------- кнопки и поля ---------- */
.btn-primary { width: 100%; min-height: 48px; background: var(--accent); color: var(--accent-ink); font-weight: 800; padding: 12px 16px; border-radius: 24px; font-size: 15px; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-primary.alt { background: var(--card-2); color: var(--text); }
.btn-ghost { min-height: 44px; padding: 10px 14px; border-radius: 22px; color: var(--muted); font-size: 14px; font-weight: 700; }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-small { background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13.5px; min-height: 36px; padding: 0 14px; border-radius: 18px; white-space: nowrap; flex-shrink: 0; }
.danger-text { color: var(--danger-text) !important; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; color: var(--text); background: var(--card); display: grid; place-items: center; flex-shrink: 0; position: relative; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); }
.icon-btn.plain { background: transparent; color: var(--muted); }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); }
.lock-dot { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; border-radius: 8px; background: #F2C14E; color: #2A1A00; display: grid; place-items: center; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input { width: 100%; background: var(--field); border: 1.5px solid transparent; border-radius: 14px; padding: 12px 14px; font-size: 16px; }
.field input:focus { border-color: var(--accent); }
.field-hint { display: block; color: var(--faint); font-size: 12px; margin-top: 5px; }

.seg { display: flex; gap: 4px; background: var(--field); border-radius: 22px; padding: 4px; }
.seg-btn { flex: 1; min-height: 38px; padding: 0 12px; border-radius: 18px; font-weight: 700; font-size: 14px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg-btn.active { background: var(--chip-on-bg); color: var(--chip-on-text); }

/* ---------- вход ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px); overflow-y: auto;
  background: radial-gradient(800px 460px at 50% -10%, var(--accent-soft), transparent 65%), var(--bg); }
.gate-card { width: 100%; max-width: 400px; background: var(--sheet); border: 1px solid var(--line); border-radius: 28px; padding: 30px 24px 24px; box-shadow: var(--shadow); }
.gate-tag { text-align: center; color: var(--faint); font-size: 12px; letter-spacing: .06em; margin: 8px 0 22px; }
.auth-tabs { margin-bottom: 18px; }
.auth-hint { font-size: 13px; color: var(--gold); line-height: 1.5; margin: 2px 0 10px; }
.auth-err { color: var(--danger-text); font-size: 13.5px; min-height: 18px; margin-bottom: 8px; line-height: 1.4; }
.invite-note { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; margin-bottom: 14px; }

/* ---------- раскладка ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.pane { min-width: 0; min-height: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.app.in-chat .pane-list { display: none; }
.app:not(.in-chat) .pane-chat { display: none; }
.app.in-chat .pane-chat { animation: slideIn .2s ease-out; }
@keyframes slideIn { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- список (левая панель) ---------- */
.list-head { padding: calc(var(--safe-top) + 16px) 20px 6px; flex-shrink: 0; }
.lh-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.lh-title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.lh-actions { display: flex; gap: 8px; }
.search { margin-top: 12px; height: 44px; background: var(--field); border-radius: 22px; display: flex; align-items: center; gap: 8px; padding: 0 16px; color: var(--muted); }
.search input { flex: 1; min-width: 0; font-size: 16px; color: var(--text); }
.list-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.list-body > * { flex-shrink: 0; }
.section-label { font-size: 13px; color: var(--faint); padding: 14px 20px 8px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--on); flex-shrink: 0; }
.live-row { display: flex; gap: 10px; padding: 2px 20px 12px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.live-row::-webkit-scrollbar { display: none; }
.live-card { flex: 0 0 auto; width: 210px; border: 1px solid var(--line-2); background: var(--card); border-radius: 20px; padding: 14px; text-align: left; }
.live-card:hover { background: var(--hover); }
.live-card .lc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.live-card .lc-name { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card .lc-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-card .lc-avs { display: flex; margin-top: 12px; }
.live-card .lc-avs .avatar { box-shadow: 0 0 0 2px var(--card); }
.live-card .lc-avs .avatar + .avatar { margin-left: -8px; }
.bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; flex-shrink: 0; }
.bars i { width: 3px; border-radius: 2px; background: var(--on); height: 40%; }
.bars i:nth-child(2) { height: 90%; } .bars i:nth-child(3) { height: 60%; } .bars i:nth-child(4) { height: 100%; }
.bars.anim i { animation: bar 1s ease-in-out infinite; }
.bars.anim i:nth-child(2) { animation-delay: -.3s; } .bars.anim i:nth-child(3) { animation-delay: -.6s; } .bars.anim i:nth-child(4) { animation-delay: -.15s; }
@keyframes bar { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1); } }
.bars i { transform-origin: bottom; }

.sheet { flex: 1 0 auto; background: var(--sheet); border-radius: 26px 26px 0 0; padding: 12px 8px 16px; margin-top: 6px; }
.sheet .seg { margin: 0 12px 8px; }
.chat-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; text-align: left; color: var(--text); }
.chat-row:hover { background: var(--hover); }
.chat-row.active { background: var(--card-2); }
.cr-main { flex: 1; min-width: 0; display: block; }
.cr-top, .cr-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cr-bottom { margin-top: 3px; }
.cr-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.cr-time { font-size: 12px; color: var(--faint); flex-shrink: 0; }
.cr-time.hot { color: var(--accent-text); font-weight: 700; }
.cr-preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; min-width: 0; }
.cr-preview .pv-text { overflow: hidden; text-overflow: ellipsis; }
.cr-live { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 12.5px; font-weight: 700; color: var(--accent-text); }
.badge { background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px; display: grid; place-items: center; flex-shrink: 0; }
.req-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.req-actions { display: flex; gap: 8px; flex-shrink: 0; }
.round-btn { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; flex-shrink: 0; background: var(--card-2); color: var(--text); }
.round-btn.ok { background: var(--accent); color: var(--accent-ink); }
.round-btn.no:hover { background: var(--danger); color: #fff; }
.empty-block { text-align: center; padding: 28px 20px; color: var(--muted); line-height: 1.55; font-size: 14.5px; }
.empty-block .eb-ico { width: 64px; height: 64px; border-radius: 22px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-block b { color: var(--accent-text); }
.empty-block .btn-primary { max-width: 280px; margin: 16px auto 0; display: block; }
.empty-block .btn-ghost { margin-top: 6px; }
.hint-card { margin: 4px 20px 10px; background: var(--card); border: 1px solid var(--line-2); border-radius: 20px; padding: 14px; display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.hint-card .hc-ico { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex-shrink: 0; }
.hint-card .hc-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.hint-card .hc-text b { color: var(--text); display: block; font-size: 14.5px; }
.hint-card { padding: 10px 8px 10px 12px; }
.hint-card .hc-ico { width: 38px; height: 38px; border-radius: 12px; }

/* серверы */
.server-list { padding: 4px 12px; display: flex; flex-direction: column; gap: 8px; }
.server-card { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 20px; background: var(--card); border: 1px solid var(--line); text-align: left; }
.server-card:hover { background: var(--hover); }
.server-card.active { border-color: var(--accent); }
.list-actions { padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 8px; }

/* профиль */
.profile-card { margin: 8px 20px 4px; background: var(--card); border-radius: 26px; padding: 22px 18px 18px; text-align: center; border: 1px solid var(--line); }
.profile-card .avatar { margin: 0 auto 12px; }
.pc-name { font-size: 21px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pc-handle { color: var(--accent-text); font-weight: 700; margin-top: 3px; }
.pc-status { color: var(--muted); font-size: 14px; margin-top: 6px; }
.pc-email { color: var(--faint); font-size: 12.5px; margin-top: 6px; }
.profile-card .btn-small { margin-top: 14px; }
.set-group { margin: 6px 20px 10px; background: var(--card); border-radius: 22px; border: 1px solid var(--line); overflow: hidden; }
.set-title { font-size: 13px; color: var(--faint); font-weight: 700; padding: 14px 24px 6px; }
.set-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-align: left; min-height: 56px; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row:hover { background: var(--hover); }
.set-row .sr-ico { width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex-shrink: 0; }
.set-row .sr-main { flex: 1; min-width: 0; }
.set-row .sr-label { font-weight: 700; font-size: 15px; }
.set-row .sr-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.set-row .sr-chev { color: var(--faint); }
.set-seg { padding: 12px; }
.app-foot { text-align: center; color: var(--faint); font-size: 12px; padding: 10px 20px 24px; }

/* нижние вкладки */
.tabs { flex-shrink: 0; display: flex; justify-content: space-around; padding: 6px 10px calc(var(--safe-bottom) + 8px); background: var(--sheet); border-top: 1px solid var(--line); }
.tab { flex: 1; max-width: 120px; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.tab-ico { position: relative; width: 60px; height: 32px; border-radius: 16px; display: grid; place-items: center; transition: background .15s; }
.tab.active { color: var(--text); }
.tab.active .tab-ico { background: var(--accent); color: var(--accent-ink); }
.tab-badge { position: absolute; top: -4px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--sheet); }

/* аватары */
.avatar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #FFFFFF; flex-shrink: 0; position: relative; }
.avatar.sq { border-radius: 16px; font-size: 16px; }
.avatar.xs { width: 26px; height: 26px; font-size: 11px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar.md { width: 40px; height: 40px; font-size: 15px; }
.avatar.md.sq { border-radius: 13px; font-size: 13px; }
.avatar.xl { width: 84px; height: 84px; font-size: 30px; }
.avatar .st { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--sheet); background: var(--line-2); }
.avatar.md .st { width: 12px; height: 12px; border-width: 2.5px; }
.avatar .st.on { background: var(--on); }
.crown { color: var(--gold); display: inline-flex; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar .st { z-index: 1; }
.avatar-edit { position: relative; display: block; margin: 0 auto 12px; border-radius: 50%; }
.avatar-edit .avatar { margin: 0; }
.ae-badge { position: absolute; right: 0; bottom: 0; width: 30px; height: 30px; border-radius: 15px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; border: 3px solid var(--card); }

/* ---------- чат (правая панель) ---------- */
.chat-header { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 10px) 14px 10px; min-height: 64px; border-bottom: 1px solid var(--line); background: var(--sheet); }
.ch-meta { flex: 1; min-width: 0; text-align: left; border-radius: 12px; }
.ch-title { font-weight: 800; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.ch-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ch-sub.on { color: var(--accent-text); }
.ch-actions { display: flex; gap: 6px; flex-shrink: 0; }
.back-btn { background: transparent; color: var(--accent-text); }
.ch-actions .icon-btn { background: var(--accent-soft); color: var(--accent-text); }
.ch-actions .icon-btn.on { background: var(--accent); color: var(--accent-ink); }

.chan-bar { flex-shrink: 0; background: var(--sheet); border-bottom: 1px solid var(--line); padding: 8px 0 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--card); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.chip.active { background: var(--chip-on-bg); color: var(--chip-on-text); border-color: transparent; }
.chip.live { border-color: var(--accent); color: var(--accent-text); }
.chip .badge { min-width: 20px; height: 20px; font-size: 11px; }
.chip.add { padding: 0 10px; color: var(--muted); }
.voice-card { margin: 10px 14px 0; background: var(--card); border: 1px solid var(--line-2); border-radius: 20px; padding: 10px 10px 10px 12px; display: flex; align-items: center; gap: 12px; }
.voice-card .vc-avs { display: flex; }
.voice-card .vc-avs .avatar { box-shadow: 0 0 0 2px var(--card); }
.voice-card .vc-avs .avatar + .avatar { margin-left: -8px; }
.voice-card .vc-main { flex: 1; min-width: 0; }
.voice-card .vc-title { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-card .vc-sub { font-size: 12.5px; color: var(--accent-text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* полоска звонка */
.call-zone:empty, .mini-call:empty { display: none; }
.call-zone { padding: 10px 14px 0; flex-shrink: 0; }
.mini-call { padding: 0 20px 8px; flex-shrink: 0; }
.callstrip { background: var(--accent); color: var(--accent-ink); border-radius: 22px; padding: 8px 8px 8px 6px; display: flex; align-items: center; gap: 8px; }
.cs-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 16px; text-align: left; color: inherit; }
.cs-main .bars i { background: currentColor; }
.cs-text { min-width: 0; display: block; }
.cs-title { display: block; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-sub { display: block; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.cs-avs { display: flex; flex-shrink: 0; }
.cs-av { position: relative; border-radius: 50%; box-shadow: 0 0 0 2px var(--accent); transition: box-shadow .12s; }
.cs-av + .cs-av { margin-left: -6px; }
.cs-av.speaking { box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--accent-ink); z-index: 1; }
.cs-muted { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 7px; background: var(--danger); color: #fff; display: grid; place-items: center; }
.cs-btn { width: 44px; height: 44px; border-radius: 22px; background: var(--accent-ink); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.cs-btn.off { background: transparent; color: var(--accent-ink); box-shadow: inset 0 0 0 2px var(--accent-ink); }
.cs-btn.leave { background: var(--danger); color: #fff; }
@media (max-width: 430px) { .call-zone .cs-avs { display: none; } .cs-btn { width: 42px; height: 42px; } }

/* сообщения */
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 6px; display: flex; flex-direction: column; overscroll-behavior: contain; }
.messages > :first-child { margin-top: auto; }
.msg { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; max-width: 100%; }
.msg.first { margin-top: 10px; }
.msg.out { justify-content: flex-end; }
.msg .av-gap { width: 32px; flex-shrink: 0; }
.bubble { max-width: min(78%, 560px); background: var(--bubble-in); color: var(--bubble-in-text); border-radius: 20px; padding: 8px 12px 6px; position: relative; }
.msg.in .bubble { border-bottom-left-radius: 8px; border-top-left-radius: 8px; }
.msg.in.first .bubble { border-top-left-radius: 20px; }
.msg.in.tail .bubble { border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--bubble-out); color: var(--bubble-out-text); border-bottom-right-radius: 8px; border-top-right-radius: 8px; }
.msg.out.first .bubble { border-top-right-radius: 20px; }
.msg.out.tail .bubble { border-bottom-right-radius: 6px; }
.msg.pending .bubble { opacity: .6; }
.b-author { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.b-text { font-size: 15.5px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.b-text a { color: inherit; text-decoration: underline; }
.b-meta { float: right; font-size: 11px; color: var(--faint); margin: 6px 0 -2px 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.msg.out .b-meta { color: var(--bubble-out-meta); }
.nc0 { color: var(--n0); } .nc1 { color: var(--n1); } .nc2 { color: var(--n2); } .nc3 { color: var(--n3); }
.nc4 { color: var(--n4); } .nc5 { color: var(--n5); } .nc6 { color: var(--n6); } .nc7 { color: var(--n7); }
.day { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 5px 12px; border-radius: 12px; background: var(--card); margin: 14px 0 4px; }
.load-more { align-self: center; font-size: 13px; color: var(--muted); padding: 8px 14px; border-radius: 16px; margin-bottom: 6px; font-weight: 700; }
.load-more:hover { background: var(--hover); }
.empty-chat { margin: auto; text-align: center; color: var(--muted); font-size: 14.5px; max-width: 320px; line-height: 1.6; padding: 20px; }
.empty-chat .logo { margin-bottom: 10px; }

/* упоминания и реакции */
.badge.at { background: var(--gold); color: #241800; }
.mention { font: inherit; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border-radius: 6px; padding: 0 3px; }
.msg.out .mention { color: inherit; background: color-mix(in srgb, currentColor 18%, transparent); }
.mention.me { background: color-mix(in srgb, var(--gold) 28%, transparent); color: var(--text); }
.msg.mentioned .bubble { box-shadow: inset 3px 0 0 var(--gold); background: color-mix(in srgb, var(--gold) 12%, var(--bubble-in)); }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; clear: both; }
.react { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 9px; border-radius: 14px; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, currentColor 10%, transparent); border: 1px solid transparent; color: inherit; }
.react.mine { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.msg.out .react.mine { border-color: currentColor; color: inherit; background: color-mix(in srgb, currentColor 20%, transparent); }
.r-emoji { font-size: 15px; line-height: 1; }
.react-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin: 0 0 14px; }
.react-pick { width: 100%; max-width: 48px; aspect-ratio: 1; justify-self: center; border-radius: 50%; font-size: 21px; display: grid; place-items: center; background: var(--field); }
.react-pick:hover { transform: scale(1.12); }
.react-pick.mine { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.react-pop { position: fixed; z-index: 260; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 26px; padding: 6px; box-shadow: var(--shadow); }
.react-pop .react-row { margin: 0; display: flex; }
.react-pop .react-pick { width: 40px; height: 40px; font-size: 20px; background: transparent; }
.react-pop .react-pick:hover { background: var(--field); }
.mention-pop { margin: 0 4px 6px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 4px; max-height: 260px; overflow-y: auto; }
.mp-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; text-align: left; min-height: 44px; }
.mp-item.sel, .mp-item:hover { background: var(--hover); }
.mp-name { font-weight: 700; }
.mp-handle { color: var(--muted); font-size: 13px; }

/* ответы */
.msg { position: relative; transition: transform .15s ease-out; }
.msg.swiping { transition: none; }
.msg-acts { order: 0; display: flex; gap: 4px; align-self: center; flex-shrink: 0; opacity: 0; transition: opacity .12s; }
.msg.in .msg-acts { order: 3; }
.msg:hover .msg-acts, .msg-acts:focus-within { opacity: 1; }
.msg-act { width: 32px; height: 32px; border-radius: 16px; display: grid; place-items: center; color: var(--muted); background: var(--card); }
.msg-act:hover { color: var(--text); }
@media (hover: none) { .msg-acts { display: none; } }
.msg.flash .bubble { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.b-quote { display: block; width: 100%; text-align: left; border-left: 3px solid currentColor; border-radius: 6px; padding: 3px 8px; margin: 2px 0 5px;
  background: color-mix(in srgb, currentColor 10%, transparent); color: var(--accent-text); max-width: 100%; }
.msg.out .b-quote { color: var(--bubble-out-text); }
.bq-name { display: block; font-size: 12.5px; font-weight: 800; }
.bq-text { display: block; font-size: 13.5px; color: var(--bubble-in-text); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.out .bq-text { color: var(--bubble-out-text); }
.msg.out .bq-name { color: inherit !important; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 4px 8px 12px; }
.rb-ico { color: var(--accent-text); }
.rb-main { flex: 1; min-width: 0; text-align: left; border-left: 3px solid var(--accent); padding: 2px 10px; }
.rb-name { display: block; font-size: 13px; font-weight: 800; color: var(--accent-text); }
.rb-text { display: block; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 2px 0; }
.voice-play { width: 38px; height: 38px; border-radius: 19px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex-shrink: 0; }
.msg.out .voice-play { background: var(--bubble-out-text); color: var(--bubble-out); }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; min-width: 110px; }
.wave i { width: 3px; border-radius: 2px; background: currentColor; opacity: .35; flex-shrink: 0; }
.wave i.on { opacity: 1; }
.voice-dur { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .8; }

.typing { padding: 0 20px; font-size: 12.5px; color: var(--muted); min-height: 18px; flex-shrink: 0; }
.composer-wrap { flex-shrink: 0; padding: 6px 10px calc(var(--safe-bottom) + 10px); }
.composer-wrap:empty { padding: 0 0 var(--safe-bottom); }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer .pill { flex: 1; min-width: 0; background: var(--field); border-radius: 24px; display: flex; align-items: flex-end; padding: 0 16px; min-height: 48px; }
.composer .pill:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.composer textarea:focus-visible { outline: none; }
.composer textarea { flex: 1; resize: none; font-size: 16px; line-height: 1.4; padding: 13px 0; max-height: 160px; min-height: 48px; color: var(--text); }
.composer .act { width: 48px; height: 48px; border-radius: 24px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex-shrink: 0; position: relative; }
.rec { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 4px 0 16px; background: var(--field); border-radius: 24px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; }
.rec-hint { flex: 1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer-locked { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px dashed var(--line-2); border-radius: 20px; padding: 12px 14px; color: var(--muted); font-size: 14px; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- плашки, баннер, тосты ---------- */
.conn-bar { position: fixed; top: calc(var(--safe-top) + 8px); left: 50%; transform: translateX(-50%); z-index: 250; background: var(--gold); color: #241800;
  font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 16px; box-shadow: var(--shadow); white-space: nowrap; }
.banner { position: fixed; top: calc(var(--safe-top) + 12px); left: 50%; transform: translateX(-50%); z-index: 300; background: var(--sheet); border: 1px solid var(--accent);
  border-radius: 22px; padding: 12px 12px 12px 16px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); width: max-content; max-width: calc(100vw - 24px); flex-wrap: wrap; }
.banner .bn-text { font-size: 14.5px; flex: 1 1 140px; }
.banner .bn-text b { color: var(--accent-text); }
.btn-accept { background: var(--accent); color: var(--accent-ink); font-weight: 800; min-height: 44px; padding: 0 16px; border-radius: 22px; }
.btn-decline { background: var(--danger); color: #fff; font-weight: 800; min-height: 44px; padding: 0 16px; border-radius: 22px; }
.toast { position: fixed; bottom: calc(var(--safe-bottom) + 92px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 18px; font-size: 14px; font-weight: 600; z-index: 400; max-width: calc(100vw - 32px); box-shadow: var(--shadow); text-align: center; }

/* ---------- окна (на телефоне — шторка снизу) ---------- */
.modal-overlay { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 200; padding: 16px; }
.modal { background: var(--sheet); border: 1px solid var(--line); border-radius: 28px; padding: 24px; width: 100%; max-width: 440px; max-height: 88dvh; overflow-y: auto; position: relative; box-shadow: var(--shadow); }
.modal h2 { font-size: 20px; font-weight: 800; margin-bottom: 6px; padding-right: 44px; display: flex; align-items: center; gap: 8px; }
.modal .lead { color: var(--muted); font-size: 14px; line-height: 1.55; margin-bottom: 18px; }
.modal .lead b { color: var(--accent-text); }
.modal-close { position: absolute; top: 14px; right: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 16px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.plan { border: 1.5px solid var(--line-2); border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.plan.best { border-color: var(--accent); background: var(--accent-soft); }
.plan b { font-size: 15px; }
.plan .price { color: var(--accent-text); font-weight: 800; }
.plan .price small { color: var(--faint); font-weight: 500; }
.feat { display: flex; gap: 10px; font-size: 14px; color: var(--muted); margin: 8px 0; line-height: 1.45; }
.feat::before { content: "✓"; color: var(--accent-text); font-weight: 800; }
.feat.soon::before { content: "…"; color: var(--faint); }
.demo-note { font-size: 12.5px; color: var(--gold); margin: 14px 0 10px; line-height: 1.5; }
.theme-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 52px; border-radius: 16px; border: 1.5px solid var(--line-2); margin-bottom: 8px; text-align: left; font-weight: 700; }
.theme-row.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-dots { display: flex; gap: 4px; }
.theme-dots i { width: 18px; height: 18px; border-radius: 50%; display: block; border: 1px solid var(--line-2); }
.chan-edit { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 4px 6px 12px; border-radius: 14px; font-size: 15px; min-height: 48px; }
.chan-edit:hover { background: var(--hover); }
.two-btns { display: flex; gap: 8px; margin-top: 8px; }
.two-btns > * { flex: 1; }
.member-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 14px; text-align: left; }
button.member-row:hover { background: var(--hover); }
.member-row .mr-main { flex: 1; min-width: 0; }
.member-row .mr-name { font-weight: 700; display: flex; align-items: center; gap: 4px; }
.member-row .mr-sub { font-size: 12.5px; color: var(--muted); }
.steps { list-style: none; counter-reset: s; margin: 4px 0 8px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; font-size: 14.5px; line-height: 1.45; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 13px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex-shrink: 0; }
.steps-title { font-weight: 800; margin: 14px 0 8px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

@media (max-width: 859px) {
  .modal-overlay { place-items: end center; padding: 0; }
  .modal { max-width: none; border-radius: 28px 28px 0 0; border-bottom: 0; padding-bottom: calc(var(--safe-bottom) + 24px); animation: sheetUp .22s ease-out; max-height: 92dvh; }
  .modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: -12px auto 14px; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }

/* ---------- компьютер: две колонки ---------- */
@media (min-width: 860px) {
  .app { grid-template-columns: 380px minmax(0, 1fr); }
  .app .pane-list, .app .pane-chat { display: flex !important; animation: none !important; }
  .pane-list { border-right: 1px solid var(--line); }
  .back-btn, .mini-call { display: none !important; }
  .messages { padding: 14px 24px 8px; }
  .composer-wrap { padding: 8px 20px 16px; }
  .toast { bottom: 28px; }
}
@media (min-width: 1280px) { .app { grid-template-columns: 420px minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
