/* ==========================================================================
   WA://CONSOLE — SaleSmartly 配色体系 · 白底蓝主色
   白面板 / 蓝色主色 / 浅蓝选中态 / 彩色圆头像 / 浅蓝气泡
   展示字: Archivo Black · 正文: IBM Plex Sans · 数据: IBM Plex Mono
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  /* 表面 */
  --color-bg: #eef1f6;          /* 浅灰蓝底（SaleSmartly 工作区底色） */
  --color-bg-deep: #f3f5f9;     /* 聊天消息区底 */
  --color-surface: #ffffff;
  --color-surface-2: #f0f4fa;   /* 悬停/次级面 */
  --color-surface-3: #e4eaf4;

  /* 文字 */
  --color-text: #23282e;
  --color-muted: #6b7684;       /* 对白底 >= 4.5:1 */
  --color-faint: #9aa4b2;

  /* 主色 = SaleSmartly 蓝 */
  --color-accent: #2362f0;
  --color-accent-strong: #1d51cc;
  --color-accent-soft: #e8f0fe; /* 选中态浅蓝 */
  --color-accent-softer: #f2f7ff;
  --color-link: #2362f0;
  --color-on-accent: #ffffff;

  /* 语义状态 */
  --sig-online: #2bbf6a;
  --sig-wait: #f59e0b;
  --sig-down: #c2c9d4;
  --sig-error: #e5484d;
  --sig-badge: #ff7d1a;         /* 未读/提醒橙 */

  --color-border: #e7eaf0;
  --color-border-strong: #d6dce6;

  /* 字体 */
  --font-display: 'Archivo Black', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'IBM Plex Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  /* 字阶 (1.25) */
  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 17.5px;
  --fs-xl: 22px;
  --fs-2xl: 28px;

  /* 间距 */
  --space-1: 4px; --space-2: 8px; --space-3: 16px;
  --space-4: 24px; --space-5: 40px; --space-6: 64px;

  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;

  --shadow-1: 0 1px 3px rgba(35, 98, 240, .06);
  --shadow-2: 0 4px 16px rgba(35, 46, 60, .08);
  --shadow-3: 0 16px 48px rgba(35, 46, 60, .16);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms; --dur-base: 320ms; --dur-slow: 640ms;

  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px var(--color-accent);
}

/* ---------- 重置与基础 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--fs-md);
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow: hidden;
}
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }

::selection { background: rgba(35, 98, 240, .18); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccd4e0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #b3bdcc; }

/* 氛围层（标记保留在 HTML，此方向不使用） */
.atmosphere, .grain { display: none; }

/* ---------- 品牌铭牌 ---------- */
.brand-mark {
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1;
  user-select: none;
}
.brand-mark.sm { font-size: var(--fs-lg); }
.brand-sep { color: var(--color-accent); }
.cursor {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-weight: 400;
  margin-left: 2px;
  animation: blink 1.2s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; font-family: var(--font-body); font-weight: 600;
  padding: 10px 18px; font-size: var(--fs-md); letter-spacing: .02em;
  transition: transform var(--dur-fast) ease-out,
              background var(--dur-fast) ease-out,
              border-color var(--dur-fast) ease-out,
              color var(--dur-fast) ease-out;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-accent {
  background: var(--color-accent); color: var(--color-on-accent);
  box-shadow: 0 2px 8px rgba(35, 98, 240, .25);
}
.btn-accent:hover { background: var(--color-accent-strong); }

.btn-ghost {
  background: var(--color-surface); color: var(--color-muted);
  border-color: var(--color-border-strong);
}
.btn-ghost:hover { color: var(--color-accent); border-color: var(--color-accent); }

.btn-sm { padding: 6px 12px; font-size: var(--fs-sm); min-height: 34px; }
.btn-block { width: 100%; }

/* ---------- 登录 ---------- */
.login-view {
  position: relative; z-index: 2;
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #dfe9fb 0%, var(--color-bg) 55%);
}
.login-card {
  width: 400px; padding: var(--space-6) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  position: relative;
  animation: rise var(--dur-slow) var(--ease-out) backwards; /* backwards：起点透明，结束回到基准可见态 */
}
/* 顶部主色条 — SaleSmartly 式强调 */
.login-card::before {
  content: ""; position: absolute; top: -1px; left: 24px; right: 24px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--color-accent), #6b9bff 70%, transparent);
}
.login-sub {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--color-muted); letter-spacing: .14em;
  margin: var(--space-3) 0 var(--space-5); line-height: 1.9;
}
.login-err { color: var(--sig-error); font-size: var(--fs-sm); min-height: 20px; margin-top: var(--space-2); }

