/* webchat iframe — panel only */
html, body.webchat-only {
  margin: 0; height: 100%; overflow: hidden;
  font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: transparent;
}
body.webchat-only .kefu-panel {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  min-height: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important;
}
/* 访客浮窗 · 尺寸/色值对标合从现网 widget（自研 UI，非抄素材） */
:root {
  --tone: #2196F3;
  --tone-msg: #209cee;
  --tone-deep: #1e88e5;
  --pink: #f14668;
  --pink-deep: #e03a5c;
  --page: #fff;
  --text: #111;
  --muted: #6b7280;
  --msg-bg: #f4f6fa;
  --bubble: #ffffff;
  --line: #e8ecf1;
  --panel-w: 370px;
  --panel-max-h: 590px;
  --head-h: 75px;
  --side: 20px;
  --fab-bottom: 20px;
  --panel-bottom: 95px;
  --font: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
}

.page-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 72% 38%, rgba(33, 150, 243, 0.1), transparent 58%),
    linear-gradient(180deg, #fff 0%, #f7fbff 100%);
}

.site-header, .hero { position: relative; z-index: 1; }

.site-header {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 40px; background: #fff; border-bottom: 1px solid #f0f0f0;
}
.site-logo { display: flex; align-items: center; gap: 8px; }
.site-logo .mark {
  width: 28px; height: 28px; border-radius: 6px; background: var(--tone);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.site-logo .brand { font-size: 17px; font-weight: 700; color: #333; }
.site-nav { display: flex; gap: 28px; font-size: 14px; color: #4a4a4a; }
.site-nav a { color: inherit; text-decoration: none; }
.site-nav a:hover { color: var(--tone); }

.hero {
  max-width: 1120px; margin: 0 auto;
  padding: 72px 40px 160px;
  display: grid; grid-template-columns: minmax(280px, 400px) 1fr;
  gap: 28px; align-items: center;
  min-height: calc(100vh - 56px);
}
.hero-copy h1 {
  font-size: 40px; line-height: 1.3; margin: 0 0 18px;
  font-weight: 700; color: #111; letter-spacing: -0.02em;
}
.hero-copy p {
  font-size: 15px; color: #666; line-height: 1.85;
  margin: 0 0 28px; max-width: 380px;
}
.cta {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tone); color: #fff; border: 0;
  border-radius: 999px; padding: 12px 32px;
  font-size: 15px; font-weight: 500; font-family: inherit;
  cursor: pointer;
}
.cta:hover { background: var(--tone-deep); }

.desk-mock {
  height: 440px; border-radius: 8px; overflow: hidden;
  display: flex; background: #fff; border: 1px solid #e8ecf2;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
  opacity: 0.5; filter: blur(0.6px);
}
.desk-side {
  width: 52px; background: #26323d; display: flex; flex-direction: column;
  align-items: center; gap: 16px; padding: 18px 0;
}
.desk-side i {
  display: block; width: 20px; height: 20px; border-radius: 5px;
  background: rgba(255,255,255,.16);
}
.desk-side i:first-child { background: var(--tone); }
.desk-main {
  flex: 1; display: grid; grid-template-columns: 0.9fr 1.35fr 0.85fr;
  background: #f7f9fc;
}
.desk-col { padding: 12px; border-right: 1px solid #e8ecf2; }
.desk-col:last-child { border-right: 0; }
.desk-bar {
  height: 10px; width: 44%; border-radius: 4px; background: #dbe3f0; margin-bottom: 12px;
}
.desk-bar.wide { width: 68%; }
.desk-item {
  height: 40px; border-radius: 6px; background: #fff; border: 1px solid #e8ecf2;
  margin-bottom: 8px;
}
.desk-item.on { border-color: #b3d7fa; background: #eef6ff; }
.desk-bubble {
  height: 32px; border-radius: 4px; background: var(--bubble);
  margin-bottom: 10px; width: 70%;
}
.desk-bubble.R {
  margin-left: auto; background: #bbdefb; width: 55%;
}
.desk-bubble.short { width: 46%; height: 24px; }
.desk-card {
  height: 68px; border-radius: 6px; background: #fff; border: 1px solid #e8ecf2;
  margin-bottom: 10px;
}

/* —— FAB：合从 button size=2 + displayName —— */
.kefu-fab {
  position: fixed; right: var(--side); bottom: var(--fab-bottom); z-index: 10000;
  height: 50px; padding: 0 22px 0 16px; border: 0; border-radius: 50px;
  background: var(--pink); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 400; font-family: inherit;
  box-shadow: 0 1px 6px rgba(0,0,0,.06), 0 2px 32px rgba(0,0,0,.16);
  transition: box-shadow .15s, opacity .15s;
  user-select: none;
}
.kefu-fab:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.09), 0 4px 40px rgba(0,0,0,.24);
}
.kefu-fab:active { opacity: .95; }
.kefu-fab .ico {
  display: grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0;
}
.kefu-fab:not(.is-open) .ico svg { display: none; }
.kefu-fab:not(.is-open)::before {
  content: "";
  width: 22px; height: 22px; flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%23fff' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.5A2.5 2.5 0 016.5 4h9A2.5 2.5 0 0118 6.5v6A2.5 2.5 0 0115.5 15H9.2L5 18v-3H6.5A2.5 2.5 0 014 12.5v-6z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* —— 面板：合从 ._aihecong_chat_iframe —— */
.kefu-panel {
  position: fixed;
  right: var(--side);
  bottom: var(--panel-bottom);
  z-index: 10000;
  width: var(--panel-w);
  height: calc(100% - 20px - 75px - 20px);
  max-height: var(--panel-max-h);
  min-height: 250px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(15,23,42,.04);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn .28s cubic-bezier(.22,.61,.36,1);
}
.kefu-panel.open { display: flex; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 头栏 75px · tone */
.kefu-hd {
  height: var(--head-h);
  background: var(--tone);
  color: hsla(0, 0%, 100%, 0.95);
  padding: 0 15px 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.kefu-hd .avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  overflow: hidden; background: hsla(0, 0%, 100%, 0.8);
}
.kefu-hd .avatar svg { display: block; }
.kefu-hd .meta { flex: 1; min-width: 0; font-weight: 400; }
.kefu-hd .name-row {
  display: flex; align-items: center; gap: 8px; height: 18px;
}
.kefu-hd .name {
  font-size: 16px; font-weight: 600; line-height: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kefu-hd .online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #86efac; box-shadow: 0 0 0 2px rgba(255,255,255,.25);
  flex-shrink: 0;
}
.kefu-hd .desc {
  font-size: 12px; line-height: 18px; height: 18px;
  margin-top: 4px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
  opacity: .92;
}
.kefu-hd .hd-actions {
  display: flex; align-items: center; height: 40px; flex-shrink: 0;
}
.kefu-hd .hd-actions button {
  width: 36px; height: 40px; border: 0; background: transparent;
  color: #fff; cursor: pointer; display: grid; place-items: center;
  opacity: 1; padding: 0;
}
.kefu-hd .hd-actions button:hover { opacity: .8; }

/* 消息区 */
.kefu-bd {
  flex: 1;
  overflow: auto;
  background: var(--msg-bg);
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
}
.kefu-bd::-webkit-scrollbar { width: 4px; }
.kefu-bd::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 4px; }

.kefu-time {
  align-self: center;
  color: #a0a8b4;
  font-size: 12px;
  margin: 14px 0 2px;
  white-space: nowrap;
}

.kefu-row {
  display: flex;
  align-items: flex-start;
  margin-top: 14px;
  padding: 0 14px;
  gap: 0;
}
.kefu-row .av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  overflow: hidden; background: #e8f4ff;
  box-shadow: 0 0 0 2px #fff;
}
.kefu-row .av svg { display: block; }

.kefu-bubble {
  background: var(--bubble);
  border-radius: 14px;
  border-top-left-radius: 4px;
  color: #1f2937;
  margin-left: 0;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 100%;
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  border: 1px solid #eef1f5;
}
.kefu-bubble-wrap {
  margin-left: 10px;
  max-width: calc(100% - 48px);
  min-width: 0;
}
.kefu-who {
  font-size: 11px;
  color: #94a3b8;
  margin: 0 0 5px 2px;
  font-weight: 500;
}
.kefu-bubble.agent {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #0f172a;
}
.kefu-bubble.img { padding: 6px; background: #fff; }
.kefu-row.me .kefu-bubble.img { background: #fff; border-color: #bfdbfe; }
.kefu-img {
  display: block; max-width: 220px; max-height: 280px; border-radius: 10px;
  cursor: zoom-in; object-fit: contain;
}
.kefu-system {
  align-self: center;
  margin: 12px 16px 0;
  padding: 6px 12px;
  font-size: 12px;
  color: #64748b;
  background: #eef2f7;
  border-radius: 999px;
  text-align: center;
  max-width: 90%;
}
.kefu-bubble .hi {
  padding: 0 0 10px;
  color: #1f2937;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 10px;
  line-height: 1.55;
}
.kefu-faq {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kefu-faq button {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1e40af;
  font-size: 13px;
  padding: 8px 12px;
  cursor: pointer;
  line-height: 1.45;
  font-family: inherit;
  border-radius: 10px;
  transition: background .15s, border-color .15s;
}
.kefu-faq button:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  text-decoration: none;
  opacity: 1;
}

/* 访客消息靠右；勿用 row-reverse+flex-end（会把气泡推回左侧） */
.kefu-row.me {
  justify-content: flex-end;
}
.kefu-row.me .kefu-bubble-wrap {
  margin-left: auto;
  margin-right: 0;
  max-width: 78%;
}
.kefu-row.me .kefu-bubble {
  background: var(--tone-msg);
  color: #fff;
  margin-left: 0;
  margin-right: 0;
  max-width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 14px;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.22);
}
.kefu-row.me .kefu-bubble .hi { padding: 0; color: #fff; border: 0; margin: 0; }

/* 底栏：胶囊 + 输入 */
.kefu-send-wrap {
  position: relative;
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid var(--line);
}

.kefu-chips {
  position: static;
  height: auto;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 0;
  overflow-x: auto;
  pointer-events: auto;
  background: #fff;
}
.kefu-chips:empty { display: none; }
.kefu-chips button {
  pointer-events: auto;
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #f8fafc;
  color: #374151;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  margin: 0;
}
.kefu-chips button:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--tone);
}

.kefu-ft {
  background: #fff;
  position: relative;
  padding: 0 0 10px;
}
.kefu-ft::before { display: none; }
.kefu-ft textarea {
  width: 100%;
  border: 0 !important;
  outline: none;
  resize: none;
  min-height: 52px;
  max-height: 100px;
  font-size: 14px;
  font-family: inherit;
  color: #333;
  background: #fff;
  padding: 12px 15px 4px;
  line-height: 1.5;
}
.kefu-ft textarea::placeholder { color: #adb5bd; }
.kefu-ft .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 10px 0 8px;
}
.kefu-ft .tools { display: flex; align-items: center; gap: 2px; }
.kefu-ft .tools button {
  height: 32px; border: 0; background: transparent;
  color: #64748b; cursor: pointer; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 4px; padding: 0 10px;
  font-size: 12px; font-family: inherit;
}
.kefu-ft .tools button svg { display: block; flex-shrink: 0; }
.kefu-ft .tools button:hover { color: var(--tone); background: #f0f7ff; }
.kefu-ft .tools button:disabled { opacity: .4; cursor: not-allowed; }

.kefu-waiting {
  align-self: flex-start;
  margin: 12px 15px 0 58px;
  display: inline-flex; align-items: center; gap: 4px; padding: 10px 14px;
  background: #fff; border: 1px solid #eef1f5; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kefu-waiting .kefu-thinking-t {
  margin-left: 6px; font-style: normal; font-size: 12px; color: #94a3b8;
}
.kefu-waiting span {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: waitDot 1.2s infinite ease-in-out;
}
.kefu-waiting span:nth-child(2) { animation-delay: .15s; }
.kefu-waiting span:nth-child(3) { animation-delay: .3s; }
@keyframes waitDot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.kefu-rate .rate-again {
  margin-top: 10px; border: 1px solid var(--tone); background: #fff; color: var(--tone);
  border-radius: 8px; height: 32px; padding: 0 14px; cursor: pointer; font-size: 13px;
}

.kefu-send {
  border: 0;
  background: var(--tone);
  color: #fff;
  border-radius: 8px;
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  line-height: 32px;
  box-shadow: 0 2px 8px rgba(33, 150, 243, 0.28);
}
.kefu-send:hover { opacity: .92; }
.kefu-send:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.kefu-loading {
  align-self: center;
  margin-top: 40px;
  color: #94a3b8;
  font-size: 13px;
}
.kefu-status {
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 7px 10px;
  border-top: 1px solid #eef2f7;
}
.kefu-rate {
  flex-shrink: 0;
  text-align: center;
  padding: 14px 12px;
  background: #fff;
  border-top: 1px solid #e5e8ef;
}
.kefu-rate .rate-title { font-size: 14px; margin-bottom: 10px; color: #111; }
.kefu-rate .rate-stars { display: flex; justify-content: center; gap: 6px; }
.kefu-rate .rate-stars button {
  border: 0; background: transparent; font-size: 26px; color: #cbd5e1; cursor: pointer; line-height: 1; padding: 0 2px;
}
.kefu-rate .rate-stars button:hover,
.kefu-rate .rate-stars button:focus { color: #f59e0b; }
.kefu-rate .rate-tip { margin-top: 8px; font-size: 12px; color: #94a3b8; }

.kefu-leave {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15,23,42,.35);
  display: flex; align-items: flex-end; justify-content: center;
}
.kefu-leave-card {
  width: min(420px, 100%); background: #fff; border-radius: 16px 16px 0 0;
  padding: 18px 16px 20px; box-shadow: 0 -8px 32px rgba(15,23,42,.15);
}
.kefu-leave-hd { font-weight: 700; font-size: 16px; }
.kefu-leave-tip { margin: 6px 0 12px; font-size: 12px; color: #64748b; }
.kefu-leave input, .kefu-leave textarea {
  width: 100%; box-sizing: border-box; margin-bottom: 8px;
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 14px;
}
.kefu-leave-ops { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.kefu-leave-ops button {
  border: 1px solid #e2e8f0; background: #fff; border-radius: 999px;
  padding: 8px 16px; font: inherit; cursor: pointer;
}
.kefu-leave-ops button.ok { background: #2196f3; border-color: #2196f3; color: #fff; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding: 40px 24px 160px; }
  .hero-copy h1 { font-size: 28px; }
  .desk-mock { display: none; }
  .site-header { padding: 0 16px; }
  .site-nav { gap: 14px; font-size: 13px; }
}
@media (max-width: 480px) {
  .kefu-panel {
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    height: 95%;
    max-height: none;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .kefu-fab { right: 16px; bottom: 16px; }
}

/* 访客咨询记录面板 */
.kefu-hist {
  display: none;
  position: absolute;
  inset: 56px 0 0 0;
  z-index: 20;
  background: #fff;
  flex-direction: column;
}
.kefu-hist.open { display: flex; }
.kefu-hist .hist-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.kefu-hist .hist-hd button {
  border: 0;
  background: transparent;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
.kefu-hist .hist-list {
  flex: 1;
  overflow: auto;
  padding: 8px;
}
.kefu-hist .hist-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #eef2f7;
  background: #fafbfc;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  font: inherit;
}
.kefu-hist .hist-item:hover,
.kefu-hist .hist-item.on {
  border-color: #bbdefb;
  background: #f0f7ff;
}
.kefu-hist .hist-t {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}
.kefu-hist .hist-t span { font-weight: 600; color: #1e88e5; }
.kefu-hist .hist-p {
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kefu-hist .hist-m { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.kefu-hist .hist-tip {
  padding: 10px 14px 14px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
  border-top: 1px solid #f1f5f9;
}
.kefu-hist .hist-loading,
.kefu-hist .hist-empty {
  padding: 40px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
