/* DISPETCH V13: geometry correction for chat gutters, full-width channel posts, and edge-attached sheet. */

/* PERSONAL + GROUP CHAT --------------------------------------------------
   Width must include padding. Otherwise a 100%-wide scroller plus padding
   becomes wider than the viewport and message cards look glued to the edges. */
html:root:root:root:root:root body .gp.chat:not(.tb-chc) > .gp-body {
  display:flex!important;flex-direction:column!important;gap:0!important;
  min-width:0!important;min-height:0!important;overflow:hidden!important;padding:0!important;
  box-sizing:border-box!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .ch-list {
  display:flex!important;flex:1 1 0%!important;flex-direction:column!important;
  width:100%!important;max-width:none!important;min-width:0!important;min-height:0!important;
  box-sizing:border-box!important;margin:0!important;
  padding:18px 18px calc(24px + max(var(--sab,0px),env(safe-area-inset-bottom,0px)))!important;
  gap:10px!important;overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch!important;overscroll-behavior-y:auto!important;
  touch-action:auto!important;scroll-behavior:auto!important;transform:none!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .ch-m {
  display:flex!important;flex:0 1 auto!important;box-sizing:border-box!important;
  width:fit-content!important;min-width:0!important;max-width:min(82%,560px)!important;
  margin-top:2px!important;margin-bottom:2px!important;overflow-wrap:anywhere!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .ch-m.me {
  align-self:flex-end!important;margin-right:3px!important;margin-left:0!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .ch-m.pe {
  align-self:flex-start!important;margin-left:3px!important;margin-right:0!important;
}
/* Keep the reply bar and composer off the glass/viewport edges too. */
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .gp-body > .ch-rp,
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .gp-body > .ch-in {
  box-sizing:border-box!important;width:auto!important;max-width:none!important;
  margin-left:10px!important;margin-right:10px!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .gp-body > .ch-in {
  margin-top:8px!important;margin-bottom:calc(10px + max(var(--sab,0px),env(safe-area-inset-bottom,0px)))!important;
  border:3px solid #111!important;border-radius:20px!important;box-shadow:4px 4px 0 #111!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .gp-body > .ch-rp {
  margin-top:6px!important;margin-bottom:0!important;border-radius:18px 18px 0 0!important;
}
html:root:root:root:root:root body .gp.chat:not(.tb-chc) .gp-body > .ch-rp:not(.pro-h)+.ch-in {
  margin-top:0!important;border-top:0!important;border-radius:0 0 20px 20px!important;
}

/* CHANNEL POST LIST ------------------------------------------------------
   .tb-cl has horizontal padding; border-box prevents its padding expanding
   the viewport. Post cards fill the available inner width, not the screen edge. */
html:root:root:root:root:root body .gp.chat.tb-chc > .gp-body {
  display:flex!important;flex:1 1 0%!important;flex-direction:column!important;
  gap:0!important;min-width:0!important;min-height:0!important;overflow:hidden!important;
  width:100%!important;max-width:none!important;margin:0!important;padding:0!important;
  box-sizing:border-box!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .ch-list.tb-cl {
  display:flex!important;flex:1 1 0%!important;flex-direction:column!important;
  width:100%!important;max-width:none!important;min-width:0!important;min-height:0!important;
  margin:0!important;box-sizing:border-box!important;
  padding:14px 14px 22px!important;gap:10px!important;
  overflow-x:hidden!important;overflow-y:auto!important;
  -webkit-overflow-scrolling:touch!important;overscroll-behavior-y:auto!important;
  background:transparent!important;background-image:none!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .ch-list.tb-cl > .tb-bub {
  display:block!important;align-self:stretch!important;flex:0 0 auto!important;
  width:100%!important;min-width:0!important;max-width:none!important;
  box-sizing:border-box!important;margin:2px 0 4px!important;
  overflow-wrap:anywhere!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .ch-list.tb-cl > .tb-bub.tb-bub-audio {
  width:100%!important;max-width:none!important;min-width:0!important;
  padding:12px 14px 8px!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-bub.tb-bub-audio .tb-cvn-wrap {
  display:block!important;width:100%!important;max-width:none!important;min-width:0!important;
  box-sizing:border-box!important;margin:0 0 6px!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-bub.tb-bub-audio .pro-vn {
  display:flex!important;width:100%!important;max-width:none!important;min-width:0!important;
  box-sizing:border-box!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-bub .tb-pim,
html:root:root:root:root:root body .gp.chat.tb-chc .tb-bub .tb-pim img {
  display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;
  box-sizing:border-box!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-bub > p {
  max-width:100%!important;box-sizing:border-box!important;overflow-wrap:anywhere!important;
}

/* CHANNEL COMPOSER: keep the same side/bottom gap while accounting for insets. */
html:root:root:root:root:root body .gp.chat.tb-chc .tb-comp:not(.fol) {
  box-sizing:border-box!important;width:100%!important;max-width:none!important;min-width:0!important;
  margin:0!important;padding:0 12px calc(12px + max(var(--sab,0px),env(safe-area-inset-bottom,0px)))!important;
  background:transparent!important;border:0!important;box-shadow:none!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-comp:not(.fol) .tb-cbx {
  flex:1 1 auto!important;width:100%!important;max-width:none!important;min-width:0!important;
  margin:8px 0 0!important;box-sizing:border-box!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-comp.fol {
  box-sizing:border-box!important;width:100%!important;max-width:none!important;
  margin:0!important;padding:0 12px calc(12px + max(var(--sab,0px),env(safe-area-inset-bottom,0px)))!important;
}
html:root:root:root:root:root body .gp.chat.tb-chc .tb-comp.fol .tb-btn {
  width:100%!important;max-width:none!important;margin:8px 0 0!important;
}

/* CHANNEL ACTION SHEET ---------------------------------------------------
   Requested behavior: full bleed on left/right/bottom, only the top corners
   are rounded. Safe-area padding is inside the sheet, so the surface reaches
   the physical bottom while content remains reachable. */
html:root:root:root:root:root body .tb-shw {
  align-items:flex-end!important;justify-content:center!important;
  width:100%!important;margin:0!important;padding:0!important;box-sizing:border-box!important;
}
html:root:root:root:root:root body .tb-shw .tb-sheet.channel-post-sheet {
  position:relative!important;align-self:flex-end!important;
  width:100%!important;max-width:none!important;min-width:0!important;
  max-height: min(82vh,680px)!important;height:auto!important;
  margin:0!important;box-sizing:border-box!important;
  padding:12px 18px calc(22px + max(var(--sab,0px),env(safe-area-inset-bottom,0px)))!important;
  border:0!important;border-top:2px solid var(--bd,#17130d)!important;
  border-radius:24px 24px 0 0!important;
  box-shadow:0 -8px 30px rgba(0,0,0,.18)!important;
  touch-action:auto!important;overscroll-behavior:auto!important;overflow-y:auto!important;
}
html:root:root:root:root:root body .tb-shw .tb-sheet.channel-post-sheet .tb-grab {
  margin:0 auto 12px!important;touch-action:none!important;pointer-events:auto!important;
}
html:root:root:root:root:root body .tb-shw .tb-sheet.channel-post-sheet .tb-ptb {
  min-width:0!important;width:100%!important;box-sizing:border-box!important;
  touch-action:auto!important;
}
