:root { color-scheme: light; --bg: #f7f7f8; --panel: #fff; --line: #e5e7eb; --line2: #f0f0f1; --text: #111827; --muted: #6b7280; --accent: #f59e0b; --accent-text: #b45309; --mine: #fde9c4; --other: #fff; --active: #fff7ed; --link: #1d4ed8; --hl: #fde68a; --room: #ece7de; --room-dot: #e2dccf; --ink: rgba(0,0,0,.06); --ink2: rgba(0,0,0,.12); --danger: #b91c1c; --danger-bg: #fee2e2; --sat: env(safe-area-inset-top); --sab: env(safe-area-inset-bottom); }
/* тёмная тема (v0.10): переключается в профиле, html[data-theme] ставится до загрузки Vue */
html[data-theme="dark"] { color-scheme: dark; --bg: #0f1216; --panel: #1a1f26; --line: #2b323b; --line2: #232930; --text: #e6e8eb; --muted: #9aa3ad; --accent: #f59e0b; --accent-text: #fbbf24; --mine: #4a3410; --other: #262d36; --active: #2a2417; --link: #7cb3ff; --hl: #6b4a0e; --room: #0b0e12; --room-dot: #1b2027; --ink: rgba(255,255,255,.08); --ink2: rgba(255,255,255,.16); --danger: #fca5a5; --danger-bg: #3b1515; }
html[data-theme="dark"] .card input[type=password], html[data-theme="dark"] .card input[type=text], html[data-theme="dark"] .login input, html[data-theme="dark"] .deal-pane .card input[type=text] { background: var(--bg); }
html[data-theme="dark"] .banner { background: var(--active); border-color: #5b3d10; }
html[data-theme="dark"] .badge.mute { background: #4b5563; color: #e5e7eb; }
html[data-theme="dark"] .seg .badge { background: #e5e7eb; color: #111; }
html[data-theme="dark"] .jump { box-shadow: 0 2px 8px rgba(0,0,0,.6); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; } /* без зума по двойному тапу: это чат, не веб-страница */
html, body { height: 100%; margin: 0; }
html, body { position: fixed; inset: 0; overflow: hidden; width: 100%; } /* iOS: страница не должна прокручиваться под клавиатуру (прыжок шапки) */
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea { -webkit-user-select: text; user-select: text; } /* долгое нажатие = наше меню, а не системное выделение; копирование через пункт меню */
[v-cloak] { display: none; }
#app { height: 100vh; height: 100dvh; display: flex; position: relative; }
.side, .main { height: 100%; display: flex; flex-direction: column; min-width: 0; }
.side { flex: 1; } .main { flex: 1; }
#app.desktop .side { flex: 0 0 340px; border-right: 1px solid var(--line); background: var(--panel); }
#app.desktop .main { flex: 1; }
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; }
.pad { padding: 12px; }
.grow { flex: 1; } .min { min-width: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.err { color: var(--danger); font-size: 14px; } .ok { color: #047857; font-size: 14px; }
.accent-text { color: var(--accent-text); }
/* роль сотрудника у имени (admin title как в Telegram) */
@keyframes alarm-blink { 0%, 100% { background: rgba(185,28,28,.55); } 50% { background: rgba(185,28,28,.15); } }
.sheet-bg.alarm { animation: alarm-blink 0.6s infinite; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.alarm-box { background: var(--panel); border-radius: 18px; padding: 24px 20px; text-align: center; width: min(320px, 90vw); display: flex; flex-direction: column; gap: 10px; }
.alarm-icon { font-size: 56px; }
.role { color: var(--accent-text); font-weight: 500; font-size: 12px; margin-left: 6px; white-space: nowrap; } .role.big { font-size: 14px; margin: 2px 0 2px; }
.clickable { cursor: pointer; }
.placeholder { flex: 1; display: flex; align-items: center; justify-content: center; }

/* шапка */
.bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) 10px 8px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 52px; }
.bar .title { font-weight: 600; font-size: 17px; }
.bar .sub { line-height: 1.2; }
.icon { background: none; border: 0; font: inherit; font-size: 20px; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--text); line-height: 1; }
.icon.on { background: var(--line); }
.icon.send { color: var(--accent-text); font-size: 24px; }
.btn { font: inherit; font-weight: 600; padding: 10px 14px; border: 0; border-radius: 10px; background: var(--line); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); } .btn.danger { background: var(--danger-bg); color: var(--danger); width: 100%; }
.btn.small { padding: 6px 10px; font-size: 14px; } .btn.ghost { background: none; color: var(--muted); }
.btn:disabled { opacity: .5; }
.center-block { display: block; margin: 6px auto; }
input, textarea { font: inherit; color: var(--text); }
.search { padding: 8px 10px; background: var(--panel); }
.search input { width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: var(--bg); }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff7ed; border-bottom: 1px solid #fed7aa; font-size: 14px; }

/* аватары */
.avatar { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 17px; flex: 0 0 auto; position: relative; background: #9ca3af; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; } .avatar.xl { width: 88px; height: 88px; font-size: 32px; margin: 12px auto; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: #22c55e; border: 2px solid var(--panel); border-radius: 50%; }

/* список */
.list .row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; cursor: pointer; background: var(--panel); border-bottom: 1px solid var(--line2); }
.list .row.active { background: var(--active); }
.list .row.accent .name { color: var(--accent-text); }
.list .row input[type=checkbox] { width: 20px; height: 20px; }
.row-top, .row-bot { display: flex; align-items: center; gap: 6px; }
.name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-size: 12px; } .preview { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: #111; font-size: 12px; font-weight: 700; border-radius: 12px; padding: 1px 7px; min-width: 20px; text-align: center; }
.badge.mute { background: #d1d5db; }
.section { padding: 10px 12px 4px; background: var(--bg); }
.empty { padding: 40px 20px; text-align: center; }
.card { background: var(--panel); border-radius: 14px; padding: 14px; margin: 12px 0; }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card input[type=password], .card input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0; }
.card .btn { margin-top: 8px; }
.card .row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.card .search { padding: 8px 0 4px; }
.row-c { display: flex; align-items: center; gap: 8px; }
.h2-input { font-size: 20px; font-weight: 600; text-align: center; border: 0; background: transparent; width: 100%; padding: 6px; }

/* вход */
.login { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: var(--panel); border-radius: 18px; padding: 28px 22px; width: 100%; max-width: 360px; text-align: center; }
.login-logo { width: 72px; height: 72px; border-radius: 18px; } .login h1 { font-size: 22px; margin: 10px 0 2px; }
.login input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0; }
.login .btn { width: 100%; margin-top: 8px; padding: 12px; }

/* диалог */
.room { background: var(--room); background-image: radial-gradient(var(--room-dot) 1px, transparent 1px); background-size: 22px 22px; position: relative; }
.pinned { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); cursor: pointer; }
.pinned.task-strip { cursor: default; } .pinned.task-strip .btn { white-space: nowrap; flex: none; }
.messages { padding: 10px 10px 8px; display: flex; flex-direction: column; overflow-x: hidden; touch-action: pan-y; } /* свайп-ответ не должен панорамировать ленту */
.room, .main { overflow: hidden; }
.day { text-align: center; margin: 10px 0 6px; } .day span { background: rgba(0,0,0,.35); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
/* плавающая дата: липнет к верху ленты, высоты не занимает, видна только при прокрутке (.on), клики пропускает */
.day-float { position: sticky; top: 0; height: 0; align-self: center; z-index: 3; text-align: center; pointer-events: none; opacity: 0; transition: opacity .35s; }
.day-float.on { opacity: 1; transition: opacity .12s; }
.day-float span { display: inline-block; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.sys { text-align: center; margin: 6px 0; } .sys span { background: rgba(0,0,0,.25); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 12px; }
.msg { display: flex; align-items: flex-end; gap: 6px; margin: 1px 0; max-width: 85%; }
.msg.first { margin-top: 6px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .side-av { flex: 0 0 32px; width: 32px; height: 32px; }
.bubble { background: var(--other); border-radius: 14px; padding: 6px 10px 4px; box-shadow: 0 1px 1px rgba(0,0,0,.08); position: relative; min-width: 60px; max-width: 100%; word-wrap: break-word; }
.msg.mine .bubble { background: var(--mine); }
.msg.pending .bubble { opacity: .7; } .msg.failed .bubble { outline: 2px solid #ef4444; }
.msg.highlight .bubble { animation: hl 1.6s ease; } @keyframes hl { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.08); } }
.bubble.emoji-only { background: transparent; box-shadow: none; } .bubble.emoji-only .text { font-size: 44px; line-height: 1.1; }
.bubble.emoji-only .meta { background: rgba(0,0,0,.35); color: #fff; border-radius: 10px; padding: 1px 6px; }
.bubble.media { padding: 3px; } .bubble.media .meta { position: absolute; right: 8px; bottom: 6px; background: rgba(0,0,0,.45); color: #fff; border-radius: 10px; padding: 1px 6px; }
.sender { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.quote { border-left: 3px solid var(--accent); padding: 2px 8px; margin: 2px 0 6px; background: var(--ink); border-radius: 6px; font-size: 13px; cursor: pointer; }
.quote b { color: var(--accent-text); }
.text { white-space: pre-wrap; } .text a { color: var(--link); }
.meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; display: flex; justify-content: flex-end; gap: 4px; align-items: center; }
.ticks { font-size: 11px; } .ticks.read { color: #16a34a; }
.photo { display: block; max-width: min(320px, 70vw); max-height: 320px; border-radius: 12px; cursor: pointer; object-fit: cover; }
.file { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 4px 0; }
/* альбом: несколько файлов одной отправки в одном пузыре; фото и видео сеткой в 2 колонки (при нечётном числе первое во всю ширину), файлы строками под ней */
.album { width: min(340px, 70vw); max-width: 100%; }
.agrid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 10px; overflow: hidden; margin: 2px 0 4px; }
.agrid img, .agrid video { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; cursor: pointer; background: rgba(0,0,0,.12); }
.agrid.odd > :first-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
.agrid.one > :first-child { aspect-ratio: auto; max-height: 320px; }
.ficon { font-size: 28px; }
.voice { display: flex; align-items: center; gap: 10px; min-width: 200px; padding: 4px 0; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); font-size: 15px; cursor: pointer; flex: 0 0 auto; }
.track { height: 6px; background: var(--ink2); border-radius: 3px; cursor: pointer; margin: 6px 0 4px; } .fill { height: 100%; background: var(--accent-text); border-radius: 3px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 2px; }
.msg-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.act-btn { border: 0; border-radius: 10px; padding: 8px 18px; font: inherit; font-weight: 700; background: var(--accent); color: #1f1300; cursor: pointer; min-width: 96px; }
.act-btn:disabled { opacity: .6; cursor: default; }
.act-done { font-size: 13px; font-weight: 600; color: var(--accent-text); padding: 4px 0; }
.react { background: var(--ink); border-radius: 12px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
.react.my { background: var(--hl); }
.typing { padding: 4px 10px; }
.jump { position: absolute; right: 14px; bottom: 76px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 20px; cursor: pointer; }
.jump .badge { position: absolute; top: -6px; right: -6px; }

/* композер */
.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 6px 8px calc(2px + var(--sab)); }
.composer textarea { flex: 1; resize: none; border: 0; background: var(--bg); border-radius: 18px; padding: 9px 12px; max-height: 120px; line-height: 1.3; }
.composer textarea:focus { outline: none; }
.staged { display: flex; gap: 6px; padding: 2px 4px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.staged .st { position: relative; flex: none; width: 60px; height: 60px; border-radius: 10px; background: var(--bg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.staged .st img { width: 100%; height: 100%; object-fit: cover; display: block; }
.staged .st.doc { width: auto; max-width: 190px; padding: 0 26px 0 10px; gap: 6px; }
.staged .st .ficon { font-size: 20px; }
.staged .st .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font: inherit; font-size: 11px; line-height: 20px; padding: 0; cursor: pointer; }
.lb-go { position: absolute; bottom: calc(24px + var(--sab)); left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.15); color: #fff; }
.attach-grid .cell .go { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; font: inherit; font-size: 14px; line-height: 26px; padding: 0; cursor: pointer; opacity: 0; transition: opacity .15s; }
.attach-grid .cell:hover .go { opacity: 1; }
.ctx { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-left: 3px solid var(--accent); margin-bottom: 6px; font-size: 14px; }
.emoji-panel { max-height: 220px; display: flex; flex-direction: column; margin-bottom: 6px; }
.emoji-tabs { display: flex; gap: 2px; } .emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); overflow-y: auto; }
.emoji-grid button { font-size: 24px; background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 8px; } .emoji-grid button:active { background: var(--line); }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #ef4444; animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2; } }

/* меню и оверлеи */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.overlay.dark { background: rgba(0,0,0,.92); align-items: center; }
.lb { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.sheet { background: var(--panel); border-radius: 18px 18px 0 0; padding: 10px 8px calc(10px + var(--sab)); width: 100%; max-width: 480px; }
#app.desktop .sheet { border-radius: 18px; margin-bottom: 20vh; }
.quick { display: flex; justify-content: space-around; padding: 4px 0 8px; } .quick button { font-size: 28px; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 10px; }
.sheet-grid { max-height: 200px; margin-bottom: 8px; }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; padding: 12px 10px; border-top: 1px solid var(--line2); cursor: pointer; color: var(--text); text-decoration: none; }
.item.danger { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: rgba(17,24,39,.92); color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 14px; z-index: 60; }

/* поиск и пересылка (v0.2) */
.search.rs { display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); } .search.rs input { flex: 1; }
.results { background: var(--bg); }
.list .row.result .preview mark, .preview mark { background: var(--hl); color: inherit; padding: 0 1px; border-radius: 3px; }
.list .row.result .preview { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fwd { font-size: 13px; color: var(--accent-text); margin-bottom: 3px; } .fwd b { font-weight: 600; }
.fwd-sheet { display: flex; flex-direction: column; max-height: 80vh; padding-top: 0; }
.bar.flat { padding-top: 8px; border-bottom: 0; background: transparent; }
.fwd-list { max-height: 55vh; }
.fwd-sheet .list .row { padding: 8px 6px; }

/* задачи по сделкам + встраивание (v0.3) */
.seg { display: flex; gap: 6px; padding: 0 10px 8px; background: var(--panel); }
.seg button { flex: 1; font: inherit; font-weight: 600; font-size: 13px; padding: 7px 4px; border: 0; border-radius: 10px; background: var(--bg); color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--accent); color: #111; }
.seg .badge { font-size: 11px; padding: 0 6px; min-width: 18px; background: #111; color: #fff; } .seg button.on .badge { background: #fff; color: #111; }
#app.embed .side { display: none !important; } #app.embed .main { flex: 1; }
#app.embed .bar { padding-top: 8px; }
.deal-pane { background: var(--bg); } .deal-pane .card { max-width: 520px; margin: 12px auto; }
.deal-pane .card h3 { font-size: 17px; } .deal-pane .card .btn { width: 100%; margin-top: 12px; }
.deal-pane .card input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0; }
.seen { padding: 4px 10px 6px; text-align: center; }
#app.kb .composer { padding-bottom: 6px; } /* клавиатура открыта: safe-area снизу не нужна */

/* стикеры (v0.6) */
.sticker { display: block; width: 160px; height: 160px; object-fit: contain; }
.emoji-tabs.scroll-x { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; } .emoji-tabs .icon { flex: 0 0 auto; }
.tab-img { width: 26px; height: 26px; object-fit: contain; display: block; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 4px; overflow-y: auto; }
.sticker-grid button { background: none; border: 0; padding: 4px; cursor: pointer; border-radius: 10px; } .sticker-grid button:active { background: var(--line); }
.sticker-grid img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.card .row-c input[type=text] { margin: 0; }

/* свайп-ответ */
.msg { transition: transform .18s ease; position: relative; }
.swipe-hint { position: absolute; right: -44px; top: 50%; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; opacity: 0; pointer-events: none; }
.rate { font: inherit; font-size: 12px; font-weight: 700; border: 0; border-radius: 10px; padding: 4px 8px; background: var(--ink); cursor: pointer; flex: 0 0 auto; }
.bubble.sticker-b, .msg.mine .bubble.sticker-b { background: transparent; box-shadow: none; padding: 0; min-width: 0; }
.bubble.sticker-b .sender { margin-left: 6px; }

/* упоминания, видео (v0.8) */
.mention { color: var(--link); font-weight: 600; }
.mention-list { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; }
.mention-list button { display: flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; padding: 4px 10px 4px 4px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); cursor: pointer; white-space: nowrap; }
.mention-list .avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.video { display: block; max-width: min(320px, 70vw); max-height: 320px; border-radius: 12px; background: #000; }
.user-sheet h2 { margin: 4px 0 2px; font-size: 20px; } .user-sheet .center { padding-bottom: 10px; }

/* тема (v0.10) */
.card .seg { padding: 0; background: transparent; }

/* звонки (v0.11) */
.call-screen { align-items: stretch; flex-direction: column; background: var(--bg); z-index: 70; padding: calc(20px + var(--sat)) 20px calc(24px + var(--sab)); }
.call-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.call-body h2 { margin: 6px 0 0; font-size: 24px; }
.call-status { min-height: 22px; font-variant-numeric: tabular-nums; }
.call-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 24px; max-width: 420px; }
.call-person { width: 84px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-person .avatar { width: 64px; height: 64px; font-size: 22px; box-shadow: 0 0 0 3px transparent; transition: box-shadow .15s; }
.call-person.speaking .avatar { box-shadow: 0 0 0 4px #22c55e; }
.call-actions { display: flex; justify-content: center; gap: 36px; padding-top: 16px; }
.call-btn { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--panel); color: var(--text); font-size: 28px; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.call-btn.off { background: var(--line); }
.call-btn small { display: block; font-size: 10px; line-height: 1; margin-top: -3px; opacity: .7; }
.call-btn.red { background: #ef4444; color: #fff; } .call-btn.green { background: #22c55e; color: #fff; }
.call-banner { background: var(--active); border-bottom: 1px solid var(--line); }
.icon.on.call-on { background: #22c55e; }
.call-person.ringing .avatar { opacity: .5; animation: blink 1.4s infinite; }
.call-btn:disabled { opacity: .4; }
.call-actions { flex-wrap: wrap; } .call-unblock { width: 100%; padding: 14px; font-size: 17px; margin-bottom: 4px; }
.call-audio { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.call-nosound { width: 100%; margin-bottom: 4px; }

/* треды (v0.12) */
.thread-chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--link); cursor: pointer; }
.tdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.avatar .dot.tdot-av { background: var(--accent); }
.thread-head { text-align: center; padding: 6px 14px 10px; }

/* видео в звонке (28.09): крупная плитка + лента маленьких, своё превью в углу */
.call-screen.video { background: #000; color: #fff; display: flex; max-width: none; max-height: none; border-radius: 0; /* .video чата (видео-сообщение, display:block + 320px) ломал экран звонка с камерой */ } .call-screen.video .muted { color: #bbb; } .call-screen.video .call-body h2 { font-size: 18px; margin: 0; }
.call-stage { flex: 1; width: 100%; max-width: 1100px; min-height: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.call-main { flex: 1; min-height: 0; position: relative; background: #111; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 3px transparent; transition: box-shadow .15s; }
.call-main.speaking { box-shadow: 0 0 0 3px #22c55e; }
.call-main video { width: 100%; height: 100%; object-fit: cover; display: block; background: #111; }
.call-main.screen video { object-fit: contain; }
/* сетка «как в Zoom» (13.10): ровные плитки, число колонок считает callCols; .strip = лента под крупной плиткой */
.call-grid { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 8px; flex: 1; min-height: 0; width: 100%; padding: 3px; }
.call-grid:not(.strip) .call-tile { width: auto; height: 100%; min-height: 96px; }
.call-grid:not(.strip) .call-tile .avatar { width: 72px; height: 72px; font-size: 26px; }
.call-grid.strip { display: flex; gap: 8px; overflow-x: auto; flex: none; scrollbar-width: none; }
.call-grid.strip:empty { display: none; }
.call-badges { position: absolute; right: 6px; top: 5px; display: flex; gap: 4px; background: rgba(0,0,0,.45); color: #fff; font-size: 14px; line-height: 1.3; padding: 2px 6px; border-radius: 8px; }
.call-tile video.mirror, .call-main video.mirror { transform: scaleX(-1); }
.call-main { cursor: pointer; }
.people-all { margin: 8px; }
.call-strip { display: flex; gap: 8px; overflow-x: auto; flex: none; padding: 3px; scrollbar-width: none; }
.call-tile { width: 112px; height: 84px; flex: none; position: relative; background: #1c1c1e; border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px transparent; transition: box-shadow .15s; }
.call-tile.clickable { cursor: pointer; } .call-tile.speaking { box-shadow: 0 0 0 3px #22c55e; } .call-tile.ringing { opacity: .5; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.call-tile .avatar { width: 44px; height: 44px; font-size: 16px; }
.call-vname { position: absolute; left: 6px; bottom: 5px; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; line-height: 1.3; padding: 2px 7px; border-radius: 8px; max-width: calc(100% - 12px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-self { position: absolute; right: 16px; top: calc(16px + var(--sat)); width: 140px; height: 105px; border-radius: 12px; overflow: hidden; background: #222; border: 1px solid rgba(255,255,255,.25); z-index: 5; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.call-self video { width: 100%; height: 100%; object-fit: cover; display: block; } .call-self video.mirror { transform: scaleX(-1); }
.call-self.share { top: calc(130px + var(--sat)); } .call-self.share video { object-fit: contain; background: #000; }
.call-btn.on { background: var(--text); color: var(--bg); }
@media (max-width: 600px) { .call-self { width: 96px; height: 128px; } .call-self.share { top: calc(154px + var(--sat)); height: 72px; } .call-actions { gap: 14px; } .call-btn { width: 58px; height: 58px; font-size: 24px; } }

/* 28.09 догон PWA: вкладки перетаскиванием, отложенные, цитата, вложения, задача по сделке */
.seg.tabs button { cursor: grab; } .seg.tabs button.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.pinned.sched { background: var(--ink); }
.sched-quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px; }
.tg-form { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.sheet input[type=datetime-local], .tg-form input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--text); min-width: 0; }
.sched-row { padding: 10px 0; border-top: 1px solid var(--line2); } .sched-row:first-child { border-top: 0; }
.sched-text { margin: 4px 0 6px; font-size: 15px; white-space: pre-wrap; word-break: break-word; max-height: 4.2em; overflow: hidden; }
.sched-acts { display: flex; gap: 14px; } .sched-acts button { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-text); cursor: pointer; } .sched-acts button.danger { color: var(--danger); }
.quote .frag { font-style: italic; }
.quote-ta { display: block; width: calc(100% - 20px); margin: 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--text); resize: vertical; }
.deal-card { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 8px 10px 0; }
.attach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-top: 8px; }
.attach-grid .cell { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--ink); cursor: pointer; }
.attach-grid img, .attach-grid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-grid .play-badge { position: absolute; right: 6px; bottom: 4px; color: #fff; font-size: 12px; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.card.attach .row { border-top: 1px solid var(--line2); } .card.attach .ficon { font-size: 22px; width: 32px; text-align: center; }
.card .ok { color: #16a34a; font-weight: 600; }

/* перемотка голосового протяжкой: полоска ловит палец, страница под ней не скроллится */
.voice .track { touch-action: none; position: relative; padding: 6px 0; box-sizing: content-box; background-clip: content-box; cursor: pointer; }
.voice .track .knob { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--accent-text); pointer-events: none; }

/* закрепы списком: размытие фона как у меню, плашка не выделяется при удержании */
.overlay.blur { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.pinned { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pins-sheet .row { border-top: 1px solid var(--line2); cursor: pointer; }
.pins-sheet .pin-text { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* мультивыбор */
.msg.selectable { cursor: pointer; padding-left: 34px; position: relative; }
.msg.selectable.mine { padding-left: 34px; }
.msg.selected { background: var(--active); border-radius: 12px; }
.msg .selbox { position: absolute; left: 6px; top: 50%; margin-top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); display: flex; align-items: center; justify-content: center; font-size: 13px; color: #111; box-sizing: border-box; }
.msg .selbox.on { background: var(--accent); border-color: var(--accent); }
.sel-bar { background: var(--panel); }
.sel-actions { display: flex; justify-content: space-around; padding: 8px 8px calc(6px + var(--sab)); }
.sel-act { background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 20px; padding: 4px 10px; }
.sel-act span { font-size: 11px; color: var(--muted); } .sel-act.danger { color: var(--danger); } .sel-act.danger span { color: var(--danger); } .sel-act:disabled { opacity: .35; cursor: default; }

/* 29.09: на компьютере текст сообщений выделяется мышкой (юзер: «нельзя скопировать кусочек текста или ссылку»).
   Глобальный user-select:none на body остаётся ради телефонов (долгое нажатие = наше меню). В режиме выбора сообщений выделение снова выключено. */
#app.desktop .bubble .text, #app.desktop .bubble .quote .ellipsis, #app.desktop .bubble .fwd, #app.desktop .bubble .file .ellipsis { -webkit-user-select: text; user-select: text; cursor: text; }
#app.desktop .bubble .text a { -webkit-user-drag: none; cursor: pointer; } /* иначе мышь тащит ссылку, а не выделяет её текст */
/* 09.10: выделение начинается с любого места ленты (поля пузыря, промежуток между сообщениями), а не только точно с буквы;
   служебное (имя, время, реакции, кнопки, картинки) не выделяется и в буфер не попадает; у строк имени и времени
   невыделяемы только сами надписи (.ns, дети .meta), пустое место строки начинает выделение. Можно протянуть через несколько сообщений. */
#app.desktop .messages { -webkit-user-select: text; user-select: text; }
#app.desktop .messages :is(.day, .sys, .sender .ns, .meta > *, .reacts, .thread-chip, .side-av, .selbox, .swipe-hint, .send-row, .voice, .ficon, .file .small, .quote b, .thread-head, .typing, button, img, video) { -webkit-user-select: none; user-select: none; }
#app.desktop .msg.selectable, #app.desktop .msg.selectable .bubble, #app.desktop .msg.selectable .bubble * { -webkit-user-select: none; user-select: none; cursor: default; }

/* вкладка «Уведомления» группы: переключатель под шапкой чата и подсказка вместо поля ввода */
.seg.room-tabs { padding-top: 0; border-bottom: 1px solid var(--line); }
.composer.bot-only { display: block; text-align: center; padding: 12px 16px; }

/* просмотр текстового файла на месте */
.textview { width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--panel); color: var(--text); border-radius: 14px; overflow: hidden; }
.textview .tv-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.textview pre { margin: 0; padding: 14px 16px; overflow: auto; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 15px; line-height: 1.5; user-select: text; }
.textview pre.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* новые ответы в тредах: кружок над кнопкой «вниз», число в списке чатов, строка списка тредов */
.jump.tjump { bottom: 128px; background: var(--accent); font-size: 18px; }
.jump.tjump .badge { background: #111; color: #fff; }
.badge.tbadge { margin-right: 4px; white-space: nowrap; }
.sheet .item.th-item { display: flex; align-items: center; gap: 10px; text-align: left; }

/* отправка: проценты и отмена загрузки файла, повтор неотправленного */
.send-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.send-row button { border: 0; background: transparent; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.send-row.fail span { color: #dc2626; }
.send-row .up-bar { flex: 1; min-width: 60px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.send-row .up-bar i { display: block; height: 100%; background: var(--accent); }

/* просмотр фото: листание */
.lbox .lb { cursor: pointer; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--sat, 0px)) 14px 10px; color: #fff; font-size: 14px; background: linear-gradient(rgba(0,0,0,.5), transparent); }
.lb-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 72px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-size: 34px; cursor: pointer; }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }
.lb-nav:hover, .lb-btn:hover { background: rgba(255,255,255,.28); }

/* полоска плеера голосовых */
.voice-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.voice-bar .vb-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--accent); color: #111; cursor: pointer; font-size: 12px; }
.voice-bar .vb-line { height: 3px; border-radius: 2px; background: var(--line); margin-top: 4px; overflow: hidden; }
.voice-bar .vb-line i { display: block; height: 100%; background: var(--accent); }

/* кто просмотрел: список в меню сообщения */
.viewers { max-height: 240px; overflow: auto; border-top: 1px solid var(--line2); }
.viewers .vrow { display: flex; align-items: center; gap: 10px; padding: 7px 14px; }

/* сворачивание звонка */
.call-min { position: absolute; top: calc(12px + var(--sat)); left: 14px; border: 0; border-radius: 10px; padding: 7px 12px; background: rgba(127,127,127,.22); color: inherit; font: inherit; font-size: 14px; cursor: pointer; z-index: 2; }
.call-pill { position: fixed; top: calc(8px + var(--sat)); left: 50%; transform: translateX(-50%); z-index: 69; display: flex; align-items: center; gap: 10px; width: min(460px, calc(100vw - 20px)); padding: 8px 10px 8px 14px; border-radius: 22px; background: #16a34a; color: #fff; font-size: 14px; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.call-pill .cp-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.22); color: #fff; cursor: pointer; }
.call-pill .cp-btn.red { background: #dc2626; } .call-pill .cp-btn.off { background: rgba(0,0,0,.35); }

/* GIF (KLIPY): вкладка в панели эмодзи и анимация в ленте */
.gif-tab { font-size: 11px; font-weight: 700; letter-spacing: .3px; border: 1.5px solid currentColor; border-radius: 6px; padding: 1px 4px; }
.gif-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.gif-bar { display: flex; align-items: center; gap: 6px; padding: 4px 0 6px; }
.gif-q { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.gif-bar .chip { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 10px; padding: 5px 9px; font-size: 13px; cursor: pointer; } .gif-bar .chip.on { background: var(--line); color: var(--text); }
.gif-by { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); }
.emoji-panel:has(.gif-pane) { max-height: min(340px, 45vh); } .emoji-panel .emoji-tabs { flex: 0 0 auto; }
.gif-grid { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; overflow-y: auto; flex: 1; min-height: 0; }
.gif-grid button { flex: 0 0 auto; height: 100px; padding: 0; border: 0; background: var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; }
.gif-grid img { display: block; height: 100%; width: auto; }
.gif-msg { padding: 16px; text-align: center; flex: 1 0 100%; }
.photo.gif { cursor: default; max-height: none; } .photo.gif.gif-st { object-fit: contain; border-radius: 0; }

/* форматирование текста (как в Telegram): панель стилей над полем, спойлер, моно, ссылка под словом */
.composer { position: relative; }
.fmt-bar { position: absolute; left: 8px; bottom: calc(100% - 2px); display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 40; }
.fmt-bar.at { position: fixed; left: auto; bottom: auto; }
.fmt-bar button { font: inherit; font-size: 14px; min-width: 30px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--text); cursor: pointer; white-space: nowrap; }
.fmt-bar button:hover { background: var(--line); }
.fmt-bar .b { font-weight: 700; } .fmt-bar .i { font-style: italic; } .fmt-bar .s { text-decoration: line-through; } .fmt-bar .u { text-decoration: underline; }
.fmt-bar .c { font-family: ui-monospace, Menlo, Consolas, monospace; } .fmt-bar .sp { background: var(--text); color: var(--panel); } .fmt-bar .sp:hover { opacity: .85; }
.fmt-bar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.text code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .93em; background: rgba(127,127,127,.18); border-radius: 4px; padding: 0 3px; }
.text .spoiler { background: var(--text); color: transparent; border-radius: 4px; cursor: pointer; user-select: none; -webkit-user-select: none; }
.text .spoiler * { color: transparent; } .text .spoiler.open { background: rgba(127,127,127,.18); color: inherit; user-select: text; -webkit-user-select: text; } .text .spoiler.open * { color: inherit; } .text .spoiler.open a { color: var(--link); }
.link-ov { align-items: center; } .link-dlg { border-radius: 18px; padding: 14px 14px 12px; display: grid; gap: 10px; margin: 0 16px; }
.link-dlg .title { font-weight: 600; } .link-dlg input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: var(--bg); color: var(--text); min-width: 0; }
.link-dlg .row-c { justify-content: flex-end; }
