@charset "utf-8";
/* =============================================================================
   建岑企服 · 智能客服组件样式 (kefu.css v1.0.0)
   - 自包含设计变量（不依赖站点 tokens.css，可独立嵌入任何页面）
   - 悬浮球（右下角）+ 渐变气泡提示 + 聊天窗（参考大账房式极简风）
   - ≤480px 移动端全屏
   ============================================================================= */
.kf-root {
  --kf-primary:      #198e7d;
  --kf-primary-deep: #0f6b5d;
  --kf-primary-soft: #e6f4f2;
  --kf-accent:       #e63946;   /* 热线号红色（对齐参考图） */
  --kf-ink:          #222;
  --kf-ink-2:        #666;
  --kf-ink-3:        #9aa5a3;
  --kf-line:         #ececec;
  --kf-bubble-in:    #f4f5f6;
  --kf-bubble-out:   #198e7d;
  --kf-z: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.kf-root *, .kf-root *::before, .kf-root *::after { box-sizing: border-box; }
.kf-hide { display: none !important; }

/* ---------------- 悬浮球 ---------------- */
.kf-ball {
  position: fixed; right: 22px; bottom: 96px; z-index: var(--kf-z);
  width: 64px; height: 64px; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%; background: transparent;
  box-shadow: 0 8px 24px rgba(15, 107, 93, .32);
  transition: transform .25s ease, box-shadow .25s ease;
}
.kf-ball:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 28px rgba(15, 107, 93, .4); }
.kf-ball:active { transform: scale(.96); }
.kf-ball__inner {
  display: grid; place-items: center; width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(120% 120% at 20% 15%, #2fb3a0 0%, #198e7d 55%, #0f6b5d 100%);
  color: #fff;
}
.kf-ball__inner svg { width: 34px; height: 34px; }
.kf-ball__pulse::before {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid rgba(25, 142, 125, .55);
  animation: kf-pulse 2.2s ease-out infinite; pointer-events: none;
}
@keyframes kf-pulse {
  0%   { transform: scale(.9);  opacity: .9; }
  70%  { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}
/* 渐变气泡提示：顾问在线，立即咨询（参考图2） */
.kf-tip {
  position: fixed; right: 94px; bottom: 100px; z-index: var(--kf-z);
  padding: 10px 16px; font-size: 15px; font-weight: 600; letter-spacing: .5px;
  color: #fff; white-space: nowrap;
  background: linear-gradient(100deg, #21a08d 0%, #198e7d 55%, #0f6b5d 100%);
  border-radius: 14px 14px 2px 14px;
  box-shadow: 0 6px 18px rgba(15, 107, 93, .35);
  animation: kf-tip-in .4s ease both;
}
.kf-tip::after {
  content: ""; position: absolute; right: -6px; bottom: 10px;
  width: 12px; height: 12px; transform: rotate(45deg);
  background: #0f6b5d; border-radius: 2px;
}
.kf-tip__close {
  position: absolute; left: -8px; top: -8px;
  width: 18px; height: 18px; padding: 0; cursor: pointer;
  border: 0; border-radius: 50%;
  background: rgba(17, 17, 17, .55); color: #fff;
  font-size: 11px; line-height: 18px;
}
.kf-tip__close:hover { background: rgba(17, 17, 17, .8); }
@keyframes kf-tip-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* ---------------- 聊天窗 ---------------- */
.kf-panel {
  position: fixed; right: 22px; bottom: 96px; z-index: var(--kf-z);
  display: flex; flex-direction: column;
  width: 375px; height: 600px; max-height: calc(100vh - 60px);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--kf-line);
  border-radius: 16px;
  box-shadow: 0 18px 60px rgba(17, 40, 36, .22);
  animation: kf-panel-in .28s cubic-bezier(.22, 1, .36, 1) both;
  transform-origin: 90% 100%;
}
@keyframes kf-panel-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }

/* 头部 */
.kf-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #f2f2f2;
}
.kf-head__ava {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: radial-gradient(120% 120% at 20% 15%, #2fb3a0 0%, #198e7d 55%, #0f6b5d 100%);
  color: #fff;
}
.kf-head__ava svg { width: 24px; height: 24px; }
.kf-head__meta { flex: 1; min-width: 0; }
.kf-head__name { font-size: 16px; font-weight: 600; color: var(--kf-ink); line-height: 1.3; }
.kf-head__status { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--kf-ink-2); margin-top: 2px; }
.kf-dot { width: 7px; height: 7px; border-radius: 50%; background: #3fae5c; }
.kf-dot.is-wait { background: #f5a623; animation: kf-blink 1.2s ease infinite; }
@keyframes kf-blink { 50% { opacity: .35; } }
.kf-head__btn {
  flex: none; width: 32px; height: 32px; padding: 0; cursor: pointer;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--kf-ink-2); font-size: 18px; line-height: 32px; text-align: center;
}
.kf-head__btn:hover { background: #f5f6f6; color: var(--kf-ink); }

/* 消息区 */
.kf-msgs {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 14px 8px;
  background: #fff;
  scrollbar-width: thin;
}
.kf-msgs::-webkit-scrollbar { width: 4px; }
.kf-msgs::-webkit-scrollbar-thumb { background: #e3e7e6; border-radius: 2px; }

.kf-note { text-align: center; font-size: 12px; color: var(--kf-ink-3); margin: 6px 0; }
.kf-note--time { margin: 10px 0; }

.kf-row { display: flex; gap: 8px; margin: 10px 0; }
.kf-row--out { justify-content: flex-end; }
.kf-ava {
  flex: none; display: grid; place-items: center; align-self: flex-start;
  width: 30px; height: 30px; border-radius: 50%; margin-top: 20px;
  background: radial-gradient(120% 120% at 20% 15%, #2fb3a0 0%, #198e7d 55%, #0f6b5d 100%);
  color: #fff;
}
.kf-ava svg { width: 18px; height: 18px; }
.kf-col { display: flex; flex-direction: column; align-items: flex-start; max-width: 76%; min-width: 0; }
.kf-name { display: block; font-size: 12px; color: var(--kf-ink-3); margin: 0 0 4px 2px; }
.kf-bubble {
  display: inline-block;
  padding: 10px 12px; font-size: 14px; line-height: 1.65; word-break: break-word;
  color: var(--kf-ink);
  background: var(--kf-bubble-in);
  border-radius: 4px 12px 12px 12px;
  white-space: pre-wrap;
}
.kf-bubble a { color: inherit; }
.kf-hotline { color: var(--kf-accent); font-weight: 700; }
.kf-row--out .kf-col { max-width: 80%; }
.kf-row--out .kf-bubble {
  color: #fff; background: var(--kf-bubble-out);
  border-radius: 12px 4px 12px 12px;
}
/* AI 正在输入 */
.kf-typing { display: inline-flex; align-items: center; gap: 4px; height: 14px; }
.kf-typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9c2c0; animation: kf-dot 1.2s ease infinite; }
.kf-typing i:nth-child(2) { animation-delay: .2s; }
.kf-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes kf-dot { 0%, 60%, 100% { transform: none; opacity: .6; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 快捷动作按钮行 */
.kf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px 40px; }
.kf-act {
  padding: 6px 14px; font-size: 13px; cursor: pointer;
  color: var(--kf-primary); background: var(--kf-primary-soft);
  border: 1px solid transparent; border-radius: 16px;
  transition: background .2s ease;
}
.kf-act:hover { background: #d8eeea; }
.kf-act--tel { color: #fff; background: var(--kf-primary); }
.kf-act--tel:hover { background: var(--kf-primary-deep); }

/* 快捷提问标签行 */
.kf-tags {
  flex: none; display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain;
  padding: 8px 14px; border-top: 1px solid #f5f5f5; scrollbar-width: none;
}
.kf-tags::-webkit-scrollbar { display: none; }
.kf-tag {
  flex: none; padding: 5px 12px; font-size: 12px; cursor: pointer;
  color: var(--kf-ink-2); background: #f6f7f7;
  border: 1px solid var(--kf-line); border-radius: 13px;
  transition: all .2s ease;
}
.kf-tag:hover { color: var(--kf-primary); background: var(--kf-primary-soft); border-color: transparent; }

/* 留资卡片（免费获取方案） */
.kf-lead {
  margin: 8px 0 8px 38px; padding: 12px;
  background: #f8fbfa; border: 1px solid #dcedea; border-radius: 10px;
}
.kf-lead__t { font-size: 13px; font-weight: 600; color: var(--kf-primary-deep); margin-bottom: 8px; }
.kf-lead__row { display: flex; gap: 8px; margin-bottom: 8px; }
.kf-lead input, .kf-lead textarea {
  flex: 1; min-width: 0; padding: 8px 10px; font-size: 13px;
  font-family: inherit; color: var(--kf-ink);
  background: #fff; border: 1px solid var(--kf-line); border-radius: 8px; outline: none;
}
.kf-lead textarea { width: 100%; resize: none; height: 52px; }
.kf-lead input:focus, .kf-lead textarea:focus { border-color: var(--kf-primary); }
.kf-lead__submit {
  width: 100%; padding: 9px 0; font-size: 14px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--kf-primary); border: 0; border-radius: 8px;
}
.kf-lead__submit:hover { background: var(--kf-primary-deep); }
.kf-lead__submit:disabled { opacity: .6; cursor: default; }
.kf-lead__err { font-size: 12px; color: var(--kf-accent); margin-top: 6px; min-height: 14px; }

/* 人工介入横幅 */
.kf-human-bar {
  flex: none; padding: 7px 14px; font-size: 12px; color: #8a5b00;
  background: #fdf4e3; border-top: 1px solid #f3e3bd;
}

/* 输入区 */
.kf-input-zone { flex: none; padding: 8px 12px 12px; border-top: 1px solid #f0f0f0; background: #fff; }
.kf-input-box {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 8px;
  background: #f6f7f7; border: 1px solid transparent; border-radius: 12px;
  transition: border-color .2s ease;
}
.kf-input-box:focus-within { border-color: var(--kf-primary); background: #fff; }
.kf-input {
  flex: 1; min-width: 0; height: 40px; max-height: 96px;
  padding: 9px 2px; font-size: 14px; font-family: inherit; color: var(--kf-ink);
  border: 0; outline: none; background: transparent; resize: none; line-height: 1.5;
}
.kf-input::placeholder { color: #b3bdbb; }
.kf-ico-btn {
  flex: none; width: 32px; height: 32px; padding: 0; cursor: pointer;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--kf-ink-3); display: grid; place-items: center;
}
.kf-ico-btn:hover { color: var(--kf-primary); background: #eef3f2; }
.kf-ico-btn svg { width: 20px; height: 20px; }
.kf-send {
  flex: none; width: 34px; height: 34px; padding: 0; cursor: pointer;
  border: 0; border-radius: 10px;
  background: var(--kf-primary); color: #fff; display: grid; place-items: center;
  transition: background .2s ease, opacity .2s ease;
}
.kf-send:hover { background: var(--kf-primary-deep); }
.kf-send:disabled { opacity: .55; cursor: default; }
.kf-send svg { width: 17px; height: 17px; }

/* 表情面板 */
.kf-emoji {
  position: absolute; left: 12px; bottom: 64px; z-index: 2;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  padding: 8px; background: #fff; border: 1px solid var(--kf-line);
  border-radius: 12px; box-shadow: 0 8px 24px rgba(17, 40, 36, .14);
}
.kf-emoji button {
  width: 30px; height: 30px; padding: 0; cursor: pointer;
  border: 0; border-radius: 6px; background: transparent; font-size: 17px; line-height: 30px;
}
.kf-emoji button:hover { background: var(--kf-primary-soft); }

/* ---------------- 移动端 ≤480px 全屏 ---------------- */
@media (max-width: 480px) {
  .kf-panel { right: 0; bottom: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; border: 0; animation-name: kf-sheet-in; transform-origin: 100% 100%; }
  @keyframes kf-sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .kf-ball { right: 14px; bottom: 78px; width: 56px; height: 56px; }
  .kf-ball__inner { width: 56px; height: 56px; }
  .kf-ball__inner svg { width: 30px; height: 30px; }
  .kf-tip { right: 78px; bottom: 84px; font-size: 14px; padding: 8px 13px; }
  .kf-actions { margin-left: 0; }
  .kf-lead { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kf-ball, .kf-tip, .kf-panel, .kf-ball__pulse::before { animation: none; }
}
