/* support#F10521 W4 — conversation first; the list owns global navigation. */
@media (max-width: 899px) {
  body.has-tabbar {
    height: var(--mob-visible-height, 100dvh);
    top: var(--mob-visible-top, 0px); bottom: auto;
  }
  body.has-tabbar:has(.chats-layout.chats-mobile-detail),
  body.has-tabbar:has(.ticket-detail-layout) {
    --mob-tabbar-space: var(--tp-safe-bottom, 0px);
    height: var(--mob-visible-height, 100dvh);
    position: fixed; inset: 0; top: var(--mob-visible-top, 0px); bottom: auto; min-height: 0;
    display: flex; flex-direction: column; overflow: hidden;
  }
  body.has-tabbar:has(.chats-layout.chats-mobile-detail) > .app-header,
  body.has-tabbar:has(.ticket-detail-layout) > .app-header,
  body.has-tabbar:has(.chats-layout.chats-mobile-detail) > .mob-tabbar,
  body.has-tabbar:has(.ticket-detail-layout) > .mob-tabbar { display: none !important; }
  body.has-tabbar:has(.chats-layout.chats-mobile-detail) > #app.app-content,
  body.has-tabbar:has(.ticket-detail-layout) > #app.app-content {
    flex: 1 1 auto; min-height: 0; width: 100%; margin: 0;
    display: flex; flex-direction: column; overflow: hidden;
    padding-bottom: var(--mob-tabbar-space);
    padding-top: var(--tp-safe-top, 0px);
    padding-inline: var(--tp-safe-left, 0px) var(--tp-safe-right, 0px);
  }
  body.has-tabbar .chats-layout.chats-mobile-detail,
  body.has-tabbar .ticket-detail-layout { flex: 1 1 auto; height: auto; min-height: 0; border-radius: 0; }
  /* Keep a degraded channel visible without consuming a third of a rotated phone. */
  body.has-tabbar:has(.ticket-detail-layout) #channelsWarnBanner,
  body.has-tabbar:has(.chats-layout.chats-mobile-detail) #channelsWarnBanner {
    display: flex; align-items: center; gap: 6px; min-height: 48px; max-height: 48px;
    padding: 6px 10px; overflow: hidden;
  }
  body.has-tabbar:has(.ticket-detail-layout) .ch-banner-sub { display: none; }
  body.has-tabbar:has(.ticket-detail-layout) .ch-banner-content { min-width: 0; overflow: hidden; }
  body.has-tabbar:has(.ticket-detail-layout) .ch-banner-content > b { display: none; }
  body.has-tabbar:has(.ticket-detail-layout) .ch-banner-content > div:not(.ch-banner-sub) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .td-topbar-card { min-height: 52px; flex-wrap: nowrap; gap: 4px; }
  .td-topbar-card .btn-back { width: 44px; height: 44px; padding: 10px; font-size: 0; }
  .td-topbar-card .btn-back svg { width: 20px; height: 20px; }
  .td-topbar-card > .td-mobile-secondary, .td-topbar-card > .text-xs { display: none; }
  .td-mobile-actions-strip {
    display: flex; gap: 4px; align-items: center; min-height: 49px;
    padding: 2px 8px; overflow-x: auto; scrollbar-width: none;
  }
  .td-mobile-actions-strip > * { flex: 0 0 auto; }
  .td-mobile-actions-strip .td-mobile-action { min-width: 44px; min-height: 44px; }
  .td-mobile-actions-strip .td-mobile-more .act-menu-btn { width: 44px; height: 44px; }
  .td-chat-tab { min-height: 44px; }
  .msg-menu-item[data-mobile-only] { display: flex; }
  .chats-head-more-mobile-only { display: block; }
  .chats-allocation-compact[hidden] { display: none !important; }
  .chats-allocation-compact:not([hidden]) {
    flex: 0 0 auto; min-height: 44px; display: flex; align-items: center; gap: 8px;
    padding: 4px 12px; border-bottom: 1px solid var(--border-light);
    background: var(--bg-subtle); overflow: hidden;
  }
  .chats-allocation-chip-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chats-allocation-chip-reset { flex: 0 0 44px; width: 44px; height: 44px; }
  .chats-head > *:not(.chats-mobile-back):not(.chats-head-title):not(.call-way-wrap):not(.msg-menu-wrap) { display: none !important; }
  .chats-head .act-menu-btn, .chats-head .call-way-wrap > button { width: 44px; min-height: 44px; }
  .call-way-wrap:has(.wa-call-locked[aria-disabled="true"]) { display: none; }
  .chats-head { padding: 4px 8px; gap: 4px; min-height: 52px; }
  .chats-head-title { font-size: 16px; }
  .ticket-detail-header #tdSubjectText { -webkit-line-clamp: 1; max-height: 20px; }
  .ticket-detail-header .td-subject { padding-block: 2px; }
  /* Multiple ticket lines are a single scrolling selector, never three stacked rows. */
  .td-chat-switch {
    flex-wrap: nowrap !important; flex: 0 0 auto;
    padding: 4px 8px !important; overflow-x: auto; scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  #tdPanelChats:has(.td-chat-switch) { position: relative; }
  #tdPanelChats .td-chat-switch { padding-right: 112px !important; }
  /* The shared down button makes its parent positioned inline. In this composition the
     ticket panel owns both the selector actions and down button, so preserve that ancestor. */
  #tdPanelChats:has(.td-chat-switch) #tdChatMount .chats-stream { position: static !important; }
  #tdPanelChats:has(.td-chat-switch) #tdChatMount .chats-head {
    position: absolute; top: 0; right: 0; z-index: 2; width: auto;
    padding: 4px; background: var(--surface);
  }
  #tdPanelChats:has(.td-chat-switch) #tdChatMount .chats-head-title { display: none !important; }
  .td-chat-switch > button {
    flex: 0 0 auto; min-height: 44px; max-width: 240px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .messages .msg-continuation > .msg-author { display: none !important; }
  .messages .msg-continuation { margin-top: 2px; }
  .messages .msg-reactions:not(.msg-reactions-automation) .btn-reaction:not(.active) { display: none; }
  .messages .msg-reactions:not(.msg-reactions-automation):not(:has(.active)) { display: none; }
  .msg-menu-dropdown .msg-menu-item[data-mobile-rating] { min-height: 44px; }
  .scroll-down-btn { min-width: 44px; min-height: 44px; }
}
@media (min-width: 900px) {
  .msg-menu-item[data-mobile-rating] { display: none; }
}

.scroll-down-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; padding: 1px 4px;
  border-radius: 12px; background: var(--accent); color: var(--on-accent, #fff);
  font-size: 11px; line-height: 16px;
}
