/* ==========================================================================
   LABO NEDJMA — DIRECT IT SUPPORT CHAT & ADMIN MESSAGING HUB v8.0.0
   Clean Government Style • High Performance • Full Dark Mode Support
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOP NAVBAR BUTTONS
   -------------------------------------------------------------------------- */

/* Collaborator Direct Chat Button - Solid Crimson Red / Rouge Labo Nedjma */
.nav-chat-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 7px !important;
  width: auto !important;
  height: 34px !important;
  padding: 0 13px !important;
  border-radius: 9px !important;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 55%, #991b1b 100%) !important;
  border: 1px solid rgba(254, 202, 202, 0.45) !important;
  color: #ffffff !important;
  font-family: 'Poppins', 'Tajawal', sans-serif !important;
  font-size: 0.74rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
  cursor: pointer !important;
  user-select: none !important;
  position: relative !important;
  box-shadow: 0 3px 10px rgba(185, 28, 28, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  flex-shrink: 0 !important;
}

.nav-chat-btn:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 55%, #b91c1c 100%) !important;
  border-color: rgba(254, 226, 226, 0.75) !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.5) !important;
}

.nav-chat-btn i {
  font-size: 0.85rem !important;
  color: #ffffff !important;
  transition: transform 0.2s ease !important;
}

.nav-chat-btn:hover i {
  transform: scale(1.15) !important;
  color: #ffffff !important;
}

/* White pulse live dot on Collaborator Chat button */
.chat-live-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #ffffff;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.75);
  animation: chatPulseDot 2s infinite;
  display: inline-block;
  margin-left: 2px;
}

@keyframes chatPulseDot {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.75);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* Badge for unread replies on Collaborator button — High Visibility Glow */
.chat-pill-badge {
  background: #facc15 !important;
  color: #991b1b !important;
  border: 1.5px solid #ffffff !important;
  font-size: 0.72rem !important;
  font-weight: 900 !important;
  min-width: 20px !important;
  height: 20px !important;
  line-height: 20px !important;
  padding: 0 6px !important;
  border-radius: 10px !important;
  text-align: center !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 10px rgba(250, 204, 21, 0.7) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  animation: chatBadgeBounce 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

@keyframes chatBadgeBounce {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}

.chat-pill-badge.hidden {
  display: none !important;
}

/* Admin IT Support Hub Button (Replaces Collaborator button in Admin Mode with exact same shape & red color) */
body.is-admin #navDirectChatBtn,
body.admin-mode #navDirectChatBtn {
  display: none !important;
}

body:not(.is-admin):not(.admin-mode) #adminChatHubBtn {
  display: none !important;
}

body.is-admin #adminChatHubBtn,
body.admin-mode #adminChatHubBtn {
  display: inline-flex !important;
}

/* Responsive label switching for Support IT Direct & Messagerie */
.admin-chat-text-short {
  display: none;
}

@media (max-width: 1320px) {
  .admin-chat-text-long {
    display: none !important;
  }
  .admin-chat-text-short {
    display: inline !important;
  }
}

/* Dark mode navbar button overrides */
html.dark-mode .nav-chat-btn {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%) !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5) !important;
}

/* Responsive Navbar Button (Tablets / Intermediate Screens) */
@media (min-width: 851px) and (max-width: 1080px) {
  .nav-chat-btn .nav-btn-label {
    display: none !important;
  }
  .nav-chat-btn {
    padding: 0 10px !important;
  }
}

/* --------------------------------------------------------------------------
   2. COLLABORATOR CHAT MODAL (#directChatModal)
   -------------------------------------------------------------------------- */

.direct-chat-modal-content {
  max-width: 480px !important;
  width: 94% !important;
  height: auto !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
  background: #ffffff !important;
  margin: auto !important;
  transition: max-width 0.25s ease, height 0.25s ease !important;
}

.direct-chat-modal-content.in-chat-mode {
  max-width: 530px !important;
  height: min(640px, 86vh) !important;
}

/* Mutual Exclusivity: Auth Mode vs Chat Mode */
.direct-chat-modal-content:not(.in-chat-mode) #chatAuthView,
.direct-chat-modal-content:not(.in-chat-mode) .chat-auth-view {
  display: flex !important;
}

.direct-chat-modal-content:not(.in-chat-mode) #chatUserSubheader,
.direct-chat-modal-content:not(.in-chat-mode) .chat-user-subheader,
.direct-chat-modal-content:not(.in-chat-mode) #chatConversationView,
.direct-chat-modal-content:not(.in-chat-mode) .chat-conversation-view {
  display: none !important;
}

