/* ===== 聊天（微信 PC 三栏之会话列表 + 对话区） ===== */

.mm-chat-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #e6e6e6;
}

.mm-chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 252px) minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
}

.mm-chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #e6e6e6;
  border-right: 1px solid #d6d6d6;
  overflow: hidden;
}

.mm-chat-sidebar[data-chat-sidebar-tab="rooms"] .mm-chat-friends-panel,
.mm-chat-sidebar[data-chat-sidebar-tab="friends"] .mm-chat-room-list,
.mm-chat-sidebar[data-chat-sidebar-tab="friends"] .mm-chat-room-invites-panel {
  display: none !important;
}

.mm-chat-sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #d6d6d6;
  background: #ededed;
}

.mm-chat-sidebar-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.mm-chat-sidebar-head h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.mm-chat-sidebar-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.mm-chat-sidebar-tab {
  border: none;
  background: transparent;
  color: #666;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
}

.mm-chat-sidebar-tab.active {
  color: #07c160;
  background: rgb(7 193 96 / 0.12);
}

.mm-chat-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 8px;
  background: #fa5151;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  vertical-align: top;
}

.mm-chat-tab-badge[hidden] {
  display: none !important;
}

.mm-chat-my-id {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border-bottom: none;
  font-size: 11px;
  color: #666;
  flex-shrink: 0;
}

.mm-chat-my-id-num {
  color: #1a1a1a;
  font-size: 12px;
  letter-spacing: 0.3px;
}

.mm-chat-my-id-copy {
  margin-left: auto;
  border: none;
  background: #fff;
  color: #07c160;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.mm-chat-my-id-copy:hover {
  background: #f0fff5;
}

.mm-chat-friends-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #e6e6e6;
}

.mm-chat-friends-panel[hidden] {
  display: none !important;
}

.mm-chat-room-list[hidden] {
  display: none !important;
}

.mm-chat-add-friend {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #ededed;
  border-bottom: 1px solid #d6d6d6;
  flex-shrink: 0;
}

.mm-chat-add-friend-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

.mm-chat-add-friend-btn {
  border: none;
  background: #07c160;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.mm-chat-add-friend-btn:hover {
  background: #06ad56;
}

.mm-chat-friend-list,
.mm-chat-blocked-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mm-chat-friend-requests-scroll {
  flex-shrink: 0;
  max-height: 42%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid #d6d6d6;
}

.mm-chat-friend-section {
  background: #ededed;
}

.mm-chat-friend-section-title {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
}

.mm-chat-friend-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #fff8e6;
  border-bottom: 1px solid #f0e6c8;
  font-size: 13px;
  line-height: 1.5;
}

.mm-chat-friend-notice-main {
  flex: 1;
  min-width: 0;
}

.mm-chat-friend-notice-reason {
  margin: 4px 0 0;
  color: #666;
  font-size: 12px;
  word-break: break-word;
}

.mm-chat-friend-item.is-request,
.mm-chat-friend-item.is-pending {
  background: #f7fff9;
}

.mm-chat-reject-reason {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 88px;
}

.mm-chat-friend-list {
  flex: 1;
  min-height: 0;
}

.mm-chat-friends-empty {
  padding: 24px 16px;
  text-align: center;
  color: #999;
  font-size: 14px;
  line-height: 1.6;
}

.mm-chat-friend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #fff;
  border-bottom: 1px solid #ececec;
}

.mm-chat-friend-item.is-blocked {
  background: #fafafa;
}

.mm-chat-friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #07c160;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  font-size: 18px;
}

.mm-chat-friend-avatar .mm-chat-msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mm-chat-friend-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mm-chat-friend-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mm-chat-friend-id {
  font-size: 12px;
  color: #999;
}

.mm-chat-friend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.mm-chat-friend-action {
  border: 1px solid #ddd;
  background: #fff;
  color: #555;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.mm-chat-friend-action.is-primary {
  border-color: #07c160;
  color: #07c160;
}

.mm-chat-friend-action.is-danger {
  border-color: #f0c0c0;
  color: #c0392b;
}

.mm-chat-friend-action:hover {
  background: #f5f5f5;
}

