/* 全站知识库问答：固定在视口右下角，不受页面滚动与各页面布局影响。 */
:root {
  --kb-paper: #fffdf9;
  --kb-ink: #2d4156;
  --kb-muted: #778495;
  --kb-navy: #082d54;
  --kb-navy-2: #0d3c68;
  --kb-gold: #f2c66e;
  --kb-gold-deep: #bd883d;
  --kb-red: #dc161c;
  --kb-line: rgba(190, 140, 78, .52);
}

.knowledge-chat-launcher {
  position: fixed;
  z-index: 1200;
  right: 22px;
  bottom: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 110px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff7e8;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  touch-action: none;
  user-select: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.knowledge-chat-launcher[hidden] { display: none !important; }
.knowledge-chat-launcher:hover { box-shadow: none; transform: translateY(-3px); }
.knowledge-chat-launcher.is-dragging { cursor: grabbing; transform: none; transition: none; }
.knowledge-chat-launcher::after { position: absolute; right: calc(100% + 12px); bottom: 5px; padding: 6px 9px; border-radius: 4px; color: #fff; background: #082d54; content: "在线咨询"; font-size: 13px; font-weight: 600; line-height: 1.25; opacity: 0; pointer-events: none; transform: translateX(4px); transition: opacity .18s ease, transform .18s ease; white-space: nowrap; }
.knowledge-chat-launcher:hover::after,
.knowledge-chat-launcher:focus-visible::after { opacity: 1; transform: translateX(0); }
.knowledge-chat-launcher__mascot { position: absolute; right: -4px; bottom: 42px; width: 52px; height: auto; filter: drop-shadow(0 4px 5px rgba(8, 45, 84, .14)); }
.knowledge-chat-launcher:focus-visible,
.knowledge-chat-window button:focus-visible { outline: 2px solid var(--kb-gold); outline-offset: 2px; }
.knowledge-chat-window__avatar { display: grid; border: 1px solid var(--kb-gold); border-radius: 50%; background: rgba(255, 255, 255, .06); place-items: center; }
.knowledge-chat-launcher__mark { position: absolute; right: 2px; bottom: 0; display: grid; width: 48px; height: 48px; color: var(--kb-gold); background: transparent; place-items: center; }
.knowledge-chat-launcher__mark svg { width: 64px; height: 48px; stroke: currentColor; }
.knowledge-chat-launcher__dot { width: 7px; height: 7px; margin-left: 2px; border-radius: 50%; background: #77d59a; box-shadow: 0 0 0 3px rgba(119, 213, 154, .14); }

.knowledge-chat-window {
  position: fixed;
  z-index: 1201;
  right: 28px;
  bottom: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(390px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px));
  overflow: hidden;
  border: 1px solid var(--kb-line);
  border-radius: 10px;
  color: var(--kb-ink);
  background: var(--kb-paper);
  box-shadow: 0 20px 52px rgba(15, 37, 59, .21);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease;
}
.knowledge-chat-window[hidden] { display: none !important; }
.knowledge-chat-window.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.knowledge-chat-window.is-instant { transition: none; }
.knowledge-chat-window__head { position: relative; display: flex; align-items: center; min-height: 92px; padding: 18px 17px; overflow: hidden; color: #fff; background: var(--kb-navy); }
.knowledge-chat-window__head::after { position: absolute; right: -30px; bottom: -35px; width: 160px; height: 90px; border: 1px solid rgba(242, 198, 110, .22); border-radius: 50%; content: ""; transform: rotate(-25deg); }
.knowledge-chat-window__avatar { z-index: 1; width: 46px; height: 46px; flex: 0 0 auto; margin-right: 12px; }
.knowledge-chat-window__avatar svg { width: 25px; height: 25px; stroke: var(--kb-gold); }
.knowledge-chat-window__title { z-index: 1; min-width: 0; }
.knowledge-chat-window__title b { display: block; color: #fff6e3; font-size: 17px; font-weight: 600; }
.knowledge-chat-window__title span { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #c6d5e1; font-size: 12px; }
.knowledge-chat-window__title i { width: 6px; height: 6px; border-radius: 50%; background: #7ad09b; }
.knowledge-chat-window__controls { z-index: 1; display: flex; gap: 4px; margin-left: auto; }
.knowledge-chat-window__icon-button { display: grid; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 5px; color: #f8d89d; background: transparent; cursor: pointer; place-items: center; }
.knowledge-chat-window__icon-button:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.knowledge-chat-window__icon-button svg { width: 18px; height: 18px; stroke: currentColor; }
.knowledge-chat-window__body { overflow-y: auto; padding: 20px 17px 14px; scrollbar-color: rgba(190, 140, 78, .5) transparent; scrollbar-width: thin; }
.knowledge-chat-window__intro { display: flex; gap: 10px; margin-bottom: 18px; }
.knowledge-chat-window__mini-avatar { display: grid; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; color: var(--kb-navy); background: #f7dfaf; font-size: 14px; font-weight: 700; place-items: center; }
.knowledge-chat-window__message { max-width: 86%; padding: 12px 14px; border-radius: 4px 11px 11px 11px; color: #405267; background: #f1ede6; font-size: 14px; line-height: 1.7; }
.knowledge-chat-window__message p { margin: 0 0 11px; }
.knowledge-chat-window__message p:last-child { margin-bottom: 0; }
.knowledge-chat-window__message .knowledge-chat-window__answer-note { margin-bottom: 12px; color: #a39a8d; font-size: 11px; line-height: 1.45; }
.knowledge-chat-window__message ol { margin: 2px 0 11px; padding-left: 22px; }
.knowledge-chat-window__message li { margin: 6px 0; padding-left: 2px; }
.knowledge-chat-window__message li::marker { color: #b87932; font-weight: 700; }
.knowledge-chat-window__message strong { color: var(--kb-navy); font-weight: 700; }
.knowledge-chat-window__source { display: flex; align-items: center; gap: 7px; margin-top: 9px; color: #ad7734; font-size: 12px; }
.knowledge-chat-window__source svg { width: 14px; height: 14px; stroke: currentColor; }
.knowledge-chat-window__section-label { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; color: var(--kb-gold-deep); font-size: 12px; font-weight: 700; letter-spacing: .7px; }
.knowledge-chat-window__section-label::after { height: 1px; flex: 1; background: rgba(201, 154, 67, .35); content: ""; }
.knowledge-chat-window__quick-list { display: grid; gap: 8px; }
.knowledge-chat-window__quick-question { display: flex; align-items: center; width: 100%; padding: 10px 11px; border: 1px solid rgba(190, 140, 78, .38); border-radius: 7px; color: #35495e; background: #fffdf9; cursor: pointer; font: inherit; font-size: 13px; text-align: left; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.knowledge-chat-window__quick-question span { display: grid; width: 23px; height: 23px; flex: 0 0 auto; margin-right: 9px; border-radius: 50%; color: #ad7734; background: #f9e7be; font-size: 12px; font-weight: 700; place-items: center; }
.knowledge-chat-window__quick-question em { margin-left: auto; color: var(--kb-gold-deep); font-size: 18px; font-style: normal; font-weight: 300; }
.knowledge-chat-window__quick-question:hover { border-color: var(--kb-gold-deep); background: #fffaf0; transform: translateX(3px); }
.knowledge-chat-window__intro,
.knowledge-chat-window__section-label,
.knowledge-chat-window__quick-question { opacity: 0; transform: translateX(-16px); }
.knowledge-chat-window.is-revealed .knowledge-chat-window__intro { animation: kb-content-reveal .42s ease-out .04s forwards; }
.knowledge-chat-window.is-revealed .knowledge-chat-window__section-label { animation: kb-content-reveal .38s ease-out .14s forwards; }
.knowledge-chat-window.is-revealed .knowledge-chat-window__quick-question:nth-child(1) { animation: kb-content-reveal .38s ease-out .20s forwards; }
.knowledge-chat-window.is-revealed .knowledge-chat-window__quick-question:nth-child(2) { animation: kb-content-reveal .38s ease-out .27s forwards; }
.knowledge-chat-window.is-revealed .knowledge-chat-window__quick-question:nth-child(3) { animation: kb-content-reveal .38s ease-out .34s forwards; }
.knowledge-chat-window.is-revealed .knowledge-chat-window__quick-question:nth-child(4) { animation: kb-content-reveal .38s ease-out .41s forwards; }
.knowledge-chat-window.is-reveal-complete .knowledge-chat-window__intro,
.knowledge-chat-window.is-reveal-complete .knowledge-chat-window__section-label,
.knowledge-chat-window.is-reveal-complete .knowledge-chat-window__quick-question { opacity: 1; transform: translateX(0); animation: none; }
.knowledge-chat-window.is-reveal-complete .knowledge-chat-window__quick-question:hover { transform: translateX(3px); }
@keyframes kb-content-reveal { to { opacity: 1; transform: translateX(0); } }
.knowledge-chat-window__user-row { display: flex; justify-content: flex-end; margin-top: 17px; }
.knowledge-chat-window__user-message { max-width: 83%; padding: 10px 13px; border-radius: 10px 4px 10px 10px; color: #fff; background: var(--kb-navy-2); font-size: 14px; line-height: 1.55; }
.knowledge-chat-window__assistant-row { display: flex; gap: 9px; margin-top: 17px; }
.knowledge-chat-window__assistant-row .knowledge-chat-window__message { max-width: calc(100% - 35px); }
.knowledge-chat-window__typing { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 9px 12px; border-radius: 4px 10px 10px 10px; background: #f1ede6; }
.knowledge-chat-window__typing i { width: 5px; height: 5px; border-radius: 50%; background: #a4acb2; animation: kb-dot 1s infinite ease-in-out; }
.knowledge-chat-window__typing i:nth-child(2) { animation-delay: .15s; }.knowledge-chat-window__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes kb-dot { 50% { transform: translateY(-3px); opacity: .55; } }
.knowledge-chat-window__composer { padding: 12px 14px 14px; border-top: 1px solid rgba(190, 140, 78, .26); background: #fffdf9; }
.knowledge-chat-window__composer-inner { display: flex; align-items: flex-end; gap: 7px; padding: 7px 7px 7px 12px; border: 1px solid rgba(190, 140, 78, .52); border-radius: 8px; background: #fff; }
.knowledge-chat-window__textarea { width: 100%; height: 37px; padding: 7px 0; border: 0; outline: 0; resize: none; color: var(--kb-ink); background: transparent; font: 14px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif; }
.knowledge-chat-window__textarea:focus-visible { outline: 0; }
.knowledge-chat-window__textarea::placeholder { color: #9aa4ac; }
.knowledge-chat-window__send { display: grid; width: 38px; height: 38px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 6px; color: #fff; background: var(--kb-red); cursor: pointer; place-items: center; transition: background .18s ease, transform .18s ease; }
.knowledge-chat-window__send:hover:not(:disabled) { background: #bd1117; transform: translateY(-1px); }
.knowledge-chat-window__send:disabled { opacity: .56; cursor: wait; }
.knowledge-chat-window__send svg { width: 18px; height: 18px; stroke: currentColor; }
.knowledge-chat-window__note { margin: 8px 0 0; color: #a1a6a5; font-size: 11px; text-align: center; }

@media (max-width: 520px) {
  .knowledge-chat-launcher { right: 15px; bottom: max(16px, env(safe-area-inset-bottom)); width: 48px; height: 102px; }
  .knowledge-chat-launcher__mascot { width: 46px; bottom: 42px; }
  .knowledge-chat-launcher__mark { right: 1px; }
  .knowledge-chat-launcher::after { display: none; }
  .knowledge-chat-window { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); width: calc(100vw - 32px); height: min(650px, calc(100vh - 32px)); }
  .knowledge-chat-window__head { min-height: 68px; padding: 11px 14px; }
  .knowledge-chat-window__head::after { right: -26px; bottom: -39px; width: 128px; height: 70px; }
  .knowledge-chat-window__avatar { width: 36px; height: 36px; margin-right: 10px; }
  .knowledge-chat-window__avatar svg { width: 20px; height: 20px; }
  .knowledge-chat-window__title b { font-size: 15px; }
  .knowledge-chat-window__title span { gap: 5px; margin-top: 3px; font-size: 10px; }
  .knowledge-chat-window__title i { width: 5px; height: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .knowledge-chat-launcher, .knowledge-chat-window, .knowledge-chat-window__quick-question, .knowledge-chat-window__send { transition: none; }
  .knowledge-chat-window__typing i { animation: none; }
  .knowledge-chat-window__intro, .knowledge-chat-window__section-label, .knowledge-chat-window__quick-question { opacity: 1; transform: none; animation: none !important; }
}