.direct-chat-modal-content.in-chat-mode #chatAuthView,
.direct-chat-modal-content.in-chat-mode .chat-auth-view {
  display: none !important;
}

.direct-chat-modal-content.in-chat-mode #chatUserSubheader,
.direct-chat-modal-content.in-chat-mode .chat-user-subheader {
  display: flex !important;
}

.direct-chat-modal-content.in-chat-mode #chatConversationView,
.direct-chat-modal-content.in-chat-mode .chat-conversation-view {
  display: flex !important;
}

/* Modal Header */
.chat-modal-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.chat-header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-it-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  position: relative;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.chat-status-dot-online {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0f172a;
  position: absolute;
  bottom: -2px;
  right: -2px;
}

.chat-header-info h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-it-verified-pill {
  font-size: 0.62rem;
  background: rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(147, 197, 253, 0.4);
  color: #93c5fd;
  padding: 1px 6px;
  border-radius: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.chat-header-info p {
  margin: 2px 0 0 0;
  font-size: 0.74rem;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chat-live-status-text {
  color: #34d399;
  font-weight: 600;
}

.chat-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.chat-header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: scale(1.05);
}

.chat-header-btn.btn-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

/* User Subheader (When logged in) */
.chat-user-subheader {
  background: #f1f5f9;
  padding: 8px 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #475569;
  flex-shrink: 0 !important;
}

.chat-user-subheader-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.chat-user-subheader-left .badge-unit {
  background: #e2e8f0;
  color: #1e293b;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
}

.chat-switch-account-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 5px;
  transition: all 0.15s ease;
}

.chat-switch-account-btn:hover {
  color: #b91c1c;
  background: #fee2e2;
}

/* Body: Registration / Login Container (Compact & Void-Free) */
.chat-auth-view {
  padding: 18px 22px 22px 22px !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  overflow-y: auto !important;
}

.chat-auth-intro {
  text-align: center !important;
  margin-bottom: 14px !important;
}

.chat-auth-intro-icon {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  color: #dc2626 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.25rem !important;
  margin-bottom: 8px !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15) !important;
}

.chat-auth-intro h4 {
  margin: 0 0 4px 0 !important;
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em !important;
}

.chat-auth-intro p {
  margin: 0 !important;
  font-size: 0.77rem !important;
  color: #64748b !important;
  line-height: 1.4 !important;
}

/* Tabs: Register / Login */
.chat-auth-tabs {
  display: flex !important;
  background: #f1f5f9 !important;
  border-radius: 10px !important;
  padding: 3px !important;
  margin-bottom: 14px !important;
  border: 1px solid #e2e8f0 !important;
}

.chat-auth-tab-btn {
  flex: 1 !important;
  border: none !important;
  background: transparent !important;
  padding: 7px 10px !important;
  border-radius: 8px !important;
  font-size: 0.76rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  font-family: inherit !important;
}

.chat-auth-tab-btn.active {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.chat-form-row {
  display: flex !important;
  gap: 10px !important;
  margin-bottom: 10px !important;
}

.chat-form-group {
  margin-bottom: 10px !important;
  flex: 1 !important;
}

.chat-form-group label {
  display: block !important;
  font-size: 0.73rem !important;
  font-weight: 700 !important;
  color: #334155 !important;
  margin-bottom: 4px !important;
}

.chat-input-wrap {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
}

.chat-input-wrap i {
  position: absolute !important;
  left: 11px !important;
  color: #94a3b8 !important;
  font-size: 0.8rem !important;
  pointer-events: none !important;
}

.chat-input-wrap input,
.chat-input-wrap select {
  width: 100% !important;
  height: 36px !important;
  padding: 0 10px 0 32px !important;
  border-radius: 9px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #ffffff !important;
  font-size: 0.82rem !important;
  font-family: inherit !important;
  color: #0f172a !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.chat-input-wrap input:focus,
.chat-input-wrap select:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

.chat-pin-helper {
  font-size: 0.68rem !important;
  color: #64748b !important;
  margin-top: 4px !important;
  display: block !important;
}

/* Compact & Elegant PIN Login Box */
.chat-pin-login-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 16px 18px !important;
  margin-bottom: 12px !important;
  text-align: center !important;
}

.chat-pin-label {
  display: block !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-bottom: 10px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
}

.chat-pin-input-container {
  position: relative !important;
  max-width: 260px !important;
  margin: 0 auto !important;
}

.chat-pin-large-input {
  width: 100% !important;
  height: 44px !important;
  border-radius: 12px !important;
  border: 2px solid #cbd5e1 !important;
  background: #ffffff !important;
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.35em !important;
  text-align: center !important;
  color: #0f172a !important;
  padding: 0 40px !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.chat-pin-large-input:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14) !important;
}

