.spai-bubble{
  position:fixed; right:22px; bottom:22px; z-index:99999;
  width:58px; height:58px; border-radius:999px; border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(135deg,#7c6dfa,#4fd1c5); color:#fff;
  display:flex; align-items:center; justify-content:center; cursor:pointer;
  box-shadow:0 18px 50px rgba(0,0,0,.35), 0 0 0 7px rgba(124,109,250,.12);
  transition:.2s transform,.2s box-shadow;
}
.spai-bubble:hover{transform:translateY(-2px) scale(1.03)}
.spai-bubble.is-open .spai-bubble-icon{transform:rotate(10deg)}
.spai-bubble-icon{font-size:24px; transition:.2s transform}
.spai-bubble-dot{
  position:absolute; right:5px; top:5px; width:13px; height:13px; border-radius:50%;
  background:#ff4d6d; border:2px solid #080810;
}
.spai-panel{
  position:fixed; right:22px; bottom:92px; z-index:99998;
  width:min(390px, calc(100vw - 24px)); height:min(620px, calc(100vh - 120px));
  border-radius:24px; overflow:hidden; border:1px solid rgba(255,255,255,.12);
  background:#0f0f1a; color:#f0f0f8;
  box-shadow:0 24px 80px rgba(0,0,0,.45);
  display:flex; flex-direction:column;
}
.spai-panel[hidden], .spai-nudge[hidden]{display:none!important}
.spai-head{display:flex; gap:12px; align-items:center; padding:15px 16px; background:#161625; border-bottom:1px solid rgba(255,255,255,.08)}
.spai-avatar{width:38px;height:38px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#7c6dfa,#4fd1c5);font-size:18px;flex:0 0 auto}
.spai-head-text{min-width:0; flex:1}
.spai-title{font-weight:800;font-size:14px;line-height:1.2}
.spai-subtitle{font-size:12px;color:rgba(240,240,248,.52);line-height:1.25;margin-top:2px}
.spai-close,.spai-minimize{
  width:34px;height:34px;border-radius:12px;border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.04);color:rgba(240,240,248,.75);
  font-size:24px;cursor:pointer;line-height:1;display:flex;align-items:center;justify-content:center;flex:0 0 auto
}
.spai-minimize{font-size:28px;padding-bottom:3px}
.spai-close:hover,.spai-minimize:hover{background:rgba(124,109,250,.18);color:#fff}
.spai-messages{flex:1; overflow:auto; padding:16px; display:flex; flex-direction:column; gap:10px; scroll-behavior:smooth}
.spai-msg{max-width:88%; padding:11px 13px; border-radius:16px; font-size:14px; line-height:1.48; white-space:pre-wrap}
.spai-user{align-self:flex-end; background:#7c6dfa; color:#fff; border-bottom-right-radius:6px}
.spai-bot{align-self:flex-start; background:#1b1b2d; color:#f0f0f8; border:1px solid rgba(255,255,255,.07); border-bottom-left-radius:6px}
.spai-chips{display:flex; gap:7px; overflow-x:auto; padding:10px 12px; border-top:1px solid rgba(255,255,255,.08)}
.spai-chips button{
  white-space:nowrap; border:1px solid rgba(124,109,250,.28); background:rgba(124,109,250,.12); color:#dcd8ff;
  border-radius:999px; padding:8px 10px; cursor:pointer; font-size:12px
}
.spai-form{display:flex; gap:8px; padding:12px; border-top:1px solid rgba(255,255,255,.08); background:#0f0f1a}
.spai-input{
  flex:1; resize:none; min-height:42px; max-height:110px; border-radius:16px; border:1px solid rgba(255,255,255,.1);
  background:#080810; color:#f0f0f8; padding:10px 12px; outline:none; font-size:14px;
}
.spai-input:focus{border-color:#7c6dfa; box-shadow:0 0 0 3px rgba(124,109,250,.14)}
.spai-send{
  width:44px;height:44px;border-radius:16px;border:0;background:#7c6dfa;color:#fff;cursor:pointer;font-weight:800
}
.spai-typing{align-self:flex-start;display:flex;gap:5px;padding:12px 14px;background:#1b1b2d;border-radius:16px;border-bottom-left-radius:6px}
.spai-typing span{width:7px;height:7px;background:rgba(240,240,248,.55);border-radius:50%;animation:spaiTyping 1.1s infinite}
.spai-typing span:nth-child(2){animation-delay:.15s}
.spai-typing span:nth-child(3){animation-delay:.3s}
@keyframes spaiTyping{0%,80%,100%{transform:translateY(0);opacity:.45}40%{transform:translateY(-5px);opacity:1}}
.spai-handoff{align-self:flex-start;max-width:92%;background:rgba(79,209,197,.08);border:1px solid rgba(79,209,197,.25);padding:12px;border-radius:16px;color:#d9fffb;font-size:13px}
.spai-handoff-note{font-size:12px;color:rgba(217,255,251,.72);margin-top:4px}
.spai-handoff-links{display:flex;gap:8px;flex-wrap:wrap;margin-top:9px}
.spai-handoff a{display:inline-flex;text-decoration:none;color:#071014;background:#4fd1c5;border-radius:999px;padding:7px 10px;font-weight:800}
.spai-nudge{
  position:fixed; right:22px; bottom:92px; z-index:99997;
  width:min(310px, calc(100vw - 28px)); border-radius:18px; padding:14px 38px 14px 15px;
  background:#10101b; color:#f0f0f8; border:1px solid rgba(124,109,250,.28);
  box-shadow:0 20px 70px rgba(0,0,0,.36), 0 0 0 6px rgba(124,109,250,.08);
  cursor:pointer; animation:spaiNudge .35s ease-out;
}
@keyframes spaiNudge{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}
.spai-nudge-title{font-size:13px;font-weight:900;margin-bottom:2px;color:#fff}
.spai-nudge-text{font-size:12.5px;line-height:1.35;color:rgba(240,240,248,.68)}
.spai-nudge-close{
  position:absolute;right:8px;top:8px;width:24px;height:24px;border-radius:9px;border:0;background:rgba(255,255,255,.08);
  color:#fff;cursor:pointer;font-size:18px;line-height:1
}
body.sitepro-theme-light .spai-panel{background:#fff;color:#101020;border-color:rgba(10,10,25,.12)}
body.sitepro-theme-light .spai-head{background:#f5f7fb;border-color:rgba(10,10,25,.08)}
body.sitepro-theme-light .spai-bot{background:#f4f6fb;color:#101020;border-color:rgba(10,10,25,.08)}
body.sitepro-theme-light .spai-input{background:#fff;color:#101020;border-color:rgba(10,10,25,.12)}
body.sitepro-theme-light .spai-form{background:#fff;border-color:rgba(10,10,25,.08)}
body.sitepro-theme-light .spai-subtitle{color:rgba(10,10,25,.55)}
body.sitepro-theme-light .spai-nudge{background:#fff;color:#101020;border-color:rgba(124,109,250,.22)}
body.sitepro-theme-light .spai-nudge-title{color:#101020}
body.sitepro-theme-light .spai-nudge-text{color:rgba(10,10,25,.65)}
body.sitepro-theme-light .spai-close, body.sitepro-theme-light .spai-minimize{color:rgba(10,10,25,.65);border-color:rgba(10,10,25,.08);background:rgba(10,10,25,.04)}
@media (max-width:560px){
  .spai-bubble{right:14px;bottom:14px;width:54px;height:54px}
  .spai-panel{right:10px;left:10px;bottom:78px;width:auto;height:min(590px, calc(100vh - 96px));border-radius:20px}
  .spai-nudge{right:14px;bottom:78px;width:calc(100vw - 28px)}
  .spai-msg{font-size:13.5px}
  .spai-title{font-size:13.5px}
}
.spai-msg-link{
  display:inline-flex;
  align-items:center;
  width:fit-content;
  margin-top:8px;
  padding:8px 11px;
  border-radius:999px;
  background:rgba(79,209,197,.14);
  color:#9ff7ef!important;
  border:1px solid rgba(79,209,197,.28);
  text-decoration:none!important;
  font-weight:800;
  font-size:13px;
}
.spai-msg-link:hover{background:rgba(79,209,197,.24);transform:translateY(-1px)}
body.sitepro-theme-light .spai-msg-link{
  background:rgba(15,160,180,.10);
  color:#087f91!important;
  border-color:rgba(15,160,180,.25);
}


/* v1.5 mobile keyboard fix and structured contact form */
:root{--spai-vvh:100vh;--spai-vvoffset:0px}
@media (max-width:560px){
  .spai-panel{
    height:min(590px, calc(var(--spai-vvh, 100vh) - 96px));
    max-height:calc(var(--spai-vvh, 100vh) - 96px);
  }
  #sitepro-ai-chat-root.spai-keyboard-open .spai-panel{
    top:calc(var(--spai-vvoffset, 0px) + 6px);
    bottom:6px;
    height:auto;
    max-height:none;
  }
  #sitepro-ai-chat-root.spai-keyboard-open .spai-head{padding-top:10px;padding-bottom:10px}
  #sitepro-ai-chat-root.spai-keyboard-open .spai-messages{padding-top:10px;padding-bottom:10px}
  #sitepro-ai-chat-root.spai-keyboard-open .spai-chips{padding-top:7px;padding-bottom:7px}
  #sitepro-ai-chat-root.spai-keyboard-open .spai-form{padding:8px}
  #sitepro-ai-chat-root.spai-keyboard-open .spai-bubble,
  #sitepro-ai-chat-root.spai-keyboard-open .spai-nudge{display:none!important}
}
.spai-contact-form-card{
  align-self:stretch;border:1px solid rgba(124,109,250,.28);background:rgba(124,109,250,.08);
  border-radius:18px;padding:13px;color:#f0f0f8
}
.spai-form-title{font-weight:900;font-size:14px;margin-bottom:4px}
.spai-form-sub{color:rgba(240,240,248,.58);font-size:12px;line-height:1.35;margin-bottom:10px}
.spai-contact-form-card label{display:block;font-size:12px;color:rgba(240,240,248,.62);margin:8px 0}
.spai-contact-form-card small{color:rgba(240,240,248,.38);font-weight:400}
.spai-contact-form-card input{
  width:100%;margin-top:4px;border:1px solid rgba(255,255,255,.12);background:#080810;color:#f0f0f8;
  border-radius:13px;padding:10px 11px;font-size:14px;outline:none
}
.spai-contact-form-card input:focus{border-color:#7c6dfa;box-shadow:0 0 0 3px rgba(124,109,250,.14)}
.spai-contact-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.spai-contact-submit{
  width:100%;border:0;border-radius:14px;padding:12px 14px;background:#7c6dfa;color:#fff;
  font-weight:900;cursor:pointer;margin-top:6px
}
@media (max-width:420px){.spai-contact-grid{grid-template-columns:1fr}}
body.sitepro-theme-light .spai-contact-form-card{background:rgba(124,109,250,.06);color:#101020;border-color:rgba(124,109,250,.22)}
body.sitepro-theme-light .spai-form-sub,body.sitepro-theme-light .spai-contact-form-card label{color:rgba(10,10,25,.62)}
body.sitepro-theme-light .spai-contact-form-card small{color:rgba(10,10,25,.42)}
body.sitepro-theme-light .spai-contact-form-card input{background:#fff;color:#101020;border-color:rgba(10,10,25,.12)}

/* v1.6 send handler fix */
.spai-send:disabled{opacity:.55;cursor:wait}
.spai-contact-form-card{scroll-margin-bottom:16px}

/* v1.7 smooth answer scroll */
@media (prefers-reduced-motion: reduce){
  .spai-messages{scroll-behavior:auto!important}
}

/* v1.8 user-controlled scroll */
.spai-new-msg{
  position:fixed;
  right:34px;
  bottom:104px;
  z-index:99999;
  border:1px solid rgba(79,209,197,.34);
  background:linear-gradient(135deg,rgba(79,209,197,.95),rgba(124,109,250,.95));
  color:#fff;
  border-radius:999px;
  padding:9px 13px;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
  box-shadow:0 16px 40px rgba(0,0,0,.28);
}
.spai-new-msg[hidden]{display:none!important}
.spai-messages{
  overscroll-behavior:contain;
}
.spai-messages:hover{
  scroll-behavior:smooth;
}
@media (max-width:560px){
  .spai-new-msg{
    right:24px;
    bottom:88px;
  }
  #sitepro-ai-chat-root.spai-keyboard-open .spai-new-msg{
    display:none!important;
  }
}
body.sitepro-theme-light .spai-new-msg{
  color:#fff;
  box-shadow:0 14px 36px rgba(10,10,25,.18);
}

/* v1.9 contact confirmation fix */
.spai-bot strong{color:#fff}
body.sitepro-theme-light .spai-bot strong{color:#101020}

/* v2.0 single lead and form focus */
.spai-contact-form-card{
  scroll-margin-top:72px;
  scroll-margin-bottom:92px;
}
.spai-contact-form-card input:focus{
  outline:0;
  border-color:#4fd1c5;
  box-shadow:0 0 0 3px rgba(79,209,197,.18), 0 12px 30px rgba(0,0,0,.12);
}
#sitepro-ai-chat-root.spai-keyboard-open .spai-contact-form-card{
  margin-bottom:8px;
}
.spai-msg.spai-bot{
  overflow-wrap:anywhere;
}

/* v4 beauty theme */
.spai-bubble,.spai-avatar,.spai-send,.spai-contact-submit{background:#8d2433}
.spai-bubble{border-radius:8px;box-shadow:0 18px 45px rgba(36,25,22,.22),0 0 0 5px rgba(141,36,51,.12)}
.spai-panel{border-radius:8px;background:#201b1b;color:#fffdfb}
.spai-head{background:#171313}
.spai-user{background:#8d2433}
.spai-bot{background:#312929}
.spai-chips button{border-color:rgba(242,203,209,.28);background:rgba(242,203,209,.1);color:#f6dce0;border-radius:6px}
.spai-input{border-radius:6px;background:#151212}
.spai-send{border-radius:6px}
.spai-nudge{border-radius:8px;background:#201b1b;border-color:rgba(141,36,51,.45);box-shadow:0 20px 60px rgba(36,25,22,.25)}
.spai-contact-form-card{border-radius:8px;border-color:rgba(242,203,209,.24);background:rgba(242,203,209,.07)}
.spai-contact-form-card input{border-radius:6px;background:#151212}
.spai-contact-submit{border-radius:6px}
.spai-contact-form-card input:focus,.spai-input:focus{border-color:#d58b97;box-shadow:0 0 0 3px rgba(213,139,151,.16)}
.spai-new-msg{border-color:#8d2433;background:#8d2433;border-radius:6px}
