:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #0f766e;
  --brand-strong: #0b5d57;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  --mobile-tabbar-height: 58px;
}

/* 3.1737 mobile IA and desktop message-density refinement. */
.identity-badge.group { background:#fff0d9; color:#b65a00; }
.group-avatar { background:#fff0d9 !important; color:#b65a00 !important; }
@media (min-width: 761px) {
  .im-shell { grid-template-columns:64px minmax(250px,280px) minmax(0,1fr) 236px; }
  .message-list { padding-left:32px; padding-right:32px; }
  .message-bubble { max-width:min(860px, 84%); }
  .message-row.self .message-bubble { max-width:min(760px, 76%); }
  .message-list .message-content { line-height:1.72; }
}
@media (max-width:760px) {
  .mobile-page-head { grid-template-columns:minmax(36px,1fr) auto minmax(72px,1fr); }
  .mobile-home-actions { display:flex; justify-content:flex-end; align-items:center; gap:36px; }
  #m-chat .mobile-page-head { position:relative; display:flex; justify-content:center; }
  #m-chat .mobile-page-head > strong { position:absolute; left:50%; transform:translateX(-50%); }
  #m-chat .mobile-home-actions { position:absolute; right:16px; }
  .mobile-create-circle { position:relative; width:30px; height:30px; min-width:30px; min-height:30px; padding:0; border:2px solid currentColor; border-radius:50%; background:transparent; color:#171717; font-size:0; }
  .mobile-create-circle::before,.mobile-create-circle::after { content:""; position:absolute; top:50%; left:50%; width:12px; height:2px; border-radius:99px; background:currentColor; transform:translate(-50%,-50%); }
  .mobile-create-circle::after { transform:translate(-50%,-50%) rotate(90deg); }
  .mobile-create-circle:active { background:#f2f2f2; }
  .mobile-contact-home { padding:8px 0; }
  /* 详情随内容自然排布：整页滚动，但每个联系人仍是一行标准高度。 */
  #m-contacts { display:block; overflow-y:auto; }
  #m-contacts .mobile-contact-detail-head { margin:0; }
  #m-contacts .mobile-contact-section { height:auto; max-height:none; margin:0; padding:18px; display:block; overflow:visible !important; border:0; border-radius:0; box-shadow:none; }
  #m-contacts .mobile-contact-section > .list,
  #m-contacts .mobile-contact-section > .request-list { min-height:0; max-height:none; overflow:visible; }
  #m-contacts .mobile-contact-section > .list { display:flex; flex-direction:column; gap:0; margin:0; padding:0; }
  #m-contacts .mobile-contact-section > .list > .session-item { flex:none; min-height:72px; margin:0; padding:12px 16px; border-radius:0; border-bottom:1px solid #edf0f4; }
  /* 仅从“发起群聊”进入时，将完整建群/拉人表单置顶；普通群聊页仍只展示列表。 */
  #m-contacts #mobileContactGroups.group-create-flow { display:flex; flex-direction:column; }
  #m-contacts #mobileContactGroups.group-create-flow > h3 { order:-2; }
  #m-contacts #mobileContactGroups.group-create-flow > .mobile-contact-add-form { order:-1; margin:0 0 16px; }
  #m-contacts #mobileContactGroups.group-create-flow .group-manage-details { width:100%; border:0; border-radius:0; background:transparent; }
  #m-contacts #mobileContactGroups.group-create-flow .group-manage-details > .member-selects,
  #m-contacts #mobileContactGroups.group-create-flow .group-manage-details > .member-actions { margin-inline:0; }
  #m-contacts #mobileContactGroups.group-create-flow .member-selects { grid-template-columns:1fr; gap:12px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-field { font-size:14px; gap:7px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-field select,
  #m-contacts #mobileContactGroups.group-create-flow .member-field input { min-height:44px; font-size:16px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-picker-field { grid-column:1 / -1; }
  .member-picker-tools { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; }
  .member-picker-search { display:flex; align-items:center; min-height:40px; padding:0 10px; border:1px solid var(--border); border-radius:8px; background:#fff; }
  .member-picker-search input { flex:1; min-width:0; padding:0; border:0; outline:0; background:transparent; font:inherit; font-size:14px; }
  .member-picker-tools button { min-height:40px; padding-inline:14px; font-size:14px; white-space:nowrap; }
  .member-picker-summary { color:var(--muted); font-size:13px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-check-list { grid-template-columns:1fr; max-height:48vh; min-height:260px; gap:0; padding:0; border-radius:10px; background:#fff; }
  #m-contacts #mobileContactGroups.group-create-flow .member-check-item { min-height:58px; padding:9px 12px; border:0; border-bottom:1px solid #edf0f4; border-radius:0; background:#fff; font-size:15px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-check-item .avatar { width:34px; height:34px; border-radius:8px; }
  #m-contacts #mobileContactGroups.group-create-flow .member-check-item > span:last-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #m-contacts #mobileContactGroups.group-create-flow .member-actions { grid-template-columns:1fr 1fr; position:sticky; bottom:0; padding:10px 0 4px; background:#fff; }
  #m-contacts #mobileContactGroups.group-create-flow #mobileAddMember { grid-column:1 / -1; min-height:48px; font-size:16px; }
  #m-contacts .mobile-contact-section > h3 { margin:0; padding:14px 16px; font-size:15px; }
  .mobile-add-page { display:grid; gap:12px; padding:12px; background:#f6f6f6; }
  .mobile-add-search { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; }
  .mobile-add-search-field { display:flex; align-items:center; min-height:42px; padding:0 11px; border:1px solid #e4e4e4; border-radius:8px; background:#fff; }
  .mobile-add-search-field input { min-width:0; flex:1; border:0; outline:0; color:#202020; font:inherit; font-size:15px; background:transparent; }
  .mobile-add-verify { min-height:42px; padding:0 13px; border-radius:8px; background:#242424; color:#fff; font:inherit; font-size:14px; font-weight:600; white-space:nowrap; }
  .mobile-add-actions { overflow:hidden; border:1px solid #eee; border-radius:8px; background:#fff; }
  .mobile-add-page .mobile-settings-row { background:#fff; border-radius:0; }
  .mobile-add-page .mobile-settings-row.is-active { color:#111; background:#f7f7f7; }
  .mobile-add-page .mobile-settings-row.is-active span::after { content:"当前"; margin-left:8px; color:#777; font-size:12px; font-weight:400; }
  .mobile-add-search-result { margin:0; max-height:none; overflow:visible; }
  .mobile-add-page.has-search-results .mobile-add-actions { display:none; }
  .mobile-add-search-result .request-item { min-height:72px; padding:10px 14px; border-radius:8px; }
  .mobile-add-search-result .request-item > button { min-width:96px; font:inherit; font-size:15px; white-space:nowrap; }
  .mobile-add-search-result .mobile-add-result-item { grid-template-columns:42px minmax(0,1fr) auto; gap:10px; align-items:center; background:#fff; }
  .mobile-add-search-result .mobile-add-result-item > span:nth-child(2) { min-width:0; }
  .mobile-add-search-result .mobile-add-result-item strong { font-size:16px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mobile-add-search-result .mobile-add-result-item em { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .mobile-moments-tools .grid { gap:18px; padding:2px 0 8px; }
  .mobile-moments-tools .grid label { gap:8px; font-size:14px; }
  .moment-field-label { font-weight:600; color:#303030; }
  .mobile-moments-tools .mobile-styled-select-button { min-height:42px; font-size:15px; }
  .moment-media-picker .file-picker,.moment-media-picker #clearMomentMedia { font-size:14px; font-weight:500; }
  .moment-more-button { width:20px; min-width:20px; height:20px; min-height:20px; padding:0; border:0; background:transparent; color:#777; font-size:15px; line-height:16px; letter-spacing:1px; }
}

@media (max-width: 760px) {
  .mobile-session-list.session-list {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0 !important;
  }

  .mobile-main #m-chat {
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  body.mobile-view-home .mobile-main {
    padding-bottom: 0 !important;
  }
}

* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  max-width: 100%;
  overflow-x: hidden;
}

.mobile-launch-screen {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: max(28px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom));
  background: #f8fafc;
  color: #111827;
  opacity: 1;
  transition: opacity 180ms ease;
}

.mobile-launch-screen.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.mobile-launch-mark {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: transparent;
  overflow: hidden;
}

.mobile-launch-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.mobile-launch-screen strong {
  font-size: 18px;
  font-weight: 700;
}

.mobile-launch-screen span {
  min-height: 18px;
  color: #667085;
  font-size: 13px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #eef1f5;
  padding: 18px;
}

.login-panel {
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.login-panel h1 {
  margin: 0;
  font-size: 24px;
}

.login-remember {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.login-remember input {
  width: 16px;
  height: 16px;
}

/* The mobile sign-in screen is a Xiuxiu entry point, not a generic web form. */
#mobileLoginScreen.login-screen {
  isolation: isolate;
  padding: max(28px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(150deg, #ff2d8e 0%, #ca3bbb 52%, #6b2bd9 100%);
}

#mobileLoginScreen.login-screen::before {
  content: "";
  position: absolute;
  inset: auto -36% -20% -36%;
  height: 34%;
  z-index: -1;
  border-radius: 50% 50% 0 0;
  background: rgba(255, 255, 255, 0.12);
}

#mobileLoginScreen .login-panel {
  position: relative;
  width: min(380px, 100%);
  padding: 28px 24px 24px;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 18px 46px rgba(76, 20, 108, 0.26);
}

#mobileLoginScreen .mobile-login-brand {
  min-height: 74px;
  gap: 14px;
  align-items: center;
  padding-bottom: 6px;
}

#mobileLoginScreen .mobile-login-brand .brand-logo-preview {
  width: 66px;
  height: 66px;
  flex: 0 0 66px;
  border: 0;
  border-radius: 16px;
  background: #c437bd;
  color: transparent;
  box-shadow: 0 8px 18px rgba(182, 44, 175, 0.28);
}

#mobileLoginScreen .mobile-login-brand .brand-logo-preview.is-text-fallback {
  color: #fff;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 38px;
  font-weight: 800;
}

#mobileLoginScreen .mobile-login-brand h1 {
  color: #242938;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
}

#mobileLoginScreen .mobile-login-brand h1::after {
  content: "有梦想，来秀秀";
  display: block;
  margin-top: 8px;
  color: #9b2fb6;
  font-size: 13px;
  font-weight: 600;
}

#mobileLoginScreen label {
  gap: 8px;
  color: #4a5060;
  font-size: 14px;
  font-weight: 650;
}

#mobileLoginScreen input:not([type="checkbox"]) {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #ded8e4;
  border-radius: 8px;
  background: #fff;
  color: #242938;
  font-size: 16px;
  line-height: 1.2;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}

#mobileLoginScreen input:not([type="checkbox"]):focus {
  border-color: #c437bd;
  box-shadow: 0 0 0 3px rgba(196, 55, 189, 0.14);
}

#mobileLoginScreen .login-remember {
  min-height: 24px;
  gap: 10px;
  color: #686f7d;
  font-size: 14px;
  font-weight: 500;
}

#mobileLoginScreen .login-remember input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #bd36bd;
}

#mobileLoginScreen #mobileLoginButton,
#mobileLoginScreen #mobileRegisterButton {
  min-height: 50px;
  border-radius: 8px;
  background: linear-gradient(100deg, #f72f8c, #8c34ca);
  box-shadow: 0 8px 16px rgba(151, 41, 178, 0.22);
  color: #fff;
  font-size: 17px;
  font-weight: 750;
}

#mobileLoginScreen #mobileShowRegister {
  min-height: 46px;
  border: 1px solid #e6d5ea;
  border-radius: 8px;
  background: #fff8fd;
  color: #972fae;
  font-size: 16px;
  font-weight: 650;
}

#mobileLoginScreen .register-panel {
  padding-top: 4px;
}

#mobileLoginScreen #mobileLoginError {
  min-height: 0;
  color: #c32755;
  font-size: 13px;
}

.register-panel,
.advanced-settings {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

button:hover {
  background: var(--brand-strong);
}

button.action-pressed {
  transform: translateY(1px);
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

button.secondary {
  background: #e7eaef;
  color: var(--text);
}

button.secondary:hover {
  background: #d9dee7;
}

button.danger {
  color: #b42318;
  background: #fff1f0;
  border: 1px solid #fecdca;
}

button.danger:hover {
  background: #fee4e2;
}

button.success {
  background: var(--ok);
  color: #fff;
}

button.success:hover {
  background: #08705f;
}

button.danger-button {
  background: var(--danger);
  color: #fff;
}

button.danger-button:hover {
  background: #912018;
}

button.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

button.link-button:hover {
  background: transparent;
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.check-row input {
  width: auto;
  min-width: 16px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  background: #101828;
  color: #fff;
  padding: 22px 18px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.rail-logo img,
.brand-logo-preview img,
.mobile-company-headline .avatar img,
.mobile-login-brand .brand-logo-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-logo-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #dbeafe;
  color: #1d4ed8;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  font-weight: 700;
}

.file-button {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #eef2f7;
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.mobile-login-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mobile-login-brand h1 {
  margin: 0;
}

.sub {
  color: #bac4d2;
  font-size: 13px;
  line-height: 1.5;
}

.nav {
  margin-top: 26px;
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #e5e7eb;
  border: 1px solid transparent;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.main {
  padding: 22px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.admin-connection-bar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.admin-connection-bar .advanced-settings {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel h2,
.panel h3 {
  margin: 0 0 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.inline-form:has(select) {
  grid-template-columns: minmax(0, 1fr) 88px auto;
}

.inline-form button,
.inline-form select,
.inline-form input {
  min-height: 38px;
}

.member-admin {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.group-manage-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.group-manage-details summary {
  min-height: 38px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--brand);
  font-weight: 800;
  list-style-position: inside;
  user-select: none;
}

.group-manage-details[open] {
  padding-bottom: 10px;
}

.group-manage-details[open] summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.group-manage-details > .inline-form,
.group-manage-details > .member-selects,
.group-manage-details > .member-actions {
  margin-inline: 10px;
}

.group-manage-details > .inline-form,
.group-manage-details > .member-selects {
  margin-bottom: 10px;
}

.member-selects {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 8px;
}

.member-field {
  min-width: 0;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.member-field-wide {
  grid-column: 1 / -1;
}

.member-field select,
.member-field input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.25;
}

.member-type-field {
  max-width: 86px;
}

.member-field select[multiple] {
  display: none;
}

#mobileMultiSendTarget[multiple] {
  display: none;
}

.member-check-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.member-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  background: var(--panel-soft);
  cursor: pointer;
}

.member-check-item input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  accent-color: var(--brand);
}

.member-check-item span {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.member-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.member-selects select,
.member-actions button {
  min-height: 40px;
  min-width: 0;
}

.member-selects select {
  width: 100%;
  color: var(--text);
}

.member-actions button {
  width: 100%;
  font-weight: 700;
  padding-inline: 8px;
  white-space: normal;
  line-height: 1.25;
}

.member-current {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.member-current-title {
  color: var(--muted);
  font-size: 12px;
}

.request-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
}

.request-title {
  color: var(--muted);
  font-size: 12px;
}

.request-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafbfc;
}

.request-item strong,
.request-item em {
  display: block;
}

.request-item em {
  margin-top: 2px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.request-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.request-actions button {
  min-height: 34px;
  padding: 7px 9px;
  white-space: nowrap;
}

.member-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 82px;
  overflow: auto;
}

.member-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 4px 8px;
  font-size: 12px;
  max-width: 100%;
  min-height: 0;
  cursor: pointer;
}

.member-chip em {
  color: var(--muted);
  font-style: normal;
}

.member-chip strong {
  color: var(--brand-strong);
  font-size: 11px;
  margin-left: 2px;
}

.member-chip.owner {
  background: #f5fbfa;
  border-color: #b9d8d1;
}

.member-chip:hover,
.member-chip.active {
  border-color: var(--brand);
  background: #edf7f5;
}

.member-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  min-height: 0;
  max-height: min(48vh, 520px);
  overflow: auto;
}

.compact-list {
  max-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.overview-strip span {
  background: #eef8f6;
  border: 1px solid #d7efea;
  border-radius: 8px;
  color: #0f766e;
  padding: 10px 12px;
  font-size: 13px;
}

.overview-strip strong {
  display: block;
  font-size: 20px;
  color: #0f172a;
  margin-top: 4px;
}

.mini-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.mini-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

.card {
  padding: 13px;
  box-shadow: none;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #edf7f5;
  color: var(--brand-strong);
  font-size: 12px;
}

.danger {
  color: var(--danger);
}

.ok {
  color: var(--ok);
}

.hidden {
  display: none !important;
}

.action-toast {
  display: none !important;
}

.platform-only {
  display: none !important;
}

body.total-control-shell .platform-only:not([hidden]) {
  display: block !important;
}

body.total-control-shell .company-only {
  display: none !important;
}

.log {
  display: none;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  background: #0f172a;
  color: #d1e7dd;
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.mobile-shell {
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--mobile-tabbar-height);
  overflow: hidden;
  background: #fff;
}

.mobile-shell,
.mobile-shell * {
  min-width: 0;
}

.mobile-header {
  background: #101828;
  color: #fff;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.mobile-main {
  width: 100%;
  max-width: 100vw;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
  display: grid;
  gap: 0;
  align-content: stretch;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

.mpage {
  width: 100%;
  max-width: 100vw;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
}

#m-chat,
#m-contacts {
  min-height: 0;
  height: 100%;
  display: grid;
  gap: 0;
  overflow: hidden;
  background: #fff;
}

#m-chat {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#m-contacts {
  grid-template-rows: auto auto minmax(0, 1fr);
}

#m-chat.hidden,
#m-contacts.hidden {
  display: none !important;
}

.mobile-tabs {
  position: static;
  height: var(--mobile-tabbar-height);
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  min-height: var(--mobile-tabbar-height);
  padding-bottom: 0;
  z-index: 60;
}

body.mobile-view-room .mobile-shell {
  grid-template-rows: minmax(0, 1fr);
}

body.mobile-view-room .mobile-tabs {
  display: none;
}

body.mobile-view-room .mobile-main {
  height: 100dvh;
  padding-bottom: 0;
}

.mobile-tabs button {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  min-height: 58px;
  padding: 6px 2px;
  white-space: nowrap;
  font-size: 11px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
}

.mobile-tabs .tab-icon {
  font-size: 17px;
  line-height: 1;
}

.mobile-tabs button.active {
  color: #0f766e;
  font-weight: 800;
  background: transparent;
}

.mobile-tabs button:active {
  color: #0b5f59;
}

.chat {
  display: grid;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
  padding: 4px;
}

.bubble {
  padding: 10px 12px;
  border-radius: 8px;
  background: #edf2f7;
  max-width: 78%;
  justify-self: start;
  cursor: pointer;
}

.bubble.self {
  background: #dff4ef;
  justify-self: end;
}

.bubble .meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.quote {
  border-left: 3px solid var(--brand);
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  max-width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 7px;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.replybar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
}

.replybar.active {
  display: flex;
}

.replybar button {
  padding: 4px 8px;
}

.replybar span {
  min-width: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.replybar .quote-clear {
  flex: 0 0 auto;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  color: var(--muted);
}

.composer {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar,
  .grid,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 14px;
  }
}

.action-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  max-width: min(360px, calc(100vw - 36px));
  padding: 10px 13px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
}

.action-toast.success {
  background: rgba(6, 118, 71, 0.94);
}

.action-toast.error {
  background: rgba(180, 35, 24, 0.94);
}

.action-toast {
  display: none !important;
}

.im-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 64px minmax(236px, 292px) minmax(0, 1fr) minmax(220px, 260px);
  background: #eef1f5;
  overflow: hidden;
}

body.total-control-shell .im-shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.total-control-shell .workbench {
  grid-column: 2;
}

body.total-control-shell #adminView {
  display: grid;
}

.rail {
  background: #1f2933;
  color: #fff;
  display: grid;
  grid-auto-rows: min-content;
  gap: 14px;
  justify-items: center;
  padding: 16px 10px;
}

.rail-logo,
.rail-btn,
.avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar.bot-avatar {
  background: linear-gradient(135deg, hsl(var(--avatar-hue, 292) 82% 58%), hsl(calc(var(--avatar-hue, 292) + 42) 78% 48%));
  color: #fff;
  font-weight: 800;
}

.avatar.friend-avatar,
.avatar.user-avatar {
  background: #dbeafe;
  color: #1d4ed8;
}

.identity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
  vertical-align: middle;
}

.identity-badge.bot {
  color: #0f766e;
  background: #d9f7ef;
}

.identity-badge.user {
  color: #475569;
  background: #eef2f6;
}

.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 700;
}

.rail-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: transparent;
  color: #d0d5dd;
  padding: 0;
}

.rail-btn.active,
.rail-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.session-pane {
  border-right: 1px solid var(--line);
  background: #f8fafc;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.pane-toggle {
  position: absolute;
  z-index: 45;
  width: 34px;
  height: 64px;
  padding: 0;
  border: 1px solid #b9c6d4;
  border-radius: 12px;
  background: #fff;
  color: #1f2937;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.18);
}

.pane-toggle:hover {
  background: #f2f7fb;
  color: var(--text);
  border-color: var(--brand);
}

.session-toggle {
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
}

.session-head {
  padding: 14px 14px 8px;
}

.searchbox {
  padding: 0 12px 10px;
}

.searchbox input {
  background: #eef2f6;
  border-color: transparent;
}

.session-list {
  min-height: 0;
  height: 100%;
  max-height: calc(100vh - 160px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 12px;
}

.session-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  text-align: left;
  padding: 10px 8px;
  border-radius: 8px;
}

.session-item.active,
.session-item:hover {
  background: #e6ebf1;
}

.session-item span:last-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.session-item strong,
.session-item em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-item em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 700;
  flex: none;
}

.avatar.large {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  font-size: 28px;
  margin: 0 auto;
}

.workbench {
  min-width: 0;
  min-height: 0;
  display: grid;
  background: #fff;
  overflow: hidden;
}

.im-view {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
}

#chatView {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.chat-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.chat-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.message-list {
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  padding: 20px 22px;
  background: #f5f7fa;
}

