.bmAttachTrayAbove{display:flex;flex-direction:column;gap:8px;padding:0 0 4px!important;max-height:240px;overflow:auto}
.bmAttachTrayAbove:empty{display:none!important}
.bmUploadItem{position:relative;display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:10px;min-height:60px;padding:7px 8px;border:1px solid rgba(62,61,86,.1);border-radius:14px;background:#f7f7fa;overflow:hidden}
.bmUploadItem.error{border-color:rgba(196,64,64,.25);background:#fff7f7}
.bmUploadItem.ready{border-color:rgba(42,145,91,.2);background:#f6fbf8}
.bmUploadPreview{width:48px;height:48px;border-radius:11px;overflow:hidden;background:rgba(82,136,193,.08);display:flex;align-items:center;justify-content:center}
.bmUploadPreview img{width:100%;height:100%;object-fit:cover;display:block}
.bmUploadFileType{font-size:9px;font-weight:900;letter-spacing:.04em;color:#4e5680}
.bmUploadInfo{min-width:0}
.bmUploadName{font-size:12px;font-weight:800;color:#1d2238;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmUploadStatus{margin-top:3px;font-size:10px;color:rgba(29,34,56,.56);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmUploadItem.error .bmUploadStatus{color:#b33b3b}
.bmUploadProgress{height:3px;margin-top:6px;border-radius:999px;background:rgba(82,136,193,.12);overflow:hidden}
.bmUploadProgress span{display:block;height:100%;border-radius:inherit;background:#5288c1;transition:width .12s linear}
.bmUploadItem.ready .bmUploadProgress span{background:#2a915b}
.bmUploadItem.error .bmUploadProgress span{background:#c44040}
.bmUploadActions{display:flex;align-items:center;gap:4px}
.bmUploadActions button{width:28px;height:28px;border:0;border-radius:9px;background:rgba(29,34,56,.07);color:#30354e;font-size:16px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.bmUploadActions button:hover{background:rgba(29,34,56,.12)}
.bmComposerSend.has-uploading{box-shadow:0 0 0 4px rgba(82,136,193,.12),0 3px 12px rgba(82,136,193,.38)!important}
.bmComposerSend.has-upload-errors{box-shadow:0 0 0 4px rgba(196,64,64,.12),0 3px 12px rgba(82,136,193,.28)!important}
.bmMediaDragActive:after{content:'Drop files to upload';position:absolute;inset:10px;z-index:999;display:flex;align-items:center;justify-content:center;border:2px dashed rgba(82,136,193,.55);border-radius:18px;background:rgba(246,250,255,.94);color:#3a6fa8;font-size:15px;font-weight:900;pointer-events:none}
@media(max-width:760px){.bmUploadItem{grid-template-columns:42px minmax(0,1fr) auto}.bmUploadPreview{width:42px;height:42px}.bmAttachTrayAbove{max-height:190px}.bmComposerRow.hasAttach .bmComposerAttachWrap{grid-column:auto!important;width:auto!important}}

.bmVideoAttachment{display:flex!important;flex-direction:column!important;gap:0!important;width:min(520px,100%)!important;max-width:100%!important;padding:0!important;overflow:hidden!important;border-radius:14px!important;background:#111!important}
.bmVideoAttachment video{display:block;width:100%;max-height:360px;background:#000;object-fit:contain}
.bmVideoAttachmentMeta{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 11px;background:#fff;color:#1d2238}
.bmVideoAttachmentMeta span{min-width:0;display:flex;flex-direction:column;gap:2px}
.bmVideoAttachmentMeta strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmVideoAttachmentMeta small{font-size:10px;color:rgba(29,34,56,.55)}
.bmVideoAttachmentMeta a{flex:0 0 auto;font-size:11px;font-weight:800;color:#3a6fa8;text-decoration:none}

/* Messages stage 2: albums, shared panel and full media viewer */
.bmMediaAlbum{display:grid!important;gap:3px!important;width:min(440px,100%)!important;max-height:430px!important;overflow:hidden!important;border-radius:15px!important;background:rgba(0,0,0,.05)!important}
.bmMediaAlbum.count-2{grid-template-columns:repeat(2,minmax(0,1fr))!important;aspect-ratio:1.75!important}
.bmMediaAlbum.count-3,.bmMediaAlbum.count-4{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:repeat(2,minmax(0,1fr))!important;aspect-ratio:1.35!important}
.bmMediaAlbum.count-3 .bmAlbumTile:first-child{grid-row:span 2!important}
.bmAlbumTile{position:relative!important;display:block!important;min-width:0!important;min-height:0!important;padding:0!important;border:0!important;background:#e8eaf0!important;overflow:hidden!important;cursor:pointer!important}
.bmAlbumTile img{display:block!important;width:100%!important;height:100%!important;object-fit:cover!important;transition:transform .18s ease!important}
.bmAlbumTile:hover img{transform:scale(1.025)!important}
.bmAlbumMore{position:absolute!important;inset:0!important;display:flex!important;align-items:center!important;justify-content:center!important;background:rgba(18,20,35,.54)!important;color:#fff!important;font-size:28px!important;font-weight:900!important;backdrop-filter:blur(1px)!important}
.bmVideoAttachment{background:#111!important;cursor:pointer!important}
.bmVideoOpen{position:relative!important;display:block!important;width:100%!important;min-height:180px!important;padding:0!important;border:0!important;background:#111!important;cursor:pointer!important;overflow:hidden!important}
.bmVideoOpen video{display:block!important;width:100%!important;max-height:360px!important;min-height:180px!important;object-fit:contain!important;background:#000!important;pointer-events:none!important}
.bmVideoOpen>span{position:absolute!important;left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;width:54px!important;height:54px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;padding-left:4px!important;background:rgba(255,255,255,.92)!important;color:#222!important;font-size:19px!important;box-shadow:0 12px 32px rgba(0,0,0,.28)!important}

.spoPanel.isChatMode .bmChatWorkspace.shared-panel-open{grid-template-columns:minmax(270px,320px) minmax(0,1fr) minmax(310px,350px)!important}
.bmChatSharedPanel{display:none;min-width:0;background:#fff;border-left:1px solid rgba(62,61,86,.09);overflow:hidden;flex-direction:column;z-index:25}
.bmChatSharedPanel.open{display:flex}
.bmSharedPanelHead{height:72px;flex:0 0 auto;padding:13px 14px 12px 16px;border-bottom:1px solid rgba(62,61,86,.08);display:flex;align-items:center;justify-content:space-between;gap:12px}
.bmSharedPanelHead>div:first-child{min-width:0;display:flex;flex-direction:column;gap:3px}
.bmSharedPanelHead strong{font-size:14px;color:#1d2238;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmSharedPanelHead span{font-size:11px;color:rgba(29,34,56,.55)}
.bmSharedPanelHeadActions{display:flex;gap:5px}
.bmSharedPanelHeadActions button{width:32px;height:32px;padding:0;border:0;border-radius:10px;background:rgba(29,34,56,.06);color:#30354e;font-size:18px;display:flex;align-items:center;justify-content:center;cursor:pointer}
.bmSharedPanelHeadActions button:hover{background:rgba(29,34,56,.11)}
.bmSharedTabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;padding:9px 10px;border-bottom:1px solid rgba(62,61,86,.07)}
.bmSharedTab{min-width:0;height:34px;padding:0 4px;border:0;border-radius:10px;background:transparent;color:rgba(29,34,56,.58);font-size:11px;font-weight:800;display:flex;align-items:center;justify-content:center;gap:4px;cursor:pointer}
.bmSharedTab b{min-width:17px;height:17px;padding:0 4px;border-radius:999px;background:rgba(29,34,56,.08);font-size:9px;display:flex;align-items:center;justify-content:center}
.bmSharedTab.active{background:rgba(82,136,193,.11);color:#356b9f}
.bmSharedTab.active b{background:rgba(82,136,193,.16)}
.bmSharedBody{min-height:0;flex:1 1 auto;overflow:auto;padding:13px}
.bmSharedHero{display:flex;flex-direction:column;align-items:center;text-align:center;padding:8px 0 17px}
.bmSharedHeroAvatar{width:64px;height:64px;border-radius:22px;margin-bottom:10px;background:linear-gradient(135deg,#6b63c4,#4b448c);color:#fff;font-size:18px;font-weight:900;display:flex;align-items:center;justify-content:center}
.bmSharedHero strong{font-size:16px;color:#1d2238}
.bmSharedHero span{margin-top:3px;font-size:11px;color:rgba(29,34,56,.55)}
.bmSharedPills{display:flex;gap:5px;justify-content:center;flex-wrap:wrap;margin-bottom:18px}
.bmSharedPills span{padding:5px 9px;border-radius:999px;background:rgba(62,61,86,.06);font-size:10px;font-weight:750;color:#555971}
.bmSharedSection h4{margin:0 0 8px;font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:rgba(29,34,56,.52)}
.bmSharedMembers{display:flex;flex-direction:column;gap:5px}
.bmSharedMember{display:flex;align-items:center;gap:9px;padding:8px;border:1px solid rgba(62,61,86,.07);border-radius:13px;background:#fafafd}
.bmSharedAvatar{position:relative;width:34px;height:34px;border-radius:50%;background:linear-gradient(135deg,#6b63c4,#4b448c);color:#fff;font-size:10px;font-weight:900;display:flex;align-items:center;justify-content:center;flex:0 0 auto}
.bmSharedAvatar.online:after{content:'';position:absolute;right:0;bottom:0;width:9px;height:9px;border-radius:50%;background:#43b581;border:2px solid #fff}
.bmSharedMember>div:last-child{min-width:0;display:flex;flex-direction:column}
.bmSharedMember strong{font-size:12px;color:#1d2238;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmSharedMember span{font-size:10px;color:rgba(29,34,56,.52)}
.bmSharedMediaGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
.bmSharedMediaTile{position:relative;aspect-ratio:1;padding:0;border:0;border-radius:8px;background:#e8eaf0;overflow:hidden;cursor:pointer}
.bmSharedMediaTile img,.bmSharedMediaTile video{width:100%;height:100%;display:block;object-fit:cover;pointer-events:none}
.bmSharedMediaTile small{position:absolute;left:5px;right:5px;bottom:5px;padding:4px 5px;border-radius:6px;background:rgba(15,17,26,.6);color:#fff;font-size:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:0;transition:opacity .14s}
.bmSharedMediaTile:hover small{opacity:1}
.bmSharedPlay{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:31px;height:31px;border-radius:50%;background:rgba(255,255,255,.9);display:flex;align-items:center;justify-content:center;padding-left:2px;color:#222;font-size:11px;pointer-events:none}
.bmSharedFileList,.bmSharedLinkList{display:flex;flex-direction:column;gap:6px}
.bmSharedFileRow{display:grid;grid-template-columns:40px minmax(0,1fr) auto;align-items:center;gap:9px;padding:8px;border:1px solid rgba(62,61,86,.07);border-radius:13px;background:#fafafd}
.bmSharedFileIcon{width:40px;height:40px;border-radius:11px;background:rgba(82,136,193,.1);color:#3a6fa8;font-size:9px;font-weight:900;display:flex;align-items:center;justify-content:center}
.bmSharedFileRow>div:nth-child(2){min-width:0;display:flex;flex-direction:column;gap:3px}
.bmSharedFileRow strong{font-size:11px;color:#1d2238;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmSharedFileRow span{font-size:9px;color:rgba(29,34,56,.52)}
.bmSharedRowActions{display:flex;gap:3px}
.bmSharedRowActions button,.bmSharedRowActions a{width:28px;height:28px;border:0;border-radius:8px;background:rgba(29,34,56,.06);color:#30354e;text-decoration:none;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:13px}
.bmSharedLinkRow{display:grid;grid-template-columns:34px minmax(0,1fr) 28px;align-items:start;gap:8px;padding:9px 5px;border-bottom:1px solid rgba(62,61,86,.07)}
.bmSharedLinkIcon{width:34px;height:34px;border-radius:10px;background:rgba(93,83,180,.1);color:#5d53b4;display:flex;align-items:center;justify-content:center;font-weight:900}
.bmSharedLinkRow>div:nth-child(2){min-width:0;display:flex;flex-direction:column;gap:2px}
.bmSharedLinkRow a{font-size:11px;font-weight:850;color:#4b448c;text-decoration:none}
.bmSharedLinkRow span{font-size:9px;color:rgba(29,34,56,.54);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bmSharedLinkRow small{font-size:9px;color:rgba(29,34,56,.43)}
.bmSharedLinkRow>button{width:28px;height:28px;border:0;border-radius:8px;background:rgba(29,34,56,.06);cursor:pointer}
.bmSharedEmpty{min-height:180px;padding:28px 16px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:rgba(29,34,56,.48)}
.bmSharedEmpty strong{font-size:13px;color:#30354e;margin-bottom:5px}
.bmSharedEmpty span{font-size:11px;line-height:1.5}
.bmSharedEmpty button{margin-top:12px;height:32px;padding:0 13px;border:0;border-radius:10px;background:#5288c1;color:#fff;font-weight:800;cursor:pointer}
.bmSharedEmpty.error strong{color:#a83b3b}
.bmSharedLoading{height:140px;display:flex;align-items:center;justify-content:center;gap:6px}
.bmSharedLoading span{width:8px;height:8px;border-radius:50%;background:#5288c1;animation:bmSharedPulse .8s infinite alternate}
.bmSharedLoading span:nth-child(2){animation-delay:.15s}.bmSharedLoading span:nth-child(3){animation-delay:.3s}
@keyframes bmSharedPulse{to{opacity:.25;transform:translateY(-5px)}}

body.bmViewerOpen{overflow:hidden!important}
.bmMediaViewer{position:fixed;inset:0;z-index:2147483640;display:none;background:rgba(10,12,18,.96);color:#fff;overflow:hidden}
.bmMediaViewer.open{display:block}
.bmMediaViewerTop{position:absolute;z-index:4;left:0;right:0;top:0;min-height:68px;padding:11px 16px 11px 20px;display:flex;align-items:center;justify-content:space-between;gap:12px;background:linear-gradient(180deg,rgba(0,0,0,.72),rgba(0,0,0,0))}
.bmMediaViewerTop>div:first-child{min-width:0;display:flex;flex-direction:column;gap:3px}
.bmMediaViewerTop strong{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:50vw}
.bmMediaViewerTop span{font-size:10px;color:rgba(255,255,255,.62)}
.bmViewerTopActions{display:flex;align-items:center;gap:7px}
.bmViewerTopActions button,.bmViewerTopActions a{height:36px;padding:0 13px;border:1px solid rgba(255,255,255,.16);border-radius:11px;background:rgba(255,255,255,.1);color:#fff;text-decoration:none;font-size:11px;font-weight:850;display:flex;align-items:center;justify-content:center;cursor:pointer;backdrop-filter:blur(10px)}
.bmViewerTopActions button[data-viewer-close]{width:36px;padding:0;font-size:22px}
.bmViewerStage{position:absolute;inset:64px 64px 66px;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none;cursor:grab}
.bmViewerStage:active{cursor:grabbing}
.bmViewerContent{width:100%;height:100%;display:flex;align-items:center;justify-content:center}
.bmViewerImage{max-width:100%;max-height:100%;object-fit:contain;user-select:none;transform-origin:center;transition:transform .08s linear;box-shadow:0 20px 70px rgba(0,0,0,.24)}
.bmViewerVideo{max-width:100%;max-height:100%;background:#000;border-radius:10px;box-shadow:0 20px 70px rgba(0,0,0,.34)}
.bmViewerNav{position:absolute;z-index:4;top:50%;transform:translateY(-50%);width:46px;height:58px;border:0;border-radius:14px;background:rgba(255,255,255,.09);color:#fff;font-size:34px;cursor:pointer;backdrop-filter:blur(10px)}
.bmViewerNav:hover{background:rgba(255,255,255,.17)}
.bmViewerNav:disabled{opacity:.25;cursor:default}.bmViewerNav.prev{left:12px}.bmViewerNav.next{right:12px}
.bmViewerTools{position:absolute;z-index:4;left:50%;bottom:14px;transform:translateX(-50%);height:42px;padding:4px;border-radius:14px;background:rgba(18,20,28,.76);border:1px solid rgba(255,255,255,.1);display:flex;align-items:center;gap:3px;backdrop-filter:blur(12px)}
.bmViewerTools button{height:34px;min-width:34px;padding:0 9px;border:0;border-radius:10px;background:transparent;color:#fff;font-size:16px;cursor:pointer}
.bmViewerTools button:hover{background:rgba(255,255,255,.1)}
.bmViewerTools span{min-width:58px;padding:0 8px;text-align:center;font-size:10px;color:rgba(255,255,255,.65)}
.bmMediaViewer.video-mode .bmViewerTools button[data-viewer-zoomout],.bmMediaViewer.video-mode .bmViewerTools button[data-viewer-reset],.bmMediaViewer.video-mode .bmViewerTools button[data-viewer-zoomin],.bmMediaViewer.video-mode .bmViewerTools button[data-viewer-rotate]{display:none}

@media(max-width:1180px){
  .spoPanel.isChatMode .bmChatWorkspace.shared-panel-open{grid-template-columns:minmax(270px,320px) minmax(0,1fr)!important}
  .bmChatSharedPanel{position:absolute;right:0;top:0;bottom:0;width:min(360px,92vw);box-shadow:-18px 0 44px rgba(18,20,35,.18);z-index:90}
}
@media(max-width:760px){
  .bmChatSharedPanel{position:absolute;inset:0;width:100%;z-index:110;border-left:0}
  .bmSharedPanelHead{height:64px}
  .bmSharedMediaGrid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .bmMediaAlbum{width:100%!important;max-height:360px!important}
  .bmViewerStage{inset:62px 8px 72px}
  .bmViewerNav{top:auto;bottom:16px;width:38px;height:42px;font-size:28px}.bmViewerNav.prev{left:10px}.bmViewerNav.next{right:10px}
  .bmViewerTopActions button[data-viewer-source]{display:none}
  .bmViewerTopActions button,.bmViewerTopActions a{height:34px;padding:0 10px}
  .bmMediaViewerTop strong{max-width:38vw}
}


/* Messages stage 3: lightweight previews and paged history */
.bmVideoOpen>img{display:block!important;width:100%!important;height:100%!important;min-height:180px!important;max-height:360px!important;object-fit:cover!important;background:#111!important;pointer-events:none!important}
.bmHistoryGate{width:100%;display:flex;align-items:center;justify-content:center;padding:8px 0 12px;flex:0 0 auto}
.bmHistoryGate button{height:32px;padding:0 14px;border:1px solid rgba(82,136,193,.18);border-radius:999px;background:rgba(255,255,255,.92);color:#3a6fa8;font-size:11px;font-weight:850;box-shadow:0 5px 16px rgba(28,32,54,.08);cursor:pointer;backdrop-filter:blur(8px)}
.bmHistoryGate button:hover{background:#fff;border-color:rgba(82,136,193,.32)}
.bmHistoryGate button:disabled{opacity:.62;cursor:default}
.bmHistoryBottom{padding:14px 0 2px}
.bmSharedMediaTile.video{background:linear-gradient(135deg,#202433,#11131b)}
@media(max-width:760px){.bmHistoryGate{padding:6px 0 10px}.bmHistoryGate button{height:30px;font-size:10px}}
