/* ============================================================
   美多多 — 微信风格布局，保留美多多蓝配色
   ============================================================ */

:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --border: #e6e8f1;
  --border-strong: #d6d9e6;
  --text: #14162b;
  --text-soft: #4a5068;
  --muted: #7b819b;
  --primary: #5b5bd6;
  --primary-dark: #4747c2;
  --primary-soft: #eeeefc;
  --online: #22c55e;
  --danger: #ef4444;
  --radius: 16px;
  --rail-w: 62px;
  --list-w: 300px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 43, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(20, 22, 43, 0.14);
  --shadow-lg: 0 24px 60px -20px rgba(20, 22, 43, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #d3d6e3;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #b9bdd0;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================================================
   登录 / 注册
   ============================================================ */

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 500px at 12% -10%, #e6e6ff 0%, transparent 60%),
    radial-gradient(800px 500px at 95% 110%, #e4f2ff 0%, transparent 55%),
    var(--bg);
}

.auth-panel {
  width: min(1020px, 100%);
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-hero {
  position: relative;
  padding: 46px 44px;
  color: #fff;
  background: linear-gradient(155deg, #6b64e8 0%, #4f46c9 48%, #312a86 100%);
  overflow: hidden;
}

.auth-hero::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -170px;
  top: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
}

.auth-hero::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  left: -120px;
  bottom: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 220, 255, 0.24), transparent 70%);
}

.hero-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12.5px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(6px);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.auth-hero h1 {
  position: relative;
  margin: 22px 0 12px;
  font-size: 33px;
  line-height: 1.28;
  letter-spacing: -0.6px;
  font-weight: 700;
}

.hero-sub {
  position: relative;
  margin: 0 0 30px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 330px;
}

.hero-list {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.hero-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  transition: background 0.2s;
}

.hero-list li:hover {
  background: rgba(255, 255, 255, 0.07);
}

.hero-icon {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-icon svg {
  width: 17px;
  height: 17px;
}

.hero-list strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.hero-list span:not(.hero-icon) {
  display: block;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.66);
  line-height: 1.45;
}

/* --- form side --- */

.auth-card {
  padding: 46px 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* 手机端极简登录：只留品牌 + 账号密码 */
.auth-mini-brand {
  display: none;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

.auth-tabs {
  display: inline-flex;
  padding: 4px;
  background: #f2f3f9;
  border-radius: 12px;
  margin-bottom: 26px;
  width: fit-content;
}

.auth-tab {
  padding: 7px 22px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.18s;
}

.auth-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.field input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(91, 91, 214, 0.12);
}

.field input::placeholder {
  color: #a9aec3;
}

.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background 0.16s, transform 0.1s, box-shadow 0.16s;
  box-shadow: 0 6px 16px -6px rgba(91, 91, 214, 0.7);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  margin: 4px 0 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 12.5px;
}

.auth-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-error.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.auth-foot {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
}

.auth-foot strong {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   主界面骨架：左导航栏 + 列表栏 + 聊天区
   ============================================================ */

.app {
  /* 用 fixed + inset 贴合真实可视区域：
     部分国产浏览器（如 360）把 100vh 算成屏幕高度而非窗口高度，
     会导致主界面比窗口高出很多、聊天输入框落到看不见的位置 */
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--rail-w) var(--list-w) 1fr;
  overflow: hidden;
}

/* --- 左侧图标栏 --- */

.rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  background: #2e2e48;
  padding: 14px 0 12px;
}

.rail-top,
.rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.rail-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.62);
  transition: background 0.16s, color 0.16s;
}

.rail-btn svg {
  width: 21px;
  height: 21px;
}

.rail-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.rail-btn.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.rail-btn.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 99px;
  background: #8f8ff0;
}

.rail-btn.danger:hover {
  color: #ff8f8f;
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid #2e2e48;
}

/* --- 中间列表栏 --- */

.listpane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.list-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.seat-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: #f2f3f9;
  padding: 3px 9px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.tab-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* --- 会话列表（消息 tab） --- */

.conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 10px;
}

.conv {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background 0.14s;
  position: relative;
}

.conv:hover {
  background: #f5f6fb;
}