.message-list-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
}

.message-list-wrap > .message-list {
  min-height: 0;
}

.jump-latest {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 8;
  min-height: 32px;
  padding: 6px 11px;
  border-radius: 999px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.message-row.locating .message-bubble {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.favorite-preview {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  justify-items: end;
}

.favorite-preview .message-row {
  margin-bottom: 0;
}

.favorite-preview .favorite-row {
  width: min(760px, 100%);
}

.favorite-preview .favorite-row .message-stack {
  max-width: min(680px, 86%);
}

.favorite-preview.collapsed .favorite-bubble .message-content {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.favorite-preview.collapsed .favorite-bubble .chat-attachment {
  display: none;
}

.favorite-preview.collapsed .favorite-note {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.favorite-preview.expanded .favorite-bubble {
  max-height: min(58vh, 620px);
  overflow: auto;
}

.favorite-message-group {
  display: grid;
  gap: 10px;
}

.favorite-source {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.favorite-source button {
  min-height: 26px;
  padding: 4px 8px;
  font-size: 12px;
}

.message-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  align-items: start;
  overflow-anchor: none;
}

.message-row.self {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.message-row.self .avatar {
  grid-column: 2;
}

.message-row.self .message-stack {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-items: flex-end;
}

.message-row.self .message-bubble {
  background: #dff4ef;
}

.message-row.selected .message-bubble {
  outline: 2px solid var(--brand);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

.message-list.multi-selecting .message-row {
  grid-template-columns: 28px 36px minmax(0, 1fr);
  cursor: pointer;
}

.message-list.multi-selecting .message-row.self {
  grid-template-columns: minmax(0, 1fr) 36px 28px;
}

.message-list.multi-selecting .message-row::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 1.5px solid #98a2b3;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  background: #fff;
}

.message-list.multi-selecting .message-row.selected::before {
  content: "✓";
  display: grid;
  place-items: center;
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.message-list.multi-selecting .message-row.self::before {
  grid-column: 3;
}

.message-list.multi-selecting .message-row.self .avatar {
  grid-column: 2;
}

.message-list.multi-selecting .message-row.self .message-stack {
  grid-column: 1;
}

.multi-send-fields {
  display: contents;
}

.multi-send-fields.hidden {
  display: none !important;
}

.multi-send-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  z-index: 28;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e2ea;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  overflow-anchor: none;
}

.multi-send-panel:has(.multi-send-fields:not(.hidden)) {
  grid-template-columns: minmax(150px, 0.7fr) minmax(170px, 0.9fr) minmax(180px, 0.9fr) minmax(220px, 1.2fr) auto;
}

.multi-send-panel.multi-send-no-target:has(.multi-send-fields:not(.hidden)) {
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.2fr) auto;
}

.multi-send-panel strong {
  display: block;
  font-size: 15px;
}

.multi-send-panel textarea {
  min-height: 42px;
  max-height: 90px;
  resize: vertical;
}

.multi-send-panel .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mobile-multi-send-panel {
  left: 10px;
  right: 10px;
  bottom: 10px;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 8px;
  font-size: 13px;
}

.mobile-multi-send-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mobile-multi-send-close {
  width: 30px;
  height: 30px;
  min-width: 30px;
  font-size: 20px;
  line-height: 1;
}

.mobile-multi-send-panel.action-open {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  grid-template-columns: 1fr !important;
  width: min(90vw, 340px);
  max-height: min(70vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 90;
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 0 0 100vmax rgba(15, 23, 42, 0.28), 0 24px 70px rgba(15, 23, 42, 0.24);
}

.mobile-multi-send-panel.action-open.multi-send-no-target {
  max-height: none;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.mobile-multi-send-panel.action-open.multi-send-no-target textarea {
  height: 88px;
  max-height: 88px;
  resize: none;
}

body.mobile-share-dialog-open {
  overflow: hidden;
}

.mobile-multi-send-panel.action-open::before {
  display: none;
}

.mobile-multi-send-panel.action-open .multi-send-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  order: 2;
  width: 100%;
  min-width: 0;
}

.mobile-multi-send-panel.action-open #mobileFavoriteMultiSend,
.mobile-multi-send-panel.action-open #mobileForwardMultiSend,
.mobile-multi-send-panel.action-open #mobileShareMomentMultiSend,
.mobile-multi-send-panel.action-open #mobileShareCaseMultiSend {
  display: none;
}

.mobile-multi-send-panel.action-open .actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
  width: 100%;
  order: 3;
}

.mobile-multi-send-panel.action-open .mobile-multi-send-summary {
  order: 1;
}

.mobile-multi-send-back {
  width: 100%;
  margin-top: 2px;
}

.mobile-multi-send-panel.action-open .mobile-multi-send-summary .muted {
  display: none;
}

.mobile-multi-send-panel.action-open .mobile-multi-send-head {
  min-height: 30px;
}

.mobile-multi-send-panel.action-open label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-multi-send-panel.action-open select,
.mobile-multi-send-panel.action-open input,
.mobile-multi-send-panel.action-open textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 15px;
}

.mobile-multi-send-panel textarea {
  max-height: 76px;
}

.mobile-target-check-list {
  grid-template-columns: 1fr;
  max-height: 176px;
  overflow: auto;
  border: 1px solid #edf0f4;
  border-radius: 10px;
  padding: 6px;
  background: #fff;
}

.mobile-target-check-list .member-check-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  min-height: 36px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
  background: #fff;
}

.mobile-target-check-list .member-check-item input {
  justify-self: start;
  margin: 0;
}

.mobile-target-check-list .member-check-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-settings-company-admin {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mobile-settings-company-admin.hidden {
  display: none;
}

.mobile-settings-company-admin .panel {
  margin: 0;
}

.mobile-settings-company-admin .mobile-settings-company-head {
  display: none !important;
}

.mobile-multi-send-panel .actions {
  justify-content: stretch;
}

.mobile-multi-send-panel .actions button {
  flex: 1;
}

@media (max-width: 900px) {
  .multi-send-panel {
    grid-template-columns: 1fr;
  }
}

.message-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: min(680px, 78%);
  min-width: 0;
}

.message-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.message-row.self .message-meta-line {
  justify-content: flex-end;
}

.message-sender-name {
  max-width: min(360px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 700;
}

.message-time {
  flex: 0 0 auto;
  color: var(--muted);
}

.message-bubble {
  max-width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  line-height: 1.55;
}

.favorite-bubble {
  max-width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.55;
  cursor: pointer;
}

.favorite-bubble:hover {
  border-color: #b7c0cc;
}

.message-bubble:hover {
  border-color: #b7c0cc;
}

.message-context-menu,
.message-forward-menu {
  position: fixed;
  z-index: 140;
  background: rgba(17, 24, 39, 0.97);
  color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
}

.message-context-menu {
  width: 160px;
  display: grid;
}

.message-context-menu button,
.message-forward-menu button {
  min-height: 40px;
  border-radius: 0;
  background: transparent;
  color: #fff;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  padding: 8px 12px;
}

.message-context-menu button:hover,
.message-forward-menu button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.message-forward-menu {
  width: min(280px, calc(100vw - 24px));
  max-height: 260px;
  overflow: auto;
  display: grid;
}

.message-forward-menu button span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.message-favorite {
  padding: 2px 6px;
  min-height: 22px;
  border-radius: 5px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 12px;
}

.message-favorite.active {
  background: #fef7c3;
  color: #854d0e;
}

.message-content {
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

.bot-message-fold {
  min-width: 0;
}

.bot-message-fold.is-foldable.is-collapsed .message-content {
  max-height: var(--message-fold-height, 12.4em);
  overflow: hidden;
}

.message-fold-toggle {
  display: block;
  min-height: 30px;
  margin: 8px 0 0 auto;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
  line-height: 20px;
}

.message-fold-toggle:hover,
.message-fold-toggle:focus-visible {
  border-color: #2563eb;
  background: #eff6ff;
}

.message-fold-toggle[hidden] {
  display: none;
}

.message-bubble .message-content,
.message-bubble .message-content * {
  user-select: text;
  -webkit-user-select: text;
}

.mention-highlight {
  color: #2563eb;
  font-weight: 700;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 999px;
  padding: 1px 6px;
  white-space: nowrap;
}

.read-receipt {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.message-content h3,
.message-content h4 {
  margin: 8px 0 6px;
  font-size: 15px;
}

.message-content ul {
  margin: 6px 0;
  padding-left: 18px;
}

.message-content pre {
  max-width: 100%;
  overflow: auto;
  background: #101828;
  color: #e5e7eb;
  border-radius: 6px;
  padding: 9px;
  white-space: pre-wrap;
}

.chat-attachment {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  color: var(--brand-strong);
  max-width: 280px;
}

.share-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: min(360px, 100%);
  max-width: 100%;
  min-width: 0;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}

.share-card-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff3b93, #7c3aed);
  color: #fff;
  font-weight: 800;
}

.share-card-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}

.share-card-main strong,
.share-card-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-card-main span {
  color: var(--muted);
  font-size: 13px;
}

.mobile-select-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(15, 23, 42, 0.32);
}

