* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #eef2f8;
  --surface: #f8fafc;
  --white: #ffffff;
  --primary: #2563eb;
  --primary-hover: #3b82f6;
  --primary-light: #eff6ff;
  --primary-glow: rgba(37,99,235,.12);
  --accent: #06b6d4;
  --accent-light: #ecfeff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --shadow-dark: #c8d0dd;
  --shadow-light: #ffffff;
  --shadow-raised: 12px 12px 24px var(--shadow-dark), -12px -12px 24px var(--shadow-light);
  --shadow-pressed: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
  --shadow-soft: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --shadow-sm: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  --shadow-lg: 16px 16px 32px var(--shadow-dark), -16px -16px 32px var(--shadow-light);
  --shadow-inset-sm: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 230px;
  --header-h: 62px;
  --font: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei","Helvetica Neue",sans-serif;
}
html, body { height: 100%; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

::selection { background: var(--primary); color: var(--white); }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d0dd; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.sidebar-inner::-webkit-scrollbar { width: 3px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: #dce4f0; }
.sidebar-inner::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ============ LOGIN ============ */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: var(--bg); }
.login-container { width: 100%; max-width: 400px; }
.login-box { background: var(--white); border-radius: var(--radius-xl); padding: 44px 36px 34px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.login-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); z-index: 1; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: inline-flex; align-items: center; justify-content: center; color: var(--white); margin-bottom: 14px; box-shadow: var(--shadow-soft); overflow: hidden; }
.login-logo-icon:has(img) { background: none; }
.login-logo-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.login-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.login-form { transition: opacity .3s; }
.form-tip { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; text-align: center; }
.login-footer { text-align: center; margin-top: 18px; }
.login-footer a { color: var(--primary); font-size: 13px; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.login-footer a:hover { opacity: .8; }
.login-footer-text { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-light); }

