/* ==========================================================================
   chat.css · 享像无限官网 · AI 客服组件（只加 .chat-* / .chat__*，不改现存样式）
   令牌复用 theme-v2.css :root；白底文字/按钮一律 --accent-strong，
   --accent(#ff6b1a) 用于橙渐变头部/海报、悬浮圆钮与深底装饰。
   版式：桌面 860×720（视口约束 max-width/height）两栏
   （左聊天+欢迎清单卡 / 右 260px 海报+数据+二维码+留资）；≤900px 单列。
   z-index：悬浮钮 40 / 面板 41 —— 高于 .floatbar(30)，低于 .vm/.lb(100)。
   ========================================================================== */

.chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 40;
  width: 96px;
  padding: 0 0 14px;
  border: 0;
  border-radius: 48px 48px 14px 14px;
  background: linear-gradient(180deg, #ff8a3c, #ff6b1a);
  color: #fff;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0,0,0,.32);
  transition: transform .2s var(--ease, ease), box-shadow .2s var(--ease, ease);
}
.chat-launcher__photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  margin: 16px auto 8px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  overflow: hidden;
}
.chat-launcher__photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.chat-launcher__label { display: block; font-size: 12px; opacity: .92; letter-spacing: .08em; }
.chat-launcher__phone { display: block; margin-top: 2px; font-size: 15px; font-weight: 800; letter-spacing: .02em; }
.chat-launcher__cta {
  position: relative;
  display: block;
  width: max-content;
  margin: 10px auto 0;
  padding: 5px 10px;
  border-radius: 4px;
  background: #fff;
  color: var(--accent-strong, #c2410c);
  font-size: 12px;
  font-weight: 800;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(0,0,0,.38); }
.chat-launcher:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 41;
  width: 860px;
  height: 720px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper, #fff);
  color: var(--ink, #14171b);
  border: 1px solid var(--line, #e6e3de);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.3);
  animation: chat-panel-in .2s var(--ease, ease) both;
}
.chat-panel[hidden] { display: none !important; }
@keyframes chat-panel-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 头部：白色留白容器 + 橙色纯色横幅 + 人物大半身像 + 右侧两行文案；桌面可拖拽移动面板 */
.chat__header {
  flex: 0 0 auto;
  position: relative;
  padding: 36px 14px 0;   /* 顶部留白容纳人物头部 32px 溢出（128-96），不被面板裁掉 */
  background: var(--paper, #fff);
  cursor: grab;
}
.chat__banner {
  position: relative;
  height: 96px;
  border-radius: 14px;
  background: #FF7042;
}
.chat__agent {
  position: absolute;
  left: 18px;
  bottom: 0;
  height: 128px;          /* 横幅高的约 1.3 倍，头顶冒出横幅上缘 */
  width: auto;
  pointer-events: none;
  z-index: 1;
  -webkit-user-drag: none;
  user-select: none;
}
.chat__banner-text {
  position: absolute;
  right: 54px;
  top: 50%;
  transform: translateY(-50%);
  text-align: right;
  color: #fff;
  z-index: 2;
}
.chat__hello { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.25; white-space: nowrap; }
.chat__sub { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: rgba(255,255,255,.85); white-space: nowrap; }
.chat__close {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 3;
  width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 8px;
  background: rgba(255,255,255,.2); color: #fff;
  font-size: 22px; line-height: 1;
  cursor: pointer;
}
.chat__close:hover { background: rgba(255,255,255,.34); }
/* 拖拽视觉：头部手型 + 禁止文本/图片拖拽选中 */
.chat__header { user-select: none; -webkit-user-select: none; }
.chat__header.is-dragging { cursor: grabbing; }

/* 主体两栏 */
.chat__body { flex: 1 1 auto; min-height: 0; display: flex; }
.chat__main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--wash, #f7f5f2);
}

/* 欢迎清单卡 */
.chat__welcome {
  flex: 0 0 auto;
  margin: 12px 12px 0;
  padding: 12px 14px;
  background: var(--paper, #fff);
  border: 1px solid var(--line, #e6e3de);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}
.chat__welcome-title { margin: 0 0 8px; font-size: 15px; font-weight: 800; color: var(--ink, #14171b); }
.chat__welcome-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chat__welcome-item { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2, #525a63); }
.chat__tick { flex: 0 0 auto; color: var(--accent-strong, #c2410c); font-weight: 800; }
.chat__chip {
  display: inline-block;
  margin: 10px 0 0;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--wash-2, #efece7);
  color: var(--ink-3, #666d75);
  font-size: 12px;
}

/* 快捷问题：浅橙描边小胶囊 */
.chat__quick {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 12px 6px;
}
.chat__quick-item {
  min-height: 30px; padding: 4px 12px;
  border: 1px solid #ffc9a3; border-radius: 999px;
  background: #fff; color: var(--accent-strong, #c2410c);
  font-size: 13px; line-height: 1.4;
}
.chat__quick-item:hover, .chat__quick-item:focus-visible {
  background: var(--accent-soft, #fff1e8);
  border-color: var(--accent-strong, #c2410c);
}
.chat__quick-item:disabled { opacity: .55; cursor: not-allowed; }

/* 消息区 */
.chat__log {
  flex: 1 1 auto;
  min-height: 72px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 12px 10px;
}
.chat__msg { display: flex; flex-direction: column; max-width: 86%; }
.chat__msg--user { align-self: flex-end; align-items: flex-end; }
.chat__msg--agent { align-self: flex-start; align-items: flex-start; }
.chat__bubble {
  padding: 8px 12px; border-radius: 10px;
  font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word;
}
.chat__msg--user .chat__bubble {
  background: var(--accent-strong, #c2410c); color: #fff;
  border-bottom-right-radius: 3px;
}
.chat__msg--agent .chat__bubble {
  background: var(--paper, #fff); color: var(--ink, #14171b);
  border: 1px solid var(--line, #e6e3de);
  border-bottom-left-radius: 3px;
}
.chat__typing {
  align-self: flex-start;
  padding: 8px 12px; border-radius: 10px;
  background: var(--paper, #fff); border: 1px solid var(--line, #e6e3de);
  color: var(--ink-3, #666d75); font-size: 13px;
}
.chat__typing::after { content: '…'; animation: chat-blink 1s steps(2, start) infinite; }
@keyframes chat-blink { 50% { opacity: .25; } }

/* 输入区 + 底部小字 */
.chat__composer {
  flex: 0 0 auto;
  display: flex; gap: 6px;
  padding: 8px 12px 6px;
}
.chat__text {
  flex: 1 1 auto; min-width: 0; height: 42px; padding: 0 11px;
  border: 1px solid var(--line-control, #8f8981); border-radius: 8px;
  background: #fff; color: var(--ink, #14171b); font-size: 14px;
}
.chat__text:focus { outline: 2px solid var(--focus, #c2410c); outline-offset: 0; }
.chat__send {
  flex: 0 0 auto; min-width: 72px; height: 42px;
  border: 0; border-radius: 8px;
  background: var(--accent-strong, #c2410c); color: #fff;
  font-size: 14px; font-weight: 700;
}
.chat__send:hover { background: var(--accent-strong-hover, #a5400a); }
.chat__send:disabled { opacity: .6; cursor: not-allowed; }
.chat__foot { margin: 0; padding: 0 12px 8px; text-align: center; font-size: 11.5px; color: var(--ink-3, #666d75); }
.chat__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 右栏：海报 + 服务数据 + 二维码 + 留资 */
.chat__side {
  flex: 0 0 260px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-left: 1px solid var(--line, #e6e3de);
  background: var(--paper, #fff);
  overflow-y: auto;
}
.chat__poster {
  padding: 16px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #ff9a3d, #ff6b1a);
  color: #fff;
}
.chat__poster-line { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.4; }
.chat__poster-sub { margin: 8px 0 0; font-size: 12px; opacity: .92; }
.chat__stats-title { margin: 0 0 6px; font-size: 14px; font-weight: 800; color: var(--ink, #14171b); }
.chat__stats-line { margin: 0 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2, #525a63); }
.chat__stats-hl { color: var(--accent-strong, #c2410c); font-weight: 800; }
.chat__side-qr { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--ink-3, #666d75); }
.chat__qr { flex: 0 0 auto; width: 48px; height: 48px; border: 1px solid var(--line, #e6e3de); border-radius: 3px; object-fit: cover; }

/* 留资卡（桌面在右栏，移动端保留在面板底部） */
.chat__lead {
  padding: 12px;
  border: 1px solid var(--line, #e6e3de);
  border-radius: 8px;
  background: var(--paper, #fff);
}
.chat__lead--hint { box-shadow: inset 0 0 0 2px var(--accent-strong, #c2410c); }
.chat__lead-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--ink, #14171b); }
.chat__lead-row { margin-bottom: 6px; }
.chat__field {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--line-control, #8f8981); border-radius: 4px;
  background: #fff; color: var(--ink, #14171b); font-size: 13px;
}
.chat__field::placeholder { color: var(--ink-3, #666d75); }
.chat__field:focus { outline: 2px solid var(--focus, #c2410c); outline-offset: 0; }
.chat__lead-btn {
  width: 100%; min-height: 38px;
  border: 0; border-radius: 4px;
  background: var(--accent-strong, #c2410c); color: #fff;
  font-size: 13px; font-weight: 700;
}
.chat__lead-btn:hover { background: var(--accent-strong-hover, #a5400a); }
.chat__lead-btn:disabled { opacity: .6; cursor: not-allowed; }
.chat__status { min-height: 15px; margin: 4px 0 0; font-size: 11.5px; color: var(--accent-strong, #c2410c); }

/* ≤900px：单列，右栏视觉隐藏但保留留资卡（display:contents 让 .chat__lead 落回主列之后）；
   拖拽不启用（JS 侧 innerWidth 守卫），定位保持固定 right/bottom */
@media (max-width: 900px) {
  .chat-launcher { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .chat-panel {
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    width: min(360px, calc(100vw - 24px));
    height: auto;
    max-height: calc(100vh - 104px - env(safe-area-inset-bottom, 0px));
  }
  .chat__header { cursor: default; padding: 28px 10px 0; }   /* 顶部留白容纳人物 24px 溢出 */
  .chat__banner { height: 72px; border-radius: 12px; }
  .chat__agent { height: 96px; left: 10px; }
  .chat__banner-text { right: 48px; }
  .chat__hello { font-size: 17px; }
  .chat__sub { font-size: 11px; }
  .chat__body { flex-direction: column; }
  .chat__side { display: contents; }
  .chat__poster, .chat__stats, .chat__side-qr { display: none; }
  .chat__lead { border-left: 0; border-radius: 0; }
}
@media (max-width: 380px) {
  .chat__quick-item { font-size: 12px; padding: 3px 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel { animation: none; }
  .chat__typing::after { animation: none; }
  .chat-unread { animation: none; }
}

/* 客服面板打开时隐藏案例轮播箭头，避免 z-index:101 穿模压住面板 */
body.chat-open .slider__arrow { visibility: hidden; pointer-events: none; }

/* 未读消息角标：红圈持续闪烁，附着在站内「咨询」入口按钮右上角 */
[data-chat-open]{position:relative}
.chat-unread{
  position:absolute; top:-7px; right:-7px;
  min-width:20px; height:20px; padding:0 5px;
  border-radius:999px; background:#ff3b30; color:#fff;
  font-size:12px; font-weight:800; line-height:20px; text-align:center;
  box-shadow:0 2px 6px rgba(0,0,0,.3);
  animation:chat-unread-blink 1s ease-in-out infinite;
  z-index:2;
}
.chat-unread[hidden]{display:none}
@keyframes chat-unread-blink{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.8)}}