.mobile-select-panel {
  width: min(88vw, 340px);
  max-height: min(64vh, 460px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.24);
  border: 1px solid #e5e7eb;
}

.mobile-select-head {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid #edf0f4;
}

.mobile-select-head strong {
  font-size: 14px;
  font-weight: 600;
}

.mobile-select-options {
  max-height: min(54vh, 400px);
  overflow: auto;
  padding: 4px 0;
}

.mobile-select-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border: 0;
  border-bottom: 1px solid #f0f2f5;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}

.mobile-select-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-select-option.active {
  color: var(--brand);
  font-weight: 600;
}

.mobile-native-select-hidden {
  display: none !important;
}

.mobile-styled-select-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #d9dee7;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
}

.mobile-styled-select-button::after {
  content: "⌄";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.chat-attachment img,
.chat-attachment video {
  width: min(280px, 100%);
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.chat-attachment.file {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #f8fafc;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.attachment-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  font-size: 12px;
}

.attachment-actions a,
.attachment-actions button {
  color: var(--brand);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
}

.attachment-actions a:hover,
.attachment-actions button:hover {
  text-decoration: underline;
}

.attachment-action {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  margin-left: 10px;
}

.file-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(15, 23, 42, 0.58);
  display: grid;
  place-items: center;
  padding: 22px;
}

.file-preview-modal.hidden {
  display: none;
}

.file-preview-panel {
  width: min(920px, 96vw);
  max-height: min(780px, 92vh);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.file-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.file-preview-head > div {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.file-preview-head a,
.file-preview-head button {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 10px;
  text-decoration: none;
}

.file-preview-body {
  min-height: 260px;
  overflow: auto;
  padding: 14px;
}

.file-preview-body img,
.file-preview-body video,
.file-preview-body iframe {
  width: 100%;
  max-height: 72vh;
  border: 0;
  object-fit: contain;
}

.file-preview-body iframe {
  min-height: 68vh;
}

.file-preview-body pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.6;
}

.im-composer {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  position: relative;
  z-index: 5;
  min-height: 70px;
}

.desktop-input-stack {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.im-composer textarea {
  height: 48px;
  min-height: 48px;
  max-height: min(260px, 42vh);
  border: 0;
  background: #f8fafc;
  resize: none;
  overflow-y: auto;
}

.desktop-input-stack .replybar {
  min-height: 30px;
  max-height: 52px;
  padding: 5px 8px;
  font-size: 12px;
}

.composer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  width: max-content;
}

.composer-actions button {
  min-width: 58px;
  white-space: nowrap;
}

.chat-file-button {
  width: auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 8px 11px;
  background: #e7eaef;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.chat-file-button input {
  display: none;
}

.attachment-draft {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
  margin: 0 0 6px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
}

.attachment-draft.hidden {
  display: none;
}

.attachment-draft span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-draft button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: #e8eef7;
  color: var(--text);
}

.mention-panel {
  position: absolute;
  left: 12px;
  right: 86px;
  bottom: calc(100% - 4px);
  max-height: min(66vh, 560px);
  overflow: auto;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.mention-search {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  gap: 6px;
  padding: 6px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.mention-search input {
  min-height: 34px;
  padding: 7px 9px;
}

.mention-results {
  display: grid;
  gap: 2px;
  max-height: calc(min(66vh, 560px) - 56px);
  overflow: auto;
}

.mention-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 8px;
  border-radius: 7px;
}

.mention-item:hover {
  background: #eef2f6;
}

.mention-item .avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.mention-type {
  color: var(--muted);
  font-size: 12px;
}

.profile-pane {
  border-left: 1px solid var(--line);
  background: #f8fafc;
  padding: 16px;
  display: grid;
  gap: 14px;
  align-content: start;
  position: relative;
  min-width: 0;
  overflow: auto;
}

.profile-toggle {
  left: -17px;
  top: 82px;
}

body.session-pane-collapsed .im-shell {
  grid-template-columns: 64px 24px minmax(0, 1fr) minmax(300px, 360px);
}

body.profile-pane-collapsed .im-shell {
  grid-template-columns: 64px minmax(236px, 292px) minmax(0, 1fr) 24px;
}

body.session-pane-collapsed.profile-pane-collapsed .im-shell {
  grid-template-columns: 64px 24px minmax(0, 1fr) 24px;
}

body.session-pane-collapsed .session-pane > :not(.session-toggle),
body.profile-pane-collapsed .profile-pane > :not(.profile-toggle) {
  display: none !important;
}

body.session-pane-collapsed .session-pane,
body.profile-pane-collapsed .profile-pane {
  padding: 0;
  overflow: visible;
}

body.session-pane-hidden-by-view .im-shell {
  grid-template-columns: 64px minmax(0, 1fr) minmax(300px, 360px);
}

body.session-pane-hidden-by-view.profile-pane-collapsed .im-shell {
  grid-template-columns: 64px minmax(0, 1fr) 24px;
}

body.profile-pane-hidden-by-view .im-shell,
body.session-pane-hidden-by-view.profile-pane-hidden-by-view .im-shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.session-pane-hidden-by-view .session-pane,
body.profile-pane-hidden-by-view .profile-pane {
  display: none !important;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.profile-card h3 {
  margin: 12px 0 4px;
}

.profile-pane .account-preferences-panel {
  display: none !important;
}

.profile-pane.group-profile-active .profile-card {
  display: none;
}

.profile-pane:not(.group-profile-active) .group-members-profile {
  display: none !important;
}

.group-members-profile {
  padding: 12px;
}

.group-members-profile summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
}

.group-members-profile .member-chip-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: min(68vh, 680px);
  overflow: auto;
  padding-right: 2px;
}

.group-members-profile .member-chip {
  width: 100%;
  border-radius: 8px;
  padding: 7px 8px;
  text-align: left;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.cap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.contact-grid {
  padding: 18px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-content: start;
  min-height: 0;
}

.contact-grid > .panel {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  align-content: start;
  max-height: calc(100vh - 96px);
  overflow: hidden;
}

.contact-grid > .panel > .list {
  max-height: none;
}

#contactsView {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

#contactsView .contacts-grid {
  height: 100%;
  overflow: hidden;
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1fr) minmax(260px, 1.25fr);
}

