/* 在线咨询（客服聊天）前台悬浮窗 */
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1000;
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--cinnabar, #b03a2e), var(--cinnabar-dark, #8f2b21));
  color: #f9f1e6; display: grid; place-items: center;
  box-shadow: 0 6px 20px -4px rgba(176, 58, 46, .55);
  transition: transform .15s ease, box-shadow .15s ease;
}
.chat-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -6px rgba(176, 58, 46, .6); }
.chat-fab svg { width: 26px; height: 26px; }
.chat-fab .chat-fab-dot {
  position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--jade, #3f6f5f); border: 2px solid #fff; display: none;
}
.chat-fab .chat-fab-dot.on { display: block; }

.chat-panel {
  position: fixed; right: 22px; bottom: 88px; z-index: 1001;
  width: 360px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 110px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card, #fff); border: 1px solid var(--line, #e9e2d6);
  border-radius: 16px; box-shadow: 0 20px 50px -18px rgba(60, 50, 30, .35);
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: linear-gradient(135deg, var(--cinnabar, #b03a2e), var(--cinnabar-dark, #8f2b21));
  color: #f9f1e6;
}
.chat-head-icon { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; flex-shrink: 0; }
.chat-head-icon svg { width: 18px; height: 18px; }
.chat-head-txt { flex: 1; min-width: 0; }
.chat-head-txt b { display: block; font-size: 15px; font-family: var(--kai, serif); letter-spacing: .02em; }
.chat-head-txt .chat-status { display: block; font-size: 12px; opacity: .9; }
.chat-close { background: none; border: none; color: #f9f1e6; font-size: 24px; line-height: 1; cursor: pointer; opacity: .85; padding: 0 2px; }
.chat-close:hover { opacity: 1; }

.chat-pre { padding: 16px; border-bottom: 1px solid var(--line, #e9e2d6); }
.chat-pre-title { margin: 0 0 12px; font-size: 13px; color: var(--muted, #8a877b); }
.chat-pre input {
  width: 100%; padding: 10px 12px; margin-bottom: 8px; border: 1.5px solid var(--line, #e9e2d6);
  border-radius: 10px; font-size: 14px; font-family: var(--sans, sans-serif); color: var(--ink, #2c2b26); background: var(--bg, #faf7f1);
}
.chat-btn { border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 500; cursor: pointer; font-family: var(--sans, sans-serif); }
.chat-btn-primary { width: 100%; background: var(--jade, #3f6f5f); color: #fff; }
.chat-btn-primary:hover { background: var(--jade-dark, #2e5447); }

.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-soft, #f3eee4); }
.chat-msg { display: flex; }
.chat-msg.admin { justify-content: flex-start; }
.chat-msg.visitor { justify-content: flex-end; }
.chat-bubble { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--ink, #2c2b26); }
.chat-msg.admin .chat-bubble { background: #fff; border: 1px solid var(--line, #e9e2d6); border-bottom-left-radius: 3px; }
.chat-msg.visitor .chat-bubble { background: var(--jade, #3f6f5f); color: #fff; border-bottom-right-radius: 3px; }
.chat-meta { display: block; font-size: 11px; opacity: .6; margin-top: 4px; }
.chat-msg.visitor .chat-meta { color: rgba(255,255,255,.8); }
.chat-sys { text-align: center; font-size: 12px; color: var(--muted, #8a877b); margin: 4px 0; }

.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line, #e9e2d6); background: var(--card, #fff); }
.chat-input input {
  flex: 1; padding: 10px 14px; border: 1.5px solid var(--line, #e9e2d6); border-radius: 999px;
  font-size: 14px; font-family: var(--sans, sans-serif); color: var(--ink, #2c2b26); background: var(--bg, #faf7f1);
}
.chat-input input:disabled { opacity: .55; }
.chat-send { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; background: var(--cinnabar, #b03a2e); color: #fff; display: grid; place-items: center; }
.chat-send:hover { background: var(--cinnabar-dark, #8f2b21); }
.chat-send svg { width: 18px; height: 18px; }
.chat-closed-note { padding: 16px; text-align: center; color: var(--muted, #8a877b); font-size: 13px; border-top: 1px solid var(--line, #e9e2d6); background: var(--card, #fff); }
.chat-closed-note button { margin-top: 10px; }

@media (max-width: 480px) {
  .chat-fab { right: 14px; bottom: 14px; }
  .chat-panel { right: 14px; bottom: 80px; height: 480px; }
}
