:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --bubble: #95ec69;
  --bg: #f5f5f5;
  --panel: #ededed;
  --panel-hover: #e4e4e4;
  --panel-active: #d9d9d9;
  --border: #e2e2e2;
  --text: #191919;
  --sub: #999;
  --link: #576b95;
  --rail: #2e2e2e;
  --rail-hover: #3b3b3b;
  --danger: #fa5151;
  --shadow: 0 8px 32px rgba(0, 0, 0, .14);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; outline: none; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
a { color: var(--link); text-decoration: none; }
.hidden { display: none !important; }
svg { display: block; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-thumb { background: #c9c9c9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b5b5b5; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================== 通用头像 ============================== */
.avatar {
  position: relative;
  width: var(--s, 40px);
  height: var(--s, 40px);
  border-radius: 5px;
  overflow: hidden;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #7ec9a4, #3f9e78);
  color: #fff;
  font-size: calc(var(--s, 40px) * .4);
  font-weight: 500;
  user-select: none;
}
.avatar span { position: relative; z-index: 1; text-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.avatar.round { border-radius: 50%; }
.avatar.sys { background: linear-gradient(135deg, #ffd36b, #f5a623); }
.avatar.official { background: linear-gradient(135deg, #5aa9ff, #2f7be0); }

/* ============================== 登录页 ============================== */
.auth {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f2f4f5;
  z-index: 100;
  overflow: hidden;
}
.auth-bg {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 18% 22%, rgba(7, 193, 96, .16), transparent 42%),
    radial-gradient(circle at 84% 76%, rgba(7, 193, 96, .14), transparent 45%),
    radial-gradient(circle at 70% 12%, rgba(87, 107, 149, .08), transparent 38%);
  filter: blur(2px);
}
.auth-card {
  position: relative;
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 14px;
  padding: 38px 38px 30px;
  box-shadow: 0 18px 60px rgba(20, 40, 30, .12);
  animation: pop .35s ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.brand { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 26px; }
.brand-logo svg { width: 54px; height: 54px; border-radius: 13px; box-shadow: 0 8px 20px rgba(7, 193, 96, .28); }
.brand-text h1 { margin: 0; font-size: 26px; letter-spacing: 4px; font-weight: 600; }
.brand-text p { margin: 4px 0 0; color: var(--sub); font-size: 12px; letter-spacing: 1px; }
.auth-tabs { display: flex; background: #f2f2f2; border-radius: 8px; padding: 3px; margin-bottom: 22px; }
.auth-tab { flex: 1; height: 34px; border-radius: 6px; color: #666; font-size: 14px; transition: .2s; }
.auth-tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: #888; }
.field input {
  height: 42px;
  border: 1px solid #e5e5e5;
  background: #fafafa;
  border-radius: 8px;
  padding: 0 13px;
  transition: .2s;
}
.field input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(7, 193, 96, .1); }
.btn-primary {
  height: 44px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 2px;
  transition: .18s;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.auth-tip { text-align: center; color: var(--sub); font-size: 12px; margin: 4px 0 0; }
.agree-row {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 12px; color: var(--sub); line-height: 1.6;
  margin: 2px 0 12px; cursor: pointer;
}
.agree-row input { margin: 3px 0 0; width: 14px; height: 14px; accent-color: var(--green); cursor: pointer; flex: none; }
.agree-row a { color: var(--green); text-decoration: none; }
.agree-row a:hover { text-decoration: underline; }
.auth-error { min-height: 18px; color: var(--danger); font-size: 12px; text-align: center; margin: 14px 0 0; }
.auth-foot {
  position: relative;
  margin-top: 22px;
  font-size: 12px;
  color: #9aa0a6;
  display: flex;
  gap: 14px;
  align-items: center;
}

/* ============================== 应用框架 ============================== */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg); }

.rail {
  width: 62px;
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 0 12px;
  flex: none;
  gap: 6px;
}
.rail-me { margin-bottom: 18px; border-radius: 6px; }
.rail-nav { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rail-bottom { margin-top: auto; }
.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
  transition: .16s;
}
.rail-btn:hover { background: var(--rail-hover); color: #d6d6d6; }
.rail-btn.active { color: var(--green); }
.rail-ico svg { width: 22px; height: 22px; }
.rail-badge {
  position: absolute;
  top: 3px;
  right: 1px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  line-height: 17px;
  text-align: center;
  font-weight: 500;
}
.rail-dot {
  position: absolute;
  top: 8px;
  right: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  border: 1px solid var(--rail);
}

/* ============================== 列表面板 ============================== */
.panel {
  width: 300px;
  flex: none;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
  position: relative;
}
.panel-head {
  height: 66px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid #e0e0e0;
}
.search-box {
  flex: 1;
  height: 30px;
  background: #dcdcdc;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  color: #7b7b7b;
  transition: .18s;
}
.search-box svg { width: 14px; height: 14px; flex: none; }
.search-box input { flex: 1; min-width: 0; background: none; border: 0; font-size: 13px; color: var(--text); }
.search-box input::placeholder { color: #8a8a8a; }
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5a5a;
  transition: .15s;
  flex: none;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }
.icon-btn svg { width: 19px; height: 19px; }
.panel-title { font-size: 17px; font-weight: 600; flex: 1; padding-left: 2px; }
.panel-body { flex: 1; overflow-y: auto; overflow-x: hidden; }
.panel-list { padding: 4px 0 20px; }

.conv-item {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  position: relative;
  transition: background .12s;
  align-items: center;
}
.conv-item:hover { background: var(--panel-hover); }
.conv-item.active { background: var(--panel-active); }
.conv-item.pinned { background: #e6e6e6; }
.conv-item.pinned.active { background: var(--panel-active); }
.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: center; gap: 6px; }
.conv-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.conv-time { font-size: 11px; color: #a3a3a3; flex: none; }
.conv-bottom { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.conv-preview {
  flex: 1;
  font-size: 12.5px;
  color: #9a9a9a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-preview .tag { color: #b0b0b0; }
.conv-badges { display: flex; align-items: center; gap: 4px; flex: none; }
.unread-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  font-weight: 500;
}
.unread-badge.dot { min-width: 8px; width: 8px; height: 8px; padding: 0; }
.mute-ico { color: #b3b3b3; display: flex; }
.mute-ico svg { width: 13px; height: 13px; }
.conv-more {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  color: #888;
  background: rgba(255, 255, 255, .7);
}
.conv-more svg { width: 15px; height: 15px; }
.conv-item:hover .conv-more { display: flex; }
.conv-more:hover { background: #fff; color: #333; }

.panel-section-label { padding: 16px 16px 6px; font-size: 12px; color: #9a9a9a; }
.panel-entry {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background .12s;
}
.panel-entry:hover { background: var(--panel-hover); }
.panel-entry .entry-ico {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex: none;
}
.panel-entry .entry-ico svg { width: 21px; height: 21px; }
.panel-entry .entry-name { flex: 1; font-size: 14px; }
.panel-entry .entry-sub { font-size: 12px; color: #9a9a9a; }
.entry-ico.green { background: #07c160; }
.entry-ico.orange { background: #fa9d3b; }
.entry-ico.blue { background: #2f8bf0; }
.entry-ico.purple { background: #8a6ad6; }

.letter-label { padding: 8px 16px 4px; font-size: 12px; color: #999; background: #e9e9e9; position: sticky; top: 0; z-index: 2; }
.contact-row { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; }
.contact-row:hover { background: var(--panel-hover); }
.contact-row.active { background: var(--panel-active); }
.contact-row .contact-name { font-size: 14px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row .contact-online { width: 8px; height: 8px; border-radius: 50%; background: #4cd964; flex: none; opacity: 0; }
.contact-row .contact-online.on { opacity: 1; }
.contact-empty { padding: 40px 20px; text-align: center; color: #aaa; font-size: 13px; }

/* ============================== 主区域 ============================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); position: relative; }
.main-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.app.wide .panel { display: none; }

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #b8b8b8;
  user-select: none;
}
.empty-state .big-logo svg { width: 76px; height: 76px; border-radius: 18px; opacity: .9; filter: grayscale(.15); }
.empty-state h3 { margin: 0; font-size: 16px; font-weight: 500; color: #a0a0a0; }
.empty-state p { margin: 0; font-size: 12.5px; color: #b8b8b8; }

/* ============================== 聊天页 ============================== */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.chat-back { display: none; }
.chat-head-info { min-width: 0; flex: 1; }
.chat-head-title { font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.chat-head-title .official-tag {
  font-size: 10px;
  color: #2f8bf0;
  border: 1px solid #bcd9fb;
  background: #eef5ff;
  border-radius: 3px;
  padding: 1px 4px;
  font-weight: 400;
}
.chat-head-sub { margin-top: 3px; font-size: 12px; color: #a0a0a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-actions { display: flex; align-items: center; gap: 2px; }
.chat-head-actions .icon-btn { width: 34px; height: 34px; color: #4a4a4a; }
.chat-head-actions .icon-btn:hover { background: #e8e8e8; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 26px;
  scroll-behavior: auto;
  position: relative;
}
.message-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: flex-start; }
.message-row.self { flex-direction: row-reverse; }
.msg-avatar { cursor: pointer; }
.msg-body { max-width: min(62%, 560px); display: flex; flex-direction: column; gap: 4px; }
.message-row.self .msg-body { align-items: flex-end; }
.msg-sender { font-size: 12px; color: #9a9a9a; padding: 0 3px; }
.bubble {
  position: relative;
  background: #fff;
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .03);
  max-width: 100%;
}
.message-row.self .bubble { background: var(--bubble); }
.bubble::before {
  content: '';
  position: absolute;
  top: 13px;
  left: -5px;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 6px solid #fff;
}
.message-row.self .bubble::before {
  left: auto;
  right: -5px;
  border-right: 0;
  border-left: 6px solid var(--bubble);
}
.msg-row-hover {
  position: relative;
}
.msg-more {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  color: #999;
  background: rgba(0, 0, 0, .04);
}
.message-row:hover .msg-more { display: flex; }
.message-row.self .msg-more { right: -26px; }
.message-row:not(.self) .msg-more { left: -26px; }
.msg-more:hover { background: rgba(0, 0, 0, .1); }
.msg-more svg { width: 14px; height: 14px; }

.sys-msg {
  text-align: center;
  font-size: 12px;
  color: #a5a5a5;
  margin: 14px auto;
  max-width: 75%;
  line-height: 1.6;
  padding: 0 8px;
}
.time-divider { text-align: center; font-size: 11.5px; color: #b0b0b0; margin: 18px 0 16px; }

.bubble-image { padding: 0; background: transparent !important; box-shadow: none; }
.bubble-image::before { display: none; }
.bubble-image img { display: block; max-width: 240px; max-height: 280px; border-radius: 5px; cursor: zoom-in; background: #ddd; }
.bubble-voice { min-width: 74px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.bubble-voice .wave { display: flex; align-items: center; gap: 2px; height: 16px; }
.bubble-voice .wave i { width: 2px; border-radius: 1px; background: #555; opacity: .65; }
.bubble-voice.playing .wave i { animation: wave .7s infinite ease-in-out; }
@keyframes wave { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1.2); } }
.bubble-voice .dur { font-size: 12px; color: #666; margin-left: auto; }
.bubble-file { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.bubble-file .file-ico {
  width: 38px; height: 44px; border-radius: 4px; background: #eef3ff; color: #4d7ad1;
  display: flex; align-items: center; justify-content: center; flex: none; font-size: 10px; font-weight: 600;
}
.bubble-file .file-ico svg { width: 20px; height: 20px; }
.bubble-file .file-meta { min-width: 0; }
.bubble-file .file-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.bubble-file .file-size { font-size: 11px; color: #999; margin-top: 2px; }
.bubble-announcement {
  background: #fff8e8 !important;
  border: 1px solid #ffe4b3;
  min-width: 240px;
}
.bubble-announcement::before { border-right-color: #fff8e8 !important; }
.bubble-announcement .ann-title { font-size: 12px; color: #e09a2c; display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.bubble-announcement .ann-title svg { width: 13px; height: 13px; }

.typing-line { font-size: 12px; color: #9a9a9a; padding: 0 24px 6px; height: 18px; transition: opacity .2s; }

.composer { flex: none; border-top: 1px solid var(--border); background: var(--bg); padding: 8px 18px 12px; position: relative; }
.composer-tools { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; }
.composer-tools .icon-btn { width: 30px; height: 30px; color: #555; }
.composer-tools .icon-btn:hover { background: #e8e8e8; }
.composer-tools .icon-btn svg { width: 19px; height: 19px; }
.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  border: 0;
  resize: none;
  background: transparent;
  font-size: 14.5px;
  line-height: 1.6;
  padding: 2px 2px 4px;
  display: block;
}
.composer-foot { display: flex; align-items: center; gap: 10px; }
.composer-hint { font-size: 11px; color: #b5b5b5; flex: 1; }
.send-btn {
  background: #e9e9e9;
  color: #a5a5a5;
  padding: 0 18px;
  height: 30px;
  border-radius: 4px;
  font-size: 13px;
  transition: .16s;
  flex: none;
}
.send-btn.ready { background: var(--green); color: #fff; }
.send-btn.ready:hover { background: var(--green-dark); }
.emoji-panel {
  position: absolute;
  left: 14px;
  bottom: 100%;
  margin-bottom: 6px;
  width: 330px;
  max-width: calc(100vw - 40px);
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 30;
}
.emoji-panel button { font-size: 21px; height: 36px; border-radius: 5px; line-height: 1; }
.emoji-panel button:hover { background: #f2f2f2; }
.recording-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  height: 54px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  z-index: 20;
}
.recording-bar .rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.recording-bar .rec-time { font-variant-numeric: tabular-nums; font-size: 13px; }
.recording-bar .rec-hint { color: #999; font-size: 12px; flex: 1; }
.recording-bar button { font-size: 13px; padding: 6px 12px; border-radius: 5px; }
.recording-bar .rec-cancel { color: #666; background: #f2f2f2; }
.recording-bar .rec-send { color: #fff; background: var(--green); }

/* ============================== 用户资料卡 ============================== */
.profile-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 30px;
  text-align: center;
}
.profile-card .p-avatar { margin-bottom: 10px; box-shadow: 0 6px 22px rgba(0, 0, 0, .12); }
.profile-card h2 { margin: 0; font-size: 20px; font-weight: 500; }
.profile-card .p-sub { color: #9a9a9a; font-size: 13px; }
.profile-card .p-sign { color: #7f7f7f; font-size: 13px; margin-top: 8px; max-width: 360px; line-height: 1.6; }
.profile-card .p-meta { display: flex; gap: 26px; margin-top: 18px; color: #9a9a9a; font-size: 12px; }
.profile-card .p-meta b { display: block; font-size: 18px; color: #444; font-weight: 500; margin-bottom: 2px; }
.profile-actions { display: flex; gap: 12px; margin-top: 26px; }
.btn-ghost {
  height: 34px;
  padding: 0 18px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #e2e2e2;
  color: #444;
  font-size: 13px;
  transition: .15s;
}
.btn-ghost:hover { background: #f7f7f7; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-dark); }
.profile-block { width: 100%; max-width: 420px; margin-top: 26px; text-align: left; background: #fff; border-radius: 8px; overflow: hidden; }
.profile-block .pb-row { display: flex; padding: 13px 16px; border-bottom: 1px solid #f2f2f2; font-size: 13px; }
.profile-block .pb-row:last-child { border-bottom: 0; }
.profile-block .pb-row span { color: #999; width: 76px; flex: none; }
.profile-block .pb-row b { font-weight: 400; color: #333; }

/* ============================== 通讯录 / 新朋友 ============================== */
.request-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
}
.request-item .req-main { flex: 1; min-width: 0; }
.request-item .req-name { font-size: 14px; }
.request-item .req-msg { font-size: 12px; color: #999; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.request-item .req-actions { display: flex; gap: 8px; flex: none; }
.request-item .req-actions button { font-size: 12px; padding: 5px 12px; border-radius: 4px; }
.btn-accept { background: var(--green); color: #fff; }
.btn-reject { background: #f2f2f2; color: #777; }
.page-head {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.page-head h2 { margin: 0; font-size: 16px; font-weight: 500; flex: 1; }
.page-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }
.requests-wrap { max-width: 640px; margin: 0 auto; }
.requests-wrap .request-item { border-radius: 8px; border: 1px solid #eee; margin-bottom: 10px; }
.section-title { font-size: 13px; color: #999; margin: 20px 0 8px; }

/* ============================== 发现 / 我 / 设置 ============================== */
.wide-page { flex: 1; overflow-y: auto; background: #f5f5f5; }
.wide-page .wp-inner { max-width: 760px; margin: 0 auto; padding: 26px 24px 60px; }
.discover-list, .menu-list { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid #f3f3f3;
  cursor: pointer;
  transition: background .12s;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:hover { background: #f8f8f8; }
.menu-row .mr-ico { width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.menu-row .mr-ico svg { width: 17px; height: 17px; }
.menu-row .mr-label { flex: 1; font-size: 14px; }
.menu-row .mr-value { color: #b0b0b0; font-size: 12.5px; }
.menu-row .mr-arrow { color: #c8c8c8; display: flex; }
.menu-row .mr-arrow svg { width: 15px; height: 15px; }
.menu-row .mr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.menu-group-label { font-size: 12px; color: #999; padding: 18px 12px 8px; }

.me-page { flex: 1; overflow-y: auto; background: #ededed; }
.me-inner { max-width: 700px; margin: 0 auto; }
.me-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 38px 24px 30px;
  cursor: pointer;
}
.me-head .me-name { font-size: 20px; font-weight: 500; }
.me-head .me-id { font-size: 12.5px; color: #999; margin-top: 5px; }
.me-head .me-qr { margin-left: auto; color: #bbb; }
.me-head .me-qr svg { width: 22px; height: 22px; }
.me-block { background: #fff; border-radius: 10px; margin: 0 18px 12px; overflow: hidden; }
.me-block .menu-row { padding: 15px 16px; }
.me-quote {
  margin: 22px 24px 0;
  color: #a5a5a5;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

.settings-page { flex: 1; overflow-y: auto; background: #ededed; }
.settings-inner { max-width: 680px; margin: 0 auto; padding: 24px 20px 60px; }
.settings-group { margin-bottom: 14px; background: #fff; border-radius: 10px; overflow: hidden; }
.settings-group .menu-row { border-bottom: 1px solid #f4f4f4; }
.settings-group .menu-row:last-child { border-bottom: 0; }
.settings-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: #666; font-size: 13px; }
.settings-head button { color: #666; display: flex; align-items: center; gap: 4px; }
.logout-btn {
  width: 100%;
  background: #fff;
  color: var(--danger);
  border-radius: 10px;
  height: 48px;
  font-size: 15px;
  margin-top: 10px;
}
.logout-btn:hover { background: #fff7f7; }

/* ============================== 朋友圈 ============================== */
.moments-page { flex: 1; overflow-y: auto; background: #fff; }
.moments-cover {
  position: relative;
  height: 260px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .18)),
    radial-gradient(circle at 20% 30%, #a7d8be, #5fa982 55%, #356b52);
  background-size: cover;
  background-position: center;
  color: #fff;
  display: flex;
  align-items: flex-end;
  padding: 0 26px 22px;
}
.moments-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.02) 40%, rgba(0,0,0,.28));
}
.moments-cover .mc-user { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; margin-left: auto; }
.moments-cover .mc-user .avatar { border: 2px solid rgba(255, 255, 255, .8); }
.moments-cover .mc-user b { font-weight: 500; font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.moments-cover .mc-publish { position: absolute; left: 24px; bottom: 22px; z-index: 2; display: flex; gap: 8px; }
.moments-cover .mc-publish button {
  color: #fff; background: rgba(0,0,0,.22); backdrop-filter: blur(6px);
  border-radius: 6px; padding: 7px 12px; font-size: 12.5px; display: flex; align-items: center; gap: 5px;
}
.moments-cover .mc-publish button:hover { background: rgba(0,0,0,.32); }
.moments-cover .mc-publish svg { width: 15px; height: 15px; }
.moments-feed { max-width: 620px; margin: 0 auto; padding: 26px 20px 90px; }
.moment {
  display: flex;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid #f2f2f2;
}
.moment:last-child { border-bottom: 0; }
.moment-body { flex: 1; min-width: 0; }
.moment-name { color: var(--link); font-size: 14.5px; font-weight: 500; cursor: pointer; }
.moment-text { margin-top: 6px; font-size: 14.5px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; }
.moment-imgs { margin-top: 9px; display: grid; gap: 5px; grid-template-columns: repeat(3, 1fr); max-width: 360px; }
.moment-imgs.n1 { grid-template-columns: 1fr; max-width: 240px; }
.moment-imgs.n2 { grid-template-columns: repeat(2, 1fr); max-width: 250px; }
.moment-imgs.n4 { grid-template-columns: repeat(2, 1fr); max-width: 250px; }
.moment-imgs img {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 3px; background: #eee; cursor: zoom-in; display: block;
}
.moment-imgs.n1 img { aspect-ratio: auto; max-height: 300px; }
.moment-loc { margin-top: 7px; font-size: 12px; color: var(--link); }
.moment-foot { display: flex; align-items: center; margin-top: 8px; gap: 8px; }
.moment-time { font-size: 12px; color: #b0b0b0; }
.moment-actions { margin-left: auto; display: flex; gap: 4px; }
.moment-actions button { width: 28px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 3px; color: #576b95; background: #f7f7f7; }
.moment-actions button:hover { background: #ededed; }
.moment-actions svg { width: 15px; height: 15px; }
.moment-actions .liked { color: var(--danger); }
.moment-social { margin-top: 8px; background: #f7f7f7; border-radius: 4px; padding: 6px 10px; font-size: 13px; line-height: 1.7; }
.moment-likes { color: var(--link); display: flex; gap: 4px; flex-wrap: wrap; }
.moment-likes svg { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; }
.moment-comments .cmt { color: #333; }
.moment-comments .cmt b { color: var(--link); font-weight: 400; cursor: pointer; }
.moment-social .social-sep { height: 1px; background: #ececec; margin: 5px 0; }
.cmt-form { display: flex; gap: 6px; margin-top: 6px; }
.cmt-form input { flex: 1; height: 30px; border-radius: 4px; border: 1px solid #e5e5e5; padding: 0 9px; font-size: 12.5px; background: #fff; }
.cmt-form button { font-size: 12px; color: var(--link); padding: 0 6px; }
.moment-del { color: #b0b0b0; font-size: 12px; }
.moments-empty { text-align: center; color: #b0b0b0; padding: 60px 0; font-size: 13px; }

/* ============================== 弹窗 / 菜单 / Toast ============================== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade .18s ease;
  padding: 20px;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 440px;
  max-width: 100%;
  max-height: calc(100vh - 60px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop .22s ease both;
}
.modal-lg { width: 560px; }
.modal-sm { width: 340px; }
.modal-head { display: flex; align-items: center; height: 54px; padding: 0 20px; border-bottom: 1px solid #f0f0f0; flex: none; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 500; flex: 1; }
.modal-close { width: 28px; height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #999; }
.modal-close:hover { background: #f2f2f2; }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 16px; flex: none; }
.modal-foot .btn-ghost, .modal-foot .btn-primary { height: 34px; padding: 0 20px; font-size: 13px; letter-spacing: 0; margin: 0; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; font-size: 12px; color: #999; margin-bottom: 6px; }
.form-field input, .form-field textarea {
  width: 100%;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 13.5px;
  background: #fafafa;
  transition: .18s;
}
.form-field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--green); background: #fff; }
.hint-text { font-size: 12px; color: #aaa; margin-top: 6px; }

.search-result-list { max-height: 320px; overflow-y: auto; margin-top: 12px; }
.user-result { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-bottom: 1px solid #f4f4f4; }
.user-result:last-child { border-bottom: 0; }
.user-result .ur-main { flex: 1; min-width: 0; }
.user-result .ur-name { font-size: 14px; }
.user-result .ur-id { font-size: 12px; color: #aaa; margin-top: 2px; }
.user-result button { font-size: 12px; padding: 5px 12px; border-radius: 4px; background: var(--green); color: #fff; }
.user-result button:disabled { background: #f0f0f0; color: #aaa; }

.member-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 8px; }
.member-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; overflow: hidden; }
.member-cell .mc-name { font-size: 11px; color: #666; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-cell.add { cursor: pointer; }
.member-cell.add .add-circle {
  width: 44px; height: 44px; border: 1px dashed #ccc; border-radius: 5px; display: flex; align-items: center; justify-content: center; color: #bbb;
}
.member-cell.add .add-circle svg { width: 20px; height: 20px; }

.friend-picker { max-height: 300px; overflow-y: auto; border: 1px solid #f0f0f0; border-radius: 6px; }
.picker-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.picker-row:hover { background: #f8f8f8; }
.picker-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); }
.picker-row .pk-name { flex: 1; font-size: 13.5px; }

.ctx-menu {
  position: fixed;
  min-width: 130px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .16);
  padding: 5px;
  z-index: 300;
  animation: fade .12s ease;
}
.ctx-menu button {
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctx-menu button:hover { background: #f4f4f4; }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button svg { width: 14px; height: 14px; }
.ctx-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }

.toast-root { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: rgba(30, 30, 30, .9);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  animation: toastIn .22s ease both;
  max-width: 78vw;
  text-align: center;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 350;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  animation: fade .18s ease;
}
.image-viewer img { max-width: 100%; max-height: 100%; border-radius: 4px; object-fit: contain; }
.image-viewer .viewer-close {
  position: absolute; top: 20px; right: 24px; color: #fff; width: 36px; height: 36px;
  border-radius: 50%; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center;
}
.image-viewer .viewer-close svg { width: 18px; height: 18px; }

/* ============================== 移动端 ============================== */
.mobile-tabs { display: none; }
.mobile-head { display: none; }

@media (max-width: 860px) {
  body { background: var(--panel); }
  .app { display: block; position: relative; height: 100dvh; }
  .rail { display: none; }
  .panel {
    width: 100%;
    height: 100%;
    border-right: 0;
    padding-bottom: 58px;
  }
  .panel-head { height: 52px; background: var(--panel); border-bottom: 1px solid #e0e0e0; }
  .panel-title { font-size: 18px; }

  .main {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: var(--bg);
  }
  .app.mobile-detail .main { display: flex; }
  .app.mobile-detail .panel { display: none; }
  .app.wide .panel { display: none; }
  .app.wide .main { display: flex; position: relative; z-index: 1; height: calc(100dvh - 58px); inset: auto; }
  .app.wide { display: flex; flex-direction: column; }
  .app.wide .main { flex: 1; }
  .app.wide .main-inner { height: 100%; overflow: hidden; }

  .mobile-tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #f7f7f7;
    border-top: 1px solid #e2e2e2;
    display: flex;
    z-index: 60;
  }
  .mtab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #7a7a7a;
    font-size: 10.5px;
    position: relative;
  }
  .mtab .rail-ico svg { width: 23px; height: 23px; }
  .mtab.active { color: var(--green); }
  .mtab .rail-badge { top: 2px; right: 50%; margin-right: -22px; }
  .mtab .rail-dot { top: 6px; right: 50%; margin-right: -16px; }
  .app.mobile-detail .mobile-tabs { display: none; }
  .app.wide .mobile-tabs { display: flex; }

  .chat-head { height: 52px; padding: 0 8px 0 4px; gap: 4px; background: #ededed; border-bottom: 1px solid #e0e0e0; }
  .chat-back { display: flex; width: 34px; height: 34px; align-items: center; justify-content: center; color: #333; flex: none; }
  .chat-back svg { width: 20px; height: 20px; }
  .chat-head-title { font-size: 16px; }
  .chat-head-sub { font-size: 11px; }
  .chat-head-actions .call-btn { display: none; }

  .messages { padding: 12px 12px 18px; }
  .msg-body { max-width: 70%; }
  .bubble { font-size: 15px; }
  .bubble-image img { max-width: 180px; max-height: 240px; }
  .msg-more { display: none !important; }
  .composer { padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .emoji-panel { left: 8px; width: calc(100vw - 16px); }

  .page-head, .mobile-head {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    background: #ededed;
    border-bottom: 1px solid #e0e0e0;
    flex: none;
  }
  .page-head { display: none; }
  .mobile-head { display: flex; }
  .mobile-head h2 { margin: 0; font-size: 17px; font-weight: 500; flex: 1; text-align: center; }
  .mobile-head .icon-btn { width: 34px; height: 34px; }
  .mobile-head .mh-back { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: #333; }
  .mobile-head .mh-back svg { width: 20px; height: 20px; }
  .mobile-head .mh-ghost { width: 34px; }

  .page-scroll { padding: 14px 14px 80px; }
  .moments-cover { height: 260px; }
  .moments-feed { padding: 16px 14px 80px; }
  .moment-imgs { max-width: 100% !important; }
  .moment-imgs.n1 { max-width: 220px !important; }
  .wide-page .wp-inner { padding: 16px 12px 80px; }
  .me-head { padding: 28px 20px 24px; }
  .me-block { margin: 0 12px 12px; }
  .settings-inner { padding: 14px 12px 80px; }
  .settings-head { display: none; }
  .moments-cover .mc-publish { left: 16px; }
  .app.wide .main-inner { padding-bottom: 0; }
  .wide-page { height: 100%; }
  .me-page, .settings-page { height: 100%; }
  .moments-page { height: 100%; overflow-y: auto; }

  .panel-body { padding-bottom: 10px; }
  .conv-item { padding: 10px 12px; }
  .conv-title { font-size: 15px; }
  .conv-preview { font-size: 13px; }
  .avatar { --s: 44px; }
  .conv-item .avatar { --s: 44px; }
  .contact-row { padding: 9px 12px; }
  .profile-card { justify-content: flex-start; padding: 34px 18px 90px; overflow-y: auto; }
  .modal { width: 100%; max-width: 100%; border-radius: 12px; }
  .modal-mask { padding: 16px; align-items: flex-end; }
  .modal { max-height: 86vh; }
  .member-grid { grid-template-columns: repeat(4, 1fr); }
  .toast-root { top: 14px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 30px 24px 24px; }
  .brand-logo svg { width: 48px; height: 48px; }
}

/* 暗色滚动条细节 */
.panel-body::-webkit-scrollbar, .messages::-webkit-scrollbar, .moments-page::-webkit-scrollbar { width: 6px; }

/* ============================== H5 细节 ============================== */
@media (max-width: 860px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
    touch-action: manipulation;
  }
  .app { height: 100vh; height: 100dvh; }
  .panel { height: 100vh; height: 100%; }

  /* iOS 聚焦输入框不放大页面（字号需 >= 16px） */
  input, textarea, select { font-size: 16px; }
  .composer textarea, .composer input[type="text"] { font-size: 16px; }
  .search-input, .modal input, .field input { font-size: 16px; }

  /* 点击反馈 */
  .chat-back:active, .mtab:active, .conv-item:active,
  .contact-row:active, .settings-row:active, .mb-item:active {
    background: rgba(0, 0, 0, .055);
  }
  .modal-mask { padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 88vh; padding-bottom: env(safe-area-inset-bottom); }
  .toast-root { top: calc(12px + env(safe-area-inset-top)); }
}

@media (max-width: 380px) {
  .mtab { font-size: 10px; }
  .bubble-image img { max-width: 150px; }
}

/* H5 聊天输入区：输入框与发送按钮同一行（微信风格） */
@media (max-width: 860px) {
  .composer {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "tools tools" "input send";
    gap: 6px 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: #f7f7f7;
  }
  .composer-tools { grid-area: tools; margin-bottom: 0; }
  .composer textarea {
    grid-area: input;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    padding: 9px 12px;
    min-height: 42px;
    max-height: 110px;
    line-height: 1.45;
  }
  .composer-foot { grid-area: send; align-self: end; }
  .composer-hint { display: none !important; }
  .send-btn {
    height: 42px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 14px;
  }
}
