/* ============================================================
   GOLDEX · 在线客服 & 后台子账号 UI
   ------------------------------------------------------------
   · 交易端（index）与后台（admin）共用，颜色全部走 CSS 变量，
     自动适配 style.css / neon.css 双主题令牌。
   · 前缀约定：客服 cs-*；后台顶栏身份 am-*；角色标签 rp-*。
   ============================================================ */

/* ---------- 通用隐藏 ---------- */
.cs-hide { display: none !important; }

/* ================= 后台顶栏身份 / 退出 ================= */
.am-me {
  display: flex; align-items: center; gap: 8px;
  margin-right: 4px; padding: 4px 10px 4px 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel2); max-width: 260px;
}
.am-uav {
  width: 27px; height: 27px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-style: normal; font-weight: 800; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--acc), var(--fut, var(--acc-deep)));
}
.am-tx { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.am-tx b { font-size: 12.5px; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.am-tx em { font-style: normal; font-size: 10px; color: var(--txt3); }
.am-out {
  border: 1px solid var(--line2); background: transparent; color: var(--txt2);
  border-radius: 999px; padding: 2px 9px; font-size: 11.5px; cursor: pointer;
  transition: all .18s; flex: none;
}
.am-out:hover { color: var(--down); border-color: var(--down-brd); background: var(--down-bg); }

/* 角色标签 */
.rp-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap;
}
.rp-super { color: #f6c75f; border-color: rgba(246, 199, 95, .4); background: rgba(246, 199, 95, .1); }
.rp-admin { color: var(--acc-hi, var(--acc)); border-color: var(--acc-glow); background: var(--acc-soft); }
.rp-support { color: var(--up); border-color: var(--up-brd); background: var(--up-bg); }

/* ================= 导航角标（客服未读） ================= */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; margin-left: 5px; padding: 0 4px;
  border-radius: 999px; background: var(--down); color: #fff;
  font-size: 10px; font-weight: 800; font-style: normal; line-height: 1;
}

/* ================= 后台「在线客服中心」 ================= */
.cs-card { display: flex; flex-direction: column; height: calc(100vh - 212px); min-height: 500px; overflow: hidden; }
.cs-layout { display: flex; flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.cs-side {
  width: 268px; flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--panel3);
}
.cs-side-hd {
  padding: 10px 13px; font-size: 12px; font-weight: 800; color: var(--txt2);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.cs-side-hd b { color: var(--acc-hi, var(--acc)); font-family: var(--num); }
.cs-list { flex: 1; overflow-y: auto; padding: 6px; }
.cs-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; margin-bottom: 4px; text-align: left; cursor: pointer;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  color: var(--txt); transition: background .15s;
}
.cs-item:hover { background: var(--panel-hi); }
.cs-item.on { background: var(--acc-soft); border-color: var(--acc-glow); }
.cs-ia {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: var(--txt);
  background: var(--panel-hi); border: 1px solid var(--line2);
}
.cs-item.guest .cs-ia { color: var(--acc-hi, var(--acc)); background: var(--acc-soft); }
.cs-it { flex: 1; min-width: 0; line-height: 1.35; }
.cs-it b { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--txt); }
.cs-it b .rp-pill { font-size: 9px; padding: 0 6px; }
.cs-it small {
  display: block; font-size: 10.5px; color: var(--txt3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.cs-t {
  flex: none; text-align: right; line-height: 1.3;
}
.cs-t i { display: block; font-style: normal; font-size: 9.5px; color: var(--txt3); font-family: var(--num); }
.cs-t b {
  display: inline-flex; min-width: 16px; height: 16px; margin-top: 3px; padding: 0 4px;
  align-items: center; justify-content: center; border-radius: 999px;
  background: var(--down); color: #fff; font-size: 9.5px;
}
.cs-empty { padding: 26px 14px; text-align: center; color: var(--txt3); font-size: 12px; line-height: 1.8; }

.cs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
.cs-head {
  padding: 10px 15px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.cs-head .rp-pill { font-size: 10px; }
.cs-head-nm { font-size: 14px; font-weight: 800; color: var(--txt); }
.cs-head-sub { font-size: 11px; color: var(--txt3); }
.cs-msgs {
  flex: 1; min-height: 0; overflow-y: auto; padding: 15px;
  display: flex; flex-direction: column; gap: 8px;
}
.cs-msgs .cs-hint { margin: auto; color: var(--txt3); font-size: 12px; text-align: center; line-height: 1.9; }

/* 消息气泡 */
.cs-row { display: flex; flex-direction: column; max-width: 78%; }
.cs-row .nm { font-size: 10px; color: var(--txt3); margin: 0 3px 2px; display: flex; align-items: center; gap: 4px; }
.cs-row .bub {
  padding: 8px 11px; border-radius: 14px; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.cs-row .bub .t {
  display: block; margin-top: 4px; font-size: 9.5px; opacity: .55; font-family: var(--num);
}
.cs-row.by-user { align-self: flex-start; align-items: flex-start; }
.cs-row.by-user .bub {
  background: var(--panel2); border: 1px solid var(--line2); color: var(--txt);
  border-top-left-radius: 4px;
}
.cs-row.by-staff { align-self: flex-end; align-items: flex-end; }
.cs-row.by-staff .bub {
  background: linear-gradient(135deg, var(--acc), var(--acc-deep));
  color: #fff; border-top-right-radius: 4px;
}

.cs-in {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--line); background: var(--panel-solid);
}
.cs-in input {
  flex: 1; min-width: 0; border: 1px solid var(--line2); border-radius: 10px;
  background: var(--panel2); color: var(--txt); padding: 9px 12px; font-size: 13px; outline: none;
}
.cs-in input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.cs-in .cs-send {
  flex: none; border: none; border-radius: 10px; padding: 0 18px; cursor: pointer;
  background: linear-gradient(135deg, var(--acc), var(--acc-deep)); color: #fff;
  font-size: 13px; font-weight: 700; transition: opacity .15s;
}
.cs-in .cs-send:hover { opacity: .86; }
.cs-in .cs-send:disabled { opacity: .45; cursor: default; }

/* 后端发送按钮保留在 mini 风格里的小按钮复用 .mini-btn */

/* ================= 用户端客服面板（顶部耳机图标呼出） ================= */
/* 未读角标：挂在首页顶部耳机图标上 */
.cs-fab-dot {
  position: absolute; top: -4px; right: -5px; min-width: 17px; height: 17px;
  padding: 0 5px; border-radius: 999px; background: var(--down); color: #fff;
  font-size: 10px; font-weight: 800; font-style: normal;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg0);
}
.cs-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 990;
  width: 384px; max-width: calc(100vw - 28px);
  height: min(640px, calc(100vh - 44px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel-solid); border: 1px solid var(--line2);
  border-radius: 18px; box-shadow: var(--sh-pop);
}
.cs-hd {
  padding: 13px 16px; display: flex; align-items: center; justify-content: space-between;
  background: var(--panel-solid); border-bottom: 1px solid var(--line);
}
.cs-hd-tx b { font-size: 15px; font-weight: 800; color: var(--txt); display: block; letter-spacing: .2px; }
.cs-hd small { font-size: 10.5px; color: var(--txt3); }
.cs-x {
  border: none; background: transparent; color: var(--txt2); font-size: 18px;
  cursor: pointer; width: 30px; height: 30px; border-radius: 9px; line-height: 1;
}
.cs-x:hover { background: var(--panel-hi); color: var(--txt); }
.cs-panel .cs-msgs { background: var(--bg2); padding: 14px; gap: 12px; }

/* ================= 消息：头像 + 气泡（两端共用） ================= */
.cs-row.has-av { flex-direction: row; align-items: flex-start; gap: 9px; max-width: 100%; }
.cs-row.has-av.by-staff { flex-direction: row-reverse; }
.cs-av {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--acc), var(--acc-deep));
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.cs-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-body { min-width: 0; display: flex; flex-direction: column; }
.cs-body .nm { margin-bottom: 3px; }
.cs-row.has-av.by-staff .cs-body { align-items: flex-end; }
.cs-panel .cs-row .bub { box-shadow: 0 6px 16px -12px rgba(0, 0, 0, .5); }
.cs-panel .cs-row.by-user .bub { background: var(--panel-solid); border-color: var(--line); }

/* ================= 附件（图片 / 视频 / 其它文件） ================= */
.cs-att-img {
  display: block; width: 208px; max-width: 100%; max-height: 260px; object-fit: cover;
  border-radius: 11px; cursor: zoom-in; background: var(--panel3);
}
.cs-att-vid { display: block; width: 236px; max-width: 100%; max-height: 280px; border-radius: 11px; background: #000; }
.cs-att-file {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  color: inherit; text-decoration: underline; word-break: break-all;
}
.cs-att-meta { display: block; margin-top: 5px; font-size: 10px; opacity: .6; font-family: var(--num); }
.bub.has-file { padding: 6px; }
.bub.has-file .cs-att-meta { padding: 0 4px; }
.cs-pending { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; opacity: .75; }

/* 图片放大预览 */
.cs-viewer {
  position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center;
  padding: 28px; background: rgba(2, 4, 10, .82); backdrop-filter: blur(3px);
}
.cs-viewer img { max-width: 94vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--sh-pop); }
.cs-viewer-x {
  position: absolute; top: 18px; right: 22px; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28); background: rgba(0, 0, 0, .35); color: #fff;
  font-size: 20px; line-height: 1; cursor: pointer;
}
.cs-viewer-x:hover { background: rgba(0, 0, 0, .6); }

