* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.panel { min-height: 100vh; }
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.92);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-modal.hidden { display: none !important; }

.im-dialog {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.im-dialog.hidden { display: none !important; }
body.group-info-open .im-dialog:not(#group-info-modal):not(.hidden),
body.group-info-open .im-dialog:not(#direct-chat-menu):not(.hidden) {
  z-index: 4000;
}
.im-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}
.im-dialog-card {
  position: relative;
  width: min(420px, 100%);
  padding: 22px 20px 18px;
  border-radius: 16px;
  background: #111827;
  border: 1px solid #334155;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 12px;
}
.im-dialog-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #f1f5f9;
}
.im-dialog-body {
  color: #94a3b8;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.im-dialog-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 14px;
}
.im-dialog-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}
.im-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.im-dialog-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
.im-dialog-btn-primary {
  background: #2563eb;
  color: #fff;
}
.im-dialog-btn-primary:hover { background: #1d4ed8; }
.im-dialog-btn-outline {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid #475569;
}
.im-dialog-btn-outline:hover { background: #1e293b; }
.im-dialog-btn-danger {
  background: #dc2626;
  color: #fff;
}
.im-dialog-btn-danger:hover { background: #b91c1c; }

.system-notice-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12000;
  max-width: min(92vw, 520px);
  padding: 14px 18px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 15px;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}
.system-notice-toast.hidden { display: none !important; }
html.theme-dark .system-notice-toast {
  background: #450a0a;
  border-color: #991b1b;
  color: #fecaca;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px 24px;
  border-radius: 16px;
  background: #111827;
  border: 1px solid #1f2937;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.login-card .brand h1 { margin: 0 0 8px; font-size: 32px; }
.login-card .brand p { color: #94a3b8; margin: 0 0 16px; }
.login-card { position: relative; }
.auth-lang-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
}
.auth-lang-wrap.hidden { display: none; }
.auth-lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
}
.auth-lang-toggle:hover { background: rgba(37, 99, 235, 0.08); }
.auth-lang-icon {
  width: 24px;
  height: 24px;
  display: block;
}
.auth-lang-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
}
.auth-lang-menu.hidden { display: none; }
.auth-lang-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: #1e293b;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.auth-lang-option:hover { background: #f1f5f9; }
.auth-lang-option.active {
  color: #2563eb;
  font-weight: 600;
}
.site-logo-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
}
.site-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.site-logo-wrap.hidden { display: none !important; }
.login-card #auth-form { display: grid; gap: 12px; }
.auth-panel { max-width: 420px; margin: 0 auto; padding: 48px 24px; }
.brand h1 { margin: 0 0 8px; font-size: 32px; }
.brand p { color: #94a3b8; margin-top: 0; }
.tabs { display: flex; gap: 8px; margin: 24px 0 12px; }
.tabs button { flex: 1; background: #1e293b; color: #cbd5e1; border: 1px solid #334155; padding: 10px; border-radius: 10px; cursor: pointer; }
.tabs button.active { background: #2563eb; color: white; border-color: #2563eb; }
#auth-form { display: grid; gap: 12px; }
#auth-form input, .search-box input, .group-box input, .wx-input-wrap textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #334155; background: #1e293b; color: #f8fafc;
  font-size: 16px;
}
#auth-form button, #create-group-btn, #logout-btn, #rename-group-btn, #announcement-save, .msg-actions button {
  border: none; border-radius: 10px; padding: 8px 12px; cursor: pointer; background: #2563eb; color: white;
}
.error { color: #f87171; min-height: 20px; }
#main-view {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.sidebar { background: #111827; border-right: 1px solid #1f2937; display: flex; flex-direction: column; min-height: 0; overflow: hidden; height: 100%; }
.sidebar-header, .search-box, .group-box { padding: 16px; border-bottom: 1px solid #1f2937; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sidebar-header small { color: #94a3b8; display: block; }
.sidebar-header button { font-size: 12px; padding: 6px 10px; }
#notify-toggle { background: #334155; }
.group-box { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.friend-box { padding: 0 16px 12px; border-bottom: 1px solid #1f2937; flex-shrink: 0; }
.section-label { font-size: 12px; color: #64748b; margin-bottom: 8px; font-weight: 600; }
.friend-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.friend-item {
  padding: 10px;
  border-radius: 10px;
  background: #1f2937;
  cursor: pointer;
  min-width: 0;
}
.friend-item:hover { background: #273449; }
.friend-item strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-item small {
  display: block;
  color: #64748b;
  font-size: 11px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.friend-body { flex: 1; min-width: 0; }
.list-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  line-height: 44px;
  text-align: center;
  flex-shrink: 0;
  overflow: hidden;
}
.list-avatar.has-image {
  background: #1f2937;
  font-size: 0;
  line-height: 0;
}
.list-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.friend-empty { color: #64748b; font-size: 13px; padding: 8px 0; grid-column: 1 / -1; }
#conversation-list { overflow-y: auto; flex: 1; }
.conv-item { padding: 14px 16px; border-bottom: 1px solid #1f2937; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.conv-item:hover, .conv-item.active { background: #1f2937; }
.conv-item.has-unread .conv-body strong { font-weight: 700; }
.conv-body { flex: 1; min-width: 0; }
.conv-item small { color: #94a3b8; display: block; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-badge {
  flex-shrink: 0;
  -webkit-flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}
.conv-muted {
  font-size: 12px;
  opacity: 0.65;
  margin-right: 2px;
}
.sidebar-user { position: relative; flex: 1; min-width: 0; overflow: visible; }
.total-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  box-sizing: border-box;
  z-index: 5;
  pointer-events: none;
}
.online-dot { color: #4ade80; margin-right: 4px; }
.chat-area { display: flex; flex-direction: column; background: #0b1220; min-height: 0; height: 100%; overflow: hidden; }
.chat-header { padding: 16px 20px; border-bottom: 1px solid #1f2937; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; flex-shrink: 0; }
.chat-header-main { flex: 1; min-width: 0; }
.chat-header-main h2 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: #1e293b;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-header small { color: #94a3b8; }
.chat-header small.status-online { color: #22c55e; }
#group-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.announcement-panel {
  padding: 12px 20px;
  background: #172554;
  border-bottom: 1px solid #1e3a8a;
  flex-shrink: 0;
}
.announcement-head { font-weight: 700; color: #bfdbfe; margin-bottom: 8px; }
.announcement-view { color: #dbeafe; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.announcement-edit { display: grid; gap: 8px; margin-top: 8px; }
.announcement-edit textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #3b82f6;
  background: #0f172a; color: #fff; resize: vertical;
}
.announcement-edit button { width: fit-content; }
.invite-panel {
  padding: 12px 20px;
  background: #0f172a;
  border-bottom: 1px solid #1f2937;
  flex-shrink: 0;
}
.invite-head { font-weight: 700; color: #cbd5e1; margin-bottom: 8px; }
.invite-panel input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid #334155;
  background: #1e293b; color: #fff;
}
.call-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.call-actions button { background: #059669; border: none; color: #fff; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.call-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: grid; place-items: center; z-index: 1000;
}
.call-card {
  width: min(520px, 92vw); background: #111827; border: 1px solid #334155; border-radius: 16px; padding: 20px;
  display: grid; gap: 12px; text-align: center;
}
.call-card video { width: 100%; max-height: 220px; background: #000; border-radius: 10px; }
.call-card video.hidden { display: none; }
#call-remote-audio, .call-remote-sink { position: absolute; width: 1px; height: 1px; opacity: 0.01; pointer-events: none; overflow: hidden; }
#call-unmute { background: #f59e0b; color: #111; border: none; border-radius: 999px; padding: 10px 16px; cursor: pointer; font-size: 15px; }
.call-btns { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.call-btns button { border: none; border-radius: 999px; padding: 10px 18px; cursor: pointer; color: #fff; }
#call-accept { background: #059669; }
#call-decline, #call-hangup { background: #dc2626; }
.member-bar { padding: 10px 20px; border-bottom: 1px solid #1f2937; display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.member-chip { background: #1e293b; border: 1px solid #334155; border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.member-chip.owner { border-color: #f59e0b; color: #fbbf24; }
.member-chip.admin { border-color: #38bdf8; color: #7dd3fc; }
#chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; overflow: hidden; }
#chat-panel.hidden { display: none !important; }
.chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.group-side-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e5e7eb;
  background: #f7f7f7;
  overflow-y: auto;
  min-height: 0;
}
.group-side-panel.hidden { display: none !important; }
.icon-btn.active { background: #dbeafe; color: #2563eb; }
html.theme-dark .icon-btn.active { background: #1e3a8a; color: #93c5fd; }
.group-side-block {
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.group-side-block-grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: none;
}
.group-side-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
}
.group-side-block-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
.group-side-block-title em {
  font-style: normal;
  font-weight: 600;
  color: #6b7280;
}
.group-side-head-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  flex-shrink: 0;
}
.group-side-head-btn svg { width: 18px; height: 18px; }
.group-side-head-btn:hover { background: #ececec; color: #374151; }
.group-side-head-btn.active { background: #e5e7eb; color: #111827; }
.group-side-block-body { padding: 0 16px 14px; }
.group-announce-text {
  font-size: 13px;
  line-height: 1.55;
  color: #4b5563;
  white-space: pre-wrap;
  word-break: break-word;
}
.group-announce-text.is-empty { color: #9ca3af; }
.group-announce-edit { display: grid; gap: 8px; }
.group-announce-edit textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  font-size: 13px;
  resize: vertical;
  min-height: 72px;
}
.group-announce-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.group-announce-edit-actions .btn-ghost {
  border: none;
  background: transparent;
  color: #6b7280;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.group-announce-edit-actions .btn-ghost:hover { background: #ececec; }
.group-announce-edit-actions button:last-child {
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  background: #07c160;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.group-member-search-wrap {
  padding: 0 12px 10px;
  display: grid;
  gap: 8px;
}
.group-member-search-wrap input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  font-size: 13px;
}
.group-invite-wrap { display: grid; gap: 6px; }
.group-member-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.group-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.group-member-row:hover { background: #ececec; }
.group-member-row-actionable { cursor: pointer; }
.group-member-row.active { background: #e5e7eb; }
.group-member-avatar {
  width: 36px;
  height: 36px;
  font-size: 14px;
  flex-shrink: 0;
}
.group-member-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.group-member-name {
  font-size: 14px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-member-sub {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-member-badge {
  flex-shrink: 0;
  font-size: 11px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
}
.group-member-badge.owner {
  background: #ffedd5;
  color: #ea580c;
}
.group-member-badge.admin {
  background: #dbeafe;
  color: #2563eb;
}
.group-member-empty {
  padding: 24px 16px;
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
}
.member-action-menu {
  position: fixed;
  z-index: 1200;
  min-width: 220px;
  max-width: min(280px, calc(100vw - 16px));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  padding: 6px 0;
}
.member-action-menu.hidden { display: none !important; }
.member-action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 11px 16px;
  font-size: 14px;
  color: #111827;
  cursor: pointer;
}
.member-action-item:hover { background: #f3f4f6; }
.member-action-item.danger { color: #dc2626; }
.member-action-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #64748b;
}
.member-action-item.danger .member-action-icon { color: #dc2626; }
.member-action-icon svg { width: 18px; height: 18px; }
.member-action-label { flex: 1; min-width: 0; }
.member-action-chevron { color: #9ca3af; font-size: 18px; line-height: 1; }
.member-action-sep {
  height: 1px;
  background: #eef2f7;
  margin: 4px 0;
}
.group-member-badge.muted {
  background: #fef3c7;
  color: #b45309;
}
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.msg { max-width: 70%; width: fit-content; padding: 10px 14px; border-radius: 14px; background: #1e293b; word-break: break-word; align-self: flex-start; }
.msg.me { align-self: flex-end; background: #2563eb; }
.msg.msg-media {
  padding: 4px;
  max-width: min(220px, 72vw);
  background: #1e293b;
}
.msg.me.msg-media { background: #2563eb; }
.msg.msg-media .meta { display: none; }
.msg.msg-media .body { line-height: 0; }
.msg.msg-media .body img {
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}
.msg.msg-media .body.sticker-msg img { max-width: 160px; }
.msg.msg-media .msg-actions { margin-top: 4px; text-align: right; }
.msg.msg-media.me .read-tag {
  display: block;
  text-align: right;
  font-size: 11px;
  opacity: 0.75;
  margin-top: 4px;
  line-height: 1.2;
}
.msg.call-log { max-width: 82%; font-size: 13px; border: 1px dashed #475569; background: #1e293b; }
.msg.me.call-log { background: #1d4ed8; border-color: #60a5fa; }
.msg.call-log .call-log-text { color: #e2e8f0; }
.msg .meta { font-size: 12px; opacity: 0.75; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; }
.msg .body img { max-width: min(240px, 100%); border-radius: 10px; display: block; }
.msg .body.text-body { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg.msg-voice,
.msg.msg-voice .body.voice-msg {
  background: transparent;
  padding: 0;
}
.msg-voice .body.voice-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  max-width: min(220px, 100%);
  padding: 8px 10px;
  border-radius: 10px;
  background: #1e293b;
}
.msg.me.msg-voice .body.voice-msg { background: #2563eb; }
.voice-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: inherit;
  cursor: pointer;
  flex: 0 0 auto;
}
.voice-play-icon { font-size: 12px; line-height: 1; }
.voice-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 36px;
}
.voice-wave i {
  display: block;
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.72;
}
.voice-wave i:nth-child(2) { height: 14px; }
.voice-wave i:nth-child(3) { height: 18px; }
.voice-wave i:nth-child(4) { height: 12px; }
.voice-wave i:nth-child(5) { height: 16px; }
.voice-duration {
  font-size: 13px;
  font-weight: 600;
  flex: 0 0 auto;
  min-width: 24px;
  text-align: right;
}
.voice-audio {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
.msg.msg-red-packet {
  max-width: min(220px, 78vw);
  padding: 8px;
  background: transparent;
}
.msg.me.msg-red-packet { background: transparent; }
.msg.msg-red-packet .body.red-packet-card {
  display: block;
  width: 100%;
  min-width: 180px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  background: linear-gradient(135deg, #e85d4c 0%, #d84332 100%);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.red-packet-card-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px 8px;
}
.red-packet-icon { font-size: 22px; line-height: 1; }
.red-packet-greeting {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.red-packet-footer {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.82);
  background: rgba(0,0,0,0.12);
}
.msg.msg-transfer {
  max-width: min(220px, 78vw);
  padding: 8px;
  background: transparent;
}
.msg.me.msg-transfer { background: transparent; }
.msg.msg-transfer .body.transfer-card {
  display: block;
  width: 100%;
  min-width: 160px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  background: linear-gradient(135deg, #fff3d6 0%, #ffe8a3 100%);
  color: #8b6914;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.transfer-card-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px 8px;
}
.transfer-icon {
  font-size: 18px;
  line-height: 1;
  color: #d4a017;
  font-weight: 700;
}
.transfer-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.transfer-footer {
  display: block;
  padding: 6px 12px;
  font-size: 12px;
  color: rgba(139,105,20,0.82);
  background: rgba(0,0,0,0.06);
}
.msg.recalled { opacity: 0.7; font-style: italic; }
.msg-actions { margin-top: 6px; }
.msg-actions button { font-size: 12px; padding: 4px 8px; background: rgba(255,255,255,0.15); }
.read-tag { font-size: 11px; opacity: 0.8; }
.mute-bar {
  flex-shrink: 0;
  padding: 14px 16px;
  text-align: center;
  font-size: 14px;
  color: #94a3b8;
  background: #1a1a1a;
  border-top: 1px solid #2a2a2a;
  user-select: none;
}
.composer {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #1a1a1a;
  border-top: 1px solid #2a2a2a;
}
.wx-panel {
  padding: 16px 12px 8px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
}
.wx-panel.plus-menu {
  padding: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-bottom: none;
}
.wx-panel.hidden { display: none; }
.plus-anchor { position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 2px; }
.plus-menu {
  position: absolute;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: calc(100% + 12px);
  min-width: 156px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  padding: 6px;
  z-index: 60;
  overflow: hidden;
}
.plus-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.plus-menu-item svg { width: 20px; height: 20px; flex-shrink: 0; stroke-linecap: round; stroke-linejoin: round; color: #475569; }
.plus-menu-item:hover { background: #f1f5f9; }
.plus-menu-item:active { background: #e2e8f0; }
.composer-inner-btn.active,
.wx-plus-btn.active { background: rgba(148, 163, 184, 0.25); border-radius: 50%; }
.wx-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
}
.wx-panel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: #d1d5db;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
}
.wx-panel-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: #2a2a2a;
  display: grid;
  place-items: center;
  font-size: 26px;
}
.wx-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #1a1a1a;
}
.wx-side-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  padding: 0;
}
.wx-plus-btn {
  font-size: 28px;
  font-weight: 300;
}
.wx-input-wrap {
  flex: 1;
  min-width: 0;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  min-height: 38px;
  display: flex;
  align-items: flex-end;
  padding: 0 10px;
}
.wx-input-wrap textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: #f9fafb;
  font-size: 16px;
  outline: none;
  padding: 8px 0;
  resize: none;
  min-height: 22px;
  max-height: 120px;
  line-height: 1.45;
  font-family: inherit;
  overflow-y: auto;
}
.wx-hold-talk {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: none;
  border-radius: 6px;
  background: #2a2a2a;
  color: #e5e7eb;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.wx-hold-talk.hidden { display: none; }
.wx-hold-talk.recording { background: #374151; color: #fff; }
.wx-input-wrap.hidden { display: none; }
.wx-send-btn {
  height: 32px;
  min-width: 52px;
  padding: 0 12px;
  border: none;
  border-radius: 4px;
  background: #07c160;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.wx-send-btn.hidden { display: none; }
.wx-plus-btn.hidden { display: none; }
.wx-call-item.hidden { display: none; }
.wx-panel:not(.direct-chat) .wx-call-item { display: none !important; }
.wx-panel.direct-chat .wx-call-item { display: flex; }
.wx-plus-btn.active { color: #07c160; }
.emoji-panel {
  padding: 10px 12px 6px;
  background: #1a1a1a;
  border-bottom: 1px solid #2a2a2a;
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.emoji-panel.hidden { display: none; }
.emoji-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 8px;
}
.emoji-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tab {
  flex-shrink: 0;
  border: none;
  background: #2a2a2a;
  color: #d1d5db;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.emoji-tab.active { background: #07c160; color: #fff; }
.emoji-tab-add {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: #2a2a2a;
  color: #e2e8f0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.emoji-tab-add:hover { background: #374151; }
.emoji-add-anchor { position: relative; flex-shrink: 0; }
.emoji-add-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 140px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 6px;
  z-index: 70;
  overflow: hidden;
}
.emoji-add-menu-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 13px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.emoji-add-menu-item:hover { background: #334155; }
.emoji-chat-picker {
  border-top: 1px solid #2a2a2a;
  padding: 8px 8px 0;
  max-height: 220px;
  overflow-y: auto;
}
.emoji-chat-picker.hidden { display: none; }
.emoji-chat-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  color: #94a3b8;
}
.emoji-chat-picker-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.emoji-chat-action {
  border: 1px solid #374151;
  background: transparent;
  color: #cbd5e1;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.emoji-chat-action:hover { background: #374151; }
.emoji-chat-action.primary {
  background: #07c160;
  border-color: #07c160;
  color: #fff;
}
.emoji-chat-action.primary:hover { background: #06ad56; }
.emoji-chat-action:disabled { opacity: 0.45; cursor: not-allowed; }
.emoji-chat-picker-close {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.emoji-chat-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-bottom: 8px;
}
.emoji-chat-pick-item {
  aspect-ratio: 1;
  border: 2px solid transparent;
  background: #2a2a2a;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}
.emoji-chat-pick-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.emoji-chat-pick-item.selected {
  border-color: #07c160;
}
.emoji-chat-pick-item.selected::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #07c160;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}
.emoji-chat-pick-item:hover { background: #374151; }
.emoji-chat-picker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  padding: 12px 8px;
}
.emoji-content { min-height: 120px; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 36px);
  gap: 2px;
  justify-content: start;
}
.emoji-item {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  display: grid;
  place-items: center;
}
.emoji-item:hover { background: #2a2a2a; }
.emoji-item:active { background: #374151; }
.emoji-item:active { background: #374151; }
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 52px);
  gap: 6px;
  padding: 0 4px 8px;
  justify-content: start;
}
.sticker-grid.hidden { display: none; }
.sticker-item {
  position: relative;
  width: 52px;
  height: 52px;
  border: none;
  background: #2a2a2a;
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: block;
}
.sticker-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  display: block;
}
.sticker-del {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  display: none;
}
.sticker-item:hover .sticker-del { display: block; }
.sticker-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 18px;
  gap: 0;
}
.sticker-add small { font-size: 9px; line-height: 1.1; }
.sticker-pack-del {
  grid-column: 1 / -1;
  margin-top: 4px;
  border: 1px solid #374151;
  background: transparent;
  color: #f87171;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-size: 13px;
}
.sticker-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: #94a3b8;
  padding: 24px;
  font-size: 14px;
}
.msg .body.sticker-msg img { max-width: 160px; background: transparent; border-radius: 0; }
.wx-emoji-btn { font-size: 24px; }
.wx-emoji-btn.active { color: #07c160; }
.wx-emoji-btn.hidden { display: none; }
#mode-switch { order: 0; }
.wx-input-wrap, .wx-hold-talk { order: 1; }
.wx-plus-btn { order: 2; }
.wx-emoji-btn { order: 3; }
.wx-send-btn { order: 4; }
#call-accept, #call-decline, #call-hangup { min-height: 44px; min-width: 44px; }
.empty { margin: auto; color: #64748b; font-size: 18px; flex: 1; display: grid; place-items: center; }
.loading-hint { padding: 24px; text-align: center; color: #94a3b8; font-size: 14px; }
.loading-hint.error { color: #f87171; }
.dropdown { margin-top: 8px; background: #1e293b; border: 1px solid #334155; border-radius: 10px; overflow: hidden; }
.dropdown div { padding: 10px 12px; cursor: pointer; }
.dropdown div:hover { background: #334155; }

.list-context-menu {
  position: fixed;
  z-index: 10000;
  min-width: 148px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.list-context-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.list-context-menu button:hover { background: #334155; }

/* 手机 / 平板竖屏：单栏，会话列表 ↔ 聊天页切换 */
@media (max-width: 768px) {
  body { overflow: hidden; }
  .auth-panel { padding: 32px 16px; max-width: 100%; }
  .brand h1 { font-size: 26px; }
  #main-view {
    grid-template-columns: 1fr;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .sidebar {
    height: 100dvh;
    border-right: none;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
  }
  .chat-area {
    height: 100dvh;
    overflow: hidden;
  }
  .chat-body { flex-direction: column; }
  .group-side-panel {
    width: 100%;
    max-height: none;
    border-left: none;
    border-top: 1px solid #1f2937;
    order: 2;
  }
  #main-view:not(.mobile-chat-open) .chat-area { display: none; }
  #main-view.mobile-chat-open .sidebar { display: none; }
  #chat-empty { display: none !important; }
  .chat-back { display: inline-flex !important; }
  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    border-bottom: 1px solid #1f2937;
  }
  .sidebar-header .sidebar-user { flex: 1; min-width: 0; }
  .sidebar-header strong { font-size: 17px; line-height: 1.2; }
  .sidebar-header small { font-size: 12px; margin-top: 2px; }
  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .mobile-header-btn {
    border: none;
    background: #1f2937;
    color: #e2e8f0;
    border-radius: 8px;
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .mobile-header-logout {
    font-size: 13px;
    padding: 0 12px;
  }
  .mobile-header-btn:active { background: #334155; }

  .search-box {
    position: relative;
    padding: 8px 16px 10px;
    border-bottom: 1px solid #1f2937;
  }
  .search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #64748b;
  }
  .search-icon svg {
    width: 16px;
    height: 16px;
    display: block;
  }
  .search-box input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border-radius: 8px;
    border: none;
    background: #1f2937;
    color: #e2e8f0;
    font-size: 15px;
  }
  .search-box input::placeholder { color: #64748b; }

  .total-unread-badge { display: none !important; }
  .group-box { grid-template-columns: 1fr; }
  .group-box button { width: 100%; min-height: 44px; }

  .conv-item {
    padding: 12px 16px;
    min-height: 64px;
    gap: 12px;
    border-bottom: 1px solid #1f2937;
  }
  .list-avatar { border-radius: 10px; }
  .conv-item .conv-body { flex: 1; min-width: 0; }
  .conv-item strong { font-size: 16px; display: block; }
  .conv-item small { font-size: 13px; margin-top: 4px; }
  .conv-item:active { background: #1f2937; }
  .chat-header {
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    flex-wrap: nowrap;
    align-items: center;
  }
  .chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
  }
  .chat-header-main h2 { font-size: 17px; }
  .chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
  }
  .chat-header-actions .icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    display: grid;
    place-items: center;
    padding: 0;
    cursor: pointer;
  }
  .chat-header-actions .icon-btn svg { width: 20px; height: 20px; }
  .chat-header-actions .icon-btn:active { background: rgba(148, 163, 184, 0.15); }
  .call-actions {
    display: flex !important;
    gap: 2px;
    flex-shrink: 0;
  }
  .call-actions .icon-btn,
  .call-actions button {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 10px !important;
    color: #94a3b8 !important;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: inherit;
    white-space: nowrap;
    display: grid;
    place-items: center;
  }
  .call-actions .icon-btn svg { width: 20px; height: 20px; }
  html:not(.theme-dark) .chat-header-actions .icon-btn,
  html:not(.theme-dark) .call-actions .icon-btn,
  html:not(.theme-dark) .call-actions button { color: #64748b !important; }
  html:not(.theme-dark) .chat-header-actions .icon-btn:active,
  html:not(.theme-dark) .call-actions .icon-btn:active { background: #f1f5f9; }
  .wx-panel:not(.hidden):not(.plus-menu) { display: block !important; }
  #mode-switch, .wx-plus-btn { display: grid !important; }
  .messages { padding: 12px; }
  .msg { max-width: 85%; width: fit-content; }
  .msg.msg-media { max-width: min(200px, 78vw); }
  .wx-bar {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    align-items: center;
    background: #0f172a;
  }
  .composer {
    background: #0f172a;
    border-top: 1px solid #1e293b;
  }

  /* 手机端输入栏（胶囊型 + 深蓝） */
  .composer-pill {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 999px;
    padding: 4px 10px 4px 12px;
    min-height: 42px;
    overflow: hidden;
  }
  .composer-pill .wx-input-wrap {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 0 6px;
    min-height: 34px;
    border-radius: 0;
  }
  .composer-pill .wx-input-wrap textarea {
    padding: 7px 0;
    min-height: 20px;
    line-height: 1.4;
    color: #e2e8f0;
  }
  .composer-pill .wx-input-wrap textarea::placeholder { color: #64748b; }
  .composer-pill .wx-hold-talk {
    flex: 1;
    min-width: 0;
    height: 34px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #e2e8f0;
    font-size: 15px;
  }
  .composer-pill .wx-hold-talk.recording {
    background: rgba(148, 163, 184, 0.12);
    color: #fff;
  }
  .composer-pill .plus-anchor { position: relative; flex-shrink: 0; }
  .composer-pill .wx-emoji-btn,
  .composer-pill .wx-plus-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 20px;
    color: #94a3b8;
  }
  .composer-pill .wx-send-btn {
    flex-shrink: 0;
    border-radius: 999px;
    height: 32px;
    min-width: 52px;
  }
  .mobile-composer-btn { color: #94a3b8; }
  .call-card {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
    border-radius: 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
  }
  .call-card video { max-height: 40vh; }
  .call-btns button { min-height: 48px; min-width: 100px; font-size: 16px; }

  /* 手机端列表底栏 */
  .mobile-list-tabs {
    display: flex;
    flex-shrink: 0;
    border-top: 1px solid #1f2937;
    background: #111827;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-list-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 14px;
    padding: 11px 8px;
    cursor: pointer;
    position: relative;
  }
  .mobile-list-tab.active {
    color: #07c160;
    font-weight: 600;
  }
  .mobile-list-tab.active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    border-radius: 2px;
    background: #07c160;
  }
  .list-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #panel-chats #conversation-list,
  #panel-groups #group-list { overflow: visible; flex: none; }
  #panel-contacts .friend-list {
    display: block;
    max-height: none;
    overflow: visible;
  }
  #panel-contacts .friend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    min-height: 64px;
    border-radius: 0;
    border-bottom: 1px solid #1f2937;
    background: transparent;
  }
  #panel-contacts .list-avatar { border-radius: 10px; }
  #panel-contacts .friend-item:active { background: #1f2937; }
  .friend-empty {
    padding: 32px 16px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
  }

  /* 手机端表情/收藏面板 */
  .emoji-panel {
    max-height: min(38vh, 220px);
    padding: 8px 8px 4px;
  }
  .emoji-tabs-wrap { padding: 0 4px 6px; }
  .emoji-tab { padding: 5px 10px; font-size: 11px; }
  .emoji-tab-add { width: 34px; height: 34px; font-size: 16px; }
  .emoji-grid {
    grid-template-columns: repeat(auto-fill, 32px);
    gap: 1px;
  }
  .emoji-item { width: 32px; height: 32px; font-size: 20px; }
  .sticker-grid {
    grid-template-columns: repeat(auto-fill, 44px);
    gap: 4px;
  }
  .sticker-item { width: 44px; height: 44px; }
  .sticker-add { font-size: 16px; }
  .sticker-add small { font-size: 8px; }
  .emoji-chat-picker { max-height: 110px; padding: 6px 6px 0; }
  .emoji-chat-picker-actions { gap: 4px; margin-bottom: 6px; }
  .emoji-chat-action { padding: 4px 8px; font-size: 11px; }
  .emoji-chat-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 4px;
  }
  .emoji-add-menu-item { min-height: 44px; padding: 12px; }

  /* 手机端 + 菜单（对齐 PC 垂直菜单） */
  .wx-panel.plus-menu {
    padding: 6px;
    min-width: 156px;
    width: max-content;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    background: #1e293b;
    border: 1px solid #334155;
    left: auto;
    right: 0;
    transform: none;
    bottom: calc(100% + 8px);
  }
  .wx-panel.plus-menu:not(.hidden) {
    display: block !important;
  }
  .plus-menu-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1;
    color: #e2e8f0;
    background: transparent;
  }
  .plus-menu-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #94a3b8;
  }
  .plus-menu-item:active { background: #334155; }
  html:not(.theme-dark) .wx-panel.plus-menu {
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  }
  html:not(.theme-dark) .plus-menu-item { color: #334155; }
  html:not(.theme-dark) .plus-menu-item svg { color: #475569; }
  html:not(.theme-dark) .plus-menu-item:active { background: #f1f5f9; }

  /* 手机端输入栏图标（对齐 PC composer-inner-btn） */
  .mobile-composer-btn,
  .wx-bar .wx-plus-btn,
  .wx-bar .wx-emoji-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0;
    flex-shrink: 0;
  }
  .mobile-composer-btn svg {
    width: 20px;
    height: 20px;
    display: block;
  }
  .mobile-composer-btn .hidden { display: none !important; }
  .wx-bar .wx-plus-btn.active { color: #64748b; background: rgba(148, 163, 184, 0.15); border-radius: 50%; }
  html:not(.theme-dark) .mobile-composer-btn,
  html:not(.theme-dark) .wx-bar .wx-plus-btn,
  html:not(.theme-dark) .wx-bar .wx-emoji-btn { color: #94a3b8; }

  /* 触控区域 */
  .icon-btn { min-width: 40px; min-height: 40px; }
}

@media (min-width: 769px) {
  /* ===== Desktop Web Light Theme ===== */
  body {
    background: #e8edf3;
    color: #1e293b;
  }
  #app {
    max-width: 1280px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 12px;
  }
  #main-view {
    grid-template-columns: 72px 240px 1fr;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(15, 23, 42, 0.12);
    background: #fff;
  }
  .mobile-only { display: none !important; }
  .desktop-only { display: grid !important; }

  /* Nav rail */
  .nav-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 10px;
    background: #f7f9fc;
    border-right: 1px solid #e2e8f0;
    gap: 16px;
  }
  .nav-profile-wrap { position: relative; margin-bottom: 8px; }
  .nav-avatar { width: 44px; height: 44px; font-size: 18px; }
  .nav-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #f7f9fc;
  }
  .nav-menu { display: flex; flex-direction: column; gap: 8px; flex: 1; }
  .nav-discover-wrap {
    display: flex;
    justify-content: center;
    margin: 4px 0 8px;
  }
  .nav-discover-wrap.hidden { display: none !important; }
  .nav-discover-btn { text-decoration: none; color: inherit; }
  .nav-discover-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
  }
  .nav-discover-icon.hidden { display: none !important; }
  .nav-discover-svg { width: 22px; height: 22px; }
  .nav-discover-svg.hidden { display: none !important; }
  .nav-tab {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
  }
  .nav-tab svg { width: 22px; height: 22px; }
  .nav-tab:hover { background: #e2e8f0; color: #334155; }
  .nav-tab.active { background: #dbeafe; color: #2563eb; }
  .nav-foot { display: flex; flex-direction: column; gap: 6px; align-items: center; }
  .nav-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    display: grid;
    place-items: center;
    padding: 0;
  }
  .nav-icon-btn svg { width: 18px; height: 18px; }
  .nav-icon-btn:hover { background: #e2e8f0; }
  .nav-logout { font-size: 18px; }

  /* List panel */
  .list-panel {
    background: #f7f9fc;
    border-right: 1px solid #e2e8f0;
  }
  .list-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px 8px;
  }
  .list-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2563eb;
  }
  .icon-btn-round {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
  }
  .icon-btn-round:hover { background: #cbd5e1; }
  .search-box {
    padding: 0 12px 10px;
    border-bottom: none;
    position: relative;
  }
  .search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: grid;
    place-items: center;
  }
  .search-icon svg { width: 14px; height: 14px; }
  .search-box input {
    padding: 8px 12px 8px 32px;
    border-radius: 999px;
    border: none;
    background: #eef2f7;
    color: #1e293b;
    font-size: 12px;
  }
  .search-box input::placeholder { color: #94a3b8; }
  .list-scroll { flex: 1; overflow-y: auto; min-height: 0; }
  #panel-contacts .friend-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 8px;
    max-height: none;
    grid-template-columns: none;
  }
  #panel-contacts .friend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: transparent;
  }
  #panel-contacts .friend-item:hover { background: #e8edf3; }
  #panel-contacts .friend-item strong { font-size: 13px; }
  #panel-contacts .friend-item small { font-size: 11px; }
  .group-box {
    padding: 0 12px 10px;
    border-bottom: 1px solid #e2e8f0;
    background: #f7f9fc;
    gap: 6px;
  }
  .group-box input {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #1e293b;
    font-size: 12px;
    padding: 8px 10px;
  }
  .group-box button {
    font-size: 12px;
    padding: 8px 10px;
  }
  .list-panel .list-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
    line-height: 36px;
  }
  .conv-item {
    padding: 8px 10px;
    border-bottom: none;
    border-radius: 10px;
    margin: 2px 6px;
    gap: 10px;
  }
  .conv-item strong { font-size: 13px; }
  .conv-item small { font-size: 11px; margin-top: 2px; }
  .conv-item:hover { background: #e8edf3; }
  .conv-item.active { background: #dbeafe; }
  .conv-item small { color: #64748b; }
  .online-dot { color: #22c55e; }

  /* Chat area */
  .chat-area { background: #fff; }
  .chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    flex-wrap: nowrap;
  }
  .chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
  }
  .chat-peer-avatar { width: 42px; height: 42px; font-size: 16px; flex-shrink: 0; }
  .chat-header-main h2 { font-size: 16px; font-weight: 700; color: #0f172a; }
  .chat-header small { color: #64748b; font-size: 12px; }
  .chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
  }
  .icon-btn svg { width: 20px; height: 20px; }
  .icon-btn:hover { background: #f1f5f9; color: #334155; }
  .icon-btn-text {
    border: none;
    background: #f1f5f9;
    color: #475569;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
  }
  .call-actions { gap: 2px; }
  .call-actions button { background: transparent; padding: 0; border-radius: 10px; }

  .announcement-panel { background: #eff6ff; border-bottom-color: #bfdbfe; }
  .announcement-head { color: #1d4ed8; }
  .announcement-view { color: #1e40af; }
  .announcement-edit textarea { background: #fff; color: #1e293b; border-color: #93c5fd; }
  .invite-panel { background: #f8fafc; border-bottom-color: #e2e8f0; }
  .invite-panel input { background: #fff; border-color: #e2e8f0; color: #1e293b; }
  .member-bar { background: #f8fafc; border-bottom-color: #e2e8f0; }
  .member-chip { background: #fff; border-color: #e2e8f0; color: #475569; }
  .group-side-panel { background: #f7f7f7; border-left-color: #e5e7eb; }

  .messages {
    padding: 20px 24px 12px;
    background: #fff;
    gap: 10px;
  }
  .msg {
    display: block;
    max-width: 70%;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 14px;
    align-self: flex-start;
  }
  html:not(.theme-dark) .msg {
    background: #f1f5f9;
    color: #1e293b;
  }
  html:not(.theme-dark) .msg.me {
    align-self: flex-end;
    background: #2563eb;
    color: #fff;
  }
  html.theme-dark .msg {
    background: #1e293b;
    color: #e2e8f0;
  }
  html.theme-dark .msg.me {
    align-self: flex-end;
    background: #1e293b;
    color: #e2e8f0;
  }
  .msg.me { align-self: flex-end; }
  .msg.msg-media {
    padding: 4px;
    max-width: min(280px, 70%);
  }
  html:not(.theme-dark) .msg.msg-media { background: #f1f5f9; }
  html:not(.theme-dark) .msg.me.msg-media { background: #2563eb; }
  html.theme-dark .msg.msg-media,
  html.theme-dark .msg.me.msg-media { background: #1e293b; }
  .msg.msg-media .meta { display: none; }
  .msg .meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    opacity: 0.75;
    margin-bottom: 4px;
  }
  html:not(.theme-dark) .msg.call-log {
    max-width: 82%;
    font-size: 13px;
    border: 1px dashed #cbd5e1;
    background: #f8fafc;
    color: #475569;
  }
  html:not(.theme-dark) .msg.me.call-log {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
  }
  html.theme-dark .msg.call-log {
    max-width: 82%;
    font-size: 13px;
    border: 1px dashed #475569;
    background: #1e293b;
    color: #94a3b8;
  }
  html.theme-dark .msg.me.call-log {
    background: #1e293b;
    border-color: #475569;
    color: #94a3b8;
  }
  .msg .read-tag { font-size: 11px; opacity: 0.8; }
  html:not(.theme-dark) .msg-actions button { background: rgba(0,0,0,0.06); color: #475569; border-radius: 6px; }
  html:not(.theme-dark) .msg.me .msg-actions button { background: rgba(255,255,255,0.15); color: #fff; }

  /* Composer pill */
  .composer { background: #fff; border-top: 1px solid #f1f5f9; }
  .mute-bar { background: #fff; border-top: 1px solid #f1f5f9; color: #64748b; }
  .wx-bar {
    padding: 12px 24px 20px;
    background: #fff;
  }
  .composer-pill {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 6px 10px 6px 12px;
    min-height: 48px;
    border: 1px solid #e2e8f0;
  }
  .composer-inner-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    flex-shrink: 0;
    font-size: 22px;
  }
  .composer-inner-btn svg { width: 18px; height: 18px; }
  .composer-inner-btn:hover { color: #334155; }
  .wx-input-wrap {
    flex: 1;
    background: transparent;
    border: none;
    min-height: 36px;
    padding: 0 8px;
  }
  .wx-input-wrap textarea {
    color: #1e293b;
    font-size: 14px;
    padding: 8px 0;
  }
  .wx-input-wrap textarea::placeholder { color: #94a3b8; }
  .wx-send-btn {
    display: none !important;
  }
  .wx-panel:not(.hidden),
  .plus-menu:not(.hidden) {
    display: block !important;
  }
  .plus-menu-item { color: #334155; }
  .plus-menu-item:hover { background: #f1f5f9; }
  .emoji-panel {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    max-height: 200px;
  }
  .emoji-tab { background: #e2e8f0; color: #475569; }
  .emoji-tab.active { background: #3b82f6; color: #fff; }
  .emoji-tab-add { background: #e2e8f0; color: #475569; }
  .emoji-tab-add:hover { background: #cbd5e1; }
  .emoji-add-menu { background: #fff; border-color: #e2e8f0; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12); }
  .emoji-add-menu-item { color: #334155; }
  .emoji-add-menu-item:hover { background: #f1f5f9; }
  .emoji-chat-picker { border-top-color: #e2e8f0; }
  .emoji-chat-picker-head { color: #64748b; }
  .emoji-chat-action { border-color: #e2e8f0; color: #475569; }
  .emoji-chat-action:hover { background: #f1f5f9; }
  .emoji-chat-pick-item { background: #f1f5f9; }
  .emoji-chat-pick-item:hover { background: #e2e8f0; }
  .emoji-item:hover { background: #e2e8f0; }
  .empty { color: #94a3b8; background: transparent; }
  .dropdown { background: #fff; border-color: #e2e8f0; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
  .dropdown div:hover { background: #f1f5f9; }
  .list-context-menu { background: #fff; border-color: #e2e8f0; box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
  .list-context-menu button { color: #0f172a; }
  .list-context-menu button:hover { background: #f1f5f9; }
  .loading-hint { color: #64748b; }

  .chat-back { display: none !important; }
  .wx-side-btn:not(.composer-inner-btn) { display: none !important; }
  .wx-emoji-btn.composer-inner-btn { display: grid !important; }
  .wx-plus-btn { display: none !important; }
  .desktop-only#desktop-plus-btn { display: grid !important; }
}

@media (max-width: 768px) {
  .nav-rail { display: none !important; }
  .list-top { display: none !important; }
  .desktop-only { display: none !important; }
  .friend-box.mobile-only { display: none !important; }
}

@media (min-width: 769px) {
  .nav-rail { display: flex; }
  .list-top { display: flex; }
}

/* Shared avatar */
.user-avatar {
  position: relative;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  isolation: isolate;
}

.user-avatar.has-image {
  background: transparent;
  font-size: 0;
}

.user-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

html.theme-dark body { background: #0b1220; color: #e2e8f0; }
html.theme-dark #main-view { background: #111827; box-shadow: 0 8px 40px rgba(0,0,0,0.5); }
html.theme-dark .nav-rail { background: #0f172a; border-color: #1e293b; }
html.theme-dark .nav-online-dot { border-color: #0f172a; }
html.theme-dark .nav-tab { color: #64748b; }
html.theme-dark .nav-tab:hover { background: #1e293b; color: #cbd5e1; }
html.theme-dark .nav-tab.active { background: #1e3a8a; color: #93c5fd; }
html.theme-dark .nav-icon-btn { color: #94a3b8; }
html.theme-dark .nav-icon-btn:hover { background: #1e293b; }
html.theme-dark .list-panel { background: #111827; border-color: #1e293b; }
html.theme-dark .list-title { color: #60a5fa; }
html.theme-dark .icon-btn-round { background: #1e293b; color: #94a3b8; }
html.theme-dark .icon-btn-round:hover { background: #334155; }
html.theme-dark .search-box input { background: #1e293b; color: #e2e8f0; }
html.theme-dark .search-box input::placeholder { color: #64748b; }
html.theme-dark .search-icon { color: #64748b; }
html.theme-dark .conv-item small { color: #64748b; }
html.theme-dark .conv-item:hover { background: #1e293b; }
html.theme-dark .conv-item.active { background: #1e3a5f; }
html.theme-dark #panel-contacts .friend-item:hover { background: #1e293b; }
html.theme-dark .friend-empty,
html.theme-dark .section-label { color: #64748b; }
html.theme-dark .chat-area,
html.theme-dark .chat-header,
html.theme-dark .composer,
html.theme-dark .mute-bar {
  background: #0f172a;
}
html.theme-dark .composer { border-top: 1px solid #1e293b; }
html.theme-dark .mute-bar {
  border-top: 1px solid #1e293b;
  color: #94a3b8;
}
html.theme-dark .messages,
html.theme-dark .wx-bar,
html.theme-dark #chat-panel { background: #0f172a; }
html.theme-dark .chat-header { border-color: #1e293b; }
html.theme-dark .composer { border-top: 1px solid #1e293b; }
html.theme-dark .chat-header-main h2 { color: #f1f5f9; }
html.theme-dark .chat-header small { color: #64748b; }
html.theme-dark .chat-header small.status-online { color: #22c55e; }
html.theme-dark .icon-btn { color: #94a3b8; }
html.theme-dark .icon-btn:hover { background: #1e293b; color: #e2e8f0; }
html.theme-dark .icon-btn-text { background: #1e293b; color: #cbd5e1; }
html.theme-dark .empty,
html.theme-dark #chat-empty { background: #0f172a !important; color: #64748b !important; }
html.theme-dark .composer-pill { background: #1e293b; border-color: #334155; }
html.theme-dark .wx-input-wrap textarea { color: #e2e8f0; }
html.theme-dark .wx-input-wrap textarea::placeholder { color: #64748b; }
html.theme-dark .composer-inner-btn { color: #94a3b8; }
html.theme-dark .composer-inner-btn:hover { color: #e2e8f0; }
html.theme-dark .msg .read-tag { opacity: 0.8; }
html.theme-dark .msg,
html.theme-dark .msg.me,
html.theme-dark .msg.msg-media,
html.theme-dark .msg.me.msg-media { background: #1e293b; color: #e2e8f0; }
html.theme-dark .msg-actions button { background: rgba(255,255,255,0.1); color: #cbd5e1; }
html.theme-dark .plus-menu,
html.theme-dark .wx-panel.plus-menu {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
html.theme-dark .plus-menu-item { color: #e2e8f0; }
html.theme-dark .plus-menu-item svg { color: #94a3b8; }
html.theme-dark .plus-menu-item:hover { background: #334155; }
html.theme-dark .plus-menu-item:active { background: #475569; }
html.theme-dark .wx-panel:not(.hidden):not(.plus-menu) { background: transparent; border: none; }
html.theme-dark .emoji-panel { background: #111827; border-color: #1e293b; }
html.theme-dark .emoji-tab { background: #1e293b; color: #94a3b8; }
html.theme-dark .emoji-tab-add { background: #334155; color: #e2e8f0; }
html.theme-dark .emoji-tab-add:hover { background: #475569; }
html.theme-dark .emoji-add-menu { background: #1e293b; border-color: #334155; }
html.theme-dark .emoji-add-menu-item { color: #e2e8f0; }
html.theme-dark .emoji-add-menu-item:hover { background: #334155; }
html.theme-dark .emoji-chat-picker { border-top-color: #1e293b; }
html.theme-dark .emoji-chat-pick-item { background: #1e293b; }
html.theme-dark .emoji-chat-pick-item:hover { background: #334155; }
html.theme-dark .emoji-item:hover { background: #334155; }
html.theme-dark .sticker-item { background: #1e293b; }
html.theme-dark .dropdown { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.theme-dark .dropdown div:hover { background: #273449; }
html.theme-dark .group-box { background: #111827; border-color: #1e293b; }
html.theme-dark .group-box input { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.theme-dark .announcement-panel { background: #172554; border-color: #1e3a8a; }
html.theme-dark .announcement-view { color: #bfdbfe; }
html.theme-dark .invite-panel { background: #111827; border-color: #1e293b; }
html.theme-dark .invite-panel input { background: #1e293b; color: #e2e8f0; border-color: #334155; }
html.theme-dark .member-bar { background: #111827; border-color: #1e293b; }
html.theme-dark .member-chip { background: #1e293b; border-color: #334155; color: #cbd5e1; }
html.theme-dark .group-side-panel { background: #111827; border-color: #1f2937; }
html.theme-dark .group-side-block { border-bottom-color: #1f2937; }
html.theme-dark .group-side-block-title { color: #f3f4f6; }
html.theme-dark .group-side-block-title em { color: #9ca3af; }
html.theme-dark .group-side-head-btn { color: #9ca3af; }
html.theme-dark .group-side-head-btn:hover { background: #1f2937; color: #e5e7eb; }
html.theme-dark .group-announce-text { color: #d1d5db; }
html.theme-dark .group-announce-text.is-empty { color: #6b7280; }
html.theme-dark .group-announce-edit textarea,
html.theme-dark .group-member-search-wrap input { background: #1f2937; border-color: #374151; color: #f3f4f6; }
html.theme-dark .group-member-row:hover { background: #1f2937; }
html.theme-dark .group-member-row.active { background: #273449; }
html.theme-dark .group-member-name { color: #f3f4f6; }
html.theme-dark .group-member-badge { background: #1f2937; color: #9ca3af; }
html.theme-dark .group-member-badge.owner { background: rgba(234, 88, 12, 0.2); color: #fb923c; }
html.theme-dark .group-member-badge.admin { background: rgba(37, 99, 235, 0.2); color: #93c5fd; }
html.theme-dark .member-action-menu { background: #1f2937; border-color: #374151; }
html.theme-dark .member-action-item { color: #f3f4f6; }
html.theme-dark .member-action-item:hover { background: #273449; }
html.theme-dark .member-action-icon { color: #94a3b8; }
html.theme-dark .member-action-sep { background: #374151; }
html.theme-dark .group-member-badge.muted { background: #422006; color: #fcd34d; }
html.theme-dark .loading-hint { color: #64748b; }
html.theme-dark .msg.call-log,
html.theme-dark .msg.me.call-log { background: #1e293b; border-color: #475569; color: #94a3b8; }
html.theme-dark .mobile-list-tabs { background: #111827; border-top-color: #1e293b; }
html.theme-dark .mobile-list-tab { color: #64748b; }
html.theme-dark .mobile-list-tab.active { color: #22c55e; }
html.theme-dark .mobile-list-tab.active::after { background: #22c55e; }
html.theme-dark .mobile-header-btn { background: #1e293b; color: #e2e8f0; }
html.theme-dark .mobile-header-btn:active { background: #334155; }
html.theme-dark .search-box input { background: #1e293b; color: #e2e8f0; }
html.theme-dark #panel-contacts .friend-item { border-bottom-color: #1e293b; }
html.theme-dark #panel-contacts .friend-item:active { background: #1e293b; }
html.theme-dark .conv-item { border-bottom-color: #1e293b; }
html.theme-dark .conv-item:active { background: #1e293b; }
html.theme-dark .login-modal { background: rgba(0,0,0,0.75); }
html.theme-dark .login-card { background: #111827; border-color: #334155; }
html.theme-dark .im-dialog-backdrop { background: rgba(0, 0, 0, 0.75); }
html.theme-dark .im-dialog-card { background: #111827; border-color: #334155; }
html.theme-dark .im-dialog-input { background: #1e293b; border-color: #334155; color: #f1f5f9; }
html:not(.theme-dark) .im-dialog-backdrop { background: rgba(15, 23, 42, 0.45); }
html:not(.theme-dark) .im-dialog-card {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}
html:not(.theme-dark) .im-dialog-card h3 { color: #0f172a; }
html:not(.theme-dark) .im-dialog-body { color: #64748b; }
html:not(.theme-dark) .im-dialog-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
html:not(.theme-dark) .im-dialog-btn-outline {
  color: #475569;
  border-color: #cbd5e1;
}
html:not(.theme-dark) .im-dialog-btn-outline:hover { background: #f1f5f9; }
html.theme-dark .login-card .brand p { color: #94a3b8; }
html.theme-dark #auth-form input { background: #1e293b; border-color: #334155; color: #f1f5f9; }
html.theme-dark .tabs button { background: #1e293b; color: #cbd5e1; border-color: #334155; }

@media (min-width: 769px) {
  .chat-back { display: none !important; }
}

.group-info-modal-card {
  width: min(420px, calc(100vw - 32px));
  max-height: min(85vh, 680px);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: group-info-pop 0.2s ease;
}
body.group-info-open { overflow: hidden; }
@keyframes group-info-pop {
  from { transform: scale(0.96) translateY(8px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.group-info-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.group-info-modal-head h3 {
  font-size: 17px;
  font-weight: 600;
}
.group-info-modal-close {
  border: none;
  background: #f3f4f6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
  flex-shrink: 0;
}
.group-info-modal-close:hover { background: #e5e7eb; color: #374151; }
.group-info-modal-body {
  overflow-y: auto;
  padding: 16px 18px 20px;
  flex: 1;
  min-height: 0;
}
.group-info-modal-body .group-info-hero,
.group-info-modal-body .group-info-members,
.group-info-modal-body .group-info-card {
  background: #f9fafb;
  margin-bottom: 12px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eef2f7;
}
.group-info-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.gi-avatar { width: 48px; height: 48px; font-size: 18px; flex-shrink: 0; }
.group-info-hero-meta { flex: 1; min-width: 0; }
.group-info-hero-meta strong {
  display: block;
  font-size: 16px;
  color: #111827;
  word-break: break-word;
}
.group-info-hero-meta small { color: #9ca3af; font-size: 12px; }
.gi-members-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  border-bottom: 1px solid #eef2f7;
}
.gi-members-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}
.group-info-modal-body .gs-row,
.group-info-modal-body .gs-action,
.group-info-modal-body .gi-members-link {
  background: transparent;
}
.group-info-modal-body .gs-row {
  padding: 12px 16px;
}
.group-info-modal-body .gs-action {
  padding: 12px 16px;
}
.gs-share-btn {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.gs-member-chip {
  width: 56px;
  text-align: center;
  font-size: 11px;
  color: #6b7280;
}
.gs-member-chip .user-avatar {
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
  font-size: 16px;
}
.gs-member-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-member-add {
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #f9fafb;
  color: #6b7280;
  font-size: 22px;
  line-height: 42px;
  cursor: pointer;
}
.gs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px;
  color: #374151;
}
.gs-row:last-child { border-bottom: none; }
.gs-row input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  text-align: right;
  color: #6b7280;
  font-size: 14px;
  outline: none;
}
.gs-row input::placeholder { color: #cbd5e1; }
.gs-switch-row { cursor: default; }
.gs-switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex-shrink: 0;
}
.gs-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.gs-switch i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.2s;
}
.gs-switch i::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.gs-switch input:checked + i { background: #22c55e; }
.gs-switch input:checked + i::after { transform: translateX(18px); }
.gs-action {
  width: 100%;
  display: block;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid #f3f4f6;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}
.gs-action:last-child { border-bottom: none; }
.gs-action.danger { color: #dc2626; }
.gs-report-link {
  display: block;
  width: calc(100% - 24px);
  margin: 4px auto 0;
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  padding: 8px;
}
.group-share-card { width: min(360px, calc(100vw - 32px)); text-align: center; }
.group-share-hint { margin: 0 0 12px; color: #64748b; font-size: 13px; }
#group-share-qr {
  display: block;
  margin: 0 auto 12px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
#group-share-url {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 12px;
}
html.theme-dark .group-info-modal-head { border-bottom-color: #1f2937; }
html.theme-dark .group-info-modal-close { background: #1f2937; color: #9ca3af; }
html.theme-dark .group-info-modal-close:hover { background: #374151; color: #e5e7eb; }
html.theme-dark .group-info-modal-body .group-info-hero,
html.theme-dark .group-info-modal-body .group-info-members,
html.theme-dark .group-info-modal-body .group-info-card {
  background: #0f172a;
  border-color: #1f2937;
}
html.theme-dark .group-info-hero-meta strong,
html.theme-dark .gs-row,
html.theme-dark .gs-action,
html.theme-dark .gi-members-link { color: #e5e7eb; }
html.theme-dark .gs-row,
html.theme-dark .gs-action,
html.theme-dark .gi-members-link { border-bottom-color: #1f2937; }
html.theme-dark .gs-row input { color: #94a3b8; }
html.theme-dark .gs-share-btn { background: #172554; border-color: #1e3a8a; color: #93c5fd; }
html.theme-dark .gs-member-add { background: #1f2937; border-color: #374151; color: #9ca3af; }
html:not(.theme-dark) .group-info-modal-head { border-bottom-color: #e5e7eb; }
html:not(.theme-dark) .group-info-modal-head h3 { color: #0f172a; }
html:not(.theme-dark) .group-info-modal-card {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18);
}

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

.add-friend-card {
  width: min(420px, calc(100vw - 32px));
}

.add-friend-search {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
}

.add-friend-results {
  max-height: 320px;
  overflow-y: auto;
}

.add-friend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.add-friend-item:last-child {
  border-bottom: none;
}

.add-friend-body {
  flex: 1;
  min-width: 0;
}

.add-friend-body strong {
  display: block;
  font-size: 15px;
}

.add-friend-body small {
  color: #64748b;
}

.add-friend-action {
  border: none;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}

.add-friend-action:disabled {
  background: #e2e8f0;
  color: #64748b;
  cursor: default;
}

.add-friend-empty {
  color: #64748b;
  text-align: center;
  padding: 24px 12px;
}
