/* Modern Chat UI - WhatsApp/Telegram Style */
/* This file uses proper CSS specificity instead of !important */

:root {
  
  --primary-color: #0084ff;
  --primary-dark: #0066cc;
  --secondary-color: #25D366;
  --bg-light: #f0f2f5;
  --bg-chat: #f0f2f5;
  --bg-white: #ffffff;
  --text-primary: #111b21;
  --text-secondary: #667781;
  --border-color: #e4e4e4;
  --message-sent: #F8F8F8;
  --message-received: #ffffff;
  --hover-bg: #f5f6f6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.15);
  --sidebar-collapsed-width: 64px;
  --chat-sidebar-default-width: 460px;
  --chat-sidebar-default-min-width: 460px;
  --chat-sidebar-default-max-width: 560px;
  --chat-main-default-min-width: 30vw;
  --chat-meeting-main-min-width: 400px;
  --chat-split-divider-width: 6px;
  --chat-split-divider-hit-width: 16px;
}

/* Main Container - Using high specificity
   Pin top+bottom instead of 100vh so short screens (e.g. 1280x720 + taskbar)
   don't clip the webinar/meet iframe footer under the OS taskbar. */
.container.chat.chat-wrapper {
  display: flex;
  width: calc(100% - 70px);
  height: auto;
  max-height: none;
  position: fixed;
  top: 70px;
  left: 70px;
  right: 0;
  bottom: 0;
  background: var(--bg-chat);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  margin-bottom: 0; /* explicitly remove any inherited bottom spacing */
  padding: 0;
  padding-bottom: 0; /* explicitly remove any inherited bottom spacing */
  z-index: 1;
  box-sizing: border-box;
  overflow: hidden;
  min-width: 0;
}

/* Sidebar - Using ID and class for specificity */
.container1.sidebar,
.container1#sidebar1 {
  width: var(--chat-sidebar-default-width);
  min-width: var(--chat-sidebar-default-min-width);
  max-width: var(--chat-sidebar-default-max-width);
  height: 93vh;
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  flex-shrink: 0;
  flex-grow: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.container1.sidebar::-webkit-scrollbar,
.container1#sidebar1::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* Mobile drawer overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 998;
  display: none;
}

.sidebar-overlay.show {
  display: block;
}

/* Prevent body scroll when drawer is open */
.no-scroll {
  overflow: hidden;
}

/* Right Container Menu */
.right-container-menu,.submenu.chat {
  display: flex;
  background: var(--bg-white);
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  gap: 4px;
  margin: 0 auto;
}

.ThreeBtn {
  border: none;
  background: transparent;
  padding: 8px 5px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
}

.ThreeBtn:hover {
  background: var(--hover-bg);
}

.ThreeBtn.activetabb {
  background: var(--hover-bg);
  color: var(--primary-color);
  font-weight: 500;
}

.ThreeBtn .primaryIcons {
  width: 20px;
  margin: 0;
}

/* Submenu */
.submenu {
  background: var(--bg-white);
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Chat List - Using ID for specificity */
#chatFriends,
#recentConversation {
  min-height: 0;
  max-height: 27vh;
  overflow-y: auto;
  overflow-x: hidden !important;
  background: var(--bg-white);
  padding: 0;
}

#chatFriends,
#recentConversation {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#chatFriends::-webkit-scrollbar,
#recentConversation::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#recentConversation {
  display: none;
}

/* ═══════════════════════════════════════════════════
   Chat List Item — Clean flat style
   ═══════════════════════════════════════════════════ */
.userListChat {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  margin: 0;
  cursor: pointer;
  border-radius: 0;
  border: none;
  border-bottom: none;
  background: var(--bg-white);
  transition: background 0.15s ease;
  position: relative;
}

.userListChat:hover {
  background: #f5f5f5;
}

.userListChat:active {
  background: #ebebeb;
}

.userListChat.clicky {
  background: #e8f0fe;
  border: none;
  box-shadow: none;
}

/* Name/status column must never show the legacy .clicky deepskyblue border */
.userListChat .chat-row-main.clicky,
.userListChat .userListPtag.clicky,
.userListChat .userListPtag_.clicky,
.userListChat .groupuserListPtag.clicky {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  outline: none !important;
}

.userListChat .userListPtag:focus,
.userListChat .userListPtag_:focus,
.userListChat .groupuserListPtag:focus,
.userListChat .chat-row-main:focus {
  outline: none;
}

/* Avatar — Clean circle */
.userListImg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
  flex-shrink: 0;
  background: #e0e0e0;
  border: none;
  box-shadow: none;
}

/* Friends chat keeps left margin for presence dots; all other lists flush left */
#inlineGroupList .userListImg,
#grouplist .userListImg,
#ai-accordion-panels .userListImg,
#ai-recent-list .userListImg,
#ai-customer-list .userListImg,
#ai-companies-list .userListImg,
#sidebarAiRecentList .userListImg,
.submenu.group .userListImg {
  margin-left: 0 !important;
}
/* Name */
.userListPtag {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: normal;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

/* Timestamp inside sidebar items — right-aligned.
   Must beat the bubble rule `.timespan { bottom: 4px }` or list times vanish. */
/* Timestamp inside sidebar items — right-aligned.
   Must beat the bubble rule `.timespan { bottom: 4px }` or list times vanish. */
#chatFriends .userListChat > .timespan,
#inlineGroupList .userListChat > .timespan,
#grouplist .userListChat > .timespan,
#sidebar1 .submenu.group .userListChat > .timespan,
#inlineGroupList .timespan,
#grouplist .timespan,
.userListChat > .timespan {
  position: absolute !important;
  top: 50% !important;
  right: 26px !important;
  bottom: auto !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 3 !important;
  display: inline-block !important;
  font-size: 11px !important;
  font-weight: 400 !important;
  color: #9aa0a6 !important;
  padding: 0 !important;
  margin: 0 !important;
  pointer-events: none;
  white-space: nowrap;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}
#chatFriends .userListChat > .timespan:empty,
#inlineGroupList .userListChat > .timespan:empty,
#grouplist .userListChat > .timespan:empty,
#sidebar1 .submenu.group .userListChat > .timespan:empty,
#inlineGroupList .timespan:empty,
#grouplist .timespan:empty,
.userListChat > .timespan:empty {
  display: none !important;
}

/* Name + live status column (keeps time absolute on the right) */
.userListChat > .chat-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  padding-right: 68px;
  margin: 0;
}
.userListChat > .chat-row-main > .userListPtag,
.userListChat > .chat-row-main > .userListPtag_ {
  flex: 0 1 auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
}
.userListChat > .chat-row-main > .chat-row-live-status {
  display: none;
  position: static;
  left: auto;
  right: auto;
  top: auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.userListChat > .chat-row-main > .chat-row-live-status.is-visible {
  display: block;
}
.userListChat > .chat-row-main > .chat-row-live-status.is-typing {
  color: #1a73e8;
  font-style: italic;
}
.userListChat > .chat-row-main > .chat-row-live-status.is-in-call {
  color: #188038;
}
/* Phone glyph for in-call */
.userListChat > .chat-row-main > .chat-row-live-status.is-in-call::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 5px;
  border-radius: 50%;
  background: #188038;
  vertical-align: 0;
  box-shadow: 0 0 0 2px rgba(24, 128, 56, 0.18);
}

/* Chat Area - Using ID for specificity */
.container2#chatArea,
.container2 {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 92vh;
  max-height: 100vh;
  background: var(--bg-chat);
  position: relative;
  width: auto;
  margin: 0;
  border: none;
  overflow: hidden;
  min-width: var(--chat-main-default-min-width);
}

/* Split divider between sidebar and chat area */
.chat-split-divider {
  position: relative;
  flex: 0 0 var(--chat-split-divider-width);
  width: var(--chat-split-divider-width);
  min-width: var(--chat-split-divider-width);
  height: 100%;
  background: transparent;
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overflow: visible;
  pointer-events: auto;
  z-index: 30;
}

.chat-split-divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: var(--chat-split-divider-hit-width, 16px);
  transform: translateX(-50%);
  background:
    linear-gradient(
      to right,
      transparent calc(50% - 0.5px),
      var(--border-subtle) calc(50% - 0.5px),
      var(--border-subtle) calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    );
  transition: background 0.15s ease;
}

