/* 企编云 AI 业务接待：两套站点布局共用 */
.qib-ai,
.qib-ai * { box-sizing: border-box; }

.qib-ai [hidden] { display: none !important; }

.qib-ai {
  --ai-blue: #557bfa;
  --ai-ink: #172033;
  --ai-muted: #7c889b;
  position: relative;
  z-index: 310;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

.qib-ai__avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #6b8cff, #4265df);
  box-shadow: 0 8px 18px rgba(56, 91, 204, .28), inset 0 1px rgba(255, 255, 255, .22);
  font-size: 15px;
  font-style: normal;
  font-weight: 800;
}

.qib-ai__welcome {
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 312;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px solid #dce4f2;
  border-radius: 18px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 22px 65px rgba(21, 37, 73, .19);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  transition: opacity .24s ease, transform .24s ease;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.qib-ai__welcome.is-visible { opacity: 1; transform: none; }

.qib-ai__welcome-main {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 2px;
  border: 0;
  color: var(--ai-ink);
  background: transparent;
  text-align: left;
}

.qib-ai__welcome-main b,
.qib-ai__welcome-main small { display: block; }
.qib-ai__welcome-main b { font-size: 13px; }
.qib-ai__welcome-main small { margin-top: 4px; color: var(--ai-muted); font-size: 10px; line-height: 1.45; }
.qib-ai__welcome-close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #8994a5;
  background: #f2f5fa;
  font-size: 18px;
}