.mm-chat-blocked-section {
  flex-shrink: 0;
  border-top: 1px solid #d6d6d6;
  background: #ededed;
  max-height: 38%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.mm-chat-blocked-title {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
}

.mm-chat-blocked-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.mm-chat-new-btn {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mm-chat-new-btn svg {
  width: 20px;
  height: 20px;
}

.mm-chat-new-btn:hover {
  background: rgb(0 0 0 / 0.06);
  color: #333;
}

.mm-chat-room-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #e6e6e6;
}

.mm-chat-room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-bottom: 1px solid #ececec;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}

.mm-chat-room-item:hover {
  background: #f5f5f5;
}

.mm-chat-room-item.active {
  background: #d9d9d9;
}

.mm-chat-room-avatar {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: #07c160;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.mm-chat-room-avatar.av-group {
  background: #576b95;
}

.mm-chat-room-avatar.av-room {
  background: #fa9d3b;
  font-size: 18px;
}

.mm-chat-room-avatar.av-private {
  background: #10aeff;
}

.mm-chat-room-list-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 13px;
  color: #999;
  line-height: 1.6;
}

.mm-chat-room-list-error {
  color: #c0392b;
}

.mm-chat-room-meta {
  min-width: 0;
  flex: 1;
}

.mm-chat-room-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mm-chat-room-name {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}

.mm-chat-room-time {
  flex-shrink: 0;
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}

.mm-chat-room-sub {
  font-size: 12px;
  color: #888;
  margin-top: 3px;
}

.mm-chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: #f5f5f5;
}

.mm-chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  padding: 24px;
}

.mm-chat-empty-inner {
  text-align: center;
  max-width: 280px;
}

.mm-chat-empty-icon {
  display: block;
  margin: 0 auto 16px;
  width: 72px;
  height: 72px;
  opacity: 0.55;
}

.mm-chat-empty-icon svg {
  width: 100%;
  height: 100%;
}

.mm-chat-empty p {
  font-size: 14px;
  color: #999;
  line-height: 1.5;
  margin-bottom: 16px;
}

.mm-chat-empty-btn {
  padding: 8px 20px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.mm-chat-empty-btn:hover {
  background: #fafafa;
  border-color: #07c160;
  color: #07c160;
}

.mm-chat-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
}

.mm-chat-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 0;
  padding: 8px 12px;
  flex-shrink: 0;
  background: #ededed;
  border-bottom: 1px solid #d6d6d6;
  position: relative;
}

.mm-chat-panel-head-main {
  flex: 1;
  min-width: 0;
  padding: 1px 4px 0 0;
}

.mm-chat-back-btn {
  display: none;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  color: #333;
  flex-shrink: 0;
  margin-top: 1px;
}

.mm-chat-more-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  margin-top: 1px;
}

.mm-chat-more-btn:hover {
  background: rgb(0 0 0 / 0.06);
}

.mm-chat-room-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 12px;
  min-width: 148px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
  z-index: 20;
  overflow: hidden;
}

.mm-chat-room-menu button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: #fff;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.mm-chat-room-menu button + button {
  border-top: 1px solid #f0f0f0;
}

.mm-chat-room-menu button:hover {
  background: #f7f7f7;
}

.mm-chat-room-menu button[data-room-action="dissolve"] {
  color: #c0392b;
}

.mm-chat-members-footer {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed #e5e5e5;
  display: flex;
  justify-content: flex-end;
}

.mm-chat-room-badge {
  margin-left: 4px;
  font-size: 12px;
  opacity: 0.75;
}

.mm-chat-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.35;
}

.mm-chat-panel-profile-trigger {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.mm-chat-panel-profile-trigger:hover {
  color: #07c160;
}

.mm-chat-panel-sub {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mm-chat-panel-online {
  font-size: 11px;
  color: #16a34a;
  margin-top: 2px;
  padding-top: 0;
  line-height: 1.35;
  word-break: break-all;
}

.mm-chat-panel-online.is-offline {
  color: #94a3b8;
}

.mm-chat-members-btn {
  flex-shrink: 0;
  border: 1px solid #c8c8c8;
  background: #fff;
  color: #333;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 1px;
}

.mm-chat-members-btn:hover {
  background: #f5f5f5;
}

.mm-chat-members-modal {
  max-width: 560px;
}

.mm-chat-members-section {
  margin-top: 16px;
}

.mm-chat-members-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}

.mm-chat-members-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.mm-chat-members-empty {
  font-size: 13px;
  color: #999;
  padding: 12px 4px;
  text-align: center;
}

.mm-chat-member-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #ebebeb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}

.mm-chat-member-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.mm-member-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
  margin-top: 6px;
}