/* ================= 输入区（圆角输入框 + 回形针 + 圆形发送键） ================= */
.cs-panel .cs-in {
  border-top: 1px solid var(--line); background: var(--panel-solid);
}
.cs-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  padding: 0 6px 0 15px; border: 1px solid var(--line2); border-radius: 999px;
  background: var(--panel2); transition: border-color .16s, box-shadow .16s;
}
.cs-field:focus-within { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
.cs-field input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  color: var(--txt); font-size: 13.5px; padding: 11px 0;
}
.cs-field input::placeholder { color: var(--txt3); }
.cs-att {
  flex: none; width: 32px; height: 32px; border: none; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--txt3);
  transition: color .15s, background .15s;
}
.cs-att:hover { color: var(--acc); background: var(--acc-soft); }
.cs-att svg { width: 18px; height: 18px; }
.cs-panel .cs-in .cs-send {
  flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; border: none;
  background: linear-gradient(135deg, var(--acc), var(--acc-deep)); color: #fff;
  box-shadow: 0 10px 20px -12px var(--acc-glow); transition: opacity .15s;
}
.cs-panel .cs-in .cs-send:hover { opacity: .88; }
.cs-panel .cs-in .cs-send:disabled { opacity: .45; cursor: default; }
.cs-panel .cs-in .cs-send svg { width: 18px; height: 18px; }