.conv.active {
  background: var(--primary-soft);
}

.conv .avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 16px;
}

.conv-body {
  flex: 1;
  min-width: 0;
}

.conv-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.conv-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-time {
  flex: none;
  font-size: 11px;
  color: #adb2c6;
  font-variant-numeric: tabular-nums;
}

.conv-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.conv-preview {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-empty-hint {
  color: #b6bbce;
}

/* --- 通讯录 / 我：微信式 cell --- */

.cell-group {
  margin: 12px 12px 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}

.cell {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s;
  position: relative;
}

.cell + .cell {
  border-top: 1px solid var(--border);
}

.cell:hover {
  background: #f5f6fb;
}

.cell-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.cell-icon svg {
  width: 17px;
  height: 17px;
}

.cell-main {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-badge {
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.cell-badge.danger {
  background: var(--danger);
}

.cell-arrow {
  flex: none;
  color: #c3c7d9;
  font-size: 18px;
  line-height: 1;
  margin-left: 2px;
}

.cell.danger .cell-main,
.cell.danger .cell-icon {
  color: var(--danger);
}

.cell.danger .cell-icon {
  background: #fef2f2;
}

/* 开关（提示音） */

.switch {
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: #d9dcea;
  position: relative;
  transition: background 0.18s;
}

.switch i {
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(20, 22, 43, 0.25);
  transition: transform 0.18s;
}

.switch.on {
  background: var(--primary);
}

.switch.on i {
  transform: translateX(18px);
}

/* --- 我 tab --- */

.me-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 14px 6px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.avatar-xl {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 22px;
}

.me-meta {
  min-width: 0;
}

.me-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.me-status {
  font-size: 12px;
  color: var(--online);
  margin-top: 2px;
}

.me-note {
  margin: 18px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #b6bbce;
}

/* --- 成员列表（通讯录） --- */

.side-label {
  padding: 14px 22px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #9aa0b6;
}

.contact-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 12px;
}

.member {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.member:hover {
  background: #f5f6fb;
}

.member.active {
  background: var(--primary-soft);
}

.member-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-body {
  flex: 1;
  min-width: 0;
}

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  position: relative;
  user-select: none;
}

.avatar-lg {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  font-size: 24px;
}

.presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  background: #c3c8d8;
}

.presence.on {
  background: var(--online);
}

.unread-badge {
  flex: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.file-empty {
  padding: 16px 10px;
  text-align: center;
  font-size: 12.5px;
  color: #a9aec3;
}

/* --- 共享文件（弹层内） --- */

.files-body {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.upload-trigger {
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px dashed var(--border-strong);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.16s;
}

.upload-trigger svg {
  width: 14px;
  height: 14px;
}

.upload-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.file-list {
  display: grid;
  gap: 2px;
  align-content: start;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 10px;
  transition: background 0.15s;
}

.file-item:hover {
  background: #f5f6fb;
}

.file-ext {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  text-transform: uppercase;
}

.file-meta {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-sub {
  font-size: 11px;
  color: var(--muted);
}

.file-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.file-item:hover .file-actions {
  opacity: 1;
}

.mini-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.14s, color 0.14s;
}

.mini-btn:hover {
  background: #eef0f8;
  color: var(--primary);
}

.mini-btn.danger:hover {
  background: #fef2f2;
  color: var(--danger);
}

.mini-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: #eceef7;
  color: var(--danger);
}

/* ============================================================
   聊天区
   ============================================================ */

.chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface-2);
}

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--muted);
}

.empty-illustration {
  width: 132px;
  height: 132px;
  color: #c8cce0;
  margin-bottom: 16px;
}

.empty-illustration svg {
  width: 100%;
  height: 100%;
}

.chat-empty h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
  color: var(--text-soft);
  letter-spacing: -0.2px;
}

.chat-empty p {
  margin: 0;
  font-size: 13px;
  max-width: 300px;
}

.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.chat-back {
  display: none;
  flex: none;
  width: 34px;
  height: 34px;
  margin-left: -6px;
  border-radius: 10px;
  place-items: center;
  color: var(--text-soft);
}

.chat-back svg {
  width: 20px;
  height: 20px;
}

