/* Shared secondary surfaces; retain existing handlers and permission filtering. */
html :is(#messageMenu,#selectedRoomMenu,#toolbarOverflowMenu,.person-actions-menu,.attachment-picker){border-radius:10px;border:1px solid var(--d-line);box-shadow:0 6px 22px #0002;overscroll-behavior:contain;scrollbar-width:thin;max-height:calc(var(--browser-visible-height,100dvh) - 24px);overflow-y:auto;box-sizing:border-box}
html :is(#selectedRoomMenu,#toolbarOverflowMenu,.person-actions-menu) :is(button,a[role=menuitem]){min-height:34px;padding:6px 9px;border-radius:6px;font-size:12px;line-height:1.35;box-shadow:none;background:transparent;color:var(--d-ink);text-align:left}
html :is(#selectedRoomMenu,#toolbarOverflowMenu,.person-actions-menu) :is(button,a):hover{background:var(--d-active)}
html :is(#selectedRoomMenu,#toolbarOverflowMenu,.person-actions-menu) :is(button,a):focus-visible{outline:2px solid var(--d-accent);outline-offset:-2px}
html #rooms .room-item{min-width:0;column-gap:8px}
html #rooms :is(.room-title,.room-preview){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
html #rooms .room-time{font-variant-numeric:tabular-nums;white-space:nowrap;flex:0 0 auto;min-width:32px;text-align:right}
html #rooms .unread-pill{flex-shrink:0;min-width:17px;font-variant-numeric:tabular-nums}
html #rooms .room-item.active{background:color-mix(in srgb,var(--d-accent) 10%,var(--d-surface))!important;box-shadow:inset 2px 0 var(--d-accent)!important}
html #messages{overflow-anchor:none}
html #messages .image-preview:has(img:not(.media-ready90)){min-height:140px;background:color-mix(in srgb,var(--d-accent) 6%,transparent)}
html #messages .image-preview img{max-width:100%;height:auto}
html #messages video{aspect-ratio:16/9;object-fit:contain;max-width:100%;background:#15191a}
html #messages video.media-ready90{aspect-ratio:auto}
html #messages .message .body:empty{display:none}
html #messages .message .reply-quote{overflow:hidden;min-width:0}
html #messages .message .reply-quote span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html[data-look] #messages .desktop47-message:not(.join-notice){margin-bottom:4px!important}
html[data-look] #messages .desktop47-message .reactions:not(:empty){position:static;inset:auto;display:flex;flex-wrap:wrap;width:auto;max-width:100%;gap:3px;margin:4px 0 2px;padding:0}
html[data-look] #messages .desktop47-message .reactions button{min-height:24px;padding:2px 6px;border-radius:7px;border:1px solid transparent;background:color-mix(in srgb,var(--d-ink) 5%,transparent);box-shadow:none}
html[data-look] #messages .desktop47-message .reactions button.mine{background:color-mix(in srgb,var(--d-accent) 14%,transparent);border-color:color-mix(in srgb,var(--d-accent) 22%,transparent)}
@media(min-width:901px){
 html[data-look] #messages .message:not(.join-notice){width:fit-content;min-width:64px;max-width:min(70%,500px)!important;padding:4px 8px!important;border-radius:9px}
 html[data-look] #messages .message .body{line-height:1.4!important}
 html[data-look] #messages .message .compact-message-heading{margin-bottom:1px;min-height:0}
 html[data-look] #messages .message .reply-quote{padding:3px 6px!important;margin:2px 0!important}
 html[data-look] #messages .message .message-footer{margin-top:1px!important;min-height:13px}
 html #messages .message :is(.attachment-card,.image-file-wrapper){margin-top:3px;margin-bottom:2px}
}
@media(max-width:900px){
 html :is(#selectedRoomMenu,#toolbarOverflowMenu,.person-actions-menu) :is(button,a[role=menuitem]){min-height:44px;padding:7px 9px}
 html.browser-keyboard-open .push-prompt{display:none!important}
 html.browser-keyboard-open .chat-header{flex-shrink:0}
 html.browser-keyboard-open :is(#compose,#composeContext,#formatBar79){flex-shrink:0}
 html #messages{scroll-padding-bottom:8px}
}
