/* Keep the existing desktop composer unchanged; mobile groups its text and emoji. */
.admin-chats .ac-composer-input { display:contents; }
.admin-chats .ac-mobile-back,
.admin-chats .ac-mobile-menu,
.admin-chats .ac-mobile-search-action { display:none; }

@media (max-width:780px) {
  /* The chat owns the visible viewport. The sidebar still opens over this shell. */
  .admin-shell.admin-shell-chats { position:fixed; inset:0; min-height:0; height:100dvh; overflow:hidden; }
  .admin-shell-chats > .admin-main { min-height:0; height:100%; overflow:hidden; }
  .admin-shell-chats:has(.admin-chats) > .admin-mobile-menu { display:none; }
  .admin-shell-chats > .admin-sidebar { height:100dvh; padding-top:max(12px,env(safe-area-inset-top,0px)); padding-bottom:max(10px,env(safe-area-inset-bottom,0px)); }
  .admin-chats[data-mobile-panel], .admin-chats.ac-unavailable {
    position:fixed; top:var(--ac-viewport-top,0px); inset-inline:0; bottom:auto;
    display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(0,1fr);
    width:100%; height:var(--ac-viewport-height,100dvh); min-height:0; min-width:0;
    overflow:hidden; background:#fff; font-size:14px;
  }
  .admin-chats[data-mobile-panel="directory"] > .ac-thread,
  .admin-chats[data-mobile-panel="thread"] > .ac-directory { display:none; }
  .admin-chats.ac-unavailable { display:flex; padding:20px; text-align:center; }
  .admin-chats.ac-unavailable .ac-mobile-menu { position:absolute; top:calc(8px + env(safe-area-inset-top,0px)); left:8px; display:inline-flex; width:44px; height:44px; }
  .admin-chats[data-mobile-panel] > .ac-directory,
  .admin-chats[data-mobile-panel] > .ac-thread { width:100%; min-width:0; min-height:0; height:100%; }
  .admin-chats[data-mobile-panel] .ac-directory { border:0; }
  .admin-chats[data-mobile-panel] .ac-directory-header { padding:calc(8px + env(safe-area-inset-top,0px)) 16px 12px; border-bottom:1px solid var(--ac-border); }
  .admin-chats[data-mobile-panel] .ac-directory-heading { display:flex; align-items:center; gap:10px; min-height:48px; margin:0 0 10px; }
  .admin-chats[data-mobile-panel] .ac-directory-heading h1 { margin:0; font-size:22px; line-height:1.25; letter-spacing:-.5px; }
  .admin-chats[data-mobile-panel] .ac-mobile-menu { display:inline-flex; margin-left:-8px; }
  .admin-chats[data-mobile-panel] .ac-search { height:44px; border-radius:10px; padding-left:12px; gap:8px; }
  .admin-chats[data-mobile-panel] .ac-search input { font-size:16px; }
  .admin-chats[data-mobile-panel] .ac-search button { width:44px; height:44px; flex-shrink:0; }
  .admin-chats[data-mobile-panel] .ac-filters { margin-top:10px; gap:6px; }
  .admin-chats[data-mobile-panel] .ac-filters button { min-height:44px; padding:7px 13px; font-size:13px; }
  .admin-chats[data-mobile-panel] .ac-directory-content { flex:1 1 auto; padding:8px 8px max(16px,env(safe-area-inset-bottom,0px)); overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .admin-chats[data-mobile-panel] .ac-folder-heading-row { gap:0; }
  .admin-chats[data-mobile-panel] .ac-folder-heading { min-height:48px; padding:6px 8px; gap:8px; }
  .admin-chats[data-mobile-panel] .ac-folder-title { font-size:14px; }
  .admin-chats[data-mobile-panel] .ac-folder-heading-row .ac-create-group { flex:0 0 44px; width:44px; height:44px; margin-right:0; }
  .admin-chats[data-mobile-panel] .ac-folder.is-open + .ac-folder::before { inset-inline:8px; }
  .admin-chats[data-mobile-panel] .ac-conversation-row { min-height:70px; padding:10px 8px; gap:10px; border-radius:10px; }
  .admin-chats[data-mobile-panel] .ac-avatar { width:40px; height:40px; }
  .admin-chats[data-mobile-panel] .ac-row-copy { gap:3px; }
  .admin-chats[data-mobile-panel] .ac-row-copy strong { font-size:14px; }
  .admin-chats[data-mobile-panel] .ac-row-copy > span { font-size:12px; }
  .admin-chats[data-mobile-panel] .ac-row-meta { padding-top:0; gap:7px; }
  .admin-chats[data-mobile-panel] .ac-row-meta time { font-size:11px; }
  .admin-chats[data-mobile-panel] .ac-search-result { padding:12px 10px; min-height:64px; gap:5px; }
  .admin-chats[data-mobile-panel] .ac-search-result strong { font-size:14px; }
  .admin-chats[data-mobile-panel] .ac-search-result > span { font-size:13px; }
  .admin-chats[data-mobile-panel] .ac-load-more { min-height:44px; }

  .admin-chats[data-mobile-panel] .ac-thread-header { flex-wrap:nowrap; gap:4px; min-height:64px; padding:calc(8px + env(safe-area-inset-top,0px)) 8px 8px; }
  .admin-chats[data-mobile-panel] .ac-mobile-back { display:inline-flex; }
  .admin-chats[data-mobile-panel] .ac-thread-identity { flex:1 1 auto; min-width:0; gap:10px; min-height:44px; }
  .admin-chats[data-mobile-panel] .ac-thread-identity .ac-avatar { width:40px; height:40px; }
  .admin-chats[data-mobile-panel] .ac-thread-identity strong { font-size:16px; line-height:21px; letter-spacing:-.25px; }
  .admin-chats[data-mobile-panel] .ac-thread-identity small { font-size:12px; line-height:18px; }
  .admin-chats[data-mobile-panel] .ac-header-actions { gap:0; margin-left:auto; flex-shrink:0; }
  .admin-chats[data-mobile-panel] .ac-icon-button { width:44px; height:44px; }
  .admin-chats[data-mobile-panel] .ac-pending-label,
  .admin-chats[data-mobile-panel] .ac-desktop-search-action { display:none; }
  .admin-chats[data-mobile-panel] .ac-mobile-search-action { display:flex; }
  .admin-chats[data-mobile-panel] .ac-popover { max-width:calc(100vw - 24px); right:4px; }
  .admin-chats[data-mobile-panel] .ac-popover button { min-height:44px; white-space:normal; }
  .admin-chats[data-mobile-panel] .ac-message-list { padding:16px 16px 12px; min-width:0; overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }
  .admin-chats[data-mobile-panel] .ac-day-divider { margin:5px 0 20px; font-size:12px; gap:12px; }
  .admin-chats[data-mobile-panel] .ac-day-divider::before,
  .admin-chats[data-mobile-panel] .ac-day-divider::after { width:36px; }
  .admin-chats[data-mobile-panel] .ac-message { margin-bottom:16px; }
  .admin-chats[data-mobile-panel] .ac-message.is-grouped { margin-top:-6px; }
  .admin-chats[data-mobile-panel] .ac-message-line { gap:4px 8px; flex-wrap:wrap; }
  .admin-chats[data-mobile-panel] .ac-bubble { max-width:min(calc(100% - 44px),252px); min-width:0; padding:10px 13px; border-radius:18px; font-size:15px; line-height:1.5; gap:5px 9px; }
  .admin-chats[data-mobile-panel] .ac-message.is-own .ac-bubble { border-bottom-right-radius:6px; }
  .admin-chats[data-mobile-panel] .ac-message:not(.is-own) .ac-bubble { border-bottom-left-radius:6px; }
  .admin-chats[data-mobile-panel] .ac-sender-name { font-size:11px; margin:0 0 4px 3px; }
  .admin-chats[data-mobile-panel] .ac-message-time { flex-basis:100%; font-size:11px; margin:0 0 0 1px; line-height:17px; }
  .admin-chats[data-mobile-panel] .ac-inline-time { font-size:11px; gap:5px; }
  .admin-chats[data-mobile-panel] .ac-bubble blockquote { font-size:12px; line-height:1.5; padding:4px 8px; }
  .admin-chats[data-mobile-panel] .ac-message .ac-message-actions.ac-mobile-message-actions { position:absolute; top:auto; bottom:18px; right:0; left:auto; display:flex; flex-direction:row; flex-basis:auto; margin:0; padding:0; border:0; box-shadow:none; background:transparent; opacity:1; pointer-events:auto; z-index:2; }
  .admin-chats[data-mobile-panel] .ac-message.is-own .ac-message-actions.ac-mobile-message-actions { bottom:0; left:0; right:auto; }
  .admin-chats[data-mobile-panel] .ac-message-actions.ac-mobile-message-actions .ac-icon-button { width:44px; height:44px; color:#a1a5b6; }
  .admin-chats[data-mobile-panel] .ac-message-note { font-size:11px; margin-left:2px; }
  .admin-chats[data-mobile-panel] .ac-first-message { min-height:160px; height:100%; padding:16px; }
  .admin-chats[data-mobile-panel] .ac-first-message span { max-width:260px; }
  .admin-chats[data-mobile-panel] .ac-focused-history { gap:6px; margin-bottom:12px; }
  .admin-chats[data-mobile-panel] .ac-history-button { min-height:40px; }
  .admin-chats[data-mobile-panel] .ac-error { align-items:flex-start; flex-wrap:wrap; padding:10px 12px; }
  .admin-chats[data-mobile-panel] .ac-error button { min-height:36px; }

  .admin-chats[data-mobile-panel] .ac-composer-area { padding:10px 12px calc(10px + var(--ac-safe-bottom,env(safe-area-inset-bottom,0px))); border-top:1px solid var(--ac-border); background:#fff; min-width:0; }
  .admin-chats[data-mobile-panel] .ac-composer { min-height:44px; padding:0; gap:8px; border:0; border-radius:0; align-items:flex-end; }
  .admin-chats[data-mobile-panel] .ac-composer-input { display:flex; align-items:flex-end; flex:1 1 auto; min-width:0; border:1px solid #dfe2ec; border-radius:24px; padding:1px 2px 1px 13px; background:#fff; }
  .admin-chats[data-mobile-panel] .ac-composer-input:focus-within { border-color:#b6afea; }
  .admin-chats[data-mobile-panel] .ac-composer textarea { flex:1 1 auto; width:0; min-width:0; min-height:44px; height:auto; max-height:min(120px,calc(var(--ac-viewport-height,100dvh) * .25)); padding:10px 0; font-size:16px; line-height:24px; border:0; border-radius:0; overflow-y:auto; }
  .admin-chats[data-mobile-panel] .chat-emoji-trigger.chat-emoji-trigger { flex:0 0 44px; width:44px; height:44px; border-radius:50%; margin-bottom:0; }
  .admin-chats[data-mobile-panel] .chat-file-picker > button,
  .admin-chats[data-mobile-panel] .ac-upload-disabled > button { width:44px; height:44px; background:#f3f4f7; color:#8c93a5; }
  .admin-chats[data-mobile-panel] .ac-send-button { width:44px; height:44px; background:#8272ee; color:#fff; }
  .admin-chats[data-mobile-panel] .ac-send-button:hover:not(:disabled) { background:#7161df; }
  .admin-chats[data-mobile-panel] .ac-send-button:disabled { background:#ddd8fb; }
  .admin-chats[data-mobile-panel] .ac-composer-area > .chat-typing { margin:0 0 7px 4px; }
  .admin-chats[data-mobile-panel] .ac-reply-preview { margin:0 0 8px; gap:8px; }
  .admin-chats[data-mobile-panel] .ac-reply-preview > span { font-size:12px; }
  .admin-chats[data-mobile-panel] .ac-reply-preview strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .admin-chats[data-mobile-panel] .chat-file-drafts { max-height:min(132px,calc(var(--ac-viewport-height,100dvh) * .25)); }
  .admin-chats[data-mobile-panel] .chat-file-draft { width:100%; max-width:100%; }
  .admin-chats[data-mobile-panel] .chat-file-message { max-width:100%; }
  .admin-chats[data-mobile-panel] .chat-file-label { gap:7px; padding:8px; }
  .admin-chats[data-mobile-panel] .chat-file-label .chat-file-icon { width:30px; height:34px; }
  .admin-chats[data-mobile-panel] .chat-file-copy strong { font-size:12px; }
  .admin-chats[data-mobile-panel] .chat-file-label > svg { padding:5px; }
  .admin-chats[data-mobile-panel] .ac-send-status { font-size:11px; }
  .admin-chats[data-mobile-panel] .ac-send-status button { min-height:36px; font-size:12px; }

  .admin-chats[data-mobile-panel] .ac-details { width:100%; border:0; box-shadow:none; padding:calc(12px + env(safe-area-inset-top,0px)) 16px max(16px,var(--ac-safe-bottom,0px)); overscroll-behavior:contain; }
  .admin-chats[data-mobile-panel] .ac-details > header { min-height:44px; }
  .admin-chats[data-mobile-panel] .ac-details li strong { font-size:14px; }
  .admin-chats[data-mobile-panel] .ac-details li small { font-size:12px; }
  .admin-chats[data-mobile-panel] .ac-modal-backdrop { top:var(--ac-viewport-top,0px); bottom:auto; height:var(--ac-viewport-height,100dvh); padding:12px; overflow:auto; }
  .admin-chats[data-mobile-panel] .ac-reason-dialog { width:100%; padding:18px; max-height:calc(var(--ac-viewport-height,100dvh) - 24px); overflow:auto; }
  .admin-chats[data-mobile-panel] .ac-reason-dialog h2 { font-size:17px; }
  .admin-chats[data-mobile-panel] .ac-reason-dialog textarea,
  .admin-chats[data-mobile-panel] .ac-group-dialog > input { font-size:16px; }
  .admin-chats[data-mobile-panel] .ac-reason-dialog footer { gap:8px; margin-top:16px; }
  .admin-chats[data-mobile-panel] .ac-reason-dialog footer button { min-height:44px; font-size:13px; }
  .admin-chats[data-mobile-panel] .ac-group-members { min-height:44px; }
  .admin-chats[data-mobile-panel] .cma-dialog { top:calc(var(--ac-viewport-top,0px) + 12px); bottom:auto; max-height:calc(var(--ac-viewport-height,100dvh) - 24px); margin:0 auto; overflow:auto; padding:18px; }
  .admin-chats[data-mobile-panel] .cma-dialog textarea { font-size:16px; min-height:90px; max-height:calc(var(--ac-viewport-height,100dvh) * .35); }
  .admin-chats[data-mobile-panel] .cma-dialog footer { margin-top:14px; }
}

/* Mobile message actions are portalled above the scroll area and software keyboard. */
.ac-mobile-actions-backdrop { position:fixed; inset:0; z-index:1510; background:#17192735; }
.ac-mobile-actions-sheet { position:fixed; z-index:1511; box-sizing:border-box; top:calc(var(--ac-viewport-top,0px) + var(--ac-viewport-height,100dvh) - 8px); left:50%; transform:translate(-50%,-100%); width:min(420px,calc(100% - 16px)); max-height:calc(var(--ac-viewport-height,100dvh) - 16px); overflow:auto; padding:8px 8px max(8px,var(--ac-safe-bottom,env(safe-area-inset-bottom,0px))); border:1px solid #e9eaf0; border-radius:20px; box-shadow:0 12px 36px #1e213a22; color:#17171c; background:#fff; font:14px/1.5 Manrope,sans-serif; overscroll-behavior:contain; }
.ac-mobile-actions-sheet *, .ac-mobile-actions-sheet *::before, .ac-mobile-actions-sheet *::after { box-sizing:border-box; }
.ac-mobile-actions-sheet header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:3px 4px 7px 10px; border-bottom:1px solid #eeeef4; margin-bottom:4px; }
.ac-mobile-actions-sheet h2, .ac-mobile-actions-sheet header strong { min-width:0; margin:0; font-size:15px; font-weight:650; }
.ac-mobile-actions-sheet > p { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; margin:10px 12px; color:#80869e; font-size:12px; line-height:1.5; }
.ac-mobile-actions-sheet button { display:flex; align-items:center; gap:11px; width:100%; min-height:48px; padding:10px 12px; border:0; border-radius:11px; background:transparent; color:inherit; font:inherit; text-align:left; cursor:pointer; -webkit-tap-highlight-color:transparent; }
.ac-mobile-actions-sheet button:hover { background:#f5f4fb; }
.ac-mobile-actions-sheet button:disabled { opacity:.45; cursor:default; }
.ac-mobile-actions-sheet button:focus-visible { outline:2px solid #8580f5; outline-offset:-2px; }
.ac-mobile-actions-sheet header button { flex:0 0 44px; justify-content:center; width:44px; height:44px; min-height:44px; padding:0; }
.ac-mobile-actions-sheet button svg { flex-shrink:0; width:20px; height:20px; color:#7b8094; }
.ac-mobile-actions-sheet .is-danger, .ac-mobile-actions-sheet .ac-mobile-delete { color:#b84d5c; }
.ac-mobile-actions-sheet .is-danger svg, .ac-mobile-actions-sheet .ac-mobile-delete svg { color:inherit; }

@media (max-width:360px) {
  .admin-chats[data-mobile-panel] .ac-thread-identity { gap:7px; }
  .admin-chats[data-mobile-panel] .ac-thread-identity strong { font-size:15px; }
  .admin-chats[data-mobile-panel] .ac-message-list { padding-inline:12px; }
  .admin-chats[data-mobile-panel] .ac-composer-area { padding-inline:8px; }
  .admin-chats[data-mobile-panel] .ac-composer { gap:6px; }
  .admin-chats[data-mobile-panel] .ac-composer-input { padding-left:10px; }
}