/* ---------- 主布局 ---------- */
.app { position: relative; z-index: 2; height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.topbar-meta { display: flex; align-items: center; gap: var(--space-3); }
.topbar-tag {
  font-family: var(--font-mono); font-size: var(--fs-xs); letter-spacing: .18em;
  color: var(--color-accent); background: var(--color-accent-soft);
  border: 1px solid rgba(35, 98, 240, .25);
  padding: 4px 10px; border-radius: 20px;
}

.layout {
  flex: 1; min-height: 0;
  display: flex; gap: 0;
  padding: 0;
  background: var(--color-border);
}
.layout > .panel { border-right: 1px solid var(--color-border); }
.layout > .panel:last-child { border-right: none; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--color-surface);
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  position: relative;
}
.panel-head {
  padding: 14px var(--space-3);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.panel-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.panel-title {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: .16em; color: var(--color-muted); text-transform: uppercase;
}
.panel-foot {
  padding: 8px var(--space-3); border-top: 1px solid var(--color-border);
  font-family: var(--font-mono); font-size: var(--fs-xs);
  color: var(--color-faint); letter-spacing: .06em; flex-shrink: 0;
}
.accounts-panel { width: 264px; flex-shrink: 0; }
.chats-panel { width: 336px; flex-shrink: 0; }
.chat-panel { flex: 1; }

/* ---------- 账号栏 ---------- */
.account-list { overflow-y: auto; flex: 1; padding: var(--space-1); }
.account-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 12px var(--space-2); margin: 2px;
  border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
  min-height: 56px;
}
.account-item:hover { background: var(--color-surface-2); }
.account-item.active { background: var(--color-accent-soft); border-color: rgba(35, 98, 240, .25); }

