:root {
  --accent: #5b4fd6; --accent-2: #3867d6; --accent-soft: #ecebff;
  --bg: #ffffff; --bg-2: #f4f4f8; --chat-bg: #e9e7f5;
  --text: #16151d; --muted: #7b7a88; --line: #e6e5ee;
  --in: #ffffff; --out: #e3defe; --danger: #e5484d; --ok: #2fa86b;
  --shadow: 0 6px 24px rgba(30, 20, 80, .14);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8f86ff; --accent-2: #6d8dff; --accent-soft: #2a2747;
    --bg: #17161f; --bg-2: #201f2b; --chat-bg: #0f0e16;
    --text: #ecebf5; --muted: #9897a8; --line: #2c2b38;
    --in: #232231; --out: #3d3577; --shadow: 0 6px 24px rgba(0,0,0,.45);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--accent); }
.hidden { display: none !important; }
#app { height: 100dvh; display: flex; overflow: hidden; }
.splash { margin: auto; } .splash img { width: 96px; border-radius: 22px; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- auth ---------- */
.auth { margin: auto; width: 100%; max-width: 380px; padding: 24px; padding-top: calc(24px + var(--safe-top)); }
.auth .logo { width: 84px; height: 84px; border-radius: 22px; display: block; margin: 0 auto 14px; box-shadow: var(--shadow); }
.auth h1 { text-align: center; margin: 0 0 4px; font-size: 26px; }
.auth p.sub { text-align: center; color: var(--muted); margin: 0 0 22px; }
.seg { display: flex; background: var(--bg-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px 2px; }
.input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 80px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); font-size: 14px; min-height: 20px; margin: 4px 0 8px; }

/* ---------- layout ---------- */
.sidebar { width: 380px; max-width: 100%; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); position: relative; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
.main .empty { margin: auto; color: var(--muted); background: rgba(0,0,0,.18); color: #fff; padding: 6px 14px; border-radius: 16px; font-size: 14px; }
@media (max-width: 760px) {
  .sidebar { width: 100%; border: 0; }
  .main { position: fixed; inset: 0; transform: translateX(100%); transition: transform .22s ease; z-index: 5; }
  #app.in-chat .main { transform: none; }
}
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; padding-top: calc(8px + var(--safe-top)); min-height: 56px; border-bottom: 1px solid var(--line); background: var(--bg); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn svg { width: 22px; height: 22px; }
.search { flex: 1; position: relative; }
.search input { width: 100%; padding: 9px 14px 9px 36px; border-radius: 20px; border: 0; background: var(--bg-2); outline: none; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted); }

.chat-list { flex: 1; overflow-y: auto; padding: 4px 6px calc(80px + var(--safe-bottom)); }
.chat-item { display: flex; gap: 11px; align-items: center; padding: 8px 9px; border-radius: 12px; cursor: pointer; }
.chat-item:hover { background: var(--bg-2); }
.chat-item.active { background: var(--accent); color: #fff; }
.chat-item.active .meta, .chat-item.active .preview { color: rgba(255,255,255,.85); }
.chat-item .body { flex: 1; min-width: 0; }
.chat-item .row { display: flex; align-items: center; gap: 6px; }
.chat-item .name { font-weight: 600; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chat-item .meta { font-size: 12px; color: var(--muted); flex: none; }
.chat-item .preview { color: var(--muted); font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.badge { background: var(--accent); color: #fff; border-radius: 11px; min-width: 22px; height: 22px; padding: 0 7px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.badge.muted { background: #a5a4b4; }
.chat-item.active .badge { background: #fff; color: var(--accent); }
.list-empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.avatar { width: 50px; height: 50px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 18px; position: relative; }
.avatar.sm { width: 38px; height: 38px; font-size: 14px; }
.avatar.xs { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.avatar.online::after { content: ''; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }

.fab { position: absolute; right: 18px; bottom: calc(18px + var(--safe-bottom)); width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; z-index: 3; }
.fab svg { width: 26px; height: 26px; }

/* ---------- chat ---------- */
.chat-head { cursor: pointer; flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .s.typing { color: var(--accent); }
.back-btn { display: none; }
@media (max-width: 760px) { .back-btn { display: inline-flex; } }

.messages { flex: 1; overflow-y: auto; padding: 12px 10px 8px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain;
  }
.messages .inner { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; margin: 10px 0 6px; background: rgba(40,30,90,.28); color: #fff; font-size: 12.5px; font-weight: 600; padding: 3px 11px; border-radius: 12px; }
.sys { align-self: center; margin: 4px 0; background: rgba(40,30,90,.22); color: #fff; font-size: 13px; padding: 4px 12px; border-radius: 12px; text-align: center; max-width: 85%; }
.msg { display: flex; gap: 6px; align-items: flex-end; max-width: 85%; }
.msg.out { align-self: flex-end; flex-direction: row-reverse; }
.msg .av-slot { width: 32px; flex: none; }
.bubble { background: var(--in); border-radius: 16px; padding: 6px 10px 6px; position: relative; box-shadow: 0 1px 1.5px rgba(0,0,0,.08); min-width: 64px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.out .bubble { background: var(--out); }
.msg.first:not(.out) .bubble { border-bottom-left-radius: 16px; }
.msg.last:not(.out) .bubble { border-bottom-left-radius: 4px; }
.msg.last.out .bubble { border-bottom-right-radius: 4px; }
.msg.first { margin-top: 6px; }
.bubble .who { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.bubble .txt { white-space: pre-wrap; }
.bubble .time { float: right; font-size: 11.5px; color: var(--muted); margin: 6px 0 -3px 10px; display: inline-flex; align-items: center; gap: 3px; user-select: none; }
.bubble .time svg { width: 16px; height: 16px; color: var(--accent); }
.bubble.media { padding: 3px; }
.bubble.media .txt, .bubble.media .who { padding: 3px 7px 0; }
.bubble.media .time.over { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.45); color: #fff; padding: 1px 7px; border-radius: 10px; margin: 0; }
.bubble.media .time.over svg { color: #fff; }
.photo { display: block; border-radius: 13px; max-width: min(320px, 70vw); max-height: 380px; width: auto; height: auto; cursor: zoom-in; background: rgba(0,0,0,.06); }
.deleted .txt { color: var(--muted); font-style: italic; }
.reply-q { border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 4px; border-radius: 4px; background: rgba(91,79,214,.08); font-size: 13.5px; cursor: pointer; }
.reply-q b { display: block; color: var(--accent); font-size: 13px; }
.reply-q span { color: var(--muted); display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 260px; }

.filebox { display: flex; gap: 10px; align-items: center; padding: 4px 2px; text-decoration: none; color: inherit; min-width: 200px; }
.filebox .fi { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.filebox .fi svg { width: 22px; }
.filebox .fn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
.filebox .fs { font-size: 12.5px; color: var(--muted); }

.voice { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 2px 0; }
.voice .play { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.voice .play svg { width: 20px; }
.voice .track { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice .track i { flex: 1; background: var(--accent); opacity: .3; border-radius: 2px; min-height: 3px; }
.voice .track i.on { opacity: 1; }
.voice .dur { font-size: 12px; color: var(--muted); min-width: 34px; }

.typing-dots { display: inline-flex; gap: 2px; margin-left: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: blink 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: .2s; } .typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

.composer-wrap { padding: 8px 10px calc(8px + var(--safe-bottom)); }
.composer-wrap .inner { max-width: 760px; margin: 0 auto; }
.reply-bar { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 14px 14px 0 0; padding: 8px 8px 4px 14px; font-size: 14px; }
.reply-bar .q { flex: 1; border-left: 3px solid var(--accent); padding-left: 8px; min-width: 0; }
.reply-bar .q b { color: var(--accent); display: block; font-size: 13px; }
.reply-bar .q span { color: var(--muted); display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.reply-bar + .composer { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer { display: flex; align-items: flex-end; gap: 4px; background: var(--bg); border-radius: 22px; padding: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 9px 6px; max-height: 160px; min-height: 40px; line-height: 1.4; }
.send-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.send-btn svg { width: 21px; height: 21px; }
.readonly-bar { text-align: center; color: var(--muted); background: var(--bg); padding: 12px; border-radius: 14px; font-size: 14px; }
.rec-bar { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 22px; padding: 4px 4px 4px 14px; }
.rec-bar .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
.rec-bar .tm { font-variant-numeric: tabular-nums; flex: 1; }
.scroll-down { position: absolute; right: 16px; bottom: calc(80px + var(--safe-bottom)); width: 44px; height: 44px; border-radius: 50%; background: var(--bg); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.scroll-down svg { width: 22px; }

/* ---------- overlays ---------- */
#layer > .overlay { position: fixed; inset: 0; background: rgba(10, 8, 30, .45); z-index: 50; display: flex; align-items: center; justify-content: center; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--bg); width: 100%; max-width: 460px; max-height: 88dvh; border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); animation: up .2s ease; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (max-width: 760px) {
  #layer > .overlay { align-items: flex-end; }
  .sheet { max-width: none; border-radius: 18px 18px 0 0; max-height: 94dvh; padding-bottom: var(--safe-bottom); }
}
.sheet-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; margin: 0; font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 14px 18px 18px; }
.menu-list button, .menu-list a.mi { display: flex; width: 100%; align-items: center; gap: 14px; padding: 12px 8px; border-radius: 10px; text-align: left; text-decoration: none; color: inherit; }
.menu-list button:hover { background: var(--bg-2); }
.menu-list svg { width: 22px; color: var(--muted); flex: none; }
.menu-list .danger, .menu-list .danger svg { color: var(--danger); }
.person { display: flex; align-items: center; gap: 11px; padding: 8px 6px; border-radius: 10px; }
.person.click { cursor: pointer; } .person.click:hover { background: var(--bg-2); }
.person .pn { flex: 1; min-width: 0; }
.person .pn b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .pn small { color: var(--muted); }
.tag { font-size: 11.5px; background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 8px; font-weight: 600; }
.sec-title { font-size: 13px; color: var(--accent); font-weight: 700; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.sec-title:first-child { margin-top: 0; }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.switch-row > span:first-child { flex: 1; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: #c8c7d4; border-radius: 13px; transition: .15s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 11px; border-radius: 16px; background: var(--bg-2); font-size: 13px; font-weight: 600; color: var(--muted); }
.chip.on { background: var(--accent); color: #fff; }
.perm-chip.on { background: var(--ok); }
.perm-chip.off { background: var(--bg-2); color: var(--muted); text-decoration: line-through; }
.card { background: var(--bg-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 8px; }
.stat { background: var(--bg-2); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat small { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { padding: 9px 12px; color: var(--muted); font-weight: 600; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.profile-top { text-align: center; padding: 6px 0 12px; }
.profile-top .avatar { margin: 0 auto 10px; }
.profile-top h2 { margin: 0; font-size: 20px; }
.profile-top p { margin: 3px 0 0; color: var(--muted); }
.linkbox { display: flex; gap: 6px; align-items: center; background: var(--bg-2); border-radius: 10px; padding: 8px 8px 8px 12px; font-size: 13.5px; }
.linkbox code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.lightbox .icon-btn { position: absolute; top: calc(10px + var(--safe-top)); color: #fff; }
.action-sheet { padding: 8px; }
#toasts { position: fixed; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: 92%; max-width: 420px; }
.toast { background: #24223a; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: up .2s; pointer-events: auto; }
.toast.error { background: var(--danger); }
.install-hint { margin: 6px 8px; padding: 10px 12px; background: var(--accent-soft); border-radius: 12px; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
.install-hint span { flex: 1; }
.install-hint > svg { width: 26px; height: 26px; flex: none; color: var(--accent); }
.muted { color: var(--muted); }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mt { margin-top: 12px; }

/* ---------- меню сообщения, реакции, пересылка ---------- */
.ctx { position: fixed; z-index: 70; display: flex; flex-direction: column; gap: 6px; animation: fade .12s; }
.ctx-react { display: flex; gap: 2px; background: var(--bg); border-radius: 26px; padding: 5px 7px; box-shadow: var(--shadow); align-self: flex-start; }
.ctx-react button { font-size: 24px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.ctx-react button:hover { transform: scale(1.25); }
.ctx-react button.on { background: var(--accent-soft); }
.ctx-menu { background: var(--bg); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); min-width: 230px; }
.ctx-menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 12px; border-radius: 9px; text-align: left; font-size: 15px; }
.ctx-menu button:hover { background: var(--bg-2); }
.ctx-menu button svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.ctx-menu button.danger, .ctx-menu button.danger svg { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 8px; }
.bubble .mbtn { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: inherit; color: var(--muted); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; box-shadow: 0 0 0 1px var(--line); }
.bubble .mbtn svg { width: 16px; height: 16px; }
.msg:hover .bubble .mbtn { opacity: 1; }
.bubble.media .mbtn { background: rgba(0,0,0,.45); color: #fff; box-shadow: none; top: 8px; right: 8px; }
.fwd { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 2px; }
.fwd svg { width: 15px; height: 15px; }
.bubble.media .fwd { padding: 4px 7px 0; }
.reacts { clear: both; display: flex; flex-wrap: wrap; gap: 4px; padding-top: 5px; }
.bubble.media .reacts { padding: 5px 6px 2px; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.react b { font-size: 12.5px; color: var(--accent); }
.react.on { background: var(--accent); }
.react.on b { color: #fff; }

/* ---------- закреплённое сообщение ---------- */
.pinned-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; background: var(--bg); border-bottom: 1px solid var(--line); }
.pinned-bar .pin-body { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 10px; cursor: pointer; }
.pinned-bar b { display: block; color: var(--accent); font-size: 13px; }
.pinned-bar span { display: block; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.pinned-bar .pin-ic { display: inline-flex; width: 20px; color: var(--muted); margin-right: 8px; }

/* ---------- своя подложка чата ---------- */
.messages { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22240%22 height=%22240%22 viewBox=%220 0 240 240%22%3E%3Cg fill=%22none%22 stroke=%22%235b4fd6%22 stroke-opacity=%220.13%22 stroke-width=%221.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolygon points=%2230.0,17.0 32.9,24.0 40.5,24.6 34.7,29.5 36.5,36.9 30.0,33.0 23.5,36.9 25.3,29.5 19.5,24.6 27.1,24.0%22/%3E%3Cpolygon points=%22178.0,142.0 180.1,147.1 185.6,147.5 181.4,151.1 182.7,156.5 178.0,153.6 173.3,156.5 174.6,151.1 170.4,147.5 175.9,147.1%22/%3E%3Cpolygon points=%22110.0,206.0 111.6,209.8 115.7,210.1 112.6,212.8 113.5,216.9 110.0,214.7 106.5,216.9 107.4,212.8 104.3,210.1 108.4,209.8%22/%3E%3Cpath d=%22M88 30h40a10 10 0 0 1 10 10v16a10 10 0 0 1-10 10h-26l-12 9v-9h-2a10 10 0 0 1-10-10V40a10 10 0 0 1 10-10z%22/%3E%3Cpath d=%22M22 120h30a8 8 0 0 1 8 8v12a8 8 0 0 1-8 8H36l-9 7v-7h-5a8 8 0 0 1-8-8v-12a8 8 0 0 1 8-8z%22/%3E%3Cpath d=%22M190 52c-4-6-14-4-14 4 0 7 14 14 14 14s14-7 14-14c0-8-10-10-14-4z%22/%3E%3Cpath d=%22M70 178c-3-4-10-3-10 3 0 5 10 10 10 10s10-5 10-10c0-6-7-7-10-3z%22/%3E%3Cpath d=%22M150 98l26-10-10 26-5-11z%22/%3E%3Cpath d=%22M161 103l5-5%22/%3E%3Crect x=%22104%22 y=%22128%22 width=%2210%22 height=%2217%22 rx=%225%22/%3E%3Cpath d=%22M99 140a10 10 0 0 0 20 0M109 150v5%22/%3E%3Cpath d=%22M206 206v8M202 210h8%22/%3E%3Cpath d=%22M60 80v6M57 83h6%22/%3E%3Cpath d=%22M214 110v6M211 113h6%22/%3E%3Cpath d=%22M150 186v6M147 189h6%22/%3E%3Ccircle cx=%2262%22 cy=%22230%22 r=%223%22/%3E%3Ccircle cx=%22226%22 cy=%2220%22 r=%222.5%22/%3E%3Ccircle cx=%22140%22 cy=%2218%22 r=%222%22/%3E%3Cpath d=%22M190 232a10 10 0 1 1 10-10%22/%3E%3C/g%3E%3C/svg%3E"); background-size: 240px 240px; }
@media (prefers-color-scheme: dark) { .messages { background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22240%22 height=%22240%22 viewBox=%220 0 240 240%22%3E%3Cg fill=%22none%22 stroke=%22%23a79fff%22 stroke-opacity=%220.08%22 stroke-width=%221.6%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpolygon points=%2230.0,17.0 32.9,24.0 40.5,24.6 34.7,29.5 36.5,36.9 30.0,33.0 23.5,36.9 25.3,29.5 19.5,24.6 27.1,24.0%22/%3E%3Cpolygon points=%22178.0,142.0 180.1,147.1 185.6,147.5 181.4,151.1 182.7,156.5 178.0,153.6 173.3,156.5 174.6,151.1 170.4,147.5 175.9,147.1%22/%3E%3Cpolygon points=%22110.0,206.0 111.6,209.8 115.7,210.1 112.6,212.8 113.5,216.9 110.0,214.7 106.5,216.9 107.4,212.8 104.3,210.1 108.4,209.8%22/%3E%3Cpath d=%22M88 30h40a10 10 0 0 1 10 10v16a10 10 0 0 1-10 10h-26l-12 9v-9h-2a10 10 0 0 1-10-10V40a10 10 0 0 1 10-10z%22/%3E%3Cpath d=%22M22 120h30a8 8 0 0 1 8 8v12a8 8 0 0 1-8 8H36l-9 7v-7h-5a8 8 0 0 1-8-8v-12a8 8 0 0 1 8-8z%22/%3E%3Cpath d=%22M190 52c-4-6-14-4-14 4 0 7 14 14 14 14s14-7 14-14c0-8-10-10-14-4z%22/%3E%3Cpath d=%22M70 178c-3-4-10-3-10 3 0 5 10 10 10 10s10-5 10-10c0-6-7-7-10-3z%22/%3E%3Cpath d=%22M150 98l26-10-10 26-5-11z%22/%3E%3Cpath d=%22M161 103l5-5%22/%3E%3Crect x=%22104%22 y=%22128%22 width=%2210%22 height=%2217%22 rx=%225%22/%3E%3Cpath d=%22M99 140a10 10 0 0 0 20 0M109 150v5%22/%3E%3Cpath d=%22M206 206v8M202 210h8%22/%3E%3Cpath d=%22M60 80v6M57 83h6%22/%3E%3Cpath d=%22M214 110v6M211 113h6%22/%3E%3Cpath d=%22M150 186v6M147 189h6%22/%3E%3Ccircle cx=%2262%22 cy=%22230%22 r=%223%22/%3E%3Ccircle cx=%22226%22 cy=%2220%22 r=%222.5%22/%3E%3Ccircle cx=%22140%22 cy=%2218%22 r=%222%22/%3E%3Cpath d=%22M190 232a10 10 0 1 1 10-10%22/%3E%3C/g%3E%3C/svg%3E"); } }

/* ---------- папки ---------- */
.folder-tabs { display: flex; gap: 4px; padding: 6px 8px 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.folder-tabs::-webkit-scrollbar { display: none; }
.ftab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 18px; white-space: nowrap; font-weight: 600; font-size: 14px; color: var(--muted); }
.ftab:hover { background: var(--bg-2); }
.ftab.on { background: var(--accent-soft); color: var(--accent); }
.fbadge { background: var(--accent); color: #fff; border-radius: 10px; min-width: 19px; height: 19px; padding: 0 5px; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.icon-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.icon-grid button { font-size: 22px; height: 42px; border-radius: 10px; background: var(--bg-2); }
.icon-grid button.on { background: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.person .switch { margin-left: auto; }

/* ---------- контакты ---------- */
.here-badge { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--bg); }

/* ---------- возможности ---------- */
.feature { display: flex; gap: 14px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.feature:last-child { border: 0; }
.feature .f-ic { font-size: 26px; width: 40px; text-align: center; flex: none; }
.feature b { display: block; margin-bottom: 2px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* Safari: шапка и вкладки окна не должны сжиматься, иконки в строках списка — фиксированного размера */
.sheet-head, .tabs { flex: none; }
.tabs button { flex: none; }
.chat-item .row > span svg { width: 15px; height: 15px; }