.mm-member-dot.is-online {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgb(34 197 94 / 0.2);
}

.mm-chat-member-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mm-member-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.45;
  word-break: break-word;
}

.mm-member-name .mm-chat-display-name {
  font-weight: 600;
}

.mm-member-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mm-member-badges:empty {
  display: none;
}

.mm-member-tag {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 0;
}

.mm-member-tag.is-owner {
  color: #b45309;
  background: #fff7ed;
  border-color: #fed7aa;
}

.mm-member-tag.is-admin {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.mm-member-tag.is-muted {
  color: #c2410c;
  background: #fff7ed;
  border-color: #fdba74;
}

.mm-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 18px;
}

.mm-member-act-btn {
  border: none;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.mm-member-act-btn:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.mm-member-act-btn.is-danger {
  background: #fef2f2;
  color: #dc2626;
}

.mm-member-act-btn.is-danger:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.mm-member-act-btn.is-primary {
  background: #ecfdf5;
  color: #059669;
}

.mm-member-act-btn.is-primary:hover {
  background: #d1fae5;
  color: #047857;
}

.mm-chat-invite-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mm-chat-invite-search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
}

.mm-chat-invite-search-btn {
  border: none;
  background: #07c160;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.mm-chat-invite-search-btn:hover {
  background: #06ad56;
}

.mm-chat-invite-pending,
.mm-chat-invite-rejects {
  margin-bottom: 12px;
}

.mm-chat-invite-pending-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
}

.mm-chat-invite-results {
  max-height: 200px;
}

.mm-chat-room-invites-panel {
  flex-shrink: 0;
  max-height: 38%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ededed;
  border-bottom: 1px solid #d6d6d6;
}

.mm-chat-room-invites-title {
  margin: 0;
  padding: 8px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
}

.mm-chat-room-invites-list {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mm-chat-room-invite-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}

.mm-chat-room-invite-main {
  min-width: 0;
}

.mm-chat-room-invite-main strong {
  display: block;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 2px;
}

.mm-chat-room-invite-sub {
  font-size: 12px;
  color: #666;
}

.mm-chat-room-invite-actions {
  display: flex;
  gap: 6px;
}

.mm-chat-level {
  display: inline-block;
  margin-right: 4px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #7c3aed;
  background: #f3e8ff;
  border: 1px solid #ddd6fe;
  vertical-align: middle;
}

.mm-chat-prefix-tag {
  display: inline-block;
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #0f766e;
  background: #ecfdf5;
  border: 1px solid #99f6e4;
  vertical-align: middle;
}

.mm-chat-base-name {
  margin-left: 4px;
  font-size: 11px;
  color: #999;
  font-weight: 400;
}

.mm-chat-msg-name .mm-chat-level,
.mm-chat-msg-name .mm-chat-prefix-tag,
.mm-chat-msg-name .mm-chat-role-tag,
.mm-chat-msg-name .mm-chat-base-name {
  pointer-events: none;
}

.mm-chat-role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 999px;
  padding: 1px 6px;
  margin-right: 4px;
  vertical-align: middle;
}