.chat-split-divider::after {
  content: "⋮⋮";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  line-height: 1;
  color: #1a73e8;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.chat-split-divider:hover::before,
.chat-split-divider.is-dragging::before {
  background:
    linear-gradient(
      to right,
      transparent calc(50% - 0.5px),
      #1a73e8 calc(50% - 0.5px),
      #1a73e8 calc(50% + 0.5px),
      transparent calc(50% + 0.5px)
    );
}

.chat-split-divider:hover::after,
.chat-split-divider.is-dragging::after {
  opacity: 1;
}

body.chat-split-dragging {
  user-select: none;
  -webkit-user-select: none;
  cursor: col-resize;
}



/* Messages Container - Using ID for specificity */
#subCont1,
.subCont1 {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 16px;
  background: var(--bg-chat);
  background-image: 
    url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='chat-pattern' x='0' y='0' width='100' height='100' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='50' cy='50' r='1' fill='%23d4d4d4' opacity='0.3'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100' height='100' fill='url(%23chat-pattern)'/%3E%3C/svg%3E");
  background-size: 100px 100px;
  background-position: 0 0, 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: auto;
  max-height: 100%;
}

/* Message Bubbles */
.message {
  display: flex;
  flex-direction: column;
  margin-bottom: 4px;
  max-width: 65%;
  min-width: 100px;
  position: relative;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.left {
  align-self: flex-start;
  float: none;
  clear: both;
  margin-right: auto;
  margin-left: 0;
}

.message.right {
  align-self: flex-end;
  float: none;
  clear: both;
  margin-left: auto;
  margin-right: 0;
}

/* Also handle standalone .left and .right classes */
.left {
  align-self: flex-start;
  float: none;
  clear: both;
  margin-right: auto;
  margin-left: 0;
}

.right {
  align-self: flex-end;
  float: none;
  clear: both;
  margin-left: auto;
  margin-right: 0;
}

/* Message Content */
.innermsg {
  padding: 8px 12px;
  padding-bottom: 24px;
  border-radius: 8px;
  font-size: 14.2px;
  line-height: 1.4;
  word-wrap: break-word;
  position: relative;
  box-shadow: var(--shadow-sm);
  border: none;
  min-height: 40px;
}

/* Google Chat–like body: intentional line breaks + fluid wrap */
.message .innermsg .textmsg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
  display: inline-block;
  max-width: 100%;
  vertical-align: top;
}

/* Teleprompter / cue tags e.g. [PAUSE] */
.chat-script-cue {
  font-weight: 500;
  color: #c5221f;
}

.message.right .innermsg .chat-script-cue {
  color: #9c1c1a;
}

/* Add extra bottom padding when reactions are present to prevent overlap with content */
.innermsg:has(.reactions:not(:empty)) {
  padding-bottom: 28px;
}

/* Received Messages (Left) */
.message.left .innermsg,
.left .innermsg {
  background: var(--message-received);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

/* Sent Messages (Right) — white bubble (no WhatsApp green) */
.message.right .innermsg,
.right .innermsg {
  background: var(--message-sent);
  border-top-right-radius: 4px;
  color: var(--text-primary);
}

/* Override old border styles */
.message.right .innermsg,
.message.right .replydiv {
  border: none;
  border-radius: 8px;
  border-top-right-radius: 4px;
  border: 1px solid #e5e7eb;
}

.message.left .innermsg,
.message.left .replydiv {
  border: none;
  border-radius: 8px;
  border-top-left-radius: 4px;
  border: 1px solid #cfe3ff;
}

/* Quoted reply inside a sent/received bubble */
.message .replydiv {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  padding: 8px 10px 22px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.message.right .replydiv {
  background: var(--message-sent, #f8f8f8);
}

.message.left .replydiv {
  background: var(--message-received, #fff);
}

.message .replydiv .content {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0 0 8px;
  padding: 6px 8px 6px 10px;
  background: rgba(0, 0, 0, 0.045);
  border: none;
  border-left: 3px solid var(--primary-color, #0084ff);
  border-radius: 8px;
  color: var(--text-secondary, #667781);
}

.message.right .replydiv .content {
  background: rgba(17, 27, 33, 0.05);
}

.message .replydiv .content > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  vertical-align: middle;
}

.message .replydiv .content > div:last-child:not(:first-child) {
  flex: 0 0 auto;
}

.message .replydiv .content > div:last-child:empty {
  display: none;
}

.message .replydiv .content > div > span {
  display: block;
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--primary-color, #0084ff);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message .replydiv .content img {
  width: 36px;
  height: 36px;
  min-width: 36px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: #fff;
}

.message .replydiv .reply {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 14.2px;
  line-height: 1.45;
  color: var(--text-primary, #111b21);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message .replydiv .nested-reply {
  margin: 0 0 8px !important;
  padding: 6px 8px 6px 10px !important;
  border-left: 2px solid var(--border-color, #e4e4e4) !important;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.03);
  font-size: 12px !important;
  color: var(--text-secondary, #667781) !important;
}

/* Message Time - Positioned at bottom */
/* Outgoing message send failure + chat connection banner */
.chat-send-error-banner {
  display: none !important;
  align-items: center;
  gap: 10px;
  margin: 0 12px 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(254, 242, 242, 0.96);
  color: #7f1d1d;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  animation: csebIn 0.22s ease-out;
  position: relative;
  z-index: 40;
}
.chat-send-error-banner.visible {
  display: flex !important;
}
@keyframes csebIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.chat-send-error-banner .cseb-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 15px;
}
.chat-send-error-banner .cseb-body {
  flex: 1 1 auto;
  min-width: 0;
}
.chat-send-error-banner .cseb-title {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}
.chat-send-error-banner .cseb-message {
  font-size: 12px;
  font-weight: 450;
  opacity: 0.85;
  line-height: 1.3;
}
.chat-send-error-banner .cseb-dismiss {
  border: none;
  background: transparent;
  color: inherit;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.7;
  flex-shrink: 0;
}
.chat-send-error-banner .cseb-dismiss:hover {
  background: rgba(127, 29, 29, 0.08);
  opacity: 1;
}

.message.right.msg-send-failed .innermsg {
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.08);
}
.message .msg-send-status {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 4px 4px 0;
  padding: 0 2px;
  font-size: 12px;
  color: #b91c1c;
  justify-content: flex-end;
}
.message.right.msg-send-failed .msg-send-status,
.message .msg-send-status.is-visible {
  display: flex;
}
.message .msg-send-status-text {
  font-weight: 550;
}
.message .msg-send-retry {
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.message .msg-send-retry:hover {
  background: rgba(239, 68, 68, 0.18);
}
.message .msg-send-retry:active {
  transform: scale(0.97);
}
.message .msg-send-retry:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Sent / Delivered / Read ticks — bottom-right of outgoing bubble */
.message.right .innermsg {
  position: relative;
}
.message.right .msg-receipt-ticks {
  position: absolute;
  right: 8px;
  bottom: 4px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  font-size: 12px;
  letter-spacing: -1.5px;
  color: #94a3b8; /* sent — muted slate */
  user-select: none;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 0 0 transparent;
}
/* Keep timestamp left of the ticks in the bottom-right corner */
.message.right .innermsg > .sendername,
.message.right .innermsg > .timespan {
  right: 28px;
  left: auto;
  text-align: right;
}
.message.right .innermsg:has(.reactions:not(:empty)) > .sendername,
.message.right .innermsg:has(.reactions:not(:empty)) > .timespan {
  right: 28px;
  left: auto;
  text-align: right;
}
.message.right .msg-receipt-ticks .msg-receipt-icon {
  font-family: inherit;
  font-weight: 700;
}
.message.right .msg-receipt-ticks[data-receipt-status="sending"] {
  opacity: 0.55;
  letter-spacing: 0;
  color: #94a3b8;
}
.message.right .msg-receipt-ticks[data-receipt-status="sent"] {
  color: #94a3b8; /* single grey tick */
}
.message.right .msg-receipt-ticks.is-delivered,
.message.right .msg-receipt-ticks[data-receipt-status="delivered"] {
  color: #475569; /* double dark slate — clearly delivered, not read */
}
.message.right .msg-receipt-ticks.is-read,
.message.right .msg-receipt-ticks[data-receipt-status="read"] {
  color: #1d4ed8; /* strong blue — WhatsApp-like read */
  filter: drop-shadow(0 0 0.4px rgba(29, 78, 216, 0.45));
}
.message.right .msg-receipt-ticks.is-failed,
.message.right .msg-receipt-ticks[data-receipt-status="failed"] {
  color: #dc2626;
  letter-spacing: 0;
}

/* Offline / blocked outgoing call toast */
.call-offline-toast {
  display: none;
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12000;
  width: min(440px, calc(100% - 24px));
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.28);
  background: rgba(254, 242, 242, 0.97);
  color: #7f1d1d;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.call-offline-toast.visible {
  display: flex;
  animation: cotIn 0.22s ease-out;
}
@keyframes cotIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
.call-offline-toast .cot-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.call-offline-toast .cot-body {
  flex: 1 1 auto;
  min-width: 0;
}
.call-offline-toast .cot-title {
  font-size: 13px;
  font-weight: 650;
}
.call-offline-toast .cot-message {
  font-size: 12.5px;
  opacity: 0.9;
  line-height: 1.35;
}
.call-offline-toast .cot-dismiss {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 4px;
}
.call-offline-toast .cot-dismiss:hover {
  opacity: 1;
}

.sendername,
.message .timespan {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 4px;
  position: absolute;
  bottom: 4px;
  z-index: 0;
  white-space: nowrap;
  pointer-events: none;
}

/* Default: right messages have time on right */
.message.right .sendername,
.message.right .timespan {
  right: 8px;
  left: auto;
  text-align: right;
}

/* Left messages have time on left */
.message.left .sendername,
.message.left .timespan {
  right: 8px;
  left: auto;
  text-align: left;
}

/* When reactions are present, move timestamp to avoid overlap */
.message.right .innermsg:has(.reactions:not(:empty)) .sendername,
.message.right .innermsg:has(.reactions:not(:empty)) .timespan {
  right: auto;
  left: 8px;
  text-align: left;
}

/* Left messages: keep time on left, but adjust if reactions take too much space */
.message.left .innermsg:has(.reactions:not(:empty)) .sendername,
.message.left .innermsg:has(.reactions:not(:empty)) .timespan {
  left: 8px;
  right: auto;
  text-align: left;
}

/* Rich URL previews — host wraps full card; 320×240 applies only to .chat-link-preview-img-wrap */
.chat-link-preview-host {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 10px;
  clear: both;
}

/* Stack bubble content so the bubble background covers image + title + description */
.innermsg:has(.chat-link-preview-host) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
}

.chat-link-preview {
  margin-top: 0;
}

.innermsg:has(.chat-link-preview-host) .textmsg .chat-msg-link,
.innermsg:has(.chat-link-preview-host) .reply .chat-msg-link,
.mc-ai-body:has(.chat-link-preview-host) a.chat-msg-link {
  display: inline-block;
  vertical-align: top;
  max-width: 100%;
  padding: 8px 16px;
  margin: 0 0 2px;
  border-radius: 9999px;
  color: #1a73e8 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-all;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.message.right .innermsg:has(.chat-link-preview-host) .textmsg .chat-msg-link,
.message.right .innermsg:has(.chat-link-preview-host) .reply .chat-msg-link {
  color: #1a73e8 !important;
}

.message.right .innermsg:has(.chat-link-preview-host) .textmsg .chat-msg-link:hover,
.message.right .innermsg:has(.chat-link-preview-host) .reply .chat-msg-link:hover,
.innermsg:has(.chat-link-preview-host) .textmsg .chat-msg-link:hover,
.innermsg:has(.chat-link-preview-host) .reply .chat-msg-link:hover,
.mc-ai-body:has(.chat-link-preview-host) a.chat-msg-link:hover {
  color: #1557b0 !important;
}

.chat-link-preview--loading,
.chat-link-preview--fallback {
  font-size: 12px;
}

.chat-link-preview-loading--google {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border-color, #e4e4e4);
  color: var(--text-secondary, #667781);
}

.chat-link-preview-card--google {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border-color, #e4e4e4);
  background: #ffffff;
  text-decoration: none !important;
  color: inherit !important;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.08));
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-link-preview-card--google:hover {
  border-color: #1a73e8;
  box-shadow: var(--shadow-md, 0 2px 8px rgba(0, 0, 0, 0.1));
}

/* Link preview thumbnail: fixed 320×240 (scales down on narrow chat via max-width) */
.chat-link-preview-card--google .chat-link-preview-img-wrap {
  position: relative;
  width: 320px;
  max-width: 100%;
  height: 240px;
  overflow: hidden;
  background: #f0f2f5;
  flex-shrink: 0;
  line-height: 0;
  box-sizing: border-box;
}

.chat-link-preview-card--google .chat-link-preview-img-wrap img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
}

.chat-link-preview-card--google .chat-link-preview-body {
  margin: 0;
  padding: 12px 14px 14px;
  min-width: 0;
  background: #ffffff;
  border-top: none;
}

.chat-link-preview-card--google:has(.chat-link-preview-img-wrap) .chat-link-preview-body {
  border-top: 1px solid var(--border-color, #e4e4e4);
}

.chat-link-preview-card--google .chat-link-preview-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary, #111b21);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* og:description — extra context like Google link previews (multi-line snippet) */
.chat-link-preview-card--google .chat-link-preview-desc {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: #5f6368;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.chat-link-preview-card--google .chat-link-preview-site {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
  color: var(--text-secondary, #667781);
  display: block;
}

.chat-link-preview-card--google:has(.chat-link-preview-desc) .chat-link-preview-site {
  margin-top: 6px;
}

.chat-link-preview-card--google.chat-link-preview-card--minimal .chat-link-preview-body {
  border-top: none;
}

.chat-link-preview-card--google.chat-link-preview-card--minimal .chat-link-preview-title {
  word-break: break-all;
  -webkit-line-clamp: unset;
  display: block;
}

/* Day/Date Separator */
.message.daytimemsg {
  align-self: center;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin: 16px 0;
  max-width: auto;
  width: auto;
  float: none;
}

/* Input Area */
.subCont2.onchat,
.subCont2 {
  background: var(--bg-white);
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
  align-items: center;
  gap: 8px;
  width: 100%;
  position: relative;
  flex-shrink: 0;
  bottom: auto;
  border-radius: 0;
  margin-top: 0;
  min-height: 60px;
}

.subCont2Child {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  width: 100%;
  gap: 8px;
  padding: 4px 0;
  margin-top: 0;
  position: relative;
}

.subCont2Child:has(> .replysection[style*="display: block"]) {
  flex-wrap: wrap;
  align-items: flex-end;
}

.subCont2Child:has(> .replysection[style*="display: block"]) > .chat-input-wrapper,
.subCont2Child:has(> .replysection[style*="display: block"]) > .chat-composer-stack {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
}


.chatInputField:focus,
#myMsg:focus {
  border-color: var(--primary-color);
}

.chatInputField:empty::before,
#myMsg:empty::before {
  content: attr(placeholder);
  color: var(--text-secondary);
  pointer-events: none;
}


/* Attachments */
.attachments {
  position: relative;
  margin-right: 8px;
}

.attachments .plus {
  width: 24px;
  height: 24px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.attachments .plus:hover {
  opacity: 1;
}

.optionschat {
  font-size: 15px;
  color: var(--text-primary);
}

/* Reply Section — sits above the composer, matching the rounded input */
.subCont2Child > .replysection,
.replysection,
#chatPopup .replysection,
#chatDock .replysection {
  position: relative;
  order: -1;
  flex: 1 1 100%;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  margin: 0 0 2px;
  padding: 8px 10px 8px 12px;
  display: none;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  background: var(--hover-bg, #f5f6f6);
  border: 1px solid var(--border-color, #e4e4e4);
  border-left: 3px solid var(--primary-color, #0084ff);
  border-radius: 16px;
  box-shadow: none;
  z-index: 3;
}

.subCont2Child > .replysection[style*="display: block"],
.replysection[style*="display: block"],
#chatPopup .replysection[style*="display: block"],
#chatDock .replysection[style*="display: block"] {
  display: flex !important;
}

.replysection .content,
#chatPopup .replysection .content,
#chatDock .replysection .content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: 0;
  color: var(--text-secondary, #667781);
}

.replysection .content > div,
#chatPopup .replysection .content > div,
#chatDock .replysection .content > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  vertical-align: middle;
}

.replysection .content > div.contentitems,
#chatPopup .replysection .content > div.contentitems,
#chatDock .replysection .content > div.contentitems {
  flex: 0 0 auto;
  order: 1;
}

.replysection .contentitems:empty {
  display: none;
}

.replysection .contentname,
.replysection .content div span.contentname {
  display: block;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--primary-color, #0084ff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replysection .contenttype,
.replysection .content div span.contenttype {
  display: block;
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-secondary, #667781);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replysection .contenttype i {
  margin-right: 4px;
  font-size: 12px;
  opacity: 0.85;
}

.replysection img,
.replysection .contentitems img {
  width: 36px;
  height: 36px;
  min-width: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: #fff;
  display: block;
}

.replysection .fa-times,
#chatPopup .replysection .fa-times,
#chatDock .replysection .fa-times {
  position: relative;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  color: var(--text-secondary, #667781);
  cursor: pointer;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.replysection .fa-times:hover,
.replysection .fa-times:focus {
  background: rgba(17, 27, 33, 0.08);
  color: var(--text-primary, #111b21);
}

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.statusdot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.greendot {
  background-color: #34a853;
}

.yellowdot {
  background-color: #fbbc04;
}

.reddot {
  background-color: #ea4335;
}

.graydot {
  background-color: #9aa0a6;
}

/* Chat header presence (Online / Away / Last seen) */
.chat-header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
  margin-left: 10px;
  margin-right: 8px;
  gap: 3px;
}
.chat-header-text #msgName {
  margin: 0;
  line-height: 1.2;
  font-size: 16px;
  font-weight: 600;
  color: #101828;
}
.chat-peer-presence {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: #667085;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-peer-presence[hidden] {
  display: none !important;
}
.chat-peer-presence-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
  background: #98a2b3;
}
.chat-peer-presence-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-peer-presence.is-online {
  color: #027a48;
  background: transparent;
  border: none;
}
.chat-peer-presence.is-online .chat-peer-presence-dot {
  background: #12b76a;
  animation: chatPresencePulse 2.2s ease-in-out infinite;
}
.chat-peer-presence.is-away {
  color: #b54708;
  background: transparent;
  border: none;
}
.chat-peer-presence.is-away .chat-peer-presence-dot {
  background: #f79009;
}
.chat-peer-presence.is-busy {
  color: #b42318;
  background: transparent;
  border: none;
}
.chat-peer-presence.is-busy .chat-peer-presence-dot {
  background: #f04438;
}
.chat-peer-presence.is-offline {
  color: #667085;
  background: transparent;
  border: none;
  padding: 0;
}
.chat-peer-presence.is-typing {
  color: #175cd3;
  background: transparent;
  border: none;
  font-style: normal;
}
.chat-peer-presence.is-typing .chat-peer-presence-dot {
  background: #2e90fa;
  animation: chatPresencePulse 1.2s ease-in-out infinite;
}
.chat-peer-presence.is-in-call {
  color: #027a48;
  background: transparent;
  border: none;
}
.chat-peer-presence.is-in-call .chat-peer-presence-dot {
  background: #12b76a;
  animation: chatPresencePulse 1.6s ease-in-out infinite;
}

@keyframes chatPresencePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.85);
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-peer-presence.is-online .chat-peer-presence-dot,
  .chat-peer-presence.is-typing .chat-peer-presence-dot,
  .chat-peer-presence.is-in-call .chat-peer-presence-dot {
    animation: none;
  }
}

/* Search */
.searchdiv {
  padding: 8px 16px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
}

.searchdiv input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: none;
  border-radius: 24px;
  background: var(--hover-bg);
  font-size: 14px;
  outline: none;
}

.searchdiv input:focus {
  background: var(--bg-white);
  box-shadow: 0 0 0 1px var(--border-color);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* No Conversation Selected */
.noconselecteddiv {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Image Messages */
.innermsg.image img,
.innermsg.video video {
  max-width: 100%;
  border-radius: 4px;
  display: block;
}

/* Message Action Buttons Bar - Below Message */
.message-actions {
  display: flex;
  align-items: center;
  justify-content: center;
    gap: 18px;
    margin-top: 8px;
    margin-bottom: 4px;
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.2s 
ease;
    position: relative;
    z-index: 2;
    clear: both;
}

.message:hover .message-actions, .message:hover .add-reaction {
  opacity: 1;
}

/* Center message-actions for both left and right messages */
.message.left .message-actions,
.message.right .message-actions {
  justify-content: center;
}

/* Add extra spacing when reactions are present - using class-based approach for better compatibility */
.message .innermsg .reactions:not(:empty) ~ * {
  margin-top: 4px;
}

/* Action Buttons (Reply, Delete, Copy) */
.message-action-btn {
  width: 32px;
  height: 32px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
}

.message-action-btn:hover {
  background: var(--hover-bg);
  transform: scale(1.1);
}

.message-action-btn i {
  font-size: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}

/* Options Menu - Keep for backward compatibility but hide by default */
.options {
  display: none;
}

.options_inner {
  display: none;
}

/* Chat Heading */
.chatheading {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
  margin: 0;
}

/* Back Button Mobile */
.backChatButtonMobile {
  display: none !important; /* hidden on mobile for now */
}

.backChatButtonMobile:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Toggle Button */
.toggle-btn {
  display: none;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST APPROACH
   ============================================ */

/* Large Tablets and Small Desktops (1024px and below) */
@media (max-width: 1024px) {
  :root {
    --chat-sidebar-default-width: 100%;
    --chat-sidebar-default-min-width: 100%;
    --chat-sidebar-default-max-width: 100%;
    --chat-main-default-min-width: 0;
  }

  .container.chat.chat-wrapper {
    width: 100%;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    max-height: none;
  }

  .container1.sidebar,
  .container1#sidebar1 {
    min-width: 100%;
    max-width: 100%;
  }

  .container2#chatArea,
  .container2 {
    width: 100%;
  }
}

/* Tablets and Nest Hub (1024px and below) — full mobile chat shell */
@media (max-width: 1024px) {
  .container.chat.chat-wrapper {
    width: 100%;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    max-height: none;
  }

  .container1.sidebar,
  .container1#sidebar1 {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    position: fixed;
    left: -100%;
    transition: left 0.3s ease;
    z-index: 1000;
    height: 100vh;
  }

  .container1.sidebar.active {
    left: 0;
  }

  /* On mobile/tablet, force full-width drawer even if sidebar is in minimized state */
  .container1.sidebar.sidebar-minimized.active {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .container1.sidebar.sidebar-minimized.active > *:not(.sidebar-minimize-bar) {
    display: block !important;
  }

  .container2#chatArea,
  .container2 {
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  .chat-split-divider {
    display: none !important;
  }

  .message {
    max-width: 80%;
    min-width: 120px;
  }

  .userListImg {
    width: 45px;
    height: 45px;
  }

  .userListPtag {
    font-size: 15px;
  }

  .chatProfile h3 {
    font-size: 15px;
  }

  .innermsg {
    font-size: 14px;
    padding: 10px 14px;
    padding-bottom: 28px;
  }

  .message .replydiv {
    padding: 7px 9px 20px;
  }

  .message .replydiv .reply {
    font-size: 14px;
  }

  .subCont2,
  .subCont2.onchat {
    padding: 6px 10px;
    min-height: 56px;
  }

  .subCont2Child > .replysection,
  .replysection {
    padding: 7px 8px 7px 10px;
    border-radius: 14px;
    gap: 6px;
  }

  .chatInputField,
  #myMsg {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
  }

  .message-actions {
    gap: 6px;
    padding: 3px 6px;
  }

  .add-reaction,
  .message-action-btn {
    width: 28px;
    height: 28px;
  }

  .add-reaction i,
  .add-reaction svg {
    font-size: 14px;
  }

  .message-action-btn i {
    font-size: 12px;
  }
}

/* Mobile Devices (480px and below) */
@media (max-width: 480px) {
  .submenu{
    width: 100%;
  }
  .Chatmodal-content{
    width: 100%;
  }
  .Chatmodal-body{
    height: 530px ;
  }
  .Chatmodal, .groupmodal{
    padding-top: 30px;
  }
  .container.chat.chat-wrapper {
    width: 100%;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    height: auto;
    max-height: none;
  }

  .container1.sidebar,
  .container1#sidebar1 {
    width: 100%;
  }

  .container2#chatArea,
  .container2 {
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
  }

  .message {
    max-width: 85%;
    min-width: 100px;
  }

  .innermsg {
    font-size: 13.5px;
    padding: 8px 12px;
    padding-bottom: 26px;
  }

  .userListChat {
    padding: 10px 12px;
  }

  .userListImg {
    width: 42px;
    height: 42px;
    margin-right: 10px;
  }

  .userListPtag {
    font-size: 14px;
  }

  .chatProfile {
    padding: 8px 12px;
    min-height: 76px;
  }

  .chatProfile img {
    width: 36px;
    height: 36px;
    margin-right: 10px;
  }

  .chatProfile h3 {
    font-size: 14px;
  }

  .subCont1,
  #subCont1 {
    padding: 16px 12px;
  }

  .subCont2,
  .subCont2.onchat {
    padding: 6px 8px;
    min-height: 52px;
  }

  .subCont2Child {
    gap: 6px;
    padding: 3px 0;
  }

  .subCont2Child > .replysection,
  .replysection {
    padding: 6px 8px 6px 10px;
    border-radius: 14px;
    margin-bottom: 0;
  }

  .replysection .contentname,
  .replysection .content div span.contentname {
    font-size: 12.5px;
  }

  .replysection .contenttype,
  .replysection .content div span.contenttype {
    font-size: 12px;
  }

  .replysection img,
  .replysection .contentitems img {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 7px;
  }

  .replysection .fa-times,
  #chatPopup .replysection .fa-times,
  #chatDock .replysection .fa-times {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .chatInputField,
  #myMsg {
    min-height: 47px;
    max-height: 110px;
    padding: 6px 12px;
    font-size: 14px;
  }
  .subCont2Child .emoji-container {
    top: 50%;
    transform: translateY(-50%);
  }
  .chatInputField:empty::before, #myMsg:empty::before{
    margin-left: 38px;
  }
  .chat .attachments{
    top: 24px;
    left: 10px;
  }
  .subCont2Child span[onclick="sendMessage()"],
  .subCont2Child > span:last-child {
    width: 36px;
    position: relative;
    height: 36px;
  }

  .subCont2Child .sendIcon {
    position:absolute;
    top: 2px;
    width: 26px;
    height: 27px;
  }

  .message-actions {
    gap: 4px;
    padding: 2px 4px;
    margin-top: 8px;
  }

  .add-reaction,
  .message-action-btn {
    width: 26px;
    height: 26px;
  }

  .add-reaction i,
  .add-reaction svg {
    font-size: 13px;
  }

  .message-action-btn i {
    font-size: 11px;
  }

  .reactions {
    bottom: 3px;
    right: 6px;
    gap: 3px;
    max-width: calc(100% - 50px);
  }

  .reaction {
    font-size: 11px;
    padding: 1px 6px;
  }

  .sendername,
  .message .timespan {
    font-size: 10px;
    bottom: 3px;
    right: 6px;
  }

  .attachments .plus {
    width: 20px;
    height: 20px;
  }

  #attachPlus {
    bottom: 50px;
    min-width: 180px;
    padding: 6px;
  }

  .image-upload {
    padding: 10px 12px;
    gap: 10px;
  }

  .image-upload img {
    width: 20px;
    height: 20px;
  }

  .optionschat {
    font-size: 13px;
  }

  .ThreeBtn {
    padding: 8px 10px;
    font-size: 13px;
  }

  .ThreeBtn .primaryIcons {
    width: 18px;
  }

  .right-container-menu {
    padding: 6px;
    gap: 3px;
  }

  .submenu {
    padding: 6px;
  }

  .searchdiv {
    padding: 6px 12px;
  }

  .searchdiv input {
    padding: 8px 14px 8px 36px;
    font-size: 13px;
  }

  .chatheading {
    padding: 10px 12px;
    font-size: 13px;
  }

  .backChatButtonMobile {
    width: 36px;
    height: 36px;
    top: 10px;
    left: 10px;
  }

  /* Emojies container adjustments for mobile */
  .subCont2Child .emojies-container,
  .subCont2Child .emoji-container .emojies-container {
    width: 100%;
    max-width: calc(100vw - 16px);
    max-height: 250px;
  }

  .container.chat .message.left .emojies-container,
  .container.chat .message.right .emojies-container {
    width: 100%;
    max-width: calc(100vw - 16px);
    max-height: 250px;
  }

  .container.chat .emojies-container {
    width: 100%;
    max-width: calc(100vw - 16px);
    max-height: 250px;
  }

  /* Reaction picker adjustments */
  .message .reaction-picker {
    min-width: 180px;
    padding: 8px;
    gap: 8px;
  }

  .reaction-picker span {
    font-size: 18px;
  }
}

