/* TS WhatsApp 13.0.47 — Inbox scroll regression fix.
   The 13.0.46 style set .inbox-v2-list-panel overflow:visible, conflicting
   with the legacy grid scroll containment. Keep each panel's own scroll root. */
html[data-theme] body.ts-studio.page-inbox .content {
  display:flex!important;
  flex-direction:column!important;
  min-height:0!important;
  height:calc(100dvh - 66px)!important;
  max-height:calc(100dvh - 66px)!important;
  overflow:hidden!important;
}
/* Account chooser + headings should keep their natural size, rather than
   taking the list's scrolling budget. */
html[data-theme] body.ts-studio.page-inbox .content > :not(.inbox-v2):not(.studio-inbox) {
  flex-shrink:0;
}
html[data-theme] body.ts-studio.page-inbox .inbox-v2.studio-inbox {
  display:grid!important;
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow:hidden!important;
}
/* Do not use grid-template-rows: auto auto auto minmax(...) here: the filter
   and bulk bar add variable rows, which can push conversation list into an
   implicit non-scrolling row. Flex works with both controls hidden/shown. */
html[data-theme] body.ts-studio.page-inbox .inbox-v2-list-panel {
  display:flex!important;
  flex-direction:column!important;
  grid-template-rows:none!important;
  min-width:0!important;
  min-height:0!important;
  height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-v2-list-panel > :not(.inbox-conversation-list) {
  flex:0 0 auto!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-conversation-list {
  display:block!important;
  flex:1 1 0%!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:contain;
  touch-action:pan-y;
  -webkit-overflow-scrolling:touch;
  scrollbar-width:thin;
  scrollbar-gutter:stable;
}
/* Native hidden attribute must override any legacy grid/flex display rules. */
html[data-theme] body.ts-studio.page-inbox .inbox-filter-drawer[hidden],
html[data-theme] body.ts-studio.page-inbox .inbox-bulk-bar[hidden] {
  display:none!important;
}
/* Dropdown remains above conversation rows, within the clipped panel. */
html[data-theme] body.ts-studio.page-inbox .inbox-list-head {
  z-index:20!important;
  isolation:isolate;
}
html[data-theme] body.ts-studio.page-inbox .inbox-search,
html[data-theme] body.ts-studio.page-inbox .inbox-bulk-bar,
html[data-theme] body.ts-studio.page-inbox .inbox-filter-drawer {
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
/* Keep messaging and right-side info independently scrollable, rather than
   allowing content to stretch the whole Inbox or hide the composer. */
html[data-theme] body.ts-studio.page-inbox .inbox-v2-main,
html[data-theme] body.ts-studio.page-inbox .inbox-chat-layout,
html[data-theme] body.ts-studio.page-inbox .inbox-chat-workspace {
  min-height:0!important;
  max-height:100%!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-chat-layout {
  height:100%!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-chat-workspace {
  height:100%!important;
  grid-template-rows:auto minmax(0,1fr) auto!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-message-wall {
  min-height:0!important;
  max-height:100%!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:contain;
  touch-action:pan-y;
  -webkit-overflow-scrolling:touch;
}
html[data-theme] body.ts-studio.page-inbox .inbox-details,
html[data-theme] body.ts-studio.page-inbox .inbox-v2-rail {
  min-height:0!important;
  max-height:100%!important;
  overflow-y:auto!important;
  overscroll-behavior-y:contain;
  -webkit-overflow-scrolling:touch;
}
/* Compact viewports: the chat list still has a bounded viewport; the chat
   panel remains an overlay per existing mobile navigation design. */
@media (max-width:980px) {
  html[data-theme] body.ts-studio.page-inbox .content {
    height:calc(100dvh - 66px)!important;
    max-height:calc(100dvh - 66px)!important;
  }
}
@media (max-width:780px) {
  html[data-theme] body.ts-studio.page-inbox .inbox-v2.studio-inbox {
    min-height:0!important;
    height:auto!important;
  }
  html[data-theme] body.ts-studio.page-inbox .inbox-v2-main {
    min-height:0!important;
    height:100%!important;
  }
  html[data-theme] body.ts-studio.page-inbox .inbox-v2-list-panel {
    height:100%!important;
  }
}
@media (max-width:560px) {
  html[data-theme] body.ts-studio.page-inbox .inbox-list-head {
    min-height:52px!important;
    padding:9px 11px!important;
  }
  html[data-theme] body.ts-studio.page-inbox .inbox-search {
    min-height:54px!important;
    padding:8px 10px!important;
  }
  html[data-theme] body.ts-studio.page-inbox .inbox-conversation-list {
    scrollbar-gutter:auto;
  }
}

/* Pagination stays visible without stealing the chat list's scroll. */
html[data-theme] body.ts-studio.page-inbox .inbox-page-nav {
  flex:0 0 auto!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:9px!important;
  padding:9px 13px!important;
  min-height:48px!important;
  border-top:1px solid var(--ts46-line)!important;
  background:var(--ts46-surface)!important;
  color:var(--ts46-muted)!important;
  font-size:11px!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-page-nav :is(a,.disabled) {
  display:grid!important;
  place-items:center!important;
  height:30px!important;
  min-width:33px!important;
  border:1px solid var(--ts46-line)!important;
  border-radius:8px!important;
  text-decoration:none!important;
  background:var(--ts46-surface2)!important;
  color:var(--ts46-ink)!important;
  font-size:20px!important;
  font-weight:600!important;
}
html[data-theme] body.ts-studio.page-inbox .inbox-page-nav .disabled{opacity:.35!important}
html[data-theme] body.ts-studio.page-inbox .inbox-page-nav a:hover {
  background:var(--ts46-hover)!important;
}
/* Setup/errors are normal pages, not scroll-locked inboxes. */
html[data-theme] body.ts-studio.page-inbox .content:has(.inbox-no-account-state) {
  overflow-y:auto!important;
  overflow-x:hidden!important;
  height:calc(100dvh - 66px)!important;
}
