/* ============ LumeChat 全局样式 ============ */
:root {
  --primary: #6366f1;
  --primary-deep: #4f46e5;
  --primary-2: #a855f7;
  --grad: linear-gradient(90deg, #6366f1, #a855f7);
  --text: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --bg-card: #ffffff;
  --danger: #ef4444;
  --ok: #10b981;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(99, 102, 241, .08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #eef2ff 0%, #fdf2f8 50%, #eff6ff 100%) fixed;
  min-height: 100%;
  font-size: 15px;
}

button { font-family: inherit; }

.boot-loading {
  text-align: center; padding: 120px 20px; color: var(--muted); font-size: 16px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; cursor: default; }
.logo-ico { font-size: 22px; }
.logo-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.online-pill {
  font-size: 12px; color: var(--ok); background: #ecfdf5;
  border: 1px solid #a7f3d0; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.nav-btn {
  border: none; background: transparent; color: var(--muted);
  font-size: 14px; padding: 7px 14px; border-radius: 10px; cursor: pointer;
  transition: all .15s;
}
.nav-btn:hover { background: #eef2ff; color: var(--primary); }
.nav-btn.active { background: var(--grad); color: #fff; font-weight: 600; }

/* ---------- 布局 ---------- */
.container { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.main-area { padding: 20px 16px 80px; }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none; cursor: pointer; border-radius: 12px;
  padding: 9px 18px; font-size: 14px; font-weight: 600;
  background: var(--grad); color: #fff;
  transition: all .15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: #eef2ff; color: var(--primary);
}
.btn-ghost:hover { background: #e0e7ff; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-warn { background: #fef3c7; color: #b45309; }
.btn-warn:hover { background: #fde68a; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; font-size: 14.5px; font-family: inherit;
  outline: none; transition: border .15s, box-shadow .15s; background: #f8fafc;
  color: var(--text);
}
.input:focus, .textarea:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.counter { font-size: 12px; color: var(--faint); text-align: right; margin-top: 4px; }

/* ---------- 登录 / 注册 ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 60px 16px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card); border-radius: 24px;
  box-shadow: 0 20px 60px rgba(99, 102, 241, .14);
  padding: 36px 32px;
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .big { font-size: 46px; }
.auth-logo .name { font-size: 26px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-logo .sub { font-size: 12.5px; color: var(--faint); margin-top: 4px; }
.auth-tabs { display: flex; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; text-align: center; padding: 9px; border: none; background: transparent;
  border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.form-err {
  background: #fef2f2; color: var(--danger); border: 1px solid #fecaca;
  font-size: 13px; border-radius: 10px; padding: 9px 12px; margin-bottom: 14px;
}
.form-ok {
  background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0;
  font-size: 13px; border-radius: 10px; padding: 9px 12px; margin-bottom: 14px;
}

/* ---------- 全屏提示页（审核中/被封禁/强制下线） ---------- */
.notice-wrap { display: flex; justify-content: center; padding: 80px 16px; }
.notice-card {
  text-align: center; max-width: 420px; width: 100%;
  background: var(--bg-card); border-radius: 24px;
  box-shadow: 0 20px 60px rgba(99, 102, 241, .14);
  padding: 48px 32px;
}
.notice-card .emoji { font-size: 60px; margin-bottom: 16px; }
.notice-card h2 { font-size: 21px; margin-bottom: 10px; }
.notice-card p { color: var(--muted); font-size: 14px; line-height: 1.7; margin-bottom: 6px; word-break: break-all; }
.notice-card .btn { margin-top: 18px; }
.spin {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px;
  border: 2px solid #c7d2fe; border-top-color: var(--primary);
  border-radius: 50%; animation: rot 1s linear infinite; margin-right: 6px;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- 头像 ---------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  user-select: none;
}
.avatar-lg { width: 64px; height: 64px; font-size: 26px; }
.avatar-sm { width: 30px; height: 30px; font-size: 13px; }
.avatar-img { object-fit: cover; }
.avatar-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }

/* ---------- 动态 ---------- */
.composer { display: flex; gap: 12px; }
.composer .textarea { min-height: 64px; }
.composer-foot { display: flex; align-items: center; margin-top: 10px; }

.post-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.post-head .who { min-width: 0; }
.post-name { font-weight: 700; font-size: 14.5px; cursor: pointer; }
.post-name:hover { color: var(--primary); }
.post-sub { font-size: 12px; color: var(--faint); }
.post-del { margin-left: auto; }
.post-content { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }
.post-actions { display: flex; gap: 6px; }
.act-btn {
  border: none; background: transparent; color: var(--muted);
  font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; transition: all .15s;
}
.act-btn:hover { background: #f1f5f9; }
.act-btn.liked { color: #e11d48; font-weight: 700; }
.act-btn.on { background: #eef2ff; color: var(--primary); font-weight: 600; }

.comments-box { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }
.comment { display: flex; gap: 9px; padding: 7px 0; align-items: flex-start; }
.comment-body { min-width: 0; flex: 1; }
.comment-name { font-size: 13px; font-weight: 700; }
.comment-text { font-size: 13.5px; color: #334155; line-height: 1.55; word-break: break-word; white-space: pre-wrap; }
.comment-time { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.comment-del { border: none; background: none; color: var(--faint); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.comment-del:hover { color: var(--danger); background: #fef2f2; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form .input { padding: 8px 12px; font-size: 13.5px; }
.empty-tip { text-align: center; color: var(--faint); font-size: 13.5px; padding: 40px 0; }

/* ---------- 个人页 ---------- */
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.profile-stats { display: flex; gap: 22px; margin-top: 8px; }
.pstat b { font-size: 17px; }
.pstat span { font-size: 12px; color: var(--muted); display: block; }
.section-title { font-size: 15px; font-weight: 800; margin: 22px 0 12px; color: var(--text); }
.section-title:first-child { margin-top: 0; }

/* ---------- 管理后台 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.tab-btn {
  border: none; background: #fff; color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 12px; cursor: pointer; box-shadow: var(--shadow);
}
.tab-btn.active { background: var(--grad); color: #fff; }
.tab-count {
  background: #fee2e2; color: var(--danger); border-radius: 999px;
  font-size: 11.5px; padding: 1px 7px; margin-left: 5px; font-weight: 700;
}
.tab-btn.active .tab-count { background: rgba(255,255,255,.3); color: #fff; }

.pending-card { display: flex; gap: 13px; }
.pending-body { flex: 1; min-width: 0; }
.pending-msg {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: #475569; margin: 8px 0 10px;
  line-height: 1.6; word-break: break-word; white-space: pre-wrap;
}
.pending-actions { display: flex; gap: 8px; }

.table-wrap { overflow-x: auto; }
/* 全部用户列表：固定高度，表格在内部纵向滚动（横向+纵向兜底），行多时信息不再被截断 */
.table-wrap.users-fixed {
  height: 940px; /* 旧内核不支持 min() 时的兜底 */
  height: min(84vh, 940px);
  min-height: 340px;
  overflow: auto;
}
/* 用户列表页临时把容器放宽（760 → 1500），9 列无需横向滑动 */
.container:has(.users-fixed) { max-width: 1500px; }
/* 私聊/群聊/AI 问答页同步放宽（与全部用户比例一致） */
.container:has(.chat-layout), .container:has(.ai-box) { max-width: 1400px; }
.table-wrap.users-fixed table.users td { padding: 8px 9px; font-size: 13.5px; }
.table-wrap.users-fixed .u-msg { max-width: 150px; }
table.users {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 860px;
}
table.users th {
  text-align: left; font-size: 12px; color: var(--faint); font-weight: 600;
  padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
table.users td { padding: 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.users tr:hover td { background: #f8fafc; }
.u-cell { display: flex; align-items: center; gap: 9px; }
.u-name { font-weight: 700; font-size: 13.5px; }
.u-nick { font-size: 12px; color: var(--faint); }
.u-msg { font-size: 12px; color: var(--muted); max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pwd-cell { display: flex; align-items: center; gap: 6px; font-family: Consolas, monospace; font-size: 12.5px; }
.pwd-eye { border: none; background: none; cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.pwd-eye:hover { background: #eef2ff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px #d1fae5; }
.dot.off { background: #cbd5e1; }
.badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: #ecfdf5; color: #059669; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.rejected { background: #f1f5f9; color: #64748b; }
.badge.banned { background: #fee2e2; color: var(--danger); }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- 弹层 ---------- */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 20px; padding: 26px; width: 100%; max-width: 380px; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

#toast-box { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #0f172a; color: #fff; font-size: 13.5px;
  padding: 10px 20px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
.toast.err { background: #dc2626; }
.toast.ok { background: #059669; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 连接断开提示 ---------- */
.disconn-box { text-align: center; padding: 90px 20px; }
.disconn-box .emoji { font-size: 56px; }

/* ---------- 导航徽标 / 角色徽标 ---------- */
.nav-badge {
  background: #ef4444; color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 6px; margin-left: 5px; vertical-align: 2px;
  display: inline-block; min-width: 16px; text-align: center;
}
.badge.super { background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; }
.badge.admin-b { background: #eef2ff; color: #4f46e5; }
.badge.user-b { background: #f1f5f9; color: #64748b; }
.badge.ai-b { background: linear-gradient(90deg, #6366f1, #8b5cf6); color: #fff; }
.badge.muted-b { background: #fef3c7; color: #b45309; margin-left: 5px; }

/* ---------- 文件卡片 / 状态徽标 ---------- */
.file-card {
  display: flex; align-items: center; gap: 11px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 13px; margin: 6px 0; max-width: 460px;
}
.file-icon {
  width: 40px; height: 40px; border-radius: 10px; background: #eef2ff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.file-icon.big { width: 46px; height: 46px; font-size: 24px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 13.5px; font-weight: 700; word-break: break-all; }
.file-sub { font-size: 12px; color: var(--faint); }
.file-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-direction: column; }
.file-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.file-card { flex-wrap: wrap; }
.status-chip { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip-pending { background: #fef3c7; color: #b45309; }
.chip-ok { background: #ecfdf5; color: #059669; }
.chip-rej { background: #fee2e2; color: var(--danger); }

/* ---------- 发帖附件 chip ---------- */
.attach-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px;
  padding: 7px 12px; margin-bottom: 8px; font-size: 13px; max-width: 100%;
}
.attach-name { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-remove { border: none; background: none; cursor: pointer; color: var(--faint); font-size: 13px; padding: 2px; }
.attach-remove:hover { color: var(--danger); }

/* ---------- 禁言提示 ---------- */
.mute-banner {
  background: #fef3c7; border: 1px solid #fde68a; color: #92400e;
  font-size: 13.5px; padding: 12px 16px;
}

/* ---------- 全站公告 ---------- */
.announce-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #fefce8, #fef9c3);
  border: 1px solid #fde047; padding: 13px 16px;
}
.announce-icon { font-size: 22px; line-height: 1.2; }
.announce-body { flex: 1; min-width: 0; }
.announce-text {
  font-size: 14.5px; color: #713f12; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; font-weight: 600;
}
.announce-meta { font-size: 11.5px; color: #a16207; margin-top: 4px; }

/* ---------- 私信 ---------- */
/* 固定聊天窗口高度，消息多时在窗口内滚动，输入栏不再被顶下去 */
.chat-layout {
  display: flex; gap: 14px;
  height: 900px; height: min(80vh, 900px); max-height: calc(100vh - 120px); min-height: 480px;
}
.chat-side {
  width: 270px; flex-shrink: 0; background: var(--bg-card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-side-tabs { display: flex; border-bottom: 1px solid var(--line); }
.chat-tab {
  flex: 1; border: none; background: none; padding: 12px; font-size: 13.5px;
  font-weight: 700; color: var(--muted); cursor: pointer;
}
.chat-tab.active { color: var(--primary); box-shadow: inset 0 -2.5px 0 var(--primary); }
.chat-list { flex: 1; overflow-y: auto; padding: 6px; }
.chat-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 12px; cursor: pointer; transition: background .12s;
}
.chat-item:hover { background: #f1f5f9; }
.chat-item.active { background: #eef2ff; }
.chat-item-mid { flex: 1; min-width: 0; }
.chat-item-name { font-size: 14px; font-weight: 700; }
.chat-item-preview {
  font-size: 12px; color: var(--faint); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.fr-tip { background: #fff7ed; color: #c2410c; font-size: 13px; font-weight: 600; justify-content: center; }
.side-sec { font-size: 12px; color: var(--faint); font-weight: 700; padding: 12px 10px 4px; }
.friend-item .btn { margin-left: 4px; }
.friend-acts { display: flex; gap: 5px; flex-shrink: 0; }
.friend-search { padding: 2px 10px 8px; }

.chat-main {
  flex: 1; min-width: 0; background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-head-name { font-weight: 800; font-size: 15px; cursor: pointer; }
.chat-head-name:hover { color: var(--primary); }
.chat-head-sub { font-size: 12px; color: var(--faint); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc; }
.msg { display: flex; gap: 9px; align-items: flex-start; max-width: 82%; }
.msg .bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px;
  padding: 9px 13px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--grad); color: #fff; border: none; border-radius: 16px 4px 16px 16px; }
.msg.me .bubble-time { color: rgba(255,255,255,.75) !important; }
.bubble-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.bubble-time { font-size: 10.5px; color: var(--faint); margin-top: 4px; text-align: right; }
.msg .bubble .file-card { background: rgba(255,255,255,.9); }
.msg-recall {
  font-size: 11px; color: #94a3b8; cursor: pointer; align-self: center;
  white-space: nowrap; padding: 2px 4px; border-radius: 6px; user-select: none;
}
.msg-recall:hover { color: var(--danger, #ef4444); background: #fef2f2; }
.msg-recalled-text {
  font-size: 12px; color: #94a3b8; background: #f1f5f9;
  border-radius: 10px; padding: 5px 12px; font-style: italic;
}
.chat-input-bar {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line);
  background: #fff; align-items: center;
}
.chat-input-bar .input { flex: 1; padding: 9px 13px; }

/* ---------- AI 设置 ---------- */
.ai-card { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 10px; }
.ai-card-head { display: flex; align-items: center; justify-content: space-between; }
.ai-key { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; }

/* ---------- AI 问答 ---------- */
.ai-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding: 14px 18px;
}
.ai-head .section-title { margin: 0; }
.ai-head .hint { margin-top: 2px; }
.ai-box { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.ai-msgs {
  flex: 1; height: 660px; height: min(70vh, 660px); min-height: 320px; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f8fafc;
}
.ai-msg { display: flex; max-width: 86%; }
.ai-msg .bubble {
  background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px;
  padding: 10px 14px; box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.ai-msg.me { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg.me .bubble { background: var(--grad); color: #fff; border: none; border-radius: 16px 4px 16px 16px; }
.ai-msg.me .bubble-text { color: #fff; }
.ai-input-bar {
  display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line);
  background: #fff; align-items: center;
}
.ai-input-bar .input { flex: 1; padding: 10px 13px; }
.ai-quota {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; padding: 13px 18px;
}
.ai-quota-line { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.shop-item { margin-bottom: 10px; }

@media (max-width: 760px) {
  .chat-layout { flex-direction: column; height: auto; max-height: none; }
  .chat-side { width: 100%; max-height: 260px; }
  .chat-main { flex: none; height: 540px; height: min(70vh, 540px); min-height: 360px; }
  .ai-msgs { height: 480px; height: min(58vh, 480px); min-height: 300px; }
}

@media (max-width: 560px) {
  .auth-card { padding: 28px 22px; }
  .topbar-inner { padding: 8px 12px; }
  .main-area { padding: 14px 12px 60px; }
  .table-wrap.users-fixed { height: 620px; height: min(65vh, 620px); }
}

/* ---------- 消息中心 ---------- */
.notify-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px; padding: 14px 18px;
}
.notify-head .section-title { margin: 0; }
.notify-list { padding: 6px 12px; }
.notify-item {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 8px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; border-radius: 10px;
  transition: background .12s;
}
.notify-item:last-child { border-bottom: none; }
.notify-item:hover { background: #f8fafc; }
.notify-item.unread { background: #eef2ff66; }
.notify-item.unread:hover { background: #e0e7ff66; }
.notify-icon { font-size: 19px; line-height: 1.3; }
.notify-body { flex: 1; min-width: 0; }
.notify-text { font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.notify-item.unread .notify-text { font-weight: 700; }
.notify-time { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* ---------- 图片九宫格 / 灯箱 ---------- */
.img-grid { display: grid; gap: 5px; margin: 6px 0 10px; max-width: 420px; }
.img-grid.grid-1 { grid-template-columns: minmax(0, 300px); }
.img-grid.grid-2, .img-grid.grid-3, .img-grid.grid-4 { grid-template-columns: repeat(2, 1fr); }
.img-grid.grid-5, .img-grid.grid-6, .img-grid.grid-7, .img-grid.grid-8, .img-grid.grid-9 {
  grid-template-columns: repeat(3, 1fr);
}
.img-cell {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: #f1f5f9; cursor: zoom-in;
}
.img-grid.grid-1 .img-cell { aspect-ratio: auto; max-height: 320px; }
.img-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-mask {
  position: fixed; inset: 0; z-index: 300; background: rgba(15, 23, 42, .92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox-img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 20px 80px rgba(0,0,0,.5); }
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  border: none; background: rgba(255,255,255,.14); color: #fff;
  font-size: 34px; width: 52px; height: 52px; border-radius: 50%;
  cursor: pointer; user-select: none; line-height: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,.28); }
.lightbox-prev { left: 14px; }
.lightbox-next { right: 14px; }
.lightbox-close {
  position: fixed; top: 14px; right: 16px; border: none; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 17px;
  width: 40px; height: 40px; border-radius: 50%;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); }
.lightbox-counter {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: #e2e8f0; font-size: 13px; background: rgba(255,255,255,.12);
  padding: 4px 14px; border-radius: 999px;
}

/* ---------- 发帖：配图九宫格 / 投票编辑 / 按钮排 ---------- */
.composer-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.composer-btns .btn-ghost.on { background: var(--grad); color: #fff; }
.composer-grid { display: grid; grid-template-columns: repeat(4, 74px); gap: 7px; margin: 8px 0; }
.composer-grid-cell {
  position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden;
  background: #f1f5f9; border: 1px solid var(--line);
}
.composer-grid-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.composer-grid-cell.uploading { opacity: .55; }
.composer-grid-cell.more {
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--faint); cursor: pointer; border-style: dashed;
}
.composer-grid-cell.more:hover { background: #eef2ff; color: var(--primary); }
.grid-status {
  position: absolute; bottom: 3px; left: 3px; font-size: 10px; font-weight: 700;
  background: rgba(15,23,42,.65); color: #fff; border-radius: 6px; padding: 1px 6px;
}
.grid-status.err { background: rgba(220,38,38,.8); }
.grid-remove {
  position: absolute; top: 3px; right: 3px; background: rgba(15,23,42,.55);
  color: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.poll-editor { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; margin: 8px 0; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; margin-bottom: 7px; }

/* ---------- 投票展示 ---------- */
.poll-box {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 13px; margin: 6px 0 10px;
}
.poll-total { font-size: 11.5px; color: var(--faint); margin-bottom: 8px; font-weight: 600; }
.poll-opt {
  position: relative; border-radius: 9px; padding: 8px 11px; margin-bottom: 6px;
  background: #fff; border: 1px solid var(--line); overflow: hidden; cursor: default;
}
.poll-opt:not(.voted) { cursor: pointer; }
.poll-opt:not(.voted):hover { border-color: var(--primary); background: #eef2ff; }
.poll-bar {
  position: absolute; inset: 0; width: 0; background: #e0e7ff;
  transition: width .3s ease;
}
.poll-opt.mine .poll-bar { background: #c7d2fe; }
.poll-label {
  position: relative; display: flex; justify-content: space-between; gap: 10px;
  font-size: 13.5px; align-items: center;
}
.poll-text { word-break: break-word; }
.poll-pct { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }

/* ---------- 私聊：搜索 / 语音 / AI ---------- */
.chat-search-btn {
  margin-left: auto; border: none; background: transparent; cursor: pointer;
  font-size: 15px; padding: 4px 8px; border-radius: 8px;
}
.chat-search-btn:hover { background: #eef2ff; }
.chat-search-panel { border-bottom: 1px solid var(--line); padding: 9px 12px; background: #fff; }
.chat-search-result { max-height: 190px; overflow-y: auto; margin-top: 7px; }
.chat-search-item { padding: 6px 8px; border-radius: 8px; cursor: default; }
.chat-search-item:hover { background: #f1f5f9; }
.chat-search-who { font-size: 11px; color: var(--faint); }
.chat-search-text { font-size: 13px; color: #334155; word-break: break-word; }
.mic-btn.recording {
  background: #fee2e2 !important; color: var(--danger) !important;
  animation: mic-pulse 1.1s infinite;
}
@keyframes mic-pulse { 50% { opacity: .55; } }
.audio-preview { width: 210px; max-width: 100%; height: 38px; display: block; margin-top: 4px; }

/* ---------- 排行榜 / 签到日历 ---------- */
.lb-me { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 10px; }
.lb-row.me { background: #eef2ff; }
.lb-rank { width: 26px; text-align: center; font-weight: 800; font-size: 13.5px; color: var(--muted); flex-shrink: 0; }
.lb-name { flex: 1; min-width: 0; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.lb-name:hover { color: var(--primary); }
.lb-points { font-weight: 800; font-size: 13.5px; color: #b45309; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal-cell {
  text-align: center; font-size: 11.5px; padding: 6px 0; border-radius: 8px;
  color: var(--muted); background: #f8fafc;
}
.cal-cell.empty { background: transparent; }
.cal-cell.cal-week { color: var(--faint); font-weight: 700; background: transparent; }
.cal-cell.on { background: var(--grad); color: #fff; font-weight: 700; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--primary); }

/* ---------- 邀请码 ---------- */
.invite-code {
  font-family: Consolas, monospace; font-size: 16px; font-weight: 800;
  letter-spacing: 2px; color: var(--primary); cursor: pointer;
}
.invite-code:hover { text-decoration: underline; }

/* ---------- 群聊 ---------- */
.grp-avatar { display: flex; align-items: center; justify-content: center; font-size: 16px; }
.new-group-btn { width: 100%; margin-bottom: 8px; }
.member-row { padding: 7px 8px; }
.bubble-sender {
  font-size: 11.5px; font-weight: 700; color: var(--primary);
  margin-bottom: 2px;
}
.msg.me .bubble-sender { display: none; }
.report-btn { margin-left: auto; }
.act-btn.report-btn:hover { color: var(--danger); background: #fef2f2; }

/* ============ v16 新增：话题 / 提及 / 等级 / 转发 / 收藏 / 打赏 ============ */
.topic-link {
  color: var(--primary); font-weight: 700; cursor: pointer; border-radius: 6px;
}
.topic-link:hover { text-decoration: underline; }
.mention-hl { color: var(--primary-2); font-weight: 700; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.topic-chip {
  font-size: 12px; font-weight: 700; color: var(--primary);
  background: #eef2ff; border: 1px solid #e0e7ff;
  padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.topic-chip:hover { background: #e0e7ff; }
.post-topics { margin-top: 8px; }
.tag-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lv-badge {
  display: inline-block; font-size: 10.5px; font-weight: 800; line-height: 1;
  color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316);
  padding: 3px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 1px;
}
.lv-badge.lv-lg { font-size: 12px; padding: 4px 8px; margin-left: 8px; }
.repost-card {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin: 8px 0; cursor: pointer;
}
.repost-card:hover { border-color: #c7d2fe; }
.repost-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.repost-name { font-weight: 700; font-size: 13px; }
.repost-body { font-size: 13.5px; color: var(--muted); word-break: break-word; }
.act-btn.fav { color: #f59e0b; }
.ai-sum-wrap { margin-top: 8px; }
.ai-sum-text {
  margin-top: 6px; font-size: 13px; color: var(--muted); background: #f5f3ff;
  border: 1px dashed #c4b5fd; border-radius: 10px; padding: 8px 10px; word-break: break-word;
}

/* 等级 / 成就 / 周报 / 登录记录 / 仪表盘 / 日志 */
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.medal {
  text-align: center; padding: 10px 6px; border-radius: 12px;
  background: #f8fafc; border: 1px solid var(--line); opacity: .45; filter: grayscale(1);
}
.medal.on { opacity: 1; filter: none; background: #fffbeb; border-color: #fde68a; }
.medal-ico { font-size: 22px; }
.medal-name { font-size: 12px; font-weight: 800; margin-top: 4px; }
.medal-desc { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.weekly-text { font-size: 12px; color: var(--faint); margin-top: 8px; }
.weekly-main { font-size: 14px; line-height: 1.7; margin-top: 6px; word-break: break-word; }
.login-row .lb-name { font-weight: 600; font-size: 12.5px; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 10px; }
.dash-stat { text-align: center; padding: 14px 8px; }
.dash-num { font-size: 22px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.dash-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dash-warn { font-size: 13px; color: var(--muted); font-weight: 600; }
.dash-chart { width: 100%; height: auto; }
.log-list { max-height: 420px; overflow-y: auto; margin-top: 8px; }
.log-row {
  display: flex; gap: 10px; padding: 6px 6px; border-radius: 8px;
  font-size: 12.5px; border-bottom: 1px dashed var(--line);
}
.log-time { color: var(--faint); white-space: nowrap; flex-shrink: 0; }
.log-msg { word-break: break-word; }
.btn-link {
  border: none; background: transparent; color: var(--primary); font-size: 12.5px;
  cursor: pointer; margin-top: 10px; padding: 4px; width: 100%;
}
.btn-link:hover { text-decoration: underline; }
.sec-wrap { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }

/* ============ 聊天：引用回复 / 壁纸 / @补全 ============ */
.quote-box {
  background: rgba(99, 102, 241, .08); border-left: 3px solid var(--primary);
  border-radius: 6px; padding: 5px 8px; margin-bottom: 5px; max-width: 100%;
}
.quote-who { font-size: 11px; font-weight: 700; color: var(--primary); }
.quote-text {
  font-size: 12px; color: var(--muted); max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quote-chip {
  display: flex; align-items: center; gap: 8px; margin: 0 12px 6px;
  background: #eef2ff; border: 1px solid #e0e7ff; border-radius: 10px; padding: 6px 10px;
}
.quote-chip-text {
  flex: 1; font-size: 12.5px; color: var(--primary); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-quote { opacity: 0; transition: opacity .12s; }
.msg:hover .msg-quote { opacity: 1; }
.at-menu {
  position: relative; z-index: 30; margin-top: -4px; margin-bottom: 6px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 180px; overflow-y: auto;
}
.at-item { padding: 7px 12px; font-size: 13.5px; cursor: pointer; }
.at-item:hover { background: #eef2ff; color: var(--primary); }
/* 聊天壁纸（6 款渐变） */
.chat-msgs.wp-1 { background: linear-gradient(160deg, #fef3c7, #fde68a 60%, #fca5a5); }
.chat-msgs.wp-2 { background: linear-gradient(160deg, #d1fae5, #a7f3d0 55%, #93c5fd); }
.chat-msgs.wp-3 { background: linear-gradient(160deg, #e0e7ff, #c7d2fe 55%, #f5d0fe); }
.chat-msgs.wp-4 { background: linear-gradient(160deg, #fce7f3, #fbcfe8 55%, #ddd6fe); }
.chat-msgs.wp-5 { background: linear-gradient(160deg, #ccfbf1, #99f6e4 55%, #7dd3fc); }
.chat-msgs.wp-6 { background: linear-gradient(160deg, #e2e8f0, #cbd5e1 55%, #94a3b8); }

/* ============ 深色模式 ============ */
body.dark {
  --text: #e2e8f0;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #293548;
  --bg-card: #111a2c;
  --shadow: 0 4px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
body.dark,
body.dark .auth-wrap { background: #0b1120 !important; }
body.dark .topbar { background: rgba(11, 17, 32, .9); border-bottom-color: var(--line); }
body.dark .card,
body.dark .auth-card,
body.dark .modal-box,
body.dark .chat-search-panel,
body.dark .at-menu { background: var(--bg-card) !important; border-color: var(--line) !important; }
body.dark .nav-btn:hover { background: #1c2740; }
body.dark .online-pill { background: #06281e; border-color: #14532d; }
body.dark .input, body.dark textarea.textarea, body.dark select.input {
  background: #0d1526; border-color: var(--line); color: var(--text);
}
body.dark .input::placeholder, body.dark textarea.textarea::placeholder { color: var(--faint); }
body.dark .post-sub, body.dark .hint, body.dark .counter, body.dark .empty-tip { color: var(--muted); }
body.dark .repost-card { background: #0d1526; border-color: var(--line); }
body.dark .repost-body { color: var(--muted); }
body.dark .medal { background: #0d1526; border-color: var(--line); }
body.dark .medal.on { background: #2a2213; border-color: #92600a; }
body.dark .medal-desc, body.dark .medal-name { color: var(--muted); }
body.dark .medal-name { color: var(--text); }
body.dark .topic-chip { background: #1c2740; border-color: #2b3a58; color: #a5b4fc; }
body.dark .lb-row.me { background: #1c2740; }
body.dark .cal-cell { background: #0d1526; }
body.dark .cal-cell.cal-week, body.dark .cal-cell.empty { background: transparent; }
body.dark .chat-side, body.dark .chat-list { background: var(--bg-card); border-color: var(--line); }
body.dark .chat-item:hover { background: #1c2740; }
body.dark .chat-item.active { background: #223052; }
body.dark .chat-item-name, body.dark .chat-item-preview { color: var(--text); }
body.dark .chat-item-preview { color: var(--muted); }
body.dark .bubble { background: #1c2740 !important; color: var(--text); }
body.dark .msg.me .bubble { background: var(--primary-deep) !important; color: #fff; }
body.dark .chat-head, body.dark .chat-input-bar { background: var(--bg-card); border-color: var(--line); }
body.dark .chat-search-btn:hover { background: #1c2740; }
body.dark .chat-search-item:hover { background: #1c2740; }
body.dark .chat-search-text { color: var(--text); }
body.dark .quote-box { background: rgba(99, 102, 241, .15); }
body.dark .quote-chip { background: #1c2740; border-color: #2b3a58; }
body.dark .comment-text { color: var(--text); }
body.dark .comment-time { color: var(--faint); }
body.dark .ai-sum-text { background: #1e1b3a; border-color: #4c3d8f; color: var(--muted); }
body.dark .log-row { border-bottom-color: var(--line); }
body.dark .btn-ghost { background: #1c2740; color: var(--text); border-color: var(--line); }
body.dark .btn-ghost:hover { background: #223052; }
body.dark .tab-btn { background: #0d1526; color: var(--muted); border-color: var(--line); }
body.dark .tab-btn.active { background: var(--primary); color: #fff; }
body.dark .notice-card { background: var(--bg-card); color: var(--text); }
body.dark .status-chip.chip-pending { background: #2a2213; color: #fbbf24; }
body.dark .attach-chip { background: #0d1526; border-color: var(--line); }
body.dark .attach-name { color: var(--text); }
body.dark .form-err { background: #3b1216; color: #fca5a5; }
body.dark .fr-tip { background: #1c2740; color: var(--text); }
body.dark .boot-loading { color: var(--muted); background: #0b1120; }
body.dark .msg-recall { color: var(--faint); }
body.dark .msg-recall:hover { color: var(--danger); background: #3b1216; }

/* AI 角色自动发动态开关（开启态） */
.btn-ok { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.btn-ok:hover { background: #d1fae5; }
body.dark .btn-ok { background: #0c2b22; color: #34d399; border-color: #14532d; }
body.dark .btn-ok:hover { background: #11362b; }

/* 视频附件 / 聊天视频预览 */
.file-card .file-video {
  width: 100%; max-width: 320px; max-height: 240px; border-radius: 10px;
  background: #000; display: block; margin-top: 8px;
}
.img-cell .grid-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.img-cell.has-video { cursor: default; }
.composer-grid-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-badge {
  position: absolute; left: 6px; bottom: 6px; z-index: 2;
  background: rgba(15, 23, 42, .72); color: #fff; font-size: 11px;
  padding: 2px 7px; border-radius: 999px; pointer-events: none;
}
.lightbox-video {
  max-width: 92vw; max-height: 88vh; border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .5); background: #000;
}

/* 个人中心媒体墙 */
.media-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.media-cell {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: #f1f5f9; cursor: zoom-in;
}
.media-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-cell video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
body.dark .media-cell { background: #0d1526; }

/* 点头像 / 名字看主页 */
.avatar-link { cursor: pointer; transition: filter .15s, transform .15s; }
.avatar-link:hover { filter: brightness(1.12); transform: scale(1.05); }
.user-link { cursor: pointer; }
.user-link:hover { color: var(--primary); }

/* 等级装扮：头像框 / 定时标记 / 抽签 */
.perk-frame-gold { box-shadow: 0 0 0 2px #fbbf24, 0 0 8px rgba(251, 191, 36, .65); }
.perk-frame-pink { box-shadow: 0 0 0 2px #f472b6, 0 0 8px rgba(244, 114, 182, .6); }
.perk-frame-rainbow {
  box-shadow: 0 0 0 2px #f87171, 0 0 0 4px #fbbf24, 0 0 0 6px #34d399, 0 0 10px rgba(96, 165, 250, .5);
}
.perk-frame-flame { box-shadow: 0 0 0 2px #f97316, 0 0 12px rgba(249, 115, 22, .8); }
.sched-chip {
  display: inline-block; font-size: 11px; margin-top: 2px;
  background: #fef3c7; color: #b45309; border-radius: 999px; padding: 2px 8px;
}
body.dark .sched-chip { background: #2a2213; color: #fbbf24; }
.fortune-card {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
}
.fortune-normal { background: #f1f5f9; color: #475569; }
.fortune-rare { background: #e0e7ff; color: #4338ca; }
.fortune-legend { background: linear-gradient(90deg, #fde68a, #fbcfe8); color: #92400e; }
.fortune-text { margin: 8px 0 4px; font-size: 15px; }
body.dark .fortune-normal { background: #1c2740; color: var(--text); }
body.dark .fortune-rare { background: #1e1b4b; color: #a5b4fc; }
 
/* ----------------

/* ---------------- 兑换码 ---------------- */
.redeem-codes{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
.redeem-chip{font-family:ui-monospace,Consolas,monospace;font-size:15px;letter-spacing:1px;padding:6px 12px;border-radius:8px;border:1px dashed var(--border,#cbd5e1);background:var(--card,#fff);cursor:pointer;color:inherit}
.redeem-chip:active{transform:scale(.96)}
