/* 组件自有颜色：样式要同时跑在克隆页（HSL 三段值）与 SSR 页（hex token）上，
   直接用 var(--pc-primary) 在后者会算成透明，所以这里固化品牌色。 */
.pc-btn, .pc-panel, .pc-toast {
  --pc-primary: #27A261;
  --pc-primary-rgb: 39 162 97;
  --pc-primary-fg: #ffffff;
  --pc-card: #ffffff;
  --pc-fg: #1F2937;
  --pc-muted: #5B6B7C;
  --pc-border: #E2E8F0;
  --pc-bg: #F7F9FB;
  --pc-danger: #EF4444;
}
/* ── 前台在线客服挂件 ────────────────────────────────
   视觉按原站「AI 智能客服」面板复刻：
   · 悬浮按钮：44px 圆形，品牌绿底 + sparkles 图标
   · 面板：360px 宽 / min(560px, 72dvh) 高，12px 圆角，卡片底色 + 1px 边框
   · 头部：品牌绿实底 + 白字，左侧机器人图标，右侧「重新开始 / 关闭」
   · 消息区：secondary/40 浅底，机器人气泡白底带边框，用户气泡品牌绿
   · 快捷问题：输入框上方一排描边胶囊
   颜色全部取站点 CSS 变量（Tailwind 的 HSL 三段值），跟随站点主题。
   ───────────────────────────────────────────────── */

.pc-btn {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pc-primary);
  color: var(--pc-primary-fg);
  box-shadow: 0 10px 24px rgb(var(--pc-primary-rgb) / 0.32);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.pc-btn:hover { transform: translateY(-2px); background: rgb(var(--pc-primary-rgb) / 0.92); box-shadow: 0 14px 30px rgb(var(--pc-primary-rgb) / 0.38); }
.pc-btn svg { width: 20px; height: 20px; }
.pc-btn .pc-dot {
  position: absolute;
  right: 3px;
  top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--pc-card);
  border: 2px solid var(--pc-primary);
  display: none;
}
.pc-btn .pc-dot.on { display: block; background: #22c55e; border-color: var(--pc-card); }
.pc-badge-tip { display: none; }

/* 未读角标 */
.pc-btn .pc-count {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pc-danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
  display: none;
}
.pc-btn .pc-count.show { display: block; }

.pc-orig-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pc-danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
  display: none;
  z-index: 2;
}
.pc-orig-badge.show { display: block; }

/* ── 面板 ───────────────────────────────────────── */
.pc-panel {
  position: fixed;
  right: 76px;
  bottom: 24px;
  z-index: 60;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: min(560px, 72dvh);
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--pc-border);
  border-radius: 12px;
  background: var(--pc-card);
  box-shadow: 0 24px 60px rgb(31 41 55 / 0.18);
  font-family: inherit;
}
.pc-panel.open { display: flex; }