/* 移动端：全屏对话（与设计稿一致） */
@media (max-width: 640px) {
  .cs-panel {
    top: 0; right: 0; bottom: 0; left: 0;
    width: 100%; height: 100%; max-width: 100%; border: none; border-radius: 0;
  }
  .cs-panel .cs-msgs { padding: 14px 12px; }
  .cs-field { border-radius: 999px; }
}

/* ================= 后台子账号表格 ================= */
.acct-cell { display: flex; align-items: center; gap: 9px; }
.acct-cell .cs-ia { width: 30px; height: 30px; }
.acct-cell div { line-height: 1.3; }
.acct-cell b { font-size: 13px; color: var(--txt); display: block; }
.acct-cell small {
  font-family: var(--num); font-size: 9.5px; color: var(--txt3);
  display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 弹窗角色选择 */
.role-seg { display: flex; gap: 8px; }
.role-seg button {
  flex: 1; padding: 9px 6px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt2);
  font-size: 12.5px; font-weight: 700; transition: all .15s;
}
.role-seg button small { display: block; font-weight: 400; font-size: 10px; margin-top: 3px; color: var(--txt3); }
.role-seg button.on { border-color: var(--acc); color: var(--acc-hi, var(--acc)); background: var(--acc-soft); box-shadow: 0 0 0 3px var(--acc-soft); }