#contactsView .contacts-grid > .panel {
  height: 100%;
  max-height: none;
  overflow: hidden;
}

#contactsView .contacts-grid .list,
#contactsView .contacts-grid .request-list {
  align-content: start;
  grid-auto-rows: max-content;
}

#contactsView .contacts-grid .list {
  height: 100%;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
}

#contactsView .contacts-grid .session-item {
  min-height: 56px;
}

#adminView {
  grid-template-rows: auto auto auto auto;
  overflow: auto;
  align-content: start;
}

#adminView .contact-grid {
  overflow: visible;
  grid-auto-rows: max-content;
  align-items: start;
  min-height: auto;
}

#adminView .admin-grid,
#adminView .contact-grid {
  overflow: auto;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

#adminView .contact-grid > .panel,
#adminView .admin-grid > .panel {
  display: block !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  grid-template-rows: none !important;
}

#adminView .contact-grid > .panel > .list,
#adminView .admin-grid > .panel > .list {
  max-height: 280px;
  overflow: auto;
}

#adminView .admin-grid textarea,
#adminView .contact-grid textarea {
  min-height: 120px;
}

.moments-view {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.moments-compose {
  margin: 18px 18px 0;
  box-shadow: none;
  display: grid;
  gap: 10px;
}

.moment-compose-body {
  display: grid;
  gap: 12px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, max-content);
  gap: 2px;
  width: max-content;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f5;
}

