/* ===== 必富IM · 蓝白金融风格 ===== */
:root {
  --blue: #0052FF;
  --blue-light: #E8F0FF;
  --blue-dark: #0037B3;
  --gold: #F0B90B;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #8C8C8C;
  --text-light: #B0B0B0;
  --border: #E8ECF0;
  --red: #FF4D4F;
  --green: #00B42A;
  --orange: #FF7D00;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ===== SVG 图标基础 ===== */
.icon, .icon-sm, .icon-lg { fill: none; display: inline-block; flex-shrink: 0; }
.icon { width: 24px; height: 24px; }
.icon-sm { width: 20px; height: 20px; }
.icon-lg { width: 28px; height: 28px; }
.icon use, .icon-sm use, .icon-lg use { stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== 加载 / 启动 ===== */
#splash-screen {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, var(--blue) 0%, #0037B3 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.4s;
}
.splash-logo {
  width: 64px; height: 64px; background: rgba(255,255,255,0.15);
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.splash-logo svg { width: 36px; height: 36px; color: #fff; }
.splash-title { color: #fff; font-size: 22px; font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; }
.splash-sub { color: rgba(255,255,255,0.6); font-size: 13px; }
.splash-loader {
  margin-top: 32px; width: 120px; height: 3px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden;
}
.splash-loader-bar { height: 100%; width: 0; background: #fff; border-radius: 2px; animation: splashLoad 1.8s ease-in-out forwards; }
@keyframes splashLoad { 0% { width: 0; } 100% { width: 100%; } }

/* 启动页完成后隐藏 */
#splash-screen.fade-out { opacity: 0; pointer-events: none; }

/* ===== 主容器 ===== */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); }

/* ===== 顶部导航 ===== */
.top-bar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; padding-top: var(--safe-top); background: var(--card);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.top-bar-title { font-size: 17px; font-weight: 600; }
.top-bar-right { display: flex; gap: 16px; align-items: center; }
.top-bar-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: 8px; cursor: pointer; border: none; color: var(--text);
}
.top-bar-btn:active { background: var(--border); }

/* 带返回的顶部导航 */
.top-bar-back {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: 52px; display: flex; align-items: center; gap: 4px;
  padding: 0 12px; padding-top: var(--safe-top); background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(10px);
}
.top-bar-back .back-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--text); }
.top-bar-back .back-title { flex: 1; font-size: 17px; font-weight: 600; }
.top-bar-back .back-action { padding: 0 12px; color: var(--blue); font-size: 14px; cursor: pointer; }

/* ===== 底部导航 ===== */
.bottom-nav {
  height: 56px; display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom); flex-shrink: 0;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-light); font-size: 10px; cursor: pointer; transition: color 0.15s;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--blue); }
.nav-item:active { opacity: 0.7; }

/* ===== 页面容器 ===== */
.page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: none; flex-direction: column; }
.page.active { display: flex; }

/* ===== 搜索栏 ===== */
.search-bar {
  display: flex; align-items: center; gap: 8px; margin: 12px 16px;
  background: var(--card); border-radius: var(--radius); padding: 0 14px;
  box-shadow: var(--shadow);
}
.search-bar .search-icon { width: 18px; height: 18px; color: var(--text-light); flex-shrink: 0; }
.search-bar input {
  flex: 1; padding: 12px 0; border: none; outline: none; font-size: 14px; background: transparent;
}
.search-bar input::placeholder { color: var(--text-light); }

/* ===== 列表/卡片 ===== */
.card-list { padding: 0 16px; display: flex; flex-direction: column; gap: 8px; }
.conv-item {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.1s;
}
.conv-item:active { transform: scale(0.98); }
.avatar {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; object-fit: cover;
  background: var(--blue-light);
}
.avatar-sm { width: 40px; height: 40px; border-radius: 10px; }
.avatar-lg { width: 72px; height: 72px; border-radius: 18px; }
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 15px; font-weight: 500; margin-bottom: 3px; }
.conv-preview { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { text-align: right; flex-shrink: 0; }
.conv-time { font-size: 11px; color: var(--text-light); }

/* ===== 空状态 ===== */
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; color: var(--text-light);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; text-align: center; line-height: 1.6; }

