html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; }

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

/* 聊天气泡 */
.bubble {
  max-width: min(80%, 520px);
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
}
.bubble.from-user { background: #0ea5e9; color: #fff; border-bottom-right-radius: 6px; }
.bubble.from-admin { background: #fff; color: #1f2937; border: 1px solid #e5e7eb; border-bottom-left-radius: 6px; }
.bubble.image { padding: 4px; background: transparent; border: none; }
.bubble.image img { max-width: 280px; max-height: 320px; border-radius: 12px; cursor: zoom-in; display: block; }

.row { display: flex; gap: 8px; align-items: flex-end; }
.row.user-side { justify-content: flex-end; }
.row.admin-side { justify-content: flex-start; }

.timestamp { font-size: 11px; color: #94a3b8; text-align: center; margin: 6px 0; }

/* 后台 nav */
.nav-btn.active { background: rgba(14,165,233,.15); color: #38bdf8; }

/* 聊天用户项 */
.chat-user-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background .15s; }
.chat-user-item:hover { background: #f8fafc; }
.chat-user-item.active { background: #e0f2fe; }

/* 在线状态指示点 */
.avatar-wrap { position: relative; }
.presence-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 9999px;
  border: 2px solid #fff; background: #cbd5e1;
}
.presence-dot.online { background: #10b981; }
.presence-dot.offline { background: #cbd5e1; }

/* ========== 前台用户聊天（加大字号 / 头像 / 图片气泡） ========== */
.user-chat-page .bubble {
  max-width: min(88%, 580px);
  padding: 10px 15px;
  border-radius: 18px;
  font-size: 17px;
  line-height: 1.52;
}
.user-chat-page .bubble.from-user,
.user-chat-page .bubble.from-admin {
  border-radius: 18px;
}
.user-chat-page .bubble.from-user { border-bottom-right-radius: 8px; }
.user-chat-page .bubble.from-admin { border-bottom-left-radius: 8px; }
.user-chat-page .bubble.image { padding: 5px; }
.user-chat-page .bubble.image img {
  max-width: min(88vw, 360px);
  max-height: 420px;
  border-radius: 14px;
}
.user-chat-page .row { gap: 10px; align-items: flex-end; }
.user-chat-page .timestamp { font-size: 12px; margin: 8px 0; }
.user-chat-page .chat-input-footer { margin-top: 4px; }

/* 后台聊天（移动端略收紧气泡，避免撑破窄屏） */
@media (max-width: 1023px) {
  body:not(.user-chat-page) .bubble { max-width: min(88%, 300px); font-size: 13px; }
  body:not(.user-chat-page) .bubble.image img { max-width: min(80vw, 240px); max-height: 220px; }
}