.segmented button {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.moments-compose textarea {
  min-height: 72px;
}

.moment-media-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.upload-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.file-picker input {
  display: none;
}

.moment-list {
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.moment-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
}

.moment-card p {
  margin: 8px 0;
  line-height: 1.6;
}

.moment-media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 112px));
  gap: 6px;
  margin: 10px 0;
}

.moment-media-grid.count-1 {
  grid-template-columns: minmax(0, 240px);
}

.moment-media-grid.count-2,
.moment-media-grid.count-4 {
  grid-template-columns: repeat(2, minmax(0, 112px));
}

.moment-media {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0f172a;
  object-fit: cover;
  display: block;
}

.moment-media-previewable {
  cursor: zoom-in;
}

video.moment-media {
  aspect-ratio: 16 / 10;
}

.moment-media-grid.count-1 video.moment-media {
  aspect-ratio: 16 / 9;
}

.moment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.moment-card > div > p { white-space: pre-wrap; line-height: 1.65; color: #172033; }
.moment-icon-action { min-width: 30px; min-height: 28px; padding: 3px 7px; border: 0; border-radius: 5px; background: transparent; color: #667085; font-size: 14px; }
.moment-icon-action:hover { background: #eef2f6; color: #1d4ed8; }
.moment-icon-action.danger:hover { color: #b42318; background: #fff1f0; }
.moment-icon-action span { margin-left: 2px; font-size: 12px; }

.case-local-share { display:flex; align-items:center; gap:5px; font-size:12px; color:#667085; }
.case-local-share select { min-width:150px; max-width:230px; min-height:30px; padding:3px 6px; font-size:12px; }
.case-local-share .mobile-styled-select-button { min-width:150px; max-width:230px; min-height:30px; padding:3px 8px; font-size:12px; text-align:left; }

.comment-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.comment-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  justify-content: space-between;
}

.comment-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.82);
}

.media-preview-modal.hidden {
  display: none;
}

.media-preview-modal img {
  max-width: min(96vw, 1080px);
  max-height: 88vh;
  border-radius: 8px;
  object-fit: contain;
  background: #111827;
}

.media-preview-modal button {
  position: fixed;
  top: 18px;
  right: 18px;
  background: #fff;
  color: var(--text);
}

.form-modal {
  position: fixed;
  inset: 0;
  z-index: 82;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.48);
}

.form-modal.hidden {
  display: none;
}

.form-modal-panel {
  width: min(560px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 14px;
}

.form-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.form-modal-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.form-modal-head p {
  margin: 0;
}

.form-modal-panel select[multiple] {
  min-height: 132px;
}

.desktop-conversation-tool-modal {
  width: min(640px, 100%);
  max-height: min(760px, 88vh);
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.desktop-conversation-tool-modal > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.desktop-conversation-tool-modal > label input {
  min-height: 42px;
  padding: 9px 11px;
  font-size: 15px;
}

.desktop-group-invite-results,
.desktop-history-search-results {
  min-height: 120px;
  max-height: min(56vh, 500px);
  overflow-y: auto;
  overflow-x: hidden;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
}

.desktop-group-invite-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}

.desktop-group-invite-item > .avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
}

.desktop-group-invite-name strong,
.desktop-group-invite-name em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desktop-group-invite-name em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.desktop-group-invite-status {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.desktop-group-invite-status.joined { color: #14866d; }
.desktop-group-invite-status.pending { color: #b54708; }

.desktop-group-invite-item > button {
  min-width: 58px;
  min-height: 34px;
  padding: 6px 11px;
}

.desktop-history-search-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  gap: 5px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.desktop-history-search-item:hover {
  background: #f6f8fb;
}

.desktop-history-search-item strong {
  font-size: 13px;
}

.desktop-history-search-item span {
  color: #475467;
  font-size: 13px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
}

.compact-label {
  display: grid;
  gap: 6px;
  padding: 6px 12px 10px;
  color: var(--muted);
  font-size: 12px;
}

.account-summary strong {
  font-size: 14px;
  color: var(--text);
}

.account-summary button {
  width: fit-content;
  padding: 6px 9px;
}

.quick-nickname-editor {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quick-nickname-editor input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.quick-nickname-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.compact-label select,
.mobile-user-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

.mobile-user-select {
  max-width: 78px;
  min-height: 30px;
  font-size: 12px;
}

.mobile-session-list {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 100%;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 0;
  border-radius: 0;
  padding: 0 10px 0;
}

.mobile-session-list,
.mobile-session-list .session-item,
.mobile-message-list,
.mobile-message-list .message-row,
.mobile-message-list .message-stack,
.mobile-message-list .message-bubble,
.mobile-composer,
.mobile-input-stack,
.mobile-room,
.message-list-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.mobile-session-list .session-item {
  overflow: hidden;
}

.mobile-session-list .session-item > *,
.mobile-message-list .message-row > *,
.mobile-message-list .message-stack > *,
.mobile-message-list .message-bubble > * {
  min-width: 0;
  max-width: 100%;
}

.mobile-contact-section .member-field select,
.mobile-contact-section .member-field input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 13px;
}

.mobile-shell,
.mobile-main,
.mpage {
  max-width: 100vw;
  min-width: 0;
  overflow-x: hidden;
}

.mobile-session-list .session-item,
.mobile-contact-section .session-item {
  max-width: 100%;
  box-sizing: border-box;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
}

.mobile-session-list .session-item > span:nth-child(2),
.mobile-contact-section .session-item > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
  overflow: hidden;
}

.mobile-session-list .session-item strong,
.mobile-session-list .session-item em,
.mobile-contact-section .session-item strong,
.mobile-contact-section .session-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-session-list .session-item time,
.mobile-contact-section .session-item time {
  max-width: 56px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  justify-self: end;
}

.mobile-room {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 0;
  height: 100%;
  min-height: 0;
  position: relative;
  padding: 0;
  background: #f3f4f7;
}

.mobile-room > .row:first-child {
  min-height: 34px;
  gap: 8px;
  align-items: center;
}

.mobile-room > .row:first-child h3 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.2;
}

.mobile-room > .row:first-child .muted {
  font-size: 11px;
  line-height: 1.2;
}

.mobile-room .header-actions {
  gap: 5px;
  justify-content: flex-end;
}

.mobile-room .header-actions button {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
}

.mobile-message-list {
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  overflow-anchor: none;
}

.mobile-room .replybar {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.mobile-room .replybar:empty {
  display: none;
}

#mobileInput {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-height: min(220px, 38vh);
  height: 38px;
  resize: none;
  padding: 8px 10px;
  line-height: 1.45;
  overflow-y: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

#mobileInput:focus,
#mobileInput:not(:placeholder-shown) {
  min-height: 48px;
}

.mobile-room > .actions {
  flex-wrap: nowrap;
  gap: 6px;
  min-height: 32px;
}

.mobile-room > .actions button,
.mobile-room > .actions .chat-file-button {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap;
}

.mobile-room > .actions #mobileSend {
  margin-left: auto;
  min-width: 58px;
}

.mobile-main .panel > .list {
  max-height: min(46vh, 460px);
  overflow: auto;
  overscroll-behavior: contain;
}

#m-contacts .panel {
  min-height: 0;
  overflow: hidden;
}

