:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e5e9f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --visitor-bubble: #2563eb;
  --admin-bubble: #e8f5ee;
  --admin-text: #14532d;
  --danger: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font: inherit;
}

a { color: var(--primary); }

/* ---------- Landing ---------- */
.landing-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.landing-card {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -1px;
}

.landing-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -0.5px;
}

.landing-card p.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.qr-frame {
  display: inline-block;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.qr-frame img {
  display: block;
  width: 240px;
  height: 240px;
}

.qr-caption {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.landing-actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--border);
}

.btn-icon {
  min-width: 46px;
  min-height: 46px;
  padding: 0;
  background: var(--surface-soft);
  color: var(--primary);
  border-color: var(--border);
  font-weight: 700;
}

.btn-icon:hover { background: var(--primary-soft); }

.hint {
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: #1e40af;
  font-size: 13px;
  line-height: 1.6;
  text-align: left;
}

/* ---------- Chat shared ---------- */
.chat-page {
  min-height: 100vh;
  padding: 24px;
  display: flex;
  justify-content: center;
}

.chat-shell {
  width: 100%;
  max-width: 760px;
  height: calc(100vh - 48px);
  min-height: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  flex: none;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: none;
}

.avatar.admin { background: linear-gradient(135deg, #059669, #34d399); }

.chat-title h2 {
  margin: 0;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-title .meta {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status.online .status-dot { background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15); }
.status.online { color: #15803d; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
}

.msg {
  max-width: 78%;
  padding: 12px 15px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 14.5px;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.msg.visitor {
  align-self: flex-end;
  background: var(--visitor-bubble);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg.admin {
  align-self: flex-start;
  background: var(--admin-bubble);
  color: var(--admin-text);
  border-bottom-left-radius: 5px;
}

/* 后台视角：客服自己的消息靠右，访客消息靠左 */
.msg.self {
  align-self: flex-end;
  background: var(--visitor-bubble);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg.other {
  align-self: flex-start;
  background: var(--admin-bubble);
  color: var(--admin-text);
  border-bottom-left-radius: 5px;
}

/* 乐观更新：发送中气泡半透明并显示小圆点 */
.msg.pending {
  opacity: 0.62;
}
.msg.pending::after {
  content: '发送中…';
  display: block;
  font-size: 10.5px;
  opacity: 0.85;
  margin-top: 3px;
}

.msg.system {
  align-self: center;
  max-width: 90%;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  box-shadow: none;
  padding: 4px 8px 10px;
}

.msg-time {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  opacity: 0.7;
}

.msg-name {
  display: block;
  margin-bottom: 4px;
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0.2px;
}

/* 对话中我的头像：贴在气泡外侧 */
.msg-avatar {
  position: absolute;
  top: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface, #fff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  background: var(--surface);
}
/* 后台“我”的消息在右侧，头像贴右外侧；访客端客服消息在左侧，贴左外侧 */
.admin-page .msg.self { position: relative; padding-right: 42px; }
.admin-page .msg.self .msg-avatar { right: 4px; }
.chat-page .msg.admin { position: relative; padding-left: 42px; }
.chat-page .msg.admin .msg-avatar { left: 4px; }
.avatar.has-img { overflow: hidden; padding: 0; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.msg-image {
  display: block;
  max-width: 230px;
  max-height: 230px;
  width: auto;
  height: auto;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  cursor: zoom-in;
}

/* 点击图片后全屏放大查看 */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.88);
  cursor: zoom-out;
  animation: lightbox-in 0.16s ease-out;
}

.img-lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  cursor: default;
}

.img-lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 26px;
  line-height: 42px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.img-lightbox-close:hover { background: rgba(255, 255, 255, 0.32); }

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.65;
}

.composer {
  flex: none;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
}

.composer textarea {
  flex: 1;
  min-height: 46px;
  max-height: 130px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  line-height: 1.5;
  background: var(--surface-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: #fff;
}

.composer .btn {
  min-height: 46px;
  padding: 0 20px;
}

.typing-note {
  flex: none;
  padding: 0 20px 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  min-height: 18px;
}

/* ---------- Admin ---------- */
.admin-page {
  min-height: 100vh;
  padding: 20px;
}

.admin-layout {
  max-width: 1380px;
  margin: 0 auto;
  height: calc(100vh - 40px);
  min-height: 620px;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-top {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-top h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.sidebar-top .sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.qr-admin {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.qr-admin img {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  background: #fff;
  flex: none;
}

.qr-admin .qr-info {
  min-width: 0;
}

.qr-admin .qr-info strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
}

.qr-admin .qr-info a {
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.stats-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.stat {
  flex: 1;
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 10px 12px;
}

.stat b {
  display: block;
  font-size: 19px;
  color: var(--primary);
}

.stat span {
  font-size: 11.5px;
  color: #1e40af;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.session-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 13px;
  padding: 12px 13px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.session-item:hover { background: var(--surface-soft); }

.session-item.active {
  background: var(--primary-soft);
  border-color: #bfdbfe;
}

.session-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.session-name {
  font-weight: 700;
  font-size: 14px;
}

.session-time {
  font-size: 11px;
  color: var(--muted);
}

.session-preview {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.online-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  font-size: 10.5px;
  color: #15803d;
}

.online-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

.offline-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  font-size: 10.5px;
  color: #94a3b8;
}

.offline-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.admin-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.admin-main .chat-header { flex: none; }

.admin-main .messages { background: #fff; }

.admin-main .composer { flex: none; }

@media (max-width: 900px) {
  .admin-layout {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }
  .sidebar { max-height: 460px; }
  .admin-main { height: 70vh; }
}

@media (max-width: 600px) {
  .chat-page { padding: 0; }
  .chat-shell {
    height: 100vh;
    min-height: 0;
    border: none;
    border-radius: 0;
  }
  .landing-card { padding: 24px 18px; }
  .msg { max-width: 88%; }
  .admin-page { padding: 10px; }
  .admin-layout { gap: 10px; }
}

/* ---------- 权限与员工管理 ---------- */
.admin-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.admin-title-row h2 { margin: 0; }

.rename-self-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 7px 12px;
  font-size: 12.5px;
  min-height: 0;
  min-width: 0;
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #dbeafe;
}

.rename-self-btn[hidden] { display: none; }

.mute-chip {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 16px;
  color: #b91c1c;
  background: #fee2e2;
  border-radius: 6px;
  vertical-align: middle;
}

.session-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.mini-btn {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.mini-btn.danger { color: var(--danger); }
.mini-btn.danger:hover { background: #fee2e2; border-color: var(--danger); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-desc { color: var(--muted); font-size: 13px; margin: 8px 0 16px; }

.staff-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.staff-create input[type="text"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}
.staff-create input[type="text"]:focus { border-color: var(--primary); }
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.perm-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; }
.staff-create .btn { align-self: flex-start; }
.staff-note { min-height: 18px; color: var(--primary); font-size: 12px; margin: 8px 2px; }

.staff-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.staff-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.staff-card.inactive { opacity: 0.6; }
.staff-card-head { display: flex; align-items: center; justify-content: space-between; }
.staff-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
}
.staff-badge.on { background: #dcfce7; color: #166534; }
.staff-perms { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; font-size: 12px; color: var(--muted); }
.perm-tag {
  padding: 2px 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 8px;
}
.staff-link {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  background: var(--surface-soft);
  padding: 6px 8px;
  border-radius: 8px;
}
.staff-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* ===== 登录页 ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px 28px; box-shadow: var(--shadow); text-align: center; }
.login-card .brand-mark { margin: 0 auto 14px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card .subtitle { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-form { text-align: left; }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.login-form input { width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; background: var(--surface); color: var(--text); }
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-form .btn { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.login-error { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 8px; }
.login-hint { margin-top: 20px; font-size: 11px; color: var(--muted); }

/* ===== 工作台顶部工具按钮 ===== */
.admin-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.clear-chat-btn { margin-left: 10px; color: #dc2626; border-color: #fecaca; }

/* 手动在线/离线开关 */
.presence-btn { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.presence-btn.is-online { color: #15803d; background: #dcfce7; border-color: #86efac; }
.presence-btn.is-online:hover { background: #bbf7d0; }
.presence-btn.is-offline { color: #b91c1c; background: #fee2e2; border-color: #fca5a5; }
.presence-btn.is-offline:hover { background: #fecaca; }
.presence-btn:disabled { opacity: 0.6; cursor: default; }

/* ===== 语音消息 ===== */
.voice-bubble { display: flex; align-items: center; gap: 8px; max-width: 260px; }
.voice-bubble audio { height: 36px; max-width: 220px; }
.voice-duration { font-size: 11px; color: var(--muted); white-space: nowrap; }
.btn.recording { background: #dc2626; color: #fff; border-color: #dc2626; animation: rec-pulse 1s infinite; }
@keyframes rec-pulse { 50% { opacity: 0.65; } }

/* ===== 弹窗（员工管理） ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal-mask[hidden] { display: none; }
.modal-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-desc { font-size: 13px; color: var(--muted); margin: 8px 0 16px; }
.staff-info { display: grid; gap: 8px; padding: 12px; background: var(--surface-soft); border-radius: 12px; margin-bottom: 12px; }
.staff-info > div { display: flex; justify-content: space-between; font-size: 13px; }
.staff-info span { color: var(--muted); }
.staff-link-row { font-size: 12px; margin-bottom: 12px; }
.staff-link-row code { display: block; word-break: break-all; background: var(--surface-soft); padding: 8px; border-radius: 8px; margin: 6px 0; font-size: 11px; }
.perm-block { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.perm-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.perm-block label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.dialog-input { width: 100%; box-sizing: border-box; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--text); background: var(--surface); outline: none; margin-bottom: 4px; }
.dialog-input:focus { border-color: var(--primary); }
.dialog-input[hidden] { display: none; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
.field-textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; color: var(--text); background: var(--surface); outline: none; resize: vertical; line-height: 1.5; }
.field-textarea:focus { border-color: var(--primary); }
.modal-hint { font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
/* 欢迎语图片上传 */
.welcome-image-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.welcome-image-box { width: 88px; height: 66px; border: 1px dashed var(--border); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface); flex: none; }
.welcome-image-box img { width: 100%; height: 100%; object-fit: cover; }
.welcome-image-empty { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; line-height: 1.4; }
.avatar-preview-box { width: 88px; height: 88px; border-radius: 50%; }
.avatar-preview-box img { border-radius: 50%; }
.welcome-img-btn { font-size: 12px !important; padding: 7px 12px !important; }
.unread-badge { position: absolute; top: 8px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.session-item { position: relative; }
.session-item.has-unread .session-preview { color: var(--text); font-weight: 600; }
.modal-note { font-size: 12px; color: var(--primary); min-height: 16px; margin-top: 10px; }

/* ===== 视频通话浮层 ===== */
.vcall-overlay { position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0); opacity: 0; transition: background .22s ease, opacity .22s ease; pointer-events: none; }
.vcall-overlay.visible { background: rgba(15, 23, 42, .62); opacity: 1; pointer-events: auto; }
.vcall-box { width: min(720px, 94vw); background: #0f172a; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 80px rgba(0,0,0,.45); transform: translateY(12px) scale(.98); transition: transform .22s ease; display: flex; flex-direction: column; }
.vcall-overlay.visible .vcall-box { transform: translateY(0) scale(1); }
.vcall-overlay.minimized .vcall-box { width: min(280px, 80vw); }
.vcall-overlay.minimized .vcall-actions { padding: 8px; }
.vcall-overlay.minimized .vcall-stage { aspect-ratio: auto; height: 160px; }
.vcall-stage { position: relative; width: 100%; aspect-ratio: 16 / 10; background: radial-gradient(circle at 50% 35%, #1e293b, #0b1120); overflow: hidden; }
.vcall-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0b1120; }
.vcall-overlay:not(.connected) .vcall-remote { opacity: 0; }
.vcall-local { position: absolute; right: 14px; bottom: 14px; width: 26%; max-width: 180px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.35); background: #111827; box-shadow: 0 6px 20px rgba(0,0,0,.4); z-index: 3; transform: scaleX(-1); }
.vcall-topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; z-index: 4; }
.vcall-calltag { font-size: 12px; color: #e2e8f0; background: rgba(15,23,42,.55); padding: 5px 12px; border-radius: 999px; backdrop-filter: blur(6px); }
.vcall-min { width: 30px; height: 30px; border: none; border-radius: 50%; background: rgba(15,23,42,.55); color: #e2e8f0; font-size: 16px; cursor: pointer; backdrop-filter: blur(6px); }
.vcall-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 2; pointer-events: none; }
.vcall-overlay.connected .vcall-center { display: none; }
.vcall-avatar { width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-size: 32px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; box-shadow: 0 8px 30px rgba(37,99,235,.45); }
.vcall-overlay.incoming .vcall-avatar { animation: vcallPulse 1.2s ease-in-out infinite; }
@keyframes vcallPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.vcall-status { color: #f1f5f9; font-size: 17px; font-weight: 600; text-align: center; padding: 0 20px; }
.vcall-notice { color: #94a3b8; font-size: 13px; margin-top: 8px; text-align: center; padding: 0 20px; min-height: 18px; }
.vcall-timer { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); color: #e2e8f0; font-size: 13px; font-variant-numeric: tabular-nums; background: rgba(15,23,42,.55); padding: 4px 12px; border-radius: 999px; z-index: 4; backdrop-filter: blur(6px); }
.vcall-actions { display: flex; gap: 12px; justify-content: center; align-items: center; padding: 18px; background: #0f172a; }
.vcall-btn { min-width: 92px; padding: 11px 18px; border: none; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer; background: #1e293b; color: #e2e8f0; transition: filter .15s ease, transform .1s ease; }
.vcall-btn:hover { filter: brightness(1.15); }
.vcall-btn:active { transform: scale(.96); }
.vcall-btn.primary { background: #22c55e; color: #062c14; }
.vcall-btn.danger { background: #ef4444; color: #fff; }
.vcall-btn.active { background: #334155; }
.vcall-mini-btn { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
