/* =========================================================
   Sync Chat
   ========================================================= */

/* ---------- Message list tabs ---------- */

#messagesTab .message-tabs {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0;
}

#messagesTab .message-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  border-radius: 999px;
  background: transparent;
  color: #4f5a77;
  font-weight: 700;
}

#messagesTab .message-tabs button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

#messagesTab .message-tabs span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

/* ---------- Conversation list ---------- */

#messagesTab .conversation-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 3px;
}

#messagesTab .conversation-list::-webkit-scrollbar,
#messagesTab .chat-body::-webkit-scrollbar {
  width: 6px;
}

#messagesTab .conversation-list::-webkit-scrollbar-thumb,
#messagesTab .chat-body::-webkit-scrollbar-thumb {
  background: #d9dcf1;
  border-radius: 999px;
}

#messagesTab .conversation {
  position: relative;
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 17px;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  overflow: hidden;
}

#messagesTab .conversation:hover,
#messagesTab .conversation.active {
  background: #f4f1ff;
}

#messagesTab .conversation > img {
  width: 52px;
  height: 52px;
  min-width: 52px;
  max-width: 52px;
  min-height: 52px;
  max-height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#messagesTab .conversation > div {
  min-width: 0;
}

#messagesTab .conversation-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#messagesTab .conversation-top strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .conversation-top small {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 13px;
}

#messagesTab .conversation p {
  max-width: 175px;
  margin-top: 5px;
  overflow: hidden;
  color: #64708d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .unread-count {
  position: absolute;
  right: 12px;
  bottom: 18px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

/* ---------- Chat panel ---------- */

#messagesTab .chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #ffffff;
}

#messagesTab .chat-header {
  height: 82px;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  flex: 0 0 auto;
}

#messagesTab .chat-user {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#messagesTab .back-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  color: #64708d;
  background: transparent;
}

#messagesTab .back-button:hover {
  background: #f4f5fb;
}

#messagesTab .avatar-stack {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

#messagesTab .avatar-stack img {
  width: 43px;
  height: 43px;
  min-width: 43px;
  max-width: 43px;
  min-height: 43px;
  max-height: 43px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#messagesTab .avatar-stack img + img {
  margin-left: -15px;
}

#messagesTab .chat-user h2,
#messagesTab #chatName {
  overflow: hidden;
  color: var(--text-main);
  font-size: 17px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .chat-user p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 13px;
}

#messagesTab .chat-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

#messagesTab .chat-actions button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  color: #66708f;
}

#messagesTab .chat-actions button:hover,
#messagesTab .chat-actions button.chat-details-active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Chat body / messages ---------- */

#messagesTab .chat-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 22px;
  background:
    radial-gradient(circle at 70% 18%, rgba(91, 53, 245, 0.035), transparent 26%),
    #ffffff;
}

#messagesTab .date-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 22px;
}

#messagesTab .message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
  margin-bottom: 18px;
}

#messagesTab .message-row.incoming {
  justify-content: flex-start;
}

#messagesTab .message-row.outgoing {
  justify-content: flex-end;
}

#messagesTab .message-row > img {
  width: 38px;
  height: 38px;
  min-width: 38px;
  max-width: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

#messagesTab .message-row > div {
  max-width: min(430px, 78%);
}

#messagesTab .message-bubble {
  display: block;
  width: fit-content;
  max-width: 390px;
  padding: 13px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: none;
}

#messagesTab .message-bubble p {
  margin: 0;
}

#messagesTab .message-row.incoming .message-bubble,
#messagesTab .incoming .message-bubble {
  background: #f2f4fa;
  color: #242a42;
  border-bottom-left-radius: 6px;
}

#messagesTab .message-row.outgoing .message-bubble,
#messagesTab .outgoing .message-bubble {
  margin-left: auto;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  border-bottom-right-radius: 6px;
}

#messagesTab .message-time,
#messagesTab .message-time-left {
  display: block;
  margin-top: 6px;
  color: #69738e;
  font-size: 12px;
}

#messagesTab .message-time {
  text-align: right;
}

#messagesTab .message-time-left {
  margin-left: 2px;
}

/* ---------- Image messages ---------- */

#messagesTab .image-message {
  max-width: 420px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  border-bottom-right-radius: 6px;
}

#messagesTab .image-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 95px 95px;
  gap: 4px;
}

