* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif; background: #ededed; color: #333; font-size: 14px; }
body { overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; }

/* 通用 */
.page { flex: 1; display: flex; flex-direction: column; background: #ededed; overflow: hidden; }
.hidden { display: none !important; }

/* 顶部导航栏 */
.navbar { height: 48px; background: #ededed; border-bottom: 1px solid #e0e0e0; display: flex; align-items: center; padding: 0 12px; flex-shrink: 0; position: relative; }
.navbar .back { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #333; cursor: pointer; }
.navbar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.navbar .right { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #333; cursor: pointer; }

/* 登录页 */
.login-page { justify-content: center; align-items: center; padding: 40px 24px; background: #fff; }
.login-logo { width: 80px; height: 80px; border-radius: 16px; background: linear-gradient(135deg, #07c160, #10ad56); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 36px; margin-bottom: 24px; }
.login-title { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.login-subtitle { color: #999; margin-bottom: 32px; }
.login-form { width: 100%; max-width: 320px; }
.login-form input { width: 100%; height: 48px; padding: 0 16px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 15px; margin-bottom: 12px; outline: none; transition: border-color .2s; }
.login-form input:focus { border-color: #07c160; }
.login-form button { width: 100%; height: 48px; background: #07c160; color: #fff; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.login-form button:active { background: #06ad56; }
.login-switch { margin-top: 16px; text-align: center; color: #07c160; cursor: pointer; font-size: 14px; }

/* 会话列表页 */
.session-list { flex: 1; overflow-y: auto; background: #fff; }
.session-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.session-item:active { background: #f5f5f5; }
.session-avatar { width: 48px; height: 48px; border-radius: 8px; background: #ddd; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; }
.session-avatar img { width: 100%; height: 100%; object-fit: cover; }
.session-info { flex: 1; margin-left: 12px; min-width: 0; }
.session-name { font-size: 16px; font-weight: 500; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; }
.session-time { font-size: 12px; color: #999; font-weight: 400; }
.session-msg { font-size: 13px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-badge { background: #fa5151; color: #fff; font-size: 11px; border-radius: 10px; padding: 0 6px; height: 18px; min-width: 18px; display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; }

/* 聊天详情页 */
.chat-page { background: #ededed; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; }
.msg-item { display: flex; margin-bottom: 16px; align-items: flex-start; }
.msg-item.self { flex-direction: row-reverse; }
.msg-avatar { width: 38px; height: 38px; border-radius: 6px; background: #ddd; flex-shrink: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-bubble { max-width: 70%; margin: 0 10px; padding: 9px 12px; border-radius: 6px; background: #fff; word-wrap: break-word; font-size: 15px; line-height: 1.5; position: relative; }
.msg-item.self .msg-bubble { background: #95ec69; }
.msg-bubble .msg-sender { font-size: 12px; color: #999; margin-bottom: 2px; }
.msg-bubble img { max-width: 100%; border-radius: 4px; }
.msg-time { text-align: center; font-size: 12px; color: #999; margin: 16px 0; }

/* 输入框 */
.chat-input { display: flex; align-items: center; padding: 8px 12px; background: #f7f7f7; border-top: 1px solid #e0e0e0; flex-shrink: 0; }
.chat-input .icon-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: #666; cursor: pointer; flex-shrink: 0; }
.chat-input input { flex: 1; height: 36px; padding: 0 12px; border: 1px solid #e0e0e0; border-radius: 6px; font-size: 15px; outline: none; margin: 0 8px; background: #fff; }
.chat-input .send-btn { height: 36px; padding: 0 16px; background: #07c160; color: #fff; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }
.chat-input .send-btn:active { background: #06ad56; }

/* 新建聊天 */
.new-chat-btn { position: absolute; right: 16px; bottom: 80px; width: 56px; height: 56px; border-radius: 50%; background: #07c160; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; box-shadow: 0 2px 8px rgba(0,0,0,.15); cursor: pointer; }
.new-chat-btn:active { transform: scale(0.95); }

/* 底部 Tab */
.tabbar { display: flex; height: 56px; background: #f7f7f7; border-top: 1px solid #e0e0e0; flex-shrink: 0; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #999; font-size: 11px; cursor: pointer; }
.tab-item.active { color: #07c160; }
.tab-item .tab-icon { font-size: 22px; margin-bottom: 2px; }

/* 模态框 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; padding: 20px; width: 85%; max-width: 360px; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.modal input { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 15px; margin-bottom: 12px; outline: none; }
.modal input:focus { border-color: #07c160; }
.modal-btns { display: flex; gap: 12px; margin-top: 8px; }
.modal-btns button { flex: 1; height: 44px; border-radius: 8px; border: none; font-size: 15px; cursor: pointer; }
.modal-btns .cancel { background: #f0f0f0; color: #666; }
.modal-btns .confirm { background: #07c160; color: #fff; }

/* Toast */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 200; }

/* 用户搜索结果 */
.search-result { padding: 8px 0; }
.search-user-item { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; }
.search-user-item:active { background: #f5f5f5; }
.search-user-item .session-avatar { width: 40px; height: 40px; }

/* 群成员 */
.member-list { display: flex; flex-wrap: wrap; padding: 12px; gap: 12px; }
.member-item { width: 60px; text-align: center; cursor: pointer; }
.member-item .session-avatar { width: 48px; height: 48px; margin: 0 auto 4px; }
.member-name { font-size: 12px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
