/* k4wzjt7xm.css — 客服系统样式（访客端：黑红风 / 后台：体育绿） */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f2f6f3; color: #1c2b22;
  overflow-x: hidden; overscroll-behavior-x: none;
}

/* ============ 访客端（黑红风） ============ */
.v-body { display: flex; flex-direction: column; background: #0d0d0f; color: #e6e6e6; }
.v-wrap { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 860px; width: 100%; margin: 0 auto; }

.v-head {
  background: linear-gradient(135deg, #050506 0%, #131316 60%, #1a1a1e 100%);
  color: #fff; flex-shrink: 0; border-bottom: 1px solid #26262b;
}
.v-head-in { display: flex; align-items: center; gap: 12px; padding: 12px 18px 10px; }
/* 皇冠头像（黑金） */
.v-logo {
  width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #2b2b30, #101013);
  border: 2px solid #d4af37; box-shadow: 0 0 14px rgba(212,175,55,.35);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.v-title h1 { font-size: 18px; letter-spacing: 1px; }
.v-status { font-size: 12px; opacity: .92; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #9a9aa2; }
.dot.on { background: #ff4d4d; box-shadow: 0 0 0 0 rgba(255,77,77,.7); animation: pulse 1.6s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,77,77,.6); }
  70% { box-shadow: 0 0 0 7px rgba(255,77,77,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,77,77,0); }
}
/* 红色装饰条 */
.v-stripes {
  height: 6px;
  background: repeating-linear-gradient(90deg, rgba(224,49,49,.9) 0 26px, transparent 26px 52px);
}

.v-chat { flex: 1; overflow-y: auto; padding: 12px 12px 8px; -webkit-overflow-scrolling: touch; background: #131316; }
.v-chat::-webkit-scrollbar { width: 6px; }
.v-chat::-webkit-scrollbar-thumb { background: #2c2c31; border-radius: 3px; }

.msg { display: flex; margin: 7px 0; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .bubble {
  max-width: 78%; padding: 7px 11px; border-radius: 12px; line-height: 1.45;
  font-size: 13px; word-break: break-word; white-space: pre-wrap; position: relative;
}
.msg .meta { font-size: 10px; opacity: .55; margin-top: 3px; }
.msg.me { justify-content: flex-end; }
.msg.me .bubble { background: linear-gradient(135deg, #e03131, #ab2424); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .bubble { background: #1d1d21; border: 1px solid #2c2c31; color: #e2e2e2; border-bottom-left-radius: 4px; }
.msg.them .bubble.sys { background: #19191d; border-style: dashed; color: #9a9aa2; font-size: 12px; }
.bubble img.pic { max-width: 200px; max-height: 200px; border-radius: 8px; display: block; cursor: zoom-in; }

/* 客服消息皇冠头像（金） */
.msg .av {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; margin-right: 8px; align-self: flex-end;
  background: linear-gradient(135deg, #d4af37, #8f721c);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(212,175,55,.4);
}
.msg .av svg { width: 16px; height: 16px; display: block; }

.v-foot { flex-shrink: 0; background: #101013; border-top: 1px solid #26262b; padding: 9px 12px 8px; }
.v-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip {
  border: 1px solid #5c2323; background: #191215; color: #ff8585;
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer; transition: .15s;
}
.chip:hover { background: #e03131; color: #fff; border-color: #e03131; }

.v-inputbar { display: flex; align-items: flex-end; gap: 8px; }
.v-imgbtn {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #ff6b6b; background: #1b1316; transition: .15s;
}
.v-imgbtn:hover { background: #2a1a1e; }
#vText, #aText {
  flex: 1; resize: none; border: 1.5px solid #d7e3db; border-radius: 12px;
  padding: 8px 12px; font-size: 13.5px; font-family: inherit; line-height: 1.4;
  max-height: 96px; outline: none; background: #fbfdfc;
}
#vText { background: #17171a; border-color: #2c2c31; color: #eee; }
#vText:focus { border-color: #e03131; }
#aText:focus { border-color: #16a34a; }
.v-sendbtn {
  flex-shrink: 0; border: 0; cursor: pointer; color: #fff; font-size: 13.5px; font-weight: 600;
  background: linear-gradient(135deg, #e03131, #a61e1e);
  padding: 10px 20px; border-radius: 12px; transition: .15s;
}
.v-sendbtn:disabled { opacity: .45; cursor: not-allowed; }
.v-sendbtn:not(:disabled):hover { filter: brightness(1.1); }

.v-lightbox {
  position: fixed; inset: 0; background: rgba(5,5,6,.9); z-index: 99;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.v-lightbox[hidden] { display: none; }
.v-lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 8px; }

/* ============ 客服后台 ============ */
.a-body { display: flex; flex-direction: column; }

.a-login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #0a4d24 0%, #0f7a35 55%, #f2f6f3 55.1%);
  min-height: 100vh; min-height: 100dvh;
}
.a-login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(10,77,36,.35); padding: 30px 28px 26px;
}
.a-login-head { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.a-login-head .v-logo { background: #0f7a35; border-color: #0a4d24; box-shadow: none; }
.a-login-head h1 { font-size: 20px; color: #103823; }
.a-field { display: block; margin-bottom: 15px; }
.a-field > span { display: block; font-size: 13px; color: #54685c; margin-bottom: 6px; }
.a-field input {
  width: 100%; border: 1.5px solid #d7e3db; border-radius: 10px; padding: 10px 12px;
  font-size: 15px; outline: none; background: #fbfdfc;
}
.a-field input:focus { border-color: #16a34a; }
.a-cap-row { }
.a-cap-row input { width: 55%; display: inline-block; vertical-align: middle; }
.a-capimg {
  width: 40%; height: 42px; border-radius: 10px; border: 1px solid #d7e3db;
  vertical-align: middle; cursor: pointer; margin-left: 4%; background: #f0f8f3;
}
.a-err { color: #c0392b; font-size: 13px; margin: -6px 0 10px; }
.a-login-btn { width: 100%; padding: 12px; border-radius: 10px; font-size: 15.5px; }

.a-app {
  display: flex; height: 100vh; height: 100dvh; max-width: 1280px; width: 100%; margin: 0 auto;
  background: #fff; box-shadow: 0 0 40px rgba(16,56,35,.08);
}
.a-side {
  width: 62%; max-width: 980px; flex-shrink: 0; border-right: 1px solid #e3ebe6; display: flex; flex-direction: column;
  background: #f8fbf9;
}
.a-side-head {
  padding: 16px 18px 12px; border-bottom: 1px solid #e3ebe6;
  background: linear-gradient(135deg, #0a4d24, #0f7a35); color: #fff;
  display: flex; align-items: baseline; gap: 8px;
}
.a-side-head h2 { font-size: 17px; }
.a-side-sub { font-size: 12px; opacity: .85; }
.a-convlist {
  flex: 1; overflow-y: auto; display: grid; align-content: start;
  grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 10px; background: #f4f8f5;
}
/* 会话卡片（网格布局） */
.conv-card {
  background: #fff; border: 1px solid #e3ebe6; border-radius: 12px; padding: 9px 10px;
  cursor: pointer; display: flex; flex-direction: column; gap: 5px; min-width: 0;
  position: relative; transition: .12s;
}
.conv-card:hover { background: #eef6f1; border-color: #cfe3d7; }
.conv-card.active { background: #e2f3ea; border-color: #16a34a; box-shadow: inset 0 0 0 1.5px #16a34a; }
.cc-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.cc-name { font-weight: 600; font-size: 12.5px; color: #14342a; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-time { font-size: 10.5px; color: #93a89b; flex-shrink: 0; }
.cc-prev {
  font-size: 12px; color: #3f584b; line-height: 1.45; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 52px;
}
.cc-info { font-size: 10.5px; color: #9ab0a3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-card.closed .cc-name::after { content: ' · 已结束'; color: #93a89b; font-weight: 400; font-size: 11px; }
.conv-card.idle { opacity: .62; }
.ci-badge {
  background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex;
  align-items: center; justify-content: center; padding: 0 5px; flex-shrink: 0;
}
/* 新消息红白交替闪烁 */
@keyframes rwblink {
  0%, 49.9% { background: #e03131; color: #fff; }
  50%, 100% { background: #ffffff; color: #c0392b; }
}
.conv-card.flash { animation: rwblink .9s linear infinite; }
.conv-card.flash .cc-name,
.conv-card.flash .cc-prev,
.conv-card.flash .cc-info,
.conv-card.flash .cc-time { color: inherit; }
.conv-card.flash { border-color: transparent; }
.conv-card.flash .ci-badge { background: #fff; color: #e03131; }

.a-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.a-main-head {
  padding: 14px 20px; border-bottom: 1px solid #e3ebe6; font-size: 14.5px; color: #54685c;
  background: #fff; flex-shrink: 0;
}
.a-main-head strong { color: #14342a; }
.a-chat { background: #f2f6f3; }
.a-foot { border-top: 1px solid #e3ebe6; }
.a-closebtn {
  flex-shrink: 0; border: 1.5px solid #e7c3bd; color: #c0392b; background: #fff;
  border-radius: 12px; padding: 9px 14px; font-size: 13.5px; cursor: pointer;
}
.a-closebtn:hover { background: #fdf1ef; }

.empty-hint { text-align: center; color: #9ab0a3; font-size: 13px; padding: 40px 0; }

/* ============ 账号设置弹窗 ============ */
.a-setbtn {
  margin-left: auto; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.12);
  color: #fff; font-size: 12px; border-radius: 8px; padding: 3px 10px; cursor: pointer;
}
.a-setbtn:hover { background: rgba(255,255,255,.25); }
.a-modal {
  position: fixed; inset: 0; background: rgba(10,25,16,.45); z-index: 98;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.a-modal[hidden] { display: none; }
.a-modal-card {
  width: 100%; max-width: 360px; background: #fff; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(10,77,36,.35); padding: 22px 20px 18px;
}
.a-modal-card h3 { font-size: 17px; color: #103823; margin-bottom: 16px; }
.a-modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.s-savebtn { background: linear-gradient(135deg, #0f7a35, #0a4d24); }

/* ============ 消息发送状态（零延迟上屏 + 上传进度条） ============ */
.msg.pending .bubble { opacity: .55; }
.msg.sendfail .bubble { opacity: .65; }
.upprog { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.upprog-bar { flex: 1; max-width: 160px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.upprog-bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; transition: width .15s linear; }
.upprog-text { font-size: 11px; line-height: 1; opacity: .9; white-space: nowrap; }

/* ============ 后台禁止左右移动（移动端水平滑动） ============ */
html { overflow-x: hidden; max-width: 100vw; }
body.a-body, .a-app, .a-side, .a-main, .a-chat, .a-convlist, .a-login-wrap { touch-action: pan-x pan-y; }
#vText, #aText { min-width: 0; }
/* 应用高度：JS 用可视视口实时校准（兼容底部工具条悬浮的内置浏览器/键盘弹出） */
.v-wrap, .a-app { height: 100vh; height: 100dvh; height: var(--app-h, 100dvh); }

/* ============ 移动端 ============ */
@media (max-width: 760px) {
  .a-app { flex-direction: column; }
  .a-side { width: 100%; max-width: none; max-height: 46vh; max-height: 46dvh; border-right: 0; border-bottom: 1px solid #e3ebe6; }
  .a-convlist { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; }
  .a-main { flex: 1; min-height: 0; }
  .v-wrap { max-width: none; }
  .msg .bubble { max-width: 86%; }
  /* iOS：输入框字号 <16px 会触发聚焦自动放大且不回缩，导致右侧内容被挤出屏幕 */
  #vText, #aText, .a-field input { font-size: 16px; }
}