.chat-back:active {
  background: #f0f1f8;
}

.peer-meta {
  flex: 1;
  min-width: 0;
}

.peer-name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.1px;
}

.peer-state {
  font-size: 11.5px;
  color: var(--muted);
}

.peer-state.on {
  color: var(--online);
}

.call-actions {
  display: flex;
  gap: 6px;
}

.call-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  transition: all 0.16s;
}

.call-btn svg {
  width: 17px;
  height: 17px;
}

.call-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.call-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.call-btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.clear-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}

.clear-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-divider {
  align-self: center;
  font-size: 11px;
  color: #a9aec3;
  background: #eef0f8;
  padding: 3px 12px;
  border-radius: 99px;
  margin: 14px 0 10px;
}

/* 未接来电等系统提示：居中一条小灰条 */
.msg-sys {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}

.sys-chip {
  padding: 4px 12px;
  border-radius: 99px;
  background: #eef0f8;
  color: #8b90a6;
  font-size: 11.5px;
  letter-spacing: 0.2px;
}

.msg {
  display: flex;
  margin-bottom: 5px;
  animation: msgIn 0.22s ease-out;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg.me {
  justify-content: flex-end;
}

.bubble {
  max-width: min(66%, 560px);
  padding: 9px 13px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.6;
}

.msg.me .bubble {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  border-bottom-right-radius: 5px;
}

.msg.them .bubble {
  border-bottom-left-radius: 5px;
}

.msg-time {
  align-self: flex-end;
  font-size: 10.5px;
  color: #b3b8ca;
  margin: 0 6px 2px;
  flex: none;
}

.msg-del {
  align-self: flex-end;
  margin: 0 0 2px;
  flex: none;
  border: none;
  background: none;
  padding: 2px 4px;
  font-size: 10.5px;
  color: #b3b8ca;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.msg:hover .msg-del,
.msg-del:focus-visible {
  opacity: 1;
}

.msg-del:hover {
  color: #e5484d;
}

@media (hover: none) {
  .msg-del {
    opacity: 0.55;
  }
}

.file-bubble {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  min-width: 230px;
}

.file-bubble .file-ext {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 34px;
  height: 34px;
}

.msg.them .file-bubble .file-ext {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.file-bubble .file-name {
  color: inherit;
  font-size: 13px;
}

.msg.me .file-bubble .file-sub {
  color: rgba(255, 255, 255, 0.72);
}

.dl-btn {
  flex: none;
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
  transition: background 0.15s;
}

.msg.them .dl-btn {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.dl-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.msg.them .dl-btn:hover {
  background: #e2e2fa;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.attach-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  transition: all 0.16s;
}

.attach-btn svg {
  width: 17px;
  height: 17px;
}

.attach-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

#msgInput {
  flex: 1;
  min-height: 40px;
  max-height: 132px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

#msgInput:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(91, 91, 214, 0.1);
}

.send-btn {
  flex: none;
  height: 40px;
  padding: 0 20px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.16s, transform 0.1s;
}

.send-btn:hover {
  background: var(--primary-dark);
}

.send-btn:active {
  transform: translateY(1px);
}

/* ============================================================
   通话
   ============================================================ */

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 600px at 50% -10%, #262a52 0%, transparent 62%),
    radial-gradient(700px 500px at 90% 110%, #1c2b4a 0%, transparent 60%),
    #0a0b14;
  color: #fff;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.call-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 22px 24px 8px;
}

.call-peer-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.call-timer {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
  padding: 2px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.call-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 8px 24px 0;
  border-radius: 22px;
  overflow: hidden;
  background: #10131f;
  display: grid;
  place-items: center;
}

.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #10131f;
  opacity: 0;
  transition: opacity 0.35s;
}

.remote-video.live {
  opacity: 1;
}

.local-video {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 168px;
  height: 116px;
  border-radius: 14px;
  object-fit: cover;
  background: #1a1e2e;
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 3;
  transform: scaleX(-1);
}

.call-status {
  position: absolute;
  z-index: 2;
  padding: 8px 18px;
  border-radius: 99px;
  background: rgba(12, 14, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.call-status:empty {
  display: none;
}

.voice-face {
  display: grid;
  place-items: center;
  gap: 22px;
  z-index: 1;
}

.voice-avatar {
  width: 108px;
  height: 108px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  font-size: 38px;
  font-weight: 700;
  background: linear-gradient(145deg, #6b64e8, #3f379f);
  box-shadow: 0 20px 50px -12px rgba(91, 91, 214, 0.8);
}

.voice-ring {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
}

.voice-ring i {
  display: block;
  width: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.5);
  animation: wave 1.15s ease-in-out infinite;
}

.voice-ring i:nth-child(1) {
  height: 9px;
  animation-delay: 0s;
}
.voice-ring i:nth-child(2) {
  height: 22px;
  animation-delay: 0.16s;
}
.voice-ring i:nth-child(3) {
  height: 13px;
  animation-delay: 0.32s;
}

@keyframes wave {
  0%,
  100% {
    transform: scaleY(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.call-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px 24px 30px;
}

.ctl-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  transition: all 0.18s;
  backdrop-filter: blur(8px);
}

.ctl-btn svg {
  width: 21px;
  height: 21px;
}

.ctl-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.ctl-btn.off {
  background: rgba(255, 255, 255, 0.92);
  color: #14162b;
  border-color: transparent;
}

.ctl-btn.ctl-danger {
  background: var(--danger);
  border-color: var(--danger);
  width: 62px;
  height: 62px;
  box-shadow: 0 12px 30px -9px rgba(239, 68, 68, 0.9);
}

.ctl-btn.ctl-danger:hover {
  background: #dc2626;
}

.ctl-btn.ctl-danger svg {
  transform: rotate(135deg);
}

/* ============================================================
   来电弹窗
   ============================================================ */

.incoming {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  background: rgba(10, 11, 20, 0.55);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.2s ease-out;
}

.incoming-card {
  width: min(330px, 90vw);
  padding: 30px 26px 24px;
  border-radius: 24px;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.incoming-card .avatar {
  margin: 0 auto 14px;
  animation: ring 1.9s ease-in-out infinite;
}

@keyframes ring {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(91, 91, 214, 0.35);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(91, 91, 214, 0);
  }
}

.incoming-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.2px;
}

.incoming-sub {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}

.incoming-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.btn-reject,
.btn-accept {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.16s;
}

.btn-reject {
  background: #f4f5fa;
  color: var(--text-soft);
}

.btn-reject:hover {
  background: #eceef7;
}

.btn-accept {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(91, 91, 214, 0.9);
}

.btn-accept:hover {
  background: var(--primary-dark);
}

/* ============================================================
   成员审核 / 共享文件 弹层
   ============================================================ */

.review-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 20, 38, 0.42);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.review-card {
  width: 100%;
  max-width: 420px;
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.review-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.review-head h3 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 680;
}

.review-head p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.review-head .icon-btn {
  margin-left: auto;
}

.review-body {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin: 16px 0 6px;
  padding-top: 14px;
  border-top: 1px dashed #e3e5f0;
}

.admin-row .who-sub {
  font-size: 11.5px;
  color: #a9aec3;
  margin-top: 2px;
}

.admin-row .tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: #8a8fb0;
  background: #f0f1f8;
  padding: 1px 7px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: 1px;
}

.admin-row .tag.hide {
  color: #b7791f;
  background: #fdf3e2;
}

.review-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.review-row .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

.review-row .who {
  flex: 1;
  min-width: 0;
}

.review-row .who-name {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.review-row .who-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.review-row .row-actions {
  display: flex;
  gap: 6px;
}

.rv-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text-soft);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 640;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
  transition: all 0.15s;
}

/* ============================================================
   手机端底部标签栏
   ============================================================ */

.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(3, 1fr);
}

