* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #0e1621; color: #f5f5f5;
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(142, 160, 179, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(142, 160, 179, 0.45); }
::-webkit-scrollbar-thumb:active { background: rgba(142, 160, 179, 0.6); }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
.hidden { display: none !important; }

.login-backdrop, .confirm-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 10, 16, 0.82); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.login-card, .confirm-card {
  width: 360px; background: #17212b; border: 1px solid #24303f;
  border-radius: 12px; padding: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.55);
}
.login-brand { font-size: 18px; font-weight: 700; color: #fff; }
.login-sub { font-size: 12px; color: #7e90a4; margin: 4px 0 18px; }
.field-lbl { display: block; font-size: 12px; color: #9db0c4; margin: 10px 0 5px; }
.field-inp {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 8px;
  border: 1px solid #2b394a; background: #0e1621; color: #fff; font-size: 13px; outline: none;
}
.field-inp:focus { border-color: #5288c1; }
.login-err { color: #ff6b6b; font-size: 12px; margin-top: 10px; }
.primary-btn {
  height: 38px; padding: 0 18px; border-radius: 8px; border: none;
  background: #2b5278; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.primary-btn:hover { background: #366594; }
.primary-btn.full { width: 100%; margin-top: 16px; }

.app { display: flex; width: 100%; height: 100%; }

/* 左侧会话栏 */
.conv-sidebar {
  width: 310px; flex-shrink: 0; background: #17212b;
  border-right: 1px solid #0e1621; display: flex; flex-direction: column;
}
.sb-top { padding: 12px 12px 10px; border-bottom: 1px solid #101922; }
.sb-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sb-brand { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.ws-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ws-dot.online { background: #4cd964; box-shadow: 0 0 6px #4cd964; }
.ws-dot.offline { background: #6b7b8c; }
.total-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: #e05252; color: #fff; font-weight: 700;
}
.sb-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 6px; border: none;
  background: transparent; color: #8da0b4; font-size: 15px; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.icon-btn.muted { opacity: 0.45; }
.search-inp {
  width: 100%; height: 34px; padding: 0 12px; border-radius: 17px;
  border: none; background: #242f3d; color: #eef2f7; font-size: 12px; outline: none;
}
.search-inp::placeholder { color: #6d7f92; }

.conv-list { flex: 1; overflow-y: auto; padding: 6px; }
.empty-tip { text-align: center; color: #67798b; font-size: 12px; padding: 36px 12px; }

.conv-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; cursor: pointer; transition: background .12s;
}
.conv-item:hover { background: #202b36; }
.conv-item.active { background: #2b5278; }

.conv-avatar {
  position: relative; width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #4b82b8, #2b5278); color: #fff;
  font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.presence-dot {
  position: absolute; right: 1px; bottom: 1px; width: 10px; height: 10px;
  border-radius: 50%; border: 2px solid #17212b; background: #6b7b8c;
}
.presence-dot.on { background: #4cd964; }
.conv-item.active .presence-dot { border-color: #2b5278; }

.conv-meta { flex: 1; min-width: 0; }
.conv-row1 { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.conv-name { font-size: 13px; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { font-size: 11px; color: #7e90a4; flex-shrink: 0; }
.conv-item.active .conv-time { color: #c7d9ea; }
.conv-row2 { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 3px; }
.conv-preview { font-size: 12px; color: #7e90a4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item.active .conv-preview { color: #d6e4f2; }
.conv-unread {
  flex-shrink: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #e05252; color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* 右侧聊天区 */
.chat-pane {
  flex: 1; min-width: 0; position: relative;
  background: #0e1621; display: flex; flex-direction: column;
}
.empty-stage { flex: 1; display: flex; align-items: center; justify-content: center; }
.empty-pill {
  padding: 7px 16px; border-radius: 16px; background: rgba(255,255,255,0.06);
  color: #8ea0b3; font-size: 13px;
}

.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header {
  height: 56px; padding: 0 18px; background: #17212b;
  border-bottom: 1px solid #0e1621; display: flex; align-items: center; justify-content: space-between;
}
.peer-info { display: flex; align-items: center; gap: 10px; }
.peer-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #4b82b8, #2b5278);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.peer-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.peer-uin { font-size: 12px; color: #8da0b4; font-weight: 400; }
.peer-status { font-size: 11px; color: #7e90a4; margin-top: 2px; }
.peer-status.on { color: #4cd964; }

.danger-ghost-btn {
  padding: 6px 12px; border-radius: 6px; border: 1px solid rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.08); color: #ff8080; font-size: 12px; cursor: pointer;
}
.danger-ghost-btn:hover { background: rgba(255, 107, 107, 0.2); }

.msg-stream {
  flex: 1; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 6px;
}
.date-sep {
  align-self: center; margin: 8px 0; padding: 3px 10px; border-radius: 12px;
  background: rgba(255,255,255,0.07); color: #9db0c4; font-size: 11px;
}

.msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 72%; position: relative; }
.msg-row.in { align-self: flex-start; }
.msg-row.out { align-self: flex-end; flex-direction: row-reverse; }

.bubble {
  padding: 8px 12px 6px; border-radius: 12px; font-size: 13px; line-height: 1.5;
  word-break: break-word; white-space: pre-wrap; user-select: text;
}
.msg-row.in .bubble { background: #182533; border-bottom-left-radius: 4px; }
.msg-row.out .bubble { background: #2b5278; border-bottom-right-radius: 4px; }

.bubble img.msg-img {
  display: block; max-width: 280px; max-height: 260px; border-radius: 8px; cursor: zoom-in;
  margin-bottom: 4px;
}
.file-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 4px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.22); border: 1px solid rgba(255, 255, 255, 0.08);
  color: inherit; text-decoration: none; min-width: 190px; max-width: 280px;
}
.file-card:hover { background: rgba(0, 0, 0, 0.34); border-color: #5288c1; }
.file-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: rgba(82, 136, 193, 0.22); color: #7cc0ff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.file-info { flex: 1; min-width: 0; }
.file-name {
  font-size: 12px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-meta { font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-top: 2px; }
.bubble-meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  font-size: 10px; color: rgba(255,255,255,0.55); margin-top: 3px;
}
.ticks { font-size: 11px; letter-spacing: -2px; }
.ticks.read { color: #5cc8ff; }

.msg-del-btn {
  opacity: 0; border: none; background: rgba(255,255,255,0.08); color: #ff8585;
  font-size: 11px; padding: 3px 7px; border-radius: 5px; cursor: pointer;
  transition: opacity .12s;
}
.msg-row:hover .msg-del-btn { opacity: 1; }
.msg-del-btn:hover { background: rgba(255,107,107,0.22); }

.pending-bar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: #17212b; border-top: 1px solid #101922;
}
.pending-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.pending-file-icon {
  width: 44px; height: 44px; border-radius: 6px; flex-shrink: 0;
  background: rgba(82, 136, 193, 0.22); color: #7cc0ff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.pending-name { flex: 1; font-size: 12px; color: #b8c7d9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer {
  position: relative; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 14px; background: #17212b; border-top: 1px solid #0e1621;
}
.tool-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  background: transparent; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.tool-btn:hover { background: rgba(255,255,255,0.08); }
.msg-input {
  flex: 1; min-height: 36px; max-height: 120px; padding: 8px 12px;
  border-radius: 10px; border: none; background: #242f3d; color: #fff;
  font-size: 13px; font-family: inherit; resize: none; outline: none; line-height: 1.4;
}
.send-btn {
  height: 36px; padding: 0 16px; border-radius: 8px; border: none;
  background: #2b5278; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.send-btn:hover { background: #376898; }

.emoji-popover {
  position: absolute; left: 12px; bottom: 58px; width: 336px;
  background: #1c2733; border: 1px solid #2b3a4a; border-radius: 10px;
  padding: 10px; box-shadow: 0 14px 36px rgba(0,0,0,0.5); z-index: 30;
}
.emoji-cats { display: flex; gap: 6px; margin-bottom: 8px; border-bottom: 1px solid #283544; padding-bottom: 6px; }
.emoji-cat {
  border: none; background: transparent; color: #8da0b4; font-size: 12px;
  padding: 3px 8px; border-radius: 5px; cursor: pointer;
}
.emoji-cat.active { background: #2b5278; color: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; overflow: hidden; }
.emoji-cell {
  border: none; background: transparent; width: 36px; height: 34px; padding: 0;
  font-size: 19px; line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", sans-serif;
  border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.emoji-cell:hover { background: rgba(255,255,255,0.1); }

/* 灯箱 & 确认弹窗 */
.lightbox {
  position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.lb-bar { position: absolute; top: 14px; right: 20px; display: flex; gap: 10px; }
.lb-btn {
  padding: 6px 14px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1); color: #fff; font-size: 12px; text-decoration: none; cursor: pointer;
}
.lb-img { max-width: 90vw; max-height: 85vh; border-radius: 6px; }

.confirm-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.confirm-desc { font-size: 13px; color: #9db0c4; margin-bottom: 18px; line-height: 1.5; }
.confirm-btns { display: flex; justify-content: flex-end; gap: 10px; }
.ghost-btn {
  padding: 7px 14px; border-radius: 6px; border: 1px solid #314152;
  background: transparent; color: #cbd5e1; font-size: 12px; cursor: pointer;
}
.danger-btn {
  padding: 7px 14px; border-radius: 6px; border: none;
  background: #d64545; color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
}

.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 100;
  padding: 8px 16px; border-radius: 8px; background: #1e2c3a;
  border: 1px solid #3f6791; color: #fff; font-size: 12px;
}
