/* Mobile Chat stage 1: responsive touch layout, desktop untouched */
@media(max-width:800px){
 body:has(#view .fc-chat-three){height:auto!important;min-height:100dvh;overflow-y:auto!important}
 body:has(#view .fc-chat-three) .app{height:auto!important;min-height:100dvh}
 #view .fc-chat-workspace.fc-chat-three{display:flex!important;flex-direction:column!important;grid-template-columns:none!important;gap:10px!important;height:auto!important;min-height:0!important;overflow:visible!important;width:100%;min-width:0}
 #view .fc-chat-three .fc-chat-column{display:flex!important;flex-direction:column!important;gap:10px!important;width:100%;min-width:0;min-height:0}
 #view .fc-chat-three .fc-chat-section{width:100%;min-width:0;min-height:180px!important;max-height:43dvh!important;overflow:hidden}
 #view .fc-chat-three .fc-chat-section-list{overflow-y:auto;overscroll-behavior:contain}
 #view .fc-chat-three .fc-chat-person{min-height:44px;touch-action:manipulation}
 #view .fc-chat-three .fc-chat-right{width:100%;min-width:0;min-height:55dvh!important;height:65dvh;max-height:75dvh;overflow:hidden}
 #view .fc-chat-three .fc-chat-messages{min-height:0;overflow-y:auto;overscroll-behavior:contain}
 #view .fc-chat-three .fc-chat-form textarea{min-width:0;max-width:100%;font-size:16px}
 #view .fc-chat-three .fc-chat-heading{overflow-wrap:anywhere}
}

/* Mobile chat stage 2: conversation view with stable top navigation */
#fc-mobile-chat-back{display:none}
@media(max-width:800px){
 #view .fc-chat-workspace.fc-chat-three{height:calc(100dvh - 185px)!important;min-height:300px!important;overflow:hidden!important}
 #view .fc-chat-three[data-mobile-stage="list"]>.fc-chat-right{display:none!important}
 #view .fc-chat-three[data-mobile-stage="detail"]>.fc-chat-column{display:none!important}
 #view .fc-chat-three[data-mobile-stage="detail"]>.fc-chat-right{display:flex!important;flex:1;min-height:0!important;height:100%!important;max-height:none!important}
 #view .fc-chat-three[data-mobile-stage="list"]>.fc-chat-column .fc-chat-section{min-height:140px!important;max-height:36dvh!important}
 #view .module-toolbar:has(#fc-mobile-chat-back){justify-content:flex-start;gap:8px;flex-wrap:wrap}
 #view .module-toolbar #fc-mobile-chat-back{display:inline-flex!important;align-items:center;justify-content:center;min-height:40px;margin-left:auto;white-space:nowrap}
 #view .module-toolbar #fc-mobile-chat-back[hidden]{visibility:hidden!important;pointer-events:none}
 #view .module-toolbar:has(#fc-mobile-chat-back)>[data-module="home"]{margin-left:0!important;flex:0 0 auto}
}

/* Mobile Chat stage 3: category tabs and exact available viewport height */
@media(max-width:800px){
 #view .fc-chat-workspace.fc-chat-three{height:auto;min-height:0!important;max-height:none!important;display:flex!important;flex-direction:column!important;gap:8px!important;overflow:hidden!important}
 #view .fc-chat-three .fc-mobile-chat-categories{display:flex;flex:0 0 auto;gap:4px;overflow-x:auto;min-height:42px;padding:0 0 2px;scrollbar-width:thin}
 #view .fc-chat-three .fc-mobile-chat-categories button{border:1px solid #dce4f0;background:#fff;border-radius:9px;color:#385272;padding:8px 11px;min-height:40px;white-space:nowrap;font:inherit;font-size:13px;cursor:pointer}
 #view .fc-chat-three .fc-mobile-chat-categories button.active{background:#dceaff;border-color:#a9c6ee;color:#234e92;font-weight:700}
 #view .fc-chat-three[data-mobile-stage="detail"] .fc-mobile-chat-categories{display:none}
 #view .fc-chat-three[data-mobile-stage="list"]>.fc-chat-column{display:none!important;flex:1;min-height:0;overflow:hidden}
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="registered"]>.fc-chat-column:nth-child(2),
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="guests"]>.fc-chat-column:nth-child(3),
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="groups"]>.fc-chat-column:nth-child(4),
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="events"]>.fc-chat-column:nth-child(4){display:flex!important}
 #view .fc-chat-three[data-mobile-stage="list"] .fc-chat-section{display:none!important;flex:1!important;min-height:0!important;max-height:none!important;height:100%;overflow:hidden}
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="registered"] .fc-chat-registered,
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="guests"] .fc-chat-guests,
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="groups"] .fc-chat-groups,
 #view .fc-chat-three[data-mobile-stage="list"][data-mobile-category="events"] .fc-chat-events{display:flex!important}
 #view .fc-chat-three[data-mobile-stage="list"] .fc-chat-section-list{flex:1;min-height:0;overflow-y:auto}
 #view .fc-chat-three[data-mobile-stage="detail"]>.fc-chat-right{flex:1;min-height:0!important;height:auto!important;max-height:none!important;overflow:hidden}
}
@media(min-width:801px){#view .fc-mobile-chat-categories{display:none}}

/* Full-height panels in all four mobile Chat categories */
@media(max-width:800px){
 #view .fc-chat-workspace.fc-chat-three{height:var(--fc-chat-available-height,calc(100dvh - 250px))!important;min-height:0!important;max-height:none!important;flex:0 0 auto!important;box-sizing:border-box}
 #view .fc-chat-three[data-mobile-stage="list"]>.fc-chat-column{height:100%!important;max-height:none!important;flex:1 1 0!important;min-height:0!important;overflow:hidden!important}
 #view .fc-chat-three[data-mobile-stage="list"]>.fc-chat-column>.fc-chat-section{height:100%!important;max-height:none!important;min-height:0!important;flex:1 1 0!important;box-sizing:border-box}
 #view .fc-chat-three[data-mobile-stage="list"] .fc-chat-section-list{height:auto!important;flex:1 1 0!important;min-height:0!important;overflow-y:auto!important}
 #view .fc-chat-three[data-mobile-stage="detail"]>.fc-chat-right{height:100%!important;min-height:0!important;max-height:none!important;flex:1 1 0!important}
}

/* Compact message composer: search-field-sized input and equal top/bottom spacing */
@media(max-width:800px){
 #view .fc-chat-three .fc-chat-form{display:flex;align-items:center;gap:8px;padding:8px 10px!important;margin:0!important;flex:0 0 auto;box-sizing:border-box}
 #view .fc-chat-three .fc-chat-form textarea{display:block;flex:1 1 auto;width:100%;height:44px!important;min-height:44px!important;max-height:44px!important;box-sizing:border-box;resize:none!important;line-height:22px;padding:10px 12px!important;margin:0!important;overflow-y:auto}
 #view .fc-chat-three .fc-chat-form .btn{min-height:44px;height:44px;flex:0 0 auto;margin:0}
 #view .fc-chat-three .fc-chat-status{margin:0!important;padding:0 10px!important;min-height:0!important;line-height:0;font-size:0}
 #view .fc-chat-three .fc-chat-status:not(:empty){padding:5px 10px!important;line-height:1.3;font-size:12px}
}
/* Four equally sized category tabs across the available mobile width. */
@media(max-width:800px){
#view .fc-chat-three .fc-mobile-chat-categories{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;gap:5px!important;overflow-x:hidden!important;padding:0 0 2px!important}
#view .fc-chat-three .fc-mobile-chat-categories button{width:100%!important;min-width:0!important;max-width:none!important;box-sizing:border-box!important;padding:8px 2px!important;text-align:center!important;white-space:nowrap!important;font-size:clamp(11px,3.1vw,14px)!important}
#view .fc-chat-three[data-mobile-stage="detail"] .fc-mobile-chat-categories{display:none!important}
}