.form-input { width: 100%; padding: 12px 18px; border: none; border-radius: var(--radius); font-size: 14px; outline: none; transition: all .25s; background: var(--bg); box-shadow: var(--shadow-inset-sm); color: var(--text); }
.form-input:focus { box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light), 0 0 0 3px var(--primary-glow); }
.form-input::placeholder { color: var(--text-light); }
.input-group { margin-bottom: 16px; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; border: none; border-radius: var(--radius); font-size: 14px; cursor: pointer; transition: all .2s cubic-bezier(.34,1.56,.64,1); white-space: nowrap; text-decoration: none; gap: 6px; user-select: none; font-weight: 600; box-shadow: var(--shadow-soft); background: var(--white); color: var(--text); position: relative; overflow: hidden; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.96); }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--white); box-shadow: var(--shadow-soft); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-raised); }
.btn-primary:active:not(:disabled) { transform: translateY(0) scale(.97); box-shadow: var(--shadow-pressed); }
.btn-default { background: var(--white); color: var(--text); }
.btn-default:hover { box-shadow: var(--shadow-raised); }
.btn-default:active { box-shadow: var(--shadow-pressed); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: var(--white); }
.btn-danger:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-raised); }
.btn-danger:active:not(:disabled) { transform: translateY(0) scale(.97); }
.btn-outline { background: transparent; box-shadow: none; color: var(--primary); }
.btn-outline:hover { box-shadow: var(--shadow-soft); background: var(--white); }
.btn-sm { padding: 6px 16px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 6px; }
.error-msg { color: #ef4444; font-size: 13px; }
.shake { animation: shake .4s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.form-input.shake { box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 3px rgba(239,68,68,.2); }

/* ============ CHAT APP ============ */
.chat-app { height: 100vh; height: 100dvh; padding: 50px; background: var(--bg); }
.chat-container { width: 100%; max-width: 1300px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; background: var(--white); box-shadow: var(--shadow-lg); border-radius: var(--radius-xl); overflow: hidden; }

/* ----- Header ----- */
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 0 28px; height: var(--header-h); background: var(--white); flex-shrink: 0; z-index: 10; box-shadow: 0 1px 0 #e2e8f0; }
.header-left { display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--text-secondary); border-radius: var(--radius-sm); transition: all .15s; }
.menu-toggle:hover { background: var(--bg); color: var(--primary); }
@media (max-width: 767px) { .menu-toggle { display: flex; align-items: center; } }
.header-logo { width: 36px; height: 36px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: var(--shadow-sm); color: var(--white); overflow: hidden; }
.header-logo:has(img) { background: none; }
.header-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.header-title { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: .3px; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* User Menu */
.user-menu { position: relative; }
.user-menu-trigger { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 14px 4px 4px; border-radius: 24px; user-select: none; background: var(--bg); box-shadow: var(--shadow-sm); }
.user-menu-trigger:hover { box-shadow: var(--shadow-soft); }
.header-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid var(--white); flex-shrink: 0; }
.header-nickname { font-size: 13px; font-weight: 600; color: var(--text); }
.menu-arrow { color: var(--text-light); transition: transform .2s; display: flex; align-items: center; }
.user-menu:hover .menu-arrow { transform: rotate(180deg); }

.user-menu-dropdown { position: absolute; top: calc(100% + 10px); right: 0; min-width: 180px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 500; animation: dropIn .15s ease; }
.user-menu-dropdown.open { display: block; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
.um-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 13px; cursor: pointer; border-radius: var(--radius-sm); transition: all .15s; color: var(--text); }
.um-item:hover { background: var(--primary-light); color: var(--primary); }
.um-item iconify-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-secondary); }
.um-item:hover iconify-icon { color: var(--primary); }
.um-item-danger { color: #ef4444; }
.um-item-danger iconify-icon { color: #ef4444; }
.um-item-danger:hover { background: #fef2f2 !important; color: #dc2626; }
.um-divider { height: 1px; background: #e2e8f0; margin: 4px 12px; }

/* ----- Chat Body ----- */
.chat-body { flex: 1; display: flex; overflow: hidden; }

/* ----- Sidebar ----- */
.chat-sidebar { width: var(--sidebar-w); flex-shrink: 0; background: linear-gradient(180deg, #f8faff, var(--white)); display: flex; flex-direction: column; border-right: 1px solid #dce4f0; }
.sidebar-inner { flex: 1; overflow-y: auto; padding: 14px 0; }
.sidebar-footer { padding: 10px 14px; flex-shrink: 0; background: var(--white); border-top: 1px solid #dce4f0; }
.sidebar-section { padding: 2px 0; }
.sidebar-title { font-size: 10px; font-weight: 700; color: var(--primary); padding: 14px 20px 6px 28px; text-transform: uppercase; letter-spacing: 1.2px; position: relative; }
.sidebar-title::before { content: ''; position: absolute; left: 14px; top: 16px; bottom: 6px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.sidebar-divider { height: 1px; background: #e2e8f0; margin: 6px 14px; }
.sidebar-list { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; font-size: 13px; color: var(--text); transition: all .15s; border-radius: var(--radius); margin: 1px 0; position: relative; transform: translateX(0); }
.sidebar-item:hover { background: var(--primary-light); transform: translateX(3px); }
.sidebar-item-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-item-active::before { content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 4px; height: 22px; border-radius: 4px; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.si-icon { width: 20px; height: 20px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.sidebar-item-active .si-icon { color: var(--primary); }
.si-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.si-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid var(--white); box-shadow: var(--shadow-sm); }
.si-online { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; flex-shrink: 0; box-shadow: 0 0 0 2px var(--white); margin-left: auto; animation: pulse-dot 2s ease infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.si-role { font-size: 10px; color: var(--primary); background: var(--primary-light); padding: 2px 10px; border-radius: 12px; font-weight: 600; flex-shrink: 0; }

.sidebar-item-cardkey { border: 1px dashed var(--primary); border-radius: var(--radius); background: var(--primary-light); color: var(--primary); gap: 8px; padding: 9px 14px; justify-content: center; }
.sidebar-item-cardkey:hover { background: var(--white); }
.sidebar-item-cardkey .si-icon { color: var(--primary); }

/* ----- Main Chat ----- */
.chat-main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--white); position: relative; }

/* ===== 樱花花瓣飘落 + 桌面宠物 ===== */
#sakuraLayer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.petal { position: absolute; top: -24px; width: 12px; height: 10px; background: linear-gradient(135deg, #ffd7e2, #ff9db8); border-radius: 100% 0 100% 0; opacity: .7; animation: petalFall linear infinite; will-change: transform; }
@keyframes petalFall {
  0% { transform: translate3d(0, -24px, 0) rotate(0deg); }
  100% { transform: translate3d(var(--sw, 40px), 108vh, 0) rotate(560deg); }
}
#chatPet { position: absolute; z-index: 6; width: 80px; height: 105px; left: 6%; top: 55%; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,.14)); animation: petIdle 3.2s ease-in-out infinite; will-change: transform; }
#chatPet.grabbing { cursor: grabbing; animation: petWobble .5s ease-in-out infinite; }
#chatPet .pet-img { width: 100%; height: 100%; display: block; pointer-events: none; object-fit: contain; transition: transform .25s ease; }
#chatPet.grabbing .pet-img { transform: rotate(-14deg) scale(1.04); }
#chatPet.jump { animation: petJump .55s ease; }
#chatPet.spin { animation: petSpin .8s ease; }
#chatPet.dance { animation: petDance .9s ease; }
#chatPet.shake { animation: petShake .5s ease; }
@keyframes petIdle {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  50% { transform: translateY(-7px) rotate(2.5deg); }
}
@keyframes petJump {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-28px) scale(1.06); }
  60% { transform: translateY(0) scale(.97, .94); }
  80% { transform: translateY(-8px); }
}
@keyframes petSpin { to { transform: rotate(360deg) scale(1.04); } }
@keyframes petDance {
  0%, 100% { transform: rotate(-9deg) translateY(0); }
  25% { transform: rotate(9deg) translateY(-6px); }
  50% { transform: rotate(-9deg) translateY(0); }
  75% { transform: rotate(9deg) translateY(-6px); }
}
@keyframes petShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  80% { transform: translateX(-4px); }
}
@keyframes petWobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}
.pet-bubble { position: absolute; top: -30px; left: 50%; background: #fff; border: 1px solid #f3c3d4; color: #d4694f; font-size: 13px; line-height: 1; padding: 5px 10px; border-radius: 14px; opacity: 0; pointer-events: none; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.pet-bubble.show { animation: bubbleUp 1.7s ease forwards; }
@keyframes bubbleUp {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  18% { opacity: 1; transform: translate(-50%, 0); }
  78% { opacity: 1; transform: translate(-50%, -4px); }
  100% { opacity: 0; transform: translate(-50%, -14px); }
}

.chat-channel-header { display: flex; align-items: center; padding: 14px 28px; background: linear-gradient(90deg, #f8faff, var(--white)); flex-shrink: 0; font-size: 14px; font-weight: 600; gap: 10px; border-bottom: 1px solid #e2e8f0; position: relative; }
.chat-channel-header::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.channel-header-icon { width: 22px; height: 22px; color: var(--primary); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.channel-actions { margin-left: auto; }

/* Messages Area */
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 28px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.chat-messages::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--primary-light), transparent); z-index: 1; pointer-events: none; }

@keyframes spin { to { transform: rotate(360deg); } }

.msg-loading-text { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 60px 0; color: var(--text-secondary); font-size: 14px; }
.media-loading { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 20px; color: var(--text-secondary); font-size: 13px; background: var(--surface); border-radius: 8px; min-width: 80px; min-height: 80px; }
.msg-image { position: relative; }
.msg-image .media-loading { position: absolute; inset: 0; z-index: 2; }
.msg-image img { position: relative; z-index: 1; }
.msg-video { position: relative; min-width: 80px; min-height: 80px; background: var(--surface); border-radius: var(--radius); }
.msg-video .media-loading { position: absolute; inset: 0; z-index: 2; }
.msg-video video { position: relative; z-index: 1; min-width: 80px; min-height: 80px; }

/* Messages */
.message { display: flex; gap: 10px; max-width: min(78%, 700px); margin-bottom: 2px; animation: msgIn .25s ease; position: relative; transition: transform .15s, box-shadow .15s; }
.message-other:hover { transform: translateX(4px); }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.message-self { align-self: flex-end; flex-direction: row-reverse; }
.message-other { align-self: flex-start; }

.msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; overflow: hidden; margin-top: 2px; box-shadow: var(--shadow-sm); }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-avatar .avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--white); }
.message-self .msg-avatar .avatar-placeholder { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.message-other .msg-avatar .avatar-placeholder { background: linear-gradient(135deg, #22c55e, #14b8a6); }

.message-grouped .msg-avatar { visibility: hidden; }
.message-grouped .msg-username { display: none; }
.message-grouped { margin-top: 0; }

.msg-body { display: flex; flex-direction: column; gap: 2px; max-width: 100%; position: relative; }
.msg-username { font-size: 11px; font-weight: 600; color: var(--text-secondary); padding: 0 6px 1px; display: flex; align-items: center; gap: 8px; }
.message-self .msg-username { justify-content: flex-end; padding-right: 8px; }
.msg-admin-action { cursor: pointer; opacity: 0; transition: opacity .15s; display: flex; align-items: center; color: var(--text-light); padding: 0 4px; border-radius: 4px; }
.message-other:hover .msg-admin-action { opacity: .6; }
.msg-admin-action:hover { opacity: 1 !important; background: var(--bg); }

.msg-bubble { padding: 10px 18px; border-radius: 18px; font-size: 14px; line-height: 1.55; word-break: break-word; position: relative; }
.message-self .msg-bubble { background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--white); border-bottom-right-radius: 6px; box-shadow: var(--shadow-soft); }
.message-other .msg-bubble { background: var(--surface); color: var(--text); border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm); transition: box-shadow .2s; }
.message-other:hover .msg-bubble { box-shadow: var(--shadow-soft); }
.message-self .msg-bubble::after { content: ''; position: absolute; bottom: 8px; right: -6px; width: 10px; height: 10px; background: var(--primary); border-radius: 2px; transform: rotate(45deg); }
.message-other .msg-bubble::after { content: ''; position: absolute; bottom: 8px; left: -6px; width: 10px; height: 10px; background: var(--surface); border-radius: 2px; transform: rotate(45deg); }

.msg-time { font-size: 10px; color: var(--text-light); padding: 0 4px; display: none; }
.message-self .msg-time { text-align: right; }
.message:hover .msg-time { display: block; }

/* Announcement */
.message-announcement { align-self: center; max-width: min(88%, 720px); margin: 8px 0; }
.message-announcement .msg-body { align-items: center; }
.message-announcement .msg-bubble { background: var(--surface); color: var(--primary); font-size: 13px; text-align: center; padding: 10px 24px; box-shadow: var(--shadow-sm); border-radius: var(--radius); }
.message-announcement .msg-bubble::after { display: none; }
.message-announcement .msg-avatar { display: none; }
.message-announcement .msg-username { display: none !important; }
.message-announcement .msg-time { display: none !important; }
.announcement-prefix { font-size: 15px; margin-right: 6px; }

/* System message */
.message-system { align-self: center; max-width: 80%; margin: 14px 0; }
.message-system .msg-bubble { background: transparent; color: var(--text-light); font-size: 12px; text-align: center; padding: 4px 16px; box-shadow: none; border-radius: 0; }
.message-system .msg-bubble::after { display: none; }

/* Date separator */
.date-separator { text-align: center; font-size: 11px; color: var(--text-light); padding: 16px 0 10px; position: relative; }
.date-separator::before, .date-separator::after { content: ''; position: absolute; top: 50%; height: 1px; width: 28%; background: linear-gradient(to right, transparent, #e2e8f0); }
.date-separator::after { background: linear-gradient(to left, transparent, #e2e8f0); right: 0; left: auto; }
.date-separator span { background: var(--white); padding: 0 14px; position: relative; z-index: 1; color: var(--text-light); }

/* Message content */
.msg-text a { color: inherit; text-decoration: underline; opacity: .9; }
.message-self .msg-text a { color: rgba(255,255,255,.85); }
.msg-image { margin: -3px -5px; min-width: 80px; min-height: 80px; background: var(--bg); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.msg-image img { max-width: 280px; max-height: 340px; border-radius: var(--radius); display: block; cursor: pointer; transition: transform .15s, opacity .3s; box-shadow: var(--shadow-sm); }
.msg-image img:hover { transform: scale(1.03); }
.msg-image img[src] { background: var(--bg); }
.msg-video video { width: 240px; max-width: 100%; aspect-ratio: 16 / 9; height: auto; background: #0f172a; border-radius: var(--radius); display: block; }

.msg-file { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.msg-file-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.message-self .msg-file-icon { background: rgba(255,255,255,.15); }
.message-other .msg-file-icon { background: var(--primary-light); }
.message-self .msg-file-icon svg { color: rgba(255,255,255,.8); }
.message-other .msg-file-icon svg { color: var(--primary); }
.msg-file-info { flex: 1; min-width: 0; }
.msg-file-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.message-self .msg-file-name { color: rgba(255,255,255,.9); }
.message-other .msg-file-name { color: var(--text); }
.msg-file-size { font-size: 11px; color: var(--text-secondary); }
.message-self .msg-file-size { color: rgba(255,255,255,.6); }
.msg-file-download { font-size: 12px; padding: 4px 14px; border-radius: var(--radius-sm); text-decoration: none; flex-shrink: 0; font-weight: 500; transition: all .12s; }
.message-self .msg-file-download { background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); }
.message-self .msg-file-download:hover { background: rgba(255,255,255,.25); }
.message-other .msg-file-download { background: var(--primary-light); color: var(--primary); }
.message-other .msg-file-download:hover { background: var(--primary); color: var(--white); }

.msg-audio { margin: 2px 0; }
.msg-audio audio { max-width: 260px; height: 36px; border-radius: 20px; }
.message-self .msg-audio audio { filter: hue-rotate(140deg) saturate(1.2); }

/* Input bar */
.chat-input-bar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--white); flex-shrink: 0; border-top: 1px solid #e2e8f0; box-shadow: 0 -1px 0 #f1f5f9; }
.input-actions { display: flex; align-items: center; gap: 4px; }
.input-action-btn { background: none; border: none; cursor: pointer; padding: 6px; color: var(--text-secondary); display: flex; align-items: center; border-radius: var(--radius-sm); transition: all .15s; }
.input-action-btn:hover { color: var(--primary); background: var(--primary-light); transform: scale(1.1); }
.input-wrap { flex: 1; }
.msg-input { width: 100%; padding: 12px 22px; border: none; border-radius: 28px; font-size: 14px; outline: none; transition: all .25s; background: var(--bg); box-shadow: var(--shadow-inset-sm); }
.msg-input:focus { box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light), 0 0 0 3px var(--primary-glow); }
.msg-input:disabled { opacity: .6; cursor: not-allowed; }
.msg-input::placeholder { color: var(--text-light); }
.btn-send { width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s cubic-bezier(.34,1.56,.64,1); flex-shrink: 0; background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--white); box-shadow: var(--shadow-soft); position: relative; overflow: hidden; }
.btn-send:hover { transform: scale(1.1); box-shadow: var(--shadow-raised); }
.btn-send:active { transform: scale(.85); box-shadow: var(--shadow-pressed); }
.btn-send:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-send::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: rgba(255,255,255,.15); transform: scale(0); transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.btn-send:hover::before { transform: scale(1); }

/* ============ UPLOAD PREVIEW ============ */
.upload-preview { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg); z-index: 100; padding: 20px 28px 24px; max-height: 55vh; overflow-y: auto; animation: slideUp .3s cubic-bezier(.16,1,.3,1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.upload-preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.upload-preview-header span { font-weight: 600; font-size: 15px; }
.upload-preview-thumb { margin-bottom: 12px; text-align: center; }
.upload-preview-thumb img { max-width: 200px; max-height: 200px; border-radius: var(--radius); object-fit: cover; box-shadow: var(--shadow-sm); }
.upload-progress-wrap { width: 100%; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin: 10px 0; box-shadow: var(--shadow-inset-sm); }
.upload-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 4px; transition: width .3s; width: 0; }
.upload-progress-text { font-size: 13px; color: var(--text-secondary); text-align: center; margin: 4px 0 14px; }

/* ============ MODAL ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(12px); animation: overlayIn .15s ease; }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--white); border-radius: var(--radius-xl); width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); animation: modalIn .25s cubic-bezier(.16,1,.3,1); overflow: hidden; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid #e2e8f0; background: linear-gradient(135deg, var(--primary-light), var(--white)); }
.modal-header h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); padding: 0; width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; transition: all .12s; line-height: 1; }
.modal-close:hover { background: var(--bg); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid #e2e8f0; }

.avatar-preview-img { width: 108px; height: 108px; border-radius: 50%; object-fit: cover; margin-bottom: 14px; background: var(--bg); border: 3px solid var(--white); box-shadow: var(--shadow-sm); }
.card-key-icon { width: 50px; height: 50px; border-radius: var(--radius); background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; box-shadow: var(--shadow-sm); }

/* ============ ADMIN PAGE ============ */
.admin-page { background: var(--bg); overflow-y: auto; }
.admin-wrapper { max-width: 1060px; margin: 0 auto; padding: 28px 20px; min-height: 100vh; }
.admin-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.admin-header h2 { font-size: 18px; font-weight: 700; }
.admin-header-right { display: flex; align-items: center; gap: 10px; }
.admin-user { font-size: 13px; color: var(--text-secondary); }
.admin-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: var(--radius); padding: 4px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.tab-btn { display: inline-flex; align-items: center; gap: 6px; flex: 1; padding: 10px 16px; border: none; background: transparent; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: all .2s; color: var(--text-secondary); font-weight: 500; justify-content: center; }
.tab-btn:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.5); }
.tab-btn.active { background: var(--white); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.tab-btn:active:not(.active) { transform: scale(.96); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: var(--radius); padding: 0 16px; box-shadow: var(--shadow-inset-sm); }
.search-box:focus-within { box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light), 0 0 0 3px var(--primary-glow); }
.search-box iconify-icon { color: var(--text-light); }
.search-box .form-input { border: none; padding: 10px 0; background: transparent; max-width: 240px; box-shadow: none; }
.search-box .form-input:focus { box-shadow: none; }

/* Card */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-raised); overflow: hidden; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; gap: 8px; padding: 16px 22px; border-bottom: 1px solid #dce4f0; font-weight: 600; font-size: 14px; }
.card-body { padding: 22px; }
.card-body.p-0 { padding: 0; }
.ah-left { display: flex; align-items: center; gap: 12px; }
.ah-left h2 { font-size: 18px; font-weight: 700; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 18px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: var(--surface); font-weight: 600; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }
.td-muted { color: var(--text-secondary); font-size: 12px; }
.td-actions { white-space: nowrap; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar-sm { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.role-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.role-admin { background: var(--primary-light); color: var(--primary); }
.role-user { background: var(--bg); color: var(--text-secondary); }
.status-normal { color: #22c55e; font-weight: 500; font-size: 12px; }
.status-banned { color: #ef4444; font-weight: 500; font-size: 12px; }
.status-muted { color: #eab308; font-weight: 500; font-size: 12px; }
.action-btn { padding: 6px 12px; font-size: 11px; border-radius: var(--radius-sm); border: none; background: var(--white); cursor: pointer; margin: 0 2px; transition: all .12s; line-height: 1; box-shadow: var(--shadow-sm); }
.action-btn:hover { box-shadow: var(--shadow-soft); }
.action-btn.danger { color: #ef4444; }
.action-btn.danger:hover { background: #ef4444; color: var(--white); }
.action-btn.success { color: #22c55e; }
.action-btn.success:hover { background: #22c55e; color: var(--white); }

/* ===== 后台表格移动端卡片化（窄屏把表格行变成卡片，避免列挤压/内容竖排） ===== */
@media (max-width: 767px) {
  .card-body.p-0 { overflow-x: visible; }
  .card-body.p-0 table thead { display: none; }
  .card-body.p-0 table,
  .card-body.p-0 table tbody { display: block; }
  .card-body.p-0 table tr { display: block; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; margin: 0 10px 10px; padding: 8px 12px; background: var(--white); box-shadow: var(--shadow-sm); }
  .card-body.p-0 table td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px; border: none; white-space: normal; }
  .card-body.p-0 table td[data-label]::before { content: attr(data-label); color: #94a3b8; font-size: 12px; font-weight: 600; flex-shrink: 0; }
  .card-body.p-0 table td .user-cell strong { font-size: 14px; word-break: break-all; }
  .card-body.p-0 table td.td-actions { flex-wrap: wrap; justify-content: flex-start; gap: 6px; white-space: normal; }
  .card-body.p-0 table td.td-actions::before { content: none; }
  .card-body.p-0 table .action-btn { padding: 7px 11px; margin: 0; font-size: 12px; flex-shrink: 0; }
  .card-body.p-0 table .td-muted { font-size: 12px; }
}
.card-token { font-size: 12px; background: var(--bg); padding: 4px 12px; border-radius: var(--radius-sm); font-family: "SF Mono","Fira Code",monospace; letter-spacing: .5px; }

.setting-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-row label { width: 140px; font-size: 14px; flex-shrink: 0; font-weight: 500; }
.setting-row .form-input { max-width: 100px; }
.set-input { display: flex; align-items: center; gap: 8px; }
.set-unit { font-size: 13px; color: var(--text-light); font-weight: 500; }
.setting-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 767px) { .settings-grid { grid-template-columns: 1fr; } }
.bg-preview { width: 100%; height: 140px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; position: relative; overflow: hidden; background: var(--bg); box-shadow: var(--shadow-inset-sm); }
.bg-preview-overlay { width: 100%; height: 100%; background: rgba(15,23,42,.2); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.bg-actions { display: flex; gap: 8px; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-light); }
.empty p { font-size: 13px; margin-top: 6px; }

/* Toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--white); padding: 12px 28px; border-radius: var(--radius); font-size: 14px; z-index: 9999; animation: toastUp .35s cubic-bezier(.16,1,.3,1); box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; }
@keyframes toastUp { from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(.92); } to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }

/* Admin action menu */
.admin-action-menu { position: absolute; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 100; min-width: 150px; animation: dropIn .12s ease; }
.admin-action-menu div { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13px; cursor: pointer; border-radius: var(--radius-sm); transition: all .1s; }
.admin-action-menu div:hover { background: var(--primary-light); }
.admin-action-menu div iconify-icon { width: 15px; height: 15px; }
.admin-action-menu .aam-danger { color: #ef4444; }
.admin-action-menu .aam-success { color: #22c55e; }

/* ============ RESPONSIVE ============ */
@media (max-width: 767px) {
  .chat-app { padding: 0; }
  .chat-container { max-width: 100%; border-radius: 0; box-shadow: none; }
  .chat-header { padding: 0 12px; }
  .header-title { font-size: 15px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-sidebar { position: fixed; left: -280px; top: 0; bottom: 0; width: 220px; z-index: 100; box-shadow: var(--shadow-lg); transition: left .3s cubic-bezier(.16,1,.3,1); border-right: none; }
  .chat-sidebar.open { left: 0; }
  .sidebar-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 99; display: none; }
  .sidebar-overlay.open { display: block; }
  .sidebar-title { display: block; font-size: 9px; padding: 12px 16px 4px 24px; }
  .sidebar-title::before { left: 10px; top: 14px; bottom: 4px; }
  .sidebar-item { justify-content: flex-start; padding: 11px 12px; border-radius: var(--radius-sm); margin: 1px 6px; }
  .sidebar-item-active::before { display: none; }
  .sidebar-item .si-label { display: block; font-size: 12px; }
  .sidebar-item .si-role { display: inline-flex; }
  .sidebar-item .si-avatar { display: block; }
  .sidebar-item .si-online { display: block; }
  .sidebar-item .si-icon { width: 18px; height: 18px; }
  .sidebar-footer .si-label { display: block; font-size: 12px; }
  .sidebar-item-cardkey .si-label { display: block; }
  .sidebar-item-cardkey { padding: 9px 12px; justify-content: flex-start; border: 1px dashed var(--primary); margin: 2px 6px; }
  .sidebar-section { padding: 2px 0; }
  .sidebar-list { padding: 0 4px; }
  .sidebar-inner { padding: 8px 0; }
  .sidebar-overlay { display: none; }
  .sidebar-footer { padding: 6px 4px; }
  .message { max-width: 96%; gap: 6px; margin-bottom: 2px; }
  .msg-avatar { width: 28px; height: 28px; margin-top: 4px; }
  .msg-avatar .avatar-placeholder { font-size: 11px; }
  .message-grouped .msg-avatar { visibility: visible; }
  .message-grouped { margin-top: 0; }
  .message-announcement { margin: 12px 0; }
  .message-system { margin: 16px 0; }
  .msg-body { gap: 1px; }
  .msg-bubble { font-size: 13px; padding: 8px 14px; }
  .msg-image img { max-width: 160px; max-height: 180px; }
  .msg-video video { width: 200px; }
  .input-actions { gap: 1px; }
  .input-action-btn { padding: 5px; }
  .input-action-btn iconify-icon { width: 18px; height: 18px; }
  .login-box { padding: 28px 20px; }
  .login-page { padding: 12px; }
  .admin-wrapper { padding: 10px 8px; }
  .admin-header { padding: 12px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .admin-header-right { width: 100%; justify-content: flex-end; }
  .admin-tabs { flex-wrap: nowrap; overflow-x: auto; gap: 2px; padding: 3px; -webkit-overflow-scrolling: touch; }
  .admin-tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: none; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
  .setting-row label { width: 100%; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .set-input { width: 100%; }
  .setting-row .form-input { max-width: 100%; }
  th, td { padding: 8px 8px; font-size: 12px; }
  td { white-space: normal; word-break: break-word; }
  .td-actions { white-space: nowrap; }
  .card-body { padding: 14px; }
  .card-body.p-0 { overflow-x: auto; }
  table { font-size: 12px; }
  .settings-grid { gap: 10px; }
  .bg-preview { height: 100px; }
  .chat-messages { padding: 10px 12px; }
  .chat-input-bar { padding: 8px 10px; gap: 6px; }
  .msg-input { padding: 9px 14px; font-size: 13px; }
  .btn-send { width: 38px; height: 38px; }
  .user-menu-trigger { padding: 2px 8px 2px 2px; }
  .header-nickname { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .modal { max-width: 100%; margin: 0 10px; }
  .modal-body { padding: 18px; }
  .action-btn { padding: 8px 12px; margin: 1px; }
  .admin-user { font-size: 12px; }
  .search-box .form-input { max-width: 140px; }
  .toast { bottom: 16px; font-size: 13px; padding: 10px 20px; max-width: 90vw; }
}

/* ============ 回复 / @提及 / 提示音 ============ */

/* 输入栏上方的回复引用条 */
.reply-bar { display: none; align-items: center; gap: 10px; padding: 7px 18px; background: var(--primary-light); border-top: 1px solid #dbeafe; flex-shrink: 0; animation: reply-bar-in .18s ease; }
.reply-bar-icon { color: var(--primary); flex-shrink: 0; }
.reply-bar-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.reply-bar-title { font-size: 11px; color: var(--primary); font-weight: 600; line-height: 1.3; }
.reply-bar-content { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.reply-bar-close { background: none; border: none; cursor: pointer; color: var(--text-light); padding: 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.reply-bar-close:hover { color: #ef4444; background: rgba(239,68,68,.1); transform: rotate(90deg); }
@keyframes reply-bar-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 气泡内回复引用块 */
.msg-reply-quote { display: flex; align-items: baseline; gap: 4px; max-width: 100%; padding: 4px 10px; margin-bottom: 5px; background: rgba(37,99,235,.07); border-left: 3px solid var(--primary); border-radius: 6px; cursor: pointer; transition: background .15s; overflow: hidden; }
.msg-reply-quote:hover { background: rgba(37,99,235,.14); }
.message-self .msg-reply-quote { background: rgba(255,255,255,.22); border-left-color: rgba(255,255,255,.85); }
.message-self .msg-reply-quote:hover { background: rgba(255,255,255,.32); }
.mrq-user { font-size: 11px; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0; }
.message-self .mrq-user { color: rgba(255,255,255,.95); text-shadow: 0 1px 2px rgba(0,0,0,.1); }
.mrq-text { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.message-self .mrq-text { color: rgba(255,255,255,.8); }

/* 悬停消息上的回复小按钮 */
.msg-action-reply { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 5px; cursor: pointer; color: var(--text-light); vertical-align: -4px; opacity: 0; transition: all .15s; margin-left: 2px; }
.message:hover .msg-action-reply { opacity: 1; }
.msg-action-reply:hover { color: var(--primary); background: var(--primary-light); transform: scale(1.15); }

/* 跳转原消息闪烁高亮 */
.jump-flash { animation: jump-flash-anim 1.6s ease; }
@keyframes jump-flash-anim {
  0% { background: rgba(37,99,235,0); border-radius: 12px; }
  15%, 55% { background: rgba(37,99,235,.14); border-radius: 12px; box-shadow: 0 0 0 2px var(--primary-glow); }
  100% { background: rgba(37,99,235,0); border-radius: 12px; }
}

/* @提及高亮 */
.mention { color: var(--primary); font-weight: 600; background: var(--primary-light); padding: 0 3px; border-radius: 4px; cursor: pointer; transition: all .15s; }
.mention:hover { background: var(--primary); color: var(--white); }
.message-self .mention { color: #1d4ed8; background: rgba(255,255,255,.35); }
.message-self .mention:hover { background: var(--white); }
.mention-me { color: #d97706; background: #fef3c7; box-shadow: 0 0 0 1px rgba(217,119,6,.25); }
.mention-me:hover { background: #f59e0b; color: var(--white); }
.message-self .mention-me { color: #b45309; background: rgba(255,255,255,.5); }

/* 自己被 @ 的整条消息描边 */
.msg-mentioned .msg-bubble { box-shadow: 0 0 0 2px #f59e0b, 0 2px 10px rgba(245,158,11,.18); }

/* @提及选择浮层 */
.mention-panel { position: absolute; bottom: 60px; left: 0; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 55; width: 240px; max-height: 232px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.mention-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; color: var(--text); border-radius: var(--radius-sm); transition: background .12s; }
.mention-item:hover, .mention-item.active { background: var(--primary-light); }
.mention-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-item-role { font-size: 10px; color: var(--primary); background: var(--primary-light); padding: 1px 6px; border-radius: 8px; flex-shrink: 0; font-weight: 600; }

/* 声音开关按钮状态 */
.input-action-btn.sound-off { color: var(--text-light); }
.input-action-btn.sound-off:hover { color: #94a3b8; background: #f1f5f9; }

/* 移动端适配 */
@media (max-width: 767px) {
  .reply-bar { padding: 5px 12px; }
  .mention-panel { width: 210px; max-height: 200px; bottom: 54px; }
}

/* ============ 消息操作行（回复/撤回/时间常显） ============ */
.msg-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; font-size: 11px; color: var(--text-light); line-height: 1.3; }
.message-self .msg-meta { justify-content: flex-end; }
.msg-meta-btn { cursor: pointer; color: var(--text-light); transition: color .15s; user-select: none; padding: 1px 2px; }
.msg-meta-btn:hover { color: var(--primary); }
.msg-meta .msg-time { display: inline; opacity: 1; color: var(--text-light); }
.message-self .msg-meta .msg-meta-btn:hover { color: #1d4ed8; }

/* 已撤回消息提示 */
.message-recalled { display: flex; justify-content: center; margin: 6px 0; }
.message-recalled .msg-body { max-width: none; }
.message-recalled .msg-bubble { display: inline-block; padding: 4px 16px; border-radius: 14px; font-size: 11px; color: var(--text-light); background: rgba(148,163,184,.12); box-shadow: none; }
.message-recalled:hover .msg-bubble { transform: none; }

/* ============ 新版侧边栏（聊天室用户面板） ============ */
.sb-new { padding: 0; }
.sb-panel { padding: 16px 14px 8px; }
.sb-panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sb-panel-title { font-size: 17px; font-weight: 700; color: var(--text); }
.sb-panel-online { font-size: 12px; color: #16a34a; }
.sb-panel-online b { font-weight: 700; }
.sb-panel-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.sb-search { flex: 1; min-width: 0; padding: 9px 14px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 13px; outline: none; background: var(--white); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.sb-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.sb-conv-btn { padding: 9px 16px; border: 1px solid #e2e8f0; border-radius: 10px; background: var(--white); font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; transition: all .15s; }
.sb-conv-btn:hover { border-color: var(--primary); color: var(--primary); }
.sb-conv-btn.active { background: var(--primary); border-color: var(--primary); color: var(--white); }

.sb-group { margin-bottom: 14px; }
.sb-group-title { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); margin: 8px 2px; font-weight: 500; }
.sb-dot-title { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sb-t-owner { background: #94a3b8; }
.sb-t-admin { background: #94a3b8; }
.sb-t-online { background: #22c55e; }
.sb-t-off { background: #94a3b8; }

.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.sb-user:hover { background: var(--primary-light); }
.sb-avatar { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; overflow: hidden; }
.sb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sb-avatar .avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: var(--white); }
.sb-ph-owner { background: linear-gradient(135deg, #f8fafc, #e2e8f0); color: #475569 !important; }
.sb-ph-admin { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.sb-ph-online { background: linear-gradient(135deg, #22c55e, #16a34a); }
.sb-ph-off { background: linear-gradient(135deg, #94a3b8, #64748b); }
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-role-suffix { font-weight: 600; }
.sb-user-status { font-size: 12px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-mail { color: #16a34a; cursor: pointer; padding: 5px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; transition: all .15s; }
.sb-mail:hover { background: rgba(22,163,74,.12); transform: scale(1.1); }
.sb-dot { width: 10px; height: 10px; border-radius: 50%; background: #cbd5e1; flex-shrink: 0; }
.sb-dot.sb-dot-on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }

.sb-conv-panel { padding-bottom: 6px; }
.sb-conv-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--text); transition: background .15s; }
.sb-conv-item:hover { background: var(--primary-light); }
.sb-conv-empty { padding: 16px 8px; font-size: 12px; color: var(--text-light); text-align: center; }

/* 设置弹窗 */
.set-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }

/* 个人状态预设 pills */
.status-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.status-pill { padding: 7px 14px; border: 1px solid #e2e8f0; border-radius: 18px; font-size: 13px; color: var(--text); background: var(--white); cursor: pointer; user-select: none; transition: all .15s; white-space: nowrap; }
.status-pill:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.status-pill.active { background: #22c55e; border-color: #22c55e; color: var(--white); font-weight: 600; box-shadow: 0 2px 8px rgba(34,197,94,.3); }

/* 移动端侧边栏适配 */
@media (max-width: 767px) {
  .sb-panel { padding: 12px 10px 6px; }
  .sb-avatar { width: 36px; height: 36px; }
  .sb-avatar .avatar-placeholder { font-size: 14px; }
}

/* ===== 侧边栏：个人主页卡片 + 聊天入口 ===== */
.sb-me-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin: 0 0 6px; background: linear-gradient(135deg, var(--primary-light), var(--white)); border: 1px solid rgba(37,99,235,.15); border-radius: var(--radius); cursor: pointer; transition: all .15s; }
.sb-me-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.sb-me-avatar { width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, #0ea5e9, #10b981); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex-shrink: 0; box-shadow: 0 4px 10px rgba(14,165,233,.35); }
.sb-me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-me-info { flex: 1; min-width: 0; }
.sb-me-name { font-weight: 700; font-size: 15px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-me-status { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-me-arrow { margin-left: auto; color: var(--text-light); flex-shrink: 0; }
.sb-section-title { font-size: 12px; font-weight: 600; color: var(--text-light); padding: 10px 4px 4px; letter-spacing: .5px; }
.sb-chat-entry { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--text); transition: background .15s; }
.sb-chat-entry:hover { background: var(--primary-light); }
.sb-chat-entry.sb-entry-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sb-entry-icon { display: flex; align-items: center; }
.sb-panel .sb-search { display: block; width: 100%; margin: 6px 0 10px; }

/* ===== 个人设置：深色卡片弹窗 ===== */
.pm-modal { background: #0d1830; border: 1px solid #1e3a5f; max-width: 400px; width: 92%; max-height: 88vh; overflow-y: auto; border-radius: 18px; padding: 22px 18px 14px; color: #e6edf7; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.pm-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.pm-avatar-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.pm-avatar { width: 104px; height: 104px; border-radius: 26px; overflow: hidden; background: linear-gradient(135deg, #10b981, #0ea5e9); display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 700; color: #fff; box-shadow: 0 12px 32px rgba(16,185,129,.35); }
.pm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-nick { text-align: center; font-size: 18px; font-weight: 700; }
.pm-status { text-align: center; font-size: 13px; color: #8fa3c0; margin: 4px 0 18px; }
.pm-card { background: #101f3a; border: 1px solid #1d3557; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.pm-card-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-left: 8px; border-left: 3px solid #38bdf8; line-height: 1.2; }
.pm-btn { display: block; width: 100%; background: #152947; border: 1px solid #24406b; color: #dbe7f7; border-radius: 8px; padding: 10px; font-size: 14px; cursor: pointer; margin-bottom: 8px; text-align: center; transition: all .15s; font-family: inherit; }
.pm-btn:last-child { margin-bottom: 0; }
.pm-btn:hover { border-color: #38bdf8; color: #fff; }
.pm-avatar-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pm-preset-av { aspect-ratio: 1; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 18px; cursor: pointer; transition: transform .15s; }
.pm-preset-av:hover { transform: scale(1.1); }
.pm-card .status-pill { background: #152947; border: 1px solid #24406b; color: #c7d5ea; box-shadow: none; }
.pm-card .status-pill:hover { border-color: #38bdf8; color: #38bdf8; }
.pm-card .status-pill.active { border-color: #38bdf8; color: #38bdf8; background: rgba(56,189,248,.08); }
/* 账号信息 */
.pm-account-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; margin-bottom: 10px; }
.pm-account-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pm-account-label { font-size: 11px; color: #94a3b8; }
.pm-account-name { font-size: 15px; font-weight: 700; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-account-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; flex-shrink: 0; background: rgba(56,189,248,.15); color: #38bdf8; border: 1px solid rgba(56,189,248,.3); }
.pm-account-badge.admin { background: rgba(245,158,11,.15); color: #f59e0b; border-color: rgba(245,158,11,.35); }
.pm-tip { font-size: 11.5px; color: #94a3b8; margin-top: 8px; line-height: 1.55; }
.pm-logout-wrap { margin: 16px 0 10px; }
.pm-logout-btn { width: 100%; background: #ef4444; border: none; color: #fff; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s; font-family: inherit; }
.pm-logout-btn:hover { background: #dc2626; }
.pm-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 6px; }
.pm-close-btn { background: #152947; border: 1px solid #24406b; color: #dbe7f7; border-radius: 8px; padding: 8px 24px; font-size: 14px; cursor: pointer; font-family: inherit; }
.pm-close-btn:hover { border-color: #38bdf8; color: #fff; }
.pm-input { width: 100%; background: #152947; border: 1px solid #24406b; border-radius: 8px; padding: 10px 12px; color: #e6edf7; font-size: 14px; margin-bottom: 10px; outline: none; font-family: inherit; }
.pm-input:focus { border-color: #38bdf8; }
.pm-input::placeholder { color: #5f7396; }
.pm-error { color: #f87171; font-size: 12px; text-align: center; margin-top: 6px; }

/* ===== 总公告弹窗 ===== */
.notice-modal { padding: 0; overflow: hidden; }
.notice-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; font-size: 16px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #2563eb, #06b6d4); border-bottom: 1px solid #1e3a5f; }
.notice-head iconify-icon { color: #fde047; }
.notice-body { padding: 18px 20px; font-size: 14px; line-height: 1.9; color: #dbe7f7; white-space: pre-wrap; word-break: break-word; max-height: 52vh; overflow-y: auto; }
.notice-body:empty::after { content: '（暂无公告内容）'; color: #5f7396; }
.notice-ok-btn { width: 100%; background: linear-gradient(135deg, #2563eb, #06b6d4); border: none; color: #fff; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: filter .15s; font-family: inherit; }
.notice-ok-btn:hover { filter: brightness(1.12); }
.notice-ok-btn:active { transform: scale(.98); }
.notice-modal .pm-footer { padding: 0 20px 18px; }

/* ===== 按住说话 ===== */
.hold-talk-btn { flex: 1; display: none; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 21px; background: var(--primary-light); color: var(--primary); font-size: 15px; font-weight: 600; border: 1px solid rgba(37,99,235,.25); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.hold-talk-btn.ht-rec { background: #ef4444; border-color: #ef4444; color: #fff; }
.hold-talk-btn.ht-cancel { background: #64748b; border-color: #64748b; color: #fff; }
.input-action-btn.voice-mode-on { color: var(--primary); background: var(--primary-light); }

/* ===== 夜间主题 ===== */
body.dark-theme { --bg: #0b1220; --surface: #101a2c; --white: #121e33; --text: #e6edf7; --text-secondary: #8fa3c0; --text-light: #5f7396; --primary-light: rgba(37,99,235,.16); --primary-glow: rgba(37,99,235,.25); --accent-light: rgba(6,182,212,.14); --shadow-dark: rgba(0,0,0,.45); --shadow-light: rgba(255,255,255,.03); }
body.dark-theme .msg-bubble { box-shadow: 0 1px 3px rgba(0,0,0,.3); }
body.dark-theme .sb-me-card { background: linear-gradient(135deg, rgba(37,99,235,.18), var(--white)); border-color: rgba(37,99,235,.3); }

/* ===== AI 思考中指示 ===== */
.ai-typing { display: inline-flex; align-items: center; gap: 5px; color: var(--text-secondary); font-size: 13px; }
.ai-typing .atd { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: aiBlink 1.2s infinite ease-in-out; }
.ai-typing .atd:nth-child(2) { animation-delay: .2s; }
.ai-typing .atd:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.15); } }

/* ===== 公共聊天室在线徽章 + 频道统计 ===== */
.sb-entry-badge { margin-left: auto; font-size: 11px; color: var(--primary); background: var(--primary-light); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.channel-sub { font-size: 12px; color: var(--text-secondary); margin-left: 10px; white-space: nowrap; }
@media (max-width:480px) { .channel-sub { font-size: 11px; } }

/* ===== 微信式聊天气泡 ===== */
.message-self .msg-bubble { background: #95ec69; color: #10240a; border-radius: 10px; border-top-right-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.message-other .msg-bubble { background: #ffffff; color: #10240a; border-radius: 10px; border-top-left-radius: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
/* 对方气泡左上小尖角 */
.message-other .msg-bubble::before { content: ''; position: absolute; top: 13px; left: -4px; width: 9px; height: 9px; background: #ffffff; border-radius: 2px; transform: rotate(45deg); box-shadow: none; }
/* 自己气泡右上小尖角（覆盖旧样式） */
.message-self .msg-bubble::after { content: ''; position: absolute; top: 13px; right: -4px; bottom: auto; width: 9px; height: 9px; background: #95ec69; border-radius: 2px; transform: rotate(45deg); }
/* 引用块微信化 */
.msg-reply-quote { background: rgba(0,0,0,.05); border-left: 3px solid #95ec69; }
.message-other .msg-reply-quote { border-left-color: #b8b8b8; }
/* 图片/视频消息去掉气泡底（微信样式：裸露媒体） */
.msg-bubble:has(.msg-image), .msg-bubble:has(.msg-video) { background: none !important; box-shadow: none !important; padding: 2px; }
.msg-bubble:has(.msg-image)::before, .msg-bubble:has(.msg-video)::before,
.msg-bubble:has(.msg-image)::after, .msg-bubble:has(.msg-video)::after { display: none; }
/* 夜间主题适配 */
body.dark-theme .message-other .msg-bubble { background: #1c2a3d; color: #e6edf7; }
body.dark-theme .message-other .msg-bubble::before { background: #1c2a3d; }
body.dark-theme .message-self .msg-bubble { background: #3aa664; color: #f2fff5; }
body.dark-theme .message-self .msg-bubble::after { background: #3aa664; }

/* ===== 表情回应（Reactions） ===== */
.msg-reactions { display: none; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.message-self .msg-reactions { justify-content: flex-end; }
.react-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 2px 8px; cursor: pointer; transition: all .15s; }
.react-chip:hover { border-color: #95ec69; }
.react-chip.react-mine { border-color: #95ec69; background: #f0fbe8; }
.react-chip b { color: #64748b; font-weight: 600; }
.react-panel { position: fixed; background: #fff; border-radius: 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 6px; display: flex; gap: 2px; z-index: 9999; animation: msgIn .15s ease; }
.react-panel span { font-size: 22px; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: transform .12s; }
.react-panel span:hover { background: #f1f5f9; transform: scale(1.25); }
body.dark-theme .react-chip { background: #152947; border-color: #24406b; color: #dbe7f7; }
body.dark-theme .react-panel { background: #101f3a; }
body.dark-theme .react-panel span:hover { background: #1d3557; }

/* ===== 微信气泡 → 主题变量化（覆盖硬编码色） ===== */
.message-self .msg-bubble { background: var(--bubble-self, #95ec69); color: var(--bubble-self-text, #10240a); }
.message-self .msg-bubble::after { background: var(--bubble-self, #95ec69); }
.message-other .msg-bubble { background: var(--bubble-other, #ffffff); color: var(--bubble-other-text, #10240a); }
.message-other .msg-bubble::before { background: var(--bubble-other, #ffffff); }
.message-self .msg-reply-quote { border-left-color: var(--bubble-self, #95ec69); }

/* 头像发光描边（参考图样式） */
.msg-avatar { border: 2px solid var(--primary-glow, transparent); box-shadow: 0 0 12px var(--primary-glow, transparent); }

/* 管理员/群主徽章 */
.role-badge { display: inline-flex; align-items: center; font-size: 10px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #22d3ee, #0ea5e9); border-radius: 8px; padding: 1px 7px; margin-right: 5px; vertical-align: 1px; }
.role-badge.rb-owner { background: linear-gradient(135deg, #fbbf24, #f59e0b); }

/* ===== 六套主题变量 ===== */
body.theme-lilan {
  --bg:#e8f1fa; --surface:#f2f8fd; --white:#fbfdff;
  --primary:#1e9be9; --primary-hover:#38acf2; --primary-light:#e3f2fc; --primary-glow:rgba(30,155,233,.16);
  --accent:#22b1e8; --accent-light:#e6f7fe;
  --shadow-dark:#c3d6e8; --shadow-light:#ffffff;
  --bubble-self:#1e9be9; --bubble-self-text:#ffffff;
  --bubble-other:#ffffff; --bubble-other-text:#10240a;
}
body.theme-liujin {
  --bg:#f3ecda; --surface:#f9f4e8; --white:#fdfaf1;
  --primary:#b8892b; --primary-hover:#c99a3d; --primary-light:#f5ecd7; --primary-glow:rgba(184,137,43,.16);
  --accent:#d4af37; --accent-light:#faf1d9;
  --shadow-dark:#ddd0ae; --shadow-light:#fffdf5;
  --bubble-self:#c9a227; --bubble-self-text:#fffdf5;
  --bubble-other:#ffffff; --bubble-other-text:#3a2f14;
}
body.theme-luolan {
  --bg:#141021; --surface:#1b1530; --white:#211a3a;
  --text:#ece8f9; --text-secondary:#9d92c4; --text-light:#6b5f94;
  --primary:#8b5cf6; --primary-hover:#a78bfa; --primary-light:rgba(139,92,246,.16); --primary-glow:rgba(139,92,246,.28);
  --accent:#7c3aed; --accent-light:rgba(124,58,237,.16);
  --shadow-dark:rgba(0,0,0,.5); --shadow-light:rgba(255,255,255,.04);
  --bubble-self:#332a52; --bubble-self-text:#f2eefd;
  --bubble-other:#241d3e; --bubble-other-text:#ece8f9;
}
body.theme-yingfei {
  --bg:#fae8f0; --surface:#fdf1f6; --white:#fef8fb;
  --primary:#ec4899; --primary-hover:#f05fa8; --primary-light:#fce4ef; --primary-glow:rgba(236,72,153,.16);
  --accent:#f472b6; --accent-light:#fde9f3;
  --shadow-dark:#e8c9d8; --shadow-light:#ffffff;
  --bubble-self:#ec4899; --bubble-self-text:#ffffff;
  --bubble-other:#ffffff; --bubble-other-text:#3d1230;
}
body.theme-feicui {
  --bg:#0d1a13; --surface:#12241a; --white:#163023;
  --text:#e5f4ec; --text-secondary:#8fb5a2; --text-light:#5c8570;
  --primary:#10b981; --primary-hover:#22c55e; --primary-light:rgba(16,185,129,.15); --primary-glow:rgba(16,185,129,.28);
  --accent:#0ea372; --accent-light:rgba(14,163,114,.15);
  --shadow-dark:rgba(0,0,0,.5); --shadow-light:rgba(255,255,255,.04);
  --bubble-self:#1a4a35; --bubble-self-text:#eafff5;
  --bubble-other:#152e22; --bubble-other-text:#e5f4ec;
}
body.theme-xingye {
  --bg:#0a1628; --surface:#101f36; --white:#152744;
  --text:#e6effb; --text-secondary:#8fa8c7; --text-light:#5a7396;
  --primary:#38bdf8; --primary-hover:#5cc9fa; --primary-light:rgba(56,189,248,.15); --primary-glow:rgba(56,189,248,.28);
  --accent:#0ea5e9; --accent-light:rgba(14,165,233,.15);
  --shadow-dark:rgba(0,0,0,.5); --shadow-light:rgba(255,255,255,.04);
  --bubble-self:#1d3253; --bubble-self-text:#eaf4ff;
  --bubble-other:#14233c; --bubble-other-text:#e6effb;
}

/* ===== 选择主题弹窗（卡片网格） ===== */
.pm-sub { font-size: 13px; color: #8fa3c0; margin: -8px 0 14px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { border-radius: 14px; padding: 14px 12px; cursor: pointer; border: 2px solid rgba(128,128,128,.18); position: relative; transition: transform .15s, border-color .15s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: #a78bfa; box-shadow: 0 0 0 2px rgba(167,139,250,.25); }
.tc-swatches { display: flex; gap: 8px; margin-bottom: 10px; }
.tc-swatch { width: 32px; height: 32px; border-radius: 10px; display: inline-block; }
.tc-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.tc-desc { font-size: 11px; }
.tc-check { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%; background: #a78bfa; color: #fff; display: none; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.theme-card.active .tc-check { display: flex; }
body.dark-theme .pm-sub { color: #8fa3c0; }

/* ===== 私聊确认弹窗（深色卡片 1:1） ===== */
.cpm-card { background: #1e2430; border-radius: 20px; padding: 26px 24px 20px; width: min(92vw, 480px); box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: cpmIn .18s ease; }
@keyframes cpmIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.cpm-title { font-size: 20px; font-weight: 700; color: #f1f5f9; margin-bottom: 14px; }
.cpm-text { font-size: 16px; color: #e2e8f0; line-height: 1.6; margin-bottom: 22px; word-break: break-all; }
.cpm-text b { color: #fff; font-weight: 600; }
.cpm-actions { display: flex; justify-content: flex-end; gap: 12px; }
.cpm-btn { padding: 11px 30px; border-radius: 12px; border: none; font-size: 15px; font-weight: 600; cursor: pointer; transition: filter .15s, transform .1s; }
.cpm-btn:active { transform: scale(.96); }
.cpm-cancel { background: #2c3442; color: #e2e8f0; }
.cpm-cancel:hover { filter: brightness(1.15); }
.cpm-ok { background: #ef4444; color: #fff; }
.cpm-ok:hover { filter: brightness(1.1); }

/* ===== 侧边栏新版（参考 QQ 风格：频道条目带副标题/头像块） ===== */
.sb-users-title { display: flex; align-items: center; justify-content: space-between; }
.sb-online-count { font-size: 12px; color: #22c55e; font-weight: 600; }
.sb-online-count b { font-weight: 700; }
.sb-chan-entry { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; cursor: pointer; margin: 2px 0; position: relative; transition: background .15s; }
.sb-chan-entry:hover { background: var(--primary-light); }
.sb-chan-entry.sb-entry-active { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.sb-chan-entry.sb-entry-active::before { content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 3px; background: var(--primary); }
.sb-chan-avatar { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; background: linear-gradient(135deg, #22c55e, #14b8a6); overflow: hidden; }
.sb-chan-avatar.sb-chan-blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.sb-chan-avatar.sb-chan-gray { background: linear-gradient(135deg, #94a3b8, #64748b); }
.sb-chan-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sb-chan-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-chan-desc { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-tools { display: flex; gap: 8px; margin: 6px 0 8px; }
.sb-user-tools .sb-search { flex: 1; margin: 0; min-width: 0; }
.sb-tool-btn { flex: 1; padding: 8px 10px; border: 1px solid var(--border, #e2e8f0); background: var(--white); color: var(--text); border-radius: 10px; font-size: 12px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.sb-tool-btn:hover { border-color: var(--primary); color: var(--primary); }
.sb-tool-btn.sb-report-btn { flex: none; width: auto; padding: 8px 12px; color: #ef4444; border-color: #fecaca; white-space: nowrap; }
.sb-tool-btn.sb-report-btn:hover { background: #fef2f2; color: #dc2626; border-color: #ef4444; }
.rep-field-label { font-size: 12px; color: #94a3b8; margin: 10px 0 6px; font-weight: 600; }

/* 举报 - 图片上传 */
.rep-uploader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 18px 12px; border: 1.5px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; color: #64748b; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.rep-uploader:hover, .rep-uploader.drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, #f8fafc); color: var(--primary); }
.rep-uploader iconify-icon { color: inherit; }
.rep-uploader-text { font-weight: 600; }
.rep-uploader-tip { font-size: 11px; opacity: .75; }
.rep-img-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.rep-img-preview:empty { display: none; }
.rep-thumb { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: #f1f5f9; border: 1px solid #e2e8f0; cursor: zoom-in; }
.rep-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rep-thumb .rep-del { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(15,23,42,.7); color: #fff; font-size: 14px; line-height: 18px; text-align: center; cursor: pointer; padding: 0; }
.rep-thumb .rep-del:hover { background: #ef4444; }
.rep-thumb .rep-status { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; text-align: center; color: #fff; background: rgba(15,23,42,.55); padding: 1px 0; }
@media (prefers-color-scheme: dark) {
  .rep-uploader { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.18); color: #cbd5e1; }
  .rep-thumb { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); }
}
@media (max-width: 480px) { .rep-thumb { width: 64px; height: 64px; } }

/* ===== 频道头部工具按钮（主题/搜索/更多） ===== */
.channel-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; }
.channel-title-wrap #channelName { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.channel-title-wrap .channel-sub { margin-left: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width:480px) { .channel-sub { font-size: 11px; } }
/* 手机端频道头部紧凑布局：缩小内边距与按钮尺寸，防止挤压标题 */
@media (max-width: 600px) {
  .chat-channel-header { padding: 10px 12px; gap: 8px; }
  .channel-actions { gap: 6px !important; }
  .channel-tools { gap: 6px; }
  .ding-btn { padding: 5px 10px; font-size: 12px; }
  .channel-actions .mute-all-btn { padding: 5px 10px; font-size: 12px; }
  .ch-tool-btn { height: 32px; min-width: 32px; padding: 0 8px; }
  .ch-tool-search, .ch-tool-theme { width: 32px; }
}
.ch-tool-btn { display: inline-flex; align-items: center; justify-content: center; height: 34px; min-width: 34px; padding: 0 12px; border: none; border-radius: 10px; cursor: pointer; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-size: 13px; font-weight: 600; transition: filter .15s, transform .1s; }
.ch-tool-btn:hover { filter: brightness(1.06); }
.ch-tool-btn:active { transform: scale(.95); }
.ch-tool-search, .ch-tool-theme { padding: 0; width: 34px; }
.ch-tool-more { padding: 0; width: 34px; background: transparent; color: var(--text-secondary); }
.ch-more-wrap { position: relative; }
.ch-more-menu { position: absolute; right: 0; top: 40px; background: var(--white); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 6px; min-width: 132px; z-index: 300; animation: cpmIn .15s ease; }
.ch-more-item { padding: 10px 16px; font-size: 14px; color: var(--text); border-radius: 9px; cursor: pointer; white-space: nowrap; }
.ch-more-item:hover { background: var(--primary-light); }

/* ===== 搜索历史消息 / 共享文件 弹窗（浅色卡片） ===== */
.shm-card { background: var(--white); border-radius: 20px; padding: 22px 20px 16px; width: min(92vw, 560px); max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: cpmIn .18s ease; }
.shm-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.shm-sub { font-size: 12px; color: var(--text-secondary); margin: -8px 0 12px; }
.shm-bar { display: flex; gap: 10px; margin-bottom: 12px; }
.shm-input { flex: 1; padding: 11px 14px; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; font-size: 14px; outline: none; background: var(--surface); color: var(--text); transition: border .15s, box-shadow .15s; min-width: 0; }
.shm-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.shm-go { padding: 0 22px; border: none; border-radius: 12px; background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.shm-go:hover { filter: brightness(1.08); }
.shm-scope { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.shm-radio { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
.shm-radio input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.shm-results { flex: 1; overflow-y: auto; border-top: 1px solid var(--border, #eef2f7); padding-top: 10px; min-height: 120px; }
.shm-empty { text-align: center; color: var(--text-secondary); font-size: 13px; padding: 28px 0; }
.shm-sec { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin: 8px 0 6px; }
.shm-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; cursor: default; }
.shm-item-pm { cursor: pointer; }
.shm-item-pm:hover { background: var(--primary-light); }
.shm-av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #22c55e, #14b8a6); color: #fff; font-weight: 600; font-size: 14px; }
.shm-av img { width: 100%; height: 100%; object-fit: cover; }
.shm-info { flex: 1; min-width: 0; }
.shm-nick { font-size: 13px; font-weight: 600; color: var(--text); }
.shm-time { font-size: 11px; color: var(--text-secondary); font-weight: 400; margin-left: 4px; }
.shm-text { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.shm-tag { font-size: 11px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border, #eef2f7); border-radius: 8px; padding: 3px 8px; flex-shrink: 0; }
.shm-size { color: var(--text-secondary); font-size: 11px; }
.shm-dl { font-size: 12px; color: var(--primary); text-decoration: none; border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 8px; padding: 4px 10px; flex-shrink: 0; }
.shm-dl:hover { background: var(--primary-light); }
.shm-footer { display: flex; justify-content: flex-end; padding-top: 12px; }
.shm-close { padding: 9px 26px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: var(--white); color: var(--text); font-size: 13px; cursor: pointer; }
.shm-close:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 修复：气泡被 meta 行撑宽（气泡按内容收缩） ===== */
.msg-body { align-items: flex-start; }
.message-self .msg-body { align-items: flex-end; }
.msg-bubble { width: fit-content; max-width: 100%; }
.message-self .msg-bubble { margin-left: auto; }
.msg-reactions { width: fit-content; }
.message-announcement .msg-body { align-items: center; }
.sb-chan-avatar.sb-chan-gold { background: linear-gradient(135deg, #f59e0b, #f97316); }

/* ===== 摇骰子（全屏 3D 骰子动画 + 消息内小骰子） ===== */
#diceOverlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .58); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 1200; display: flex; align-items: center; justify-content: center; animation: diceFadeIn .25s ease; }
.dice-stage { text-align: center; perspective: 800px; }
.dice-cube { width: 110px; height: 110px; margin: 0 auto 30px; position: relative; transform-style: preserve-3d; transition: transform 1.5s cubic-bezier(.16, .84, .3, 1); }
.dice-face { position: absolute; inset: 0; background: linear-gradient(145deg, #ffffff, #eef2f7); border-radius: 18px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08), 0 0 22px rgba(99, 102, 241, .28); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 13px; box-sizing: border-box; backface-visibility: hidden; }
.dice-face .pip { width: 17px; height: 17px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #64748b, #1e293b); align-self: center; justify-self: center; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, .45); }
.df-back { transform: rotateY(180deg) translateZ(55px); }
.df-right { transform: rotateY(90deg) translateZ(55px); }
.df-left { transform: rotateY(-90deg) translateZ(55px); }
.df-top { transform: rotateX(90deg) translateZ(55px); }
.df-bottom { transform: rotateX(-90deg) translateZ(55px); }
.dice-result-text { color: #fff; font-size: 19px; font-weight: 700; letter-spacing: 1px; text-shadow: 0 2px 12px rgba(0, 0, 0, .45); animation: diceTextPop .35s ease; }
.dice-result-text.dice-win { color: #fde047; font-size: 22px; }
@keyframes diceFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes diceTextPop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 消息气泡内的小骰子 */
.msg-dice { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 3px 4px 2px; min-width: 76px; }
.msg-dice .mini-die { width: 46px; height: 46px; background: linear-gradient(145deg, #ffffff, #e8edf4); border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .07), 0 3px 8px rgba(15, 23, 42, .14); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px; box-sizing: border-box; }
.msg-dice .mini-die .pip { width: 7px; height: 7px; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #64748b, #1e293b); align-self: center; justify-self: center; }
.msg-dice-label { font-size: 12px; color: #64748b; white-space: nowrap; }
.msg-dice-label b { color: #4f46e5; font-size: 13px; }

/* ===== 登录/注册页樱花飘落 ===== */
#loginSakura { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }

/* ===== 后台：邀请好友入群弹窗（可滑动多选列表） ===== */
.invite-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; transition: background .12s; user-select: none; -webkit-user-select: none; }
.invite-item:hover { background: #f8fafc; }
.invite-item.picked { background: #eef2ff; }
.invite-item.disabled { opacity: .55; cursor: default; }
.invite-item.disabled:hover { background: transparent; }
.invite-item .user-avatar-sm { width: 30px; height: 30px; font-size: 13px; flex-shrink: 0; }
.invite-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cbd5e1; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; box-sizing: border-box; }
.invite-item.picked .invite-check { background: #6366f1; border-color: #6366f1; }
.invite-item.disabled .invite-check { width: auto; min-width: 48px; height: 20px; border: none; border-radius: 10px; background: #f1f5f9; color: #94a3b8; font-size: 11px; font-weight: 500; padding: 0 8px; }

/* ============================================================
   钱包 / 红包 / 自由市场
   ============================================================ */

/* 侧边栏钱包入口 */
.si-badge { margin-left: auto; font-size: 11px; font-weight: 700; color: #d97706; background: #fffbeb; border: 1px solid #fde68a; border-radius: 20px; padding: 2px 8px; flex-shrink: 0; }

/* ---------- 消息里的红包卡片 ---------- */
.rp-card {
  display: flex; align-items: center; gap: 10px;
  min-width: 210px; max-width: 260px;
  padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #ef4444);
  color: #fff; cursor: pointer; user-select: none;
  box-shadow: 0 6px 18px rgba(239, 68, 68, .28);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.rp-card:active { transform: scale(.97); }
.rp-card:hover { box-shadow: 0 8px 24px rgba(239, 68, 68, .38); }
.rp-icon { font-size: 24px; flex-shrink: 0; }
.rp-text { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: hidden; }
.rp-text b { font-size: 14px; font-weight: 700; }
.rp-text i { font-size: 12px; font-style: normal; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-tip { font-size: 11px; background: rgba(255, 255, 255, .22); border-radius: 20px; padding: 3px 9px; flex-shrink: 0; }
.rp-card.rp-done { background: linear-gradient(135deg, #fbbf24, #f59e0b); filter: saturate(.85); }
.rp-card.rp-mine { background: linear-gradient(135deg, #f59e0b, #d97706); opacity: .82; }
.rp-card.rp-expired { background: linear-gradient(135deg, #cbd5e1, #94a3b8); box-shadow: none; }

/* ---------- 钱包弹窗 ---------- */
.wallet-modal { max-width: 420px; width: min(92vw, 420px); }
.wallet-balance-card {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 14px; padding: 18px; color: #fff; text-align: center; margin-bottom: 14px;
}
.wb-label { font-size: 12px; opacity: .9; }
.wb-amount { font-size: 32px; font-weight: 800; letter-spacing: .5px; margin: 4px 0 2px; }
.wb-tip { font-size: 11px; opacity: .85; }
.wallet-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.wallet-tab {
  flex: 1; padding: 8px 4px; border: 1px solid var(--border, #e2e8f0); background: transparent;
  border-radius: 10px; font-size: 13px; cursor: pointer; color: var(--text-secondary, #64748b);
}
.wallet-tab.active { background: var(--primary, #6366f1); border-color: var(--primary, #6366f1); color: #fff; font-weight: 600; }
.wallet-pane { display: block; }
.wallet-sub-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.wsub { flex: 1; padding: 7px; border-radius: 9px; border: 1px solid var(--border, #e2e8f0); background: transparent; font-size: 12px; cursor: pointer; color: var(--text-secondary, #64748b); }
.wsub.active { background: var(--primary-light, #eef2ff); border-color: var(--primary, #6366f1); color: var(--primary, #6366f1); font-weight: 600; }
.wd-form { display: flex; flex-direction: column; gap: 8px; }
.mch-status-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;padding:12px;margin-bottom:10px}
.wd-upload{display:flex;align-items:center;gap:8px;padding:11px 12px;border:1px dashed var(--border);border-radius:10px;background:var(--bg-secondary);color:var(--text-secondary);font-size:13px;cursor:pointer}
.wd-upload:hover{border-color:var(--primary);color:var(--primary)}
.wd-qr-preview{display:flex;align-items:center;gap:10px;margin-top:2px}
.wd-qr-preview img{width:88px;height:88px;object-fit:cover;border-radius:8px;border:1px solid var(--border)}
.wd-qr-del{padding:3px 10px;border:1px solid #fecaca;background:#fff0f0;color:#ef4444;border-radius:8px;font-size:12px;cursor:pointer}
.wallet-list { max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wl-empty { text-align: center; color: #94a3b8; font-size: 12px; padding: 16px 0; }
.wl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-light, #f8fafc); margin-bottom: 6px; }
.wl-main { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.wl-main b { font-size: 13px; }
.wl-main span { font-size: 11px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-right { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.wl-delta { font-size: 14px; font-weight: 700; }
.wl-delta.pos { color: #16a34a; }
.wl-delta.neg { color: #dc2626; }
.wl-time { font-size: 10px; color: #94a3b8; }
.wl-status { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f1f5f9; color: #64748b; }
.wl-status.st-pending { background: #fffbeb; color: #d97706; }
.wl-status.st-approved { background: #f0fdf4; color: #15803d; }
.wl-status.st-rejected { background: #fef2f2; color: #b91c1c; }
.wl-status.st-sold { background: #eef2ff; color: #4338ca; }
.wl-status.st-offline { background: #f1f5f9; color: #64748b; }

/* ---------- 发红包弹窗 ---------- */
.rp-send-card { display: flex; flex-direction: column; gap: 12px; }
.rp-field label { display: block; font-size: 12px; color: var(--text-secondary, #64748b); margin-bottom: 5px; }
.rp-input-wrap { display: flex; align-items: center; gap: 6px; background: var(--bg-light, #f8fafc); border: 1px solid var(--border, #e2e8f0); border-radius: 10px; padding: 0 12px; }
.rp-cny { font-size: 15px; font-weight: 700; color: var(--text, #1e293b); }
.rp-input { flex: 1; border: none; background: transparent; padding: 10px 0; font-size: 15px; outline: none; color: var(--text, #1e293b); }
.rp-mode-wrap { display: flex; gap: 8px; }
.rp-mode-btn { flex: 1; padding: 9px 4px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); background: transparent; font-size: 12px; cursor: pointer; color: var(--text-secondary, #64748b); }
.rp-mode-btn.active { background: #fff1f2; border-color: #ef4444; color: #dc2626; font-weight: 700; }
.rp-total { display: flex; align-items: center; justify-content: space-between; font-size: 20px; font-weight: 800; padding-top: 4px; border-top: 1px dashed var(--border, #e2e8f0); }
.rp-bal { font-size: 11px; font-weight: 400; color: var(--text-secondary, #64748b); }

/* ---------- 拆红包弹窗 ---------- */
.rp-open-card {
  width: min(88vw, 320px); background: linear-gradient(160deg, #f97316, #dc2626);
  border-radius: 18px; padding: 28px 22px 20px; text-align: center; color: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4); display: flex; flex-direction: column; align-items: center;
}
.rpo-sender { font-size: 14px; opacity: .95; }
.rpo-note { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.rpo-amount-wrap { margin: 14px 0 6px; }
.rpo-amount { font-size: 38px; font-weight: 800; }
.rpo-best { font-size: 12px; background: rgba(255, 255, 255, .22); border-radius: 20px; padding: 3px 12px; display: inline-block; margin-top: 6px; }
.rpo-open-btn {
  width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(135deg, #fde68a, #f59e0b);
  display: flex; align-items: center; justify-content: center; cursor: pointer; margin: 10px 0 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3); transition: transform .15s;
}
.rpo-open-btn span { font-size: 32px; font-weight: 800; color: #b91c1c; }
.rpo-open-btn:active { transform: scale(.94); }
.rpo-hint { font-size: 12px; opacity: .9; }
.rpo-claims { width: 100%; margin-top: 14px; max-height: 190px; overflow-y: auto; text-align: left; }
.rpo-claims-title { font-size: 11px; opacity: .85; margin-bottom: 6px; text-align: center; }
.rpo-claim-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .16); font-size: 13px; }
.rpc-best { font-size: 10px; background: #fde68a; color: #b45309; border-radius: 20px; padding: 1px 6px; }
.rpc-amt { font-weight: 700; }
.rpo-close { margin-top: 14px; font-size: 13px; opacity: .85; cursor: pointer; border-top: 1px solid rgba(255, 255, 255, .2); padding-top: 12px; width: 100%; }

/* ---------- 自由市场 ---------- */
.market-modal { max-width: 520px; width: min(94vw, 520px); }
.market-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.market-tab { flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--border, #e2e8f0); background: transparent; font-size: 13px; cursor: pointer; color: var(--text-secondary, #64748b); }
.market-tab.active { background: var(--primary, #6366f1); border-color: var(--primary, #6366f1); color: #fff; font-weight: 600; }
.market-search { display: flex; gap: 8px; margin-bottom: 12px; }
.market-search .pm-input { margin: 0; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 380px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.mk-item { border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 8px; cursor: pointer; transition: transform .15s, box-shadow .15s; background: var(--white, #fff); }
.mk-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.mk-img { width: 100%; height: 110px; object-fit: cover; border-radius: 9px; display: block; }
.mk-noimg { display: flex; align-items: center; justify-content: center; background: var(--bg-light, #f8fafc); font-size: 30px; }
.mk-title { font-size: 13px; font-weight: 600; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mk-price { font-size: 15px; font-weight: 800; color: #dc2626; margin-top: 2px; }
.mk-seller { font-size: 11px; color: #94a3b8; }
.mk-status { font-size: 11px; margin-top: 4px; padding: 2px 8px; border-radius: 20px; display: inline-block; background: #f1f5f9; color: #64748b; }
.mk-status.st-approved { background: #f0fdf4; color: #15803d; }
.mk-status.st-pending { background: #fffbeb; color: #d97706; }
.mk-status.st-rejected { background: #fef2f2; color: #b91c1c; }
.mk-status.st-sold { background: #eef2ff; color: #4338ca; }
.mk-act { width: 100%; margin-top: 6px; padding: 5px; border-radius: 8px; border: 1px solid var(--border, #e2e8f0); background: var(--bg-light, #f8fafc); font-size: 12px; cursor: pointer; color: var(--text-secondary, #64748b); }
.market-sub-title { font-size: 12px; font-weight: 700; color: var(--text-secondary, #64748b); margin: 12px 0 6px; }
.pb-upload { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border: 1px dashed var(--border, #cbd5e1); border-radius: 12px; cursor: pointer; color: var(--text-secondary, #64748b); font-size: 12px; margin-top: 8px; }
.pb-upload:hover { background: var(--bg-light, #f8fafc); }
.id-price { font-size: 26px; font-weight: 800; color: #dc2626; }
.id-seller { font-size: 12px; color: var(--text-secondary, #64748b); margin: 4px 0; }
.id-desc { font-size: 13px; line-height: 1.7; white-space: pre-wrap; background: var(--bg-light, #f8fafc); border-radius: 10px; padding: 10px; margin: 8px 0; }
.id-status { font-size: 12px; color: var(--text-secondary, #64748b); }

/* ===== 发卡网市场：订单 / 发货 / 补卡 ===== */
.mk-badge{display:inline-block;min-width:16px;height:16px;line-height:16px;padding:0 4px;margin-left:4px;border-radius:8px;background:#ef4444;color:#fff;font-size:11px;text-align:center;vertical-align:middle}
.mk-stock{font-size:12px;color:var(--text-secondary);display:flex;align-items:center;gap:3px;margin-top:2px}
.mk-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.mk-act{padding:4px 10px;border:1px solid var(--border);border-radius:8px;background:var(--bg-secondary);color:var(--text-primary);font-size:12px;cursor:pointer}
.mk-act:hover{border-color:var(--primary);color:var(--primary)}
.mk-act-main{background:linear-gradient(135deg,#f59e0b,#ef4444);border:0;color:#fff}
.mk-act-main:hover{opacity:.9;color:#fff}
.mk-act-danger{color:#ef4444;border-color:#fecaca}
.mk-act-danger:hover{background:#fef2f2;border-color:#ef4444;color:#ef4444}
.pb-mode-row{display:flex;gap:8px;margin:6px 0 10px}
.pb-mode-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;padding:9px 6px;border:1px solid var(--border);border-radius:10px;background:var(--bg-secondary);color:var(--text-secondary);font-size:13px;cursor:pointer}
.pb-mode-btn.active{border-color:var(--primary);color:var(--primary);background:var(--bg-primary);font-weight:600}
.mk-order{border:1px solid var(--border);border-radius:12px;padding:10px 12px;margin-bottom:10px;background:var(--bg-secondary)}
.mo-head{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:14px;margin-bottom:4px}
.mo-price{color:#ef4444;font-weight:700;flex-shrink:0}
.mo-line{font-size:12px;color:var(--text-secondary);margin-top:2px}
.mo-status{padding:1px 8px;border-radius:8px;font-size:12px}
.mo-status.ok{background:#dcfce7;color:#15803d}
.mo-status.wait{background:#fef3c7;color:#b45309}
.mo-card{margin-top:8px;padding:8px 10px;border-radius:8px;background:var(--bg-primary);border:1px dashed var(--border);font-size:13px;word-break:break-all;display:flex;align-items:center;justify-content:space-between;gap:8px}
.mo-card-text{flex:1;font-family:monospace}
.mo-tip{margin-top:8px;font-size:12px;color:#b45309}
.id-meta{font-size:12px;color:var(--text-secondary);display:flex;align-items:center;gap:4px;margin:4px 0}
#brCards .mo-card{margin-bottom:8px}
.id-merchant{margin:10px 0;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:var(--bg-secondary);font-size:13px}
.mc-title{display:flex;align-items:center;gap:6px;font-weight:700;color:var(--primary);margin-bottom:8px}
.mc-row{display:flex;align-items:center;gap:8px;padding:3px 0;flex-wrap:wrap}
.mc-label{color:var(--text-secondary);min-width:64px}
.mc-val{font-weight:600;word-break:break-all}
.mc-img{max-width:120px;max-height:120px;border-radius:8px;border:1px solid var(--border);cursor:pointer}

/* ===== 购买确认 / 支付方式 ===== */
.bc-line{font-size:13px;color:var(--text-primary);margin:6px 0;line-height:1.6}
.bc-pay-title{font-size:13px;font-weight:600;margin:14px 0 8px;color:var(--text-secondary)}
.bc-pay-list{display:flex;flex-direction:column;gap:8px}
.bc-pay{display:flex;align-items:center;gap:10px;padding:11px 12px;border:1px solid var(--border);border-radius:12px;background:var(--bg-secondary);cursor:pointer;font-size:14px;transition:.15s}
.bc-pay:hover{border-color:var(--primary)}
.bc-pay.active{border-color:var(--primary);background:var(--bg-primary);box-shadow:0 0 0 2px rgba(99,102,241,.18)}
.bc-pay input{accent-color:var(--primary);width:16px;height:16px}
.bc-pay-ic{display:inline-flex;color:var(--primary)}

/* ===== 账号ID / VIP / 在线人数 / 搜索结果 ===== */
.uid-badge{display:inline-flex;align-items:center;font-size:10px;font-weight:600;color:#64748b;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:6px;padding:0 5px;margin-left:5px;vertical-align:1px;font-family:monospace}
.nick-vip,.msg-nick.nick-vip,.sb-nick.nick-vip,.pm-id-row .nick-vip{color:#b45309 !important;font-weight:700}
.vip-badge{display:inline-flex;align-items:center;gap:2px;font-size:10px;font-weight:700;color:#fff;background:linear-gradient(135deg,#fbbf24,#f59e0b);border-radius:8px;padding:1px 6px;margin-left:5px;vertical-align:1px}
.sb-online-bar{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text-secondary);padding:6px 10px;margin:6px 0 2px;background:var(--bg-secondary);border-radius:10px}
.sb-online-bar b{color:#16a34a;font-size:13px}
.sob-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px rgba(34,197,94,.18);flex-shrink:0}
.sob-sep{color:var(--border)}
.sid-list{display:flex;flex-direction:column;gap:8px}
.sid-item{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 12px;border:1px solid var(--border);border-radius:10px;background:var(--bg-secondary)}
.sid-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.sid-main b{font-size:14px;display:flex;align-items:center;flex-wrap:wrap}
.sid-main span{font-size:12px;color:var(--text-secondary)}
.pm-id-row{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;color:var(--text-secondary);margin:8px 0}
.pm-id-row b{color:var(--text-primary);font-family:monospace}
.pm-qq-row{display:flex;gap:8px;align-items:center;margin:8px 0}
.pm-qq-row .pm-input{flex:1;margin:0}
.pm-mini-btn{padding:7px 14px;border:1px solid var(--border);border-radius:8px;background:var(--bg-secondary);color:var(--text-primary);font-size:13px;cursor:pointer;flex-shrink:0}
.pm-mini-btn:hover{border-color:var(--primary);color:var(--primary)}
.vip-card{border-radius:12px;padding:14px;background:linear-gradient(135deg,#1f2937,#111827);color:#f8fafc;margin-bottom:12px}
.vip-card.vip-on{background:linear-gradient(135deg,#f59e0b,#b45309)}
.vip-title{display:flex;align-items:center;gap:6px;font-size:15px;font-weight:700}
.vip-expire{font-size:12px;opacity:.9;margin-top:4px}
.vip-plans{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.vip-plan{border:1px solid var(--border);border-radius:12px;padding:12px;text-align:center;cursor:pointer;background:var(--bg-secondary)}
.vip-plan:hover{border-color:#f59e0b}
.vip-plan.vp-hot{border-color:#f59e0b;background:rgba(245,158,11,.08)}
.vp-label{font-size:13px;color:var(--text-secondary);display:flex;align-items:center;justify-content:center;gap:5px}
.vp-tag{font-size:10px;background:#ef4444;color:#fff;border-radius:6px;padding:0 5px}
.vp-price{font-size:18px;font-weight:700;color:#f59e0b;margin-top:4px}

/* ============================================================
   社交体系：好友 / 群聊分区 / 群管理 / 好友申请
   ============================================================ */
.sb-section-title.sb-toggle-title{
  cursor:pointer;user-select:none;display:flex;align-items:center;justify-content:space-between;
  transition:opacity .15s;
}
.sb-section-title.sb-toggle-title:hover{opacity:.75}
.sb-sec-right{display:flex;align-items:center;gap:6px}
.sb-sec-count{
  font-size:11px;font-weight:600;color:var(--text-secondary);
  background:var(--bg-hover,#f1f5f9);border-radius:8px;padding:1px 6px;min-width:18px;text-align:center;
}
.sb-sec-arrow{transition:transform .18s;opacity:.6}

/* 好友条目 */
.sb-friend-entry{
  display:flex;align-items:center;gap:8px;padding:7px 12px 7px 16px;cursor:pointer;
  border-radius:8px;transition:background .15s;position:relative;
}
.sb-friend-entry:hover{background:var(--bg-hover,#f1f5f9)}
.fr-dot{width:8px;height:8px;border-radius:50%;background:#cbd5e1;flex-shrink:0}
.fr-dot-on{background:#22c55e;box-shadow:0 0 0 2px rgba(34,197,94,.18)}
.sb-friend-name{
  flex:1;font-size:13px;color:var(--text-primary,#334155);font-weight:500;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;align-items:center;gap:4px;
}
.sb-friend-uid{font-size:11px;color:#94a3b8;flex-shrink:0}
/* 好友举报入口：默认淡出，悬停该行时显示 */
.sb-friend-report{
  flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;
  width:20px;height:20px;border-radius:6px;color:#94a3b8;
  opacity:0;transition:opacity .15s,color .15s,background .15s;
}
.sb-friend-entry:hover .sb-friend-report{opacity:1}
.sb-friend-report:hover{color:#ef4444;background:#fff1f2}
@media (hover:none){ .sb-friend-report{opacity:.55} }
/* 好友「更多操作」入口：始终可见，点击弹出操作弹窗 */
.sb-friend-act{
  flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;
  width:22px;height:22px;border-radius:6px;color:#64748b;background:#f1f5f9;
  margin-left:2px;
}
.sb-friend-act:hover{color:#6366f1;background:#eef2ff}
.fr-ai-tag{
  font-size:9px;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;
  border-radius:5px;padding:0 4px;font-weight:600;flex-shrink:0;
}
.fr-role-tag{font-size:9px;border-radius:5px;padding:0 4px;font-weight:600;flex-shrink:0}
.fr-role-owner{background:#fef3c7;color:#b45309}
.fr-role-admin{background:#dbeafe;color:#1d4ed8}

/* 群条目齿轮 */
.sb-group-entry{position:relative}
.sb-entry-gear{
  opacity:0;transition:opacity .15s;color:#94a3b8;display:flex;align-items:center;padding:2px;
  border-radius:6px;flex-shrink:0;
}
.sb-group-entry:hover .sb-entry-gear{opacity:1}
.sb-entry-gear:hover{background:var(--bg-hover,#e2e8f0);color:var(--text-primary,#334155)}

/* 好友申请列表 */
.fr-req-item{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1px solid var(--border,#e2e8f0);
}
.fr-req-item:last-child{border-bottom:none}
.fr-req-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.fr-req-main b{font-size:13px;color:var(--text-primary,#334155);display:flex;align-items:center;gap:5px}
.fr-req-main span{font-size:12px;color:#94a3b8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fr-req-acts{display:flex;gap:6px;flex-shrink:0}

/* 群管理面板 */
.gm-card{
  background:var(--bg-secondary,#f8fafc);border:1px solid var(--border,#e2e8f0);
  border-radius:12px;padding:12px;margin-bottom:10px;
}
.gm-title{
  display:flex;align-items:center;gap:6px;font-size:13px;font-weight:700;
  color:var(--text-primary,#334155);margin-bottom:8px;
}
.gm-row{display:flex;align-items:center;justify-content:space-between;padding:3px 0;font-size:12px}
.gm-k{color:#94a3b8;flex-shrink:0}
.gm-v{color:var(--text-primary,#334155);font-weight:600;text-align:right;word-break:break-all}
.gm-ann{
  background:#eff6ff;border:1px solid #bfdbfe;color:#1d4ed8;border-radius:10px;padding:10px 12px;
  font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-word;
}
.gm-ann-meta{font-size:11px;color:#94a3b8;margin-top:6px}
.gm-tip{font-size:11px;color:#94a3b8;line-height:1.6}
.gm-acts{display:flex;gap:8px;flex-wrap:wrap}

/* 群成员管理 */
.gm-members{max-height:280px;overflow-y:auto;margin-top:2px}
.gm-member{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 4px;border-bottom:1px solid #eef2f7}
.gm-member:last-child{border-bottom:none}
.gm-member-main{display:flex;align-items:center;gap:6px;min-width:0}
.gm-member-name{font-size:13px;font-weight:600;color:var(--text-primary,#334155);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gm-role{font-size:10px;padding:1px 6px;border-radius:6px;font-weight:600;flex-shrink:0}
.gm-role-owner{background:#fef3c7;color:#b45309}
.gm-role-admin{background:#ede9fe;color:#7c3aed}
.gm-role-muted{background:#fef2f2;color:#dc2626;display:inline-flex;align-items:center;gap:3px}
.gm-member-acts{display:flex;gap:5px;flex-wrap:wrap;flex-shrink:0}
.gm-member-acts-empty{color:#cbd5e1;font-size:12px}
.gm-m-act{padding:3px 9px;border:1px solid var(--border,#e2e8f0);border-radius:7px;background:#fff;color:#475569;font-size:11px;cursor:pointer;white-space:nowrap}
.gm-m-act:hover{border-color:#6366f1;color:#6366f1}
.gm-m-act-main{background:#eef2ff;border-color:#c7d2fe;color:#4f46e5}
.gm-m-act-danger{border-color:#fecaca;color:#dc2626}
.gm-m-act-danger:hover{background:#fef2f2;border-color:#ef4444;color:#ef4444}

/* 用户列表加好友按钮 */
.sb-add-friend{color:#94a3b8;cursor:pointer;transition:color .15s}
.sb-add-friend:hover{color:#f59e0b}

/* 发现分区举报入口（红色头像底） */
.sb-chan-red{background:#fee2e2;color:#dc2626}

/* QQ 式群分组：我创建的 / 我管理的 / 我加入的 */
.sb-gsec{margin:2px 0}
.sb-gsec-head{
  display:flex;align-items:center;gap:5px;padding:6px 12px;cursor:pointer;user-select:none;
  color:#94a3b8;font-size:11px;font-weight:600;border-radius:8px;transition:background .15s;
}
.sb-gsec-head:hover{background:var(--bg-hover,#f1f5f9);color:var(--text-primary,#475569)}
.sb-gsec-arrow{flex-shrink:0;opacity:.7}
.sb-gsec-label{flex:1}
.sb-gsec-count{
  font-size:10px;font-weight:600;color:#94a3b8;background:var(--bg-hover,#f1f5f9);
  border-radius:8px;padding:0 6px;min-width:16px;text-align:center;
}
.sb-gsec-body .sb-chan-entry{padding-left:14px}

/* 品牌版本角标 / 登录页标语 */
.brand-ver{
  display:inline-block;margin-left:8px;font-size:10px;font-weight:700;vertical-align:middle;
  color:#fff;background:linear-gradient(135deg,#6366f1,#8b5cf6);
  border-radius:6px;padding:2px 6px;letter-spacing:.5px;
}
.login-brand-slogan{
  margin:6px 0 0;font-size:12px;color:#94a3b8;letter-spacing:.3px;
}

/* ==================== 论坛入口（论坛本体已拆到 forum.php） ==================== */
.sb-chan-avatar.sb-chan-forum { background: linear-gradient(135deg,#8b5cf6,#ec4899); }

/* 侧边栏「论坛」入口的右箭头 */
.sb-chan-go { margin-left: auto; color: var(--text-light,#94a3b8); display: flex; align-items: center; flex-shrink: 0; }