/* 头部 */
.pc-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--pc-primary);
  color: var(--pc-primary-fg);
}
.pc-head-bot { width: 20px; height: 20px; flex: 0 0 auto; }
.pc-head-txt { flex: 1 1 auto; min-width: 0; }
.pc-head-title { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-head-sub { margin: 0; font-size: 12px; line-height: 1.4; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-icon-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background-color .15s ease;
}
.pc-icon-btn:hover { background: rgb(255 255 255 / 0.14); }
.pc-icon-btn svg { width: 16px; height: 16px; display: block; }
.pc-close { display: inline-flex; }

/* 消息区 */
.pc-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: var(--pc-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pc-msg { display: flex; flex-direction: column; max-width: 100%; }
.pc-msg.admin { align-items: flex-start; }
.pc-msg.me { align-items: flex-end; }
.pc-bubble {
  max-width: 85%;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 16px;
}
.pc-msg.admin .pc-bubble {
  background: var(--pc-card);
  color: var(--pc-fg);
  border: 1px solid var(--pc-border);
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 2px rgb(31 41 55 / 0.04);
}
.pc-msg.me .pc-bubble {
  background: var(--pc-primary);
  color: var(--pc-primary-fg);
  border-bottom-right-radius: 6px;
}
.pc-time, .pc-meta { margin-top: 4px; font-size: 11px; color: var(--pc-muted); }
.pc-sys { align-self: center; font-size: 11.5px; color: var(--pc-muted); text-align: center; padding: 2px 8px; }
.pc-msg-img .pc-bubble { padding: 4px; background: var(--pc-card); border: 1px solid var(--pc-border); }
.pc-img { display: block; max-width: 200px; max-height: 200px; border-radius: 10px; object-fit: cover; }

/* 起始屏 */
.pc-start { display: flex; flex-direction: column; gap: 12px; }
.pc-start > p { margin: 0; font-size: 13.5px; line-height: 1.7; color: var(--pc-muted); }

/* 留资卡 */
.pc-lead {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--pc-border);
  border-radius: 12px;
  background: var(--pc-card);
}
.pc-lead p { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--pc-fg); }
.pc-lead input, .pc-lead textarea {
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--pc-fg);
  background: transparent;
  border: 1px solid var(--pc-border);
  border-radius: 6px;
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.pc-lead textarea { height: 64px; resize: vertical; }
.pc-lead input:focus, .pc-lead textarea:focus { border-color: var(--pc-primary); box-shadow: 0 0 0 3px rgb(var(--pc-primary-rgb) / 0.12); }
.pc-lead button {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--pc-primary);
  color: var(--pc-primary-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pc-lead button:disabled { opacity: .6; cursor: not-allowed; }

/* 快捷问题：输入框上方一排描边胶囊 */
.pc-chips {
  flex: 0 0 auto;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 4px;
  background: var(--pc-card);
}
.pc-chips.show { display: flex; }
.pc-chip {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--pc-primary);
  background: transparent;
  border: 1px solid rgb(var(--pc-primary-rgb) / 0.4);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.pc-chip:hover { background: rgb(var(--pc-primary-rgb) / 0.1); border-color: rgb(var(--pc-primary-rgb) / 0.7); }
.pc-chip.rated { color: var(--pc-muted); border-color: var(--pc-border); }

/* 满意度评价卡 */
.pc-rate {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--pc-border);
  border-radius: 12px;
  background: var(--pc-card);
}
.pc-rate-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--pc-fg); }
.pc-stars { display: flex; gap: 4px; }
.pc-star {
  padding: 0;
  width: 28px;
  height: 28px;
  font-size: 22px;
  line-height: 1;
  color: #D8DEE7;
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color .12s ease, transform .12s ease;
}
.pc-star:hover { transform: translateY(-1px); }
.pc-star.on { color: #F5A623; }
.pc-stars.done .pc-star { cursor: default; }
.pc-rate textarea {
  width: 100%;
  box-sizing: border-box;
  height: 56px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--pc-fg);
  background: transparent;
  border: 1px solid var(--pc-border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
}
.pc-rate textarea:focus { border-color: var(--pc-primary); box-shadow: 0 0 0 3px rgb(var(--pc-primary-rgb) / 0.12); }
.pc-rate button#pcRateBtn {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--pc-primary);
  color: var(--pc-primary-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.pc-rate button#pcRateBtn:disabled { opacity: .45; cursor: not-allowed; }
.pc-rate-comment { margin: 0; font-size: 12.5px; color: var(--pc-muted); }
.pc-rate-tip { margin: 0; font-size: 11.5px; color: var(--pc-muted); }

/* 输入区 */
.pc-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--pc-border);
  background: var(--pc-card);
  padding: 12px;
}
.pc-input-row { display: flex; align-items: flex-end; gap: 8px; }
.pc-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  max-height: 96px;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
  color: var(--pc-fg);
  background: transparent;
  border: 1px solid var(--pc-border);
  border-radius: 6px;
  outline: none;
  resize: none;
  overflow-y: auto;
  box-shadow: 0 1px 2px rgb(31 41 55 / 0.04);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.pc-input::placeholder { color: var(--pc-muted); }
.pc-input:focus { border-color: var(--pc-primary); box-shadow: 0 0 0 3px rgb(var(--pc-primary-rgb) / 0.14); }
.pc-attach, .pc-send {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  transition: background-color .15s ease, opacity .15s ease;
}
.pc-attach { border: 1px solid var(--pc-border); background: transparent; color: var(--pc-muted); }
.pc-attach:hover { background: var(--pc-bg); color: var(--pc-fg); }
.pc-send { border: 0; background: var(--pc-primary); color: var(--pc-primary-fg); }
.pc-send:hover { background: rgb(var(--pc-primary-rgb) / 0.9); }
.pc-send:disabled { opacity: .5; cursor: not-allowed; }
.pc-send svg { width: 16px; height: 16px; }
.pc-hint { margin-top: 8px; font-size: 11px; color: var(--pc-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.pc-hint a { color: var(--pc-primary); text-decoration: none; }

/* 轻提示 */
.pc-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 70;
  padding: 8px 14px;
  font-size: 13px;
  color: #fff;
  background: rgb(31 41 55 / 0.9);
  border-radius: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.pc-toast.show { opacity: 1; }

/* 手机：面板铺满 */
@media (max-width: 640px) {
  .pc-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .pc-panel.open { display: flex; }
  .pc-btn { right: 16px; bottom: 16px; }
  .pc-chips { padding: 10px 12px 4px; }
  .pc-foot { padding: 10px 12px 14px; }
  .pc-input { font-size: 16px; } /* 防 iOS 聚焦缩放 */
}

/* 评价标签（可多选，最多 3 个） */
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-tag {
  padding: 4px 10px;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--pc-muted);
  background: transparent;
  border: 1px solid var(--pc-border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.pc-tag:hover { border-color: rgb(var(--pc-primary-rgb) / 0.55); color: var(--pc-primary); }
.pc-tag.on { color: var(--pc-primary); border-color: rgb(var(--pc-primary-rgb) / 0.7); background: rgb(var(--pc-primary-rgb) / 0.08); }
.pc-tags.done .pc-tag { cursor: default; }