.qib-ai__launcher {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 311;
  display: grid;
  min-width: 172px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(132, 160, 224, .25);
  border-radius: 17px;
  color: #eef3ff;
  background: rgba(7, 13, 27, .94);
  box-shadow: 0 20px 52px rgba(0, 0, 0, .32), 0 0 28px rgba(57, 98, 229, .1);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.qib-ai__launcher b,
.qib-ai__launcher small { display: block; text-align: left; }
.qib-ai__launcher b { font-size: 12px; }
.qib-ai__launcher small { display: flex; align-items: center; gap: 5px; margin-top: 3px; color: #7f8da7; font-size: 8px; }
.qib-ai__launcher small i,
.qib-ai__head small i { width: 6px; height: 6px; border-radius: 50%; background: #42dca8; box-shadow: 0 0 9px rgba(66, 220, 168, .8); }

.qib-ai__dialog {
  position: fixed;
  inset: 0;
  z-index: 320;
}
.qib-ai__backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(3, 7, 15, .63);
  opacity: 0;
  transition: opacity .24s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.qib-ai__panel {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(420px, calc(100vw - 44px));
  max-height: min(760px, calc(100svh - 44px));
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid #dce4f0;
  border-radius: 24px;
  color: var(--ai-ink);
  background: #f6f8fc;
  box-shadow: 0 36px 110px rgba(0, 0, 0, .38);
  opacity: 0;
  transform: translateY(18px) scale(.98);
  transition: opacity .24s ease, transform .24s ease;
}
.qib-ai__dialog.is-open .qib-ai__backdrop { opacity: 1; }
.qib-ai__dialog.is-open .qib-ai__panel { opacity: 1; transform: none; }

.qib-ai__head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 15px;
  border-bottom: 1px solid rgba(127, 155, 218, .16);
  color: #eef3ff;
  background:
    radial-gradient(circle at 90% 0, rgba(78, 121, 247, .22), transparent 34%),
    linear-gradient(145deg, #0b1224, #101c36);
}
.qib-ai__head > div { display: flex; min-width: 0; align-items: center; gap: 10px; }
.qib-ai__head b,
.qib-ai__head small { display: block; }
.qib-ai__head b { font-size: 14px; }
.qib-ai__head small { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #8291ad; font-size: 8px; }
.qib-ai__head-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.qib-ai__head-actions > button {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(139, 168, 232, .18);
  border-radius: 50%;
  color: #c6d1e5;
  background: rgba(111, 139, 202, .08);
  font-size: 20px;
}
.qib-ai__head-actions > .qib-ai__transfer {
  width: auto;
  min-width: 58px;
  padding: 0 11px;
  border-radius: 10px;
  color: #dce7ff;
  background: rgba(98, 132, 220, .17);
  font-size: 10px;
  font-weight: 750;
}

.qib-ai__notice {
  padding: 8px 14px;
  color: #768399;
  border-bottom: 1px solid #e3e8f0;
  background: #eef2f8;
  font-size: 8px;
  line-height: 1.55;
}

.qib-ai__messages {
  min-height: 210px;
  padding: 15px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.qib-ai__message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 13px;
}
.qib-ai__message:first-child { margin-top: 0; }
.qib-ai__message > .qib-ai__avatar { width: 28px; height: 28px; border-radius: 9px; font-size: 10px; }
.qib-ai__message > div { max-width: calc(100% - 48px); }
.qib-ai__message p {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dfe5ef;
  border-radius: 4px 14px 14px 14px;
  color: #344056;
  background: #fff;
  box-shadow: 0 5px 16px rgba(34, 52, 88, .045);
  font-size: 12px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.qib-ai__message--user { justify-content: flex-end; }
.qib-ai__message--user > div { max-width: 82%; }
.qib-ai__message--user p {
  color: #fff;
  border-color: #5579e6;
  border-radius: 14px 4px 14px 14px;
  background: linear-gradient(135deg, #6185f5, #4a6bd8);
  box-shadow: 0 7px 18px rgba(70, 103, 205, .18);
}
.qib-ai__message--typing p { display: flex; min-width: 48px; gap: 4px; }
.qib-ai__message--typing p i { width: 5px; height: 5px; border-radius: 50%; background: #8190aa; animation: aiTyping 1s ease-in-out infinite; }
.qib-ai__message--typing p i:nth-child(2) { animation-delay: .13s; }
.qib-ai__message--typing p i:nth-child(3) { animation-delay: .26s; }

.qib-ai__contact-prompt {
  margin: 13px 0 0 36px;
  padding: 10px 11px;
  border: 1px solid #d9e2f1;
  border-radius: 12px;
  background: #edf3ff;
}
.qib-ai__contact-prompt > span { color: #50617d; font-size: 9px; line-height: 1.55; }
.qib-ai__contact-prompt > div { display: flex; gap: 7px; margin-top: 8px; }
.qib-ai__contact-prompt button { min-height: 31px; padding: 6px 10px; border: 1px solid #cdd9ee; border-radius: 9px; color: #52627c; background: #fff; font-size: 9px; }
.qib-ai__contact-prompt button:first-child { color: #fff; border-color: #5d7fe8; background: #5d7fe8; }

.qib-ai__quick {
  display: flex;
  gap: 7px;
  padding: 0 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.qib-ai__quick::-webkit-scrollbar { display: none; }
.qib-ai__quick button {
  min-height: 31px;
  flex: 0 0 auto;
  padding: 6px 10px;
  border: 1px solid #d8e0ee;
  border-radius: 99px;
  color: #51647f;
  background: #fff;
  font-size: 9px;
  white-space: nowrap;
}
.qib-ai__quick button:hover { color: #315bcf; border-color: #afc2f2; background: #f5f8ff; }

.qib-ai__composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: end;
  gap: 7px;
  margin: 0 13px;
  padding: 7px;
  border: 1px solid #d5deeb;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(31, 49, 85, .06);
}
.qib-ai__composer > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.qib-ai__composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 108px;
  padding: 10px 8px;
  resize: none;
  border: 0;
  outline: 0;
  color: #253149;
  background: transparent;
  font: 12px/1.55 inherit;
}
.qib-ai__composer textarea::placeholder { color: #a0a9b8; }
.qib-ai__composer > button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #6689ff, #4668dc);
  box-shadow: 0 8px 18px rgba(60, 94, 205, .24);
}
.qib-ai__composer > button:disabled { opacity: .55; }
.qib-ai__composer svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.qib-ai__human {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px 13px;
}
.qib-ai__human button { padding: 0; border: 0; color: #476bd5; background: transparent; font-size: 9px; font-weight: 730; }
.qib-ai__human span { color: #9aa4b4; font-size: 7px; }

.qib-ai__contact {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  padding: 15px;
  overflow-y: auto;
  border: 1px solid #dce4f0;
  border-radius: 18px;
  background: rgba(255, 255, 255, .99);
  box-shadow: 0 22px 65px rgba(20, 36, 70, .24);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.qib-ai__contact-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.qib-ai__contact-head b,
.qib-ai__contact-head small { display: block; }
.qib-ai__contact-head b { color: #1c273c; font-size: 14px; }
.qib-ai__contact-head small { margin-top: 4px; color: #7f8a9d; font-size: 9px; }
.qib-ai__contact-head button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 50%; color: #7e899a; background: #f0f3f8; font-size: 17px; }
.qib-ai__contact > input[name="website"] { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.qib-ai__contact-fields { display: grid; grid-template-columns: .8fr 1.2fr; gap: 8px; margin-top: 14px; }
.qib-ai__contact-fields label > span { display: block; margin-bottom: 6px; color: #6f7b8f; font-size: 8px; }
.qib-ai__contact-fields input {
  width: 100%;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid #d7dfeb;
  border-radius: 11px;
  outline: 0;
  color: #263147;
  background: #f8fafe;
  font-size: 16px;
}
.qib-ai__contact-fields input:focus { border-color: #7895e9; box-shadow: 0 0 0 3px rgba(84, 120, 225, .1); }
.qib-ai__consent { display: flex; align-items: flex-start; gap: 7px; margin-top: 11px; color: #7e899a; font-size: 8px; line-height: 1.55; }
.qib-ai__consent input { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; accent-color: #5578e2; }
.qib-ai__consent a { color: #456bd8; }
.qib-ai__contact-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, #6287fa, #4a6cdd);
  box-shadow: 0 9px 20px rgba(65, 99, 207, .2);
  font-size: 12px;
  font-weight: 750;
}
.qib-ai__contact-submit:disabled { opacity: .6; }
.qib-ai__contact-status { min-height: 16px; margin: 8px 0 0; color: #718097; font-size: 8px; text-align: center; }
.qib-ai__contact-status.is-error { color: #cf4252; }
.qib-ai__contact-status.is-success { color: #21966f; }

html.qib-ai-lock,
html.qib-ai-lock body { overflow: hidden !important; }

@media (max-width: 820px) {
  .qib-ai__launcher { display: none; }
  .qib-ai__welcome {
    right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    border-radius: 17px;
  }
  .qib-ai__dialog { z-index: 420; }
  .qib-ai__panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(82svh, 720px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 24px 24px 0 0;
    transform: translateY(100%);
  }
  .qib-ai__dialog.is-open .qib-ai__panel { transform: translateY(0); }
  .qib-ai__head { min-height: 68px; padding: 10px 14px; }
  .qib-ai__notice { font-size: 8px; }
  .qib-ai__messages { min-height: 190px; padding: 13px 12px; }
  .qib-ai__message p { font-size: 12px; }
  .qib-ai__quick { padding-inline: 12px; }
  .qib-ai__composer { margin-inline: 11px; }
  .qib-ai__human { padding-inline: 12px; padding-bottom: calc(11px + env(safe-area-inset-bottom)); }
  .qib-ai__contact { bottom: calc(8px + env(safe-area-inset-bottom)); max-height: calc(100% - 84px); }
}

@media (max-width: 370px) {
  .qib-ai__welcome { right: 9px; left: 9px; }
  .qib-ai__welcome-main small { font-size: 9px; }
  .qib-ai__contact-fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .qib-ai__welcome,
  .qib-ai__backdrop,
  .qib-ai__panel { transition: none; }
  .qib-ai__message--typing p i { animation: none; }
}

@keyframes aiTyping {
  0%, 70%, 100% { opacity: .35; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}