.mobile-contact-home {
  display: grid;
  gap: 0;
  background: #fff;
}

.contact-entry,
.mobile-contact-detail-head {
  width: 100%;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: #fff;
  color: var(--text);
  border: 0;
  border-bottom: 1px solid #edf0f4;
  border-radius: 0;
  padding: 16px 14px;
  box-shadow: none;
}

.contact-entry:hover {
  background: #f8fafc;
}

.contact-entry strong,
.contact-entry em {
  display: block;
}

.contact-entry em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  margin-top: 3px;
}

.mobile-contact-detail-head {
  grid-template-columns: auto 1fr;
  box-shadow: none;
}

.mobile-contact-section {
  max-height: calc(100vh - 170px);
  overflow: auto !important;
}

.mobile-admin-fold {
  padding: 0;
  overflow: hidden;
  border: 1px solid #edf0f4;
  border-radius: 10px;
  background: #fff;
}

.mobile-admin-fold summary {
  min-height: 50px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  color: #475569;
  list-style: none;
}

.mobile-admin-fold summary::-webkit-details-marker {
  display: none;
}

.mobile-admin-fold summary::after {
  content: "";
  float: right;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.mobile-admin-fold[open] summary {
  border-bottom: 1px solid var(--line);
}

.mobile-admin-fold[open] summary::after {
  content: "";
}

.mobile-admin-fold > :not(summary) {
  margin: 12px;
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
}

.mobile-admin-fold > .list {
  max-height: min(52vh, 480px);
  overflow: auto;
}

.mobile-page-head {
  min-height: 48px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid #edf0f4;
  text-align: center;
}

.mobile-page-head strong {
  font-size: 17px;
  line-height: 1.2;
}

.icon-button,
.composer-icon {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 18px;
}

.icon-button:hover,
.composer-icon:hover {
  background: #eef2f6;
  color: var(--text);
}

.mobile-search-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 10px 12px;
  padding: 0 12px;
  min-height: 42px;
  border-radius: 12px;
  background: #eef2f6;
  color: var(--muted);
}