#messagesTab .image-grid img:first-child {
  grid-row: 1 / 3;
  width: 100%;
  height: 100%;
}

#messagesTab .image-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#messagesTab .image-message p {
  padding: 12px 15px;
  font-size: 14px;
}

#messagesTab .image-time {
  color: #ece8ff;
  padding: 0 14px 12px;
}

#messagesTab .chat-message-image {
  display: block;
  width: auto;
  max-width: min(460px, 100%);
  max-height: 420px;
  object-fit: contain;
  border-radius: 18px;
  margin-bottom: 8px;
  cursor: pointer;
  background: transparent;
}

/* ---------- File attachments ---------- */

#messagesTab .chat-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  max-width: 360px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  text-decoration: none;
}

#messagesTab .message-row.incoming .chat-file-card {
  background: #f4f5fb;
  color: var(--text-main);
}

#messagesTab .chat-file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 18px;
}

#messagesTab .message-row.incoming .chat-file-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

#messagesTab .chat-file-info {
  min-width: 0;
}

#messagesTab .chat-file-info strong,
#messagesTab .chat-file-info span {
  display: block;
}

#messagesTab .chat-file-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

#messagesTab .chat-file-info span {
  margin-top: 3px;
  opacity: 0.72;
  font-size: 12px;
}

/* ---------- New message divider ---------- */

#messagesTab .new-message-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  margin: 18px 0 22px;
}

#messagesTab .new-message-divider span {
  height: 1px;
  flex: 1;
  background: #dfdafa;
}

/* ---------- Composer ---------- */

#messagesTab .message-composer {
  height: 78px;
  min-height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 0 18px;
  border-top: 1px solid var(--border);
  background: #ffffff;
  overflow: visible;
}

#messagesTab .composer-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  overflow: visible;
  z-index: 90;
}

#messagesTab .composer-actions button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #66708f;
  font-size: 20px;
  background: transparent;
}

#messagesTab .composer-actions button:hover {
  color: var(--primary);
}

#messagesTab .message-composer input,
#messagesTab #messageInput {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
}

#messagesTab .send-button {
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 12px 25px rgba(91, 53, 245, 0.25);
}

#messagesTab .send-button:hover {
  transform: translateY(-1px);
}

#messagesTab .chat-composer-hidden {
  display: none;
}

/* ---------- Loading / empty message ---------- */

#messagesTab .chat-loading-message {
  width: fit-content;
  max-width: 75%;
  margin: 20px auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: #f4f1ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

/* ---------- Emoji picker ---------- */

.emoji-picker {
  position: absolute;
  left: 0;
  bottom: 46px;
  z-index: 999;
  display: none;
  width: 292px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 22px 70px rgba(24, 20, 70, 0.18);
}

#messagesTab .message-composer > .emoji-picker {
  left: 18px;
  bottom: 68px;
}

.emoji-picker.active {
  display: block;
}

.emoji-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.emoji-picker-header strong {
  color: var(--text-main);
  font-size: 14px;
}

.emoji-picker-header button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f4f5fb;
  color: #65708f;
}

.emoji-picker-header button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.emoji-picker-grid button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: transparent;
  font-size: 19px;
  line-height: 1;
}

.emoji-picker-grid button:hover {
  background: var(--primary-soft);
}

/* ---------- Image lightbox ---------- */

.chat-image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background: rgba(8, 10, 24, 0.86);
  backdrop-filter: blur(10px);
}

.chat-image-lightbox.active {
  display: flex;
}

.chat-image-lightbox-content {
  position: relative;
  width: min(1100px, 92vw);
  height: min(820px, 86vh);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-image-lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.38);
  image-rendering: auto;
}

.chat-image-lightbox-close,
.chat-image-lightbox-nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: none;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.chat-image-lightbox-close {
  top: -8px;
  right: -8px;
  width: 44px;
  height: 44px;
  border-radius: 15px;
}

.chat-image-lightbox-nav {
  top: 50%;
  width: 48px;
  height: 56px;
  border-radius: 18px;
  transform: translateY(-50%);
}

.chat-image-lightbox-nav:hover,
.chat-image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chat-image-lightbox-prev {
  left: -64px;
}

.chat-image-lightbox-next {
  right: -64px;
}

.chat-image-lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: -38px;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0.86;
}

