/* Compact "Chats" tab (and the «2 в 1» workspace, which hosts the same chat) for laptops (1280x720+): the message feed gets the height, not the chrome around it.
   Desktop only and scoped to the active chats view, so other tabs and mobile.html keep their layout.
   body:has(...) gives these rules higher specificity than the !important styles injected by app.js. */
@media screen and (min-width: 861px) {
  body:has(#view-conversations.active, #view-workspace.active) .main-area { padding-top: 8px !important; padding-bottom: 8px !important; }

  /* global bars: one slim row each, every button stays */
  body:has(#view-conversations.active, #view-workspace.active) .top-license-bar { padding: 3px 10px !important; margin-bottom: 6px !important; min-height: 0 !important; }
  body:has(#view-conversations.active, #view-workspace.active) .top-license-bar > span:first-child { display: none !important; }
  body:has(#view-conversations.active, #view-workspace.active) #pcHeaderQuickTools { flex-direction: row !important; gap: 6px !important; }
  body:has(#view-conversations.active, #view-workspace.active) .cyber-ticker-bar { padding: 2px 8px !important; margin-bottom: 6px !important; min-height: 0 !important; }
  body:has(#view-conversations.active, #view-workspace.active) #view-conversations > .page-header { margin-bottom: 6px !important; min-height: 0 !important; }
  body:has(#view-conversations.active, #view-workspace.active) #view-conversations .page-title { font-size: 17px !important; line-height: 28px !important; }
  body:has(#view-conversations.active, #view-workspace.active) #view-conversations .header-actions .btn { padding: 5px 10px !important; }

  body:has(#view-conversations.active, #view-workspace.active) #view-conversations .chat-layout {
    height: calc(100vh - 128px) !important;
    max-height: calc(100vh - 128px) !important;
    min-height: 420px !important;
  }

  /* active chat header: info left, actions in one row (wraps under the info only when it must) */
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header { padding: 6px 12px !important; flex-wrap: wrap !important; gap: 6px 10px !important; min-height: 0 !important; }
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header > div:first-child > img,
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header .user-avatar { width: 34px !important; height: 34px !important; }
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header > div:first-child { min-width: 0 !important; flex: 1 1 auto; overflow: hidden; }
  body:has(#view-conversations.active, #view-workspace.active) .radz-header-right-stack { flex-direction: row !important; align-items: center !important; gap: 6px !important; margin-left: auto !important; }
  body:has(#view-conversations.active, #view-workspace.active) .radz-header-right-stack > button,
  body:has(#view-conversations.active, #view-workspace.active) .radz-sub-actions-row .radz-pro-btn,
  body:has(#view-conversations.active, #view-workspace.active) .radz-gear-main-btn { height: 28px !important; padding-top: 0 !important; padding-bottom: 0 !important; }

  /* history row: single line */
  body:has(#view-conversations.active, #view-workspace.active) #v120SmartHistoryBar { padding: 4px 12px !important; flex-wrap: nowrap !important; gap: 8px !important; min-height: 0 !important; }
  body:has(#view-conversations.active, #view-workspace.active) #v120SmartHistoryBar > div:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 0 1 auto; }
  body:has(#view-conversations.active, #view-workspace.active) #v120SmartHistoryBar > div:last-child { flex-wrap: nowrap !important; flex-shrink: 0; }
  body:has(#view-conversations.active, #view-workspace.active) .v120-hist-btn { padding: 3px 10px !important; white-space: nowrap; }

  /* deal dossier: every chip on one horizontally scrollable line */
  body:has(#view-conversations.active, #view-workspace.active) #v44ChatDealDossierBar {
    flex-direction: row !important; flex-wrap: nowrap !important; align-items: center !important;
    overflow-x: auto !important; overflow-y: hidden !important; gap: 5px !important;
    padding: 4px 12px !important; min-height: 0 !important; scrollbar-width: thin;
  }
  body:has(#view-conversations.active, #view-workspace.active) #v44ChatDealDossierBar .v44-dossier-row,
  body:has(#view-conversations.active, #view-workspace.active) #v44ChatDealDossierBar .v44-dossier-row > div { display: contents !important; }
  body:has(#view-conversations.active, #view-workspace.active) #v44ChatDealDossierBar * { white-space: nowrap; flex-shrink: 0; }

  body:has(#view-conversations.active, #view-workspace.active) #view-conversations .chat-footer { padding: 6px 12px !important; gap: 6px !important; }
  body:has(#view-conversations.active, #view-workspace.active) #activeChatMessages { padding: 10px 14px !important; }
}

/* laptop widths: header actions become icons (all keep their title tooltip), so the header stays one row */
@media screen and (min-width: 861px) and (max-width: 1399px) {
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header { flex-wrap: nowrap !important; }
  body:has(#view-conversations.active, #view-workspace.active) #btnChatGearV24 > span,
  body:has(#view-conversations.active, #view-workspace.active) .radz-sub-actions-row .radz-pro-btn > span { display: none !important; }
  body:has(#view-conversations.active, #view-workspace.active) .radz-sub-actions-row .radz-pro-btn,
  body:has(#view-conversations.active, #view-workspace.active) #btnChatGearV24 { padding-left: 9px !important; padding-right: 9px !important; gap: 4px !important; }
  /* translate toggle has no icon element: show only its leading globe emoji, colour shows ON/OFF */
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header > div:first-child > div > div:first-child { flex-wrap: nowrap !important; min-width: 0; overflow: hidden; }
  body:has(#view-conversations.active, #view-workspace.active) #chatActiveView .chat-header .radz-ltv-returning-badge { min-width: 0; flex-shrink: 1 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body:has(#view-conversations.active, #view-workspace.active) #v37DirectTranslateChatBtn { max-width: 32px !important; overflow: hidden !important; white-space: nowrap !important; justify-content: flex-start !important; padding-left: 8px !important; }
}