/* Very Small Mobile Devices (360px and below) */
@media (max-width: 360px) {
  .Chatmodal-content{
    width: 100%;
  }
  .message {
    max-width: 90%;
    min-width: 80px;
  }

  .innermsg {
    font-size: 13px;
    padding: 6px 10px;
    padding-bottom: 24px;
  }

  .userListChat {
    padding: 8px 10px;
  }

  .userListImg {
    width: 38px;
    height: 38px;
    margin-right: 8px;
  }

  .userListPtag {
    font-size: 13px;
  }

  .chatProfile {
    padding: 6px 10px;
    min-height: 52px;
  }

  .chatProfile img {
    width: 32px;
    height: 32px;
    margin-right: 8px;
  }

  .chatProfile h3 {
    font-size: 13px;
  }

  .subCont1,
  #subCont1 {
    padding: 12px 10px;
  }

  .subCont2,
  .subCont2.onchat {
    padding: 5px 6px;
    min-height: 48px;
  }

  .chatInputField,
  #myMsg {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
  }

  .subCont2Child span[onclick="sendMessage()"],
  .subCont2Child > span:last-child {
    width: 32px;
    height: 32px;
  }

  .message-actions {
    gap: 3px;
    padding: 2px;
  }

  .add-reaction,
  .message-action-btn {
    width: 24px;
    height: 24px;
  }

  .add-reaction i,
  .add-reaction svg {
    font-size: 12px;
  }

  .message-action-btn i {
    font-size: 10px;
  }
  .sendSpan{
    position: relative;
  }
  .sendIcon{
    position: absolute;
    top: 10px;
    right: 2px;
  }
}