/* ---------- Chat details / live location ---------- */

#messagesTab .chat-details-view {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  padding: 2px;
}

#messagesTab .chat-details-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

#messagesTab .chat-details-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#messagesTab .chat-details-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
}

#messagesTab .chat-details-user-text {
  min-width: 0;
}

#messagesTab .chat-details-user-text strong {
  display: block;
  overflow: hidden;
  color: var(--text-main);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .chat-details-live-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

#messagesTab .chat-details-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#messagesTab .chat-details-close-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: #f4f5fb;
  color: #66708f;
}

#messagesTab .chat-details-close-button:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

#messagesTab .chat-details-top-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(91, 53, 245, 0.11), transparent 34%),
    #fbfbff;
}

#messagesTab .chat-details-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#messagesTab .chat-details-meta-item {
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
}

#messagesTab .chat-details-meta-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}

#messagesTab .chat-details-meta-item strong {
  display: block;
  color: var(--text-main);
  font-size: 14px;
}

#messagesTab .chat-details-address {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

#messagesTab .chat-details-address > i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
}

#messagesTab .chat-details-address strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-main);
}

#messagesTab .chat-details-address p {
  margin: 0 0 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

#messagesTab .chat-details-address small {
  color: #707996;
  font-size: 12px;
  font-weight: 700;
}

#messagesTab .chat-details-map-wrap {
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #f4f5fb;
}

#messagesTab .chat-details-map {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  display: block;
}

/* ---------- Right sidebar chat cards ---------- */

#messagesTab .right-sidebar {
  overflow-y: auto;
}

#messagesTab .todays-checklist-card,
#messagesTab .chat-calendar-card {
  margin-bottom: 18px;
}

#messagesTab .today-checklist-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

#messagesTab .today-check-item {
  width: 100%;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 15px;
  background: #fbfbff;
  color: var(--text-main);
  text-align: left;
}

#messagesTab .today-check-item:hover {
  background: var(--primary-soft);
}

#messagesTab .today-check-box {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(91, 53, 245, 0.25);
  border-radius: 10px;
  color: transparent;
  background: #ffffff;
}

#messagesTab .today-check-item.completed .today-check-box {
  background: var(--primary);
  color: #ffffff;
}

#messagesTab .today-check-content {
  min-width: 0;
}

#messagesTab .today-check-content strong,
#messagesTab .today-check-content small {
  display: block;
}

#messagesTab .today-check-content strong {
  overflow: hidden;
  margin-bottom: 3px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .today-check-content small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .empty-today-checklist {
  padding: 8px 0;
  color: var(--text-muted);
}

#messagesTab .empty-today-checklist i {
  margin-right: 7px;
  color: var(--primary);
}

#messagesTab .empty-today-checklist strong {
  display: block;
  color: var(--text-main);
  margin-bottom: 4px;
}

#messagesTab .empty-today-checklist p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Mini calendar additions ---------- */

#messagesTab .chat-calendar-card .mini-calendar {
  margin-top: 16px;
}

#messagesTab .chat-calendar-card .mini-calendar-day {
  overflow: hidden;
}

#messagesTab .chat-calendar-card .mini-calendar-day small {
  max-width: 100%;
  display: block;
  overflow: hidden;
  padding: 0 3px;
  color: inherit;
  font-size: 8px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#messagesTab .chat-calendar-card .mini-calendar-day em {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
}

#messagesTab .mini-calendar-event-list {
  display: grid;
  gap: 9px;
  margin: 10px 0 12px;
}

#messagesTab .mini-calendar-event-row {
  padding: 10px;
  border-radius: 14px;
  background: #ffffff;
}

#messagesTab .mini-calendar-event-row strong,
#messagesTab .mini-calendar-event-row span,
#messagesTab .mini-calendar-event-row p {
  display: block;
}

#messagesTab .mini-calendar-event-row strong {
  margin-bottom: 3px;
  font-size: 13px;
}

#messagesTab .mini-calendar-event-row span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

#messagesTab .mini-calendar-event-row p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- Skeleton support ---------- */

.sync-skeleton-list {
  display: grid;
  gap: 10px;
}

.sync-skeleton-conversation {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #fbfbff;
}