/* 彩色圆头像 — SaleSmartly 式首字母头像，按顺序轮换色相 */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-md);
  color: #fff; background: var(--color-accent);
}
.account-item:nth-child(6n+1) .avatar { background: #2362f0; }  /* 蓝 */
.account-item:nth-child(6n+2) .avatar { background: #2bbf6a; }  /* 绿 */
.account-item:nth-child(6n+3) .avatar { background: #8b5cf6; }  /* 紫 */
.account-item:nth-child(6n+4) .avatar { background: #f59e0b; }  /* 橙 */
.account-item:nth-child(6n+5) .avatar { background: #0ea5b7; }  /* 青 */
.account-item:nth-child(6n+6) .avatar { background: #ec5f9b; }  /* 粉 */

.account-info { flex: 1; min-width: 0; }
.account-name {
  font-weight: 600; font-size: var(--fs-md); line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-sub {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs); color: var(--color-muted); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 信号灯 */
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.st-online { background: var(--sig-online); animation: pulse 2.4s ease-in-out infinite; }
.st-qr, .st-loading, .st-authenticated { background: var(--sig-wait); animation: blink 1s steps(1) infinite; }
.st-offline, .st-stopped, .st-disconnected { background: var(--sig-down); }
.st-error, .st-auth_failure { background: var(--sig-error); }
@keyframes pulse { 50% { opacity: .55; } }

.account-actions { position: absolute; right: 10px; display: none; gap: 2px; }
.account-item:hover .account-actions { display: flex; }
.icon-btn {
  border: 1px solid var(--color-border-strong); background: var(--color-surface);
  cursor: pointer; font-size: var(--fs-xs); font-family: var(--font-mono);
  border-radius: var(--radius-sm); padding: 4px 7px; color: var(--color-muted);
  min-width: 26px; min-height: 26px;
  transition: color var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
}
.icon-btn:hover { color: var(--color-accent); border-color: var(--color-accent); }

/* ---------- 会话列表 ---------- */
.search-box { padding: 10px var(--space-3); border-bottom: 1px solid var(--color-border); }
.search-box input, .field input, .field select {
  width: 100%; padding: 10px 12px; min-height: 44px;
  background: var(--color-bg-deep); color: var(--color-text);
  border: 1px solid transparent; border-radius: var(--radius-md);
  outline: none; font-size: var(--fs-md); font-family: var(--font-body);
  transition: border-color var(--dur-fast) ease-out, background var(--dur-fast) ease-out;
}
.search-box input::placeholder, .field input::placeholder, textarea::placeholder { color: var(--color-faint); }
.search-box input:focus, .field input:focus, .field select:focus {
  background: var(--color-surface); border-color: var(--color-accent);
}
input.mono, textarea.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.chat-list { flex: 1; overflow-y: auto; padding: var(--space-1); }
.chat-item {
  padding: 12px var(--space-2); margin: 2px;
  border-radius: var(--radius-md); cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
}
.chat-item:hover { background: var(--color-surface-2); }
.chat-item.active { background: var(--color-accent-soft); border-color: rgba(35, 98, 240, .25); }
.chat-item-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); margin-bottom: 3px; }
.chat-name { font-weight: 600; font-size: var(--fs-md); }
.chat-time {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs); color: var(--color-faint);
}
.chat-preview {
  font-size: var(--fs-sm); color: var(--color-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.empty-tip {
  color: var(--color-muted); text-align: center; padding: var(--space-6) var(--space-3);
  font-family: var(--font-mono); font-size: var(--fs-sm); letter-spacing: .06em; line-height: 2;
}

/* ---------- 聊天区 ---------- */
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-3);
}
.chat-empty-glyph {
  font-family: var(--font-mono); font-size: 56px; color: var(--color-surface-3);
  letter-spacing: .1em;
}
.chat-empty-text { color: var(--color-muted); text-align: center; line-height: 2; }
.chat-empty-text span {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: .2em; color: var(--color-faint);
}

.chat-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header {
  padding: 14px var(--space-4); border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.chat-title { font-weight: 700; font-size: var(--fs-lg); line-height: 1.3; }
.chat-sub { font-size: var(--fs-sm); color: var(--color-muted); }

.msg-list {
  flex: 1; overflow-y: auto; padding: var(--space-4);
  display: flex; flex-direction: column; gap: 8px;
  background: var(--color-bg-deep);
}
.msg {
  max-width: 62%; padding: 10px 14px;
  border-radius: var(--radius-md); line-height: 1.6;
  font-size: var(--fs-md); word-break: break-word; white-space: pre-wrap;
  animation: msg-in var(--dur-base) var(--ease-out);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
/* 浅蓝气泡 = 我方（SaleSmartly 式），白色气泡 = 对方 */
.msg.out {
  align-self: flex-end;
  background: #d6e6fd;
  border-bottom-right-radius: 2px;
}
.msg.in {
  align-self: flex-start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 2px;
}
.msg-meta {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 10.5px; color: var(--color-faint); margin-top: 4px; text-align: right;
}
.day-divider {
  align-self: center;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs); letter-spacing: .1em; color: var(--color-muted);
  background: var(--color-surface-2);
  padding: 3px 12px; border-radius: 20px; margin: var(--space-2) 0;
}

.chat-input-bar {
  display: flex; gap: 10px; padding: 12px var(--space-3);
  border-top: 1px solid var(--color-border); flex-shrink: 0; align-items: flex-end;
  background: var(--color-surface);
}
.chat-input-bar textarea {
  flex: 1; resize: none;
  background: var(--color-bg-deep); color: var(--color-text);
  border: 1px solid transparent; border-radius: var(--radius-md);
  padding: 11px 14px; font-size: var(--fs-md); font-family: var(--font-body);
  line-height: 1.55; outline: none; max-height: 120px; min-height: 44px;
  transition: border-color var(--dur-fast) ease-out, background var(--dur-fast) ease-out;
}
.chat-input-bar textarea:focus { background: var(--color-surface); border-color: var(--color-accent); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(35, 46, 60, .38);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in var(--dur-base) var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  width: 500px; max-height: 88vh; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-3);
  animation: modal-in var(--dur-base) var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.modal::before {
  content: ""; position: absolute; top: -1px; left: 24px; right: 24px; height: 3px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--color-accent), #6b9bff 70%, transparent);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border);
}
.modal-head h3 { font-size: var(--fs-lg); font-weight: 700; letter-spacing: .01em; }
.modal-close {
  border: 1px solid transparent; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--color-muted);
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  transition: color var(--dur-fast) ease-out, border-color var(--dur-fast) ease-out;
}
.modal-close:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.modal-body { padding: var(--space-4); overflow-y: auto; }
.modal-foot {
  padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: var(--space-3); flex: 1; min-width: 0; }
.field span {
  display: block; font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: .1em; color: var(--color-muted); margin-bottom: 6px; text-transform: uppercase;
}
.field-row { display: flex; gap: 10px; }
.field-row .field.grow { flex: 2; }
.field-group-title {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  letter-spacing: .12em; color: var(--color-accent);
  margin: var(--space-4) 0 var(--space-2);
}
.proxy-test-row { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-1) 0; min-height: 34px; }
.proxy-test-result { font-size: var(--fs-sm); color: var(--color-muted); }
.proxy-test-result.ok { color: var(--sig-online); }
.proxy-test-result.fail { color: var(--sig-error); }

/* ---------- 二维码 ---------- */
.qr-area { text-align: center; margin-top: var(--space-3); }
.qr-frame {
  display: inline-block; padding: 12px; background: #fff;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
}
.qr-area img { width: 224px; height: 224px; display: block; }
.qr-tip {
  font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--color-muted);
  margin-top: var(--space-2); line-height: 2; letter-spacing: .04em;
}

/* ---------- 入场编排：3 组错峰 ---------- */
.reveal { opacity: 0; transform: translateY(24px); }
.app > .topbar, .layout > .panel { animation: rise var(--dur-slow) var(--ease-out) backwards; }
.app > .topbar { animation-delay: 0ms; }
.layout > .panel:nth-child(1) { animation-delay: 90ms; }
.layout > .panel:nth-child(2) { animation-delay: 180ms; }
.layout > .panel:nth-child(3) { animation-delay: 270ms; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.login-card.reveal { animation: rise var(--dur-slow) var(--ease-out); }

/* ---------- 成员管理 ---------- */
.user-chip {
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--color-muted);
  background: var(--color-accent-soft); border-radius: 20px; padding: 6px 14px;
}
.users-list { display: flex; flex-direction: column; gap: 2px; }
.user-item {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 10px var(--space-2); border-radius: var(--radius-md);
  border: 1px solid transparent;
}
.user-item:hover { background: var(--color-surface-2); border-color: var(--color-border); }
.user-item-info { display: flex; flex-direction: column; min-width: 0; }
.user-item-name { font-weight: 600; font-size: var(--fs-md); }
.user-item-sub { font-size: var(--fs-xs); color: var(--color-muted); }
.user-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.user-item .icon-btn { min-height: 30px; }

/* ---------- 会话筛选标签 ---------- */
.chat-tabs {
  display: flex; gap: 4px; padding: 6px var(--space-2);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto; flex-shrink: 0;
}
.chat-tab {
  border: none; background: transparent;
  padding: 5px 10px; border-radius: 14px;
  font-size: var(--fs-sm); color: var(--color-muted);
  cursor: pointer; white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}
.chat-tab:hover { background: var(--color-surface-2); }
.chat-tab.active { background: var(--color-accent); color: #fff; }
.tab-count { font-size: var(--fs-xs); opacity: .75; margin-left: 2px; }

/* 未读徽章 */
.chat-top-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.unread-badge {
  background: var(--color-accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1;
  padding: 4px 7px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.chat-tag {
  display: inline-block; font-size: 10px; line-height: 1;
  color: var(--color-accent); background: var(--color-accent-soft);
  border-radius: 4px; padding: 3px 4px; margin-right: 5px;
  vertical-align: 1px;
}
.preview-me { color: var(--color-muted); }

/* ---------- 输入区工具与附件 ---------- */
.icon-tool {
  width: 36px; height: 36px; flex-shrink: 0;
  border: none; background: transparent; border-radius: var(--radius-md);
  font-size: 18px; cursor: pointer;
  transition: background 120ms ease;
}
.icon-tool:hover { background: var(--color-surface-2); }
.icon-tool:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.media-preview {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 var(--space-3) 6px;
  padding: 8px 12px;
  background: var(--color-accent-soft);
  border: 1px solid rgba(35, 98, 240, .25);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm); color: var(--color-text);
}
.media-preview.hidden { display: none; }
.media-preview-cancel {
  border: none; background: transparent; cursor: pointer;
  font-size: 18px; color: var(--color-muted); line-height: 1;
  padding: 0 2px;
}
.media-preview-cancel:hover { color: var(--color-text); }
.emoji-pop {
  position: absolute; bottom: 64px; left: 16px;
  width: 344px; padding: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  z-index: 30;
}
.emoji-pop.hidden { display: none; }
.emoji-tabs {
  display: flex; gap: 2px;
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}
.emoji-tab {
  border: none; background: transparent;
  font-size: 17px; line-height: 1;
  padding: 5px 7px; border-radius: 6px; cursor: pointer;
  opacity: 0.55; flex-shrink: 0;
}
.emoji-tab:hover { opacity: 1; background: var(--color-surface-2); }
.emoji-tab.active {
  opacity: 1;
  background: var(--color-primary-weak, #e8f0fe);
}
.emoji-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px;
  max-height: 240px; overflow-y: auto;
  overscroll-behavior: contain;
}
.emoji-item {
  border: none; background: transparent; font-size: 21px;
  padding: 4px; border-radius: 6px; cursor: pointer; line-height: 1.2;
}
.emoji-item:hover { background: var(--color-surface-2); }

/* ---------- 客户资料面板 ---------- */
.customer-panel { width: 300px; flex-shrink: 0; }
.customer-body { flex: 1; overflow-y: auto; padding: var(--space-3); }
.customer-empty { color: var(--color-faint); font-size: var(--fs-sm); text-align: center; padding: 40px 12px; }
.customer-head { display: flex; align-items: center; gap: 12px; padding: 6px 2px 14px; border-bottom: 1px solid var(--color-border); }
.avatar-lg { width: 48px; height: 48px; font-size: 20px; }
.customer-head-info { min-width: 0; }
.customer-name { font-weight: 700; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-tags { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.pill { font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 10px; }
.pill-blue { background: var(--color-accent-soft); color: var(--color-accent); }
.pill-green { background: #e6f7ec; color: #1d8a4e; }
.pill-orange { background: #fdf0e3; color: #c77700; }
.customer-section { padding: 14px 2px; border-bottom: 1px solid var(--color-border); }
.customer-section-title { font-size: var(--fs-xs); color: var(--color-muted); margin-bottom: 10px; font-weight: 600; }
.info-row { display: flex; justify-content: space-between; gap: var(--space-2); padding: 4px 0; font-size: var(--fs-sm); }
.info-label { color: var(--color-muted); flex-shrink: 0; }
.info-value { color: var(--color-text); text-align: right; overflow: hidden; text-overflow: ellipsis; }
.note-input {
  width: 100%; min-height: 88px; resize: vertical;
  padding: 10px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); font-size: var(--fs-sm);
  font-family: inherit; line-height: 1.6; background: var(--color-surface);
  color: var(--color-text);
}
.note-input:focus { outline: none; border-color: var(--color-accent); }
.note-save { margin-top: 8px; }

/* ---------- 密码可见性切换（小眼睛） ---------- */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  width: 100%;
  padding-right: 42px;
}
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--color-faint);
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
}
.pw-eye:hover {
  color: var(--color-accent);
  background: var(--color-accent-soft);
}
.pw-eye:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.pw-eye .ic-eye-off { display: none; }
.pw-eye.showing .ic-eye { display: none; }
.pw-eye.showing .ic-eye-off { display: block; }

/* ---------- 聊天记录媒体消息（永久存档展示） ---------- */
.msg-image {
  max-width: 240px; max-height: 260px;
  border-radius: 8px; display: block;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.msg-out .msg-image { border-color: rgba(255, 255, 255, 0.25); }
.msg-video {
  max-width: 260px; border-radius: 8px; display: block;
  background: #000;
}
.msg-file {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--color-accent); text-decoration: none;
  font-size: var(--fs-sm); font-weight: 500;
}
.msg-file:hover { text-decoration: underline; }
.msg-caption { margin-top: 4px; font-size: var(--fs-sm); }

/* ---------- 降级动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .app > .topbar, .layout > .panel { opacity: 1; transform: none; }
}

/* ---------- 响应式：768 / 375 ---------- */
@media (max-width: 900px) {
  .accounts-panel { width: 200px; }
  .chats-panel { width: 260px; }
  .customer-panel { display: none; }
}

/* 聊天返回按钮：桌面隐藏，手机显示 */
.chat-back {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  margin-right: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  padding: 0 0 3px;
}
.chat-back:hover { background: var(--color-surface-2); }
.chat-back:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

/* ---------- 手机端：单页导航（账号 → 会话 → 聊天） ---------- */
@media (max-width: 680px) {
  html, body { height: 100%; overflow: hidden; }
  .app { height: 100vh; height: 100dvh; min-height: 0; }
  .layout { flex-direction: row; overflow: hidden; }
  .layout > .panel { border-right: none; }

  /* 默认只显示一个面板 */
  .accounts-panel, .chats-panel, .chat-panel { display: none; width: 100%; flex: 1 1 100%; }
  body.m-accounts .accounts-panel { display: flex; }
  body.m-chats .chats-panel { display: flex; }
  body.m-chat .chat-panel { display: flex; }

  .account-list, .chat-list { max-height: none; flex: 1; }
  .panel-foot { display: none; }

  /* 聊天页：返回按钮 + 可读字号 */
  .chat-back { display: flex; }
  .chat-header { display: flex; align-items: center; padding: 12px var(--space-3); }
  .chat-panel { min-height: 0; }
  .msg { max-width: 86%; }
  .msg-list { padding: var(--space-3) var(--space-2); }
  .chat-input-bar { padding: 10px var(--space-2); }
  .chat-input-bar textarea { font-size: 16px; } /* 防 iOS 聚焦自动放大 */
  .chat-input-bar .btn { padding: 10px 12px; }
  .emoji-pop { bottom: 58px; left: 8px; width: min(320px, calc(100vw - 16px)); }
  .emoji-grid { max-height: 200px; }
  .customer-panel { display: none; }

  /* 顶栏精简 */
  .brand-mark { font-size: var(--fs-lg); }
  .topbar-tag, .topbar-sub { display: none; }
  .topbar { padding: 10px var(--space-3); flex-wrap: nowrap; }
  .topbar-meta { gap: 8px; }
  .user-chip { display: none; }

  /* 弹窗全屏化，避免手机上下留白 */
  .modal { width: 100%; max-width: none; max-height: 100%; border-radius: 0; height: 100%; }
  .modal-mask { padding: 0; align-items: stretch; }
  .modal-body { max-height: none; flex: 1; overflow-y: auto; }
  .field input, .field select { font-size: 16px; }
  .login-card { width: 100%; max-width: 360px; }
}
