/* ============================================================
   Smart PGs — Assistant (chatbot) widget
   ============================================================ */
.spg-chat { --c-green:#17402D; --c-green-deep:#0F251A; --c-gold:#C4A05A; --c-gold-deep:#9E7B34; --c-cream:#F5F0E6; --c-card:#FBF8F1; --c-ink:#13251C; --c-muted:#5E6259; --c-wa:#1FA855; font-family:'Manrope',system-ui,sans-serif; }

/* ---- launcher (lives inside .fab-stack — colours are self-contained,
       NOT via --c-* vars, because it's moved outside .spg-chat) ---- */
.spg-launch {
  position: relative; width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(145deg, #1C5138 0%, #17402D 55%, #0F251A 100%);
  color: #E7C883;
  border: 2px solid rgba(196, 160, 90, .95); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 18px 40px -12px rgba(19, 37, 28, .9), 0 4px 12px -4px rgba(0, 0, 0, .35);
  transition: transform .18s ease, box-shadow .2s ease, filter .2s ease;
}
.spg-launch:hover { transform: translateY(-3px) scale(1.05); filter: brightness(1.08); box-shadow: 0 24px 48px -12px rgba(19, 37, 28, .95); }
.spg-launch:focus-visible { outline: 3px solid rgba(196, 160, 90, .9); outline-offset: 3px; }
.spg-launch svg { width: 30px; height: 30px; }
.spg-launch__ring { position: absolute; inset: -2px; border-radius: 50%; box-shadow: 0 0 0 0 rgba(196, 160, 90, .6); animation: spg-ring 2.6s infinite; pointer-events: none; }
@keyframes spg-ring { 0% { box-shadow: 0 0 0 0 rgba(196, 160, 90, .55); } 70% { box-shadow: 0 0 0 16px rgba(196, 160, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(196, 160, 90, 0); } }
.spg-launch__badge { position: absolute; top: -4px; right: -4px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 999px; background: #E4572E; color: #fff; font-size: 11.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid #F5F0E6; box-shadow: 0 2px 6px -1px rgba(0,0,0,.3); }

/* teaser bubble */
.spg-teaser {
  position: fixed; right: 22px; bottom: 150px; z-index: 96; max-width: 232px;
  background: #fff; color: var(--c-ink); border: 1px solid rgba(19,37,28,.1);
  border-radius: 16px 16px 4px 16px; padding: 13px 34px 13px 15px;
  box-shadow: 0 20px 44px -22px rgba(19,37,28,.55); font-size: 13.5px; line-height: 1.45; font-weight: 600;
  cursor: pointer; transform-origin: bottom right; animation: spg-pop .3s ease both;
}
.spg-teaser b { color: var(--c-green); }
.spg-teaser__x { position: absolute; top: 6px; right: 8px; width: 20px; height: 20px; border: none; background: transparent; color: var(--c-muted); font-size: 15px; cursor: pointer; line-height: 1; border-radius: 6px; }
.spg-teaser__x:hover { background: rgba(19,37,28,.06); }
@keyframes spg-pop { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }

/* ---- panel ---- */
.spg-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 120;
  width: 384px; max-width: calc(100vw - 32px); height: 588px; max-height: calc(100vh - 40px);
  background: var(--c-cream); border-radius: 22px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 40px 80px -28px rgba(9,20,14,.6), 0 0 0 1px rgba(19,37,28,.06);
  opacity: 0; transform: translateY(20px) scale(.97); pointer-events: none;
  transition: opacity .24s ease, transform .24s cubic-bezier(.22,1,.36,1);
}
.spg-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* header */
.spg-head { background: var(--c-green); color: var(--c-cream); padding: 16px 16px 15px; display: flex; align-items: center; gap: 12px; }
.spg-head__avatar { position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(140deg,#C4A05A,#9E7B34); display: flex; align-items: center; justify-content: center; color: #13251C; }
.spg-head__avatar svg { width: 22px; height: 22px; }
.spg-head__dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #37D36A; border: 2px solid var(--c-green); }
.spg-head__meta { flex: 1; min-width: 0; }
.spg-head__title { font-weight: 800; font-size: 15.5px; letter-spacing: .01em; }
.spg-head__status { font-size: 12px; color: rgba(245,240,230,.72); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.spg-head__status i { width: 6px; height: 6px; border-radius: 50%; background: #37D36A; display: inline-block; }
.spg-head__btns { display: flex; gap: 4px; }
.spg-head__btn { width: 32px; height: 32px; border-radius: 9px; border: none; background: rgba(245,240,230,.12); color: var(--c-cream); cursor: pointer; font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.spg-head__btn:hover { background: rgba(245,240,230,.22); }

/* messages */
.spg-body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.spg-body::-webkit-scrollbar { width: 7px; }
.spg-body::-webkit-scrollbar-thumb { background: rgba(19,37,28,.16); border-radius: 999px; }

.spg-row { display: flex; gap: 9px; max-width: 100%; align-items: flex-end; }
.spg-row--bot { justify-content: flex-start; }
.spg-row--user { justify-content: flex-end; }
.spg-ava { flex: none; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(140deg,#C4A05A,#9E7B34); display: flex; align-items: center; justify-content: center; color: #13251C; align-self: flex-end; }
.spg-ava svg { width: 15px; height: 15px; }
.spg-bubble { padding: 11px 14px; font-size: 14px; line-height: 1.5; border-radius: 16px; max-width: 78%; word-wrap: break-word; }
.spg-row--bot .spg-bubble { background: #fff; color: var(--c-ink); border: 1px solid rgba(19,37,28,.07); border-bottom-left-radius: 5px; box-shadow: 0 8px 20px -18px rgba(19,37,28,.5); }
.spg-row--user .spg-bubble { background: var(--c-green); color: var(--c-cream); border-bottom-right-radius: 5px; }
.spg-bubble b { font-weight: 800; }
.spg-bubble .spg-hr { height: 1px; background: rgba(19,37,28,.08); margin: 8px 0; border: 0; }
.spg-bubble ul { margin: 6px 0 0; padding-left: 18px; }
.spg-bubble li { margin: 2px 0; }
.spg-bubble .spg-rate { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.spg-bubble .spg-rate b { color: var(--c-green-deep); }

/* action buttons inside/after a bot message */
.spg-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.spg-act { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12.5px; padding: 8px 13px; border-radius: 999px; cursor: pointer; border: 1.5px solid rgba(19,37,28,.14); background: #fff; color: var(--c-ink); text-decoration: none; }
.spg-act:hover { border-color: var(--c-gold); color: var(--c-ink); }
.spg-act--wa { background: var(--c-wa); border-color: var(--c-wa); color: #fff; }
.spg-act--wa:hover { color: #fff; filter: brightness(1.05); }
.spg-act--call { background: var(--c-gold); border-color: var(--c-gold); color: #13251C; }
.spg-act--call:hover { color: #13251C; }

/* typing indicator */
.spg-typing { display: inline-flex; gap: 4px; padding: 13px 14px; }
.spg-typing i { width: 7px; height: 7px; border-radius: 50%; background: rgba(19,37,28,.4); animation: spg-blink 1.2s infinite both; }
.spg-typing i:nth-child(2) { animation-delay: .2s; }
.spg-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes spg-blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* quick replies */
.spg-quicks { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; scrollbar-width: none; border-top: 1px solid rgba(19,37,28,.07); background: var(--c-cream); }
.spg-quicks::-webkit-scrollbar { display: none; }
.spg-quick { flex: none; white-space: nowrap; font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid rgba(19,37,28,.14); background: #fff; color: var(--c-ink); cursor: pointer; }
.spg-quick:hover { border-color: var(--c-gold); background: #fffaf0; }

/* composer */
.spg-foot { padding: 10px 12px 12px; background: var(--c-cream); border-top: 1px solid rgba(19,37,28,.07); }
.spg-input { display: flex; align-items: center; gap: 8px; background: #fff; border: 1.5px solid rgba(19,37,28,.12); border-radius: 999px; padding: 5px 5px 5px 16px; transition: border-color .15s ease; }
.spg-input:focus-within { border-color: var(--c-gold); }
.spg-input input { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 14px; color: var(--c-ink); padding: 8px 0; }
.spg-input input::placeholder { color: #9aa093; }
.spg-send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--c-gold); color: #13251C; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.spg-send:hover { filter: brightness(1.04); }
.spg-send:disabled { opacity: .45; cursor: default; filter: none; }
.spg-send svg { width: 19px; height: 19px; }
.spg-credit { text-align: center; font-size: 10.5px; color: #a7ab9f; margin-top: 8px; font-weight: 600; letter-spacing: .02em; }
.spg-credit b { color: var(--c-gold-deep); }

/* mobile: near-fullscreen sheet */
@media (max-width: 560px) {
  .spg-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 18px 18px 0 0; }
  .spg-teaser { bottom: 148px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .spg-launch__ring, .fab--wa, .spg-typing i { animation: none !important; }
  .spg-panel { transition: opacity .15s ease; }
}
