/* 抖音私信坐席工作台 —— 仿抖音网页版私信 (白底 + #fe2c55 红主题) */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --red: #fe2c55;
  --red-soft: #fff0f3;
  --dark: #161823;
  --bg: #f5f5f7;
  --line: #ececec;
}
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--dark);
  height: 100vh;
  overflow: hidden;
}
#root { height: 100%; }
button { font-family: inherit; }

/* ============ 登录/注册页 ============ */
.auth-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fe2c55 0%, #ff6b88 100%);
}
.auth-card {
  width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.auth-card h1 { font-size: 22px; margin-bottom: 4px; color: var(--dark); }
.auth-card .sub { font-size: 13px; color: #888; margin-bottom: 22px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 9px 0; border: none; border-radius: 8px;
  background: #f0f0f2; color: #555; font-size: 14px; cursor: pointer;
}
.auth-tabs button.active { background: var(--red); color: #fff; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: #888; margin-bottom: 5px; }
.field input {
  width: 100%; padding: 11px 12px; border: 1px solid #e2e2e6;
  border-radius: 8px; font-size: 14px; outline: none;
}
.field input:focus { border-color: var(--red); }
.btn-primary {
  width: 100%; padding: 12px 0; border: none; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 15px; cursor: pointer; margin-top: 6px;
}
.btn-primary:disabled { background: #f5b5c2; cursor: not-allowed; }
.auth-err { color: var(--red); font-size: 13px; margin-top: 12px; min-height: 18px; }
.cfg-row { display: flex; gap: 8px; margin-top: 18px; }
.cfg-row .field { flex: 1; margin: 0; }
.cfg-row input { font-size: 12px; padding: 7px 8px; }

/* ============ 主界面布局 ============ */
.app { display: flex; height: 100%; }

/* 左侧账号导轨 */
.rail {
  width: 66px; background: var(--dark);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 12px; overflow-y: auto;
}
.rail .logo { color: var(--red); font-weight: bold; font-size: 11px; text-align: center; line-height: 1.2; margin-bottom: 6px; }
.rail .acc {
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; object-fit: cover; background: #333;
  position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px;
}
.rail .acc.active { border-color: var(--red); }
.rail .acc.all { background: #2f2f37; }
.rail .acc .rdot { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--dark); }
.rail .add {
  width: 46px; height: 46px; border-radius: 50%; background: #2f2f37; color: var(--red);
  font-size: 26px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-top: auto; flex-shrink: 0;
}
.rail .logout { color: #888; font-size: 10px; cursor: pointer; padding: 4px; }

/* 会话列表 */
.list { width: 320px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.list .lhd { padding: 14px 16px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.list .lhd .reload { margin-left: auto; font-size: 12px; color: var(--red); cursor: pointer; background: none; border: none; }
.list .conv-scroll { flex: 1; overflow-y: auto; }
.conv { display: flex; align-items: center; gap: 11px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f6f6f6; }
.conv:hover { background: #f7f7f8; }
.conv.active { background: var(--red-soft); }
.conv > img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.conv .meta { flex: 1; min-width: 0; }
.conv .meta .top { display: flex; align-items: center; gap: 5px; }
.conv .meta .nick { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .meta .preview { font-size: 12px; color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.conv .right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.conv .badge { background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 6px; min-width: 18px; text-align: center; }
.tag { font-size: 10px; border-radius: 4px; padding: 0 4px; line-height: 16px; white-space: nowrap; }
.tag.acc { color: var(--red); background: var(--red-soft); }
.tag.group { color: #fff; background: #9b59b6; }
.tag.stranger { color: #fff; background: #ff9500; }
.tag.relation { color: #fff; background: #19c37d; }

/* 聊天区 */
.chat { flex: 1; display: flex; flex-direction: column; background: var(--bg); min-width: 0; }
.chat .hd { padding: 15px 20px; background: #fff; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.chat .empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #bbb; font-size: 14px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; align-items: flex-start; gap: 9px; max-width: 72%; }
.msg.self { align-self: flex-end; flex-direction: row-reverse; }
.msg > img { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; background: #ddd; object-fit: cover; }
.bub { padding: 9px 13px; border-radius: 10px; font-size: 14px; line-height: 1.5; word-break: break-word; background: #fff; white-space: pre-wrap; }
.msg.self .bub { background: var(--red); color: #fff; }
.bub.bimg { padding: 3px; }
.bub.bimg img { max-width: 200px; max-height: 220px; border-radius: 7px; display: block; }
.bub.placeholder { color: #999; font-style: italic; background: #fafafa; border: 1px dashed #ddd; }
.msg.self .bub.placeholder { color: #ffe0e8; background: #ff5a7a; border-color: #ff8aa2; }
.sysmsg { align-self: center; font-size: 12px; color: #999; background: var(--line); border-radius: 10px; padding: 4px 12px; max-width: 80%; text-align: center; }

/* 输入框 */
.input { padding: 12px 16px; background: #fff; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.input textarea { flex: 1; resize: none; border: 1px solid #e2e2e6; border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; height: 42px; max-height: 120px; font-family: inherit; }
.input textarea:focus { border-color: var(--red); }
.input button { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 0 24px; font-size: 14px; cursor: pointer; }
.input button:disabled { background: #f5b5c2; cursor: not-allowed; }

/* 连接状态 */
.ws-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ws-dot.on { background: #19c37d; }
.ws-dot.off { background: #bbb; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal .card { background: #fff; border-radius: 12px; width: 560px; max-height: 84vh; overflow-y: auto; padding: 22px; }
.modal .card h3 { margin-bottom: 12px; }
.modal .card textarea { width: 100%; height: 220px; border: 1px solid #e2e2e6; border-radius: 8px; padding: 10px; font-family: monospace; font-size: 12px; outline: none; }
.modal .card .hint { font-size: 12px; color: #888; margin: 8px 0; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal .actions button { padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer; font-size: 14px; }
.modal .actions .cancel { background: #f0f0f2; color: #555; }
.modal .actions .ok { background: var(--red); color: #fff; }
.acc-manage { margin-top: 16px; }
.acc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f2f2f2; }
.acc-row img { width: 36px; height: 36px; border-radius: 50%; background: #eee; }
.acc-row .del { margin-left: auto; color: var(--red); cursor: pointer; font-size: 13px; background: none; border: none; }

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

/* ---------- 头像填充修复: rail 内 Avatar 的 img/占位需撑满 .acc 圆框 ---------- */
.rail .acc img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.rail .acc > div { width: 100%; height: 100%; border-radius: 50%; }
.conv > div:first-child { width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; }
.msg > div:first-child { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }

/* ---------- 系统提示(建群/入群等)居中细灰条 ---------- */
.sysmsg { align-self: center; max-width: 80%; color: #999; font-size: 12px; background: #f0f0f2; padding: 4px 12px; border-radius: 10px; }

/* ---------- 链接卡片 / 名片 ---------- */
.bub.card { padding: 0; overflow: hidden; max-width: 240px; background: #fff; border: 1px solid var(--line); }
.bub.card .cov { width: 100%; max-height: 130px; object-fit: cover; display: block; }
.bub.card .ct { padding: 8px 12px 2px; font-size: 14px; font-weight: 500; }
.bub.card .cd { padding: 0 12px; font-size: 12px; color: #888; }
.bub.card .cl { display: block; padding: 6px 12px 10px; font-size: 12px; color: var(--red); word-break: break-all; }
.namecard { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.namecard img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

/* ---------- 贴纸/大表情 ---------- */
.bub.bsticker { padding: 0; background: transparent; }
.bub.bsticker img { max-width: 120px; max-height: 120px; display: block; }

/* ---------- 视频封面 + 播放按钮 ---------- */
.vid { position: relative; display: inline-block; }
.vid img { max-width: 200px; max-height: 220px; border-radius: 7px; display: block; }
.vid .play { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 30px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }

/* ============ 左侧导航菜单栏 ============ */
.navbar { width: 72px; background: #1a1a20; display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 6px; flex-shrink: 0; }
.navbar .nb-logo { color: var(--red); font-weight: bold; font-size: 12px; text-align: center; line-height: 1.2; margin-bottom: 14px; }
.navbar .nb-item { width: 100%; color: #9a9aa2; font-size: 12px; text-align: center; padding: 10px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; border-left: 3px solid transparent; }
.navbar .nb-item .ic { font-size: 19px; }
.navbar .nb-item:hover { color: #ddd; }
.navbar .nb-item.on { color: #fff; background: #26262e; border-left-color: var(--red); }
.navbar .nb-spacer { flex: 1; }
.navbar .nb-logout { color: #777; font-size: 11px; cursor: pointer; padding: 8px 0; }
.navbar .nb-logout:hover { color: var(--red); }

/* 关系标签 */
.tag.rel { color: #fff; background: #19c37d; }

/* ============ 通用页(账号/素材) ============ */
.page { flex: 1; overflow-y: auto; padding: 26px 34px; background: #f6f6f8; }
.page h2 { font-size: 20px; margin: 0 0 18px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; max-width: 760px; }
.panel h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.panel .hint { color: #999; font-size: 12px; margin-bottom: 10px; }
.json-input { width: 100%; height: 120px; resize: vertical; border: 1px solid #e2e2e6; border-radius: 8px; padding: 10px 12px; font-size: 12px; font-family: monospace; outline: none; box-sizing: border-box; }
.json-input:focus { border-color: var(--red); }
.big-input { width: 100%; border: 1px solid #e2e2e6; border-radius: 8px; padding: 11px 12px; font-size: 14px; outline: none; box-sizing: border-box; margin: 6px 0 4px; }
.big-input:focus { border-color: var(--red); }
.ok { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 9px 22px; font-size: 14px; cursor: pointer; margin-top: 10px; }
.ok:disabled { background: #f5b5c2; cursor: not-allowed; }
.ok.mini { padding: 4px 12px; font-size: 12px; margin: 0; margin-left: auto; }
.page select { border: 1px solid #e2e2e6; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.acc-row .hl { font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: auto; }
.acc-row .hl.ok { color: #19c37d; background: #e7f9f0; }
.acc-row .hl.bad { color: #fff; background: var(--red); }
.acc-row .del { margin-left: 12px; }

/* 素材网格 */
.sticker-grid { display: flex; flex-wrap: wrap; gap: 10px; max-height: 360px; overflow-y: auto; }
.sticker-cell { width: 72px; text-align: center; }
.sticker-cell img { width: 58px; height: 58px; object-fit: contain; border-radius: 8px; background: #f3f3f5; }
.sticker-cell span { font-size: 12px; color: #555; }
.sticker-cell .cat { font-size: 10px; color: #aaa; margin-top: 2px; }

/* ============ 聊天输入工具条 ============ */
.input .tools { display: flex; gap: 4px; align-items: center; }
.input .tools button { background: transparent; color: inherit; border: none; padding: 4px; font-size: 19px; cursor: pointer; border-radius: 6px; width: auto; }
.input .tools button:hover { background: #f0f0f2; }
.input .send-btn { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 0 24px; font-size: 14px; cursor: pointer; }
.input .send-btn:disabled { background: #f5b5c2; cursor: not-allowed; }
.emoji-inline { width: 20px; height: 20px; vertical-align: -4px; margin: 0 1px; }

/* ============ 表情/贴纸选择器 ============ */
.picker { position: absolute; bottom: 74px; left: 16px; width: 360px; max-height: 280px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.16); display: flex; flex-direction: column; z-index: 20; }
.ptabs { display: flex; align-items: center; border-bottom: 1px solid var(--line); padding: 4px 6px; gap: 4px; }
.ptabs button { background: none; border: none; font-size: 13px; color: #888; cursor: pointer; padding: 6px 10px; border-radius: 6px; }
.ptabs button.on { color: var(--red); background: var(--red-soft); }
.ptabs .pclose { margin-left: auto; font-size: 18px; color: #bbb; }
.pgrid { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; overflow-y: auto; }
.pitem { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; }
.pitem:hover { background: #f0f0f2; }
.pitem img { max-width: 40px; max-height: 40px; }
.pitem span { font-size: 11px; color: #666; }
.phint { color: #aaa; font-size: 12px; padding: 14px; }
.chat { position: relative; }
.hd .tag { margin-left: 6px; }

/* 上滑加载更早消息提示 */
.load-more { text-align: center; color: #aaa; font-size: 12px; padding: 8px 0; }

/* 视频时长角标 */
.vid .vdur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 8px; }

/* 已读回执 */
.receipt { align-self: flex-end; font-size: 11px; color: #bbb; padding: 0 4px 2px; }
.receipt.read { color: #19c37d; }

/* ---------- 表单行 / 输入 ---------- */
.form-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.form-row label { font-size: 13px; color: #555; }
.ti { border: 1px solid #e2e2e6; border-radius: 7px; padding: 7px 10px; font-size: 13px; outline: none; }
.ti:focus { border-color: var(--red); }
.ti.wide { flex: 1; min-width: 240px; }
.mini-link { color: var(--red); font-size: 12px; cursor: pointer; }
.hl.warn { color: #fff; background: #e0762a; }

/* ---------- 管理后台表格 ---------- */
.atable { width: 100%; border-collapse: collapse; font-size: 13px; }
.atable th, .atable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f0f0f2; }
.atable th { color: #888; font-weight: 600; background: #fafafa; }
.atable .actions-cell button { font-size: 12px; margin-right: 6px; border: 1px solid #e2e2e6; background: #fff; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.atable .actions-cell button:hover { border-color: var(--red); color: var(--red); }

/* ---------- 素材选择器里的文本/视频项 ---------- */
.mat-text { width: 100%; padding: 8px 10px; border: 1px solid #eee; border-radius: 7px; margin-bottom: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-text:hover { background: #f6f6f8; border-color: var(--red); }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 22px; }
.switch input { display: none; }
.switch .slider { position: absolute; inset: 0; background: #ccc; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch .slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #19c37d; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ---------- 统计卡片 ---------- */
.stat-row { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-card { min-width: 92px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; text-align: center; }
.stat-card.alt { background: #fafafb; }
.stat-card .sv { font-size: 22px; font-weight: 700; }
.stat-card .sl { font-size: 12px; color: #999; margin-top: 4px; }
