/* Scoped messenger workspace. Platform navigation and other modules retain their styles. */
.communication-shell [hidden], [data-communication-entry][hidden] { display:none !important; }
body.communication-body { height:100dvh; overflow:hidden; }
.communication-body { --comm-bg:#0f1721; --comm-panel:#17212b; --comm-hover:#202b36; --comm-active:rgba(43, 82, 120, 0.4); --comm-bubble:#182533; --comm-own:#2b5278; --comm-text:#f5f5f5; --comm-muted:#7e8b98; --comm-line:rgba(255, 255, 255, 0.07); --comm-blue:#5288c1; --comm-ghost:#242f3d; --comm-meta-own:#8bb2df; }
[data-theme="light"] .communication-body { --comm-bg:#eef0f3; --comm-panel:#ffffff; --comm-hover:#f4f4f5; --comm-active:rgba(51, 144, 236, 0.12); --comm-bubble:#ffffff; --comm-own:#effdde; --comm-text:#000000; --comm-muted:#707579; --comm-line:#dfe1e5; --comm-blue:#3390ec; --comm-ghost:#f4f4f5; --comm-meta-own:#4fae4e; }
body[data-ui-version="new"] .communication-shell { height:100dvh; min-height:0; grid-template-rows:minmax(0,1fr); color:var(--comm-text); }
body[data-ui-version="new"] .communication-shell > .communication-workspace { grid-column:2; grid-row:1; min-height:0; height:100%; }
.communication-workspace { display:grid; grid-template-columns:340px minmax(0,1fr); gap:0; border:1px solid var(--comm-line); border-radius:14px; overflow:hidden; background:var(--comm-panel); }
.communication-workspace.has-drawer { grid-template-columns:320px minmax(0,1fr) 340px; }
.communication-info-drawer { display:flex; flex-direction:column; border-left:1px solid var(--comm-line); background:var(--comm-panel); overflow-y:auto; overflow-x:hidden; height:100%; min-width:0; }
.communication-drawer-header { height:64px; display:flex; align-items:center; justify-content:space-between; padding:0 16px; border-bottom:1px solid var(--comm-line); flex-shrink:0; }
.communication-drawer-header h3 { margin:0; font-size:16px; font-weight:600; }
.communication-drawer-profile { display:flex; flex-direction:column; align-items:center; text-align:center; padding:24px 16px; border-bottom:1px solid var(--comm-line); gap:8px; }
.communication-drawer-avatar { width:84px; height:84px; border-radius:50%; font-size:28px; }
.communication-drawer-name { font-size:17px; font-weight:650; margin:0; }
.communication-drawer-status { font-size:13px; color:var(--comm-muted); margin:0; }
.communication-drawer-section { padding:14px 16px; border-bottom:1px solid var(--comm-line); display:flex; flex-direction:column; gap:8px; }
.communication-drawer-section-title { font-size:12px; font-weight:600; text-transform:uppercase; color:var(--comm-blue); letter-spacing:0.5px; }
.communication-drawer-media-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:4px; max-height:220px; overflow-y:auto; }
.communication-drawer-media-grid img { width:100%; height:80px; object-fit:cover; border-radius:6px; cursor:pointer; }
.communication-drawer-media-grid img:hover { opacity:0.85; }
.communication-drawer-actions { padding:14px 16px; display:flex; flex-direction:column; gap:4px; }
.communication-drawer-actions button { display:flex; align-items:center; gap:10px; width:100%; min-height:40px; padding:8px 12px; border:0; border-radius:8px; background:transparent; color:var(--comm-text); font-size:13.5px; text-align:left; cursor:pointer; }
.communication-drawer-actions button:hover { background:var(--comm-hover); }
.communication-drawer-actions button.is-danger { color:#ef4444; }
.communication-list { min-width:0; min-height:0; display:flex; flex-direction:column; border-right:1px solid var(--comm-line); background:var(--comm-panel); }
.communication-sidebar-header { height:68px; display:flex; align-items:center; gap:12px; padding:8px 12px; flex-shrink:0; }
.communication-sidebar-header h1 { flex:1; font-size:20px; font-weight:650; margin:0; letter-spacing:-.3px; }
.communication-shell button { font-family:inherit; font-weight:500; cursor:pointer; }
.communication-shell button:disabled { cursor:default; opacity:.45; }
.communication-icon-button { display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; width:42px; height:42px; min-height:42px; padding:0; border:0; border-radius:50%; background:transparent; color:var(--comm-muted); list-style:none; cursor:pointer; }
.communication-icon-button::-webkit-details-marker { display:none; }
.communication-icon-button:hover { background:var(--comm-hover); color:var(--comm-text); }
.communication-shell svg { width:22px; height:22px; flex-shrink:0; }
.communication-shell :is(button,summary,a,input,textarea):focus-visible, #comm-dialog :is(button,input,select):focus-visible { outline:2px solid var(--comm-blue); outline-offset:2px; }
.communication-menu { position:relative; }
.communication-menu-panel { position:absolute; z-index:30; top:48px; left:0; width:270px; padding:8px; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-panel); box-shadow:0 12px 40px #0003; }
.communication-menu-panel > :is(button,a) { display:flex; align-items:center; gap:12px; width:100%; min-height:44px; text-align:left; padding:10px 12px; border:0; border-radius:8px; font-size:14px; color:var(--comm-text); text-decoration:none; background:transparent; }
.communication-menu-panel > :is(button,a):hover { background:var(--comm-hover); }
.communication-menu-panel .product-workspace-toolbar { position:static; min-height:44px; margin:4px 0 0; padding:4px 0 0; justify-content:flex-start; border:0; border-top:1px solid var(--comm-line); background:transparent; }
.communication-menu-panel .theme-control-button { border:0; width:100%; justify-content:flex-start; padding:10px 12px; color:var(--comm-text); }
.communication-list-search { margin:0 16px 8px; display:flex; align-items:center; gap:8px; padding:0 12px; height:42px; border-radius:22px; color:var(--comm-muted); background:var(--comm-ghost); }
body.communication-body .communication-list-search input { min-width:0; width:100%; border:0; border-radius:0; background:transparent !important; padding:8px 0; color:var(--comm-text); font-size:14px; outline-offset:0; }
.communication-folder-bar { display:flex; align-items:center; border-bottom:1px solid var(--comm-line); padding:0 8px; min-height:48px; }
#comm-folders { display:flex; flex:1; min-width:0; overflow-x:auto; scrollbar-width:none; gap:4px; }
#comm-folders button { position:relative; border:0; background:transparent; color:var(--comm-muted); height:48px; padding:0 12px; white-space:nowrap; font-size:14px; }
#comm-folders button[draggable="true"] { cursor:grab; }
#comm-folders button[draggable="true"]:active { cursor:grabbing; }
#comm-folders button[aria-selected="true"] { color:var(--comm-blue); }
#comm-folders button[aria-selected="true"]::after { content:""; position:absolute; height:3px; bottom:0; left:10px; right:10px; background:var(--comm-blue); border-radius:3px 3px 0 0; }
.communication-folder-bar > button { width:36px; height:40px; min-height:40px; }
.communication-dialog-list { flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:4px 8px; }
.communication-room { position:relative; display:flex; align-items:center; gap:12px; text-align:left; width:100%; min-height:80px; padding:10px 10px; border:0; border-radius:8px; background:transparent; color:var(--comm-text); transition:background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease; }
.communication-room:hover:not([aria-current="true"]) { background:var(--comm-hover); }
.communication-room[aria-current="true"] { background:var(--accent-soft, rgba(34, 111, 220, 0.1)) !important; color:var(--comm-text) !important; box-shadow:inset 3px 0 0 var(--comm-blue, var(--accent)) !important; }
.communication-avatar { display:flex; align-items:center; justify-content:center; flex-shrink:0; width:52px; height:52px; border-radius:50%; overflow:hidden; background:#5687ba; color:#fff; font-size:19px; font-weight:600; }
.communication-avatar-saved { background:var(--comm-blue) !important; color:#fff !important; }
.communication-avatar-saved svg { width:24px; height:24px; }
.communication-avatar img, .communication-profile-avatar img, .communication-message-avatar img { width:100%; height:100%; border-radius:50%; object-fit:cover; }
.communication-room-copy { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.communication-room-top, .communication-room-bottom { display:flex; align-items:center; gap:6px; min-width:0; }
.communication-room-title { flex:1; min-width:0; font-size:15px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.communication-room-time { flex-shrink:0; font-size:11px; color:var(--comm-muted); }
.communication-room-preview { flex:1; min-width:0; font-size:13px; color:var(--comm-muted); overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.communication-unread { min-width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; padding:0 6px; border-radius:20px; font-size:11px; background:var(--comm-blue); color:#fff; }
.communication-push-prompt { margin:0 18px 12px; padding:12px; display:grid; grid-template-columns:24px 1fr auto; gap:10px; align-items:center; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-panel); color:var(--comm-text); }
.communication-push-prompt[hidden] { display:none; }
.communication-push-prompt svg { width:22px; height:22px; color:var(--comm-blue); }
.communication-push-prompt strong { display:block; font-size:13px; }
.communication-push-prompt p { margin:2px 0 0; color:var(--comm-muted); font-size:11px; line-height:1.35; }
.communication-push-prompt button { border:0; border-radius:9px; padding:8px 10px; background:var(--comm-blue); color:#fff; font-weight:700; cursor:pointer; }
.communication-folder-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:8px 0; }
.communication-folder-controls strong { flex:1; }
#comm-folders .is-drop-target { outline:2px solid var(--comm-blue); outline-offset:-2px; }
#comm-folders .communication-unread { margin-left:6px; }
.communication-invitation-card { margin:6px 2px; padding:12px; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-ghost); color:var(--comm-text); }
.communication-invitation-card strong { display:block; font-size:14px; }
.communication-invitation-card p { margin:5px 0 8px; color:var(--comm-muted); font-size:12px; line-height:1.4; }
.communication-invitation-actions { display:flex; flex-wrap:wrap; gap:5px; }
.communication-invitation-actions button { flex:1; min-width:92px; margin:0; }
.communication-room-muted { width:14px !important; height:14px !important; color:var(--comm-muted); }
.communication-room-pinned { width:14px !important; height:14px !important; color:var(--comm-muted); transform:rotate(45deg); flex-shrink:0; }
.communication-room[aria-current="true"] .communication-room-pinned { color:var(--comm-blue); }
.communication-thread { position:relative; display:flex; flex-direction:column; min-height:0; min-width:0; background-color:var(--comm-bg); background-image:radial-gradient(ellipse at top right,#57978612,transparent 65%),radial-gradient(circle,#76958915 1px,transparent 1px); background-size:auto,24px 24px; }
.communication-thread-header { display:flex; align-items:center; gap:12px; min-height:68px; padding:10px 20px; background:var(--comm-panel); border-bottom:1px solid var(--comm-line); flex-shrink:0; }
.communication-thread-header .communication-avatar { width:42px; height:42px; font-size:16px; }
.communication-thread-identity { flex:1; min-width:0; }
.communication-thread-identity h2 { margin:0; font-size:16px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.communication-thread-identity p { margin:3px 0 0; font-size:12px; color:var(--comm-muted); }

/* Закрепленное сообщение под шапкой (Telegram Pinned Bar) */
.communication-pinned-bar { display:flex; align-items:center; gap:10px; padding:8px 16px; background:var(--comm-panel); border-bottom:1px solid var(--comm-line); cursor:pointer; user-select:none; transition:background 0.15s ease; flex-shrink:0; }
.communication-pinned-bar:hover { background:var(--comm-hover); }
.communication-pinned-bar-line { width:3px; height:32px; background:var(--comm-blue); border-radius:2px; flex-shrink:0; }
.communication-pinned-bar-content { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.communication-pinned-bar-title { font-size:12px; font-weight:600; color:var(--comm-blue); }
.communication-pinned-bar-text { font-size:13px; color:var(--comm-text); opacity:0.85; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.communication-pinned-bar-close { width:28px; height:28px; display:flex; align-items:center; justify-content:center; border:0; background:transparent; color:var(--comm-muted); border-radius:50%; cursor:pointer; flex-shrink:0; }
.communication-pinned-bar-close:hover { background:var(--comm-hover); color:var(--comm-text); }

/* Индикатор набора текста Telegram (Typing...) */
.communication-typing-status { color:var(--comm-blue); display:inline-flex; align-items:center; gap:4px; font-size:12px; font-weight:500; }
.communication-typing-dots { display:inline-flex; gap:2.5px; margin-right:2px; }
.communication-typing-dots span { width:3.5px; height:3.5px; background:var(--comm-blue); border-radius:50%; animation:commTypingDot 1.4s infinite ease-in-out both; }
.communication-typing-dots span:nth-child(1) { animation-delay:-0.32s; }
.communication-typing-dots span:nth-child(2) { animation-delay:-0.16s; }
@keyframes commTypingDot {
    0%, 80%, 100% { transform:scale(0); opacity:0.3; }
    40% { transform:scale(1.15); opacity:1; }
}

.communication-messages { flex:1; min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; padding:16px max(16px,calc((100% - 760px)/2)); display:flex; flex-direction:column; gap:8px; scroll-behavior:auto; }
.communication-date { align-self:center; margin:8px 0 10px; padding:4px 14px; border-radius:18px; background:rgba(0,0,0,0.28); color:#fff; font-size:12px; font-weight:500; backdrop-filter:blur(10px); }
[data-theme="light"] .communication-date { background:rgba(0,0,0,0.18); color:#fff; }

/* Telegram Speech Bubbles & Grouping */
.communication-message { position:relative; align-self:flex-start; width:fit-content; min-width:96px; max-width:min(540px,85%); padding:7px 10px 5px; border-radius:16px 16px 16px 4px; background:var(--comm-bubble); box-shadow:0 1px 2px rgba(0,0,0,0.18); overflow-wrap:anywhere; transition:transform 0.12s ease-out; touch-action:pan-y; cursor:pointer; }
.communication-message.is-middle { border-radius:4px 16px 16px 4px; margin-top:-4px; }
.communication-message.is-last { border-radius:4px 16px 16px 4px; margin-top:-4px; }
.communication-message.has-tail:not(.is-own)::after { content:""; position:absolute; left:-6px; bottom:0; width:10px; height:14px; background:inherit; clip-path:polygon(100% 0, 100% 100%, 0 100%); }

.communication-message.is-own { align-self:flex-end; background:var(--comm-own); border-radius:16px 16px 4px 16px; color:#fff; }
[data-theme="light"] .communication-message.is-own { color:#000; }
.communication-message.is-own.is-middle { border-radius:16px 4px 4px 16px; margin-top:-4px; }
.communication-message.is-own.is-last { border-radius:16px 4px 4px 16px; margin-top:-4px; }
.communication-message.is-own.has-tail::after { content:""; position:absolute; right:-6px; bottom:0; width:10px; height:14px; background:inherit; clip-path:polygon(0 0, 100% 100%, 0 100%); }

.communication-message.has-author-avatar { margin-left:36px; }
.communication-message-avatar { position:absolute; left:-36px; bottom:0; display:flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:50%; overflow:hidden; background:#5687ba; color:#fff; font-size:10px; font-weight:700; }
.communication-message-author { display:block; color:var(--comm-blue); font-size:12.5px; font-weight:600; margin:0 16px 3px 0; }
.communication-message-author small { color:var(--comm-muted); font-size:10.5px; font-weight:500; }

.communication-formatted-text { min-width:0; padding-right:4px; font-size:14.5px; line-height:1.45; overflow-wrap:anywhere; display:inline; }
.communication-formatted-text > :first-child { margin-top:0; }
.communication-formatted-text > :last-child { margin-bottom:0; }
.communication-formatted-text p { margin:0 0 3px; display:inline; white-space:pre-wrap; }
.communication-formatted-text ul,.communication-formatted-text ol { margin:4px 0 6px; padding-left:20px; display:block; }
.communication-formatted-text blockquote { margin:4px 0 6px; padding:4px 8px; border-left:3px solid var(--comm-blue); border-radius:3px; background:rgba(51, 144, 236, 0.12); display:block; }
.communication-formatted-text a { color:var(--comm-blue); text-decoration:underline; text-underline-offset:2px; }
.communication-formatted-text code { padding:1px 4px; border-radius:4px; background:color-mix(in srgb,currentColor 12%,transparent); color:inherit; font:12px/1.4 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.communication-formatted-text pre { max-width:100%; overflow-x:auto; margin:4px 0; padding:8px; border-radius:6px; background:color-mix(in srgb,currentColor 10%,transparent); white-space:pre; display:block; }
.communication-formatted-text pre code { padding:0; background:transparent; }

/* Компактный мета-блок Telegram (Время + Галочки) в правом нижнем углу */
.communication-message-meta { display:inline-flex; align-items:baseline; gap:4px; float:right; margin-left:8px; margin-top:4px; position:relative; bottom:-1px; font-size:11px; line-height:1; color:var(--comm-muted); user-select:none; }
.communication-message.is-own .communication-message-meta { color:var(--comm-meta-own); }
.communication-message-meta button { border:0; background:transparent; color:inherit; font:inherit; padding:0 2px; cursor:pointer; }
.communication-message-meta button:hover { opacity:0.8; }
.communication-message-meta span[aria-label] { font-size:11px; font-weight:600; }

/* Скрытие постоянной кнопки с тремя точками */
.communication-message-menu > summary { display:none !important; }
.communication-message-menu { position:static; }

/* Контекстное меню Telegram с быстрыми реакциями */
.communication-context-menu {
    position: fixed;
    z-index: 100;
    min-width: 210px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid var(--comm-line);
    border-radius: 14px;
    background: var(--comm-panel);
    box-shadow: 0 16px 48px -4px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(28px);
    animation: commMenuPop 0.12s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes commMenuPop {
    from { opacity: 0; transform: scale(0.92) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.communication-quick-reactions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--comm-line);
    overflow-x: auto;
}
.communication-quick-reaction-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 0;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.12s ease;
}
.communication-quick-reaction-btn:hover {
    transform: scale(1.35) translateY(-3px);
    background: var(--comm-hover);
}
.communication-context-item {
    border: 0;
    text-align: left;
    padding: 8px 12px;
    background: transparent;
    color: var(--comm-text);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    transition: background 0.12s ease, color 0.12s ease;
}
.communication-context-item:hover {
    background: var(--comm-hover);
    color: var(--comm-blue);
}
.communication-context-item .comm-item-icon {
    width: 17px;
    height: 17px;
    color: var(--comm-muted);
    opacity: 0.85;
    flex-shrink: 0;
    transition: color 0.12s ease, opacity 0.12s ease;
}
.communication-context-item:hover .comm-item-icon {
    color: var(--comm-blue);
    opacity: 1;
}
.communication-context-separator {
    height: 1px;
    background: var(--comm-line);
    margin: 4px 2px;
}
.communication-context-item.is-danger {
    color: #f43f5e;
}
.communication-context-item.is-danger .comm-item-icon {
    color: #f43f5e;
}
.communication-context-item.is-danger:hover {
    background: rgba(244, 63, 94, 0.12);
    color: #f43f5e;
}

/* Свайп влево для ответа */
.communication-message.is-swiping { transition:none; }
.communication-swipe-icon { position:absolute; right:-34px; top:50%; transform:translateY(-50%) scale(0.8); width:28px; height:28px; border-radius:50%; background:var(--comm-blue); color:#fff; display:flex; align-items:center; justify-content:center; opacity:0; transition:opacity 0.15s ease, transform 0.15s ease; pointer-events:none; }
.communication-swipe-icon.is-active { opacity:1; transform:translateY(-50%) scale(1.1); }

/* Подсветка сообщения (Flash) при переходе по закрепу или цитате */
.communication-message-flash { animation:commFlash 1.4s ease-out; }
@keyframes commFlash {
    0%, 100% { box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
    30%, 70% { box-shadow: 0 0 0 3px var(--comm-blue), 0 6px 20px rgba(51, 144, 236, 0.45); }
}

.communication-message-reply { display:block; border-left:3px solid var(--comm-blue); background:rgba(51, 144, 236, 0.1); border-radius:4px; padding:4px 8px; margin:0 0 5px 0; font-size:12px; color:var(--comm-muted); white-space:pre-wrap; cursor:pointer; }
.communication-message-reply:hover { opacity:0.85; }
.communication-attachment { display:flex; align-items:center; gap:8px; max-width:100%; padding:10px 8px; margin:4px 0; border:0; border-radius:8px; background:#3390ec12; color:var(--comm-text); font-size:12px; overflow-wrap:anywhere; text-align:left; }
.communication-attachment img { display:block; max-width:100%; max-height:300px; border-radius:8px; object-fit:contain; }

/* Telegram Voice Message Player */
.communication-voice-player { display:flex; align-items:center; gap:10px; padding:6px 4px; min-width:240px; max-width:320px; user-select:none; }
.communication-voice-play-btn { width:38px; height:38px; min-width:38px; border-radius:50%; border:0; background:var(--comm-blue); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform 0.15s ease, background 0.15s ease; }
.communication-voice-play-btn:hover { transform:scale(1.06); }
.communication-voice-play-btn svg { width:18px; height:18px; }
.communication-voice-body { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; }
.communication-voice-waveform { display:flex; align-items:center; gap:2px; height:24px; cursor:pointer; padding:2px 0; }
.communication-voice-bar { width:2.5px; border-radius:1.5px; background:rgba(255,255,255,0.3); transition:background 0.12s ease; }
[data-theme="light"] .communication-voice-bar { background:rgba(0,0,0,0.22); }
.communication-voice-bar.is-played { background:var(--comm-blue); }
.communication-message.is-own .communication-voice-bar.is-played { background:#fff; }
[data-theme="light"] .communication-message.is-own .communication-voice-bar.is-played { background:var(--comm-blue); }
.communication-voice-meta-row { display:flex; align-items:center; justify-content:space-between; font-size:11px; color:var(--comm-muted); }
.communication-voice-rate-btn { border:0; background:rgba(255,255,255,0.12); color:inherit; font-size:10px; font-weight:600; padding:1px 5px; border-radius:4px; cursor:pointer; }
.communication-voice-rate-btn:hover { background:rgba(255,255,255,0.25); }

/* Запись голосового сообщения (Voice Recording Bar) */
.communication-voice-recording { display:flex; align-items:center; gap:12px; padding:6px 12px; border-radius:12px; background:var(--comm-hover); margin-top:4px; animation:commFadeIn 0.2s ease-out; }
@keyframes commFadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
.communication-voice-rec-dot { width:10px; height:10px; border-radius:50%; background:#ef4444; flex-shrink:0; animation:commBlink 1s infinite alternate; }
@keyframes commBlink { from { opacity:1; transform:scale(1); } to { opacity:0.3; transform:scale(0.8); } }
.communication-voice-timer { font-size:13.5px; font-weight:600; font-variant-numeric:tabular-nums; color:var(--comm-text); flex-shrink:0; }
.communication-voice-live-wave { flex:1; height:20px; display:flex; align-items:center; gap:2.5px; overflow:hidden; }
.communication-voice-live-bar { width:3px; height:8px; background:var(--comm-blue); border-radius:1.5px; animation:commLiveWave 0.8s infinite ease-in-out alternate; }
@keyframes commLiveWave { from { height:4px; } to { height:20px; } }
.communication-voice-btn { color:var(--comm-muted); }
.communication-voice-btn:hover { color:var(--comm-blue); }
.communication-message.has-images { width:min(520px,84%); padding:4px; }
.communication-message-media { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:2px; overflow:hidden; border-radius:9px; margin-bottom:4px; }
.communication-message-media > img { display:block; width:100%; height:190px; object-fit:cover; background:#0000000a; image-rendering:-webkit-optimize-contrast; transform:translateZ(0); }
.communication-message-media[data-count="1"] { display:block; }
.communication-message-media[data-count="1"] > img { height:auto; max-height:520px; object-fit:contain; }
.communication-message-media.is-odd:not(.is-many) > img:first-child { grid-column:1 / -1; height:260px; }
.communication-message-media.is-many { grid-template-columns:repeat(3,minmax(0,1fr)); }
.communication-message-media.is-many > img { height:130px; }
.communication-message-media > img { cursor:pointer; transition:filter 0.12s ease; }
.communication-message-media > img:hover { filter:brightness(0.92); }

/* Карусель медиа в чате */
.communication-carousel {
    position: relative;
    width: 100%;
    margin-bottom: 4px;
    border-radius: 12px;
    overflow: hidden;
    user-select: none;
    background: #000;
    transform: translateZ(0);
}
.communication-carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0;
    padding: 0;
}
.communication-carousel-track::-webkit-scrollbar {
    display: none;
}
.communication-carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    max-height: 480px;
    background: #000;
    overflow: hidden;
}
.communication-carousel-slide img {
    width: 100%;
    height: 100%;
    max-height: 480px;
    object-fit: contain;
    display: block;
    cursor: pointer;
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
    transition: transform 0.15s ease;
}
.communication-carousel-slide img:hover {
    transform: scale(1.01);
}
.communication-carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.18s ease;
    z-index: 5;
    opacity: 0.85;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.communication-carousel:hover .communication-carousel-nav-btn {
    opacity: 1;
}
.communication-carousel-nav-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: translateY(-50%) scale(1.1);
}
.communication-carousel-nav-btn.is-prev { left: 8px; }
.communication-carousel-nav-btn.is-next { right: 8px; }
.communication-carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    pointer-events: none;
}
.communication-carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.2s ease;
}
.communication-carousel-dot.is-active {
    background: #fff;
    width: 14px;
    border-radius: 4px;
}
.communication-carousel-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* Telegram Media Lightbox (Полноэкранный просмотрщик) */
.communication-media-viewer { position:fixed; inset:0; z-index:9999; background:rgba(10, 14, 20, 0.94); backdrop-filter:blur(24px); display:flex; flex-direction:column; animation:commViewerFade 0.18s ease-out; }
@keyframes commViewerFade { from { opacity:0; } to { opacity:1; } }
.communication-media-viewer-header { height:56px; display:flex; align-items:center; justify-content:space-between; padding:0 20px; color:#fff; flex-shrink:0; border-bottom:1px solid rgba(255,255,255,0.08); }
.communication-media-viewer-counter { font-size:14px; font-weight:500; opacity:0.85; }
.communication-media-viewer-actions { display:flex; align-items:center; gap:8px; }
.communication-media-viewer-actions button { width:36px; height:36px; border-radius:50%; border:0; background:rgba(255,255,255,0.1); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:background 0.15s ease; }
.communication-media-viewer-actions button:hover { background:rgba(255,255,255,0.22); }
.communication-media-viewer-stage { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; position:relative; padding:16px; user-select:none; }
.communication-media-viewer-stage img,
.communication-media-viewer-stage video {
    max-width:92vw;
    max-height:76vh;
    object-fit:contain;
    border-radius:8px;
    box-shadow:0 12px 48px rgba(0,0,0,0.6);
    image-rendering:-webkit-optimize-contrast;
    transform:translateZ(0);
}
.communication-media-viewer-stage video {
    background: #000;
    outline: none;
}
.communication-media-viewer-thumbs {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}
.communication-media-viewer-thumbs::-webkit-scrollbar {
    display: none;
}
.communication-media-viewer-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    flex-shrink: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.communication-media-viewer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.communication-media-viewer-thumb:hover {
    opacity: 0.85;
}
.communication-media-viewer-thumb.is-active {
    opacity: 1;
    border-color: #2481cc;
    box-shadow: 0 0 12px rgba(36, 129, 204, 0.6);
}
.communication-media-viewer-nav-btn { position:absolute; top:50%; transform:translateY(-50%); width:48px; height:48px; border-radius:50%; border:0; background:rgba(0,0,0,0.4); color:#fff; display:flex; align-items:center; justify-content:center; cursor:pointer; backdrop-filter:blur(8px); transition:background 0.15s ease, transform 0.15s ease; z-index: 10; }
.communication-media-viewer-nav-btn:hover { background:rgba(0,0,0,0.7); transform:translateY(-50%) scale(1.08); }
.communication-media-viewer-nav-btn.is-prev { left:24px; }
.communication-media-viewer-nav-btn.is-next { right:24px; }
.communication-message.has-images > .communication-formatted-text { margin:2px 6px 1px; padding:3px 26px 2px 2px; }
.communication-message.has-images > .communication-attachment { margin:5px 4px; }
.communication-message.has-images > .communication-message-meta { padding:0 5px; }
.communication-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:24px; color:var(--comm-muted); font-size:14px; }
.communication-empty .communication-empty-icon { width:80px; height:80px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:#ffffff0c; margin-bottom:16px; }
.communication-empty-icon svg { width:36px; height:36px; }
.communication-empty strong { font-size:16px; color:var(--comm-text); }
.communication-empty p { max-width:260px; margin:8px 0; line-height:1.6; }
.communication-compose {
    position: relative;
    flex-shrink: 0;
    margin: 8px auto 16px;
    width: calc(100% - 32px);
    max-width: 760px;
    border-radius: 24px;
    background: var(--comm-panel);
    padding: 4px 8px;
    border: 1px solid var(--comm-line);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.communication-compose:focus-within {
    border-color: rgba(51, 144, 236, 0.5) !important;
    outline: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16) !important;
}
.communication-format-toolbar { display:none; align-items:center; gap:2px; padding:4px 8px 1px; border-bottom:1px solid var(--comm-line); overflow-x:auto; }
.communication-format-toolbar:not([hidden]) { display:flex; }
.communication-format-toolbar[hidden] { display:none !important; }
.communication-format-toolbar button { display:flex; align-items:center; justify-content:center; min-width:30px; height:28px; border:0; border-radius:6px; background:transparent; color:var(--comm-muted); font-size:13px; cursor:pointer; }
.communication-format-toolbar button:hover,.communication-format-toolbar button:focus-visible { background:var(--comm-hover); color:var(--comm-blue); }
.communication-format-toolbar svg { width:15px; height:15px; }
.communication-toolbar-expand-btn { display:flex; align-items:center; justify-content:center; min-width:30px; height:28px; border:0; border-radius:6px; background:transparent; color:var(--comm-muted); font-size:13px; cursor:pointer; }
.communication-toolbar-expand-btn:hover,.communication-toolbar-expand-btn:focus-visible { background:var(--comm-hover); color:var(--comm-blue); }
.communication-toolbar-expand-btn svg { width:15px; height:15px; }
.communication-expand-btn { color:var(--comm-muted); }
.communication-expand-btn:hover { color:var(--comm-blue); }
.communication-compose.is-expanded { box-shadow:0 12px 36px #0004; border-radius:16px; }
.communication-compose.is-expanded [contenteditable] { min-height:180px; max-height:min(50vh,360px); }
.communication-composer-row { display:flex; align-items:center; gap:4px; padding:2px 4px; }
.communication-composer-row [contenteditable] { flex:1; min-width:0; border:0; outline:none !important; box-shadow:none !important; resize:none; background:transparent; color:var(--comm-text); font:inherit; font-size:14.5px; line-height:22px; min-height:38px; max-height:160px; padding:8px 8px; overflow-y:auto; }
.communication-composer-row [contenteditable]:focus,.communication-composer-row [contenteditable]:focus-visible,#comm-text:focus,#comm-text:focus-visible { outline:none !important; border:none !important; box-shadow:none !important; }
.communication-composer-row .communication-icon-button { margin-bottom:0; width:38px; height:38px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; color:var(--comm-muted); background:transparent; border:0; cursor:pointer; transition:color 0.15s ease, background 0.15s ease; }
.communication-composer-row .communication-icon-button:hover { color:var(--comm-blue); background:var(--comm-hover); }
.communication-composer-row .communication-icon-button svg { width:20px; height:20px; }
.communication-send { display:flex; align-items:center; justify-content:center; border:0; border-radius:50%; width:38px; height:38px; flex-shrink:0; background:var(--comm-blue); color:#fff; padding:0; cursor:pointer; transition:transform 0.15s ease, background 0.15s ease; }
.communication-send:hover { transform:scale(1.06); }
.communication-send:active { transform:scale(0.94); }
.communication-send svg { width:18px; height:18px; }
#comm-reply { display:flex; align-items:center; justify-content:space-between; gap:8px; border-left:3px solid var(--comm-blue); background:#3390ec0d; color:var(--comm-blue); font-size:13px; padding:8px 12px; margin:6px 8px; border-radius:4px; }
#comm-reply button { border:0; background:transparent; color:var(--comm-muted); font-size:12px; }
#comm-files { padding:0 8px; font-size:12px; }
.communication-draft-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(132px,1fr)); gap:8px; padding:8px 0 4px; max-height:250px; overflow-y:auto; }
.communication-draft-item { position:relative; display:grid; grid-template-rows:96px auto; min-width:0; overflow:hidden; border:1px solid var(--comm-line); border-radius:10px; background:var(--comm-hover); color:var(--comm-text); }
.communication-draft-item > img { width:100%; height:96px; object-fit:cover; background:var(--comm-bg); }
.communication-draft-file-icon { display:flex; align-items:center; justify-content:center; height:96px; color:var(--comm-blue); }
.communication-draft-file-icon svg { width:28px; height:28px; }
.communication-draft-meta { display:flex; min-width:0; flex-direction:column; gap:2px; padding:7px 30px 8px 8px; }
.communication-draft-meta strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.communication-draft-meta small { color:var(--comm-muted); }
.communication-draft-remove { position:absolute; top:5px; right:5px; display:flex; align-items:center; justify-content:center; width:28px; height:28px; border:0; border-radius:50%; background:#0e1621cc; color:#fff; font-size:20px; line-height:1; }
.communication-draft-remove:disabled { opacity:.5; }
@media (max-width:700px) {
  .communication-draft-grid { grid-template-columns:repeat(3,minmax(0,1fr)); max-height:224px; }
  .communication-draft-item { grid-template-rows:74px auto; }
  .communication-draft-item > img,.communication-draft-file-icon { height:74px; }
  .communication-draft-meta { padding:6px 26px 7px 6px; font-size:11px; }
  .communication-draft-remove { width:24px; height:24px; font-size:18px; }
}
.communication-delivery:not(:empty) { display:block; padding:0 12px 4px; color:var(--comm-muted); font-size:11px; }
#comm-emoji-panel {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    width: min(380px, calc(100vw - 32px));
    height: 380px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--comm-line);
    border-radius: 16px;
    background: var(--comm-panel);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(24px);
    z-index: 60;
    overflow: hidden;
    animation: commEmojiPop 0.14s ease-out;
}
@keyframes commEmojiPop {
    from { opacity: 0; transform: scale(0.94) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.comm-emoji-search {
    margin: 10px 12px 6px;
    padding: 7px 12px;
    border: 1px solid var(--comm-line);
    border-radius: 18px;
    background: var(--comm-hover);
    color: var(--comm-text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
}
.comm-emoji-search:focus {
    border-color: var(--comm-blue);
}
.comm-emoji-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-bottom: 1px solid var(--comm-line);
    overflow-x: auto;
    flex-shrink: 0;
}
.comm-emoji-tab-btn {
    flex: 1;
    height: 34px;
    border: 0;
    background: transparent;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s ease, transform 0.12s ease;
    opacity: 0.65;
}
.comm-emoji-tab-btn:hover {
    opacity: 1;
    background: var(--comm-hover);
    transform: scale(1.1);
}
.comm-emoji-tab-btn.is-active {
    opacity: 1;
    background: rgba(51, 144, 236, 0.18);
}
.comm-emoji-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px 10px;
}
.comm-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.comm-emoji-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 0;
    background: transparent;
    font-size: 23px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.12s ease;
}
.comm-emoji-btn:hover {
    transform: scale(1.25);
    background: var(--comm-hover);
}
.communication-reactions { display:inline-flex; flex-wrap:wrap; gap:4px; margin:4px 0 2px; }
.communication-reaction { display:inline-flex; align-items:center; gap:3px; min-height:24px; padding:2px 8px; border:1px solid rgba(255,255,255,0.08); border-radius:12px; background:rgba(0,0,0,0.18); color:var(--comm-text); font-size:12px; line-height:1; cursor:pointer; user-select:none; transition:transform 0.1s ease, background 0.1s ease; }
[data-theme="light"] .communication-reaction { background:rgba(0,0,0,0.06); border-color:rgba(0,0,0,0.08); }
.communication-reaction:hover { transform:scale(1.06); background:var(--comm-hover); }
.communication-reaction.is-chosen { border-color:var(--comm-blue); background:rgba(51, 144, 236, 0.25); color:var(--comm-blue); font-weight:600; }
.communication-reaction-add { display:none !important; }

/* Telegram Reaction & Read Popovers */
.communication-reaction-popover,
.communication-read-popover {
    position: fixed;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid var(--comm-line);
    background: var(--comm-panel);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(28px);
    font-size: 12.5px;
    color: var(--comm-text);
    pointer-events: auto;
    animation: commPopoverPop 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 240px;
}
@keyframes commPopoverPop {
    from { opacity: 0; transform: scale(0.92) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.comm-popover-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}
.comm-popover-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    overflow: hidden;
    background: #5687ba;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comm-popover-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-popover-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--comm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comm-popover-time {
    margin-left: auto;
    font-size: 11px;
    color: var(--comm-muted);
}
.comm-popover-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--comm-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--comm-line);
    margin-bottom: 2px;
}
.communication-message-meta .communication-tick {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: inherit;
    cursor: default;
    user-select: none;
    transition: opacity 0.12s ease;
}
.communication-message-meta .communication-tick.is-clickable {
    cursor: pointer;
}
.communication-message-meta .communication-tick.is-clickable:hover {
    opacity: 0.8;
}
.communication-room-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--comm-panel);
    flex-shrink: 0;
}
.communication-room-preview .comm-preview-tick {
    color: var(--comm-blue);
    font-weight: 700;
    margin-right: 3px;
}
.communication-comments-button { display:flex; align-items:center; gap:5px; min-height:28px; margin:4px 0 1px; padding:2px 4px; border:0; background:transparent; color:var(--comm-blue); font-size:12px; font-weight:600; cursor:pointer; }
.communication-comments-button svg { width:15px; height:15px; }
.communication-reaction-picker { display:grid; grid-template-columns:repeat(4,minmax(54px,1fr)); gap:8px; }
#comm-dialog .communication-reaction-picker button { min-height:50px; margin:0; font-size:24px; }
.communication-comments-list { display:flex; flex-direction:column; gap:10px; max-height:52dvh; overflow-y:auto; padding:2px; }
.communication-comment { display:grid; grid-template-columns:36px minmax(0,1fr); gap:9px; padding:9px; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-ghost); }
.communication-comment-avatar,.communication-member-avatar { display:flex; align-items:center; justify-content:center; width:36px; height:36px; overflow:hidden; border-radius:50%; background:#5687ba; color:#fff; font-size:12px; font-weight:700; }
.communication-comment-avatar img,.communication-member-avatar img { width:100%; height:100%; object-fit:cover; }
.communication-comment-body { min-width:0; }
.communication-comment-head { display:flex; align-items:baseline; gap:6px; min-width:0; }
.communication-comment-head strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.communication-comment-head small,.communication-comment-head time { color:var(--comm-muted); font-size:10px; }
.communication-comment-head time { margin-left:auto; white-space:nowrap; }
.communication-comment .communication-formatted-text { padding:3px 0 0; }
#comm-dialog .communication-comment-body > button { min-height:28px; margin:2px 0 0; padding:3px 7px; font-size:11px; }
.communication-comments-empty { color:var(--comm-muted); text-align:center; }
.communication-comment-form { display:grid; gap:8px; margin-top:12px; }
#comm-dialog textarea { width:100%; min-width:0; padding:10px; border:1px solid var(--border); border-radius:8px; resize:vertical; background:var(--surface); color:var(--text); font:inherit; }
.communication-settings-form h3 { margin:18px 0 8px; font-size:14px; }
#comm-dialog .communication-checkbox { display:flex; align-items:center; gap:9px; margin:7px 0; }
#comm-dialog .communication-checkbox input { width:24px; height:24px; flex:0 0 24px; margin:0; accent-color:var(--comm-blue); }
.communication-reaction-settings { display:grid; grid-template-columns:repeat(4,1fr); gap:4px; }
.communication-reaction-settings .communication-checkbox { justify-content:center; padding:6px; border:1px solid var(--comm-line); border-radius:8px; }
.communication-member-list { display:flex; flex-direction:column; gap:7px; }
.communication-member-card { display:grid; grid-template-columns:40px minmax(0,1fr) auto; align-items:center; gap:9px; padding:8px; border:1px solid var(--comm-line); border-radius:11px; }
.communication-member-copy { display:flex; min-width:0; flex-direction:column; gap:2px; }
.communication-member-copy strong,.communication-member-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.communication-member-copy small { color:var(--comm-muted); font-size:11px; }
#comm-dialog .communication-member-card > button { margin:0; }
.communication-search { display:flex; align-items:center; gap:8px; padding:8px 20px; background:var(--comm-panel); border-bottom:1px solid var(--comm-line); }
.communication-search input { flex:1; min-width:0; border:1px solid var(--comm-line); border-radius:8px; padding:8px; background:var(--comm-ghost); color:var(--comm-text); }
.communication-search button { font-size:12px; }
.communication-history-button { align-self:center; border:0; background:var(--comm-panel); color:var(--comm-blue); border-radius:20px; padding:6px 14px; font-size:12px; margin:8px 0 0; }
#communication-notice:not(:empty) { position:fixed; z-index:50; top:80px; right:24px; left:min(470px,35vw); border-radius:10px; box-shadow:0 4px 20px #0003; padding:8px 16px; background:var(--comm-panel); border-bottom:1px solid var(--comm-line); color:var(--comm-text); font-size:13px; }
.communication-sr { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.communication-dialog-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--comm-line); }
.communication-dialog-header h2 { font-size:18px; font-weight:600; margin:0; color:var(--comm-text); }
.communication-dialog-close { width:32px; height:32px; border-radius:50%; border:0; background:transparent; color:var(--comm-muted); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; transition:background 0.15s ease, color 0.15s ease; padding:0; }
.communication-dialog-close:hover { background:var(--comm-hover); color:var(--comm-text); }
.communication-dialog-close svg { width:18px; height:18px; }

#comm-dialog { width:min(500px,calc(100vw - 24px)); max-height:85dvh; overflow-y:auto; padding:20px 24px; border:1px solid var(--comm-line); border-radius:18px; background:var(--comm-panel); color:var(--comm-text); box-shadow:0 24px 64px rgba(0,0,0,0.45); backdrop-filter:blur(32px); }
#comm-dialog [hidden] { display:none !important; }
#comm-dialog::backdrop { background:rgba(0,0,0,0.6); backdrop-filter:blur(4px); }
#comm-dialog input, #comm-dialog select { width:100%; min-width:0; padding:10px 12px; border:1px solid var(--comm-line); border-radius:10px; background:var(--comm-hover); color:var(--comm-text); font:inherit; font-size:14px; outline:none; transition:border-color 0.15s ease; }
#comm-dialog input:focus, #comm-dialog select:focus { border-color:var(--comm-blue); }
#comm-dialog label { display:block; font-size:13px; margin:10px 0; color:var(--comm-text); }
#comm-dialog button { min-height:38px; margin:3px; font-size:13px; border-radius:8px; }

/* Форма создания и настройки папок в стиле Telegram */
.comm-folder-form { display:flex; flex-direction:column; gap:12px; }
.comm-folder-label { font-weight:600; font-size:13px; display:flex; flex-direction:column; gap:6px; }
.comm-folder-presets-title { font-size:12px; color:var(--comm-muted); font-weight:500; }
.comm-folder-presets { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:4px; }
.comm-folder-chip { display:inline-flex; align-items:center; gap:4px; padding:5px 11px; border-radius:16px; border:1px solid var(--comm-line); background:var(--comm-hover); color:var(--comm-text); font-size:12.5px; cursor:pointer; transition:transform 0.1s ease, border-color 0.15s ease; min-height:auto !important; margin:0 !important; }
.comm-folder-chip:hover { border-color:var(--comm-blue); transform:scale(1.04); }
.comm-folder-chats-section { display:flex; flex-direction:column; gap:8px; padding:12px; border:1px solid var(--comm-line); border-radius:12px; background:rgba(0,0,0,0.08); }
.comm-folder-section-header { display:flex; flex-direction:column; gap:2px; }
.comm-folder-section-header strong { font-size:13.5px; color:var(--comm-text); }
.comm-folder-section-header small { font-size:11.5px; color:var(--comm-muted); }
.comm-folder-chat-search { width:100%; padding:7px 10px !important; font-size:13px !important; border-radius:8px !important; }
.comm-folder-chat-list { display:flex; flex-direction:column; gap:4px; max-height:180px; overflow-y:auto; padding-right:4px; }
.comm-folder-chat-item { display:flex; align-items:center; gap:10px; padding:6px 8px; border-radius:8px; cursor:pointer; transition:background 0.12s ease; margin:0 !important; }
.comm-folder-chat-item:hover { background:var(--comm-hover); }
.comm-folder-chat-item input[type="checkbox"] { width:18px !important; height:18px !important; margin:0 !important; accent-color:var(--comm-blue); cursor:pointer; flex-shrink:0; }
.comm-folder-chat-title { font-size:13.5px; font-weight:500; color:var(--comm-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comm-folder-empty-chats { font-size:12px; color:var(--comm-muted); text-align:center; padding:12px 0; }
.comm-folder-submit-btn { width:100%; margin-top:8px !important; min-height:42px !important; border-radius:10px !important; font-weight:600 !important; }
.communication-profile-editor { display:flex; align-items:center; gap:16px; margin-bottom:16px; }
.communication-profile-avatar { display:flex; align-items:center; justify-content:center; width:78px; height:78px; flex:0 0 78px; border-radius:50%; overflow:hidden; background:#5687ba; color:#fff; font-size:24px; font-weight:700; }
.communication-profile-actions { display:flex; flex-wrap:wrap; gap:6px; }
.communication-referral-card { margin:16px 0; padding:14px; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-ghost); }
.communication-referral-card h3 { margin:0; font-size:15px; font-weight:600; }
.communication-referral-card > p { margin:7px 0; color:var(--comm-muted); font-size:12px; line-height:1.45; }
.communication-referral-link { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:6px; margin-top:10px; }
.communication-referral-link input { font-size:12px; }
.communication-referral-qr-stage { margin:12px auto 8px; padding:12px; max-width:316px; overflow:hidden; border-radius:10px; background:#fff; }
.communication-referral-qr-stage img { max-width:100%; height:auto; margin:auto; }
.communication-referral-qr-stage img:not([hidden]) { display:block; }
.communication-referral-status { min-height:18px; }
.communication-referral-actions { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.communication-referral-actions a { display:inline-flex; align-items:center; justify-content:center; min-height:38px; padding:7px 12px; border-radius:8px; font-size:13px; text-decoration:none; }
#comm-dialog form small { display:block; color:var(--comm-muted); margin:-6px 0 10px; }
#comm-back { display:none; }
.communication-block-list { display:flex; flex-direction:column; gap:6px; margin-top:14px; }
.communication-block-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; border:1px solid var(--comm-line); border-radius:10px; }
.communication-block-item span { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.communication-recipient-picker { margin:14px 0; padding:12px; border:1px solid var(--comm-line); border-radius:12px; background:var(--comm-ghost); }
.communication-recipient-picker h3 { margin:0; font-size:15px; font-weight:650; }
.communication-recipient-picker > p { margin:6px 0 10px; color:var(--comm-muted); font-size:12px; line-height:1.45; }
.communication-recipient-controls { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
#comm-dialog .communication-recipient-controls label { margin:4px 0; }
.communication-recipient-summary { min-height:18px; }
.communication-recipient-list { display:flex; flex-direction:column; gap:5px; max-height:250px; overflow-y:auto; }
.communication-recipient-list > p { margin:8px 4px; color:var(--comm-muted); font-size:12px; }
.communication-recipient-card { display:flex; align-items:center; gap:10px; width:100%; min-height:58px; padding:7px; border:1px solid transparent; border-radius:10px; background:transparent; color:var(--comm-text); text-align:left; }
.communication-recipient-card:hover { background:var(--comm-hover); }
.communication-recipient-card[aria-pressed="true"] { border-color:var(--comm-blue); background:#3390ec18; }
.communication-recipient-card .communication-avatar { width:42px; height:42px; font-size:14px; }
.communication-recipient-copy { display:flex; min-width:0; flex-direction:column; gap:3px; }
.communication-recipient-copy strong, .communication-recipient-copy small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.communication-recipient-copy small { color:var(--comm-muted); font-size:11px; }
.communication-invite-manual { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:6px; }
#comm-dialog .communication-invite-manual label { margin:4px 0; }
.communication-invite-selected { display:flex; flex-wrap:wrap; gap:5px; margin:10px 0 4px; }
.communication-invite-chip { display:inline-flex; align-items:center; gap:5px; max-width:100%; padding:5px 7px 5px 10px; border-radius:18px; background:#3390ec18; color:var(--comm-text); font-size:12px; }
#comm-dialog .communication-invite-chip button { width:24px; height:24px; min-height:24px; margin:0; padding:0; border:0; border-radius:50%; background:transparent; color:var(--comm-muted); font-size:17px; }
@media (max-width:1100px) and (min-width:701px) { .communication-workspace { grid-template-columns:300px minmax(0,1fr); } }
@media (max-width:700px) {
    body[data-ui-version="new"] .communication-shell { display:flex; height:var(--comm-height,100dvh); min-height:0; gap:0; padding:env(safe-area-inset-top,0px) 0 calc(70px + env(safe-area-inset-bottom,0px)); }
    body[data-ui-version="new"] .communication-shell > .communication-workspace { width:100%; height:auto; flex:1; min-height:0; grid-template-columns:minmax(0,1fr); border:0; border-radius:0; }
    .communication-workspace:not(.has-room) .communication-thread, .communication-workspace.has-room .communication-list { display:none; }
    .communication-list { border:0; }
    .communication-thread-header { min-height:62px; padding:8px; gap:8px; }
    #comm-back { display:inline-flex; }
    .communication-thread-header .communication-avatar { width:36px; height:36px; font-size:14px; }
    .communication-thread-identity h2 { font-size:15px; }
    .communication-thread-header .communication-icon-button { width:36px; height:40px; min-height:40px; }
    .communication-messages { padding:12px; }
    .communication-message { max-width:88%; }
    .communication-message.has-images { width:min(520px,88%); }
    .communication-message-media > img { height:132px; }
    .communication-message-media.is-odd:not(.is-many) > img:first-child { height:180px; }
    .communication-message-media.is-many > img { height:90px; }
    .communication-carousel-slide { min-height: 180px; max-height: 360px; }
    .communication-carousel-slide img { max-height: 360px; }
    .communication-carousel-nav-btn { width: 30px; height: 30px; opacity: 0.9; }
    .communication-media-viewer-thumbs { height: 60px; padding: 6px 10px; }
    .communication-media-viewer-thumb { width: 44px; height: 44px; }
    .communication-compose { width:calc(100% - 16px); margin:4px auto 8px; }
    .communication-format-toolbar { padding-left:4px; }
    .communication-composer-row { gap:0; padding:2px; }
    .communication-composer-row .communication-icon-button { width:36px; height:42px; }
    .communication-composer-row [contenteditable] { padding-left:6px; font-size:16px; }
    .communication-search { padding:8px; gap:4px; }
    #comm-dialog { padding:18px; }
    .communication-referral-link { grid-template-columns:minmax(0,1fr); }
    .communication-referral-link button, .communication-referral-actions a, .communication-referral-actions button { width:100%; }
    .communication-invite-manual { grid-template-columns:minmax(0,1fr); }
    .communication-invite-manual button { width:100%; }
    #comm-emoji-panel { grid-template-columns:repeat(7,36px); }
    .communication-member-card { grid-template-columns:36px minmax(0,1fr); }
    #comm-dialog .communication-member-card > button { grid-column:1 / -1; width:100%; }

    /* Автоскрытие нижнего навбара при фокусе в строке ввода или развернутом режиме */
    body:has(#comm-text:focus) .new-product-nav,
    body.is-comm-focused .new-product-nav,
    body:has(.communication-compose.is-expanded) .new-product-nav {
        transform: translateY(calc(100% + 24px)) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: transform 0.22s ease-out, opacity 0.2s ease-out;
    }

    body[data-ui-version="new"]:has(#comm-text:focus) .communication-shell,
    body[data-ui-version="new"].is-comm-focused .communication-shell,
    body[data-ui-version="new"]:has(.communication-compose.is-expanded) .communication-shell {
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .communication-compose.is-expanded {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
        width: calc(100% - 16px) !important;
        max-width: none !important;
        margin: 0 !important;
        z-index: 40 !important;
        box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.45) !important;
        border: 1px solid var(--comm-blue);
    }

    .communication-compose.is-expanded [contenteditable] {
        min-height: min(38vh, 240px) !important;
        max-height: min(50vh, 300px) !important;
    }
}
@media (prefers-reduced-motion:reduce) { .communication-shell * { scroll-behavior:auto; transition:none; } }

@media (max-width:700px) { #communication-notice:not(:empty) { top:70px; left:12px; right:12px; } }

.communication-message-menu.opens-up .communication-actions { top:auto; bottom:34px; }

#comm-text { white-space:pre-wrap; overflow-wrap:anywhere; }
#comm-text:empty::before { content:attr(data-placeholder); color:var(--comm-muted); pointer-events:none; }
#comm-text[aria-invalid="true"] { outline:2px solid var(--comm-blue); }
.communication-rich-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.communication-quote { border-left:3px solid var(--comm-blue); padding-left:6px; background:var(--comm-hover); }
.communication-pre { font-family:monospace; background:var(--comm-hover); }
.communication-spoiler { background:var(--comm-muted); color:transparent; border-radius:3px; cursor:pointer; }
#comm-text .communication-spoiler,.communication-spoiler.is-revealed { color:inherit; background:var(--comm-hover); }
.communication-message-meta button { border:0; background:transparent; color:inherit; font:inherit; padding:0 3px; cursor:pointer; }
.communication-format-toolbar [aria-pressed="true"] { background:var(--comm-hover); color:var(--comm-blue); }
.communication-message:focus-visible { outline:2px solid var(--comm-blue); }
.communication-message-menu:focus-within { opacity:1; }
.communication-preview-files img { max-width:100%; max-height:240px; border-radius:8px; }
.communication-activity-row { display:flex; gap:8px; align-items:center; margin:8px 0; }
.communication-activity-row img { width:30px; height:30px; border-radius:50%; }

/* Telegram Message Activity & Reactions/Views Modal */
.comm-activity-modal { display:flex; flex-direction:column; gap:12px; }
.comm-activity-preview { display:flex; align-items:center; gap:10px; padding:10px 14px; background:var(--comm-hover); border-radius:12px; border-left:3px solid var(--comm-blue); font-size:13px; color:var(--comm-text); overflow:hidden; }
.comm-activity-preview svg { width:16px; height:16px; flex-shrink:0; color:var(--comm-blue); }
.comm-activity-preview span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comm-activity-tabs { display:flex; align-items:center; gap:6px; border-bottom:1px solid var(--comm-line); padding-bottom:6px; }
.comm-activity-tab-btn { flex:1; display:flex; align-items:center; justify-content:center; gap:6px; height:36px; padding:0 12px; border:0; border-radius:10px; background:transparent; color:var(--comm-muted); font-size:13.5px; font-weight:500; cursor:pointer; transition:background 0.15s ease, color 0.15s ease; min-height:auto !important; margin:0 !important; }
.comm-activity-tab-btn:hover { background:var(--comm-hover); color:var(--comm-text); }
.comm-activity-tab-btn.is-active { background:rgba(51, 144, 236, 0.16); color:var(--comm-blue); font-weight:600; }
.comm-activity-tab-badge { font-size:11px; font-weight:700; padding:2px 7px; border-radius:10px; background:var(--comm-line); color:var(--comm-text); }
.comm-activity-tab-btn.is-active .comm-activity-tab-badge { background:var(--comm-blue); color:#fff; }
.comm-activity-filter-bar { display:flex; align-items:center; gap:6px; overflow-x:auto; padding:2px 0 6px; }
.comm-activity-filter-chip { display:inline-flex; align-items:center; gap:4px; padding:4px 10px; border-radius:14px; border:1px solid var(--comm-line); background:var(--comm-hover); color:var(--comm-text); font-size:12px; cursor:pointer; transition:transform 0.1s ease, border-color 0.12s ease; min-height:auto !important; margin:0 !important; }
.comm-activity-filter-chip:hover { border-color:var(--comm-blue); transform:scale(1.04); }
.comm-activity-filter-chip.is-active { border-color:var(--comm-blue); background:rgba(51, 144, 236, 0.2); color:var(--comm-blue); font-weight:600; }
.comm-activity-list { display:flex; flex-direction:column; gap:4px; max-height:280px; overflow-y:auto; padding-right:4px; }
.comm-activity-user-row { display:flex; align-items:center; gap:12px; padding:8px 10px; border-radius:10px; transition:background 0.12s ease; }
.comm-activity-user-row:hover { background:var(--comm-hover); }
.comm-activity-user-avatar { width:38px; height:38px; border-radius:50%; overflow:hidden; background:#5687ba; color:#fff; font-size:13px; font-weight:700; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.comm-activity-user-avatar img { width:100%; height:100%; object-fit:cover; }
.comm-activity-user-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.comm-activity-user-name { font-size:14px; font-weight:600; color:var(--comm-text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.comm-activity-user-time { font-size:11.5px; color:var(--comm-muted); }
.comm-activity-reaction-badge { font-size:20px; width:34px; height:34px; border-radius:50%; background:var(--comm-hover); display:flex; align-items:center; justify-content:center; flex-shrink:0; box-shadow:0 1px 4px rgba(0,0,0,0.12); }
.comm-activity-read-status { display:flex; align-items:center; gap:4px; color:var(--comm-blue); font-size:13px; font-weight:700; }
.comm-activity-summary-banner { display:flex; align-items:center; gap:8px; padding:10px 14px; border-radius:10px; background:rgba(51, 144, 236, 0.1); color:var(--comm-blue); font-size:13.5px; font-weight:600; margin-bottom:8px; }
.comm-activity-summary-banner svg { width:18px; height:18px; }
.comm-activity-empty { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:28px 16px; text-align:center; gap:8px; }
.comm-activity-empty-icon { width:52px; height:52px; border-radius:50%; background:var(--comm-hover); display:flex; align-items:center; justify-content:center; font-size:24px; color:var(--comm-muted); }
.comm-activity-empty strong { font-size:15px; color:var(--comm-text); }
.comm-activity-empty p { font-size:12.5px; color:var(--comm-muted); max-width:260px; margin:0; line-height:1.45; }

.communication-message-meta > * { white-space:nowrap; flex-shrink:0; }
.communication-message-meta button { min-width:24px; min-height:24px; }

.communication-message-menu .communication-actions { max-height:min(70vh,400px); overflow-y:auto; }

/* Telegram Popovers для реакций и прочитавших */
.communication-telegram-popover {
    position: fixed;
    z-index: 1200;
    min-width: 180px;
    max-width: 280px;
    background: var(--comm-panel);
    border: 1px solid var(--comm-line);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 8px;
    font-size: 13px;
    color: var(--comm-text);
    animation: comm-popover-in 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: bottom center;
    pointer-events: auto;
}
@keyframes comm-popover-in {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.comm-popover-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 8px;
    border-bottom: 1px solid var(--comm-line);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--comm-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.comm-popover-header svg {
    width: 14px;
    height: 14px;
    color: var(--comm-blue);
}
.comm-popover-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 220px;
    overflow-y: auto;
    padding-top: 6px;
}
.comm-popover-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 8px;
    transition: background 0.12s ease;
}
.comm-popover-user:hover {
    background: var(--comm-hover);
}
.comm-popover-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: #5687ba;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.comm-popover-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comm-popover-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    color: var(--comm-text);
}
.comm-popover-badge {
    font-size: 15px;
    margin-left: auto;
    flex-shrink: 0;
}
.comm-popover-time {
    font-size: 11px;
    color: var(--comm-muted);
    margin-left: auto;
    flex-shrink: 0;
}

/* Кликабельные галочки прочтения и просмотров в бабле сообщения */
.communication-tick.is-clickable,
.communication-view-count.is-clickable {
    cursor: pointer;
    border-radius: 4px;
    padding: 0 3px;
    transition: background 0.15s ease, color 0.15s ease;
}
.communication-tick.is-clickable:hover,
.communication-view-count.is-clickable:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--comm-blue);
}

/* Индикатор онлайн в списке диалогов */
.communication-room-avatar-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}
.communication-room-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #4fae4e;
    border: 2px solid var(--comm-panel);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Галочки прочитано в списке чатов (превью последнего сообщения) */
.comm-preview-tick {
    display: inline-flex;
    align-items: center;
    color: var(--comm-blue);
    font-size: 11px;
    font-weight: 700;
    margin-right: 4px;
    vertical-align: middle;
}

/* Плавающая кнопка скролла вниз в стиле Telegram */
.communication-scroll-bottom {
    position: absolute;
    right: 22px;
    bottom: 84px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--comm-panel);
    border: 1px solid var(--comm-line);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--comm-muted);
    cursor: pointer;
    z-index: 45;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.15s ease, color 0.15s ease, opacity 0.2s ease;
    animation: comm-scroll-btn-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}
@keyframes comm-scroll-btn-in {
    from { opacity: 0; transform: translateY(10px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.communication-scroll-bottom:hover {
    background: var(--comm-hover);
    color: var(--comm-blue);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}
.communication-scroll-bottom svg {
    width: 20px;
    height: 20px;
}
.communication-scroll-unread {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--comm-blue);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Drag & Drop оверлей файлов над чатом */
.communication-drag-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
    animation: comm-drag-in 0.18s ease-out;
}
@keyframes comm-drag-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.communication-drag-box {
    border: 2px dashed var(--comm-blue);
    border-radius: 20px;
    padding: 48px 64px;
    text-align: center;
    background: rgba(51, 144, 236, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.communication-drag-box svg {
    width: 48px;
    height: 48px;
    color: var(--comm-blue);
}
.communication-drag-box strong {
    font-size: 18px;
    font-weight: 600;
}
.communication-drag-box span {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.75);
}

/* Плавающий Telegram Format Bubble над выделенным текстом */
.communication-format-bubble {
    position: fixed;
    z-index: 1300;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 6px;
    background: var(--comm-panel);
    border: 1px solid var(--comm-line);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    animation: comm-popover-in 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform-origin: bottom center;
}
.communication-format-bubble button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--comm-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, transform 0.1s ease;
    min-height: auto !important;
    margin: 0 !important;
}
.communication-format-bubble button:hover {
    background: var(--comm-hover);
    color: var(--comm-blue);
    transform: scale(1.05);
}
.communication-format-bubble button:active {
    transform: scale(0.95);
}
.communication-format-bubble svg {
    width: 15px;
    height: 15px;
}
.communication-format-separator {
    width: 1px;
    height: 18px;
    background: var(--comm-line);
    margin: 0 2px;
}
.communication-context-shortcut {
    margin-left: auto;
    font-size: 11px;
    color: var(--comm-muted);
    font-weight: 500;
}

.communication-video-bubble {
    display: block;
    margin: 4px 0;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.communication-video-element {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 12px;
    outline: none;
}

.communication-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

/* Круглые селфи-видеосообщения (Telegram Video Notes) */
.communication-message.is-video-note-bubble {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.communication-message.is-video-note-bubble::before,
.communication-message.is-video-note-bubble::after {
    display: none !important;
}

.communication-message.is-video-note-bubble .communication-message-reply {
    margin-bottom: 4px;
}

.communication-message.is-video-note-bubble .communication-message-meta,
.communication-message.is-video-note-bubble .communication-time-wrap {
    position: absolute;
    bottom: 8px;
    right: 14px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 2px 7px;
    color: #fff !important;
    font-size: 11px;
    line-height: 1.2;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.communication-message.is-video-note-bubble .communication-message-meta *,
.communication-message.is-video-note-bubble .communication-time-wrap * {
    color: #fff !important;
    fill: #fff !important;
}

.communication-video-note-wrap {
    position: relative;
    width: 240px;
    height: 240px;
    max-width: 68vw;
    max-height: 68vw;
    margin: 0;
    border-radius: 50% !important;
    overflow: hidden !important;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    clip-path: circle(50% at 50% 50%) !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    background: #000;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    aspect-ratio: 1 / 1;
}

.communication-video-note-element {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    clip-path: circle(50% at 50% 50%) !important;
    display: block;
}

.communication-video-note-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    transition: opacity 0.2s ease;
    border-radius: 50%;
    pointer-events: none;
}

.communication-video-note-wrap.is-playing .communication-video-note-overlay {
    opacity: 0;
}

.communication-video-note-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.communication-video-note-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

/* Кнопка зацикливания для кругляшек и обычных видео */
.communication-video-note-loop-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    padding: 0;
}

.communication-video-note-loop-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    transform: scale(1.08);
}

.communication-video-note-loop-btn.is-active {
    background: #2481cc;
    border-color: #2481cc;
    color: #fff;
    box-shadow: 0 2px 10px rgba(36, 129, 204, 0.6);
}

.communication-video-note-loop-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.communication-video-bubble {
    position: relative;
    max-width: 100%;
    margin: 4px 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    transform: translateZ(0);
}

.communication-video-element {
    display: block;
    width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: 12px;
    outline: none;
    image-rendering: -webkit-optimize-contrast;
    transform: translateZ(0);
}

.communication-video-bubble .communication-video-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 10;
}

.communication-video-bubble .communication-video-loop-btn,
.communication-video-bubble .communication-video-expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.communication-video-bubble .communication-video-loop-btn:hover,
.communication-video-bubble .communication-video-expand-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    transform: scale(1.08);
}

.communication-video-bubble .communication-video-loop-btn.is-active {
    background: #2481cc;
    border-color: #2481cc;
    color: #fff;
    box-shadow: 0 2px 10px rgba(36, 129, 204, 0.6);
}

.communication-video-bubble .communication-video-loop-btn svg,
.communication-video-bubble .communication-video-expand-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Модальное окно селфи-записи кругляшки */
.communication-video-rec-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: commFadeIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.communication-video-rec-circle {
    position: relative;
    width: 280px;
    height: 280px;
    max-width: 75vw;
    max-height: 75vw;
    border-radius: 50% !important;
    overflow: hidden !important;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    clip-path: circle(50% at 50% 50%) !important;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    box-shadow: 0 0 0 4px #2481cc, 0 16px 40px rgba(0, 0, 0, 0.6);
    background: #000;
}

.communication-video-rec-stream {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    -webkit-clip-path: circle(50% at 50% 50%) !important;
    clip-path: circle(50% at 50% 50%) !important;
    transform: scaleX(-1) translateZ(0) !important;
    -webkit-transform: scaleX(-1) translateZ(0) !important;
    display: block;
}

.communication-video-rec-timer {
    margin-top: 20px;
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 18px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}

.communication-video-rec-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3b30;
    animation: commPulse 1s infinite alternate;
}

.communication-video-rec-controls {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.communication-video-rec-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.communication-video-rec-btn:active {
    transform: scale(0.92);
}

.communication-video-rec-cancel {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.communication-video-rec-cancel:hover {
    background: rgba(255, 59, 48, 0.85);
}

.communication-video-rec-send {
    background: #2481cc;
    color: #fff;
    box-shadow: 0 4px 18px rgba(36, 129, 204, 0.55);
}

.communication-video-rec-send:hover {
    background: #1b6fa9;
}