/* Landscape Orientation on Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .container.chat.chat-wrapper {
    height: 100vh;
  }

  .subCont1,
  #subCont1 {
    padding: 12px;
  }

  .subCont2,
  .subCont2.onchat {
    min-height: 48px;
    padding: 4px 8px;
  }

  .chatInputField,
  #myMsg {
    min-height: 32px;
  }
}

/* ===== Tablet / Nest Hub: use full mobile chat shell (do not keep desktop split) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Intentionally empty — mobile shell rules above (max-width: 1024px) own this range. */
}

/* ===== Low-height viewports (≤ 540px tall) — keep sidebar-minimize-bar always in view ===== */
@media (max-height: 540px) {
  .container.chat.chat-wrapper {
    height: 100dvh;
    overflow: hidden;
  }

  .container1.sidebar,
  .container1#sidebar1 {
    height: 100dvh;
    overflow-y: auto;
  }

  .sidebar-minimize-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
    flex-shrink: 0;
  }

  .container2#chatArea,
  .container2 {
    height: 100dvh;
    overflow-y: auto;
  }

  .toggle-btn {
    top: 4px;
    left: 4px;
    width: 36px;
    height: 36px;
  }
}

/* ===== Prevent horizontal overflow ===== */
.container.chat.chat-wrapper,
.container1.sidebar,
.container2 {
  max-width: 100%;
  box-sizing: border-box;
}

/* Toggle Button for Mobile / Tablet */
@media (max-width: 1024px) {
  .toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    touch-action: manipulation;
  }

  .toggle-btn .sidebar-minimize-icon {
    width: 35px;
    display: block;
    object-fit: contain;
  }
}

/* Touch-friendly targets for mobile / tablet */
@media (max-width: 1024px) {
  .userListChat,
  .message-action-btn,
  .add-reaction,
  .ThreeBtn,
  .image-upload {
    min-height: 44px;
    min-width: 44px;
  }
#chatArea{
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
}
  /* Better scrolling on mobile */
  .subCont1,
  #subCont1 {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  #chatFriends,
  #recentConversation {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* Prevent text size adjustment on iOS */
@media (max-width: 768px) {
  .chatInputField,
  #myMsg {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
}

/* Group Info */
.groupinfocontainer {
  background: var(--bg-white);
  border-left: 1px solid var(--border-color);
}

/* Caption */
.captionImg {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-primary);
  padding: 0 4px;
}

/* From Name (Group Chats) */
.fromname {
  display: block;
  color: var(--primary-color);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
  text-transform: capitalize;
}

/* 1:1 chat — header shows the peer; hide name above each bubble */
#subCont1:not(.is-group-chat) .fromname {
  display: none !important;
}

/* Unread Dot - Hidden by default, shown when new message arrives */
.unreaddot {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: #ff6d00;
  border-radius: 50%;
  display: none; /* Hidden by default */
}



/* Video Preview */
#videoPreview {
  max-width: 100%;
  border-radius: 8px;
}

/* Image Preview */
.previewImage {
  max-width: 100%;
  border-radius: 8px;
}

/* Loading States */
.loaderchat {
  display: block;
  margin: 20px auto;
}

.none {
  display: none;
}

/* --- Chat filters (All / MYCT AI) --- */
.chat-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 27px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-color);
}
.chat-filter-btn {
  flex: 1;
  border: 1px solid #e2e5eb;
  background: #f7f9fb;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chat-filter-btn:hover {
  background: #eff3f9;
}
.chat-filter-btn.active {
  background: #e8f3ff;
  color: var(--primary-color);
  border-color: #c6defb;
  box-shadow: 0 2px 6px rgba(11, 125, 220, 0.15);
}

/* Mobile-only category pills — hidden on desktop */
.chat-filter-bar.chat-filter-bar--mobile {
  display: none;
}

.dealchief-mobile-brand {
  display: none;
}

.mobile-list-section-header {
  display: none;
}

#sidebar1.container1.sidebar .myct-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Hide legacy submenus for chat/call */
.submenu.chat,
.submenu.call {
  display: none !important;
}

/* --- Call actions grid --- */
.call-actions-grid {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(14px, 2vw, 24px);
  background: var(--bg-chat);
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}
.call-actions-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 18px;
  width: 100%;
  max-width: min(960px, 100%);
  margin: 0 auto;
  min-width: 0;
  align-content: start;
}
.call-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
  min-height: clamp(160px, 24vh, 240px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  overflow: hidden;
}
.call-card:hover {
  border-color: #c6defb;
  box-shadow: 0 6px 14px rgba(11, 125, 220, 0.15);
  transform: translateY(-2px);
}
.call-card-icon,
.call-card-title {
  min-width: 0;
  max-width: 100%;
}
.call-card-icon img {
  width: clamp(56px, 7vw, 72px);
  height: clamp(56px, 7vw, 72px);
  object-fit: contain;
  margin-bottom: 0;
}
.call-card-title {
  font-size: clamp(14px, 1vw, 16px);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .chat-filter-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .chat-filter-btn {
    font-size: 13px;
    padding: 9px 10px;
  }
  body:not(.call-mobile-tab-open) .call-actions-grid {
    padding: 14px;
  }
  body:not(.call-mobile-tab-open) .call-actions-grid-inner {
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 14px;
  }
  body:not(.call-mobile-tab-open) .call-card {
    padding: 16px 12px;
    min-height: 160px;
  }
  body:not(.call-mobile-tab-open) .call-card-icon img {
    width: 56px;
    height: 56px;
  }
}