.tab-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #9aa0b6;
  font-size: 10.5px;
  transition: color 0.16s;
}

.tab-btn svg {
  width: 23px;
  height: 23px;
}

.tab-btn.active {
  color: var(--primary);
}

.tab-btn .nav-badge {
  top: 2px;
  right: calc(50% - 26px);
  border-color: #fff;
}

/* ============================================================
   新消息横幅
   ============================================================ */

.msg-banner {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 210;
  width: min(430px, calc(100% - 20px));
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(91, 91, 214, 0.16);
  box-shadow: 0 16px 40px -14px rgba(20, 22, 43, 0.42);
  backdrop-filter: blur(10px);
  cursor: pointer;
  animation: bannerIn 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}

.msg-banner.out {
  opacity: 0;
  transform: translateX(-50%) translateY(-14px);
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.msg-banner .avatar {
  width: 38px;
  height: 38px;
  font-size: 14px;
  border-radius: 12px;
}

.banner-main {
  flex: 1;
  min-width: 0;
}

.banner-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-text {
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.banner-close {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f2f3f9;
}

.banner-close svg {
  width: 13px;
  height: 13px;
}

/* ============================================================
   Toast
   ============================================================ */

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 8px;
  pointer-events: none;
  transition: top 0.2s;
}

/* 有消息横幅时，普通提示往下让位 */
body.has-banner .toast-wrap {
  top: 78px;
}

.toast {
  padding: 10px 18px;
  border-radius: 11px;
  background: rgba(20, 22, 43, 0.94);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(8px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   响应式（手机端）
   ============================================================ */

@media (max-width: 860px) {
  .auth-view {
    padding: 20px 16px;
  }

  .auth-panel {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  /* 手机上不再显示上方蓝色介绍区，登录页只留账号密码 */
  .auth-hero {
    display: none;
  }

  .auth-mini-brand {
    display: flex;
    margin-bottom: 20px;
  }

  .auth-card {
    padding: 30px 24px 28px;
  }

  /* --- 主界面改为单栏 + 底部标签 --- */
  .app {
    display: block;
    /* 高度由 position: fixed + inset: 0 决定，不再依赖 vh，避免部分浏览器算错 */
  }

  .rail {
    display: none;
  }

  .tabbar {
    display: grid;
  }

  .listpane {
    height: 100%;
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    border-right: none;
  }

  /* 聊天区：全屏覆盖层，点返回回到列表 */
  .chat {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: var(--surface-2);
  }

  body.chat-open .chat {
    display: flex;
  }

  body.chat-open .listpane {
    visibility: hidden;
  }

  .chat-back {
    display: grid;
  }

  .chat-empty {
    display: none;
  }

  .chat-head {
    padding: 10px 14px;
  }

  .messages {
    padding: 16px 14px 8px;
  }

  .bubble {
    max-width: 80%;
  }

  .local-video {
    width: 108px;
    height: 76px;
    right: 12px;
    bottom: 12px;
  }

  .call-stage {
    margin: 8px 12px 0;
    border-radius: 16px;
  }

  .conv {
    padding: 12px 14px;
  }

  .cell-group {
    margin: 12px 12px 4px;
  }

  .review-modal,
  .files-modal {
    padding: 14px;
  }

  .review-card {
    max-height: 88vh;
  }
}

/* --- 小屏手机：登录页铺满整屏 --- */
@media (max-width: 560px) {
  .auth-view {
    padding: 0;
    display: block;
    background: var(--surface);
  }

  .auth-panel {
    min-height: 100vh;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    animation: none;
  }

  .auth-card {
    flex: 1;
    padding: calc(env(safe-area-inset-top, 0px) + 52px) 22px 26px;
    justify-content: flex-start;
  }

  .auth-mini-brand {
    margin-bottom: 26px;
    font-size: 18px;
  }

  .auth-tabs {
    width: 100%;
    margin-bottom: 22px;
  }

  .auth-tab {
    flex: 1;
    padding: 8px 0;
    text-align: center;
  }

  .field {
    margin-bottom: 14px;
  }

  .field > span {
    font-size: 13px;
  }

  /* 16px 以上可避免 iOS 聚焦输入框时自动放大页面 */
  .field input {
    font-size: 16px;
    padding: 13px 14px;
  }

  .btn-primary {
    padding: 14px;
    font-size: 15.5px;
    margin-top: 10px;
  }

  .auth-foot {
    margin-top: auto;
    padding-top: 16px;
  }

  .messages {
    padding: 14px 12px 6px;
  }

  .bubble {
    max-width: 84%;
  }
}
