.chat-page{display:flex;flex-direction:column;min-height:0}
.chat-head,.chat-compose,.chat-file-preview,.chat-error{flex:none}
.chat-head{min-width:0;gap:12px}.chat-head>div{min-width:0;flex:1}
.chat-head b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-head>a{flex:0 0 44px;width:44px;height:44px}
.chat-head .chat-details-link{margin-left:auto;background:transparent}
.chat-messages{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain}
.chat-compose{align-items:center;gap:8px;margin:0}
.chat-compose input{width:0;min-width:0;flex:1;height:44px}
.chat-compose .chat-attach{width:44px;height:44px;flex:0 0 44px;margin:0}
.chat-compose button{flex:none;min-width:44px;min-height:44px}
.chat-file-preview[hidden],.chat-error[hidden],.attachment-viewer[hidden]{display:none!important}
.chat-file-preview{max-height:120px;overflow:auto}.chat-file-preview span,.chat-file span{overflow-wrap:anywhere;min-width:0}
.bubble{min-width:0;overflow-wrap:anywhere}.bubble p{word-break:break-word}
.bubble img,.bubble video,.bubble audio,.bubble iframe{max-width:100%}
.chat-pdf iframe{width:100%;max-width:100%;height:240px}
.msg-kind{display:block;font-size:10px;font-weight:700;color:var(--brand2);margin:2px 0}
.msg-conv-copy{min-width:0}.msg-conv-copy b,.msg-conv-copy small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.msg-conversation{min-height:76px}.msg-avatar>i{font-size:22px}
.msg-room,.msg-thread{min-height:0}.msg-room{overflow:hidden}.msg-compose,.msg-room-head{flex:none}
.larche-messenger{grid-template-rows:minmax(0,1fr)}
.msg-sidebar,.msg-conversations{min-height:0}.msg-sidebar{overflow:hidden}.msg-conversations{flex:1;overflow-y:auto}
@media(max-width:980px){
    .page:has(.chat-page){padding:0!important}
    .chat-page{position:fixed;left:0;right:0;top:var(--chat-viewport-top,var(--mobile-header));height:var(--chat-viewport-height,calc(100dvh - var(--mobile-header) - var(--mobile-bottom)))!important;width:100%;max-width:none;min-height:0!important;margin:0;border:0;border-radius:0!important;z-index:50}
    body .larche-messenger,body.sidebar-compact .larche-messenger{top:var(--chat-viewport-top,var(--mobile-header))!important;height:var(--chat-viewport-height,calc(100dvh - var(--mobile-header) - var(--mobile-bottom)))!important;bottom:auto!important;min-height:0}
    .chat-head{padding:10px 12px;background:#fff}.chat-messages{padding:16px 12px;background:#f4f7fb}
    .chat-compose{padding:10px 12px;background:#fff;box-shadow:0 -4px 18px #163b6508}
    .bubble{max-width:88%;border-radius:16px;padding:12px}.bubble.mine{background:var(--brand);color:#fff}
    .bubble.mine b,.bubble.mine small{color:#ffffffd9}
    .chat-compose button{width:44px;padding:0;display:grid;place-items:center;border-radius:50%;font-size:18px}.chat-compose button span{display:none}
    .msg-compose{min-width:0}.msg-input-wrap{min-width:0}.msg-tool,.msg-send{min-width:36px;min-height:44px}
    body.chat-keyboard-open .mobile-nav{display:none!important}
    .community-grid,.pastor-grid,.donation-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .section-head,.row-actions,.profile-main{flex-wrap:wrap;min-width:0}
}
@media(max-width:600px){
    .community-grid,.pastor-grid,.donation-grid,.two{grid-template-columns:minmax(0,1fr)}
    .profile-main{padding:16px;gap:12px}.profile-main>div{min-width:0;max-width:100%}.profile-main h1{font-size:24px;overflow-wrap:anywhere}.profile-main .btn{margin-left:0;min-height:44px}
    .people-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
.chat-page [hidden]{display:none!important}
.community-message-actions,.community-reactions,.community-emoji-picker{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.community-message-actions button,.community-reactions button,.community-emoji-picker button{border:0;border-radius:12px;padding:8px 10px;background:rgba(128,128,128,.12);color:inherit;cursor:pointer;min-height:36px}
.community-message-actions button{font-size:12px}
.community-reactions .selected{outline:2px solid var(--brand,#164bdf)}
.community-emoji-picker button{font-size:23px;min-width:44px;min-height:44px}
.chat-page blockquote{margin:8px 0;padding:8px 10px;border-left:3px solid currentColor;background:rgba(128,128,128,.1);border-radius:8px}
.chat-page blockquote span{display:block;white-space:pre-wrap;overflow-wrap:anywhere;max-height:70px;overflow:hidden}
.community-reply-panel{display:flex;align-items:center;gap:8px;padding:10px 14px;background:var(--surface,#fff);flex:none}
.community-reply-panel span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.community-reply-panel button{border:0;background:transparent;font-size:24px;min-width:44px;min-height:44px}
.community-edit{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.community-edit textarea{width:100%;min-height:80px;box-sizing:border-box;resize:vertical;color:#172033;background:#fff;border:1px solid #ccc;border-radius:10px;padding:10px}
.community-edit button{border:0;border-radius:8px;padding:10px;cursor:pointer}
.deleted-message{font-style:italic;opacity:.7}
