body,button,input,textarea,select{font-weight:400}
h1,h2,h3,h4,h5,h6,strong,b,.btn,.field>span,.main-nav button,.mobile-bottom-nav button,.home-menu-grid strong,.chat-toggle-btn strong,.profile-detail-list strong,.member-row-card strong{font-weight:500!important}
.chat-room-head .chat-room-actions{display:none!important}
.chat-room-head{display:grid!important;grid-template-columns:44px minmax(0,1fr)!important;gap:10px!important;align-items:center}
.chat-room-head #chatRoomAvatar{width:44px!important;height:44px!important}
.chat-room-head .group-title-btn{min-width:0;max-width:100%;width:100%;text-align:left}
#chatGroupTitle,#chatGroupMeta{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;margin:0}
#chatGroupMeta{font-size:12px;margin-top:3px;color:var(--muted)}
#pageBackButton{position:fixed;z-index:200}
body.chat-room-open #pageBackButton{display:grid!important;opacity:1!important;pointer-events:auto!important;transform:none!important}
.profile-sheet>.sheet-card>.profile-sheet-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:24px 0 20px}
.profile-sheet .profile-sheet-head>.profile-avatar{width:112px!important;height:112px!important;min-width:112px;max-width:112px;object-fit:cover}
.profile-sheet .profile-sheet-head>div{min-width:0;max-width:100%}
.profile-sheet .profile-sheet-head h2{margin:4px 0;overflow-wrap:anywhere;white-space:normal}
.profile-sheet .profile-sheet-head p{overflow-wrap:anywhere;white-space:normal}
.compact-profile-bar{position:sticky;top:0;height:64px;margin-bottom:-64px;display:grid;grid-template-columns:40px minmax(0,1fr) 32px;align-items:center;gap:10px;padding:8px 14px;background:#fff;border-bottom:1px solid var(--line);z-index:5;visibility:hidden;pointer-events:none}
.compact-profile-bar.visible{visibility:visible;pointer-events:auto}
.compact-profile-avatar{width:40px;height:40px;overflow:hidden;border-radius:50%;display:grid;place-items:center;background:var(--green-50);flex:none}
.compact-profile-avatar img{width:100%;height:100%;object-fit:cover}
.compact-profile-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
.compact-profile-bar button{width:32px;height:32px;border:0;border-radius:50%;background:var(--green-50);color:var(--ink);font-size:22px}
/* Leave scroll room for the floating back control, including the last member. */
body.has-page-back #mainContent{padding-bottom:calc(150px + env(safe-area-inset-bottom))}
.profile-sheet{scroll-padding-bottom:calc(110px + env(safe-area-inset-bottom))}
.profile-sheet>.sheet-card{padding-bottom:calc(120px + env(safe-area-inset-bottom))}
#groupProfileStatus{font-size:12px;color:var(--muted);margin:8px 0}
#groupProfileStatus:empty{display:none}
body.member-menu-open #pageBackButton{visibility:hidden!important;pointer-events:none!important}

/* Search stays visible inside the scrolling group list. */
.site-header{position:sticky;top:0}
.chat-list-toolbar{position:sticky;top:0;z-index:4;background:#fff;padding:16px 0 12px}
.chat-sidebar{padding-top:0!important;min-height:0;overscroll-behavior:contain}
.chat-guest-entry{padding:16px 0 8px}
.chat-guest-entry h2{margin:0;font-size:18px}
.chat-guest-entry p{margin:6px 0 12px;color:var(--muted);font-size:13px}
#chatProfileGate{min-height:0}
.chat-list-toolbar .chat-list-head{margin:14px 0 0}
.chat-search-field{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;padding:0 14px;border:1px solid var(--line);border-radius:16px;background:#f4f9fa;box-sizing:border-box}
.chat-search-field:focus-within{border-color:var(--green-800);box-shadow:0 0 0 3px rgba(0,166,177,.1)}
.chat-search-field svg{width:19px;height:19px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;color:var(--muted)}
.chat-search-field input{width:100%;min-width:0;border:0;outline:none;background:transparent;padding:12px 0;font:inherit;font-size:14px;color:var(--ink)}
.chat-search-results{padding-bottom:90px}
#chatSearchStatus{font-size:12px;color:var(--muted);margin:8px 0 14px}
.chat-search-hit{display:flex;flex-direction:column;gap:5px;text-align:left;overflow-wrap:anywhere;width:100%;border:1px solid var(--line);border-radius:14px;background:white;padding:13px;margin-bottom:8px;color:var(--ink)}
.chat-search-hit:hover,.chat-search-hit:focus-visible{background:#f0fafb;border-color:var(--green-800)}
.chat-search-hit small{color:var(--muted)}
.chat-search-hit span{font-size:13px;white-space:pre-wrap}
.chat-search-highlight{outline:2px solid var(--green-800);outline-offset:3px}
.chat-composer{align-items:end!important;min-width:0}
.chat-composer #chatText{resize:none;box-sizing:border-box;min-width:0;min-height:44px;height:44px;max-height:180px;line-height:1.45;overflow-y:hidden}
/* Bound desktop chat to the viewport; only the message list and sidebar scroll. */
@media(min-width:681px){
 body.chat-room-open{overflow:hidden}
 body.chat-room-open #mainContent{padding-bottom:0}
 body.chat-room-open #page-chat .chat-app-shell{position:fixed;inset:76px 0 0;height:auto;min-height:0;grid-template-rows:minmax(0,1fr);overflow:hidden}
 body.chat-room-open #page-chat .chat-panel{min-height:0;overflow:hidden}
 body.chat-room-open #chatRoom{display:flex;flex-direction:column;min-height:0;overflow:hidden}
 body.chat-room-open .chat-room-head,body.chat-room-open #chatCategories,body.chat-room-open .chat-composer{flex-shrink:0}
 body.chat-room-open #chatLabelEditor{flex-shrink:0;max-height:30dvh;overflow:auto}
 body.chat-room-open #chatMessages{flex:1 1 0;min-height:0;overflow:auto;overscroll-behavior:contain;padding-bottom:76px}
 body.chat-room-open #pageBackButton{top:auto!important;bottom:calc(var(--chat-composer-height,68px) + 12px)!important;right:24px!important}
 body.chat-room-open:has(.profile-sheet:not(.hidden)) #pageBackButton{top:auto!important;bottom:24px!important}
}
@media(max-width:680px){
 body.chat-landing #page-chat .chat-app-shell{height:calc(100dvh - 60px - 72px);min-height:0;display:grid;grid-template-columns:1fr}
 body.chat-landing #page-chat .chat-panel{display:none}
 body.chat-landing #page-chat .chat-sidebar{overflow:auto;min-height:0;padding-bottom:90px}
 body.chat-room-open #page-chat .chat-panel{bottom:var(--chat-keyboard-offset,0px)!important}
}

#shareGroupId{display:grid;place-items:center;width:38px;height:38px;padding:8px;flex:none}
#shareGroupId svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
/* Keep public information in the sidebar, clear of the message composer and mobile menu. */
@media(min-width:681px){
 #page-chat .chat-sidebar{display:flex;flex-direction:column;scroll-padding-bottom:68px}
 #page-chat .chat-sidebar > *{flex-shrink:0}
 #page-chat .chat-sidebar > :is(.chat-profile-gate,.chat-workspace){margin-bottom:12px}
 #page-chat .chat-sidebar > .public-site-links{
  position:sticky;bottom:12px;z-index:3;margin-top:auto;
  background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:0 5px 18px rgba(13,48,44,.12)
 }
}
@media(max-width:680px){
 #page-chat .public-site-links a{min-height:44px}
}