@media (max-width: 560px) {
  body:not(.call-mobile-tab-open) .call-actions-grid-inner {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   Master Chief AI — Message Card Styles
   ===================================================================== */

/* Outer bubble */
.message.mc-ai-message {
  max-width: 88% !important;
  width: auto !important;
  float: left;
  clear: both;
  margin: 8px 0 8px 4px;
}

/* Inner card */
.mc-ai-innermsg {
  background: #f0f7ff !important;
  border: 1.5px solid #aed6f1 !important;
  border-left: 4px solid #2E86C1 !important;
  border-radius: 0 12px 12px 12px !important;
  padding: 10px 14px 8px !important;
  min-width: 200px;
  max-width: 100%;
  display: block !important;
  box-shadow: 0 1px 4px rgba(46,134,193,0.10);
}

/* Header row: avatar + name + badge */
.mc-ai-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #aed6f1;
}
.mc-ai-avatar {
  font-size: 18px;
  line-height: 1;
}
.mc-ai-name {
  font-weight: 700;
  font-size: 13px;
  color: #1a5276;
}
.mc-ai-badge {
  display: inline-block;
  background: #2E86C1;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.mc-ai-replay-btn {
  margin-left: auto;
  border: 1px solid #aed6f1;
  background: #ffffff;
  color: #1a5276;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.mc-ai-replay-btn:hover {
  background: #eaf4ff;
}

/* Markdown body */
.mc-ai-body {
  font-size: 14px;
  line-height: 1.6;
  color: #1c2833;
  word-break: break-word;
}

/* Headings inside AI reply */
.mc-ai-body .mc-ai-h2 {
  font-size: 15px;
  font-weight: 700;
  color: #154360;
  margin: 10px 0 4px;
}
.mc-ai-body .mc-ai-h3 {
  font-size: 14px;
  font-weight: 700;
  color: #1a5276;
  margin: 8px 0 3px;
  border-bottom: 1px solid #aed6f1;
  padding-bottom: 2px;
}
.mc-ai-body .mc-ai-h4 {
  font-size: 13px;
  font-weight: 700;
  color: #2471a3;
  margin: 6px 0 2px;
}

/* Paragraphs */
.mc-ai-body .mc-ai-p {
  margin: 3px 0;
}

/* Spacer between paragraphs */
.mc-ai-body .mc-ai-spacer {
  height: 6px;
}

/* Lists */
.mc-ai-body .mc-ai-ul,
.mc-ai-body .mc-ai-ol {
  margin: 4px 0 4px 20px;
  padding: 0;
}
.mc-ai-body .mc-ai-ul li,
.mc-ai-body .mc-ai-ol li {
  margin: 2px 0;
}

/* Horizontal rule */
.mc-ai-body .mc-ai-hr {
  border: none;
  border-top: 1px solid #aed6f1;
  margin: 8px 0;
}

/* Images inside AI response */
.mc-ai-body .mc-ai-img-block {
  margin: 8px 0;
}
.mc-ai-body .mc-ai-img,
.mc-ai-body .mc-ai-img-link img {
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 8px;
  border: 1px solid #aed6f1;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
}
.mc-ai-body .mc-ai-img:hover,
.mc-ai-body .mc-ai-img-link img:hover {
  opacity: 0.88;
}
.mc-ai-body .mc-ai-img-link {
  display: inline-block;
}
.mc-ai-body .mc-ai-img-err {
  color: #c0392b;
  font-size: 12px;
}
/* Regular hyperlinks inside AI response */
.mc-ai-body .mc-ai-link {
  color: #2E86C1;
  text-decoration: underline;
  word-break: break-all;
}

/* Timestamp */
.mc-ai-innermsg .mc-ai-time,
span.sendername.mc-ai-time {
  display: block !important;
  position: static !important;
  float: right;
  text-align: right;
  font-size: 11px !important;
  color: #7fb3d3 !important;
  margin-top: 6px;
  margin-bottom: 0;
  width: 100%;
}

/* ═══════════════════════════════════════════════════
   Sidebar Sections — Collapsible, with colored dots
   ═══════════════════════════════════════════════════ */
.sidebar-section {
  background: var(--bg-white);
  border-bottom: 1px solid #eef0f4;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.sidebar-section-header:hover {
  background: #f8f9fa;
}

/* Colored dots */
.sidebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-dot--ai       { background: #4285f4; }
.sidebar-dot--friends  { background: #4285f4; }
.sidebar-dot--business { background: #4285f4; }

/* Section title */
.sidebar-section-title {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Action link on the right of a section header (e.g. Create Group) */
.sidebar-section-action {
  flex-shrink: 0;
  margin-left: auto;
  margin-right: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1a73e8;
  text-decoration: none;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1;
}

.sidebar-section-action:hover {
  color: #174ea6;
  text-decoration: underline;
}

/* Collapse arrow */
.sidebar-collapse-arrow {
  font-size: 10px;
  color: #9aa0a6;
  transition: transform 0.25s ease;
  line-height: 1;
}

.sidebar-collapse-arrow.collapsed {
  transform: rotate(180deg);
}

/* Section body (collapsible) */
.sidebar-section-body {
  overflow: visible;
  transition: max-height 0.3s ease;
}

.sidebar-section-body.collapsed {
  max-height: 0 !important;
  overflow: hidden;
}

/* "Show all" link at bottom of section */
.sidebar-show-all {
  padding: 8px 16px 12px;
  text-align: left;
  cursor: pointer;
}

.sidebar-show-all span {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-color);
  transition: color 0.15s ease;
}

.sidebar-show-all:hover span {
  color: var(--primary-dark);
}

/* ═══════════════════════════════════════════════════
   MasterChief Pinned Card (inside AI section)
   ═══════════════════════════════════════════════════ */
.mc-pinned-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 0 10px 8px;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, #ede7f6 0%, #e8eaf6 50%, #fce4ec 100%);
  transition: box-shadow 0.2s ease, background 0.2s ease;
  position: relative;
}

.mc-pinned-card:hover {
  box-shadow: 0 2px 8px rgba(103, 58, 183, 0.15);
  background: linear-gradient(135deg, #e1d5f0 0%, #dde0f5 50%, #fbd8e6 100%);
}

/* Avatar wrapper with online dot */
.mc-pinned-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.mc-pinned-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  border: none;
  box-shadow: none;
}

.mc-pinned-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34a853;
  border: 2px solid #ede7f6;
}

/* Text body */
.mc-pinned-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.mc-pinned-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-pinned-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI Badge (inline in name) */
.mc-pinned-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4285f4 0%, #a259ff 100%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1;
  vertical-align: middle;
}

/* "Now" timestamp on MC card */
.mc-pinned-time {
  font-size: 11px;
  color: #9aa0a6;
  flex-shrink: 0;
  white-space: nowrap;
  margin-right: 6px;
}

/* Status dot on right side of MC card */
.mc-pinned-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ea4335;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   AI Recent Chats — Sidebar Section Items
   ═══════════════════════════════════════════════════ */
#sidebarAiRecentList {
  padding: 0;
}

.ai-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: var(--bg-white);
}

.ai-sidebar-item:hover {
  background: #f5f5f5;
}

.ai-sidebar-item:active {
  background: #ebebeb;
}

.ai-sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa0a6;
  font-size: 15px;
}

.ai-sidebar-icon svg {
  width: 16px;
  height: 16px;
  fill: #9aa0a6;
}

.ai-sidebar-title {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════
   Inline Groups Section
   ═══════════════════════════════════════════════════ */
#inlineGroupList {
  max-height: 27vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

#inlineGroupList::-webkit-scrollbar {
  width: 4px;
}

#inlineGroupList::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

/* Full Groups Tab */
#grouplist {
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#grouplist::-webkit-scrollbar {
  width: 4px;
}

#grouplist::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

/* Old section labels — hide if still present */
.sidebar-section-label {
  display: none;
}

.sidebar-section-count {
  display: none;
}

/* ═══════════════════════════════════════════════════
   Override myct.css sidebar-section-title inside headers
   ═══════════════════════════════════════════════════ */
.sidebar-section-header .sidebar-section-title,
.sidebar-section-header .sidebar-section-title--plain {
  margin-bottom: 0 !important;
  padding: 0 !important;
  flex: 1;
}

/* ═══════════════════════════════════════════════════
   Top Tab Bar — sidebar-top-tabs
   ═══════════════════════════════════════════════════ */
.right-container-menu.sidebar-top-tabs {
  display: flex;
  background: #fff;
  padding: 0;
  border-bottom: 1px solid #e9ecef;
  gap: 0;
  margin: 0;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px 8px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 11px;
  font-weight: 500;
  color: #5f6368;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn .primaryIcons {
  width: 20px;
  margin: 0;
  filter: grayscale(0.4) opacity(0.7);
  transition: filter 0.2s;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn:hover {
  color: #1da1ff;
  background: #f5f8ff;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn:hover .primaryIcons {
  filter: none;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn.activetabb {
  color: #1da1ff;
  border-bottom: 2px solid #1da1ff;
  background: transparent;
  font-weight: 600;
}

.right-container-menu.sidebar-top-tabs .ThreeBtn.activetabb .primaryIcons {
  filter: none;
}

/* ═══════════════════════════════════════════════════
   New Chat & Search Action Rows
   ═══════════════════════════════════════════════════ */
.sidebar-action-rows {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
}

.sidebar-action-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f1f3f6;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}

.sidebar-action-row:last-child {
  border-bottom: none;
}

.sidebar-action-row:hover {
  background: #f5f8ff;
}

.sidebar-action-icon {
  /* width: 20px;
  height: 20px; */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  flex-shrink: 0;
  gap: 13px;
}
.sidebar-action-icon  img {
  width: 20px;
  height: 20px;
}

.sidebar-action-label {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
}

#contactActionsHeader .sidebar-action-icon img {
  width: 32px;
  height: 32px;
}

.contact-action-row-with-qr {
  position: relative;
}