/* ===== 联系人 / 好友 ===== */
.friend-item {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; cursor: pointer; box-shadow: var(--shadow);
}
.friend-item:active { transform: scale(0.98); }
.friend-info { flex: 1; }
.friend-name { font-size: 15px; font-weight: 500; }
.friend-uid { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* 新的朋友卡片 */
.section-card {
  background: var(--card); border-radius: var(--radius); margin: 8px 16px 4px;
  box-shadow: var(--shadow); overflow: hidden;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; cursor: pointer;
}
.section-header .section-title { font-size: 15px; font-weight: 500; }
.section-header .section-badge {
  background: var(--red); color: #fff; font-size: 11px; border-radius: 10px;
  min-width: 20px; height: 20px; padding: 0 6px; display: flex; align-items: center; justify-content: center;
}

/* ===== 个人中心 ===== */
.profile-card {
  background: var(--card); margin: 16px; border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px;
}
.profile-card .avatar-lg { cursor: pointer; }
.profile-info { flex: 1; }
.profile-name { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.profile-uid { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.copy-btn {
  background: var(--blue-light); color: var(--blue); border: none; border-radius: 4px;
  padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.menu-card {
  background: var(--card); margin: 0 16px 12px; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.menu-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.menu-row:last-child { border-bottom: none; }
.menu-row:active { background: var(--bg); }
.menu-row svg { width: 22px; height: 22px; color: var(--blue); }
.menu-row .menu-text { flex: 1; font-size: 15px; }
.menu-row .menu-value { color: var(--text-secondary); font-size: 14px; }
.menu-row .menu-arrow { color: var(--text-light); width: 16px; height: 16px; }

/* ===== 聊天页 ===== */
.chat-page {
  position: fixed; inset: 0; z-index: 30; background: var(--bg);
  display: none; flex-direction: column;
}
.chat-page.active { display: flex; }
.chat-msgs {
  flex: 1; overflow-y: auto; padding: 12px 14px; padding-top: 60px;
  -webkit-overflow-scrolling: touch;
}
.msg-row { display: flex; margin-bottom: 14px; align-items: flex-end; gap: 8px; }
.msg-row.me { flex-direction: row-reverse; }
.msg-avatar { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; object-fit: cover; background: var(--blue-light); }
.msg-bubble {
  max-width: 72%; padding: 10px 14px; border-radius: var(--radius); font-size: 15px; line-height: 1.45;
  word-break: break-word; position: relative;
}
.msg-row.other .msg-bubble { background: var(--card); color: var(--text); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.msg-row.me .msg-bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg-bubble img { max-width: 100%; border-radius: 8px; display: block; }
.msg-system { text-align: center; font-size: 12px; color: var(--text-light); margin: 12px 0; }
.msg-transfer-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; min-width: 180px;
  box-shadow: var(--shadow); cursor: pointer;
}
.msg-transfer-card .transfer-amt {
  padding: 14px; font-size: 20px; font-weight: 700; color: var(--blue);
}
.msg-transfer-card .transfer-st {
  padding: 8px 14px; font-size: 12px; color: var(--text-secondary); border-top: 1px solid var(--border);
}
/* 输入栏 */
.chat-input-area {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  padding-bottom: calc(8px + var(--safe-bottom)); background: var(--card); border-top: 1px solid var(--border);
}
.chat-input-wrap {
  flex: 1; background: var(--bg); border-radius: 20px; padding: 0 14px; display: flex; align-items: center;
}
.chat-input-wrap input { flex: 1; padding: 10px 0; border: none; outline: none; font-size: 15px; background: transparent; }
.chat-plus-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--blue);
  color: #fff; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-plus-btn svg { width: 20px; height: 20px; }
.chat-send-btn {
  height: 36px; padding: 0 16px; background: var(--blue); color: #fff; border: none;
  border-radius: 18px; font-size: 14px; cursor: pointer; display: none; flex-shrink: 0;
}
.chat-plus-panel {
  display: flex; gap: 24px; padding: 16px 20px; padding-bottom: calc(16px + var(--safe-bottom));
  background: var(--card); border-top: 1px solid var(--border);
}
.plus-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text); cursor: pointer;
}
.plus-item svg { width: 28px; height: 28px; color: var(--blue); }
.plus-icon-box {
  width: 48px; height: 48px; border-radius: 12px; background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--card); border-radius: var(--radius-lg); padding: 24px;
  width: 100%; max-width: 320px;
}
.modal-box h3 { font-size: 17px; font-weight: 600; margin-bottom: 16px; text-align: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions button { flex: 1; padding: 12px; border-radius: var(--radius); font-size: 15px; border: none; cursor: pointer; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); }
.modal-actions .btn-primary { background: var(--blue); color: #fff; }
.modal-actions .btn-secondary { background: var(--bg); color: var(--text); }
.modal-actions .btn-danger { background: var(--red); color: #fff; }

/* 转账弹窗 */
.transfer-modal .amount-input {
  display: flex; align-items: center; border-bottom: 2px solid var(--blue); padding: 8px 0; margin: 8px 0 6px;
}
.transfer-modal .amount-input .cur { font-size: 24px; font-weight: 700; color: var(--blue); margin-right: 4px; }
.transfer-modal .amount-input input { flex: 1; font-size: 32px; border: none; outline: none; font-weight: 700; }
.transfer-modal .bal-info { font-size: 13px; color: var(--text-secondary); }

/* ===== 钱包 ===== */
.wallet-page { position: fixed; inset: 0; z-index: 25; background: var(--bg); display: none; flex-direction: column; }
.wallet-page.active { display: flex; }
.wallet-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: 52px; }
.wallet-balance-card {
  background: linear-gradient(135deg, var(--blue) 0%, #0037B3 100%);
  margin: 16px; border-radius: var(--radius-lg); padding: 24px; color: #fff;
}
.wallet-balance-label { font-size: 13px; opacity: 0.8; }
.wallet-balance-num { font-size: 36px; font-weight: 700; margin: 8px 0 20px; }
.wallet-actions { display: flex; gap: 12px; }
.wallet-actions button {
  flex: 1; padding: 12px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1); color: #fff; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.wallet-actions button:active { background: rgba(255,255,255,0.2); }

/* 充值/提现页 */
.sub-page { position: fixed; inset: 0; z-index: 26; background: var(--bg); display: none; flex-direction: column; }
.sub-page.active { display: flex; }
.sub-content { flex: 1; overflow-y: auto; padding: 12px 16px; padding-top: 60px; }
.sub-card {
  background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.sub-card label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.sub-card .address-box {
  background: var(--bg); border-radius: 8px; padding: 12px; font-size: 12px; word-break: break-all; margin-bottom: 12px;
}
.sub-card input {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; margin-bottom: 12px;
}
.sub-card input:focus { border-color: var(--blue); }
.btn-blue {
  width: 100%; padding: 14px; background: var(--blue); color: #fff; border: none;
  border-radius: var(--radius); font-size: 15px; font-weight: 500; cursor: pointer;
}
.btn-blue:active { background: var(--blue-dark); }
.btn-outline-blue {
  width: 100%; padding: 14px; background: transparent; color: var(--blue);
  border: 1px solid var(--blue); border-radius: var(--radius); font-size: 15px; cursor: pointer;
}
.qr-img { width: 160px; height: 160px; margin: 12px auto; display: block; border-radius: 8px; }
.tip-text { font-size: 12px; color: var(--text-light); line-height: 1.7; }
.record-item {
  display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.record-item:last-child { border-bottom: none; }
.record-info { flex: 1; }
.record-amt { font-weight: 600; font-size: 15px; }
.record-amt.positive { color: var(--green); }
.record-amt.negative { color: var(--red); }
.record-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.record-status { font-size: 12px; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.78); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 14px; z-index: 99; max-width: 75%; text-align: center; pointer-events: none;
}

/* ===== 用户信息弹出层 ===== */
.user-info-modal .modal-box { text-align: center; }
.user-info-modal .avatar-lg { margin: 0 auto; }
.user-info-modal .ui-name { font-size: 18px; font-weight: 600; margin-top: 10px; }
.user-info-modal .ui-uid { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ===== 管理后台入口 ===== */
#btn-admin { display: none; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }