
:root{--bg:#F8FBDD;--bg2:#FFFFFF;--bg3:#EFF7FF;--bg4:#E6F2FF;--surface:#FFFFFF;--surface2:#F0F8FF;--border:#E0EAF0;--border2:#E0EAF0;--accent:#a8d8ea;--accent2:#BBD0E4;--accent3:#8BC8DC;--accent-glow:rgba(168,216,234,0.35);--teal:#A8D8EA;--teal-dim:rgba(168,216,234,0.2);--text:#2C3E50;--text2:#7F8C8D;--text3:#7F8C8D;--green:#22c55e;--red:#ef4444;--sys-bg:#8A2BE2;--sys-text:#FFFFFF;--radius:16px;--radius-sm:10px;--radius-xs:6px;--font-head:'Unbounded',sans-serif;--font-body:'Onest',sans-serif;--sidebar:320px;--tr:0.2s cubic-bezier(0.4,0,0.2,1);}
*{margin:0;padding:0;box-sizing:border-box;}
html,body{height:100%;overflow:hidden;}
body{font-family:var(--font-body);background:var(--bg);color:var(--text);display:flex;flex-direction:column;height:100dvh;}
.screen{display:none;width:100%;height:100%;}
.screen.active{display:flex;}
.auth-tagline{color:var(--text2);font-size:.9rem;letter-spacing:.05em;margin-bottom:48px;}
.auth-card{background:var(--bg2);border:1px solid var(--border2);border-radius:24px;padding:40px;width:380px;display:flex;flex-direction:column;gap:20px;box-shadow:0 32px 80px rgba(0,0,0,.5);}
.auth-step{display:none;flex-direction:column;gap:20px;}
.auth-step.active{display:flex;}
.auth-title{font-family:var(--font-head);font-size:1.2rem;font-weight:600;margin-bottom:4px;}
.auth-desc{font-size:.85rem;color:var(--text2);line-height:1.5;}
.auth-label{font-size:.75rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text3);margin-bottom:4px;}
.phone-wrap{display:flex;gap:10px;}
.input-field{background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:14px 18px;color:var(--text);font-family:var(--font-body);font-size:.95rem;width:100%;transition:border-color var(--tr),box-shadow var(--tr);}
.input-field:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow);}
.input-field::placeholder{color:var(--text3);}
.otp-inputs{display:flex;gap:10px;justify-content:center;}
.otp-digit{width:52px;height:58px;background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius-sm);text-align:center;font-family:var(--font-head);font-size:1.4rem;font-weight:600;color:var(--text);transition:border-color var(--tr),box-shadow var(--tr);}
.otp-digit:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow);}
.btn-primary{background:linear-gradient(135deg,var(--accent) 0%,var(--accent3) 100%);color:#fff;border:none;border-radius:var(--radius-sm);padding:15px 24px;font-family:var(--font-body);font-size:.95rem;font-weight:600;cursor:pointer;transition:opacity var(--tr),transform var(--tr),box-shadow var(--tr);box-shadow:0 8px 24px rgba(0,201,177,.35);}
.btn-primary:hover{opacity:.92;transform:translateY(-1px);}
.btn-primary:disabled{opacity:.5;cursor:not-allowed;transform:none;}
.btn-ghost{background:transparent;border:1px solid var(--border2);border-radius:var(--radius-sm);padding:14px 24px;color:var(--text2);font-family:var(--font-body);font-size:.9rem;cursor:pointer;transition:border-color var(--tr),color var(--tr);}
.btn-ghost:hover{border-color:var(--accent);color:var(--accent2);}
.auth-error{background:rgba(239,68,68,.1);border:1px solid rgba(239,68,68,.3);border-radius:var(--radius-xs);padding:10px 14px;font-size:.83rem;color:#f87171;display:none;}
.auth-error.show{display:block;}
.auth-resend{text-align:center;font-size:.82rem;color:var(--text2);}
.auth-resend span{color:var(--accent2);cursor:pointer;}
#screen-app{flex-direction:row;height:100dvh;overflow:hidden;}
.sidebar{width:var(--sidebar);min-width:var(--sidebar);background:var(--bg2);border-right:1px solid var(--border);display:flex;flex-direction:column;height:100%;overflow:hidden;}
.sidebar-header{padding:0;flex-shrink:0;}
.sidebar-logo{display:flex;align-items:center;justify-content:center;padding:18px 20px 14px;gap:10px;border-bottom:1px solid var(--border);}
.sidebar-logo-icon{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,var(--accent),var(--accent3));display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.sidebar-logo-icon svg{width:20px;height:20px;color:#121212;}
.sidebar-title{font-family:var(--font-head);font-size:1.1rem;font-weight:700;letter-spacing:-.02em;flex:1;}
.sidebar-top{display:flex;align-items:center;gap:12px;margin-bottom:0px;}
.my-avatar{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--teal));display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.8rem;font-weight:700;color:#121212;cursor:pointer;flex-shrink:0;position:relative;overflow:hidden;transition:transform var(--tr);}
.my-avatar:hover{transform:scale(1.05);}
.my-avatar img{width:100%;height:100%;object-fit:cover;position:absolute;border-radius:50%;}
/* Навигационные вкладки */
.nav-tabs{display:flex;gap:2px;padding:10px 12px;flex-shrink:0;border-bottom:1px solid var(--border);}
.nav-tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 4px;border-radius:10px;border:none;background:transparent;cursor:pointer;color:var(--text3);transition:all var(--tr);font-family:var(--font-body);}
.nav-tab:hover{background:var(--bg3);color:var(--text2);}
.nav-tab.active{background:rgba(0,201,177,.12);color:var(--accent);}
.nav-tab svg{width:20px;height:20px;}
.nav-tab-label{font-size:.68rem;font-weight:600;letter-spacing:.02em;transition:font-size .2s;}
.nav-tab.active .nav-tab-label{font-size:.78rem;}
.sidebar-logo-icon{width:36px;height:36px;border-radius:10px;background:linear-gradient(135deg,var(--accent),var(--accent3));display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:transform .3s ease;transform-style:preserve-3d;}
@keyframes flipRight{0%{transform:rotateY(0deg);}50%{transform:rotateY(90deg);}100%{transform:rotateY(0deg);}}
@keyframes flipLeft{0%{transform:rotateY(0deg);}50%{transform:rotateY(-90deg);}100%{transform:rotateY(0deg);}}
.logo-flip-right{animation:flipRight .35s ease;}
.logo-flip-left{animation:flipLeft .35s ease;}
.sidebar-content-wrap{position:relative;flex:1;min-height:0;overflow:hidden;}
.sidebar-content-pane{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;transition:transform .25s ease,opacity .25s ease;background:var(--bg2);}

/* Плашка профиля снизу */
.sidebar-profile{display:flex;align-items:center;gap:12px;padding:14px 16px;border-top:1px solid var(--border);flex-shrink:0;cursor:pointer;transition:background var(--tr);}
.sidebar-profile:hover{background:var(--bg3);}
.sidebar-profile-info{flex:1;min-width:0;}
.sidebar-profile-name{font-size:.9rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--text);}
.sidebar-profile-username{font-size:.75rem;color:var(--text3);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.icon-btn{width:36px;height:36px;border-radius:50%;background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);transition:background var(--tr),color var(--tr);flex-shrink:0;}
.icon-btn:hover{background:var(--bg3);color:var(--text);}
.icon-btn.hidden{display:none!important;}
.icon-btn svg{width:18px;height:18px;}
.search-wrap{position:relative;margin-bottom:12px;}
.search-icon{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--text3);pointer-events:none;}
.search-icon svg{width:16px;height:16px;}
.search-input{width:100%;background:var(--bg3);border:1px solid var(--border);border-radius:12px;padding:11px 14px 11px 40px;color:var(--text);font-family:var(--font-body);font-size:.88rem;transition:border-color var(--tr);}
.search-input:focus{outline:none;border-color:var(--border2);}
.search-input::placeholder{color:var(--text3);}
.folders-bar{display:flex;gap:6px;overflow-x:auto;padding:0 20px 14px;flex-shrink:0;scrollbar-width:none;}
.folders-bar::-webkit-scrollbar{display:none;}
.folder-chip{padding:6px 14px;border-radius:20px;font-size:.78rem;font-weight:600;cursor:pointer;white-space:nowrap;border:1px solid var(--border2);color:var(--text2);background:transparent;transition:all var(--tr);}
.folder-chip.active{background:var(--accent);border-color:var(--accent);color:#121212;font-weight:700;box-shadow:0 4px 12px var(--accent-glow);}
.folder-chip:hover:not(.active){border-color:var(--accent2);color:var(--accent2);}
.chat-list{flex:1;overflow-y:auto;padding:4px 8px;scrollbar-width:thin;scrollbar-color:var(--border2) transparent;}
.section-label{padding:8px 12px 4px;font-size:.7rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text3);display:flex;align-items:center;gap:6px;}
.saved-chat-btn{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--radius-sm);cursor:pointer;transition:background var(--tr);margin:4px 8px 0;user-select:none;}
.saved-chat-btn:hover{background:var(--bg3);}
.saved-chat-btn.active{background:var(--surface);}
.saved-chat-btn.active::before{content:'';position:absolute;left:8px;top:20%;height:60%;width:3px;background:var(--accent);border-radius:0 2px 2px 0;}
.saved-chat-icon{width:48px;height:48px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent3));display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.saved-chat-icon svg{width:22px;height:22px;color:#121212;}
.saved-chat-info{flex:1;min-width:0;}
.saved-chat-name{font-weight:600;font-size:.92rem;color:var(--text);}
.saved-chat-preview{font-size:.82rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;}
.chat-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:var(--radius-sm);cursor:pointer;transition:background var(--tr);position:relative;user-select:none;}
.chat-item:hover{background:var(--bg3);}
.chat-item.active{background:var(--surface);}
.chat-item.active::before{content:'';position:absolute;left:0;top:20%;height:60%;width:3px;background:var(--accent);border-radius:0 2px 2px 0;}
.chat-avatar{width:48px;height:48px;border-radius:50%;flex-shrink:0;position:relative;overflow:hidden;}
.chat-info{flex:1;min-width:0;}
.chat-row1{display:flex;align-items:center;gap:6px;margin-bottom:3px;}
.chat-name{font-weight:600;font-size:.92rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;}
.chat-time{font-size:.72rem;color:var(--text3);flex-shrink:0;}
.chat-row2{display:flex;align-items:center;gap:6px;}
.chat-preview{font-size:.82rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;}
.unread-badge{background:var(--accent);color:#121212;font-weight:700;border-radius:10px;padding:2px 7px;font-size:.7rem;font-weight:700;flex-shrink:0;}
/* Заглушённые чаты */
.unread-badge.muted { background: var(--text3); color: var(--bg2); }
.mute-icon { font-size: .8rem; color: var(--text3); flex-shrink: 0; }

.chat-area{flex:1;display:flex;flex-direction:column;height:100%;overflow:hidden;background:#F5FCFF;position:relative;}
.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;color:var(--text3);}
.chat-empty-icon{width:72px;height:72px;border-radius:50%;background:var(--bg2);display:flex;align-items:center;justify-content:center;}
.chat-empty-icon svg{width:32px;height:32px;}
.chat-empty h3{font-family:var(--font-head);font-size:1rem;color:var(--text2);}
.chat-empty p{font-size:.85rem;max-width:240px;text-align:center;line-height:1.5;}
.chat-header{display:flex;align-items:center;gap:14px;padding:14px 20px;border-bottom:1px solid var(--border);background:var(--bg2);flex-shrink:0;z-index:10;}
.chat-header-avatar{width:40px;height:40px;border-radius:50%;flex-shrink:0;position:relative;overflow:hidden;cursor:pointer;}
.chat-header-avatar-inner{width:100%;height:100%;border-radius:50%;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.75rem;font-weight:700;color:#fff;}
.chat-header-info{flex:1;min-width:0;}
.chat-header-name{font-weight:700;font-size:.97rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.chat-header-status{font-size:.78rem;color:var(--text2);}
.chat-header-status.online{color:var(--teal);}
.chat-header-actions{display:flex;gap:4px;}
.messages-area{flex:1;overflow-y:auto;padding:20px 20px 10px;display:flex;flex-direction:column;gap:2px;scrollbar-width:thin;scrollbar-color:var(--border2) transparent;background:#F5FCFF;}
.date-divider{display:flex;align-items:center;gap:12px;padding:12px 0;color:var(--text3);font-size:.76rem;font-weight:600;letter-spacing:.05em;}
.msg-system-text{background:var(--sys-bg);color:var(--sys-text);border-radius:12px;padding:4px 14px;font-size:.78rem;text-align:center;display:inline-block;}
.date-divider::before,.date-divider::after{content:'';flex:1;height:1px;background:var(--border);}
.msg-wrap{display:flex;gap:10px;padding:2px 0;}
.msg-wrap.out{flex-direction:row-reverse;}
.msg-avatar{width:32px;height:32px;border-radius:50%;flex-shrink:0;overflow:hidden;align-self:flex-end;margin-bottom:4px;}
.msg-avatar-inner{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.65rem;font-weight:700;color:#fff;}
.msg-wrap.out .msg-avatar{display:none;}
.msg-bubble-wrap{max-width:min(75vw,560px);display:flex;flex-direction:column;gap:3px;}
.msg-wrap.out .msg-bubble-wrap{align-items:flex-end;}
.msg-sender{font-size:.75rem;font-weight:600;color:var(--accent2);padding-left:14px;margin-bottom:2px;}
/* Фон личного чата */
#messages-area.private-bg {
  background-color: #F5FCFF;
  background-image: none;
  position: relative;
}
#messages-area.private-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: none;
  pointer-events: none;
}

.msg-bubble{background:var(--surface);border-radius:18px 18px 18px 4px;padding:10px 14px;position:relative;word-break:break-word;border:1px solid var(--border);transition:transform .1s;overflow:hidden;}
.msg-bubble.has-img{padding:0;}.msg-bubble.has-img .msg-text,.msg-bubble.has-img .msg-meta{padding:6px 12px;}.msg-bubble.has-img .msg-text{padding-top:8px;}
.msg-wrap.out .msg-bubble{background:linear-gradient(135deg,var(--accent) 0%,var(--accent3) 100%);border-color:transparent;border-radius:18px 18px 4px 18px;}
.msg-text{font-size:.9rem;line-height:1.55;}
.msg-wrap.out .msg-text{color:#fff;}
.msg-meta{display:flex;align-items:center;gap:5px;justify-content:flex-end;margin-top:4px;}
.msg-time{font-size:.68rem;color:rgba(255,255,255,.5);}
.msg-wrap:not(.out) .msg-time{color:var(--text3);}
.msg-read svg{width:14px;height:14px;}
.msg-voice{display:flex;align-items:center;gap:12px;padding:4px 0;min-width:180px;}
.voice-play-btn{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.15);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background var(--tr);}
.voice-play-btn:hover{background:rgba(255,255,255,.25);}
.voice-play-btn svg{width:16px;height:16px;color:#fff;}
.msg-wrap:not(.out) .voice-play-btn{background:var(--accent-glow);}
.msg-wrap:not(.out) .voice-play-btn svg{color:var(--accent2);}
.voice-waveform{flex:1;height:28px;display:flex;align-items:center;gap:2px;}
.voice-bar{width:3px;background:rgba(255,255,255,.4);border-radius:2px;}
.msg-wrap:not(.out) .voice-bar{background:var(--accent2);opacity:.6;}
.voice-dur{font-size:.72rem;color:rgba(255,255,255,.6);flex-shrink:0;}
.msg-wrap:not(.out) .voice-dur{color:var(--text3);}
.msg-video-circle{width:180px;height:180px;border-radius:50%;overflow:hidden;background:var(--bg3);border:3px solid var(--accent);flex-shrink:0;position:relative;cursor:pointer;}
.vid-placeholder{width:100%;height:100%;background:linear-gradient(135deg,#2a2060,#1a3060);display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,.5);}
.vid-placeholder svg{width:40px;height:40px;}
.vid-play-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.3);border-radius:50%;}
.vid-play-overlay svg{width:36px;height:36px;color:#fff;}
.msg-file{display:flex;align-items:center;gap:12px;padding:2px 0;min-width:200px;cursor:pointer;}
.file-icon{width:40px;height:40px;border-radius:10px;background:rgba(255,255,255,.12);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.file-icon svg{width:20px;height:20px;color:rgba(255,255,255,.8);}
.msg-wrap:not(.out) .file-icon{background:var(--bg4);}
.msg-wrap:not(.out) .file-icon svg{color:var(--accent2);}
.file-name{font-size:.85rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.file-size{font-size:.72rem;opacity:.6;margin-top:2px;}
.typing-indicator{display:flex;align-items:center;gap:8px;padding:8px 14px;color:var(--text2);font-size:.82rem;}
.typing-dots{display:flex;gap:4px;}
.typing-dot{width:6px;height:6px;border-radius:50%;background:var(--text3);animation:typingDot 1.4s infinite;}
.typing-dot:nth-child(2){animation-delay:.2s;}
.typing-dot:nth-child(3){animation-delay:.4s;}
@keyframes typingDot{0%,60%,100%{transform:translateY(0);}30%{transform:translateY(-6px);}}
.input-area{border-top:1px solid var(--border);background:var(--bg2);padding:14px 20px;flex-shrink:0;}
.input-row{display:flex;align-items:flex-end;gap:10px;}
.emoji-trigger{width:38px;height:38px;border-radius:50%;background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--text2);transition:all var(--tr);}
.emoji-trigger:hover{background:var(--bg3);color:var(--text);}
.emoji-trigger svg{width:20px;height:20px;}
.msg-input-wrap{flex:1;position:relative;}
.msg-input{width:100%;background:var(--bg3);border:1px solid var(--border2);border-radius:20px;padding:10px 16px;color:var(--text);font-family:var(--font-body);font-size:.93rem;min-height:44px;max-height:196px;line-height:1.4;overflow-y:auto;transition:border-color var(--tr),box-shadow var(--tr);scrollbar-width:none;box-sizing:border-box;outline:none;word-break:break-word;white-space:pre-wrap;}
.msg-input:empty:before{content:attr(data-placeholder);color:var(--text3);pointer-events:none;}
.msg-input b, .msg-input strong, .msg-input i, .msg-input em, .msg-input s, .msg-input code, .msg-input span { display:inline; }
.msg-input-wrap{position:relative;flex:1;}
.msg-input::-webkit-scrollbar{display:none;}
.msg-char-counter{position:absolute;bottom:6px;right:12px;font-size:.68rem;color:var(--text3);pointer-events:none;transition:color .2s;}
.msg-char-counter.warn{color:#f59e0b;}
.msg-char-counter.over{color:var(--red);font-weight:600;}
.msg-input:focus{outline:none;border-color:var(--border2);box-shadow:0 0 0 3px rgba(0,201,177,.1);}
.msg-input::placeholder{color:var(--text3);}
.send-btn{width:42px;height:42px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--accent3));border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all var(--tr);box-shadow:0 4px 14px var(--accent-glow);}
.send-btn:hover{transform:scale(1.08);}
.send-btn svg{width:18px;height:18px;color:#fff;}
.record-btn{width:42px;height:42px;border-radius:50%;background:var(--bg3);border:1px solid var(--border2);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;color:var(--text2);transition:all var(--tr);position:relative;user-select:none;}
.record-btn:hover{background:var(--bg4);color:var(--text);}
.record-btn.recording{background:var(--red);border-color:var(--red);color:#fff;animation:pulseRec 1s infinite;}
.record-btn.mode-video{color:var(--teal);border-color:var(--teal);}
.record-btn svg{width:18px;height:18px;}
.record-mode-tip{position:absolute;bottom:calc(100% + 6px);right:0;background:var(--bg2);border:1px solid var(--border2);border-radius:8px;padding:4px 10px;font-size:.72rem;color:var(--text2);white-space:nowrap;pointer-events:none;opacity:0;transition:opacity var(--tr);}
.record-btn:hover .record-mode-tip{opacity:1;}
@keyframes pulseRec{0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.5);}50%{box-shadow:0 0 0 8px rgba(239,68,68,0);}}
.emoji-picker{position:fixed;right:8px;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius);padding:12px;width:320px;box-shadow:0 20px 60px rgba(0,0,0,.5);z-index:100;display:none;}
.emoji-picker.open{display:block;animation:fadeUp .15s ease;}
@keyframes fadeUp{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:translateY(0);}}
.emoji-cats{display:flex;gap:4px;margin-bottom:10px;border-bottom:1px solid var(--border);padding-bottom:8px;}
.emoji-cat-btn{padding:4px 8px;border-radius:8px;border:none;background:transparent;cursor:pointer;font-size:1rem;transition:background var(--tr);}
.emoji-cat-btn:hover,.emoji-cat-btn.active{background:var(--bg4);}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;max-height:200px;overflow-y:auto;overflow-x:hidden;scrollbar-width:none;}
.emoji-grid::-webkit-scrollbar{display:none;}
.emoji-btn{padding:6px;border-radius:8px;border:none;background:transparent;cursor:pointer;font-size:1.1rem;transition:background var(--tr),transform var(--tr);text-align:center;}
.emoji-btn:hover{background:var(--bg4);transform:scale(1.2);}
.profile-panel{width:0;overflow:hidden;background:var(--bg2);border-left:1px solid var(--border);transition:width .3s cubic-bezier(.4,0,.2,1);display:flex;flex-direction:column;flex-shrink:0;}
.profile-panel.open{width:280px;}
.profile-inner{width:280px;padding:20px;overflow-y:auto;height:100%;scrollbar-width:none;}
.profile-inner::-webkit-scrollbar{display:none;}
.profile-cover{height:100px;background:linear-gradient(135deg,var(--accent3),var(--teal));border-radius:var(--radius);position:relative;}
.profile-avatar-big{width:72px;height:72px;border-radius:50%;border:3px solid var(--bg2);margin:-36px auto 0;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.2rem;font-weight:700;color:#fff;position:relative;overflow:hidden;}
.profile-avatar-big img{width:100%;height:100%;object-fit:cover;position:absolute;}
.profile-name{text-align:center;margin-top:12px;font-family:var(--font-head);font-size:1rem;font-weight:700;}
.profile-username{text-align:center;color:var(--text2);font-size:.82rem;margin-top:3px;}
.profile-status-wrap{display:flex;justify-content:center;margin-top:6px;}
.profile-status{font-size:.78rem;padding:4px 12px;border-radius:20px;background:var(--teal-dim);color:var(--teal);display:inline-block;font-weight:600;}
.profile-section{margin-top:20px;}
/* Вкладки в профиле */
.profile-tabs{display:flex;gap:4px;overflow-x:auto;padding:12px 0 8px;scrollbar-width:none;border-bottom:1px solid var(--border);margin-bottom:12px;flex-shrink:0;}
.profile-tabs::-webkit-scrollbar{display:none;}
.profile-tabs::-webkit-scrollbar{display:none;}
.profile-tab{padding:5px 12px;border-radius:16px;font-size:.73rem;font-weight:600;cursor:pointer;white-space:nowrap;border:1px solid var(--border2);color:var(--text2);background:transparent;transition:all var(--tr);flex-shrink:0;}
.profile-tab.active{background:var(--accent);border-color:var(--accent);color:#121212;}
.profile-tab:hover:not(.active){border-color:var(--accent2);color:var(--accent2);}
.profile-media-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:3px;margin-top:4px;}
.profile-media-item{aspect-ratio:1;border-radius:8px;overflow:hidden;cursor:pointer;background:var(--bg3);position:relative;}
.profile-media-item img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .2s;}
.profile-media-item:hover img{transform:scale(1.05);}
.profile-list-item{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--border);cursor:pointer;transition:opacity .2s;}
.profile-list-item:hover{opacity:.8;}
.profile-list-item:last-child{border-bottom:none;}
.profile-list-icon{width:38px;height:38px;border-radius:10px;background:var(--bg3);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.profile-list-icon svg{width:18px;height:18px;color:var(--accent2);}
.profile-list-info{flex:1;min-width:0;}
.profile-list-name{font-size:.85rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.profile-list-meta{font-size:.72rem;color:var(--text3);margin-top:1px;}
.profile-empty{text-align:center;padding:24px 0;color:var(--text3);font-size:.82rem;}
/* Модал удаления */
.delete-modal{position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(6px);z-index:500;display:none;align-items:center;justify-content:center;}
.delete-modal.open{display:flex;animation:fadeIn .15s;}
.delete-card{background:var(--bg2);border:1px solid var(--border2);border-radius:20px;padding:28px;width:320px;display:flex;flex-direction:column;gap:16px;box-shadow:0 40px 100px rgba(0,0,0,.6);animation:scaleIn .2s cubic-bezier(.4,0,.2,1);}
.delete-title{font-family:var(--font-head);font-size:1rem;font-weight:700;}
.delete-desc{font-size:.85rem;color:var(--text2);line-height:1.5;}
.delete-check{display:flex;align-items:center;gap:10px;cursor:pointer;user-select:none;font-size:.88rem;padding:4px 0;}
.delete-check input{width:16px;height:16px;accent-color:var(--accent);cursor:pointer;flex-shrink:0;}
.delete-actions{display:flex;gap:10px;margin-top:4px;}
/* Контекстное меню в папках профиля */
#profile-item-ctx{min-width:160px;}
.profile-section-title{font-size:.7rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text3);margin-bottom:8px;}
.overlay-panel{position:fixed;inset:0;z-index:200;display:none;align-items:flex-start;justify-content:flex-start;}
.overlay-panel.open{display:flex;}
.overlay-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.6);backdrop-filter:blur(4px);}
.overlay-sheet{position:relative;width:360px;height:100%;background:var(--bg2);border-right:1px solid var(--border2);display:flex;flex-direction:column;animation:slideInLeft .25s cubic-bezier(.4,0,.2,1);overflow-y:auto;}
@keyframes slideInLeft{from{transform:translateX(-100%);}to{transform:translateX(0);}}
.sheet-header{padding:24px 20px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px;flex-shrink:0;}
.sheet-title{font-family:var(--font-head);font-size:1.1rem;font-weight:700;flex:1;}
.avatar-upload-area{display:flex;flex-direction:column;align-items:center;padding:24px 20px;border-bottom:1px solid var(--border);}
.avatar-upload-big{width:90px;height:90px;border-radius:50%;background:linear-gradient(135deg,var(--accent),var(--teal));display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.6rem;font-weight:700;color:#fff;position:relative;overflow:hidden;cursor:pointer;margin-bottom:12px;}
.avatar-upload-big img{width:100%;height:100%;object-fit:cover;position:absolute;}
.avatar-upload-overlay{position:absolute;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity var(--tr);border-radius:50%;}
.avatar-upload-overlay svg{width:24px;height:24px;color:#fff;}
.avatar-upload-big:hover .avatar-upload-overlay{opacity:1;}
.avatar-hint{font-size:.78rem;color:var(--text2);}
.settings-section{padding:16px 20px;border-bottom:1px solid var(--border);}
.settings-section-title{font-size:.7rem;font-weight:600;letter-spacing:.1em;text-transform:uppercase;color:var(--text3);margin-bottom:12px;}
.settings-item{display:flex;align-items:center;gap:14px;padding:10px 0;cursor:pointer;transition:color var(--tr);}
.settings-item:hover{color:var(--accent2);}
.settings-item-icon{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.settings-item-icon svg{width:18px;height:18px;}
.settings-item-label{font-size:.9rem;flex:1;}
.settings-toggle{width:38px;height:22px;border-radius:11px;background:var(--border2);position:relative;cursor:pointer;transition:background var(--tr);flex-shrink:0;}
.settings-toggle.on{background:var(--accent);}
.settings-toggle::after{content:'';position:absolute;width:16px;height:16px;border-radius:50%;background:#fff;top:3px;left:3px;transition:transform var(--tr);}
.settings-toggle.on::after{transform:translateX(16px);}
.input-edit{background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius-xs);padding:8px 12px;color:var(--text);font-family:var(--font-body);font-size:.88rem;width:100%;margin-top:4px;transition:border-color var(--tr);}
.input-edit:focus{outline:none;border-color:var(--accent);}
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(6px);z-index:300;display:none;align-items:center;justify-content:center;}
.modal-overlay.open{display:flex;animation:fadeIn .15s;}
@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}
.modal-card{background:var(--bg2);border:1px solid var(--border2);border-radius:20px;padding:28px;width:340px;display:flex;flex-direction:column;gap:16px;box-shadow:0 40px 100px rgba(0,0,0,.6);animation:scaleIn .2s cubic-bezier(.4,0,.2,1);}
@keyframes scaleIn{from{transform:scale(.95);opacity:0;}to{transform:scale(1);opacity:1;}}
.modal-title{font-family:var(--font-head);font-size:1.1rem;font-weight:700;}
.modal-subtitle{font-size:.84rem;color:var(--text2);margin-top:2px;}
.modal-actions{display:flex;gap:10px;margin-top:4px;}
.toast{position:fixed;bottom:24px;right:24px;background:var(--surface2);border:1px solid var(--border2);border-radius:12px;padding:12px 18px;font-size:.88rem;box-shadow:0 12px 40px rgba(0,0,0,.4);z-index:500;display:flex;align-items:center;gap:10px;transform:translateY(20px);opacity:0;transition:all .3s cubic-bezier(.4,0,.2,1);pointer-events:none;}
.toast.show{transform:translateY(0);opacity:1;}
.toast-icon{width:20px;height:20px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.toast-icon svg{width:11px;height:11px;color:#fff;}
.loader{display:inline-block;width:18px;height:18px;border:2px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite;}
@keyframes spin{to{transform:rotate(360deg);}}
.ctx-menu{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:6px;min-width:180px;box-shadow:0 16px 40px rgba(0,0,0,.5);z-index:400;display:none;animation:fadeUp .12s;}
.ctx-menu.open{display:block;}
.ctx-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:8px;cursor:pointer;font-size:.88rem;transition:background var(--tr);}
.ctx-item:hover{background:var(--bg3);}
.ctx-item svg{width:16px;height:16px;color:var(--text2);}
.ctx-item.danger{color:var(--red);}
.ctx-item.danger svg{color:var(--red);}
.ctx-sep{height:1px;background:var(--border);margin:4px 0;}
.file-preview-grid{display:flex;flex-wrap:wrap;gap:8px;max-height:200px;overflow-y:auto;padding:4px 0;}
.file-preview-item{position:relative;border-radius:10px;overflow:hidden;border:1px solid var(--border2);}
.file-preview-item img{width:100px;height:100px;object-fit:cover;display:block;}
.file-preview-doc{width:120px;height:80px;background:var(--bg3);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:8px;}
.file-preview-doc svg{width:28px;height:28px;color:var(--accent2);}
.file-preview-doc span{font-size:.7rem;color:var(--text2);text-align:center;word-break:break-all;overflow:hidden;max-height:2.4em;}
.file-preview-remove{position:absolute;top:4px;right:4px;width:20px;height:20px;border-radius:50%;background:rgba(0,0,0,.7);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;font-size:.7rem;line-height:1;}
/* Группа картинок */
.msg-img-group{display:grid;grid-template-columns:1fr 1fr;gap:2px;border-radius:14px;overflow:hidden;width:100%;}
.msg-img-group.count-1{grid-template-columns:1fr;}
.msg-img-group.count-1 .msg-img-group-item{aspect-ratio:unset;max-height:320px;}
.msg-img-group.count-3 .msg-img-group-item:first-child,
.msg-img-group.count-5 .msg-img-group-item:first-child,
.msg-img-group.count-7 .msg-img-group-item:first-child,
.msg-img-group.count-9 .msg-img-group-item:first-child{grid-column:1/-1;}
.msg-img-group-item{position:relative;overflow:hidden;aspect-ratio:1;background:#000;cursor:pointer;}
.msg-img-group-item img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .2s;}
.msg-img-group-item:hover img{transform:scale(1.04);}
.msg-img-group-more{position:absolute;inset:0;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.4rem;font-weight:700;color:#fff;pointer-events:none;}
/* Лайтбокс */
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.92);z-index:1000;display:none;align-items:center;justify-content:center;flex-direction:column;}
.lightbox.open{display:flex;}
.lightbox-img-wrap{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;overflow:hidden;cursor:zoom-in;}
.lightbox-img-wrap.zoomed{cursor:zoom-out;}
.lightbox img{max-width:90vw;max-height:85vh;object-fit:contain;border-radius:0;transition:transform .2s;user-select:none;}
.lightbox-close{position:absolute;top:16px;right:20px;width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.1);border:none;cursor:pointer;color:#fff;font-size:1.2rem;display:flex;align-items:center;justify-content:center;z-index:10;transition:background .2s;}
.lightbox-close:hover{background:rgba(255,255,255,.25);}
.lightbox-arrow{position:absolute;top:50%;transform:translateY(-50%);width:44px;height:44px;border-radius:50%;background:rgba(255,255,255,.1);border:none;cursor:pointer;color:#fff;font-size:1.3rem;display:flex;align-items:center;justify-content:center;z-index:10;transition:background .2s;}
.lightbox-arrow:hover{background:rgba(255,255,255,.25);}
.lightbox-arrow.prev{left:16px;}
.lightbox-arrow.next{right:16px;}
.lightbox-counter{position:absolute;bottom:16px;color:rgba(255,255,255,.7);font-size:.85rem;}
.lightbox-arrow:disabled{opacity:.2;cursor:default;}
/* Картинка в сообщении */
.msg-img-wrap{position:relative;border-radius:14px;overflow:hidden;width:100%;min-height:60px;display:flex;align-items:center;justify-content:center;background:#000;}
.msg-img-bg{position:absolute;inset:0;background-size:cover;background-position:center;filter:blur(16px) brightness(0.7);transform:scale(1.1);z-index:0;}
.msg-img{position:relative;z-index:1;max-width:100%;max-height:320px;border-radius:10px;display:block;object-fit:contain;}
/* Пересылка */
.forward-modal{position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(6px);z-index:300;display:none;align-items:center;justify-content:center;}
.forward-modal.open{display:flex;animation:fadeIn .15s;}
.forward-card{background:var(--bg2);border:1px solid var(--border2);border-radius:20px;width:380px;max-height:80vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 40px 100px rgba(0,0,0,.6);animation:scaleIn .2s cubic-bezier(.4,0,.2,1);}
.forward-header{padding:18px 20px 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;flex-shrink:0;}
.forward-title{font-family:var(--font-head);font-size:.95rem;font-weight:700;}
.forward-close{background:var(--bg3);border:none;border-radius:50%;width:30px;height:30px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);}
.forward-search-wrap{padding:10px 16px;border-bottom:1px solid var(--border);flex-shrink:0;}
.forward-list{flex:1;overflow-y:auto;padding:6px 8px;scrollbar-width:thin;scrollbar-color:var(--border2) transparent;}
.forward-item{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:var(--radius-sm);cursor:pointer;transition:background var(--tr);}
.forward-item:hover{background:var(--bg3);}
.forward-item-avatar{width:42px;height:42px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.78rem;font-weight:700;color:#121212;}
.forward-item-name{font-size:.9rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.forward-item-preview{font-size:.78rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px;}
/* Шапка пересланного сообщения */
.msg-forward-header{display:flex;align-items:center;gap:6px;font-size:.75rem;color:var(--accent2);font-weight:600;margin-bottom:5px;padding-bottom:5px;border-bottom:1px solid rgba(255,255,255,.1);}
.msg-wrap:not(.out) .msg-forward-header{border-bottom-color:var(--border);}
.msg-forward-header svg{width:13px;height:13px;}
/* Панель ответа */
.reply-bar{display:none;align-items:center;gap:10px;padding:10px 16px;background:var(--bg3);border-top:1px solid var(--border);border-left:3px solid var(--accent);}
.reply-bar.show{display:flex;}
.reply-bar-content{flex:1;min-width:0;}
.reply-bar-name{font-size:.75rem;font-weight:600;color:var(--accent2);margin-bottom:2px;}
.reply-bar-text{font-size:.82rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.reply-bar-close{cursor:pointer;color:var(--text3);flex-shrink:0;transition:color var(--tr);}
.reply-bar-close:hover{color:var(--text);}
/* Цитата внутри сообщения */
.msg-reply{background:rgba(0,0,0,.2);border-left:3px solid rgba(255,255,255,.3);border-radius:6px;padding:6px 10px;margin-bottom:6px;cursor:pointer;}
.msg-wrap:not(.out) .msg-reply{background:var(--bg3);border-left-color:var(--accent);}
.msg-reply-name{font-size:.72rem;font-weight:600;color:var(--accent2);margin-bottom:2px;}
.msg-reply-text{font-size:.78rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px;}
/* Реакции */
.msg-reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:5px;}
.reaction-chip{background:var(--bg3);border:1px solid var(--border2);border-radius:12px;padding:3px 8px;font-size:.82rem;cursor:pointer;transition:all var(--tr);display:flex;align-items:center;gap:4px;user-select:none;}
.reaction-chip:hover{border-color:var(--accent);transform:scale(1.05);}
.reaction-chip.mine{background:var(--accent-glow);border-color:var(--accent);}
.reaction-chip span{font-size:.7rem;color:var(--text2);}
/* Быстрые реакции при наведении */
.quick-reactions{position:absolute;bottom:calc(100% + 6px);background:var(--bg2);border:1px solid var(--border2);border-radius:20px;padding:6px 10px;display:none;gap:6px;box-shadow:0 8px 24px rgba(0,0,0,.4);z-index:50;white-space:nowrap;}
.msg-wrap:hover .quick-reactions{display:flex;}
.no-react-perm .quick-reactions{display:none !important;}
.quick-reaction-btn{font-size:1.1rem;cursor:pointer;transition:transform var(--tr);border:none;background:transparent;padding:2px;}
.quick-reaction-btn:hover{transform:scale(1.3);}
.menu-item {
  display:flex; align-items:center; gap:14px;
  padding:11px 12px; border-radius:var(--radius-sm);
  cursor:pointer; font-size:.9rem;
  transition:background var(--tr);
}
.menu-item:hover { background:var(--bg3); }
.menu-item-icon {
  width:36px; height:36px; border-radius:10px;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.menu-item-icon svg { width:18px; height:18px; }
.attach-btn { width:38px;height:38px;border-radius:50%;background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);transition:all var(--tr); }
.attach-btn:hover { background:var(--bg3);color:var(--text); }
.attach-btn svg { width:20px;height:20px; }
/* Карточка профиля */
.profile-card-modal{position:fixed;inset:0;background:rgba(0,0,0,.75);backdrop-filter:blur(8px);z-index:350;display:none;align-items:center !important;justify-content:center;}
.profile-card-modal.open{display:flex;animation:fadeIn .15s;}
.profile-card{background:var(--bg2);border:1px solid var(--border2);border-radius:24px;width:360px;max-width:90vw;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 40px 100px rgba(0,0,0,.7);animation:scaleIn .2s cubic-bezier(.4,0,.2,1);position:relative;}
.pc-close{position:absolute;top:14px;right:14px;width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.4);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;z-index:2;transition:background .2s;}
.pc-close:hover{background:rgba(0,0,0,.6);}
.pc-more{position:absolute;top:14px;right:54px;width:32px;height:32px;border-radius:50%;background:rgba(0,0,0,.4);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:#fff;z-index:2;transition:background .2s;}
.pc-more:hover{background:rgba(0,0,0,.6);}
.pc-more-menu{position:absolute;top:52px;right:14px;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:6px;min-width:180px;box-shadow:0 12px 40px rgba(0,0,0,.5);z-index:10;display:none;}
.pc-more-menu.open{display:block;animation:fadeUp .12s;}
.pc-cover{height:120px;background:linear-gradient(135deg,var(--accent3),var(--teal));flex-shrink:0;position:relative;}
.pc-avatar-wrap{position:absolute;bottom:-42px;left:50%;transform:translateX(-50%);cursor:pointer;}
.pc-avatar{width:84px;height:84px;border-radius:50%;border:3px solid var(--bg2);overflow:hidden;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.4rem;font-weight:700;color:#121212;position:relative;}
.pc-avatar img{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;}
.pc-avatar-overlay{position:absolute;inset:0;background:rgba(0,0,0,.35);border-radius:50%;display:flex;align-items:center;justify-content:center;opacity:0;transition:opacity .2s;}
.pc-avatar-wrap:hover .pc-avatar-overlay{opacity:1;}
.pc-body{padding:52px 24px 0;display:flex;flex-direction:column;align-items:center;gap:4px;flex-shrink:0;}
.pc-name{font-family:var(--font-head);font-size:1.1rem;font-weight:700;text-align:center;}
.pc-username{font-size:.82rem;color:var(--text3);}
.pc-status{font-size:.78rem;padding:3px 12px;border-radius:16px;margin-top:2px;}
.pc-status.online{background:rgba(0,201,177,.15);color:var(--accent);}
.pc-status.offline{background:var(--bg3);color:var(--text3);}
.pc-bio{font-size:.85rem;color:var(--text2);text-align:center;line-height:1.5;margin-top:6px;padding:0 8px;}
.pc-actions{display:flex;gap:10px;margin-top:14px;width:100%;}
.pc-tabs{display:flex;border-bottom:1px solid var(--border);margin-top:16px;width:100%;}
.pc-tab{flex:1;padding:10px 0;text-align:center;font-size:.8rem;font-weight:600;cursor:pointer;color:var(--text3);border-bottom:2px solid transparent;transition:all var(--tr);margin-bottom:-1px;}
.pc-tab.active{color:var(--accent);border-bottom-color:var(--accent);}
.pc-tab-content{flex:1;overflow-y:auto;padding:16px;scrollbar-width:none;min-height:120px;}
.pc-tab-content::-webkit-scrollbar{display:none;}
.pc-empty{text-align:center;padding:32px 0;color:var(--text3);font-size:.85rem;}
.pc-empty-icon{font-size:2rem;margin-bottom:8px;}
/* Голосовые сообщения */
.voice-record-btn{width:38px;height:38px;border-radius:50%;background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);transition:all var(--tr);flex-shrink:0;}
.voice-record-btn:hover{background:var(--bg3);color:var(--text);}
.voice-record-btn.recording{background:var(--red);color:#fff;animation:pulse 1s infinite;}
@keyframes pulse{0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4);}50%{box-shadow:0 0 0 8px rgba(239,68,68,0);}}
.voice-record-bar{display:none;align-items:center;gap:12px;padding:10px 16px;background:var(--bg3);border-top:1px solid var(--border);flex-shrink:0;}
.voice-record-bar.active{display:flex;}
.voice-record-timer{font-family:var(--font-head);font-size:.9rem;font-weight:600;color:var(--red);min-width:48px;}
.voice-waveform{flex:1;height:32px;display:flex;align-items:center;gap:2px;}
.voice-waveform-bar{width:3px;border-radius:2px;background:var(--accent);transition:height .1s;}
.voice-msg-wrap{display:flex;align-items:center;gap:10px;padding:6px 0;}
.voice-play-btn{width:36px;height:36px;border-radius:50%;background:var(--accent);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:opacity .2s;}
.voice-play-btn:hover{opacity:.85;}
.voice-play-btn svg{width:16px;height:16px;color:#121212;}
.voice-progress{flex:1;height:4px;background:rgba(255,255,255,.15);border-radius:2px;cursor:pointer;position:relative;}
.voice-progress-fill{height:100%;background:var(--accent);border-radius:2px;transition:width .1s;}
.voice-duration{font-size:.75rem;color:var(--text3);min-width:36px;text-align:right;}
/* Закреплённое сообщение */
.pinned-bar{display:none;align-items:center;gap:10px;padding:8px 16px;background:var(--bg2);border-bottom:1px solid var(--border);cursor:pointer;transition:background var(--tr);flex-shrink:0;}
.pinned-bar:hover{background:var(--bg3);}
.pinned-bar.visible{display:flex;}
.pinned-bar-accent{width:3px;height:36px;border-radius:2px;background:var(--accent);flex-shrink:0;}
.pinned-bar-content{flex:1;min-width:0;}
.pinned-bar-label{font-size:.68rem;font-weight:700;color:var(--accent2);margin-bottom:2px;}
.pinned-bar-text{font-size:.82rem;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.pinned-bar-close{width:24px;height:24px;border-radius:50%;background:transparent;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text3);flex-shrink:0;transition:background .2s;}
.pinned-bar-close:hover{background:var(--bg4);color:var(--text);}
/* Режим выбора сообщений */
.msg-wrap.selectable{cursor:pointer;}
.msg-wrap.selectable:hover .msg-bubble{opacity:.85;}
.msg-select-check{width:22px;height:22px;border-radius:50%;border:2px solid var(--border2);background:var(--bg3);display:none;align-items:center;justify-content:center;flex-shrink:0;align-self:center;transition:all var(--tr);margin:0 4px;}
.selection-mode .msg-select-check{display:flex;}
.msg-wrap.selected .msg-select-check{background:var(--accent);border-color:var(--accent);}
.msg-wrap.selected .msg-bubble{box-shadow:0 0 0 2px var(--accent);}
.selection-bar{position:fixed;bottom:0;left:var(--sidebar);right:0;background:var(--bg2);border-top:1px solid var(--border2);padding:14px 20px;display:none;align-items:center;justify-content:space-between;gap:12px;z-index:50;animation:fadeUp .15s ease;}
.selection-bar.open{display:flex;}
.selection-count{font-size:.9rem;font-weight:600;color:var(--text2);}
/* Контекстное меню канала */
.ch-ctx-submenu{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:6px;min-width:160px;box-shadow:0 12px 40px rgba(0,0,0,.5);z-index:401;display:none;animation:fadeUp .12s;}
.ch-ctx-submenu.open{display:block;}
/* Настройки */
.settings-overlay{position:fixed;inset:0;background:rgba(0,0,0,.85);backdrop-filter:blur(8px);z-index:600;display:none;align-items:center;justify-content:center;}
.settings-overlay.open{display:flex;animation:fadeIn .15s;}
.settings-modal{background:var(--bg);width:900px;height:680px;border-radius:20px;display:flex;overflow:hidden;box-shadow:0 40px 100px rgba(0,0,0,.8);position:relative;}
.settings-close{position:absolute;top:16px;right:16px;width:32px;height:32px;border-radius:50%;background:var(--bg3);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);z-index:2;transition:background .2s;}
.settings-close:hover{background:var(--bg4);color:var(--text);}
/* Левая колонка */
.settings-nav{width:220px;min-width:220px;background:var(--bg2);display:flex;flex-direction:column;overflow-y:auto;scrollbar-width:none;padding-bottom:16px;}
.settings-nav::-webkit-scrollbar{display:none;}
.settings-profile-header{padding:20px 16px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px;cursor:pointer;transition:background .2s;}
.settings-profile-header:hover{background:var(--bg3);}
.settings-profile-av{width:40px;height:40px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.75rem;font-weight:700;color:#121212;flex-shrink:0;overflow:hidden;position:relative;}
.settings-profile-av img{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;}
.settings-profile-info{flex:1;min-width:0;}
.settings-profile-name{font-size:.88rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.settings-profile-user{font-size:.72rem;color:var(--text3);}
.settings-section-title{font-size:.68rem;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--text3);padding:16px 16px 6px;}
.settings-nav-item{display:flex;align-items:center;gap:10px;padding:9px 16px;cursor:pointer;border-radius:8px;margin:0 8px;transition:background .2s;color:var(--text2);font-size:.88rem;}
.settings-nav-item:hover{background:var(--bg3);color:var(--text);}
.settings-nav-item.active{background:var(--bg3);color:var(--text);}
.settings-nav-item svg{width:18px;height:18px;flex-shrink:0;}
.settings-nav-sep{height:1px;background:var(--border);margin:8px 16px;}
.settings-nav-item.danger{color:var(--red);}
.settings-nav-item.danger:hover{background:rgba(239,68,68,.1);}
/* Правая часть */
.settings-content{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--border2) transparent;}
.settings-content::-webkit-scrollbar{width:4px;}
.settings-content::-webkit-scrollbar-thumb{background:var(--border2);border-radius:2px;}
/* Шапка профиля */
.settings-hero{height:120px;background:linear-gradient(135deg,var(--accent3),#6c63ff);flex-shrink:0;position:relative;}
.settings-hero-av{position:absolute;bottom:-44px;left:28px;width:88px;height:88px;border-radius:50%;border:4px solid var(--bg);overflow:hidden;background:var(--accent);display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.5rem;font-weight:700;color:#121212;cursor:pointer;}
.settings-hero-av img{width:100%;height:100%;object-fit:cover;}
.settings-hero-av:hover::after{content:'📷';position:absolute;inset:0;background:rgba(0,0,0,.5);display:flex;align-items:center;justify-content:center;font-size:1.5rem;}
.settings-section{padding:24px 28px;border-bottom:1px solid var(--border);}
.settings-section:last-child{border-bottom:none;}
.settings-section-heading{font-family:var(--font-head);font-size:.78rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--accent2);margin-bottom:16px;}
.settings-field{margin-bottom:16px;}
.settings-field label{display:block;font-size:.75rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--text3);margin-bottom:6px;}
.settings-field .input-field{width:100%;}
.settings-field textarea.input-field{resize:none;min-height:80px;line-height:1.5;}
.settings-toggle-row{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid var(--border);}
.settings-toggle-row:last-child{border-bottom:none;}
.settings-toggle-label{font-size:.88rem;color:var(--text2);}
.settings-toggle-desc{font-size:.75rem;color:var(--text3);margin-top:2px;}
.toggle-switch{width:44px;height:24px;border-radius:12px;background:var(--bg4);border:none;cursor:pointer;position:relative;transition:background .2s;flex-shrink:0;}
.toggle-switch.on{background:var(--accent);}
.toggle-switch::after{content:'';position:absolute;width:18px;height:18px;border-radius:50%;background:#fff;top:3px;left:3px;transition:transform .2s;}
.toggle-switch.on::after{transform:translateX(20px);}
.settings-select{background:var(--bg3);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:10px 14px;color:var(--text);font-family:var(--font-body);font-size:.88rem;width:100%;cursor:pointer;}
.settings-select:focus{outline:none;border-color:var(--accent);}
.settings-color-grid{display:flex;gap:10px;flex-wrap:wrap;margin-top:8px;}
.settings-color-btn{width:36px;height:36px;border-radius:50%;border:3px solid transparent;cursor:pointer;transition:transform .2s;}
.settings-color-btn:hover{transform:scale(1.1);}
.settings-color-btn.active{border-color:#fff;}
/* ══ МОБИЛЬНАЯ АДАПТАЦИЯ ══════════════════════════ */
/* Фиксируем ширину карточки профиля на ПК */
.profile-card { width: 360px; border-radius: 24px; }
.profile-card-modal { align-items: center; justify-content: center; }

/* Настройки сообщества */
.comm-settings-dropdown{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:14px;padding:6px;min-width:210px;box-shadow:0 12px 40px rgba(0,0,0,.5);z-index:600;display:none;flex-direction:column;gap:2px;animation:fadeUp .15s ease;}
.comm-settings-dropdown.open{display:flex;}
.comm-settings-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:8px;cursor:pointer;font-size:.88rem;transition:background var(--tr);}
.comm-settings-item:hover{background:var(--bg3);}
.comm-settings-item.danger{color:var(--red);}
.comm-modal{position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:700;display:none;align-items:center;justify-content:center;}
.comm-modal.open{display:flex;}
.comm-modal-card{background:var(--bg2);border-radius:20px;width:480px;max-width:95vw;max-height:85vh;overflow-y:auto;display:flex;flex-direction:column;}
.comm-modal-header{padding:20px 24px 0;display:flex;align-items:center;justify-content:space-between;flex-shrink:0;}
.comm-modal-title{font-size:1.1rem;font-weight:700;font-family:var(--font-head);}
.comm-modal-body{padding:16px 24px 24px;display:flex;flex-direction:column;gap:12px;}
.comm-settings-menu-item{display:flex;align-items:center;gap:14px;padding:14px 16px;border-radius:12px;cursor:pointer;background:var(--bg3);transition:background .15s;font-size:.92rem;font-weight:500;}
.comm-settings-menu-item:hover{background:var(--bg);}
.comm-settings-menu-icon{width:38px;height:38px;border-radius:10px;background:var(--bg2);display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.channel-type-btn{flex:1;padding:14px;border-radius:12px;border:2px solid var(--border2);background:var(--bg3);cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:8px;font-size:.85rem;color:var(--text2);transition:all .15s;}
.channel-type-btn.active{border-color:var(--accent);background:rgba(0,201,177,.08);color:var(--accent);}
.event-location-btn{flex:1;padding:14px;border-radius:12px;border:2px solid var(--border2);background:var(--bg3);cursor:pointer;display:flex;align-items:center;gap:10px;font-size:.88rem;color:var(--text2);transition:all .15s;}
.event-location-btn.active{border-color:var(--accent);background:rgba(0,201,177,.08);color:var(--accent);}
.day-btn{width:36px;height:36px;border-radius:50%;border:2px solid var(--border2);background:none;cursor:pointer;font-size:.78rem;font-weight:600;color:var(--text2);transition:all .15s;}
.day-btn.active{border-color:var(--accent);background:var(--accent);color:#121212;}

/* События сообщества */
.comm-events-widget{display:flex;align-items:center;gap:8px;padding:7px 12px;background:rgba(0,0,0,.35);cursor:pointer;transition:background .15s;border-radius:10px;backdrop-filter:blur(6px);}
.comm-events-widget:hover{background:rgba(0,0,0,.5);}
.comm-events-widget-title{font-size:.8rem;font-weight:600;color:#fff;flex:1;white-space:nowrap;overflow:hidden;text-overflow:clip;min-width:0;}
.comm-events-widget-time{font-size:.75rem;color:rgba(255,255,255,.75);flex-shrink:0;white-space:nowrap;}

/* Участники сообщества */
.comm-member-row{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--border);}
.comm-member-row:last-child{border-bottom:none;}
.comm-member-av{width:40px;height:40px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.9rem;overflow:hidden;}
.comm-member-av img{width:100%;height:100%;object-fit:cover;}
.comm-member-info{flex:1;min-width:0;}
.comm-member-name{font-weight:600;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.comm-member-username{font-size:.75rem;color:var(--text3);}
.comm-member-meta{font-size:.72rem;color:var(--text3);margin-top:2px;}
.comm-member-roles{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;}
.comm-member-role-badge{font-size:.68rem;padding:2px 7px;border-radius:6px;font-weight:600;}
.comm-member-ctx{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:12px;padding:6px;min-width:200px;box-shadow:0 8px 32px rgba(0,0,0,.4);z-index:800;display:none;flex-direction:column;gap:2px;}
.comm-member-ctx.open{display:flex;}
.comm-member-ctx-item{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:8px;cursor:pointer;font-size:.85rem;transition:background .15s;}
.comm-member-ctx-item:hover{background:var(--bg3);}
.comm-member-ctx-item.danger{color:var(--red);}
.comm-member-ctx-item.warn{color:#f59e0b;}
.comm-member-ctx-item.warn{color:#f59e0b;}

/* Роли */
.roles-modal-body{display:flex;gap:0;flex:1;min-height:0;overflow:hidden;}
.roles-list-panel{width:200px;flex-shrink:0;border-right:1px solid var(--border);display:flex;flex-direction:column;overflow:hidden;}
.roles-list-scroll{flex:1;overflow-y:auto;padding:8px;}
.role-list-item{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;cursor:pointer;font-size:.85rem;transition:background .15s;}
.role-list-item:hover{background:var(--bg3);}
.role-list-item.active{background:var(--bg3);}
.role-color-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0;}
.role-settings-panel{flex:1;overflow-y:auto;padding:16px 20px;}
.perm-group{margin-bottom:20px;}
.perm-group-title{font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--accent2);margin-bottom:10px;}
.perm-row{display:flex;align-items:flex-start;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--border);gap:12px;}
.perm-row:last-child{border-bottom:none;}
.perm-info{flex:1;}
.perm-name{font-size:.88rem;font-weight:600;}
.perm-desc{font-size:.75rem;color:var(--text3);margin-top:2px;line-height:1.4;}

/* Desktop comm-open */
body.comm-open .chat-area { display: none !important; }
body.comm-open.voice-open .chat-area { display: flex !important; }



.unread-badge.muted {
  background: var(--text3);
  color: var(--bg2);
}
.mute-icon {
  font-size: .75rem;
  flex-shrink: 0;
  opacity: .6;
}
/* Заглушённый чат — приглушённый превью */
.chat-item.muted-item .chat-preview {
  opacity: .5;
}


/* ══ УВЕДОМЛЕНИЯ НА ПК ══════════════════════════ */
@keyframes notifSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes notifSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.text-ctx-menu { position:fixed; background:var(--bg2); border:1px solid var(--border2); border-radius:12px; padding:4px; box-shadow:0 8px 32px rgba(0,0,0,.4); z-index:500; display:none; flex-direction:column; min-width:180px; }
.text-ctx-menu.open { display:flex; }
.text-ctx-menu .item { padding:8px 14px; border-radius:8px; cursor:pointer; font-size:.85rem; color:var(--text); display:flex; align-items:center; gap:10px; transition:background .15s; }
.text-ctx-menu .item:hover { background:var(--bg3); }
.text-ctx-menu .item.danger { color:var(--red); }
.text-ctx-menu .sep { height:1px; background:var(--border); margin:3px 8px; }
.text-ctx-submenu { position:fixed; background:var(--bg2); border:1px solid var(--border2); border-radius:12px; padding:4px; box-shadow:0 8px 32px rgba(0,0,0,.4); z-index:501; display:none; flex-direction:column; min-width:160px; }
.text-ctx-submenu.open { display:flex; }
.spoiler { user-select:none; background:var(--text2); color:var(--text2); border-radius:4px; padding:0 4px; cursor:pointer; transition:background .2s, color .2s; }
.spoiler.open { background:var(--bg3) !important; color:var(--text) !important; }
.mobile-back-btn { display: none; }
.msg-video-note-wrap { display:inline-flex; flex-direction:column; align-items:flex-start; }
.msg-wrap.out .msg-video-note-wrap { align-items:flex-end; }
.msg-video-circle { position:relative; width:200px; height:200px; border-radius:50%; overflow:hidden; cursor:pointer; background:var(--bg3); flex-shrink:0; transition:transform .3s ease, border-radius .3s ease; }
.msg-video-circle video { width:100%; height:100%; object-fit:cover; border-radius:inherit; display:block; }
.vid-play-overlay { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(0,0,0,.25); border-radius:inherit; transition:border-radius .3s; }
.msg-video-circle.vn-playing { border-radius:16px; z-index:2; }
.msg-wrap.out .msg-video-circle.vn-playing { align-self:flex-end; }
/* Голосовой чат в центральной области */
.voice-area{display:none;flex-direction:column;height:100%;background:var(--bg);overflow:hidden;}
.voice-area.active{display:flex;}
.voice-area-header{padding:12px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px;flex-shrink:0;}
.voice-area-title{font-family:var(--font-head);font-size:.95rem;font-weight:700;flex:1;}
.voice-area-count{font-size:.78rem;color:var(--text3);}
.voice-grid{flex:1;display:grid;grid-template-columns:repeat(2,300px);gap:12px;padding:20px;align-content:center;justify-content:center;overflow-y:auto;scrollbar-width:none;}
.voice-grid::-webkit-scrollbar{display:none;}
.voice-grid:has(> :only-child){grid-template-columns:300px;}
.voice-tile{border-radius:16px;background:var(--bg2);overflow:hidden;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;width:300px;height:220px;border:2px solid transparent;transition:border-color .2s;}
.voice-tile.speaking{border-color:#43b581;box-shadow:0 0 0 2px #43b581;}
.voice-member-av-wrap.voice-member-speaking{outline:2px solid #43b581;outline-offset:1px;border-radius:50%;}
.my-avatar-speaking{box-shadow:0 0 0 3px #43b581!important;}
.voice-tile video{width:100%;height:100%;object-fit:cover;position:absolute;inset:0;}
.voice-tile-av{width:72px;height:72px;border-radius:50%;background:var(--accent);display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:1.3rem;font-weight:700;color:#121212;flex-shrink:0;position:relative;z-index:1;}
.voice-tile-av img{width:100%;height:100%;object-fit:cover;border-radius:50%;position:absolute;inset:0;}
.voice-tile-name{position:absolute;bottom:10px;left:10px;background:rgba(0,0,0,.6);border-radius:6px;padding:3px 8px;font-size:.78rem;font-weight:600;z-index:2;display:flex;align-items:center;gap:4px;}
.voice-tile-muted{position:absolute;top:8px;right:8px;background:rgba(0,0,0,.6);border-radius:50%;width:26px;height:26px;display:flex;align-items:center;justify-content:center;z-index:2;}
.voice-controls-bar{flex-shrink:0;background:var(--bg2);border-top:1px solid var(--border);padding:12px 20px;display:flex;align-items:center;justify-content:center;gap:10px;}
.vc-btn{width:46px;height:46px;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--tr);background:var(--bg3);color:var(--text);}
.vc-btn:hover{background:var(--bg4);}
.vc-btn.active{background:var(--accent);color:#121212;}
.vc-btn.danger{background:var(--red);color:#fff;}
.vc-btn.danger:hover{background:#c0392b;}
.vc-btn svg{width:20px;height:20px;}
/* Голосовая панель в сайдбаре */
.voice-bar{background:var(--bg3);border-top:1px solid var(--border);padding:8px 12px;flex-shrink:0;display:none;}
.voice-bar.active{display:block;}
.voice-bar-info{display:flex;align-items:center;gap:8px;margin-bottom:8px;}
.voice-bar-status{width:8px;height:8px;border-radius:50%;background:#43b581;flex-shrink:0;}
.voice-bar-name{font-size:.75rem;color:var(--text2);flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.voice-bar-channel{font-size:.7rem;color:var(--text3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.voice-bar-controls{display:flex;gap:4px;}
.voice-ctrl-btn{width:32px;height:32px;border-radius:8px;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text2);transition:all var(--tr);}
.voice-ctrl-btn:hover{background:var(--bg4);color:var(--text);}
.voice-ctrl-btn.muted{color:var(--red);}
.voice-ctrl-btn svg{width:16px;height:16px;}
.voice-ctrl-btn.disconnect{color:var(--red);}
.voice-ctrl-btn.disconnect:hover{background:rgba(255,59,48,.15);}
/* Сообщества */
.communities-sidebar{display:none;flex-direction:row;height:100%;width:100%;}
.comm-list{display:flex;flex-direction:column;gap:16px;padding:16px;overflow-y:auto;flex:1;min-width:0;}
.comm-card{background:var(--bg2);border-radius:16px;height:125px;display:flex;flex-direction:column;padding:14px 16px;gap:6px;cursor:pointer;transition:transform .12s ease,box-shadow .12s ease;position:relative;overflow:hidden;border:1px solid var(--border);}
.comm-card:hover{transform:scale(1.01);box-shadow:0 4px 20px rgba(0,0,0,.2);}
.comm-card:active{transform:scale(0.98);}
.comm-card-header{display:flex;align-items:center;gap:10px;}
.comm-card-av{width:38px;height:38px;border-radius:12px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:.9rem;font-weight:700;color:#121212;overflow:hidden;}
.comm-card-av img{width:100%;height:100%;object-fit:cover;}
.comm-card-name{font-weight:700;font-size:.95rem;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.comm-card-live{background:var(--red);color:#fff;font-size:.65rem;font-weight:700;padding:2px 7px;border-radius:20px;letter-spacing:.04em;flex-shrink:0;}
.comm-card-meta{font-size:.75rem;color:var(--text3);display:flex;gap:6px;}
.comm-card-desc{font-size:.78rem;color:var(--text2);overflow:hidden;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;flex:1;}
.comm-card-members{display:flex;align-items:center;gap:4px;margin-top:auto;}
.comm-card-av-stack{display:flex;}
.comm-card-av-stack .av-s{width:22px;height:22px;border-radius:50%;border:2px solid var(--bg2);margin-left:-6px;background:var(--bg3);font-size:.6rem;display:flex;align-items:center;justify-content:center;font-weight:700;overflow:hidden;flex-shrink:0;}
.comm-card-av-stack .av-s:first-child{margin-left:0;}
.comm-card-av-stack .av-s img{width:100%;height:100%;object-fit:cover;}
.comm-card-more{font-size:.72rem;color:var(--text3);margin-left:6px;}
.community-icons-bar{transform:translateX(-100%);transition:transform .2s ease;}
.community-icons-bar.visible{transform:translateX(0);}
.communities-sidebar.active{display:flex;}
.community-icons-bar{width:64px;min-width:64px;background:var(--bg);display:flex;flex-direction:column;align-items:center;padding:8px 0;gap:6px;border-right:1px solid var(--border);overflow-y:auto;scrollbar-width:none;}
.community-icons-bar::-webkit-scrollbar{display:none;}
.community-icon-btn{width:44px;height:44px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.8rem;font-weight:700;color:#121212;transition:border-radius var(--tr),transform var(--tr);position:relative;overflow:hidden;flex-shrink:0;}
.community-icon-btn:hover{border-radius:30%;}
.community-icon-btn.active{box-shadow:inset 0 0 0 3px rgba(255,255,255,.4);transform:scale(1);border-radius:16px;}
.community-icon-btn img{width:100%;height:100%;object-fit:cover;}
.community-icon-btn::after{content:'';position:absolute;left:-6px;top:50%;transform:translateY(-50%);width:4px;height:0;background:var(--accent);border-radius:0 2px 2px 0;transition:height var(--tr);}
.community-icon-btn.active::after{height:70%;}
.community-icon-btn:hover::after{height:40%;}
.community-icon-sep{width:32px;height:2px;background:var(--border2);border-radius:1px;flex-shrink:0;}
.community-add-btn{width:44px;height:44px;border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;background:var(--bg2);border:none;color:var(--accent);transition:all var(--tr);flex-shrink:0;}
.community-add-btn:hover{border-radius:30%;background:var(--accent);color:#121212;}
/* Панель каналов */
.community-panel{flex:1;display:flex;flex-direction:column;background:var(--bg2);overflow:hidden;}
.community-panel-header{padding:16px;border-bottom:1px solid var(--border);flex-shrink:0;display:flex;align-items:center;justify-content:space-between;}
.community-panel-name{font-family:var(--font-head);font-size:.95rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.channel-list{flex:1;overflow-y:auto;padding:8px;scrollbar-width:none;}
.channel-list::-webkit-scrollbar{display:none;}
.channel-section-title{font-size:.68rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--text3);padding:8px 8px 4px;display:flex;align-items:center;justify-content:space-between;}
.channel-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:6px;cursor:pointer;transition:background var(--tr);color:var(--text3);}
.channel-item:hover{background:var(--bg3);color:var(--text2);}
.channel-item.active{background:var(--bg4);color:var(--text);}
.channel-item svg{width:16px;height:16px;flex-shrink:0;}
.channel-item-name{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;}
/* Голосовой канал — участники */
.voice-members{display:flex;margin-left:auto;}
.voice-member-av{width:20px;height:20px;border-radius:50%;border:2px solid var(--bg2);margin-left:-6px;overflow:hidden;background:var(--accent);display:flex;align-items:center;justify-content:center;font-size:.55rem;font-weight:700;color:#121212;flex-shrink:0;}
.voice-member-av:first-child{margin-left:0;}
.voice-member-av img{width:100%;height:100%;object-fit:cover;}
.voice-more{width:20px;height:20px;border-radius:50%;border:2px solid var(--bg2);margin-left:-6px;background:var(--bg4);display:flex;align-items:center;justify-content:center;font-size:.5rem;color:var(--text2);flex-shrink:0;}
/* Нет сообществ */
.no-communities{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:20px;text-align:center;}
.no-communities-icon{width:64px;height:64px;border-radius:50%;background:var(--bg3);display:flex;align-items:center;justify-content:center;}
.no-communities-icon svg{width:28px;height:28px;color:var(--text3);}
/* Создание сообщества */
.create-community-modal{position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(6px);z-index:300;display:none;align-items:center;justify-content:center;}
.create-community-modal.open{display:flex;animation:fadeIn .15s;}
/* Создание группы */
.cg-modal{position:fixed;inset:0;background:rgba(0,0,0,.7);backdrop-filter:blur(6px);z-index:300;display:none;align-items:center;justify-content:center;}
.cg-modal.open{display:flex;animation:fadeIn .15s;}
.cg-card{background:var(--bg2);border:1px solid var(--border2);border-radius:20px;width:420px;max-height:85vh;display:flex;flex-direction:column;overflow:hidden;box-shadow:0 40px 100px rgba(0,0,0,.6);animation:scaleIn .2s cubic-bezier(.4,0,.2,1);}
.cg-step{display:none;flex-direction:column;flex:1;overflow:hidden;}
.cg-step.active{display:flex;}
.cg-header{padding:18px 20px 14px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;flex-shrink:0;}
.member-list{flex:1;overflow-y:auto;padding:6px 8px;scrollbar-width:none;}
.member-list::-webkit-scrollbar{display:none;}
.member-row{display:flex;align-items:center;gap:12px;padding:9px 12px;border-radius:var(--radius-sm);cursor:pointer;transition:background var(--tr);}
.member-row:hover{background:var(--bg3);}
.member-row.sel{background:rgba(0,201,177,.1);}
.member-check{width:20px;height:20px;border-radius:50%;border:2px solid var(--border2);display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:all var(--tr);}
.member-row.sel .member-check{background:var(--accent);border-color:var(--accent);}
.member-check-inner{width:10px;height:10px;display:none;}
.member-row.sel .member-check-inner{display:block;}
.sel-bar{display:flex;gap:10px;overflow-x:auto;padding:0 16px;scrollbar-width:none;max-height:0;overflow-y:hidden;transition:max-height .2s,padding .2s;}
.sel-bar::-webkit-scrollbar{display:none;}
.sel-bar.has{max-height:80px;padding:10px 16px;border-bottom:1px solid var(--border);}
.sel-chip{display:flex;flex-direction:column;align-items:center;gap:3px;flex-shrink:0;cursor:pointer;}
.sel-chip-av{width:40px;height:40px;border-radius:50%;position:relative;display:flex;align-items:center;justify-content:center;font-family:var(--font-head);font-size:.72rem;font-weight:700;color:#121212;}
.sel-chip-rm{position:absolute;top:-2px;right:-2px;width:15px;height:15px;border-radius:50%;background:var(--red);display:flex;align-items:center;justify-content:center;font-size:.55rem;color:#fff;line-height:1;}
.sel-chip-name{font-size:.62rem;color:var(--text2);white-space:nowrap;max-width:48px;overflow:hidden;text-overflow:ellipsis;}
/* Новое меню + */
.new-dropdown{position:fixed;background:var(--bg2);border:1px solid var(--border2);border-radius:var(--radius-sm);padding:6px;min-width:170px;box-shadow:0 12px 40px rgba(0,0,0,.5);display:none;flex-direction:column;gap:2px;z-index:400;animation:fadeUp .15s ease;}
.new-dropdown.open{display:flex;}
.new-dropdown-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:8px;cursor:pointer;font-size:.88rem;transition:background var(--tr);}
.new-dropdown-item:hover{background:var(--bg3);}
/* Контекстное меню участника группы */
#member-ctx-menu{min-width:180px;}
/* Участники группы в профиле */
.gm-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);}
.gm-row:last-child{border-bottom:none;}
.gm-badge{font-size:.65rem;padding:2px 7px;border-radius:8px;font-weight:600;margin-left:4px;}
.gm-badge.owner{background:rgba(0,201,177,.15);color:var(--accent);}
.gm-badge.admin{background:rgba(138,43,226,.15);color:#8A2BE2;}

/* ══ ПАНЕЛЬ КАНАЛОВ СООБЩЕСТВА ══════════════════ */
.comm-channels-panel {
  position: fixed;
  top: 0;
  left: var(--sidebar);
  width: 260px;
  height: 100dvh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transform: translateX(-110%);
  opacity: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s ease;
  pointer-events: none;
  overflow: hidden;
}
.comm-channels-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: all;
}
/* Когда панель открыта — сдвигаем chat-area */
#screen-app.channels-open .chat-area {
  margin-left: 260px;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
#screen-app:not(.channels-open) .chat-area {
  margin-left: 0;
  transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}


/* ══ IN-APP УВЕДОМЛЕНИЯ ══════════════════════════ */
.inapp-notif {
  position: fixed;
  width: 320px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9000;
  cursor: pointer;
  transform: translateX(120%);
  opacity: 0;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s ease;
  max-width: calc(100vw - 32px);
}
.inapp-notif[data-pos="bottom-left"],
.inapp-notif[data-pos="top-left"] {
  transform: translateX(-120%);
}
.inapp-notif.show {
  transform: translateX(0);
  opacity: 1;
}
.inapp-notif:hover { background: var(--bg3); }
.inapp-notif-av {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
}
.inapp-notif-body { flex: 1; min-width: 0; }
.inapp-notif-title {
  font-weight: 700;
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inapp-notif-text {
  font-size: .78rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.inapp-notif-close {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: .8rem;
  line-height: 1;
  transition: background .15s;
}
.inapp-notif-close:hover { background: var(--bg4); color: var(--text); }

/* ── Индикатор загрузки медиа ── */
.msg-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.msg-upload-progress {
  position: relative;
  width: 44px;
  height: 44px;
  cursor: pointer;
}
.msg-upload-progress svg {
  transform: rotate(-90deg);
}
.msg-upload-progress circle.track {
  fill: none;
  stroke: rgba(255,255,255,.3);
  stroke-width: 3;
}
.msg-upload-progress circle.fill {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 113;
  stroke-dashoffset: 113;
  transition: stroke-dashoffset .3s;
}
.msg-upload-progress .cancel-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.msg-img-wrap { position: relative; }
.msg-video-circle { position: relative; }
/* Видео в сообщении */
.msg-video-wrap video {
  max-height: 400px;
  object-fit: contain;
}

/* ── Тёмная тема ── */
body.theme-dark {
  --bg:#1A2B4F;
  --bg2:#1C2F4A;
  --bg3:#2A4060;
  --bg4:#3A557A;
  --surface:#1C2F4A;
  --surface2:#2A4060;
  --border:#4A6B8A;
  --border2:#4A6B8A;
  --accent:#A8D8EA;
  --accent2:#BBD0E4;
  --accent3:#8BC8DC;
  --accent-glow:rgba(168,216,234,0.25);
  --teal:#A8D8EA;
  --teal-dim:rgba(168,216,234,0.15);
  --text:#ECF0F1;
  --text2:#95A5A6;
  --text3:#95A5A6;
}

body.theme-dark .chat-area {
  background: #233455 !important;
}

body.theme-dark #messages-area,
body.theme-dark #messages-area.private-bg {
  background-color: #233455 !important;
  background-image: none !important;
}

.channel-media-tab{background:none;border:none;color:var(--text3);cursor:pointer;padding:8px 12px;font-family:var(--font-body);font-size:.85rem;border-bottom:2px solid transparent;}
.channel-media-tab.active{color:var(--accent);border-bottom-color:var(--accent);}.global-search-filter{background:var(--bg3);border:none;border-radius:20px;padding:6px 14px;font-size:.82rem;cursor:pointer;color:var(--text2);white-space:nowrap;font-family:var(--font-body);transition:all .15s;}
.global-search-filter.active{background:var(--accent);color:#fff;}
.folder-tab{background:var(--bg3);border:none;border-radius:20px;padding:6px 14px;font-size:.82rem;cursor:pointer;color:var(--text2);white-space:nowrap;font-family:var(--font-body);transition:all .15s;flex-shrink:0;}
.folder-tab.active{background:var(--accent);color:#fff;}
#folders-bar::-webkit-scrollbar{display:none;}
#folder-items-modal { z-index: 10000 !important; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