.mm-chat-role-tag.is-owner {
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.mm-chat-role-tag.is-admin {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.mm-chat-room-settings {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.mm-chat-levels-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}

.mm-chat-levels-toggle input {
  width: 16px;
  height: 16px;
}

.mm-chat-compose.is-speech-muted {
  opacity: 0.72;
}

.mm-chat-compose.is-speech-muted .mm-chat-text {
  background: #f3f4f6;
}

.mm-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px max(10px, calc((100% - 760px) / 2));
  -webkit-overflow-scrolling: touch;
  background: #f5f5f5;
}

.mm-chat-msg-empty {
  text-align: center;
  color: #bbb;
  font-size: 13px;
  padding: 24px 12px;
}

.mm-chat-msg {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.mm-chat-msg.mine {
  flex-direction: row-reverse;
}

.mm-chat-msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.mm-chat-msg-body {
  max-width: min(82%, 460px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.mm-chat-msg.mine .mm-chat-msg-body {
  align-items: flex-end;
}

.mm-chat-msg-name {
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  max-width: 100%;
}

.mm-chat-profile-trigger {
  cursor: pointer;
}

.mm-chat-msg-avatar.mm-chat-profile-trigger:hover {
  opacity: 0.88;
}

.mm-chat-msg-name.mm-chat-profile-trigger:hover {
  color: #07c160;
}

.mm-chat-msg.mine .mm-chat-msg-name {
  text-align: right;
}

.mm-chat-msg-time {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #aaa;
  line-height: 1.2;
}

.mm-chat-msg-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}

.mm-chat-msg-foot .mm-chat-msg-time {
  margin-top: 0;
}

.mm-chat-msg-read {
  font-size: 11px;
  color: #16a34a;
  line-height: 1.2;
}

.mm-chat-msg.mine .mm-chat-msg-foot {
  justify-content: flex-end;
}

.mm-chat-msg.mine .mm-chat-msg-time {
  text-align: right;
}

.mm-chat-bubble {
  background: var(--bubble-other-bg, #fff);
  color: var(--bubble-other-color, inherit);
  border-radius: var(--bubble-other-radius, 4px);
  border: var(--bubble-other-border, none);
  padding: var(--bubble-padding, 9px 12px);
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: var(--bubble-shadow, 0 1px 1px rgb(0 0 0 / 0.04));
  width: fit-content;
  max-width: 100%;
  position: relative;
}

.mm-chat-msg.mine .mm-chat-bubble {
  background: var(--bubble-mine-bg, #95ec69);
  color: var(--bubble-mine-color, inherit);
  border-radius: var(--bubble-mine-radius, 4px);
  border: var(--bubble-mine-border, none);
  box-shadow: var(--bubble-mine-shadow, var(--bubble-shadow, 0 1px 1px rgb(0 0 0 / 0.04)));
}

.mm-chat-msg.system {
  justify-content: center;
  margin-bottom: 8px;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

.mm-chat-msg-system {
  color: #999;
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
  padding: 2px 12px;
  max-width: 90%;
}

.mm-chat-bubble.system {
  background: transparent;
  box-shadow: none;
  color: #999;
  font-size: 12px;
  text-align: center;
  padding: 4px 0;
}

.mm-chat-msg-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.mm-chat-msg-imgs img,
.mm-chat-msg-imgs .mm-sticker-img,
.mm-chat-msg-imgs .mm-chat-video {
  max-width: 120px;
  max-height: 120px;
  border-radius: 4px;
  cursor: pointer;
  object-fit: cover;
  background: #000;
}

.mm-chat-msg-imgs .mm-chat-video {
  max-width: min(240px, 72vw);
  max-height: 180px;
}

.mm-chat-msg-imgs .mm-chat-audio,
.mm-media-audio.mm-chat-audio {
  width: min(280px, 78vw);
  max-width: 100%;
  height: 36px;
  margin-top: 2px;
}

.mm-compose-thumb.is-audio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 56px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.mm-compose-audio-icon {
  font-size: 22px;
  line-height: 1;
}

.mm-voice-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 148px;
  max-width: min(280px, 78vw);
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.4);
}

.mm-chat-msg.mine .mm-voice-bar,
.mm-voice-bar.is-mine {
  background: #95ec69;
  border-color: #7ed957;
}

.mm-voice-bar.is-compact {
  min-width: 120px;
  max-width: 180px;
  padding: 6px 8px;
  gap: 6px;
}

.mm-voice-bar-play {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgb(7 193 96 / 0.15);
  color: #059669;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  padding: 0;
}

.mm-chat-msg.mine .mm-voice-bar-play,
.mm-voice-bar.is-mine .mm-voice-bar-play {
  background: rgb(255 255 255 / 0.35);
  color: #166534;
}

.mm-voice-bar.is-playing .mm-voice-bar-play {
  background: #07c160;
  color: #fff;
}

.mm-voice-bar-waves {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  flex: 1;
  min-width: 36px;
}

.mm-voice-bar-waves i {
  display: block;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: #94a3b8;
  animation: none;
}

.mm-voice-bar.is-playing .mm-voice-bar-waves i {
  animation: mm-voice-wave 0.8s ease-in-out infinite;
}

.mm-voice-bar.is-playing .mm-voice-bar-waves i:nth-child(2) { animation-delay: 0.1s; }
.mm-voice-bar.is-playing .mm-voice-bar-waves i:nth-child(3) { animation-delay: 0.2s; }
.mm-voice-bar.is-playing .mm-voice-bar-waves i:nth-child(4) { animation-delay: 0.3s; }
.mm-voice-bar.is-playing .mm-voice-bar-waves i:nth-child(5) { animation-delay: 0.4s; }

@keyframes mm-voice-wave {
  0%, 100% { height: 6px; }
  50% { height: 16px; }
}

.mm-voice-bar-duration {
  font-size: 12px;
  color: #64748b;
  min-width: 24px;
  flex-shrink: 0;
}

.mm-voice-bar-text-btn {
  border: none;
  background: rgb(59 130 246 / 0.12);
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

.mm-voice-bar-transcript {
  flex: 1 1 100%;
  margin: 2px 0 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgb(0 0 0 / 0.04);
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
  word-break: break-word;
}

.mm-chat-msg.mine .mm-voice-bar-transcript,
.mm-voice-bar.is-mine .mm-voice-bar-transcript {
  background: rgb(255 255 255 / 0.35);
  color: #14532d;
}

.mm-compose-thumb.is-voice-bar {
  width: auto;
  min-width: 150px;
  max-width: 200px;
  height: auto;
  min-height: 0;
  padding: 4px 24px 4px 4px;
  background: #fff;
  border: 1px solid #e5e7eb;
  position: relative;
}

.mm-compose-thumb.is-voice-bar .mm-voice-bar {
  box-shadow: none;
  border: none;
  padding: 4px 6px;
  min-width: 0;
  max-width: 100%;
}

.mm-compose-thumb.is-voice-bar .mm-voice-bar-text-btn {
  display: none;
}

.mm-voice-input-btn.is-active,
.mm-voice-record-btn.is-recording {
  background: #fee2e2;
  color: #dc2626;
  border-radius: 8px;
}

[data-theme="dark"] .mm-voice-bar {
  background: var(--chat-bubble-bg);
  border-color: var(--chat-border);
}

[data-theme="dark"] .mm-chat-msg.mine .mm-voice-bar,
[data-theme="dark"] .mm-voice-bar.is-mine {
  background: var(--chat-bubble-mine);
}

.mm-chat-msg-foot .mm-chat-revoke-btn,
.mm-chat-msg-foot .mm-chat-admin-delete-btn {
  margin-top: 0;
}

.mm-chat-revoke-btn,
.mm-chat-admin-delete-btn {
  border: none;
  background: none;
  color: #576b95;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  line-height: 1.2;
}

.mm-chat-revoke-btn:hover,
.mm-chat-admin-delete-btn:hover {
  color: #07c160;
}

.mm-chat-msg.mine .mm-chat-revoke-btn,
.mm-chat-msg.mine .mm-chat-admin-delete-btn {
  color: #4b7a5c;
}

.mm-chat-msg-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.mm-chat-msg.mine .mm-chat-msg-actions {
  justify-content: flex-end;
}

.mm-chat-msg-actions button {
  border: none;
  background: none;
  color: #999;
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}

.mm-chat-msg-actions button:hover {
  color: #07c160;
}

.mm-chat-compose {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 10px 8px;
  background: #ededed;
  border-top: 1px solid #d6d6d6;
}

.mm-chat-compose-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.mm-chat-compose-row .mm-chat-tools {
  flex: 0 0 auto;
  align-self: flex-end;
}

.mm-chat-compose-row .mm-chat-input-row {
  flex: 1;
  min-width: 0;
}

.mm-chat-tools {
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.mm-chat-tools .mm-emoji-btn,
.mm-chat-tool-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.mm-chat-tools .mm-emoji-btn svg,
.mm-chat-tool-btn svg {
  width: 22px;
  height: 22px;
}

.mm-chat-tools .mm-upload-btn {
  padding: 0;
  background: transparent;
  border-radius: 4px;
  color: #666;
  font-size: 0;
  font-weight: normal;
}

.mm-chat-tools .mm-emoji-btn:hover,
.mm-chat-tool-btn:hover,
.mm-chat-tools .mm-upload-btn:hover {
  background: rgb(0 0 0 / 0.05);
}

.mm-chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
}

.mm-chat-text {
  flex: 1 1 auto;
  min-width: 0;
  width: 0;
  min-height: 32px;
  max-height: 88px;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  background: #fff;
  line-height: 1.4;
  box-sizing: border-box;
}

.mm-chat-text:focus {
  outline: none;
  box-shadow: 0 0 0 1px rgb(7 193 96 / 0.35);
}

.mm-chat-send-btn {
  flex: 0 0 auto;
  height: 32px;
  min-width: 48px;
  padding: 0 12px;
  border: none;
  border-radius: 4px;
  background: #07c160;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mm-chat-send-btn:hover {
  background: #06ad56;
}

.mm-chat-create-types {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mm-chat-create-type {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
}

.mm-chat-create-type.active {
  border-color: #07c160;
  background: #e8f8ef;
}

.mm-chat-member-pick {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
}

/* 手机 */
.is-mobile .mm-chat-wrap {
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.is-mobile .mm-chat-layout {
  grid-template-columns: 1fr;
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  height: 100%;
}

.is-mobile .mm-chat-sidebar {
  width: 100%;
  min-width: 0;
  flex: 1;
  max-width: 100%;
}

.is-mobile .mm-chat-sidebar-head {
  height: clamp(48px, 13vw, 52px);
  padding: 0 clamp(12px, 4vw, 16px);
}

.is-mobile .mm-chat-sidebar-head h3 {
  font-size: clamp(14px, 4vw, 15px);
}

.is-mobile .mm-chat-room-item {
  padding: clamp(10px, 3vw, 12px) clamp(12px, 4vw, 14px);
  gap: clamp(10px, 3vw, 12px);
}

.is-mobile .mm-chat-room-avatar {
  width: clamp(38px, 11vw, 44px);
  height: clamp(38px, 11vw, 44px);
  font-size: clamp(14px, 4vw, 16px);
}

.is-mobile .mm-chat-room-name {
  font-size: clamp(13px, 3.8vw, 14px);
}

.is-mobile .mm-chat-room-sub {
  font-size: clamp(11px, 3.2vw, 12px);
}

.is-mobile .mm-chat-main {
  display: none;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.is-mobile .mm-chat-layout.room-open .mm-chat-sidebar {
  display: none;
}

.is-mobile .mm-chat-layout.room-open .mm-chat-main {
  display: flex;
  flex: 1;
  min-height: 0;
}

.is-mobile .mm-chat-panel {
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.is-mobile .mm-chat-compose {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  padding: clamp(6px, 2vw, 8px) clamp(8px, 2.5vw, 10px) max(8px, env(safe-area-inset-bottom, 0px));
}

.is-mobile .mm-chat-compose-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.is-mobile .mm-chat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  width: 100%;
}

.is-mobile .mm-chat-text {
  width: auto;
  min-width: 0;
  font-size: 16px;
  min-height: 40px;
}

.is-mobile .mm-chat-send-btn {
  min-height: 40px;
  min-width: 56px;
  padding: 0 clamp(12px, 4vw, 16px);
  font-size: clamp(12px, 3.5vw, 13px);
}

.is-mobile .mm-chat-back-btn {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.is-mobile .mm-chat-panel-head {
  min-height: clamp(48px, 13vw, 52px);
  height: auto;
  padding: 10px clamp(12px, 3.5vw, 16px) 12px;
}

.is-mobile .mm-chat-panel-online {
  margin-top: 5px;
}

.is-mobile .mm-chat-panel-title {
  font-size: clamp(14px, 4vw, 15px);
}

.is-mobile .mm-chat-messages {
  padding: clamp(10px, 3vw, 14px) clamp(10px, 3.5vw, 16px);
}

.is-mobile .mm-chat-msg-body {
  max-width: min(82vw, 340px);
}

.is-mobile .mm-chat-bubble {
  font-size: clamp(14px, 4vw, 15px);
  padding: clamp(8px, 2.5vw, 10px) clamp(10px, 3vw, 12px);
}

.is-mobile .mm-chat-msg-imgs img,
.is-mobile .mm-chat-msg-imgs .mm-sticker-img {
  max-width: min(42vw, 140px);
  max-height: min(42vw, 140px);
}

.is-mobile .mm-chat-tools .mm-emoji-btn,
.is-mobile .mm-chat-tools .mm-chat-tool-btn,
.is-mobile .mm-chat-tools .mm-upload-btn {
  min-width: 44px;
  min-height: 44px;
}

.is-mobile .mm-chat-empty {
  padding: clamp(16px, 5vw, 24px);
}

.is-mobile .mm-chat-empty p {
  font-size: clamp(13px, 3.8vw, 14px);
}

.is-mobile .mm-chat-create-types {
  flex-wrap: wrap;
}

.is-mobile .mm-chat-create-type {
  min-width: calc(33.33% - 6px);
  padding: clamp(8px, 2.5vw, 10px);
  font-size: clamp(12px, 3.5vw, 14px);
}

.is-desktop .mm-chat-layout {
  grid-template-columns: 260px minmax(0, 1fr);
}

/* 窄屏（含 iPhone 切到电脑版）强制单栏聊天，避免发送按钮被挤出 */
@media (max-width: 768px) {
  .mm-chat-layout {
    grid-template-columns: 1fr !important;
    height: 100%;
  }

  .mm-chat-layout:not(.room-open) .mm-chat-main {
    display: none !important;
  }

  .mm-chat-layout.room-open .mm-chat-sidebar {
    display: none !important;
  }

  .mm-chat-layout.room-open .mm-chat-main {
    display: flex !important;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
  }

  .mm-chat-panel {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  .mm-chat-compose {
    flex-shrink: 0;
    z-index: 2;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }

  .mm-chat-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    width: 100%;
  }

  .mm-chat-text {
    width: auto;
    min-width: 0;
    font-size: 16px;
  }

  .mm-chat-send-btn {
    min-width: 56px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mm-chat-back-btn {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 360px) {
  .is-mobile .mm-chat-msg-body {
    max-width: 88vw;
  }

  .is-mobile .mm-chat-create-type {
    min-width: 100%;
  }
}

.mm-chat-notify-banner {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h, 52px) + env(safe-area-inset-top, 0px) + 10px);
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px));
  z-index: 500;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 12px;
  box-shadow: 0 10px 32px rgb(0 0 0 / 0.16);
  overflow: hidden;
}

.mm-chat-notify-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #999;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.mm-chat-notify-body {
  display: block;
  width: 100%;
  padding: 14px 36px 14px 16px;
  border: none;
  background: #fff;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.mm-chat-notify-body:hover {
  background: #f7f7f7;
}

.mm-chat-notify-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #07c160;
  margin-bottom: 4px;
}

.mm-chat-notify-text {
  display: block;
  font-size: 13px;
  color: #555;
  line-height: 1.45;
  word-break: break-word;
}

.is-mobile .mm-chat-notify-banner {
  top: calc(var(--header-h, 52px) + env(safe-area-inset-top, 0px) + 8px);
  width: calc(100vw - 20px);
}

.mm-chat-date-divider {
  display: flex;
  justify-content: center;
  margin: 8px auto 6px;
  max-width: 760px;
}

.mm-chat-date-divider span {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.06);
  color: #888;
  font-size: 12px;
  line-height: 1.4;
}

.mm-chat-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
  max-width: 760px;
  margin: 0 auto;
}

.mm-chat-load-more {
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}

.mm-chat-load-more:hover {
  border-color: #07c160;
  color: #07c160;
}

.mm-chat-history-modal {
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
}

.mm-chat-history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.mm-chat-history-status {
  font-size: 12px;
  color: #999;
}

.mm-chat-history-list {
  flex: 1;
  min-height: 200px;
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid #eee;
  border-radius: 12px;
  background: #fafafa;
  padding: 8px 0;
}

.mm-chat-history-row {
  display: grid;
  grid-template-columns: 92px minmax(72px, 120px) 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 14px;
  border-bottom: 1px solid rgb(0 0 0 / 0.04);
  font-size: 13px;
  line-height: 1.5;
}

.mm-chat-history-row:last-child {
  border-bottom: none;
}

.mm-chat-history-time {
  color: #888;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mm-chat-history-name {
  color: #07c160;
  font-weight: 600;
  word-break: break-all;
}

.mm-chat-history-text {
  color: #333;
  word-break: break-word;
  white-space: pre-wrap;
}

.mm-chat-history-empty {
  padding: 24px 16px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

.is-mobile .mm-chat-history-row {
  grid-template-columns: 1fr;
  gap: 2px;
}

.is-mobile .mm-chat-history-name {
  display: inline;
}

.is-mobile .mm-chat-history-name::after {
  content: ' · ';
  color: #bbb;
  font-weight: 400;
}
