/* Shared MINI layout only; existing chat transport and permissions are retained. */
/* V1.3 & V1.4 Clean Conversation presentation. Membership never grants access here. */
body.mf-mini[data-mf-workspace="chat"]:is([data-mf-conversation-view="active"], [data-mf-room-presentation="one-to-one"]) .mf-chat-dynamic-content {
  display: flex !important; flex-direction: column !important;
}
body.mf-mini[data-mf-workspace="chat"]:is([data-mf-conversation-view="active"], [data-mf-room-presentation="one-to-one"]) .mf-chat-room-nav-header {
  flex: 0 0 auto !important; min-height: 56px; position: relative !important;
  width: 100%; min-width: 0; box-sizing: border-box;
}
body.mf-mini[data-mf-workspace="chat"]:is([data-mf-conversation-view="active"], [data-mf-room-presentation="one-to-one"]) .mf-view-messages:not([hidden]) {
  flex: 1 1 0 !important; min-height: 0 !important; min-width: 0 !important;
  height: auto !important; overflow-y: auto !important; overflow-x: hidden !important;
}
body.mf-mini[data-mf-workspace="chat"]:is([data-mf-conversation-view="active"], [data-mf-room-presentation="one-to-one"]) :is(.mf-view-services, .mf-view-friends, .mf-view-chat-hub, .mf-mini-quick-replies, .mf-chat-target-header-inline, .mf6345-presence),
body.mf-mini[data-mf-workspace="chat"][data-mf-room-presentation="unknown"]:has(.mf-private-unavailable) :is(.mf-view-services, .mf-view-friends, .mf-chat-target-header-inline) { display: none !important; }
body.mf-mini[data-mf-workspace="chat"][data-mf-room-presentation="unknown"]:has(.mf-private-unavailable) :is(.mf-view-messages, .mf-view-chat-hub, .mf-chat-bottom-controls) { display: none !important; }
.mf-private-recipient, .mf-service-room-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.mf-private-recipient b, .mf-service-room-title b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-service-room-title small { display: block; font-size: 11px; color: #64748b; white-space: nowrap; }
.mf-private-recipient img, .mf-private-avatar { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; object-fit: cover; }
.mf-private-avatar { display: grid; place-items: center; background: #edf3fa; }
.mf-private-unavailable { margin: 12px; padding: 12px; border-radius: 12px; background: #edf3fa; color: #334155; font-size: 13px; }
body.mf-mini[data-mf-workspace="chat"] .mf-chat-view-section[hidden] { display: none !important; }
body.mf-mini { --mf-mini-workspace-width: 430px; }
body.mf-mini .mf514-window {
  width: 100% !important; max-width: var(--mf-mini-workspace-width) !important;
  min-width: 0 !important; margin-inline: auto !important; box-sizing: border-box !important;
}
body.mf-mini .mf-mini-bottom-nav {
  height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  min-height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  box-sizing: border-box !important;
  position: relative !important; inset: auto !important; transform: none !important;
  width: 100% !important; max-width: var(--mf-mini-workspace-width) !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  flex: 0 0 calc(64px + env(safe-area-inset-bottom, 0px)) !important;
}
body.mf-mini .mf-mini-bottom-nav > button {
  min-width: 0 !important; min-height: 48px !important;
  display: flex !important; flex-direction: column !important;
  align-items: center !important; justify-content: center !important;
  font-size: 11px !important; gap: 3px !important;
}
body.mf-mini .mf-mini-bottom-nav img { width: 23px !important; height: 23px !important; }
body.mf-mini .mf-mini-bottom-nav .mf-center-btn-circle {
  width: 56px !important; height: 56px !important; min-width: 56px !important; min-height: 56px !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-chat-pane {
  min-width: 0 !important; overflow: hidden !important; padding-bottom: 0 !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf-chat-dynamic-content {
  min-width: 0 !important; min-height: 0 !important; padding: 0 !important;
  overflow: hidden !important; flex: 1 1 0 !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf-chat-view-section:not([hidden]) {
  min-width: 0 !important; min-height: 0 !important; flex: 1 1 0 !important;
  overflow-y: auto !important; box-sizing: border-box !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf-chat-bottom-controls {
  flex: 0 0 auto !important; min-width: 0 !important; position: relative !important;
}
body.mf-mini[data-mf-workspace="chat"]:has(.mf-view-messages[hidden]) .mf-chat-bottom-controls,
body.mf-mini[data-mf-workspace="chat"] .mf-chat-bottom-controls[hidden] { display: none !important; }
body.mf-mini[data-mf-workspace="chat"] .mf514-composer.mf63451-composer {
  padding: 6px 12px !important; min-height: 54px !important; width: 100% !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf-mini-composer-bar,
body.mf-mini[data-mf-workspace="chat"] .mf-composer-input-wrap { min-width: 0 !important; }
body.mf-mini[data-mf-workspace="chat"] .mf-mini-composer-bar { width: 100% !important; gap: 6px !important; }
body.mf-mini[data-mf-workspace="chat"] .mf514-send.mf63451-send {
  flex: 0 0 42px !important; width: 42px !important; height: 42px !important; min-width: 42px !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-message { min-width: 0; max-width: 100%; }
body.mf-mini[data-mf-workspace="chat"] .mf514-message > div { min-width: 0; max-width: 80% !important; overflow-wrap: anywhere; }
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine > div { background: #006cff !important; color: white !important; border-color: #006cff !important; }
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine :is(p, small, b) { color: inherit !important; }
body.mf-mini[data-mf-workspace="chat"] .mf514-messages { padding-bottom: 16px !important; }
body.mf-mini .mf-chat-hub-wrap { padding: 12px 12px 20px; }
body.mf-mini .mf-chat-hub-title-wrap { min-width: 0; flex: 1; }
body.mf-mini .mf-chat-hub-actions { flex: 0 0 auto; }
body.mf-mini .mf-chat-entrances-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.mf-mini .mf-ch-entrance-card { height: 74px; box-sizing: border-box; }
body.mf-mini .mf-ch-entrance-sub { display: none; }
body.mf-mini .mf-ch-entrance-icon-box { width: 34px; height: 34px; }
body.mf-mini .mf-ch-entrance-icon-box svg { width: 24px; height: 24px; }
body.mf-mini .mf-chat-filter-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
body.mf-mini .mf-ch-chip { min-width: 0; padding: 5px 3px; gap: 3px; justify-content: center; font-size: 12px; }
body.mf-mini .mf-chat-search-input-box { min-width: 0; flex: 1; }
body.mf-mini .mf-chat-search-input-box input { min-width: 0; width: 0; flex: 1; }
body.mf-mini .mf-ch-modal-option-btn > div:last-child { min-width: 0; overflow-wrap: anywhere; }
body.mf-mini :is(#mfSupportModal, #mfAddFriendModal) { position: absolute; inset: 0; width: 100%; padding: 0; background: #f8fafc; z-index: 50; align-items: stretch; }
body.mf-mini :is(#mfSupportModal, #mfAddFriendModal) .mf-ch-modal-sheet { width: 100%; max-width: 100%; max-height: 100%; height: 100%; margin: 0; border-radius: 0; box-shadow: none; box-sizing: border-box; overflow-y: auto; padding: 16px 12px; }
body.mf-mini :is(#mfSupportModal, #mfAddFriendModal) .mf-ch-modal-bar { display: none; }
body.mf-mini #mfSupportModal .mf-ch-modal-option-btn:first-child { background: #e7f2ff; border-color: #c6e0ff; min-height: 110px; }
.mf-chat-backend-gap { opacity: .75; }
.mf-discovery-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px; border: 1px solid #e2e8f0; border-radius: 12px; }
.mf-discovery-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mf-discovery-row b, .mf-discovery-row small { display: block; }
body.mf-mini .mf-composer-emoji { flex: 0 0 30px; width: 30px; height: 36px; padding: 0; border: 0; background: transparent; color: #526d99; font-size: 23px; }

/* Room tools occupy their own row; messages and composer stay unobstructed. */
body.mf-mini[data-mf-workspace="chat"] .mf-chat-dynamic-content { display:flex !important; flex-direction:column !important; }
body.mf-mini[data-mf-workspace="chat"] .mf-chat-room-nav-header { position:relative !important; flex:0 0 auto !important; min-width:0; }
.mf-room-tools-toggle { flex:0 0 40px; width:40px; height:40px; border:0; border-radius:10px; background:#edf3fa; color:#003da5; font-size:28px; cursor:pointer; }
.mf-room-tools-toggle[aria-expanded="true"] { background:#dceaff; }
body.mf-mini .mf-room-tools[hidden] { display:none !important; }
body.mf-mini[data-mf-workspace="chat"] .mf-room-tools:not([hidden]) { display:block !important; position:relative !important; flex:0 1 auto !important; min-height:0; max-height:35%; overflow:auto; padding:10px 12px; box-sizing:border-box; background:#f8fafc; border-bottom:1px solid #e2e8f0; }
body.mf-mini[data-mf-workspace="chat"] .mf-room-tools .mf-mini-quick-replies { position:static !important; margin:0 0 10px !important; padding:0 !important; width:100% !important; flex-wrap:wrap; height:auto !important; }
body.mf-mini[data-mf-workspace="chat"] .mf-room-tools .mf-services-selector-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
body.mf-mini .mf-room-tools .mf-service-card { min-width:0; }
body.mf-mini[data-mf-room-presentation="one-to-one"] .mf-room-tools,
body.mf-mini:has(.mf-private-unavailable) .mf-room-tools { display:none !important; }
/* Approved chat visual refinement: scoped to message presentation only.
   Both server-rendered bubbles and refreshed legacy history are supported. */
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine .mf-msg-bubble,
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine > div:not(.mf-msg-content) {
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .05) !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-message .mf-msg-bubble:has(.mf-chat-sticker-img),
body.mf-mini[data-mf-workspace="chat"] .mf514-message > div:not(.mf-msg-content):has(.mf-chat-sticker-img),
body.mf-mini[data-mf-workspace="chat"] .mf514-message .mf-chat-sticker-bubble {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-message .mf-chat-sticker-img,
body.mf-mini[data-mf-workspace="chat"] .mf-sticker-btn img {
  object-fit: contain !important;
  border-radius: 0 !important;
  background: transparent !important;
  image-rendering: auto !important;
  filter: none !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine .mf-msg-footer small,
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine > div:not(.mf-msg-content) > small:not(.mf601-send-state):not(.mf-read-status) {
  color: #64748b !important;
}
body.mf-mini[data-mf-workspace="chat"] .mf514-message.is-mine :is(.mf-read-status, .mf601-send-state.is-sent, .mf601-send-state.is-read) {
  color: #003da5 !important;
}

