:root {
  --bg: #eef1f5;
  --side: #f6f7f9;
  --panel: #ffffff;
  --line: #e3e6eb;
  --text: #1f2329;
  --muted: #7a8290;
  --accent: #07c160;
  --accent-dark: #06ad56;
  --mine: #95ec69;
  --danger: #e34d59;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}
button { font-family: inherit; cursor: pointer; }

/* ===== 登录 ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #07c160 0%, #0a8f4d 100%);
}
.auth-card {
  width: 340px;
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.auth-logo { font-size: 24px; font-weight: 700; color: var(--accent-dark); }
.auth-sub { color: var(--muted); margin: 4px 0 18px; }
.auth-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.auth-card input {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.primary, .send-btn {
  width: 100%;
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px;
  font-size: 15px;
  margin-top: 8px;
}
.primary:hover, .send-btn:hover { background: var(--accent-dark); }
.link {
  display: block;
  margin: 14px auto 0;
  border: 0;
  background: none;
  color: var(--accent-dark);
}
.auth-tip { min-height: 20px; margin-top: 12px; text-align: center; color: var(--danger); font-size: 13px; }

/* ===== 主界面 ===== */
.app { display: flex; height: 100vh; overflow: hidden; }
.side {
  width: 290px;
  flex-shrink: 0;
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.me-text { flex: 1; min-width: 0; }
.me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-uid { font-size: 12px; color: var(--muted); }
.me-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  color: var(--muted);
}
.search { display: flex; gap: 6px; padding: 10px 12px; }
.search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  outline: none;
  background: #fff;
}
.search button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0 12px;
}
.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}
.count { background: #e7eaee; border-radius: 10px; padding: 0 7px; font-size: 11px; }
.friend-list, .admin-list, .search-block ul {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  overflow-y: auto;
}
.friend-list { flex: 1; }
.friend-item, .user-item, .search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.friend-item:hover, .friend-item.active, .user-item:hover, .search-item:hover { background: #eceff3; }
.f-avatar { width: 36px; height: 36px; border-radius: 8px; background: #dde7ff; color: #3b5fc0; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.f-text { min-width: 0; flex: 1; }
.f-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-uid { font-size: 11px; color: var(--muted); }
.mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  color: var(--text);
}
.mini-btn.ok { border-color: var(--accent); color: var(--accent-dark); }
.mini-btn.bad { border-color: var(--danger); color: var(--danger); }

.chat { flex: 1; min-width: 0; background: var(--panel); display: flex; flex-direction: column; }
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.chat-title { font-weight: 600; font-size: 16px; }
.chat-uid { font-size: 12px; color: var(--muted); }
.chat-actions { display: flex; gap: 8px; }
.danger-btn { border: 1px solid var(--danger); background: none; color: var(--danger); border-radius: 8px; padding: 6px 12px; }
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty { margin: 50px auto; color: var(--muted); }
.msg {
  max-width: 72%;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
  align-items: flex-start;
  width: fit-content;
}
.msg .bubble {
  padding: 8px 12px;
  border-radius: 10px;
  background: #f4f5f7;
  word-break: break-word;
  white-space: pre-wrap;
  width: fit-content;
  max-width: 100%;
}
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble { background: var(--mine); }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg .file-card {
  display: flex;
  align-items: center;
  gap: 8px;
}
.msg .file-card a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.msg .file-meta { font-size: 11px; color: var(--muted); }

.input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}
.input-row input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
}
.file-btn { border: 0; background: none; font-size: 20px; padding: 2px; }
.send-btn { width: auto; margin: 0; padding: 8px 16px; }

/* ===== 管理员 ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.admin-panel {
  width: 620px;
  max-width: 92vw;
  max-height: 82vh;
  background: #fff;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.admin-body { padding: 8px 14px 18px; overflow-y: auto; }
.user-item .f-text { cursor: default; }
.user-status { font-size: 11px; padding: 2px 7px; border-radius: 8px; background: #f1f2f5; }
.user-status.pending { background: #fff6e5; color: #c98a00; }
.user-status.active { background: #e9f9ef; color: var(--accent-dark); }
.user-status.disabled, .user-status.rejected { background: #fdeeee; color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.78);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  z-index: 99;
}