.sidebar-action-qr {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.sidebar-action-qr:hover {
  background: #e8eaed;
}

/* ═══════════════════════════════════════════════════
   Section Header — plain (no dot, for Freindschat / Business Chat / AI Recent)
   ═══════════════════════════════════════════════════ */
.sidebar-section-header--label {
  cursor: default;
  padding: 10px 16px 6px;
}

.sidebar-section-header--label:hover {
  background: transparent;
}

.sidebar-section-title--plain {
  flex: 1;
  font-size: 11px;
  font-weight: 700;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ═══════════════════════════════════════════════════
   Show All Recent link
   ═══════════════════════════════════════════════════ */
.sidebar-show-all {
  padding: 7px 16px 10px;
  text-align: left;
  cursor: pointer;
}

.sidebar-show-all span {
  font-size: 12px;
  font-weight: 500;
  color: #1da1ff;
  transition: color 0.15s;
}

.sidebar-show-all:hover span {
  color: #0077cc;
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════
   AI Recent Chats Sidebar Items (colored icon style)
   ═══════════════════════════════════════════════════ */
.ai-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border: none;
  background: #fff;
  width: 100%;
  position: relative;
}

.ai-sidebar-item:hover {
  background: #f5f5f5;
}

.ai-sidebar-item:hover .ai-sidebar-more {
  opacity: 1;
}

.ai-sidebar-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.ai-sidebar-icon-box.color-red    { background: #fff0f0; }
.ai-sidebar-icon-box.color-blue   { background: #f0f4ff; }
.ai-sidebar-icon-box.color-green  { background: #f0fff4; }
.ai-sidebar-icon-box.color-orange { background: #fff8f0; }
.ai-sidebar-icon-box.color-purple { background: #f8f0ff; }
.ai-sidebar-icon-box.color-teal   { background: #f0fffe; }

.ai-sidebar-text {
  flex: 1;
  min-width: 0;
}

.ai-sidebar-title {
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  display: block;
}

.ai-sidebar-more {
  opacity: 0;
  color: #9aa0a6;
  padding: 2px 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.ai-sidebar-more-icon {
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
}

/* AI sidebar loading placeholder */
.ai-sidebar-loading {
  padding: 12px 16px;
  font-size: 12px;
  color: #9aa0a6;
  text-align: center;
}

/* ═══════════════════════════════════════════════════
   AI RECENT CHATS section — keep v.right-container-menu.sidebar-top-tabs .ThreeBtn .primaryIconsisible in default chat mode
   ═══════════════════════════════════════════════════ */
#aiRecentChatsSection {
  display: block;
}

#sidebarAiRecentList {
  max-height: 17vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
}

#sidebarAiRecentList::-webkit-scrollbar { width: 4px; }
#sidebarAiRecentList::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
}

/* Master Chief card — remove right-side dot */
.mc-pinned-status-dot {
  display: none;
}

/* Section without dot marker for plain sections */
.sidebar-section-header:not(.sidebar-section-header--label) .sidebar-dot {
  display: none;
}

/* ═══════════════════════════════════════════════════
   Sidebar Minimize / Expand Toggle Bar
   ═══════════════════════════════════════════════════ */
.sidebar-minimize-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 5px 8px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
  margin-left: 14px;
}

.sidebar-minimize-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
  transition: background 0.2s, color 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.sidebar-minimize-btn:hover {
  background: none;
  color: #1da1ff;
}

.sidebar-minimize-icon {
  width: 35px;
  display: block;
  object-fit: contain;
}

/* ── Minimized sidebar state ── */
.container1.sidebar.sidebar-minimized {
  width: var(--sidebar-collapsed-width) !important;
  min-width: var(--sidebar-collapsed-width) !important;
  max-width: var(--sidebar-collapsed-width) !important;
  overflow: hidden;
}

/* Keep icon fully visible and centered in collapsed sidebar */
.container1.sidebar.sidebar-minimized .sidebar-minimize-bar {
  justify-content: center;
  padding: 6px 0;
  margin-left: 0;
}

.container1.sidebar.sidebar-minimized .sidebar-minimize-btn {
  width: 36px;
  height: 36px;
  margin: 0 auto;
}

/* Hide everything inside the sidebar except the minimize bar */
.container1.sidebar.sidebar-minimized > *:not(.sidebar-minimize-bar) {
  display: none !important;
}

/* ═══════════════════════════════════════════════════
   AI Sidebar chat item — ··· context menu (fixed overlay)
   ═══════════════════════════════════════════════════ */

/* Always-visible ··· for accordion list rows (no parent :hover needed) */
.ai-recent-item .ai-sidebar-more,
.ai-recent-item .ai-recent-more {
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  color: #5f6368;
  border-radius: 4px;
}
.ai-recent-item:hover .ai-sidebar-more,
.ai-recent-item:hover .ai-recent-more {
  opacity: 1;
}

/* Fixed-position overlay — appended to <body>, never clipped */
#aiChatContextMenu {
  display: none;
  position: fixed;
  min-width: 140px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  overflow: hidden;
}

/* Individual menu action */
.ai-sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: #333;
  transition: background 0.15s;
  white-space: nowrap;
}

.ai-sidebar-menu-item:hover {
  background: #f5f5f5;
}

/* Rename action */
.ai-sidebar-menu-rename {
  color: #1a73e8;
}

.ai-sidebar-menu-rename:hover {
  background: #e8f0fe;
  color: #1557b0;
}

.ai-sidebar-menu-rename svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* Divider between menu actions */
.ai-sidebar-menu-item + .ai-sidebar-menu-item {
  border-top: 1px solid #f0f0f0;
}

/* Delete action — red tint */
.ai-sidebar-menu-delete {
  color: #d32f2f;
}

.ai-sidebar-menu-delete:hover {
  background: #ffeaea;
  color: #b71c1c;
}

.ai-sidebar-menu-delete svg {
  flex-shrink: 0;
  stroke: currentColor;
}

/* ═══════════════════════════════════════════════════
   Invite Friends Panel
   ═══════════════════════════════════════════════════ */
.invite-friends-panel {
  width: 100%;
  height: 100%;
  background: #f8f9fb;
  z-index: 15;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.invite-friends-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 36px;
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.invite-friends-back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #1a73e8;
  padding: 4px;
  display: flex;
  align-items: center;
}

.invite-friends-back:hover {
  color: #1557b0;
}

.invite-friends-title {
  font-size: 22px;
  font-weight: 700;
  color: #202124;
  letter-spacing: -0.3px;
}

.invite-friends-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 32px;
  gap: 18px;
}

.invite-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #fff;
  border: 1px solid #e0e4ea;
  border-radius: 14px;
  padding: 22px 28px;
  cursor: pointer;
  transition: box-shadow 0.18s, border-color 0.18s;
  width: 100%;
  max-width: 520px;
}

.invite-card:hover {
  border-color: #c4cdd5;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.invite-card-icon {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #f4f6fb;
}

.invite-card-icon img {
  width: 45px;
  height: 45px;
}

.invite-card-icon--email {
  background: #fef3f2;
}

.invite-card-content {
  flex: 1;
  min-width: 0;
}

.invite-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  margin-bottom: 6px;
}

.invite-card-subtitle {
  font-size: 13px;
  color: #80868b;
  line-height: 1.4;
}

.invite-card-link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  background: #f0f6ff;
  border: 1.5px solid #d2e3fc;
  border-radius: 10px;
  padding: 8px 14px;
  max-width: 260px;
}

.invite-card-link-text {
  font-size: 13px;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-weight: 500;
}

.invite-card-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #1a73e8;
  font-size: 16px;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.invite-card-copy-btn:hover {
  color: #1557b0;
}

.invite-social-section {
  margin-top: 12px;
  /* width: 100%; */
  max-width: 520px;
}

.invite-social-heading {
  font-size: 16px;
  font-weight: 700;
  color: #202124;
  margin-bottom: 18px;
}

.invite-social-icons {
  display: flex;
  gap: 18px;
}

.invite-social-btn {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid #e0e4ea;
  background: #fff;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  padding: 0;
}

.invite-social-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  border-color: #c4cdd5;
}

.invite-social-btn i {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
}

.invite-social--whatsapp i {
  background: #25d366;
}

.invite-social--messenger i {
  background: linear-gradient(135deg, #00b2ff, #006aff);
}

.invite-social--twitter i {
  background: #000;
}

.invite-social--telegram i {
  background: #0088cc;
}

/* ── Inline rename input inside ai-recent-item ── */
.ai-rename-input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  background: #fff;
  border: 1px solid #1a73e8;
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
  width: 100%;
  line-height: 1.4;
}

/* ==========================================================
   MYCT MOBILE CHAT SHELL (ported from DealChief reference)
   ========================================================== */
:root {
  --chat-mobile-toolbar-height: 56px;
  --chat-mobile-content-gap: 10px;
  --chat-mobile-shell-top: calc(
    var(--chat-mobile-toolbar-height) + var(--chat-mobile-content-gap)
  );
}

/* Dedicated chat page mobile toolbar (profile | search | actions) */
.chat-mobile-toolbar {
  display: none;
}