.sync-skeleton-conversation span,
.sync-skeleton-conversation strong,
.sync-skeleton-conversation p,
.sync-skeleton-message span,
.sync-skeleton-message p,
.sync-side-skeleton div,
.sync-profile-skeleton,
.sync-user-name-skeleton,
.sync-user-handle-skeleton {
  display: block;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #eef0f7 0%,
    #f8f8fc 45%,
    #eef0f7 100%
  );
  background-size: 220% 100%;
  animation: syncSkeletonPulse 1.15s ease-in-out infinite;
}

.sync-skeleton-conversation span {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.sync-skeleton-conversation strong {
  width: 58%;
  height: 13px;
  margin-bottom: 9px;
}

.sync-skeleton-conversation p {
  width: 82%;
  height: 11px;
  margin: 0;
}

.sync-chat-skeleton {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.sync-skeleton-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.sync-skeleton-message span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.sync-skeleton-message p {
  width: min(320px, 70%);
  height: 46px;
  border-radius: 18px;
  margin: 0;
}

.sync-skeleton-message.outgoing {
  justify-content: flex-end;
}

.sync-skeleton-message.outgoing p {
  width: min(280px, 64%);
}

.sync-side-skeleton {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.sync-side-skeleton div {
  height: 64px;
  border-radius: 18px;
}

.sync-profile-skeleton {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.sync-user-name-skeleton {
  width: 128px;
  height: 18px;
  margin-bottom: 9px;
}

.sync-user-handle-skeleton {
  width: 92px;
  height: 12px;
}

@keyframes syncSkeletonPulse {
  0% {
    background-position: 220% 0;
  }

  100% {
    background-position: -220% 0;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 820px) {
  #messagesTab .message-list-panel,
  #messagesTab .chat-panel {
    width: 100%;
    height: calc(100dvh - 62px);
    min-height: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow: hidden;
  }

  #messagesTab .chat-header {
    height: 64px;
    min-height: 64px;
    padding: 0 14px;
  }

  #messagesTab .chat-user {
    gap: 10px;
  }

  #messagesTab .avatar-stack img {
    width: 38px;
    height: 38px;
    min-width: 38px;
    max-width: 38px;
    min-height: 38px;
    max-height: 38px;
  }

  #messagesTab .chat-user h2,
  #messagesTab #chatName {
    max-width: 42vw;
    font-size: 15px;
  }

  #messagesTab .chat-actions {
    gap: 6px;
  }

  #messagesTab .chat-actions button {
    width: 32px;
    height: 32px;
  }

  #messagesTab .chat-body {
    padding: 16px 14px 18px;
  }

  #messagesTab .message-row {
    gap: 8px;
  }

  #messagesTab .message-row > div {
    max-width: 78vw;
  }

  #messagesTab .message-bubble {
    max-width: 78vw;
    padding: 10px 13px;
  }

  #messagesTab .message-composer {
    height: auto;
    min-height: 64px;
    padding: 10px 12px;
  }

  #messagesTab .composer-actions {
    gap: 8px;
  }

  #messagesTab .composer-actions button {
    width: 26px;
    height: 26px;
    font-size: 18px;
  }

  #messagesTab .send-button {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  #messagesTab .conversation-list {
    height: calc(100dvh - 170px);
    overflow-y: auto;
  }

  #messagesTab .conversation {
    min-height: 74px;
  }

  #messagesTab .conversation > img {
    width: 50px;
    height: 50px;
    min-width: 50px;
    max-width: 50px;
    min-height: 50px;
    max-height: 50px;
  }

  #messagesTab .chat-message-image {
    max-width: 76vw;
    max-height: 330px;
  }

  #messagesTab .chat-file-card {
    min-width: 0;
    max-width: 76vw;
  }

  .emoji-picker {
    left: 8px;
    right: 8px;
    bottom: 72px;
    width: auto;
  }

  .chat-image-lightbox {
    padding: 18px;
  }

  .chat-image-lightbox-prev {
    left: 8px;
  }

  .chat-image-lightbox-next {
    right: 8px;
  }

  .chat-image-lightbox-close {
    top: 8px;
    right: 8px;
  }

  #messagesTab .chat-details-view {
    padding: 14px;
  }

  #messagesTab .chat-details-meta {
    grid-template-columns: 1fr;
  }

  #messagesTab .chat-details-map-wrap,
  #messagesTab .chat-details-map {
    min-height: 300px;
  }
}