:root {
  --blue: #12b7f5;
  --blue-2: #0a9bf0;
  --blue-dark: #0099ff;
  --bg: #f2f3f5;
  --panel: #ffffff;
  --rail: #e9ebef;
  --line: #e6e8ec;
  --text: #1a1a1a;
  --sub: #8c9199;
  --hover: #f2f6fc;
  --active: #e6f3ff;
  --chat-bg: #f5f6f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------------- 登录 ---------------- */
.login-mask {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e8f4ff 0%, #f6f8fb 45%, #eaf2ff 100%);
}
.login-card {
  width: 360px; padding: 32px 30px 24px;
  background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(19, 60, 110, .12);
  text-align: center;
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 16px; color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2ac6ff, #0a84ff);
  box-shadow: 0 8px 20px rgba(18, 183, 245, .32);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.login-sub { margin: 0 0 20px; color: var(--sub); font-size: 12px; }
.field { display: block; text-align: left; margin-bottom: 12px; }
.field > span { display: block; margin-bottom: 5px; color: var(--sub); font-size: 12px; }
.field input, .field select {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus { border-color: var(--blue); background: #fff; }
.login-actions { display: flex; gap: 10px; margin-top: 18px; }
.login-err { min-height: 18px; margin: 10px 0 0; color: #e34d59; font-size: 12px; line-height: 1.55; }
.login-err:not(:empty) {
  padding: 9px 11px; border-radius: 8px; text-align: left;
  background: #fff1f2; border: 1px solid #ffd9dc;
}
.login-card.shake { animation: login-shake .32s ease-in-out; }
@keyframes login-shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}
.btn-primary:disabled, .btn-ghost:disabled { opacity: .62; cursor: not-allowed; }

.btn-primary {
  flex: 1; height: 38px; border: 0; border-radius: 8px; color: #fff; font-weight: 500;
  background: linear-gradient(135deg, #2ac6ff, #0a84ff);
  box-shadow: 0 4px 12px rgba(18, 183, 245, .28);
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { filter: brightness(.94); }
.btn-primary.sm { flex: none; height: 30px; padding: 0 14px; font-size: 13px; }
.btn-ghost {
  flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: #4e5560;
}
.btn-ghost:hover { background: var(--hover); border-color: #cfe3f8; }
.btn-ghost.sm { flex: none; height: 30px; padding: 0 12px; font-size: 13px; }

/* ---------------- 主框架 ---------------- */
.app { display: flex; height: 100vh; }
.rail {
  width: 62px; flex: none; background: var(--rail);
  display: flex; flex-direction: column; align-items: center; padding: 14px 0 10px; gap: 4px;
}
.rail-avatar {
  width: 38px; height: 38px; border-radius: 50%; color: #fff; font-weight: 600;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
  background: linear-gradient(135deg, #2ac6ff, #0a84ff); box-shadow: 0 4px 10px rgba(18, 183, 245, .3);
}
.rail-btn {
  width: 42px; height: 42px; border: 0; border-radius: 9px; background: transparent;
  color: #5c626b; display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.rail-btn:hover { background: rgba(255, 255, 255, .7); }
.rail-btn.active { background: #d7eaff; color: var(--blue-dark); }
.rail-gap { flex: 1; }

.list-panel {
  width: 268px; flex: none; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.list-head {
  height: 54px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.search {
  flex: 1; height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px;
  background: #f4f5f7; outline: none;
}
.search:focus { background: #fff; border-color: var(--blue); }
.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 7px; background: transparent;
  color: #5c626b; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--hover); color: var(--blue-dark); }

.conv-list { flex: 1; overflow-y: auto; padding: 6px 8px; }
.conv {
  display: flex; gap: 10px; padding: 10px; border-radius: 9px; align-items: center;
  cursor: pointer; transition: background .12s;
}
.conv:hover { background: var(--hover); }
.conv.active { background: var(--active); }
.conv-body { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { flex: none; font-size: 11px; color: var(--sub); }
.conv-last {
  margin-top: 3px; font-size: 12px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge {
  flex: none; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #f45b5b; color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}

.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px;
  user-select: none;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }

.main-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.view { flex: 1; min-height: 0; display: none; flex-direction: column; }
.view.active { display: flex; }

/* ---------------- 聊天 ---------------- */
.chat-head {
  height: 58px; flex: none; padding: 0 18px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line);
}
.chat-title { font-size: 15px; font-weight: 600; }
.chat-sub { margin-top: 2px; font-size: 12px; color: var(--sub); }
.chat-head-actions { display: flex; gap: 2px; }

.msg-scroll {
  flex: 1; overflow-y: auto; padding: 12px 20px 18px; background: var(--chat-bg);
  scroll-behavior: smooth; display: flex; flex-direction: column;
}
.msg-spacer { flex: 1 1 auto; min-height: 0; }
.msg, .time-divider, .empty { flex: none; }
.empty { padding: 60px 0; text-align: center; color: #a8adb5; font-size: 13px; }

.time-divider { text-align: center; margin: 16px 0 10px; }
.time-divider span {
  display: inline-block; padding: 2px 9px; border-radius: 9px;
  background: rgba(0, 0, 0, .05); color: #8e939b; font-size: 11px;
}

.msg { display: flex; gap: 9px; margin-bottom: 14px; align-items: flex-start; }
.msg.me { flex-direction: row-reverse; }
.msg-col { max-width: min(560px, 66%); }
.msg-meta { margin-bottom: 4px; font-size: 11px; color: var(--sub); }
.msg.me .msg-meta { text-align: right; }

.bubble {
  position: relative; padding: 9px 12px; border-radius: var(--radius);
  background: #fff; line-height: 1.6; word-break: break-word; white-space: pre-wrap;
  box-shadow: var(--shadow);
}
.bubble::before {
  content: ""; position: absolute; top: 11px; left: -5px;
  border-top: 5px solid transparent; border-bottom: 5px solid transparent;
  border-right: 6px solid #fff;
}
.msg.me .bubble {
  background: linear-gradient(135deg, #2ac6ff, #0a9bf0); color: #fff;
  box-shadow: 0 2px 8px rgba(18, 183, 245, .3);
}
.msg.me .bubble::before {
  left: auto; right: -5px; border-right: 0;
  border-left: 6px solid #0a9bf0;
}
.bubble.revoked { background: #f0f1f3; color: #9aa0a8; font-style: italic; box-shadow: none; }
.bubble.revoked::before { border-right-color: #f0f1f3; border-left-color: #f0f1f3; }
.bubble.media { white-space: normal; padding: 7px 9px; line-height: 1.4; }

.bubble img { display: block; max-width: 240px; max-height: 240px; border-radius: 6px; }
.bubble audio { display: block; width: 220px; }
.voice-line { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.voice-bar { display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.voice-bar i { display: block; width: 2px; background: currentColor; opacity: .65; border-radius: 1px; }
.file-card { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.file-ico {
  width: 34px; height: 34px; border-radius: 7px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18, 183, 245, .12); color: var(--blue-2); font-size: 12px; font-weight: 600;
}
.msg.me .file-ico { background: rgba(255, 255, 255, .22); color: #fff; }
.file-name { font-size: 13px; }
.file-size { font-size: 11px; opacity: .7; margin-top: 2px; }

.msg-tools {
  display: flex; gap: 6px; margin-top: 5px; opacity: 0; transition: opacity .12s;
}
.msg:hover .msg-tools { opacity: 1; }
.msg.me .msg-tools { justify-content: flex-end; }
.link-btn {
  border: 0; background: transparent; color: var(--blue-dark); font-size: 11px; padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------- 输入区 ---------------- */
.composer { flex: none; border-top: 1px solid var(--line); padding: 8px 16px 12px; background: #fff; }
.composer-tools { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.tool {
  width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent;
  color: #5c626b; display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.tool:hover { background: var(--hover); color: var(--blue-dark); }
.tool-text {
  height: 26px; padding: 0 8px; border: 0; border-radius: 5px; background: transparent;
  color: var(--sub); font-size: 12px;
}
.tool-text:hover { background: var(--hover); color: var(--blue-dark); }
.tool-sep { width: 1px; height: 16px; background: var(--line); margin: 0 6px; }
#msgInput {
  width: 100%; min-height: 62px; max-height: 160px; resize: none; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; outline: none; line-height: 1.55;
  background: #fafbfc;
}
#msgInput:focus { border-color: var(--blue); background: #fff; }
.composer-bottom {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 8px;
}
.typing-hint { margin-right: auto; color: var(--sub); font-size: 12px; }
#btnSend { flex: none; width: 96px; height: 32px; }

/* ---------------- 通用页面 ---------------- */
.page-head {
  height: 58px; flex: none; padding: 0 20px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--line);
}
.page-title { font-size: 15px; font-weight: 600; }
.page-head-actions { display: flex; gap: 8px; }
.page-body { flex: 1; overflow-y: auto; padding: 18px 20px; background: var(--chat-bg); }
.share-bar {
  margin-bottom: 12px; padding: 10px 12px; border-radius: 8px; background: #fff;
  border: 1px solid #d6ecff; color: #2b6ca3; font-size: 12px; word-break: break-all;
}

/* 空间 */
.moment-composer {
  background: #fff; border-radius: 10px; padding: 12px; box-shadow: var(--shadow); margin-bottom: 14px;
}
#momentInput {
  width: 100%; border: 0; outline: none; resize: none; line-height: 1.6; background: transparent;
}
.moment-composer-bar {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  padding-top: 8px; border-top: 1px solid var(--line);
}
.attach-hint { flex: 1; color: var(--sub); font-size: 12px; }
.moment-list { display: flex; flex-direction: column; gap: 12px; }
.moment {
  background: #fff; border-radius: 10px; padding: 14px; box-shadow: var(--shadow);
}
.moment-head { display: flex; gap: 10px; align-items: center; }
.moment-author { font-weight: 500; }
.moment-time { font-size: 11px; color: var(--sub); }
.moment-text { margin: 10px 0 0; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.moment-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.moment-imgs img {
  width: 104px; height: 104px; object-fit: cover; border-radius: 8px; cursor: pointer; background: #eef1f5;
}
.moment-foot {
  display: flex; gap: 14px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
}
.moment-comments { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: #f7f8fa; font-size: 12px; }
.moment-comments div { margin: 3px 0; line-height: 1.6; }
.moment-comments b { font-weight: 500; color: #2b6ca3; }

/* 文件 */
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: #fff; border-radius: 9px; box-shadow: var(--shadow);
}
.file-row .file-ico { width: 38px; height: 38px; font-size: 12px; }
.file-row-body { flex: 1; min-width: 0; }
.file-row-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-meta { margin-top: 3px; font-size: 11px; color: var(--sub); }
.file-row-actions { display: flex; gap: 8px; flex: none; }

/* 我的 */
.profile-card {
  display: flex; gap: 16px; align-items: center; padding: 18px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.profile-avatar {
  width: 64px; height: 64px; border-radius: 50%; color: #fff; font-size: 24px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2ac6ff, #0a84ff);
}
.profile-name { font-size: 17px; font-weight: 600; }
.profile-id { margin: 4px 0 8px; font-size: 12px; color: var(--sub); }
.form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px;
  background: #fff; border-radius: 12px; padding: 18px; box-shadow: var(--shadow);
}
.form-grid .field { margin: 0; }

/* 拖拽上传遮罩 */
.drop-mask {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 132, 255, .07);
}
.drop-mask[hidden] { display: none; }
.drop-inner {
  padding: 34px 54px; text-align: center; border-radius: 16px;
  border: 2px dashed var(--blue); background: rgba(255, 255, 255, .95);
  box-shadow: 0 16px 44px rgba(18, 183, 245, .2);
}
.drop-title { margin-top: 10px; font-size: 16px; font-weight: 600; color: #1a1a1a; }
.drop-sub { margin-top: 6px; font-size: 12px; color: var(--sub); }

/* 录音状态 */
.tool.recording {
  background: #ffecec; color: #e34d59;
  animation: rec-pulse 1s ease-in-out infinite;
}
@keyframes rec-pulse { 50% { opacity: .5; } }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  padding: 9px 16px; border-radius: 20px; background: rgba(28, 32, 38, .88); color: #fff;
  font-size: 13px; z-index: 80; pointer-events: none; max-width: 70vw;
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d6db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bfc3c9; }
::-webkit-scrollbar-track { background: transparent; }

/* 窄屏：底部导航 + 列表/聊天二选一 */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .rail {
    order: 3; width: 100%; height: 54px; flex-direction: row; padding: 0 8px;
    justify-content: space-around; border-top: 1px solid var(--line);
  }
  .rail-avatar { display: none; }
  .rail-gap { display: none; }
  .list-panel { order: 1; width: 100%; border-right: 0; }
  .main-panel { order: 2; }
  .app:not(.chatting) .main-panel { display: none; }
  .app.chatting .list-panel { display: none; }
  .app.chatting .rail { display: flex; }
  .msg-col { max-width: 74%; }
  .form-grid { grid-template-columns: 1fr; }
  .chat-head { padding: 0 12px; }
  .msg-scroll { padding: 10px 12px 14px; }
}

/* ===== 空间：好友/我的 切换 ===== */
.tab-btn {
  flex: none; height: 30px; padding: 0 14px; border-radius: 15px; border: 1px solid var(--line);
  background: #fff; color: var(--sub); font-size: 13px;
}
.tab-btn:hover { border-color: #cfe3f8; color: var(--blue-dark); }
.tab-btn.active { background: var(--active); border-color: #bcdcff; color: var(--blue-dark); font-weight: 500; }

/* ===== 我的 ===== */
.profile-avatar { cursor: pointer; }
.profile-account { margin-top: 4px; font-size: 12px; color: var(--sub); }
.profile-uid {
  margin-top: 2px; font-size: 12px; color: var(--sub);
  cursor: copy; user-select: none; display: inline-flex; align-items: center; gap: 4px;
}
.profile-uid:hover { color: var(--blue-dark); }
.entry-list {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.entry {
  width: 100%; height: 47px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line);
  background: #fff; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; color: #1a1a1a; text-align: left;
}
.entry:last-child { border-bottom: 0; }
.entry:hover { background: var(--hover); }
.entry-arrow { color: #b9bfc7; font-size: 16px; }
.entry-danger { color: #e34d59; }
a.entry { text-decoration: none; box-sizing: border-box; }

/* ===== 基本资料弹层 ===== */
.edit-mask {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(16, 24, 36, .34);
}
.edit-mask[hidden] { display: none; }
.edit-card {
  width: 520px; max-width: calc(100vw - 40px); background: #fff; border-radius: 14px;
  box-shadow: 0 20px 60px rgba(16, 36, 64, .22); overflow: hidden;
}
.edit-head {
  height: 50px; padding: 0 12px 0 18px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600;
}
.edit-card .form-grid { box-shadow: none; border-radius: 0; padding: 18px; }
.edit-foot { padding: 0 18px 18px; display: flex; justify-content: flex-end; }

/* ===== 会话列表：正在输入 / 已读未读 ===== */
.conv-last { display: flex; align-items: center; gap: 6px; }
.conv-last .conv-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-typing { color: #22a65b; display: flex; align-items: center; gap: 5px; }
.conv-typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #22c55e; display: inline-block;
}
.conv-state {
  flex: none; font-size: 10px; line-height: 15px; padding: 0 5px; border-radius: 4px;
}
.conv-state.read { color: #2f80ed; background: #eaf3ff; }
.conv-state.unread { color: #d97706; background: #fff2e6; }

/* ===== 语音气泡：点击播放 ===== */
.bubble.clickable { cursor: pointer; }
.bubble.clickable:hover { filter: brightness(1.03); }

/* ===== 页面返回 ===== */
.page-head-left { display: flex; align-items: center; gap: 8px; }
.back-btn {
  width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent;
  color: var(--sub); font-size: 20px; line-height: 1; padding-bottom: 3px;
}
.back-btn:hover { background: var(--hover); color: var(--blue-dark); }

/* ===== 好友 ===== */
.friend-list { display: flex; flex-direction: column; gap: 8px; }
.friend-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow);
}
.friend-body { flex: 1; min-width: 0; }
.friend-name { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.friend-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; flex: none; }
.friend-dot.off { background: #c9ced6; }
.friend-sub {
  margin-top: 3px; font-size: 11.5px; color: var(--sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.friend-actions { display: flex; gap: 6px; flex: none; }

/* ===== 收藏 ===== */
.fav-list { display: flex; flex-direction: column; gap: 8px; }
.fav-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow);
}
.fav-kind {
  flex: none; width: 38px; height: 38px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  background: rgba(18, 183, 245, .12); color: var(--blue-2);
}
.fav-body { flex: 1; min-width: 0; }
.fav-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-sub { margin-top: 3px; font-size: 11.5px; color: var(--sub); }
.fav-sub.missing { color: #e34d59; }

/* ===== 表情面板 ===== */
.emoji-panel {
  margin: 0 0 8px; padding: 10px 10px 6px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.emoji-panel[hidden] { display: none; }
.emoji-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.emoji-tabs button {
  height: 26px; padding: 0 12px; border: 1px solid var(--line); border-radius: 13px;
  background: transparent; color: var(--sub); font-size: 12px;
}
.emoji-tabs button.active { background: var(--active); border-color: #bcdcff; color: var(--blue-dark); }
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 2px; max-height: 168px; overflow-y: auto;
}
.emoji-grid button {
  height: 38px; border: 0; border-radius: 8px; background: transparent; font-size: 22px; line-height: 1;
}
.emoji-grid button:hover { background: var(--hover); }
.emoji-grid button.big { font-size: 26px; }

/* 纯表情消息放大显示 */
.bubble.emoji-only {
  background: transparent !important; box-shadow: none !important; padding: 0;
  font-size: 38px; line-height: 1.2;
}
.bubble.emoji-only::before { display: none; }

/* ===== 主题选择 ===== */
.entry-static { cursor: default; }
.entry-static:hover { background: var(--panel); }
.seg { display: flex; gap: 4px; }
.seg button {
  height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 13px;
  background: transparent; color: var(--sub); font-size: 12px;
}
.seg button.active { background: var(--active); border-color: #bcdcff; color: var(--blue-dark); }

/* ===== 深色主题 ===== */
html[data-theme='dark'] {
  --bg: #0f1115;
  --panel: #1a1d23;
  --rail: #14171c;
  --line: #2a2f37;
  --text: #e6e9ee;
  --sub: #8b929c;
  --hover: #232830;
  --active: #1d3348;
  --chat-bg: #101317;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
html[data-theme='dark'] .login-mask { background: linear-gradient(135deg, #0d141c, #0b0e12 55%, #101a24); }
html[data-theme='dark'] .login-card,
html[data-theme='dark'] .entry,
html[data-theme='dark'] .entry-list,
html[data-theme='dark'] .tab-btn,
html[data-theme='dark'] .form-grid,
html[data-theme='dark'] .moment,
html[data-theme='dark'] .moment-composer,
html[data-theme='dark'] .profile-card,
html[data-theme='dark'] .composer,
html[data-theme='dark'] .edit-card,
html[data-theme='dark'] .search { background: var(--panel); }
html[data-theme='dark'] .bubble { background: #262c33; color: #e6e9ee; }
html[data-theme='dark'] .bubble::before { border-right-color: #262c33; }
html[data-theme='dark'] .msg.me .bubble::before { border-left-color: var(--blue-2); }
html[data-theme='dark'] #msgInput { background: #232830; border-color: #2f353d; color: #e6e9ee; }
html[data-theme='dark'] .moment-comments { background: #22272e; }
html[data-theme='dark'] .moment-comments b { color: #6fb3e8; }
html[data-theme='dark'] .time-divider span { background: rgba(255, 255, 255, .08); color: #9aa2ac; }
html[data-theme='dark'] .bubble.revoked { background: #2a2f36; color: #8b929c; }
html[data-theme='dark'] .drop-inner { background: rgba(26, 29, 35, .96); }
html[data-theme='dark'] .empty { color: #6b727c; }
html[data-theme='dark'] .btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
html[data-theme='dark'] .btn-ghost:hover { background: var(--hover); }
html[data-theme='dark'] .share-bar { background: #1b2733; border-color: #2b455c; color: #7fb6e0; }
html[data-theme='dark'] .toast { background: rgba(40, 45, 52, .96); color: #e6e9ee; }
html[data-theme='dark'] .rail-btn:hover { background: var(--hover); }
html[data-theme='dark'] .search { color: #e6e9ee; }

/* 深色下补正硬编码的深色文字 */
html[data-theme='dark'] .entry,
html[data-theme='dark'] .drop-title { color: var(--text); }
html[data-theme='dark'] .icon-btn,
html[data-theme='dark'] .tool,
html[data-theme='dark'] .rail-btn,
html[data-theme='dark'] .back-btn { color: #a7afba; }
html[data-theme='dark'] .file-row-name,
html[data-theme='dark'] .friend-name,
html[data-theme='dark'] .fav-title,
html[data-theme='dark'] .moment-text,
html[data-theme='dark'] .moment-author,
html[data-theme='dark'] .conv-name,
html[data-theme='dark'] .page-title,
html[data-theme='dark'] .chat-title,
html[data-theme='dark'] .profile-name,
html[data-theme='dark'] .friend-name span { color: var(--text); }
html[data-theme='dark'] .entry-arrow { color: #6b727c; }
html[data-theme='dark'] .entry-danger { color: #ff6b78; }

/* 修复：.login-mask 的 display:flex 会覆盖 [hidden]，登录后遮罩必须真正消失 */
.login-mask[hidden] { display: none; }

/* ===== 好友资料弹层 ===== */
.friend-card { width: 420px; }
.friend-detail { display: flex; gap: 14px; align-items: center; padding: 18px; }
.avatar.lg {
  width: 64px; height: 64px; font-size: 24px; border-radius: 50%;
}
.fd-main { flex: 1; min-width: 0; }
.fd-name { font-size: 17px; font-weight: 600; }
.fd-line { margin-top: 4px; font-size: 12px; color: var(--sub); word-break: break-all; }
.fd-rows { padding: 0 18px 14px; }
.fd-row {
  display: flex; gap: 12px; padding: 7px 0; font-size: 13px;
  border-top: 1px solid var(--line);
}
.fd-row span:first-child { flex: none; width: 56px; color: var(--sub); }
.fd-row span:last-child { flex: 1; min-width: 0; color: var(--text); word-break: break-all; }

/* ===== 空间：按用户筛选提示 ===== */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; padding: 9px 12px; border-radius: 8px;
  background: var(--active); color: var(--blue-dark); font-size: 12.5px;
}
.filter-bar[hidden] { display: none; }

/* ===== 收藏星标高亮 ===== */
#btnFavConv.active { color: #f5a623; background: rgba(245, 166, 35, .12); }

/* 应用图标（登录页 logo） */
.login-logo { overflow: hidden; padding: 0; }
.login-logo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }

/* ===== 危险按钮 ===== */
.btn-danger {
  height: 34px; padding: 0 16px; border: 0; border-radius: 8px;
  background: #e5484d; color: #fff; font-size: 13px;
}
.btn-danger:hover { background: #d33a3f; }
.btn-danger:disabled { opacity: .5; }

/* ===== 会话列表：头像在线点 / 长按删除 ===== */
.conv { position: relative; user-select: none; }
.conv.pressing { background: var(--hover); }
.conv-swiped { background: #fdecec; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: #22c55e; border: 2px solid var(--panel);
}
.avatar-wrap .online-dot.off { background: #c9ced6; }

/* ===== 好友多选 ===== */
.sel-hint {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; padding: 9px 12px; border-radius: 8px;
  background: var(--active); color: var(--blue-dark); font-size: 12.5px;
}
.sel-hint[hidden] { display: none; }
.sel-hint-tip { color: var(--sub); font-size: 11.5px; }
.friend-row { cursor: pointer; transition: background .12s, box-shadow .12s; }
.friend-row.selected { background: var(--active); box-shadow: inset 0 0 0 1px #bcdcff; }
.friend-check {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid #c6ccd4; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; background: transparent;
}
.friend-row.selected .friend-check { background: #12b7f5; border-color: #12b7f5; }
.friend-foot {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--panel);
}
.friend-foot .btn-primary { min-width: 160px; }
.friend-foot-tip { font-size: 11.5px; color: var(--sub); }
.batch-bar {
  flex: none; display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 10px 20px; border-top: 1px solid var(--line); background: var(--panel);
}
.batch-bar[hidden] { display: none; }

/* ===== 确认 / 输入弹窗 ===== */
.confirm-mask {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(16, 24, 36, .38);
}
.confirm-mask[hidden] { display: none; }
.confirm-card {
  width: 340px; max-width: calc(100vw - 40px); padding: 20px 20px 16px;
  background: var(--panel); border-radius: 12px; box-shadow: 0 20px 60px rgba(16, 36, 64, .25);
}
.confirm-title { font-size: 15px; font-weight: 600; color: var(--text); }
.confirm-text { margin-top: 8px; font-size: 13px; line-height: 1.6; color: var(--sub); word-break: break-all; white-space: pre-line; }
.confirm-actions { margin-top: 18px; display: flex; gap: 10px; justify-content: flex-end; }
.prompt-input {
  width: 100%; margin-top: 14px; height: 34px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; color: var(--text);
}
html[data-theme='dark'] .prompt-input { background: #232830; }
.chat-sub .friend-dot { display: inline-block; margin-right: 5px; vertical-align: middle; }

/* [hidden] 必须真正隐藏（否则 display:flex 的元素会照常显示） */
[hidden] { display: none !important; }

/* 聊天头部头像（与状态一起实时同步） */
.chat-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head-left > div:last-child { min-width: 0; }

/* ===== 导航红点（消息 / 好友 / 空间） ===== */
.rail-btn { position: relative; }
.rail-dot {
  position: absolute; top: 7px; right: 8px; width: 8px; height: 8px;
  border-radius: 50%; background: #f45b5b; box-shadow: 0 0 0 2px var(--rail);
  pointer-events: none;
}

/* ===== 空间：谁赞了 ===== */
.moment-likes {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 8px;
  padding: 7px 10px; border-radius: 8px; background: var(--hover);
  font-size: 12.5px; color: var(--blue-dark); line-height: 1.5;
}
.moment-likes .like-heart { flex: none; color: #f45b5b; font-size: 13px; }
.moment-likes .like-names { flex: 1; min-width: 0; word-break: break-all; }
html[data-theme='dark'] .moment-likes { background: #232830; color: #78b6e6; }

/* 空间作者可点击进聊天 */
.moment-author, .moment-head .avatar { cursor: pointer; }
.moment-author:hover { color: var(--blue-dark); text-decoration: underline; }