.mobile-search-row input {
  border: 0;
  background: transparent;
  padding: 8px 0;
}

.mobile-search-icon,
.mobile-search-glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  color: var(--text);
}

.mobile-search-icon::before,
.mobile-search-glyph::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 999px;
  display: block;
}

.mobile-search-icon::after,
.mobile-search-glyph::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(9px, 8px) rotate(45deg);
}

.mobile-company-headline.hidden {
  display: none !important;
}

.mobile-company-headline {
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid #edf0f4;
}

.mobile-company-headline strong,
.mobile-company-headline em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-company-headline em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.session-item {
  position: relative;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  border-radius: 0;
  border-bottom: 1px solid #edf0f4;
}

.session-item time {
  align-self: start;
  color: var(--muted);
  font-size: 12px;
  padding-top: 2px;
  white-space: nowrap;
}

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: #ef4444;
  vertical-align: middle;
}

.pin-mark {
  display: inline-block;
  margin-right: 3px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fff1f0;
  color: #b42318;
  font-size: 10px;
  line-height: 1.2;
}

.mute-mark {
  display: inline-block;
  margin-right: 3px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #eef2f6;
  color: #667085;
  font-size: 10px;
  line-height: 1.2;
}

.short-link {
  display: inline-flex;
  max-width: min(100%, 260px);
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef8f6;
  color: var(--brand);
  text-decoration: none;
  vertical-align: baseline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-message-list .short-link,
.mobile-message-list .share-card,
.mobile-input-stack .replybar {
  max-width: 100%;
}

.mobile-room-head {
  min-height: 48px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  padding: 0 10px;
  background: #fff;
  border-bottom: 1px solid #edf0f4;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}

.mobile-room-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.mobile-room-back {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  background: transparent;
  color: var(--text);
}

#mobileRoomMore {
  width: 20px;
  height: 20px;
  min-height: 20px;
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 800;
}

.mobile-room-head .muted {
  font-size: 11px;
  line-height: 1.2;
}

.mobile-room-drawer {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  max-height: none;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  font-size: 15px;
  max-width: 100%;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.mobile-room-drawer-head {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 74px;
  align-items: center;
  min-height: calc(56px + env(safe-area-inset-top));
  margin: 0;
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: 1px solid #edf0f4;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.mobile-room-drawer-toolbar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: 48px;
  padding: 0 8px;
  border-bottom: 1px solid #edf0f4;
  background: #fff;
}

.mobile-room-drawer-toolbar button {
  min-width: 0;
  min-height: 48px;
  padding: 0 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #344054;
  font-size: clamp(10px, 3vw, 13px);
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.mobile-room-drawer-toolbar button:active,
.mobile-room-drawer-toolbar button:hover {
  background: #f5f7fa;
  color: var(--brand);
}

.mobile-room-drawer-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 8px 16px max(24px, env(safe-area-inset-bottom));
}

.mobile-room-drawer-head strong {
  display: block;
  min-width: 0;
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-room-drawer-back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  justify-self: start;
}

.mobile-room-drawer-back > span {
  font-size: 30px;
  line-height: 1;
}

.mobile-room-drawer-head-spacer {
  width: 74px;
}

body.mobile-room-drawer-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flat-action,
.mobile-settings-row {
  width: 100%;
  min-height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0;
  border: 0;
  border-top: 1px solid #edf0f4;
  background: transparent;
  color: var(--text);
  padding: 12px 4px;
  text-align: left;
  font-size: 15px;
}

.mobile-settings-row span {
  font-weight: 800;
  font-size: 15px;
}

.flat-action:hover,
.mobile-settings-row:hover {
  background: #f8fafc;
  color: var(--text);
}

.mobile-room-member-panel {
  border-top: 0;
  padding-top: 2px;
  margin-top: 0;
}

.mobile-room-member-title {
  width: 100%;
  min-height: 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 12px 4px;
  font-size: 16px;
  text-align: left;
}

.mobile-room-member-title > button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #edf3ff;
  color: #2563eb;
  font-size: 19px;
  font-weight: 800;
}

.mobile-room-invite-panel {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  background: #f8fafc;
}

.mobile-room-invite-search input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid #d0d5dd;
  border-radius: 7px;
  background: #fff;
  font-size: 14px;
  box-sizing: border-box;
}

.mobile-room-invite-results {
  display: grid;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 8px;
  overscroll-behavior: contain;
}

.mobile-room-invite-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 50px;
  padding: 7px 2px;
  border-bottom: 1px solid #e8edf2;
}

.mobile-room-invite-item > .avatar {
  width: 34px;
  height: 34px;
  min-width: 34px;
}

.mobile-room-invite-name strong,
.mobile-room-invite-name em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-room-invite-name em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.mobile-room-invite-status {
  color: #667085;
  font-size: 12px;
  white-space: nowrap;
}

.mobile-room-invite-status.joined { color: #14866d; }
.mobile-room-invite-status.pending { color: #b54708; }

.mobile-room-invite-item > button {
  min-width: 48px;
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
}

.mobile-room-members {
  display: grid;
  max-height: none;
  overflow: visible;
  margin: 4px 0 14px;
}

.room-member {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid #edf0f4;
  min-height: 48px;
  padding: 9px 0;
  text-align: left;
  font-size: 14px;
}

#m-moments .moment-list {
  padding: 0;
  gap: 0;
  background: #fff;
}

#m-moments .moment-card {
  position: relative;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  padding: 16px 14px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  border-radius: 0;
}

#m-moments .moment-card > .avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
}

#m-moments .moment-card > div:last-child {
  min-width: 0;
}

#m-moments .moment-card > div > p {
  margin: 7px 0 10px;
  font-size: 16px;
  line-height: 1.65;
  color: #172033;
}

#m-moments .moment-meta-row {
  position: relative;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: #98a2b3;
  font-size: 12px;
}

#m-moments .moment-more-button {
  width: 27px;
  height: 23px;
  min-height: 23px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #f2f4f7;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

#m-moments .moment-action-menu {
  position: absolute;
  right: 40px;
  bottom: 2px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(2, 86px);
  width: 172px;
  max-width: calc(100vw - 92px);
  overflow: hidden;
  border-radius: 6px;
  background: #4c5158;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
}

#m-moments .moment-action-menu.hidden {
  display: none;
}

#m-moments .moment-action-menu button {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 7px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

#m-moments .moment-action-menu button:last-child {
  border-right: 0;
}

#m-moments .moment-action-menu button.danger {
  color: #ffd4cf;
}

#m-moments .moment-comment-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-top: 8px;
}

#m-moments .moment-comment-composer.hidden {
  display: none;
}

