/* R998: exact Group desktop responsive breakpoint for chats and channels.
   >=1279px: left header+timeline column / right context column.
   <=1278px: context overlays without shrinking the conversation.
   Group and mobile rules are deliberately unchanged. */
@media (min-width:1279px){
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context){
  display:grid!important;
  grid-template-columns:minmax(0,1fr) clamp(270px,30%,354px)!important;
  grid-template-rows:auto minmax(0,1fr)!important;
  align-items:stretch!important;
  min-width:0!important;min-height:0!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-chat-head-stack{
  grid-column:1!important;grid-row:1!important;min-width:0!important;max-width:100%!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-reference-body{
  grid-column:1!important;grid-row:2!important;min-width:0!important;min-height:0!important;
  width:100%!important;max-width:100%!important;padding-right:0!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-reference-context{
  grid-column:2!important;grid-row:1 / 3!important;
  position:relative!important;inset:auto!important;top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;
  width:100%!important;max-width:100%!important;height:100%!important;max-height:100%!important;
  min-width:0!important;min-height:0!important;z-index:2!important;
  transform:none!important;box-shadow:none!important;overflow-y:auto!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"])>.client-reference-scrim{display:none!important;}
}

/* R998: narrow desktop windows use the Group-style overlay rather than
   forcing chats/channels into a permanent second column. R936's older
   fixed-position context rule starts at 1101px; override it only here.
   A scrim keeps the overlay dismissible and the full-width composer intact. */
@media (min-width:1101px) and (max-width:1278px){
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context){
  display:flex!important;flex-direction:column!important;grid-template-columns:none!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-chat-head-stack,
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-reference-body{
  grid-column:auto!important;grid-row:auto!important;width:100%!important;max-width:100%!important;min-width:0!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-reference-context{
  position:absolute!important;inset:0 0 0 auto!important;top:0!important;right:0!important;bottom:0!important;left:auto!important;
  width:min(354px,calc(100% - 44px))!important;max-width:calc(100% - 44px)!important;
  height:100%!important;max-height:100%!important;min-width:0!important;min-height:0!important;
  z-index:490!important;transform:none!important;box-shadow:-7px 0 24px rgba(0,0,0,.13)!important;
 }
 #app .client-inbox-workspace .conversation.client-reference-workspace:is([data-client-kind="users"],[data-client-kind="channels"]):has(>.client-reference-context)>.client-reference-scrim{
  display:block!important;
 }
}