@media (max-width: 1024px) {
  body:has(.container.chat.chat-wrapper) .mobile-header {
    display: none !important;
  }

  body:has(.container.chat.chat-wrapper) #chat-mobile-toolbar.chat-mobile-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 120;
    min-height: var(--chat-mobile-toolbar-height);
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e8edf2;
    box-sizing: border-box;
  }

  .chat-mobile-toolbar__profile {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
  }

  .chat-mobile-toolbar__profile img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }

  .chat-mobile-toolbar__search {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
  }

  .chat-mobile-toolbar__search .header-search-container {
    width: 100%;
    margin: 0;
  }

  .chat-mobile-toolbar__search .header-search {
    width: 100%;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 8px 12px 8px 36px;
    font-size: 14px;
    box-sizing: border-box;
  }

  .chat-mobile-toolbar__search .search-image {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    margin: 0;
    pointer-events: none;
  }

  .chat-mobile-toolbar__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 2px;
  }

  .chat-mobile-toolbar__action {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 40px;
    text-decoration: none;
    color: #4b5563;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    border: none;
    background: none;
    padding: 0 2px;
    cursor: pointer;
  }

  .chat-mobile-toolbar__action img {
    width: 26px;
    height: 26px;
    object-fit: contain;
  }

  html.myct-chat-standalone body:has(.container.chat.chat-wrapper) #chat-mobile-toolbar.chat-mobile-toolbar {
    display: flex !important;
  }

  /* Chat page: legacy mobile-header rules (fallback if toolbar missing) */
  body:has(.container.chat.chat-wrapper):not(:has(#chat-mobile-toolbar)) .mobile-header {
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px !important;
    min-height: 56px;
    background: #fff;
    border-bottom: 1px solid #e8edf2;
    box-sizing: border-box;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_:first-child,
  body:has(.container.chat.chat-wrapper) .mobile-header .row_:last-child {
    display: contents;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .user {
    order: 1;
    display: inline-block !important;
    flex: 0 0 44px;
    width: 44px !important;
    margin: 0 !important;
    vertical-align: middle;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .user img {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50%;
    object-fit: cover;
    display: block;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-search {
    order: 2;
    display: block !important;
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
    margin: 0 !important;
    position: relative;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-search .header-search-container {
    width: 100%;
    margin: 0;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-search .header-search {
    width: 100%;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 8px 12px 8px 36px;
    font-size: 14px;
    box-sizing: border-box;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-search .search-image {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    margin: 0;
    pointer-events: none;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links {
    order: 3;
    display: flex !important;
    align-items: center;
    gap: 4px;
    width: auto !important;
    margin: 0 !important;
    flex: 0 0 auto;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .create-post {
    display: none !important;
  }
  .mobile-header .chat-mobile-header-link--chat-only,
  .mobile-header .chat-mobile-header-coupons-label {
    display: none;
  }

  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .chat-mobile-header-link,
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .chat-mobile-header-coupons {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 44px;
    text-decoration: none;
    color: #4b5563;
    font-size: 9px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    border: none;
    background: none;
    padding: 0 2px;
    cursor: pointer;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .chat-mobile-header-link img {
    width: 28px;
    height: 28px;
    margin: 0;
    object-fit: contain;
    transform: none;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .chat-mobile-header-coupons-label {
    display: block !important;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-links .chat-mobile-header-coupons .coupons {
    transform: none;
  }
  body:has(.container.chat.chat-wrapper) .mobile-header .row_ .col-zip,
  body:has(.container.chat.chat-wrapper) .mobile-header .hamburger-btn,
  body:has(.container.chat.chat-wrapper) .mobile-header .mobile-menu-container {
    display: none !important;
  }

  html body .container.chat.chat-wrapper {
    position: fixed !important;
    top: var(--chat-mobile-shell-top) !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100dvh - var(--chat-mobile-shell-top)) !important;
    max-height: calc(100dvh - var(--chat-mobile-shell-top)) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 50 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  html body .container.chat.chat-wrapper.chat-wrapper--conversation-open {
    flex-direction: column !important;
  }

  html body .container.chat.chat-wrapper #sidebar1.container1.sidebar {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-right: none !important;
    margin: 0 !important;
    box-shadow: none !important;
    z-index: 2 !important;
    background: #f3f4f6 !important;
  }

  /* Hide empty right pane until a conversation / call surface is active.
     Skip meeting embed (chat_internal iframe is ~360px wide so this mobile
     breakpoint always matches there — hiding #chatArea caused a blank white panel). */
  html body:not(.chat-internal-page):not(.chat-embedded) .container.chat.chat-wrapper #chatArea.container2:not(.ai-chat-area-active):not(.friend-chat-area-active):not(.call-tab-area-active) {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html body .container.chat.chat-wrapper .comingsoondiv {
    display: none !important;
  }

  html body .container.chat.chat-wrapper #sidebar1.container1.sidebar .myct-sidebar-scroll {
    display: flex !important;
    flex-direction: column !important;
    background: #f3f4f6 !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-bottom: 76px !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html body .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active,
  html body .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active,
  html body .container.chat.chat-wrapper #chatArea.container2.friend-chat-area-active,
  html body .container.chat.chat-wrapper .container2#chatArea.friend-chat-area-active,
  html body .container.chat.chat-wrapper #chatArea.container2.call-tab-area-active,
  html body .container.chat.chat-wrapper .container2#chatArea.call-tab-area-active {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    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;
    max-height: 100% !important;
    z-index: 10 !important;
    overflow: hidden !important;
  }

  html body.friend-mobile-conversation-open .container.chat.chat-wrapper #chatArea.container2.friend-chat-area-active,
  html body.friend-mobile-conversation-open .container.chat.chat-wrapper .container2#chatArea.friend-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
  }

  html body .container.chat.chat-wrapper .right-container-menu.sidebar-top-tabs {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    z-index: 9999 !important;
    background: #fff !important;
    border-top: 1px solid #e8edf2 !important;
    border-bottom: none !important;
  }

  .dealchief-mobile-brand {
    order: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 12px 6px;
    background: #f3f4f6;
  }

  .dealchief-mobile-wordmark {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    user-select: none;
  }

  .dealchief-mobile-wordmark-deal {
    color: #0f172a;
  }

  .dealchief-mobile-wordmark-chief {
    color: #0ea5e9;
  }

  /* Desktop accordions are not used on mobile — filter pills + RECENT list only */
  #sidebar1 #ai-accordion-panels {
    display: none !important;
  }

  html body .container.chat.chat-wrapper #chatArea.container2.call-tab-area-active,
  html body .container.chat.chat-wrapper .container2#chatArea.call-tab-area-active {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
  }

  /* Call tab: hide chat filter pills and sidebar lists — show call panel only */
  body.call-mobile-tab-open .chat-filter-bar.chat-filter-bar--mobile,
  body.call-mobile-tab-open #masterchiefPinned,
  body.call-mobile-tab-open #mobileAiRecentHeader,
  body.call-mobile-tab-open #recentConversation,
  body.call-mobile-tab-open #recentChatLabel,
  body.call-mobile-tab-open #inlineGroupsSection,
  body.call-mobile-tab-open #sidebar1 .myct-sidebar-scroll {
    display: none !important;
  }

  body.call-mobile-tab-open .container.chat.chat-wrapper #sidebar1.container1.sidebar {
    display: flex !important;
    visibility: visible !important;
  }

  /* ── Mobile Call tab layout (reference: action row + recent calls) ── */
  body.call-mobile-tab-open #chatSplitDivider {
    display: none !important;
  }

  body.call-mobile-tab-open .mobile-call-tab-header {
    display: flex !important;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 8px 12px 6px;
    background: #fff;
    border-bottom: 1px solid #eef1f4;
  }

  body.call-mobile-tab-open .mobile-call-tab-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #0b7ddc;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 auto;
  }

  body.call-mobile-tab-open .mobile-call-tab-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
  }

  body.call-mobile-tab-open #callActionsGrid.call-actions-grid,
  body.call-mobile-tab-open #callActionsGrid,
  body.call-mobile-tab-open #mobileCallActionsGrid.call-actions-grid,
  body.call-mobile-tab-open #mobileCallActionsGrid {
    display: block !important;
    flex: 0 0 auto;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 8px 8px !important;
    background: #f3f6fa !important;
    border-bottom: 1px solid #e6ebf2 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-actions-grid-inner,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-actions-grid-inner {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 0 2px 2px !important;
    max-width: 100% !important;
    justify-content: space-between !important;
    -webkit-overflow-scrolling: touch !important;
    grid-template-columns: unset !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-card,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-card {
    flex: 1 1 0 !important;
    min-width: 60px !important;
    max-width: 84px !important;
    min-height: unset !important;
    padding: 6px 2px 8px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 12px !important;
    text-align: center !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-card:hover,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-card:hover {
    background: rgba(11, 125, 220, 0.06) !important;
    transform: none !important;
    box-shadow: none !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-card-icon,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-card-icon {
    width: 46px !important;
    height: 46px !important;
    margin: 0 auto 6px !important;
    border-radius: 50% !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-card-icon img,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-card-icon img {
    width: 26px !important;
    height: 26px !important;
    margin: 0 !important;
    object-fit: contain !important;
  }

  body.call-mobile-tab-open #callActionsGrid .call-card-title,
  body.call-mobile-tab-open #mobileCallActionsGrid .call-card-title {
    font-size: 10.5px !important;
    line-height: 1.15 !important;
    font-weight: 600 !important;
    color: #4b5563 !important;
    word-break: break-word !important;
  }

  body.call-mobile-tab-open #callHistorySection.call-history-section,
  body.call-mobile-tab-open #callHistorySection {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    padding: 0 8px 76px !important;
    background: #fff !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  body.call-mobile-tab-open #callHistorySection .call-history-section-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 8px 8px !important;
    flex: 0 0 auto !important;
  }

  body.call-mobile-tab-open #callHistorySection .chatheading.callHead {
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    color: #1f2937 !important;
    text-transform: none !important;
    margin: 0 !important;
  }

  body.call-mobile-tab-open #callHistorySection .call-history-clear-all-btn {
    display: none !important;
  }

  body.call-mobile-tab-open #callHistoryList.call-history-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-top: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding-right: 2px !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
  }

  body.call-mobile-tab-open #callHistoryList.call-history-list::-webkit-scrollbar {
    width: 4px;
  }

  body.call-mobile-tab-open #callHistoryList.call-history-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 4px;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-item {
    padding: 8px !important;
    margin-bottom: 0 !important;
    background: transparent !important;
    border-bottom: 1px solid #f1f3f6 !important;
    border-radius: 0 !important;
    gap: 8px !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    grid-template-columns: unset !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-status {
    display: none !important;
    order: 0 !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 3px 8px !important;
    min-width: 0 !important;
    border-radius: 999px !important;
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-transform: capitalize !important;
    white-space: nowrap !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-status.missed {
    background: #fee2e2 !important;
    color: #dc2626 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-status.in-progress,
  body.call-mobile-tab-open #callHistoryList .call-history-status.ongoing {
    background: #fef3c7 !important;
    color: #d97706 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-avatar {
    position: relative !important;
    align-self: center !important;
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    flex: 0 0 38px !important;
    font-size: 16px !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-avatar::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #34a853;
    border: 2px solid #fff;
    box-sizing: border-box;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-info {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-details {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    font-size: 12px !important;
    color: #9ca3af !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-headline {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-time {
    margin-left: auto !important;
    margin-top: 0 !important;
    font-size: 12px !important;
    color: #b0b5bd !important;
    flex: 0 0 auto !important;
    align-self: center !important;
    text-align: right !important;
    white-space: nowrap !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-actions,
  body.call-mobile-tab-open #callHistoryList .call-history-item .call-btn,
  body.call-mobile-tab-open #callHistoryList .call-history-clear-btn {
    display: none !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-status.completed {
    background: #dcfce7 !important;
    color: #16a34a !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-item:last-child {
    border-bottom: none !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-item:hover {
    background: #f7f9fc !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-item-skeleton {
    pointer-events: none;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-item-skeleton:hover {
    background: transparent !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-skeleton-avatar {
    width: 44px !important;
    height: 44px !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-skeleton-status {
    order: 0 !important;
    margin: 4px 6px 0 0 !important;
  }

  body.call-mobile-tab-open #callHistoryList .call-history-skeleton-btn {
    order: 4 !important;
    margin-left: auto !important;
  }

  .chat-filter-bar.chat-filter-bar--mobile {
    order: 1;
    display: flex !important;
    padding: 6px 10px 8px !important;
    gap: 7px !important;
    background: #f3f4f6 !important;
    border-bottom: none !important;
    position: static !important;
  }

  .chat-filter-bar.chat-filter-bar--mobile .chat-filter-btn {
    border-radius: 999px !important;
    border: 1px solid #d9dce2 !important;
    background: #f7f8fa !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #8a8f98 !important;
    line-height: 1 !important;
  }

  .chat-filter-bar.chat-filter-bar--mobile .chat-filter-btn.active {
    background: #edf7ff !important;
    border-color: #8bc9ff !important;
    color: #38a8ff !important;
    box-shadow: none !important;
  }

  #masterchiefPinned {
    order: 2;
    background: #f3f4f6 !important;
    border-bottom: none !important;
  }

  #masterchiefPinned .sidebar-section-header.sidebar-section-header--label {
    display: none !important;
  }

  #mobileAiRecentHeader {
    order: 3;
    display: none;
    padding: 6px 12px 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #b8bcc4;
    background: #f3f4f6;
  }

  #mobileAiRecentHeader:not(.hidden) {
    display: block !important;
  }

  #recentConversation { order: 4; }
  #recentChatLabel { order: 4; border-top: none !important; }
  #inlineGroupsSection { order: 4; border-top: none !important; }

  #body-friends-chat,
  #body-business-chat,
  #recentConversation {
    min-height: 170px;
  }

  #chatFriends,
  #inlineGroupList,
  #recentConversation {
    min-height: 150px;
  }

  #friends-empty-state,
  #groups-empty-state {
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px 14px;
    text-align: center;
  }

  body.mobile-more-open .chat-filter-bar.chat-filter-bar--mobile,
  body.mobile-more-open .dealchief-mobile-brand {
    display: none !important;
  }

  body.mobile-more-open #chatSearchBar {
    display: none !important;
  }

  .mc-pinned-card {
    margin: 0 12px 8px !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    border: 2px solid #8fd4ff !important;
    background: #f8fcff !important;
    box-shadow: none !important;
    gap: 10px !important;
  }

  .mc-pinned-avatar {
    width: 50px !important;
    height: 50px !important;
  }

  .mc-pinned-name {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: #5d6168 !important;
    line-height: 1.05 !important;
  }

  .mc-pinned-sub {
    font-size: 14px !important;
    color: #b0b4bb !important;
    line-height: 1.15 !important;
  }

  .mc-pinned-badge,
  .mc-pinned-time {
    display: none !important;
  }

  #recentChatLabel .sidebar-section-header,
  #inlineGroupsSection .sidebar-section-header {
    padding: 6px 12px 4px !important;
    background: #f3f4f6 !important;
    border: none !important;
    cursor: default !important;
  }

  #recentChatLabel .sidebar-collapse-arrow,
  #inlineGroupsSection .sidebar-collapse-arrow {
    display: none !important;
  }

  #recentChatLabel .sidebar-section-title--plain {
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
  }

  #recentChatLabel .sidebar-section-title--plain::after {
    content: "FRIENDS CHATS";
    font-size: 12px !important;
    line-height: 1.2 !important;
    letter-spacing: 0.06em !important;
    color: #b8bcc4 !important;
    text-transform: uppercase;
    font-weight: 600 !important;
  }

  #inlineGroupsSection .sidebar-section-title--plain {
    font-size: 12px !important;
    letter-spacing: 0.06em !important;
    color: #b8bcc4 !important;
    text-transform: uppercase;
    font-weight: 600 !important;
  }

  .userListChat,
  .ai-sidebar-item {
    padding: 10px 12px !important;
    border-bottom: none !important;
  }

  .userListImg {
    width: 35px !important;
    height: 35px !important;
    margin-right: 10px !important;
  }

  .userListPtag,
  .ai-sidebar-title {
    font-size: 16px !important;
    color: #4f545d !important;
    font-weight: 500 !important;
  }

  .right-container-menu.sidebar-top-tabs .ThreeBtn {
    gap: 2px !important;
    padding: 7px 4px calc(6px + env(safe-area-inset-bottom, 0px)) !important;
    border-bottom: none !important;
    color: #8f949c !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    background: #fff !important;
  }

  .right-container-menu.sidebar-top-tabs .ThreeBtn.activetabb {
    color: #3cadff !important;
    font-weight: 600 !important;
  }

  #chatFriends,
  #recentConversation,
  #inlineGroupList,
  #grouplist {
    max-height: none !important;
    height: auto !important;
  }

  #body-friends-chat,
  #body-business-chat {
    min-height: 44vh;
  }

  html body.ai-mobile-conversation-open .container.chat.chat-wrapper #sidebar1.container1.sidebar,
  html body.friend-mobile-conversation-open .container.chat.chat-wrapper #sidebar1.container1.sidebar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  html body.ai-mobile-conversation-open .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active,
  html body.ai-mobile-conversation-open .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    z-index: 10 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.ai-mobile-conversation-open .AIChatBox.ai-panel-open,
  body.ai-mobile-conversation-open .AIChatBox:not(.none) {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: 100% !important;
    z-index: 1 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .container.chat.chat-wrapper > .toggle-btn {
    display: none !important;
  }

  .chat-mobile-home-btn {
    display: none !important;
  }

  /* ── Friends chat conversation (reference layout) ── */
  .backChatButtonMobile.mobile-visible {
    display: flex !important;
    position: absolute;
    left: 10px;
    top: 10px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eef3f7;
    color: #374151;
    z-index: 10002;
    border: none;
    cursor: pointer;
  }

  html body.friend-mobile-conversation-open .container.chat.chat-wrapper #chatArea.container2.friend-chat-area-active,
  html body.friend-mobile-conversation-open .container.chat.chat-wrapper .container2#chatArea.friend-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    z-index: 10 !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat {
    /* display: flex !important; */
    flex: 0 0 auto;
    order: 1;
    width: 100%;
    min-height: 56px;
    padding: 8px 12px 8px 48px;
    border-bottom: 1px solid #e8edf2;
    background: #fff;
    position: relative;
    z-index: 2;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat > div {
    width: 100%;
    margin-top: 0 !important;
    align-items: center !important;
    gap: 8px;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat #userListImg {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    object-fit: cover;
    flex: 0 0 40px;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat .chat-header-text {
    flex: 1 1 auto;
    min-width: 0;
    margin-left: 10px;
    margin-right: 4px;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat #msgName {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 17px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat .chat-peer-presence {
    font-size: 11px;
    width: fit-content;
    max-width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    gap: 5px;
  }
  body.friend-mobile-conversation-open .chatProfile.onchat .chat-peer-presence-dot {
    width: 6px;
    height: 6px;
    flex-basis: 6px;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat #msgName a {
    display: none;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat #chatCallButtons {
    display: flex !important;
    align-items: center;
    gap: 4px;
    margin-left: auto !important;
    flex: 0 0 auto;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat .call-btn {
    width: 34px;
    height: 34px;
    background: transparent;
  }

  body.friend-mobile-conversation-open .chatProfile.onchat .masterchief-toggle {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
  }

  /* Call details mode in mobile: keep header clean and title aligned */
  body.call-history-details-open.friend-mobile-conversation-open .chatProfile.onchat #chatCallButtons {
    display: none !important;
  }

  body.call-history-details-open.friend-mobile-conversation-open .chatProfile.onchat .masterchief-toggle {
    display: none !important;
  }

  body.call-history-details-open.friend-mobile-conversation-open .chatProfile.onchat {
    padding-right: 12px !important;
    min-height: 54px !important;
  }

  body.call-history-details-open.friend-mobile-conversation-open .chatProfile.onchat #msgName {
    font-size: 18px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.friend-mobile-conversation-open #subCont1.subCont1,
  body.friend-mobile-conversation-open #subCont1 {
    /* display: flex !important; */
    /* flex-direction: column !important; */
    flex: 1 1 auto !important;
    order: 2;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 12px 10px 8px !important;
  
    background-size: 18px 18px !important;
    background-position: 0 0 !important;
  }
  body.call-history-details-open .call-details-inline,
  body.call-history-details-open .call-info-panel {
    padding: 10px 10px 14px !important;
  }

  body.friend-mobile-conversation-open #subCont1 img.noconselected {
    display: none !important;
  }

  body.friend-mobile-conversation-open .subCont2.onchat {
    display: block !important;
    position: relative !important;
    bottom: auto !important;
    order: 3;
    flex: 0 0 auto;
    width: 100% !important;
    border-radius: 0 !important;
    border-top: 1px solid #e8edf2;
    background: #fff !important;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 58px;
  }

  body.friend-mobile-conversation-open .subCont2Child {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px 6px !important;
    min-height: 44px;
  }

  body.friend-mobile-conversation-open .subCont2Child:has(> .replysection[style*="display: block"]) {
    border-radius: 22px;
    padding: 8px 8px 4px !important;
    align-items: stretch;
  }

  body.friend-mobile-conversation-open .subCont2Child > .replysection {
    margin: 0 2px 4px;
    border-radius: 14px;
  }

  body.friend-mobile-conversation-open .subCont2Child .attachments .plus {
    width: 28px;
    height: 28px;
  }

  body.friend-mobile-conversation-open .message.right .innermsg,
  body.friend-mobile-conversation-open .right .innermsg,
  body.friend-mobile-conversation-open .message.right .replydiv,
  body.friend-mobile-conversation-open .right .replydiv {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    border-top-right-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  }

  body.friend-mobile-conversation-open .message.left .innermsg,
  body.friend-mobile-conversation-open .left .innermsg,
  body.friend-mobile-conversation-open .message.left .replydiv,
  body.friend-mobile-conversation-open .left .replydiv {
    background: #fff !important;
    border: 1px solid #ececec !important;
    border-radius: 12px !important;
    border-top-left-radius: 4px !important;
  }

  /* AI panel must fill chat area when active */
  body.ai-mobile-conversation-open .AIChatBox.ai-panel-open,
  body.ai-mobile-conversation-open .AIChatBox:not(.none) {
    display: flex !important;
    flex-direction: column !important;
  }

  body.ai-mobile-conversation-open .AIChatBox.ai-panel-open > main,
  body.ai-mobile-conversation-open .AIChatBox:not(.none) > main {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
}