#m-moments .mobile-comment-input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}

#m-moments .mobile-comment-moment {
  min-width: 58px;
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 6px;
}

#m-moments .mobile-cancel-comment {
  min-width: 52px;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 6px;
}

#m-moments .comment-list {
  gap: 5px;
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 4px;
  background: #f5f6f8;
  color: #344054;
  font-size: 13px;
}

#m-moments .moment-like-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #576b95;
  overflow-wrap: anywhere;
}

#m-moments .moment-like-summary > span {
  flex: 0 0 auto;
  font-size: 12px;
}

.room-member strong,
.room-member em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-member em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.mobile-composer {
  position: relative;
  display: flex;
  align-items: end;
  gap: 5px;
  padding: 8px 8px 10px;
  background: #f6f7f9;
  border-top: 1px solid #e5e7eb;
  max-width: 100%;
  overflow: visible;
  z-index: 120;
}

.mobile-input-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 5px;
}

.mobile-composer #mobileInput {
  width: 100%;
}

.mobile-composer .composer-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 50%;
}

.mobile-send-button {
  flex: 0 0 auto;
  min-width: 44px;
  height: 32px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  background: #d1d5db;
  color: #fff;
  font-size: 13px;
}

.mobile-send-button.active {
  background: var(--brand);
}

.mobile-input-stack .replybar {
  width: 100%;
  min-height: 28px;
  max-height: 48px;
  padding: 5px 7px;
  font-size: 11px;
  line-height: 1.35;
  border-radius: 8px;
  background: #fff;
}

.mobile-input-stack .replybar span {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.mobile-input-stack .replybar button {
  flex: 0 0 auto;
}

.mobile-plus-menu {
  position: fixed;
  right: 12px;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 260;
  width: min(72vw, 260px);
  max-height: 52vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.mobile-plus-menu label {
  min-height: 38px;
  display: grid;
  place-items: center start;
  padding: 6px 8px;
  color: var(--text);
  border-bottom: 1px solid #edf0f4;
  font-weight: 700;
}

.mobile-plus-menu label:last-child {
  border-bottom: 0;
}

.mobile-plus-menu input[type="file"] {
  display: none;
}

.mobile-plus-menu > button {
  min-height: 38px;
  width: 100%;
  display: grid;
  place-items: center start;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #edf0f4;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.mobile-plus-menu > button:hover {
  background: #f3f6f9;
}

.mobile-history-search {
  display: grid;
  gap: 8px;
  border-top: 1px solid #edf0f4;
  padding: 8px 0 2px;
}

.mobile-history-search input {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 14px;
}

.mobile-history-search-results {
  display: grid;
  gap: 0;
  max-height: 260px;
  overflow: auto;
}

.history-search-item {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}

.history-search-item span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-room .mention-panel {
  left: 10px;
  right: 10px;
  bottom: 58px;
  width: auto;
  max-height: min(66vh, 560px);
}

.mobile-room .mention-results {
  max-height: calc(min(66vh, 560px) - 64px);
}

.message-avatar {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: #dbeafe;
}

.mobile-message-menu {
  position: fixed;
  z-index: 120;
  width: 180px;
  display: grid;
  background: rgba(17, 24, 39, 0.96);
  color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.24);
}

.mobile-message-menu button {
  min-height: 42px;
  border-radius: 0;
  background: transparent;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-message-menu button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mobile-plain-block,
.mobile-settings-section {
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  padding: 14px;
}

.mobile-pref-field {
  border-top: 1px solid #edf0f4;
  padding: 0;
}

.mobile-pref-field summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  list-style-position: inside;
}

.mobile-pref-field textarea {
  width: 100%;
  min-height: 120px;
  margin: 0 0 10px;
  font-size: 14px;
}

.mobile-moments-tools {
  padding: 8px 10px;
}

.mobile-moment-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.mobile-moment-toolbar strong {
  font-size: 16px;
}

.mobile-moment-search {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef2f6;
}

.mobile-moment-search input {
  border: 0;
  background: transparent;
  padding: 6px 0;
  font-size: 13px;
}

.mobile-moment-filter {
  margin-top: 6px;
  min-height: 30px;
}

.mobile-moment-filter button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 13px;
}

.member-current {
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.member-current summary {
  min-height: 38px;
  padding: 9px 10px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
  list-style: none;
}

.member-current summary::-webkit-details-marker {
  display: none;
}

.member-current summary::after {
  content: "v";
  float: right;
  color: var(--muted);
  font-size: 12px;
}

.member-current[open] summary::after {
  content: "^";
}

.member-current .member-chip-list {
  max-height: min(48vh, 420px);
  padding: 8px;
  border-top: 1px solid #edf0f4;
}

.mobile-admin-fold label:has(input[type="checkbox"]),
.mobile-admin-fold .check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.mobile-admin-fold label > input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
}

.mobile-profile-hero {
  min-height: 150px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 24px 18px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(236, 72, 153, 0.18)),
    #fff;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid #edf0f4;
}

.mobile-profile-hero h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.mobile-profile-hero p,
.mobile-settings-row em {
  margin: 0;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

/* 消息页添加入口：覆盖通用 icon-button 尺寸，保持参考图中的正圆与居中十字。 */
@media (max-width: 760px) {
  #mobileContactAdd.mobile-create-circle {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    box-sizing: border-box;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1.25px solid #171717;
    border-radius: 50%;
    color: #171717;
    font-size: 0;
    line-height: 0;
  }

  #mobileContactAdd.mobile-create-circle::before,
  #mobileContactAdd.mobile-create-circle::after {
    width: 8px;
    height: 1.25px;
    border-radius: 99px;
  }
}

.mobile-settings-panel {
  border-top: 1px solid #edf0f4;
  margin-top: 8px;
  padding-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.mobile-settings-item,
.profile-kv {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f4;
}

.mobile-settings-item span,
.profile-kv span {
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.mobile-settings-item strong,
.profile-kv strong,
.mobile-settings-panel .flat-action {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
}

.danger-text {
  color: var(--danger);
}

@media (max-width: 1000px) {
  .im-shell {
    grid-template-columns: 56px minmax(210px, 32vw) minmax(0, 1fr);
  }

  .profile-pane {
    display: none;
  }
}

@media (max-width: 1180px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (min-width: 1001px) and (max-width: 1280px) {
  .im-shell {
    grid-template-columns: 64px minmax(240px, 292px) minmax(0, 1fr);
  }

  .profile-pane {
    display: none;
  }
}

@media (max-width: 760px) {
  .im-shell {
    grid-template-columns: 52px minmax(180px, 36vw) minmax(0, 1fr);
  }

  .session-list {
    max-height: calc(100vh - 152px);
  }

  .admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chat-head {
    min-height: 54px;
    padding: 8px 10px;
  }

  .chat-head h2 {
    font-size: 15px;
  }

  .message-list {
    padding: 14px 12px;
  }

  .mobile-message-list .message-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
  }

  .mobile-message-list .message-row.self {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .mobile-message-list .message-stack {
    width: fit-content;
    max-width: min(82vw, calc(100vw - 66px));
  }

  .mobile-message-list .message-row.self .message-stack {
    justify-self: end;
  }

  .mobile-message-list .message-bubble,
  .mobile-message-list .favorite-bubble {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .mobile-message-list .message-sender-name {
    max-width: min(62vw, 260px);
  }

  .im-composer {
    grid-template-columns: minmax(0, 1fr);
  }

  .member-selects,
  .member-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .group-manage-details .member-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-manage-details .member-actions button {
    min-height: 36px;
    font-size: 12px;
  }

  .composer-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .mention-panel {
    right: 12px;
    bottom: 96px;
  }

  .moment-media-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .moment-media-grid.count-1 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .mobile-session-list.session-list {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: 0 !important;
  }

  .mobile-main #m-chat {
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  body.mobile-view-home .mobile-main {
    padding-bottom: 0 !important;
  }
}