.btn-toggle-pin-visibility {
  position: absolute !important;
  right: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  padding: 6px !important;
  font-size: 0.95rem !important;
  transition: color 0.15s ease !important;
}

.btn-toggle-pin-visibility:hover {
  color: #0f172a !important;
}

.btn-chat-auth-submit {
  width: 100%;
  height: 42px;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  transition: all 0.22s ease;
  margin-top: 10px;
}

.btn-chat-auth-submit:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
}

/* Chat Messages View (Active Conversation) */
.chat-conversation-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #f8fafc;
  overflow: hidden;
}

.chat-messages-stream {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overflow-anchor: none !important;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  scroll-behavior: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Welcome system notice inside chat */
.chat-system-welcome-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-align: center;
  flex-shrink: 0 !important;
}

.chat-welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.chat-system-welcome-card p {
  margin: 0;
  font-size: 0.77rem;
  color: #475569;
  line-height: 1.5;
}

/* Date separator */
.chat-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0;
  flex-shrink: 0 !important;
}

.chat-date-separator span {
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 10px;
}

/* Message Bubble */
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  flex-shrink: 0 !important;
  animation: fadeInBubble 0.25s ease-out;
}

@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble-wrap.from-user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble-wrap.from-admin {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble-sender-title {
  font-size: 0.67rem;
  font-weight: 700;
  margin-bottom: 3px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.from-user .chat-bubble-sender-title {
  color: #2563eb;
}

.from-admin .chat-bubble-sender-title {
  color: #059669;
}

.chat-bubble-body {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  word-break: break-word;
  position: relative;
}

/* User Message Styling */
.from-user .chat-bubble-body {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
}

/* Admin / IT Message Styling */
.from-admin .chat-bubble-body {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
}

.chat-bubble-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.65rem;
  margin-top: 3px;
  padding: 0 4px;
  color: #94a3b8;
}

.chat-bubble-meta i.fa-check-double {
  color: #3b82f6;
}

/* Quick Copy Box inside message (e.g. for credentials sent by IT) */
.chat-copy-snippet-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.76rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-copy-chat-snippet {
  background: #e2e8f0;
  border: none;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-copy-chat-snippet:hover {
  background: #2563eb;
  color: #ffffff;
}

/* Quick Prompt Suggestion Chips */
.chat-quick-prompts-bar {
  padding: 6px 14px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  gap: 6px !important;
  overflow-x: auto !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.chat-quick-prompts-bar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.chat-prompt-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  font-family: inherit;
}

.chat-prompt-chip:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Input Area */
.chat-footer-input-area {
  padding: 12px 20px 16px 20px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  overflow: hidden !important;
}

.chat-textarea-wrap {
  flex: 1 !important;
  min-width: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

.chat-textarea-wrap textarea {
  width: 100% !important;
  min-height: 42px !important;
  max-height: 90px !important;
  padding: 10px 16px !important;
  border-radius: 22px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #f8fafc !important;
  font-size: 0.85rem !important;
  font-family: inherit !important;
  color: #0f172a !important;
  outline: none !important;
  resize: none !important;
  line-height: 1.4 !important;
  box-sizing: border-box !important;
  display: block !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.chat-textarea-wrap textarea:focus {
  border-color: #2563eb !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.chat-textarea-wrap textarea::placeholder {
  color: #94a3b8 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 0.84rem !important;
}

.btn-send-chat-msg {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

.btn-send-chat-msg:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transform: scale(1.05);
}

.btn-send-chat-msg:active {
  transform: scale(0.96);
}

/* --------------------------------------------------------------------------
   3. ADMIN CHAT HUB MODAL (#adminChatHubModal)
   -------------------------------------------------------------------------- */

.admin-chat-hub-modal-content {
  max-width: 960px !important;
  width: 96% !important;
  height: 85vh !important;
  max-height: 720px !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.32), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
  background: #ffffff !important;
}

/* Admin Hub Header */
.admin-hub-topbar {
  padding: 14px 20px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.admin-hub-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-hub-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.admin-hub-title-group h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-hub-role-badge {
  font-size: 0.62rem;
  background: rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(165, 180, 252, 0.4);
  color: #c7d2fe;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-hub-title-group p {
  margin: 2px 0 0 0;
  font-size: 0.74rem;
  color: #c7d2fe;
}

.admin-hub-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-admin-hub-refresh {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-admin-hub-refresh:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Two-Panel Layout */
.admin-chat-hub-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  background: #ffffff;
}

/* Left Sidebar: Threads / Conversations list */
.admin-chat-sidebar {
  width: 320px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  flex-shrink: 0;
}

.admin-chat-search-wrap {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
}

.admin-chat-search-wrap i {
  position: absolute;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.8rem;
}

.admin-chat-search-wrap input {
  width: 100%;
  height: 34px;
  padding: 0 10px 0 32px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.78rem;
  font-family: inherit;
  color: #0f172a;
  outline: none;
}

.admin-chat-search-wrap input:focus {
  border-color: #4f46e5;
}

.admin-conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-convo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.admin-convo-item:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.admin-convo-item.active {
  background: #eff6ff;
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.admin-convo-item.has-unread {
  border-left: 3.5px solid #ef4444;
}

.admin-convo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-convo-details {
  flex: 1;
  min-width: 0;
}

.admin-convo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.admin-convo-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-convo-time {
  font-size: 0.65rem;
  color: #94a3b8;
  flex-shrink: 0;
}

.admin-convo-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.admin-convo-preview {
  font-size: 0.72rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-convo-item.has-unread .admin-convo-preview {
  font-weight: 700;
  color: #0f172a;
}

.admin-convo-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 900;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  padding: 0 4px;
  border-radius: 10px;
  text-align: center;
  flex-shrink: 0;
}

.admin-convo-empty {
  text-align: center;
  padding: 40px 16px;
  color: #94a3b8;
  font-size: 0.8rem;
}

.admin-convo-empty i {
  font-size: 2rem;
  margin-bottom: 10px;
  display: block;
  color: #cbd5e1;
}

/* Right Main Area: Active Thread */
.admin-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #ffffff;
}

.admin-chat-active-header {
  padding: 12px 18px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
}

.admin-active-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-active-user-info h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-active-user-info p {
  margin: 2px 0 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

.admin-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-admin-clear-chat {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-admin-clear-chat:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
  transform: translateY(-1px);
}

html.dark-mode .btn-admin-clear-chat {
  background: rgba(220, 38, 38, 0.18);
  border-color: rgba(220, 38, 38, 0.4);
  color: #fca5a5;
}

html.dark-mode .btn-admin-clear-chat:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Quick Response Templates Toolbar */
.admin-templates-toolbar {
  padding: 6px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-template-label {
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  margin-right: 4px;
}

.btn-admin-template-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-admin-template-pill:hover {
  background: #eff6ff;
  border-color: #6366f1;
  color: #4f46e5;
}

/* Admin Chat Messages Stream */
.admin-messages-stream {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overflow-anchor: none !important;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  background: #f8fafc;
  scroll-behavior: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Admin Input Area */
.admin-chat-footer {
  padding: 12px 20px 16px 20px !important;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  width: 100% !important;
  overflow: hidden !important;
}

.admin-chat-footer textarea {
  flex: 1 !important;
  min-height: 42px !important;
  max-height: 100px !important;
  padding: 10px 16px !important;
  border-radius: 22px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #f8fafc !important;
  font-size: 0.85rem !important;
  font-family: inherit !important;
  color: #0f172a !important;
  outline: none !important;
  resize: none !important;
  line-height: 1.4 !important;
  box-sizing: border-box !important;
  display: block !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.chat-textarea-wrap textarea::placeholder,
.admin-chat-footer textarea::placeholder {
  color: #94a3b8 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 0.84rem !important;
}

.admin-chat-footer textarea:focus {
  border-color: #4f46e5 !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12) !important;
}

.btn-admin-send {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 1rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35) !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
}

.btn-admin-send:hover {
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   4. DARK MODE SUPPORT
   -------------------------------------------------------------------------- */

html.dark-mode .direct-chat-modal-content,
html.dark-mode .admin-chat-hub-modal-content {
  background: #0f172a !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(51, 65, 85, 0.8) !important;
}

html.dark-mode .chat-user-subheader {
  background: #1e293b;
  border-bottom-color: #334155;
  color: #94a3b8;
}

html.dark-mode .chat-auth-intro h4,
html.dark-mode .chat-form-group label,
html.dark-mode .admin-active-user-info h3,
html.dark-mode .admin-convo-name {
  color: #f1f5f9;
}

html.dark-mode .chat-auth-tabs {
  background: #1e293b;
  border-color: #334155;
}

html.dark-mode .chat-auth-tab-btn {
  color: #94a3b8;
}

html.dark-mode .chat-auth-tab-btn.active {
  background: #0f172a;
  color: #f8fafc;
}

html.dark-mode .chat-input-wrap input,
html.dark-mode .chat-input-wrap select,
html.dark-mode .chat-textarea-wrap textarea,
html.dark-mode .admin-chat-footer textarea,
html.dark-mode .admin-chat-search-wrap input {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

html.dark-mode .chat-conversation-view,
html.dark-mode .admin-chat-sidebar,
html.dark-mode .admin-messages-stream {
  background: #0b1120;
}

html.dark-mode .chat-system-welcome-card,
html.dark-mode .admin-convo-item,
html.dark-mode .admin-chat-main,
html.dark-mode .admin-chat-active-header,
html.dark-mode .chat-quick-prompts-bar,
html.dark-mode .chat-footer-input-area,
html.dark-mode .admin-chat-footer {
  background: #0f172a;
  border-color: #1e293b;
}

html.dark-mode .from-admin .chat-bubble-body {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}

html.dark-mode .chat-prompt-chip,
html.dark-mode .btn-admin-template-pill {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html.dark-mode .chat-prompt-chip:hover,
html.dark-mode .btn-admin-template-pill:hover {
  background: #312e81;
  border-color: #6366f1;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   5. MOBILE & TABLET RESPONSIVENESS (<= 850px)
   -------------------------------------------------------------------------- */

@media (max-width: 850px) {
  /* --- Topbar Buttons (Admin & Collaborator) --- */
  .nav-chat-btn,
  .nav-admin-chat-btn,
  #navDirectChatBtn,
  #adminChatHubBtn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 0 !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .nav-chat-btn i,
  .nav-admin-chat-btn i,
  #navDirectChatBtn i,
  #adminChatHubBtn i {
    font-size: 0.95rem !important;
    margin: 0 !important;
    line-height: 1 !important;
    color: #ffffff !important;
  }

  .nav-chat-btn .nav-btn-label,
  .nav-admin-chat-btn .nav-btn-label {
    display: none !important;
  }

  /* Live pulse dot positioned neatly on top-right of the square button */
  .nav-chat-btn .chat-live-pulse,
  .nav-admin-chat-btn .chat-live-pulse {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 6px !important;
    height: 6px !important;
    margin: 0 !important;
  }

  /* Unread count badge positioned at top-right corner */
  .nav-chat-btn .chat-pill-badge,
  .nav-admin-chat-btn .chat-pill-badge,
  #navDirectChatBadge,
  #adminChatBadge,
  #chatUserUnreadBadge {
    position: absolute !important;
    top: -5px !important;
    right: -6px !important;
    min-width: 17px !important;
    height: 17px !important;
    padding: 0 4px !important;
    font-size: 0.62rem !important;
    line-height: 17px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
    z-index: 10 !important;
  }

  .nav-chat-btn .chat-pill-badge.hidden,
  .nav-admin-chat-btn .chat-pill-badge.hidden,
  #navDirectChatBadge.hidden,
  #adminChatBadge.hidden,
  #chatUserUnreadBadge.hidden {
    display: none !important;
  }

  /* --- Fullscreen Modal Overlay Containers --- */
  #directChatModal.modal,
  #adminChatHubModal.modal {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: rgba(0, 0, 0, 0.55) !important;
    z-index: 150000 !important;
  }

  #directChatModal.modal.active,
  #adminChatHubModal.modal.active,
  #directChatModal.modal[style*="display: flex"],
  #adminChatHubModal.modal[style*="display: flex"] {
    display: flex !important;
  }

  /* --- Modal Content Shells (Edge-to-edge 100dvh) --- */
  .direct-chat-modal-content,
  .direct-chat-modal-content.in-chat-mode,
  .admin-chat-hub-modal-content {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* --- Headers on Mobile (Clean Native Conflict-Free Layout) --- */
  .chat-modal-header,
  .admin-hub-topbar {
    padding: 8px 12px !important;
    border-radius: 0 !important;
    flex-shrink: 0 !important;
    min-height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .admin-hub-topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .admin-hub-icon-wrap {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    flex-shrink: 0 !important;
  }

  .admin-hub-title-group {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .admin-hub-title-group h2 {
    font-size: 0.88rem !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  .admin-hub-title-text {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .admin-hub-role-badge {
    font-size: 0.58rem !important;
    padding: 2px 6px !important;
    border-radius: 6px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    letter-spacing: 0.3px !important;
  }

  /* Compact single-line subtitle on mobile to eliminate clutter */
  .admin-hub-title-group p,
  .chat-modal-header .chat-header-title-wrap p {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 2px 0 0 0 !important;
    color: #a5b4fc !important;
    max-width: 100% !important;
  }

  .admin-hub-topbar-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }

  .btn-admin-hub-refresh {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 8px !important;
  }

  .btn-admin-hub-refresh span {
    display: none !important;
  }

  .btn-admin-hub-refresh i {
    font-size: 0.85rem !important;
    margin: 0 !important;
  }

  .chat-header-btn.btn-close {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* --- Collaborator Viewport & Prompts Bar --- */
  .chat-conversation-view {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .chat-quick-prompts-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    scrollbar-width: none !important;
  }

  .chat-quick-prompts-bar::-webkit-scrollbar {
    display: none !important;
  }

  .chat-prompt-chip {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.74rem !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
  }

  /* --- Input Footers on Mobile --- */
  .chat-footer-input-area,
  .admin-chat-footer {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px !important;
    flex-shrink: 0 !important;
  }

  .chat-input-wrapper input,
  .admin-chat-input-wrap input {
    font-size: 0.92rem !important;
    padding: 9px 14px !important;
  }

  .chat-send-btn,
  .admin-chat-send-btn {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    flex-shrink: 0 !important;
  }

  /* --- Admin Chat Hub: Mobile Two-Pane Sliding Layout --- */
  .admin-chat-hub-layout {
    position: relative !important;
    flex: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: block !important;
  }

  /* Sidebar takes 100% width on mobile */
  .admin-chat-sidebar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    background: #f8fafc !important;
    z-index: 20 !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .admin-chat-search-wrap,
  .admin-conversations-list,
  .admin-convo-item {
    visibility: visible !important;
  }

  /* When thread is active: Sidebar slides to left */
  .admin-chat-hub-layout.thread-active .admin-chat-sidebar {
    transform: translateX(-100%) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Main area on mobile: stays tucked off-screen to the right until thread is selected */
  .admin-chat-main {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: #ffffff !important;
    z-index: 10 !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    transform: translateX(100%) !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .admin-chat-hub-layout.thread-active .admin-chat-main {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* Back button in thread header */
  .admin-chat-mobile-back-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 8px !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #4f46e5 !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    margin-right: 8px !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }

  .admin-chat-mobile-back-btn:active {
    background: #e2e8f0 !important;
  }

  /* Admin Active Header on Mobile */
  .admin-chat-active-header {
    padding: 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    min-height: auto !important;
  }

  .admin-active-user-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    flex: 1 !important;
  }

  .admin-active-user-info h3 {
    font-size: 0.90rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
  }

  .admin-active-user-info p {
    font-size: 0.68rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 2px 0 0 0 !important;
  }

  .btn-admin-clear-chat {
    padding: 5px 8px !important;
    font-size: 0.70rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Admin Quick Templates Bar on Mobile */
  .admin-templates-toolbar {
    padding: 6px 10px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }

  .admin-templates-toolbar::-webkit-scrollbar {
    display: none !important;
  }

  .btn-admin-template-pill {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.72rem !important;
    padding: 4px 8px !important;
  }

  /* Dark mode overrides for mobile */
  html.dark-mode .admin-chat-sidebar {
    background: #0b1120 !important;
  }
  html.dark-mode .admin-chat-main {
    background: #0f172a !important;
  }
  html.dark-mode .admin-chat-mobile-back-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #818cf8 !important;
  }
}

/* Very Small Mobile (< 480px) */
@media (max-width: 480px) {
  .btn-admin-clear-chat span {
    display: none !important;
  }
  .btn-admin-clear-chat {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
  }
}

/* Desktop Screens (> 850px) */
@media (min-width: 851px) {
  .admin-chat-hub-layout {
    display: flex !important;
    flex-direction: row !important;
    position: relative !important;
  }

  .admin-chat-sidebar {
    position: static !important;
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .admin-chat-main {
    position: static !important;
    flex: 1 !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .admin-chat-mobile-back-btn {
    display: none !important;
  }
}

/* ===== PROFESSIONAL DIALOG Z-INDEX & DELETE BUTTONS ===== */
.app-dialog-overlay {
  z-index: 200000 !important;
}

.admin-convo-top-right {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-shrink: 0 !important;
}