/* Desktop: AI panel fills the right chat pane (same as friend chat container) */
@media (min-width: 1025px) {
  html body .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active,
  html body .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: auto !important;
    flex: 1 1 auto !important;
    min-width: var(--chat-main-default-min-width, 360px) !important;
    height: 92vh !important;
    max-height: 100vh !important;
    z-index: 1 !important;
    overflow: hidden !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  html body .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active .AIChatBox.ai-panel-open,
  html body .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active .AIChatBox.ai-panel-open,
  html body .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active .AIChatBox:not(.none),
  html body .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active .AIChatBox:not(.none) {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
  }

  html body .container.chat.chat-wrapper #chatArea.container2.ai-chat-area-active > *:not(.AIChatBox),
  html body .container.chat.chat-wrapper .container2#chatArea.ai-chat-area-active > *:not(.AIChatBox) {
    display: none !important;
  }
}

/* ==========================================================================
   Chat history loading (WhatsApp-like)
   Bubbles stay hidden while MAM pages stream in, so the thread is revealed
   once - already scrolled to the newest message - instead of flickering.
   ========================================================================== */
#subCont1.chat-history-loading {
  overflow-y: hidden;
}

#subCont1.chat-history-loading .message {
  opacity: 0 !important;
  animation: none !important;
}

#subCont1.chat-history-revealed .message {
  animation: chatHistoryReveal 0.3s ease-out both;
}

@keyframes chatHistoryReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-history-skeleton {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
  margin-top: auto;
}

.chat-skel-row {
  display: flex;
  width: 100%;
}

.chat-skel-row.right {
  justify-content: flex-end;
}

.chat-skel-bubble {
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(
    100deg,
    rgba(0, 0, 0, 0.045) 20%,
    rgba(0, 0, 0, 0.085) 40%,
    rgba(0, 0, 0, 0.045) 60%
  );
  background-size: 300% 100%;
  animation: chatSkelShimmer 1.25s ease-in-out infinite;
}

.chat-skel-bubble.w1 { width: 34%; }
.chat-skel-bubble.w2 { width: 44%; }
.chat-skel-bubble.w3 { width: 55%; }
.chat-skel-bubble.w4 { width: 62%; height: 58px; }

@keyframes chatSkelShimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #subCont1.chat-history-revealed .message {
    animation: none;
  }

  .chat-skel-bubble {
    animation: none;
  }
}

/* Profile links: friend header, group member, and group sender name */
.chatProfile.chat-person-open #userListImg,
.chatProfile.chat-person-open #msgName,
.grpmemberdiv .userImages,
.grpmemberdiv .memImg,
#subCont1.is-group-chat .message .fromname:not(:empty) {
  cursor: pointer;
}
