/* Avatars stay independent; every account badge sits after its displayed name. */
.chat-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 32px; height: 32px; vertical-align: middle; }
.chat-avatar > .message-avatar,
.chat-avatar > .profile-avatar-action,
.chat-avatar > .room-profile-avatar-action { display: block; width: 32px; height: 32px; min-width: 32px; margin: 0; }
.chat-avatar .profile-avatar-action,
.room-profile-avatar-action { padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.chat-avatar .message-avatar { display: block; width: 32px; height: 32px; object-fit: cover; }
.chat-identity-name { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.chat-identity-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-identity-name > .chat-identity-text { flex: 0 1 auto; }
.chat-identity-name > .social-badge,
.chat-name-badge { display: inline-flex; flex: 0 0 auto; align-items: center; margin: 0; line-height: 1; }
.chat-name-badge:empty { display: none; }
.chat-identity-name .social-badge.social-badge-image { display: inline-flex; position: static; width: auto; height: 22px; margin: 0; padding: 0; transform: none; opacity: 1; }
.chat-identity-name .social-badge .social-badge-art { display: block; width: auto; height: 22px; max-width: 70px; max-height: 22px; object-fit: contain; border-radius: 0; }
.chat-identity-name .hall-badge { flex: 0 0 auto; margin: 0; white-space: nowrap; }

/* A scroll container must never compress rows below their message content. */
.messages > .message-row { flex: 0 0 auto; min-width: 0; }
.message-stack { display: flex; flex-direction: column; align-items: flex-start; flex: 0 1 auto; min-width: 0; max-width: 100%; }
.message-row.mine > .message-stack { align-items: flex-end; }
.message-stack > .message-meta { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; row-gap: 2px; max-width: 100%; margin: 0 0 5px; opacity: 1; color: #7b8798; font-size: 12px; line-height: 1.5; }
.message-row.mine > .message-stack > .message-meta { justify-content: flex-end; }
.message-author { min-height: 22px; color: #58677b; }
.message-author > strong { font-weight: 500; }
.message-time { flex: 0 0 auto; white-space: nowrap; font-size: 10px; color: #96a0af; }
.message-stack > .message-bubble { min-width: 0; max-width: 100%; box-sizing: border-box; }
.message-text { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; white-space: pre-wrap; }
.message-bubble .chat-image, .message-bubble .chat-video { max-width: 100%; }
.message-bubble .file-link { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.message-bubble .message-toolbox { max-width: 100%; flex-wrap: wrap; }
body.theme-dark .message-author { color: #bec9d7; }
body.theme-dark .message-time { color: #8996a9; }

.room-item .room-list-identity { display: flex; flex: 1 1 auto; gap: 10px; align-items: center; min-width: 0; max-width: 100%; overflow: hidden; }
.room-item .room-list-identity span { margin-top: 0; opacity: 1; }
.room-item .room-list-identity .room-list-avatar { display: inline-flex; }
.room-item .room-list-name { display: flex; flex: 1 1 auto; min-width: 0; }
.room-item .room-list-name .chat-identity-text { font-size: 14px; }
.room-item .room-list-name .social-badge, .room-item .room-list-name .hall-badge { display: inline-flex; }
.room-list-avatar > img { display: block; width: 32px; height: 32px; object-fit: cover; border-radius: 50%; }
.conv-name.chat-identity-name { overflow: hidden; }
.conv-name .chat-identity-text { font-size: 16px; }
.conv-row1 { align-items: center; }
.conv-name .social-badge .social-badge-art, .room-list-name .social-badge .social-badge-art { height: 19px; max-height: 19px; max-width: 60px; }
.active-room-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.active-room-heading > div { min-width: 0; }
.active-room-avatar { width: 40px; height: 40px; }
.active-room-avatar > img { width: 40px; height: 40px; object-fit: cover; border-radius: 50%; }
.phone-body .active-room-avatar { width: 34px; height: 34px; margin-right: 5px; }
.phone-body .active-room-avatar > img { width: 34px; height: 34px; }
.chat-title-wrap > .chat-identity-name { justify-content: center; }
.chat-title-wrap .chat-identity-text { flex: 0 1 auto; }
.me-avatar-wrap { width: 60px; height: 60px; }
.me-avatar-wrap > .me-avatar { display: block; width: 60px; height: 60px; margin: 0; object-fit: cover; }
.me-info { flex: 1; min-width: 0; }
.admin-identity { min-width: 0; }
.service-avatar-wrap { width: 44px; height: 44px; margin-right: 5px; }
.service-avatar-wrap > .room-profile-avatar-action { width: 44px; height: 44px; min-width: 44px; }
.service-avatar-wrap .service-avatar { display: block; width: 44px; height: 44px; margin: 0; object-fit: cover; }
.chat-header > .service-heading { flex: 1; min-width: 0; }
.chat-header .chat-identity-name h1 { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#visitorMomentsButton { flex: 0 0 auto; max-width: 98px; padding: 8px 10px; font-size: 12px; }
.room-profile-avatar-action:focus-visible { outline: 3px solid #74b5a5; outline-offset: 3px; }
.room-service-profile-mask { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .45); z-index: 1100; }
.room-service-profile-mask[hidden] { display: none !important; }
.room-service-profile-card { width: min(100%, 400px); max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 22px; padding: 24px; background: #fff; color: #253447; box-shadow: 0 18px 70px #0f172a35; }
.room-service-profile-top { display: flex; align-items: center; gap: 15px; padding-bottom: 24px; }
.room-service-profile-avatar { width: 60px; height: 60px; }
.room-service-profile-avatar > img { width: 60px; height: 60px; border-radius: 16px; object-fit: cover; }
.room-service-profile-identity { min-width: 0; flex: 1; }
.room-service-profile-name { margin: 0; font-size: 21px; line-height: 1.45; }
.room-service-profile-label { margin: 5px 0 0; color: #8491a3; font-size: 12px; }
.room-service-profile-details { margin: 0; }
.room-service-profile-details > div { padding: 15px 0; border-top: 1px solid #edf1f5; }
.room-service-profile-details dt { color: #8693a5; font-size: 12px; margin-bottom: 7px; }
.room-service-profile-details dd { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.room-service-profile-empty { font-size: 13px; line-height: 1.7; color: #8a96a7; }
.room-service-profile-actions { display: flex; gap: 10px; margin-top: 20px; }
.room-service-profile-actions > button { flex: 1; min-height: 42px; }
@media (max-width: 600px) {
  .room-service-profile-mask { padding: 16px; }
  .room-service-profile-card { padding: 22px; }
  .message-row { gap: 8px; }
  .message-author .social-badge .social-badge-art { height: 20px; max-height: 20px; max-width: 66px; }
  .conv-name .social-badge .social-badge-art { max-width: 52px; }
}
