:root{--blue:#2f7edb;--blue-soft:#eaf3ff;--rail:#303b49;--sidebar:#f7f9fc;--line:#e3e8ef;--chat:#f4f7fa;--text:#263445;--muted:#8794a3}
*{box-sizing:border-box}html,body{height:100%;margin:0;font-family:Inter,"Noto Sans Thai",Arial,sans-serif;color:var(--text);background:#fff}button,input,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}
.shell{height:100vh;display:grid;grid-template-columns:58px 286px minmax(520px,1fr) 300px;overflow:hidden;background:#fff}.rail{background:var(--rail);display:flex;flex-direction:column;align-items:center;padding:9px 7px;gap:7px}.app-mark,.profile-dot{width:38px;height:38px;border:0;border-radius:10px;display:grid;place-items:center;background:var(--blue);color:white;font-weight:700}.profile-dot{border-radius:50%}.rail-button{width:42px;height:42px;border:0;border-radius:10px;background:transparent;color:#d8e1eb;font-size:17px}.rail-button:hover,.rail-button.active{background:#465365;color:#fff}.rail-button.active{box-shadow:inset 3px 0 0 #69aef4}.rail-spacer{flex:1}
.sidebar{background:var(--sidebar);border-right:1px solid var(--line);overflow:auto}.sidebar-top{height:74px;padding:14px 14px 9px 17px;display:flex;align-items:center;justify-content:space-between}.sidebar-top h1{font-size:19px;margin:0 0 3px}.me-label{font-size:11px;color:var(--muted)}.icon-button{border:1px solid var(--line);background:#fff;color:#667587;border-radius:8px}.circle{width:36px;height:36px;border-radius:50%;font-size:21px}.search-box{height:38px;margin:0 12px 10px;padding:0 11px;border-radius:9px;background:#eaf0f6;display:flex;align-items:center;gap:8px;color:#7f8c9b}.search-box input{border:0;outline:0;background:transparent;width:100%}.sidebar-tabs{display:flex;gap:21px;padding:0 13px 8px}.sidebar-tabs button{border:0;background:transparent;padding:7px 0;color:var(--muted);font-size:12px;border-bottom:2px solid transparent}.sidebar-tabs button.active{color:var(--blue);border-color:var(--blue)}.room-list{padding:1px 7px 9px}.room{width:100%;border:0;background:transparent;min-height:54px;padding:7px 8px;border-radius:7px;display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:9px;text-align:left;margin-bottom:1px}.room:hover{background:#edf2f7}.room.active{background:#deebfb}.room-icon{width:34px;height:34px;border-radius:8px;display:grid;place-items:center;background:#e4eaf0;color:#6e7d8e;font-weight:750}.room.active .room-icon{background:var(--blue);color:#fff}.room-copy{min-width:0}.room-copy b,.room-copy small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.room-copy b{font-size:13px}.room-copy small{margin-top:4px;font-size:11px;color:#8d99a7}.room-side{display:flex;flex-direction:column;align-items:flex-end;gap:7px}.room-side time{font-size:10px;color:#9ba6b2}.room-side em{font-style:normal;font-size:9px;color:#fff;background:var(--blue);min-width:17px;height:17px;border-radius:9px;display:grid;place-items:center}.section-title{padding:16px 15px 6px;font-size:11px;color:var(--muted);display:flex;justify-content:space-between}.section-title button{border:0;background:transparent;color:inherit}.contact-list{padding:0 9px}.contact-row{width:100%;border:0;background:transparent;display:grid;grid-template-columns:34px 1fr auto;align-items:center;gap:10px;padding:8px 6px;border-radius:7px;text-align:left}.contact-row:hover{background:#edf2f7}.avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700}.green{background:#2eb67d}.purple{background:#7657d6}.contact-row b,.contact-row small{display:block;font-size:12px}.contact-row small{color:var(--muted);margin-top:3px}.contact-row i{display:inline-block;width:7px;height:7px;border-radius:50%;background:#36c97d;margin-right:4px}.unread-dot{font-size:9px;background:var(--blue);color:#fff;border-radius:9px;min-width:17px;height:17px;display:grid;place-items:center}
.chat-area{min-width:0;display:grid;grid-template-rows:68px minmax(0,1fr) auto;background:var(--chat)}.chat-header{background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 16px}.channel-info{display:flex;align-items:center;gap:10px}.channel-avatar,.large-channel-avatar{display:grid;place-items:center;background:var(--blue-soft);color:var(--blue);font-weight:800}.channel-avatar{width:38px;height:38px;border-radius:10px}.channel-info h2{font-size:16px;margin:0}.channel-info small{color:var(--muted);font-size:11px}.header-actions{display:flex;align-items:center;gap:6px}.header-actions .icon-button{width:34px;height:34px}.member-stack{display:flex;margin-right:3px}.mini-avatar{width:25px;height:25px;border:2px solid #fff;border-radius:50%;display:grid;place-items:center;color:#fff;font-size:9px;font-weight:700;margin-left:-6px}.mini-avatar:first-child{margin-left:0}.mobile-menu{display:none}
.messages{overflow:auto;padding:22px 34px 34px;background:#f4f7fa}.date-divider{display:flex;align-items:center;gap:10px;margin:6px 0 22px;color:#929fac;font-size:10px}.date-divider:before,.date-divider:after{content:"";height:1px;background:#dfe5eb;flex:1}.date-divider span{background:#f4f7fa;padding:0 8px}.message-row{display:flex;gap:10px;margin:0 0 18px;max-width:min(720px,78%)}.message-row.mine{flex-direction:row-reverse;margin-left:auto}.message-avatar{width:34px;height:34px;flex:0 0 34px;border-radius:50%;display:grid;place-items:center;background:#5e7ef8;color:#fff;font-size:10px;font-weight:700}.message-row.mine .message-avatar{background:var(--blue)}.message-body{min-width:0}.message-meta{display:flex;align-items:center;gap:8px;margin:0 3px 5px;font-size:10px;color:#929eaa}.message-meta b{font-size:11px;color:#344251}.message-row.mine .message-meta{justify-content:flex-end}.bubble-wrap{position:relative}.bubble{padding:10px 13px;border:1px solid #e1e6ec;border-radius:6px 14px 14px 14px;background:#fff;box-shadow:0 2px 8px rgba(37,52,69,.05);white-space:pre-wrap;line-height:1.5;font-size:13px;overflow-wrap:anywhere}.message-row.mine .bubble{background:var(--blue);color:#fff;border-color:var(--blue);border-radius:14px 6px 14px 14px}.message-actions{position:absolute;right:6px;top:-17px;display:none;background:#fff;border:1px solid var(--line);border-radius:8px;box-shadow:0 5px 16px rgba(31,45,61,.12);padding:2px}.message-row.mine .message-actions{right:auto;left:6px}.bubble-wrap:hover .message-actions{display:flex}.message-actions button{width:26px;height:24px;border:0;background:transparent;color:#718092;border-radius:5px}.message-actions button:hover{background:#f1f4f8}.read-state{display:block;text-align:right;color:#97a3af;font-size:9px;margin-top:4px}.empty-state{height:100%;display:grid;place-items:center;text-align:center;color:#8b97a5}.empty-state strong{display:block;color:#4e5b69;margin-bottom:5px}
.composer-wrap{background:#fff;border-top:1px solid var(--line);padding:7px 15px 12px}.composer-tools{height:31px;display:flex;align-items:center;gap:3px}.composer-hint{margin-right:auto;font-size:10px;color:#8b97a4}.composer-tools button{width:30px;height:27px;border:0;border-radius:6px;background:transparent;color:#647487}.composer-tools button:hover{background:#f0f3f7}.composer{display:flex;align-items:flex-end;border:1px solid #d8dfe7;border-radius:10px;padding:6px 7px 6px 11px;background:#fff}.composer:focus-within{border-color:#83b6ec;box-shadow:0 0 0 3px rgba(47,126,219,.08)}.composer textarea{flex:1;border:0;outline:0;resize:none;min-height:31px;max-height:130px;padding:5px 0;background:transparent}.send-button{width:37px;height:33px;border:0;border-radius:8px;background:var(--blue);color:#fff;font-size:16px}
.info-panel{background:#fff;border-left:1px solid var(--line);overflow:auto}.info-panel.hidden-panel{display:none}.info-header{height:68px;padding:0 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}.info-header b{font-size:14px}.info-header .icon-button{border:0;font-size:22px}.channel-card{text-align:center;padding:25px 20px 21px;border-bottom:1px solid var(--line)}.large-channel-avatar{width:58px;height:58px;border-radius:14px;margin:0 auto 13px;font-size:22px}.channel-card h3{font-size:16px;margin:0 0 7px}.channel-card p{font-size:11px;line-height:1.5;color:var(--muted);margin:0}.info-section{border-bottom:1px solid var(--line);padding:8px 0}.info-section-title{display:flex;justify-content:space-between;padding:8px 16px;color:#687788;font-size:11px}.member-row{display:flex;gap:10px;align-items:center;padding:7px 16px}.member-row b,.member-row small{display:block;font-size:11px}.member-row small{color:var(--muted);margin-top:3px}.info-item{width:100%;min-height:46px;padding:0 16px;border:0;background:#fff;display:flex;align-items:center;justify-content:space-between;font-size:12px}.info-item span{color:#697888}.info-link:hover{background:#f8fafc}
@media(max-width:1120px){.shell{grid-template-columns:58px 286px minmax(0,1fr)}.info-panel{position:fixed;right:0;top:0;bottom:0;width:300px;z-index:10;box-shadow:-10px 0 30px rgba(31,45,61,.12)}}
@media(max-width:740px){.shell{grid-template-columns:1fr}.rail{display:none}.sidebar{position:fixed;z-index:20;left:0;top:0;bottom:0;width:285px;transform:translateX(-100%);transition:.2s;box-shadow:8px 0 30px rgba(30,45,60,.18)}.sidebar.mobile-open{transform:translateX(0)}.mobile-menu{display:inline-grid;place-items:center;width:34px;height:34px;border:0;border-radius:8px;background:#f0f3f7}.messages{padding:18px 12px 22px}.info-panel{display:none}.composer-hint{display:none}.message-row{max-width:94%}}

/* v0.4.1 interaction and secondary views */
.shell.info-closed{grid-template-columns:58px 286px minmax(520px,1fr)}
.shell.info-closed .info-panel{display:none}
.workspace-view{overflow:auto;background:#f5f7fa;padding:24px 28px}
.workspace-view.hidden{display:none}
.workspace-card{max-width:960px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:0 8px 24px rgba(37,51,68,.05)}
.workspace-head{height:72px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}
.workspace-head h2{margin:0;font-size:18px}.workspace-head p{margin:4px 0 0;color:var(--muted);font-size:11px}
.workspace-search{height:36px;min-width:240px;border:1px solid var(--line);border-radius:8px;padding:0 11px;outline:none}
.workspace-list{padding:8px 0}.workspace-row{display:grid;grid-template-columns:42px 1fr auto;align-items:center;gap:12px;padding:11px 18px;border-bottom:1px solid #eef2f5}
.workspace-row:last-child{border-bottom:0}.workspace-row:hover{background:#f8fafc}.workspace-row b,.workspace-row small{display:block}.workspace-row small{color:var(--muted);font-size:11px;margin-top:4px}.workspace-row .row-action{border:1px solid var(--line);background:#fff;border-radius:7px;padding:6px 10px;color:#5f6f81}
.file-icon{width:38px;height:38px;border-radius:9px;background:#edf3fb;display:grid;place-items:center;font-size:18px}
.settings-grid{display:grid;grid-template-columns:220px 1fr;min-height:480px}.settings-menu{padding:12px;border-right:1px solid var(--line);background:#fafbfd}.settings-menu button{width:100%;border:0;background:transparent;text-align:left;padding:10px 12px;border-radius:7px;color:#5e6d7e}.settings-menu button.active{background:#e8f2ff;color:var(--blue)}.settings-content{padding:24px}.setting-field{margin-bottom:18px}.setting-field label{display:block;font-size:12px;font-weight:700;margin-bottom:7px}.setting-field input,.setting-field select{width:100%;max-width:420px;height:38px;border:1px solid var(--line);border-radius:8px;padding:0 10px;background:#fff}
.reply-preview{display:flex;align-items:center;justify-content:space-between;margin:0 0 6px;border-left:3px solid var(--blue);background:#f4f8fd;border-radius:6px;padding:7px 9px}.reply-preview.hidden{display:none}.reply-preview b,.reply-preview span{display:block;font-size:10px}.reply-preview span{color:var(--muted);margin-top:2px}.reply-preview button{border:0;background:transparent;font-size:17px;color:#778696}
.attachment-preview{margin:0 0 7px;padding:8px 10px;border:1px dashed #b9c6d5;border-radius:8px;background:#fafcfe;display:flex;align-items:center;gap:9px;font-size:11px}.attachment-preview img{width:44px;height:44px;object-fit:cover;border-radius:6px}.attachment-preview button{margin-left:auto;border:0;background:transparent;color:#788696}
.emoji-popover{position:fixed;z-index:50;background:white;border:1px solid var(--line);box-shadow:0 10px 30px rgba(30,45,60,.15);border-radius:10px;padding:9px;display:grid;grid-template-columns:repeat(6,32px);gap:3px}.emoji-popover button{border:0;background:transparent;border-radius:6px;font-size:18px;height:32px}.emoji-popover button:hover{background:#f0f3f7}
.message-actions{opacity:0;transition:.15s}.message-row:hover .message-actions{opacity:1}
.message-reactions{display:flex;gap:4px;margin-top:5px}.reaction-chip{border:1px solid #d8e1eb;background:#fff;border-radius:10px;padding:2px 7px;font-size:10px}.reaction-chip.active{border-color:#8bbcf0;background:#edf6ff}
@media(max-width:1120px){.shell.info-closed{grid-template-columns:58px 286px minmax(0,1fr)}}


/* v0.4.2 modal and notification center */
.notification-button{position:relative}.notification-badge{position:absolute;right:-4px;top:-5px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#ef5b5b;color:white;font-size:9px;display:grid;place-items:center;border:2px solid white}
.modal-backdrop{position:fixed;inset:0;z-index:100;background:rgba(24,34,47,.38);display:grid;place-items:center;padding:20px}.modal-backdrop.hidden{display:none}.modal-card{width:min(440px,100%);background:white;border-radius:13px;box-shadow:0 24px 70px rgba(24,34,47,.28);overflow:hidden}.modal-head{display:flex;align-items:flex-start;justify-content:space-between;padding:18px 20px;border-bottom:1px solid var(--line)}.modal-head h3{margin:0;font-size:17px}.modal-head p{margin:4px 0 0;color:var(--muted);font-size:11px}.modal-head .icon-button{border:0;font-size:22px}.modal-body{padding:20px}.modal-field{display:block;margin-bottom:16px}.modal-field>span{display:block;margin-bottom:7px;font-size:12px;font-weight:700}.modal-field input,.modal-field textarea{width:100%;border:1px solid #d7dfe8;border-radius:8px;padding:10px 11px;outline:none;resize:vertical}.modal-field input:focus,.modal-field textarea:focus{border-color:#79afe8;box-shadow:0 0 0 3px rgba(47,126,219,.09)}.switch-row{display:flex;align-items:flex-start;gap:9px;padding:8px 0}.switch-row b,.switch-row small{display:block}.switch-row b{font-size:12px}.switch-row small{font-size:10px;color:var(--muted);margin-top:3px}.modal-error{margin-top:10px;padding:9px 10px;border-radius:7px;background:#fff0f0;color:#d94444;font-size:11px}.modal-error.hidden{display:none}.modal-actions{display:flex;justify-content:flex-end;gap:8px;padding:13px 20px;background:#fafbfd;border-top:1px solid var(--line)}.secondary-button,.primary-button{height:36px;border-radius:8px;padding:0 16px}.secondary-button{border:1px solid #d7dfe8;background:white;color:#5c6c7d}.primary-button{border:1px solid var(--blue);background:var(--blue);color:white}
.notification-popover{position:fixed;z-index:90;width:340px;background:white;border:1px solid var(--line);border-radius:11px;box-shadow:0 15px 45px rgba(27,40,55,.18);overflow:hidden}.notification-popover.hidden{display:none}.notification-head{height:48px;padding:0 14px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.notification-head b{font-size:13px}.notification-head button{border:0;background:transparent;color:var(--blue);font-size:10px}.notification-item{position:relative;width:100%;display:grid;grid-template-columns:34px 1fr;gap:10px;text-align:left;border:0;border-bottom:1px solid #eef2f5;background:white;padding:12px 14px}.notification-item:last-child{border-bottom:0}.notification-item:hover{background:#f8fafc}.notification-item.unread{background:#f1f7ff}.notification-item.unread:after{content:"";position:absolute;right:12px;top:18px;width:7px;height:7px;border-radius:50%;background:var(--blue)}.notification-icon{width:32px;height:32px;border-radius:9px;background:#eaf3ff;display:grid;place-items:center}.notification-item b,.notification-item small{display:block;padding-right:12px}.notification-item b{font-size:11px}.notification-item small{font-size:10px;color:var(--muted);margin-top:4px;line-height:1.4}
@media(max-width:740px){.notification-popover{left:10px!important;right:10px!important;width:auto}.modal-card{width:100%}}

/* v0.4.3 */
.contact-row.active{background:#e8f2ff;color:#1769c2}
.contact-row.active small{color:#5d8fc7}
.search-modal-card{width:min(560px,calc(100vw - 28px));max-height:min(700px,86vh)}
.message-search-results{margin-top:14px;border:1px solid #e5eaf0;border-radius:10px;max-height:360px;overflow:auto;background:#fff}
.search-empty{padding:30px 18px;text-align:center;color:#8b98aa;font-size:13px}
.search-result{display:block;width:100%;border:0;border-bottom:1px solid #eef1f5;background:#fff;text-align:left;padding:13px 14px}
.search-result:last-child{border-bottom:0}
.search-result:hover{background:#f5f9ff}
.search-result b,.search-result small,.search-result span{display:block}
.search-result b{font-size:12px;margin-bottom:5px}
.search-result span{font-size:13px;line-height:1.5;color:#334155}
.search-result small{font-size:11px;color:#94a3b8;margin-top:5px}
.search-highlight{animation:messageFlash 1.7s ease}
@keyframes messageFlash{0%,100%{filter:none}35%{filter:drop-shadow(0 0 8px rgba(47,126,219,.55))}}


/* v0.4.4 message management */
.message-actions{position:relative}
.message-actions button.active{background:#e8f2ff;color:var(--blue)}
.message-menu{position:fixed;z-index:80;min-width:160px;padding:6px;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 12px 32px rgba(31,45,61,.18)}
.message-menu button{width:100%;height:36px;border:0;background:transparent;border-radius:7px;text-align:left;padding:0 10px;color:var(--text);font-size:12px}
.message-menu button:hover{background:#f2f6fb}
.message-menu button.danger{color:#d94c4c}
.message-row.pinned .bubble-wrap:before{content:'📌';position:absolute;left:-18px;top:3px;font-size:11px}
.message-row.pinned .bubble-wrap{position:relative}
.edited-label{margin-left:5px;color:#9aa7b7;font-weight:400}
.pinned-modal-card{width:min(560px,calc(100vw - 30px))}
.pinned-list{max-height:55vh;overflow:auto;padding:8px 16px 16px}
.pinned-entry{width:100%;border:1px solid var(--line);background:#fff;border-radius:10px;padding:12px;margin-top:8px;text-align:left;display:grid;gap:6px}
.pinned-entry:hover{background:#f8fafc}
.pinned-entry b{font-size:12px}.pinned-entry span{font-size:12px;line-height:1.45}.pinned-entry small{font-size:10px;color:var(--muted)}
.edit-message-card{width:min(520px,calc(100vw - 30px))}
.message-row.removing{opacity:.35;transform:scale(.98);transition:.18s}
.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:120;background:#263445;color:#fff;padding:10px 14px;border-radius:9px;font-size:12px;box-shadow:0 10px 30px rgba(31,45,61,.2)}
\n\n/* v0.4.5 attachments and shared items */\n.attachment-bubble{padding:7px;min-width:230px}\n.message-image{display:block;max-width:320px;max-height:240px;width:100%;object-fit:cover;border-radius:9px;margin-bottom:7px}\n.message-file-card{display:grid;grid-template-columns:36px minmax(0,1fr) 28px;gap:9px;align-items:center;background:rgba(255,255,255,.78);color:var(--text);border-radius:9px;padding:8px}\n.mine .message-file-card{background:rgba(255,255,255,.94)}\n.message-file-card span:nth-child(2){min-width:0}.message-file-card b,.message-file-card small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.message-file-card b{font-size:11px}.message-file-card small{font-size:10px;color:var(--muted);margin-top:3px}.message-file-card button{border:0;background:transparent;color:var(--blue)}\n.message-file-icon{font-size:20px;text-align:center}\n.shared-items-card{width:min(620px,calc(100vw - 30px))}.shared-tabs{display:flex;border-bottom:1px solid var(--line);padding:0 18px}.shared-tabs button{border:0;background:transparent;padding:11px 12px;color:var(--muted);border-bottom:2px solid transparent}.shared-tabs button.active{color:var(--blue);border-color:var(--blue)}\n.shared-items-list{padding:12px 18px 18px;max-height:58vh;overflow:auto;display:grid;gap:9px}.shared-item{display:grid;grid-template-columns:48px minmax(0,1fr);gap:11px;align-items:center;border:1px solid var(--line);border-radius:10px;padding:9px;background:#fff}.shared-item img{width:48px;height:48px;object-fit:cover;border-radius:7px}.shared-file-icon{width:48px;height:48px;display:grid;place-items:center;background:#f0f4f9;border-radius:7px;font-size:22px}.shared-item b,.shared-item small{display:block}.shared-item b{font-size:12px}.shared-item small{font-size:10px;color:var(--muted);margin-top:4px}\n
/* v0.4.6 drafts, typing indicator, and unread polish */
.draft-label{display:block!important;color:#e05d44!important;font-size:10px!important;margin-top:3px!important;font-weight:600}
.typing-indicator{min-height:24px;display:flex;align-items:center;gap:4px;padding:0 4px 5px;color:#8996a5;font-size:10px}
.typing-indicator span{width:5px;height:5px;border-radius:50%;background:#8ea0b4;animation:typingBounce 1.1s infinite ease-in-out}
.typing-indicator span:nth-child(2){animation-delay:.14s}.typing-indicator span:nth-child(3){animation-delay:.28s}
.typing-indicator b{font-weight:500;margin-left:4px}
@keyframes typingBounce{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-3px);opacity:1}}
.room.has-unread .room-copy b{font-weight:800}.room.has-unread .room-copy small{color:#536477}

/* v0.4.7: drag-and-drop / clipboard attachment experience */
.messages.drag-active,.composer-wrap.drag-active{outline:2px dashed #2f7edb;outline-offset:-8px;background:#eef6ff}
.drop-overlay{position:absolute;inset:68px 0 92px;z-index:35;display:flex;align-items:center;justify-content:center;background:rgba(238,246,255,.92);backdrop-filter:blur(2px);pointer-events:none}
.drop-overlay.hidden{display:none}
.drop-overlay-card{min-width:320px;padding:30px 34px;border:2px dashed #2f7edb;border-radius:16px;background:#fff;text-align:center;box-shadow:0 14px 36px rgba(40,77,120,.14)}
.drop-overlay-card strong{display:block;font-size:16px;margin:8px 0 5px}.drop-overlay-card span{display:block;color:#7d8b9d;font-size:12px}.drop-overlay-icon{font-size:34px}
.attachment-preview{gap:9px;flex-wrap:wrap}.attachment-preview .upload-state{margin-left:auto;font-size:11px;color:#7d8b9d}.attachment-preview.uploading{opacity:.78}.attachment-preview.uploading:after{content:"";height:2px;background:#2f7edb;position:absolute;left:0;bottom:0;animation:uploadProgress .7s ease-out forwards}
@keyframes uploadProgress{from{width:0}to{width:100%}}
.paste-hint{position:absolute;right:18px;bottom:96px;z-index:40;padding:8px 11px;border-radius:8px;background:#273444;color:#fff;font-size:11px;box-shadow:0 8px 22px rgba(0,0,0,.18);animation:hintIn .18s ease-out}.paste-hint.hidden{display:none}@keyframes hintIn{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}

/* v0.4.8 shared links, previews, and message forwarding */
.bubble a.message-link{color:#176fd1;text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}.mine .bubble a.message-link{color:#fff}
.link-preview-card{display:grid;grid-template-columns:42px minmax(0,1fr) 28px;gap:9px;align-items:center;margin-top:8px;padding:9px;border:1px solid rgba(113,135,158,.22);border-radius:9px;background:rgba(244,248,252,.95);color:var(--text)}
.mine .link-preview-card{background:rgba(255,255,255,.94)}.link-preview-icon{width:42px;height:42px;border-radius:8px;background:#e8f2ff;color:var(--blue);display:grid;place-items:center;font-size:19px}.link-preview-copy{min-width:0}.link-preview-copy b,.link-preview-copy small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.link-preview-copy b{font-size:11px}.link-preview-copy small{font-size:10px;color:var(--muted);margin-top:4px}.link-preview-open{border:0;background:transparent;color:var(--blue);font-size:16px}
.shared-links-card{width:min(650px,calc(100vw - 30px))}.shared-links-list{padding:12px 18px 18px;max-height:60vh;overflow:auto;display:grid;gap:9px}.shared-link-entry{display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:10px;align-items:center;border:1px solid var(--line);border-radius:10px;padding:10px;background:#fff}.shared-link-entry:hover{background:#f8fbff}.shared-link-entry .link-preview-icon{width:40px;height:40px}.shared-link-entry b,.shared-link-entry small{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.shared-link-entry b{font-size:12px}.shared-link-entry small{font-size:10px;color:var(--muted);margin-top:4px}.shared-link-actions{display:flex;gap:4px}.shared-link-actions button{width:30px;height:30px;border:1px solid var(--line);border-radius:7px;background:#fff;color:#607286}
.forward-card{width:min(520px,calc(100vw - 30px))}.forward-preview{margin:16px 20px 0;padding:12px;border-radius:9px;background:#f4f7fa;border:1px solid var(--line);font-size:12px;line-height:1.5;max-height:110px;overflow:auto}.forward-search{width:100%;height:39px;border:1px solid #d7dfe8;border-radius:8px;padding:0 11px;outline:none}.forward-search:focus{border-color:#79afe8;box-shadow:0 0 0 3px rgba(47,126,219,.09)}.forward-targets{margin-top:12px;max-height:300px;overflow:auto;border:1px solid var(--line);border-radius:9px}.forward-target{width:100%;display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;align-items:center;border:0;border-bottom:1px solid #edf1f5;background:#fff;padding:10px;text-align:left}.forward-target:last-child{border-bottom:0}.forward-target:hover{background:#f4f8fd}.forward-target-icon{width:34px;height:34px;border-radius:9px;background:#e8f2ff;color:var(--blue);display:grid;place-items:center;font-weight:700}.forward-target b,.forward-target small{display:block}.forward-target b{font-size:12px}.forward-target small{font-size:10px;color:var(--muted);margin-top:3px}.forward-target em{font-style:normal;color:var(--blue);font-size:11px}.forwarded-label{display:block;margin-bottom:6px;font-size:10px;color:#8b98a8}.mine .forwarded-label{color:rgba(255,255,255,.78)}


/* v0.6.3 real reactions and pins */
.server-reactions{display:flex;gap:5px;flex-wrap:wrap;margin-top:5px}.reaction-chip{border:1px solid #d7e0eb;background:#fff;border-radius:13px;padding:2px 7px;display:flex;align-items:center;gap:4px;cursor:pointer;font-size:12px}.reaction-chip.active{background:#e7f1ff;border-color:#6aa8f7}.reaction-chip b{font-size:11px}.server-pinned .bubble{box-shadow:0 0 0 1px #f0b429 inset}.server-pin-mark{margin-left:8px;color:#a36b00;font-weight:500}.reaction-quick-picker{display:flex;gap:2px;padding:5px;border-bottom:1px solid #e8edf3}.reaction-quick-picker button{border:0;background:transparent;padding:4px;cursor:pointer;font-size:17px}.reaction-quick-picker button:hover{background:#eef4fb;border-radius:6px}


/* v0.6.4 thread drawer */
.thread-drawer{position:fixed;top:0;right:0;bottom:0;width:390px;max-width:92vw;background:#fff;border-left:1px solid #dce4ee;box-shadow:-12px 0 30px rgba(30,55,80,.14);z-index:1200;display:flex;flex-direction:column;transition:transform .2s ease}.thread-drawer.hidden{display:flex!important;transform:translateX(105%);pointer-events:none}.thread-head{height:66px;padding:12px 16px;border-bottom:1px solid #e5ebf2;display:flex;align-items:center;justify-content:space-between}.thread-head div{display:flex;flex-direction:column;gap:3px}.thread-head small{color:#8a99aa}.thread-head button{border:0;background:transparent;font-size:26px;color:#718096;cursor:pointer}.thread-original{margin:14px;padding:14px;border-radius:10px;background:#f4f7fb;border:1px solid #e3e9f1}.thread-original p{margin:7px 0 0;white-space:pre-wrap}.thread-replies{flex:1;overflow:auto;padding:4px 14px 16px}.thread-reply{display:flex;gap:10px;padding:12px 2px;border-bottom:1px solid #edf1f5}.thread-avatar{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#3d83df;color:#fff;font-weight:700;flex:0 0 auto}.thread-reply>div{min-width:0;flex:1}.thread-reply b{font-size:13px}.thread-reply small{margin-left:8px;color:#98a6b6}.thread-reply p{margin:5px 0 0;white-space:pre-wrap;word-break:break-word}.thread-form{padding:12px;border-top:1px solid #e5ebf2;display:flex;gap:8px}.thread-form textarea{flex:1;resize:none;border:1px solid #ccd7e4;border-radius:9px;padding:10px;font:inherit;outline:none}.thread-form textarea:focus{border-color:#3d83df}.thread-form button{border:0;border-radius:9px;background:#2f80df;color:#fff;padding:0 16px;font-weight:700;cursor:pointer}.thread-count-badge{align-self:flex-start;border:0;background:transparent;color:#397ccb;font-size:12px;padding:5px 0;cursor:pointer}.thread-empty,.thread-loading{text-align:center;color:#8d9aaa;padding:24px 8px}@media(max-width:760px){.thread-drawer{width:100%;max-width:none}}


/* v0.6.5 presence and read receipts */
.read-state{display:block;margin-top:4px;color:#8b9aad;font-size:10px;text-align:right}.mine .read-state{color:#5587be}.contact-row small{transition:color .15s}.contact-row small:first-letter{text-transform:uppercase}

#login {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, #edf5ff, transparent 45%),
    #f5f7fa;
}

#login.hidden,
#app.hidden {
  display: none !important;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
}

.login-card {
  padding: 36px;
  background: #fff;
  border: 1px solid #dfe6ef;
  border-radius: 18px;
  box-shadow: 0 18px 55px rgba(36, 55, 78, .15);
}

.login-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  border-radius: 15px;
  background: #3182e8;
}

.login-card h1,
.login-card p {
  text-align: center;
}

.login-card p {
  margin-bottom: 24px;
  color: #8290a3;
}

.login-card label {
  display: block;
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 13px;
  border: 1px solid #ced8e5;
  border-radius: 9px;
  font: inherit;
}

.password-field {
  display: flex;
  gap: 6px;
}

.password-field input {
  flex: 1;
}

.password-field button {
  width: 44px;
  border: 1px solid #ced8e5;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.login-button,
.register-button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.login-button {
  border: 0;
  color: #fff;
  background: #3182e8;
}

.register-button {
  border: 1px solid #ced8e5;
  color: #334155;
  background: #fff;
}

.auth-error {
  min-height: 22px;
  margin-top: 10px;
  color: #d14343;
  font-size: 13px;
  text-align: center;
}

.account-menu {
  position: fixed;
  z-index: 10000;
  width: 230px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dfe6ef;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(35, 52, 72, .2);
}

.account-menu-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
}

.account-menu-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  border-radius: 50%;
  background: #3182e8;
}

.account-menu-header strong,
.account-menu-header small {
  display: block;
}

.account-menu-header small {
  margin-top: 2px;
  color: #28b77a;
}

.account-menu button {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: #283649;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.account-menu button:hover {
  background: #edf4fc;
}

.account-menu-separator {
  height: 1px;
  margin: 6px 4px;
  background: #e5eaf1;
}

.account-menu .account-menu-logout {
  color: #d64242;
}

/* RC8 layout stability fix: keep the composer visible inside the viewport. */
html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#app.shell {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  overflow: hidden;
}

.rail,
.sidebar,
.chat-area,
.info-panel {
  min-width: 0;
  min-height: 0;
  max-height: 100%;
}

.sidebar,
.info-panel {
  overflow-y: auto;
  overflow-x: hidden;
}

.chat-area {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: 68px minmax(0, 1fr) max-content;
}

.messages {
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.composer-wrap {
  position: relative;
  z-index: 4;
  min-height: 0;
  flex: 0 0 auto;
  align-self: end;
  width: 100%;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.workspace-view {
  min-height: 0;
  overflow: auto;
}

@media (max-width: 1120px) {
  .info-panel {
    max-height: 100dvh;
  }
}

@supports not (height: 100dvh) {
  #app.shell {
    height: 100vh;
    max-height: 100vh;
  }
}

/* RC9 media preview */
.server-attachment-bubble{padding:7px;min-width:230px;max-width:min(420px,70vw);overflow:hidden}
.message-image-button{display:block;width:100%;max-height:320px;padding:0;border:0;border-radius:10px;background:#e8edf3;overflow:hidden;cursor:zoom-in}
.message-image-button .message-image{display:block;width:100%;max-height:320px;object-fit:contain;background:#eef2f6}
.message-image-button.image-load-error{min-height:100px;padding:20px;color:#6d7885;cursor:default}
.server-file-card{width:100%;margin-top:7px;padding:9px 10px;border:0;border-radius:9px;background:rgba(255,255,255,.94);color:#26384b;display:flex;align-items:center;gap:9px;text-align:left;cursor:pointer}
.message-row:not(.mine) .server-file-card{background:#f3f6f9;border:1px solid #e0e6ed}
.message-file-icon{font-size:20px}.message-file-copy{display:flex;flex:1;min-width:0;flex-direction:column}.message-file-copy b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.message-file-copy small{font-size:10px;color:#7b8896}.message-file-open{font-size:10px;color:#287bd7;font-weight:700}
.media-viewer{position:fixed;inset:0;z-index:10000;background:rgba(10,16,24,.92);display:flex;flex-direction:column}.media-viewer.hidden{display:none}.media-viewer-toolbar{height:58px;flex:0 0 58px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;color:#fff;background:rgba(0,0,0,.28)}.media-viewer-name{max-width:70vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.media-viewer-actions{display:flex;align-items:center;gap:12px}.media-viewer-download{color:#fff;text-decoration:none;border:1px solid rgba(255,255,255,.35);border-radius:7px;padding:7px 11px}.media-viewer-close{width:38px;height:38px;border:0;border-radius:50%;background:rgba(255,255,255,.12);color:#fff;font-size:27px;cursor:pointer}.media-viewer-stage{flex:1;min-height:0;display:grid;place-items:center;padding:20px;cursor:zoom-out}.media-viewer-stage img{max-width:96vw;max-height:calc(100vh - 98px);object-fit:contain;box-shadow:0 16px 55px rgba(0,0,0,.35)}

/* RC10 rich-message hardening */
.message-row[data-rich-attachment="1"] .bubble{white-space:normal}
.message-row[data-rich-attachment="1"] .message-actions{z-index:3}
.message-image-button{min-height:90px}
.message-image-button img{min-height:90px}

/* RC12 unified attachment queue */
.rc12-attachment-queue{display:flex;flex-direction:column;gap:8px;max-height:220px;overflow:auto}
.rc12-attachment-item{display:grid;grid-template-columns:44px minmax(0,1fr) 32px;align-items:center;gap:10px;width:100%}
.rc12-attachment-item img{width:44px;height:44px;object-fit:cover;border-radius:7px}
.rc12-file-icon{font-size:24px;text-align:center}.rc12-file-copy{display:flex;flex-direction:column;min-width:0}.rc12-file-copy b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.rc12-file-copy small{color:#8794a7}.rc12-attachment-item button{border:0;background:transparent;font-size:18px;cursor:pointer}.rc12-attachment-queue .upload-state{font-size:12px;color:#347fdc;padding-left:4px}

/* RC20: clickable members for direct messages */
#memberList .rc20-member-action{cursor:pointer;border-radius:10px;transition:background .15s ease,transform .15s ease,opacity .15s ease}
#memberList .rc20-member-action:hover{background:rgba(47,128,237,.10);transform:translateX(2px)}
#memberList .rc20-member-action:focus-visible{outline:2px solid rgba(47,128,237,.5);outline-offset:2px}
#memberList .rc20-member-opening{opacity:.5;pointer-events:none}
.admin-users-btn{margin-left:auto;border:0;border-radius:8px;padding:8px 12px;background:#2563eb;color:#fff;font-weight:700;cursor:pointer}.admin-modal{position:fixed;inset:0;background:rgba(15,23,42,.5);display:flex;align-items:center;justify-content:center;z-index:9999}.admin-modal.hidden,.admin-users-btn.hidden{display:none}.admin-card{width:min(420px,calc(100vw - 32px));background:#fff;border-radius:14px;padding:22px;box-shadow:0 20px 60px rgba(0,0,0,.25)}.admin-card h3{margin:0 0 16px}.admin-card label{display:block;margin:12px 0;font-weight:700}.admin-card input{display:block;width:100%;box-sizing:border-box;margin-top:6px;padding:10px;border:1px solid #cbd5e1;border-radius:8px}.admin-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}.admin-actions button{padding:9px 14px;border-radius:8px;border:1px solid #cbd5e1;cursor:pointer}.admin-actions #adminCreateBtn{background:#2563eb;color:white;border-color:#2563eb}.admin-error{min-height:20px;color:#dc2626;font-size:13px}

/* RC27 real-time typing indicator */
.rc27-live-typing{min-height:28px;padding:5px 10px 3px;color:#64748b;font-size:12px;background:transparent}
.rc27-live-typing b{font-weight:600}
.rc27-live-typing span{display:inline-block;width:6px;height:6px;margin-right:2px;border-radius:50%;background:currentColor;animation:typingBounce 1.1s infinite ease-in-out}
.rc27-live-typing span:nth-child(2){animation-delay:.14s}.rc27-live-typing span:nth-child(3){animation-delay:.28s}

/* RC28 native reply quote */
.reply-quote{display:flex;flex-direction:column;align-items:flex-start;width:100%;border:0;border-left:3px solid currentColor;background:rgba(255,255,255,.55);border-radius:5px;padding:6px 8px;margin:0 0 7px;cursor:pointer;text-align:left;opacity:.88}.reply-quote b{font-size:11px}.reply-quote span{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.message-content{white-space:pre-wrap;word-break:break-word}


/* RC30 notification center */
.room{position:relative}.rc30-room-unread{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:#ef4444;color:#fff;font-size:11px;font-weight:800;line-height:1;box-shadow:0 0 0 2px #fff}.notification-head{gap:8px}.notification-head #notificationSoundToggle{margin-left:auto;border:0;background:transparent;color:#475569;font-size:12px;cursor:pointer}.notification-head #markAllRead{margin-left:0}.rc30-notification-item{width:100%;border:0;border-bottom:1px solid #eef2f7;background:#fff;display:flex;align-items:flex-start;gap:10px;padding:11px 13px;text-align:left;cursor:pointer}.rc30-notification-item:hover{background:#f8fafc}.rc30-notification-avatar{width:34px;height:34px;flex:0 0 34px;border-radius:50%;display:grid;place-items:center;background:#dbeafe;color:#1d4ed8;font-weight:800}.rc30-notification-copy{min-width:0;display:flex;flex-direction:column;gap:2px}.rc30-notification-copy b{font-size:13px;color:#0f172a}.rc30-notification-copy small{font-size:10px;color:#94a3b8}.rc30-notification-copy span{max-width:270px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:#475569}.rc30-notification-empty{padding:26px 18px;color:#94a3b8;text-align:center;font-size:13px}


/* RC31 mention autocomplete */
.composer-wrap{position:relative}.mention-menu{position:absolute;left:18px;bottom:86px;z-index:80;width:min(360px,calc(100% - 36px));max-height:280px;overflow:auto;background:#fff;border:1px solid #dbe4ef;border-radius:14px;box-shadow:0 18px 45px rgba(15,23,42,.18);padding:7px}.mention-menu.hidden{display:none}.mention-option{width:100%;border:0;background:transparent;border-radius:10px;padding:9px 10px;display:flex;align-items:center;gap:10px;text-align:left;cursor:pointer;color:#0f172a}.mention-option:hover,.mention-option.active{background:#eff6ff}.mention-option>span:last-child{display:flex;flex-direction:column;min-width:0}.mention-option b{font-size:13px}.mention-option small{font-size:11px;color:#94a3b8}.mention-avatar{width:32px;height:32px;flex:0 0 32px;border-radius:50%;display:grid;place-items:center;background:#dbeafe;color:#1d4ed8;font-weight:800}.mention-tag{display:inline-block;padding:0 4px;border-radius:5px;background:#e0f2fe;color:#0369a1;font-weight:700}.mention-tag.mention-me{background:#fef3c7;color:#92400e;box-shadow:inset 0 0 0 1px #fbbf24}


/* RC33 group room member picker */
.room-member-picker{border:1px solid var(--border,#d9dee8);border-radius:12px;padding:12px;margin-top:10px;background:#f8fafc}
.room-member-picker-title{font-weight:700;margin-bottom:8px}
.room-member-options{display:grid;gap:8px;max-height:220px;overflow:auto}
.room-member-option{display:flex;align-items:center;gap:10px;padding:9px 10px;border-radius:10px;background:#fff;cursor:pointer;border:1px solid transparent}
.room-member-option:hover{border-color:#8ab4ff}
.room-member-option input{width:17px;height:17px}
.room-member-option>span:last-child{display:flex;flex-direction:column}
.room-member-option small{color:#64748b}


/* RC34 voice messages */
.voice-record-button{border:0;background:transparent;font-size:18px;line-height:1;padding:5px 7px;border-radius:7px;cursor:pointer}
.voice-record-button:hover{background:#eef3f8}.voice-record-button.recording{background:#fee2e2;color:#dc2626;animation:voicePulse 1s infinite}.voice-record-button:disabled{opacity:.55;cursor:wait}
.voice-message-bubble{min-width:min(390px,72vw)}.voice-message-card{display:grid;grid-template-columns:32px minmax(180px,1fr) auto;align-items:center;gap:9px}.voice-message-icon{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#e8f2ff}.voice-message-card audio{width:100%;height:36px}.voice-download{font-size:10px;text-decoration:none;color:var(--blue);white-space:nowrap}
.mine .voice-message-icon{background:rgba(255,255,255,.2)}.mine .voice-download{color:#fff}
@keyframes voicePulse{50%{transform:scale(.92);box-shadow:0 0 0 5px rgba(220,38,38,.12)}}
@media(max-width:600px){.voice-message-bubble{min-width:min(300px,76vw)}.voice-message-card{grid-template-columns:28px minmax(130px,1fr)}.voice-download{display:none}}

/* RC35 upload progress and cancellation */
.rc35-upload-queue{position:relative;overflow:visible}
.rc35-upload-item{grid-template-columns:44px minmax(0,1fr) 32px}
.rc35-file-icon{width:44px;height:44px;display:grid;place-items:center;border-radius:7px;background:#eef3f8;font-size:22px}
.rc35-file-copy{display:flex;flex-direction:column;min-width:0}.rc35-file-copy b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rc35-file-copy small{color:#8794a7;margin-top:3px}
.rc35-upload-footer{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 10px;align-items:center;width:100%}
.rc35-upload-footer .upload-state{margin:0;padding:0;font-size:11px;color:#347fdc}
.rc35-progress{grid-column:1/-1;height:5px;border-radius:99px;background:#dce6f1;overflow:hidden}.rc35-progress span{display:block;height:100%;background:#2f7edb;transition:width .15s linear}
.rc35-cancel-upload{border:0;background:transparent;color:#d74747;font-size:11px;cursor:pointer;padding:2px 5px}

/* RC36 file preview */
.rc36-file-viewer{position:fixed;inset:0;z-index:10050;background:rgba(9,14,24,.86);display:flex;align-items:center;justify-content:center;padding:22px}
.rc36-file-viewer.hidden{display:none}
.rc36-viewer-shell{width:min(1180px,96vw);height:min(850px,94vh);background:#111827;border:1px solid rgba(255,255,255,.14);border-radius:16px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 30px 90px rgba(0,0,0,.5)}
.rc36-viewer-head{height:58px;flex:0 0 58px;display:flex;align-items:center;justify-content:space-between;padding:0 14px 0 20px;background:#0b1220;border-bottom:1px solid rgba(255,255,255,.12);color:#fff;gap:16px}
.rc36-viewer-title{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rc36-viewer-actions{display:flex;align-items:center;gap:10px;flex:0 0 auto}
.rc36-viewer-download{color:#fff;text-decoration:none;background:#2563eb;padding:8px 13px;border-radius:9px;font-size:14px}
.rc36-viewer-close{width:38px;height:38px;border:0;border-radius:10px;background:rgba(255,255,255,.1);color:#fff;font-size:25px;cursor:pointer}
.rc36-viewer-body{min-height:0;flex:1;display:flex;align-items:center;justify-content:center;background:#0f172a;overflow:auto;padding:18px}
.rc36-preview-image{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px}
.rc36-preview-pdf{width:100%;height:100%;border:0;background:#fff;border-radius:8px}
.rc36-preview-video{max-width:100%;max-height:100%;background:#000;border-radius:8px}
.rc36-preview-audio-wrap{width:min(620px,92%);padding:34px;border-radius:18px;background:#fff;color:#111827;display:grid;gap:18px;text-align:center;box-shadow:0 18px 50px rgba(0,0,0,.35)}
.rc36-preview-audio-icon{font-size:56px}.rc36-preview-audio{width:100%}
.rc36-preview-fallback{color:#fff;text-align:center}.rc36-preview-fallback-icon{font-size:70px;margin-bottom:14px}.rc36-preview-fallback p{opacity:.72}
@media(max-width:700px){.rc36-file-viewer{padding:0}.rc36-viewer-shell{width:100vw;height:100vh;border-radius:0}.rc36-viewer-head{padding-left:12px}.rc36-viewer-download{padding:7px 10px}.rc36-viewer-body{padding:8px}}

/* RC38 multi-image album and gallery */
.message-row.rc38-album .bubble-wrap{margin-bottom:2px}.message-row.rc38-album .message-image-button{border-radius:4px}.message-row.rc38-album-first .message-image-button{border-radius:12px 12px 4px 4px}.message-row.rc38-album-last .message-image-button{border-radius:4px 4px 12px 12px}.message-row.rc38-album-middle .message-meta,.message-row.rc38-album-last .message-meta,.message-row.rc38-album-middle .message-avatar,.message-row.rc38-album-last .message-avatar{visibility:hidden;height:0;margin:0}.message-row.rc38-album-middle,.message-row.rc38-album-last{margin-top:-7px}.rc38-album-count{position:absolute;right:7px;top:7px;z-index:5;padding:4px 8px;border-radius:999px;background:rgba(15,23,42,.72);color:#fff;font-size:10px;backdrop-filter:blur(5px)}
.rc38-gallery{position:fixed;inset:0;z-index:10000;background:rgba(3,8,18,.96);display:grid;grid-template-columns:70px minmax(0,1fr) 70px;grid-template-rows:auto minmax(0,1fr) 94px;color:#fff}.rc38-gallery.hidden{display:none}.rc38-gallery-head{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;padding:12px 18px;background:rgba(0,0,0,.3)}.rc38-gallery-head b,.rc38-gallery-head small{display:block}.rc38-gallery-head small{opacity:.7;margin-top:3px}.rc38-gallery-head>div:last-child{display:flex;align-items:center;gap:9px}.rc38-gallery-head a,.rc38-gallery-head button{border:0;border-radius:8px;padding:8px 11px;background:rgba(255,255,255,.12);color:#fff;text-decoration:none}.rc38-gallery-head button{font-size:22px;line-height:1}.rc38-gallery-stage{display:grid;place-items:center;min-width:0;min-height:0;padding:14px}.rc38-gallery-stage img{max-width:100%;max-height:100%;object-fit:contain;border-radius:8px}.rc38-gallery-nav{border:0;background:transparent;color:#fff;font-size:52px;opacity:.7}.rc38-gallery-nav:hover{opacity:1;background:rgba(255,255,255,.06)}.rc38-gallery-thumbs{grid-column:1/-1;display:flex;gap:8px;align-items:center;justify-content:center;overflow-x:auto;padding:10px 16px;background:rgba(0,0,0,.28)}.rc38-gallery-thumb{width:68px;height:68px;flex:0 0 auto;border:2px solid transparent;border-radius:8px;padding:0;background:#101827;overflow:hidden;opacity:.62}.rc38-gallery-thumb.active{border-color:#60a5fa;opacity:1}.rc38-gallery-thumb img{width:100%;height:100%;object-fit:cover}
@media(max-width:640px){.rc38-gallery{grid-template-columns:44px minmax(0,1fr) 44px;grid-template-rows:auto minmax(0,1fr) 76px}.rc38-gallery-nav{font-size:38px}.rc38-gallery-thumb{width:54px;height:54px}.rc38-gallery-head{padding:9px 10px}.rc38-gallery-head a{display:none}}


/* RC39 mobile-first responsive layout */
.mobile-backdrop{display:none}
@media(max-width:900px){
  html,body{height:100%;overflow:hidden}
  #app.shell{height:100dvh;max-height:100dvh;grid-template-columns:56px minmax(0,1fr)}
  .rail{width:56px;min-width:56px;padding-bottom:max(8px,env(safe-area-inset-bottom))}
  .app-mark{width:38px;height:38px;font-size:13px}
  .rail-button,.profile-dot{width:40px;height:40px;min-height:40px}
  .sidebar{position:fixed;z-index:220;top:0;bottom:0;left:56px;width:min(340px,calc(100vw - 56px));transform:translateX(-110%);transition:transform .22s ease;box-shadow:18px 0 45px rgba(15,23,42,.24);padding-bottom:max(12px,env(safe-area-inset-bottom))}
  .sidebar.mobile-open{transform:translateX(0)}
  .mobile-backdrop{position:fixed;z-index:210;inset:0 0 0 56px;border:0;background:rgba(15,23,42,.42);backdrop-filter:blur(1px)}
  .mobile-backdrop:not(.hidden){display:block}
  .chat-area{grid-column:2;min-width:0;width:100%}
  .mobile-menu{display:inline-flex!important}
  .chat-header{padding-left:10px;padding-right:8px;min-height:58px}
  .channel-info{min-width:0}.channel-info>div{min-width:0}.channel-info h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:42vw}
  .header-actions{gap:2px}.header-actions .member-stack{display:none}.header-actions .icon-button{width:36px;height:36px}
  .header-actions .icon-button:nth-last-child(1){display:none}
  .info-panel{position:fixed;z-index:230;right:0;top:0;bottom:0;width:min(360px,92vw);max-width:none;transform:translateX(105%);transition:transform .22s ease;box-shadow:-18px 0 45px rgba(15,23,42,.24)}
  .info-panel.open{transform:translateX(0)}
  .messages{padding:14px 10px 10px;scroll-padding-bottom:120px}
  .message-row{max-width:96%}.bubble{max-width:min(78vw,560px)}
  .composer-wrap{padding:8px 10px max(8px,env(safe-area-inset-bottom));background:#fff}
  .composer-tools{gap:2px;overflow-x:auto;scrollbar-width:none}.composer-tools::-webkit-scrollbar{display:none}
  .composer-hint{display:none}.composer-tools button{min-width:36px;min-height:36px}
  .composer{gap:7px}.composer textarea{font-size:16px;max-height:128px}.send-button{width:42px;height:42px;flex:0 0 42px}
  .notification-popover{position:fixed!important;left:64px!important;right:8px!important;top:62px!important;width:auto!important;max-height:70dvh}
  .modal-card{width:calc(100vw - 24px);max-height:90dvh;overflow:auto}
}
@media(max-width:560px){
  #app.shell{grid-template-columns:1fr}
  .rail{position:fixed;z-index:240;left:0;right:0;bottom:0;top:auto;width:100%;height:58px;min-width:0;display:flex;flex-direction:row;align-items:center;justify-content:space-around;padding:4px max(8px,env(safe-area-inset-right)) max(4px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));border-top:1px solid #dbe4ef;border-right:0;background:#fff}
  .rail .app-mark,.rail .rail-spacer{display:none}.rail-button,.profile-dot{width:42px;height:42px;margin:0}
  .chat-area{grid-column:1;padding-bottom:58px}
  .sidebar{left:0;width:min(330px,88vw);bottom:58px}
  .mobile-backdrop{inset:0 0 58px 0}
  .chat-header{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(6px,env(safe-area-inset-right))}
  .header-actions .icon-button:nth-of-type(2){display:none}
  .channel-info h2{max-width:36vw}
  .messages{padding-left:7px;padding-right:7px}.message-row{max-width:100%}.bubble{max-width:82vw}
  .composer-wrap{position:sticky;bottom:0}.composer-tools{padding-bottom:2px}
  .rc36-viewer-shell{height:calc(100dvh - 58px)}
}

/* RC40 installable PWA */
#installAppButton:not(.hidden){animation:rc40InstallPulse 1.8s ease-in-out infinite}
@keyframes rc40InstallPulse{0%,100%{box-shadow:none}50%{box-shadow:0 0 0 4px rgba(47,126,219,.18)}}

/* RC41 admin user manager */
.admin-manager-card{width:min(760px,calc(100vw - 32px));max-height:86vh;overflow:auto}.admin-manager-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.admin-manager-head h3{margin:0}.admin-manager-head p{margin:5px 0 0;color:#64748b;font-size:13px}.admin-create-grid{display:grid;grid-template-columns:1fr 1fr auto;gap:10px;align-items:end;margin:18px 0}.admin-create-grid label{margin:0}.admin-create-grid button{height:42px;border:0;border-radius:9px;padding:0 16px;background:#2563eb;color:#fff;font-weight:700;cursor:pointer}.admin-user-list{border-top:1px solid #e2e8f0;margin-top:12px}.admin-user-row{display:grid;grid-template-columns:40px 1fr auto;gap:12px;align-items:center;padding:12px 2px;border-bottom:1px solid #eef2f7}.admin-user-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#dbeafe;color:#1d4ed8;font-weight:800}.admin-user-copy{display:flex;flex-direction:column;gap:3px}.admin-user-copy small{color:#16a34a}.admin-user-copy small.is-disabled{color:#dc2626}.admin-user-actions{display:flex;gap:8px}.admin-user-actions button{border:1px solid #cbd5e1;background:#fff;border-radius:8px;padding:7px 10px;cursor:pointer}.admin-user-actions button.enable{border-color:#86efac;color:#15803d}@media(max-width:640px){.admin-create-grid{grid-template-columns:1fr}.admin-user-row{grid-template-columns:36px 1fr}.admin-user-actions{grid-column:1/-1;justify-content:flex-end}}

/* RC43: per-room draft marker */
.draft-marker{display:block;margin-top:2px;color:#d97706!important;font-size:11px;font-weight:700;line-height:1.2}

/* RC44 chat export */
.export-chat-card{width:min(620px,calc(100vw - 28px))}
.export-format-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.export-format-grid button{border:1px solid #dce4ee;background:#fff;border-radius:12px;padding:18px 14px;text-align:left;cursor:pointer;min-height:96px}
.export-format-grid button:hover{border-color:#77abe3;background:#f5f9ff;box-shadow:0 5px 18px rgba(25,70,120,.08)}
.export-format-grid b,.export-format-grid small{display:block}.export-format-grid b{font-size:18px;color:#1f4f86}.export-format-grid small{margin-top:8px;color:#7b8795;line-height:1.45}
.export-chat-status{margin-top:16px;padding:11px 12px;border-radius:9px;background:#f3f6fa;color:#667587;font-size:12px}
.export-chat-status.busy{color:#1e67b1;background:#edf6ff}
.export-chat-status.error{color:#b42318;background:#fff1f0}
@media(max-width:620px){.export-format-grid{grid-template-columns:1fr}.export-format-grid button{min-height:72px}}

/* RC45 saved messages */
.rc45-save-message{position:absolute;right:-30px;top:3px;width:25px;height:25px;border:0;border-radius:7px;background:transparent;color:#94a3b8;font-size:18px;line-height:1;cursor:pointer;opacity:0;transition:.15s}.message-row:hover .rc45-save-message,.rc45-save-message.active{opacity:1}.rc45-save-message:hover{background:#eef4fb;color:#1d67ad}.rc45-save-message.active{color:#e59b12}.message-row.mine .rc45-save-message{right:auto;left:-30px}.saved-message-card{width:min(680px,calc(100vw - 28px));max-height:84vh;overflow:hidden;display:flex;flex-direction:column}.saved-message-list{display:grid;gap:8px;overflow:auto;min-height:160px;padding-right:3px}.saved-message-entry{display:grid;grid-template-columns:minmax(120px,180px) minmax(0,1fr) auto;gap:12px;align-items:center;border:1px solid #e1e8f0;background:#fff;border-radius:11px;padding:12px;text-align:left;cursor:pointer}.saved-message-entry:hover{border-color:#8db9e7;background:#f7fbff}.saved-message-entry div{display:flex;flex-direction:column;gap:3px}.saved-message-entry small,.saved-message-entry time{color:#758397;font-size:11px}.saved-message-entry span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#334155}@media(max-width:640px){.rc45-save-message{opacity:1;right:-24px}.message-row.mine .rc45-save-message{left:-24px}.saved-message-entry{grid-template-columns:1fr}.saved-message-entry time{justify-self:start}}


/* RC46 toolbar stability */
.rc46-room-more-menu{position:fixed;z-index:10050;width:230px;padding:7px;background:#fff;border:1px solid #dce5ef;border-radius:12px;box-shadow:0 18px 48px rgba(15,23,42,.22)}
.rc46-room-more-menu.hidden{display:none}
.rc46-room-more-menu button{width:100%;border:0;background:transparent;border-radius:8px;padding:10px 11px;display:flex;align-items:center;gap:10px;text-align:left;color:#263548;font-size:13px}
.rc46-room-more-menu button:hover,.rc46-room-more-menu button:focus{background:#eef5ff;outline:none}
#savedMessagesModal{z-index:10040}
#savedMessagesModal .saved-message-list{padding:16px;max-height:65vh;overflow:auto}

/* RC47 toolbar reliability */
.toolbar-fix-menu{position:fixed;z-index:20000;width:230px;padding:7px;background:#fff;border:1px solid #dce5ef;border-radius:12px;box-shadow:0 18px 48px rgba(15,23,42,.22)}
.toolbar-fix-menu.hidden{display:none!important}
.toolbar-fix-menu button{width:100%;border:0;background:transparent;border-radius:8px;padding:10px 11px;display:flex;align-items:center;gap:10px;text-align:left;color:#263548;font-size:13px}
.toolbar-fix-menu button:hover{background:#eef5ff}
.toolbar-fix-toast{position:fixed;left:50%;bottom:28px;z-index:30000;transform:translate(-50%,18px);opacity:0;pointer-events:none;background:#172235;color:#fff;padding:10px 14px;border-radius:10px;box-shadow:0 12px 30px rgba(15,23,42,.28);font-size:13px;transition:.2s}.toolbar-fix-toast.show{opacity:1;transform:translate(-50%,0)}

/* RC55 selectable upload folders */
.upload-folder-control{display:inline-flex;align-items:center;gap:3px;border:1px solid var(--line);border-radius:7px;padding:2px 5px;background:var(--panel,#fff);font-size:11px}
.upload-folder-control select{max-width:130px;border:0;outline:0;background:transparent;color:inherit;font-size:11px}
.upload-folder-custom{width:125px;border:1px solid var(--line);border-radius:7px;padding:4px 7px;font-size:11px}
.rc55-folder-badge{display:inline-flex;align-items:center;gap:4px;font-size:10px;color:var(--muted);margin-left:5px}
@media(max-width:720px){.upload-folder-control select{max-width:90px}.upload-folder-custom{width:95px}}

/* RC56 configurable mobile Rich Menu */
.rich-menu-launcher{width:38px;height:38px;border-radius:50%!important;font-size:25px!important;line-height:1;background:#fff!important;border:1px solid #d7dde8!important;color:#27364a!important;flex:0 0 auto}
.rich-menu-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.34);opacity:0;visibility:hidden;transition:.18s;z-index:1090}
.rich-menu-backdrop.open{opacity:1;visibility:visible}
.rich-menu-sheet{position:fixed;left:50%;bottom:0;width:min(720px,100%);transform:translate(-50%,105%);background:#fff;border-radius:22px 22px 0 0;padding:8px 14px max(16px,env(safe-area-inset-bottom));box-shadow:0 -16px 48px rgba(15,23,42,.2);transition:transform .22s ease;z-index:1100}
.rich-menu-sheet.open{transform:translate(-50%,0)}
.rich-menu-handle{width:42px;height:5px;border-radius:99px;background:#cbd5e1;margin:2px auto 9px}
.rich-menu-head{display:flex;align-items:baseline;justify-content:space-between;padding:0 4px 10px}.rich-menu-head b{font-size:17px}.rich-menu-head span{font-size:12px;color:#64748b}
.rich-menu-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.rich-menu-item{min-height:80px;border:1px solid #e2e8f0!important;background:#f8fafc!important;border-radius:15px!important;display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:6px;color:#1e293b!important;padding:8px!important}
.rich-menu-item:active{transform:scale(.97);background:#eef6ff!important}.rich-menu-icon{font-size:27px;line-height:1}.rich-menu-label{font-size:12px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}.rich-menu-settings{background:#fff!important}
.rich-settings-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.45);z-index:1120;display:none;align-items:center;justify-content:center;padding:16px}.rich-settings-backdrop.open{display:flex}
.rich-settings-card{width:min(900px,100%);max-height:90vh;overflow:hidden;background:#fff;border-radius:18px;box-shadow:0 24px 70px rgba(0,0,0,.25);display:flex;flex-direction:column}
.rich-settings-head{display:flex;justify-content:space-between;align-items:flex-start;padding:18px 20px;border-bottom:1px solid #e2e8f0}.rich-settings-head h3{margin:0 0 4px}.rich-settings-head p{margin:0;color:#64748b;font-size:13px}.rich-settings-close,.rich-remove{border:0!important;background:transparent!important;font-size:25px!important}
.rich-settings-rows{padding:12px 18px;overflow:auto;display:grid;gap:8px}.rich-settings-row{display:grid;grid-template-columns:30px 58px 150px 1fr 32px 32px;gap:8px;align-items:center;padding:8px;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.rich-settings-row input{min-width:0;padding:9px;border:1px solid #cbd5e1;border-radius:9px}.rich-icon-input{text-align:center;font-size:20px}.rich-drag{cursor:grab;color:#94a3b8;text-align:center}.rich-settings-actions{display:flex;justify-content:flex-end;gap:8px;padding:14px 18px;border-top:1px solid #e2e8f0}.rich-settings-actions button{padding:9px 13px;border-radius:10px}
@media(max-width:680px){.composer-tools>#attachFile,.composer-tools>#attachImage{display:none!important}.rich-menu-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.rich-menu-item{min-height:74px}.rich-settings-backdrop{padding:0;align-items:flex-end}.rich-settings-card{max-height:94vh;border-radius:20px 20px 0 0}.rich-settings-row{grid-template-columns:28px 52px 1fr 30px 30px}.rich-value-input{grid-column:3/6}.rich-settings-actions{position:sticky;bottom:0;background:#fff;flex-wrap:wrap}.rich-settings-actions button{flex:1}.upload-folder-control{max-width:140px}}
