.sg-assistant {
  --sg-assistant-blue: #1265ee;
  --sg-assistant-cyan: #31d8f5;
  --sg-assistant-ink: #081225;
  position: fixed;
  right: 24px;
  bottom: 94px;
  z-index: 1200;
  font-family: Inter, system-ui, sans-serif;
}

.sg-assistant-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 7px 16px 7px 6px;
  overflow: visible;
  border: 1px solid rgba(49, 216, 245, .55);
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #0b2252, var(--sg-assistant-blue));
  box-shadow: 0 18px 45px rgba(8, 24, 58, .3);
  cursor: pointer;
}

.sg-assistant-mascot {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  isolation: isolate;
  perspective: 320px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 32%, #fff 0 48%, #dceeff 76%, #7fdff4 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.7), 0 8px 24px rgba(49,216,245,.24);
}

.sg-assistant-mascot::before {
  position: absolute;
  z-index: -1;
  inset: -3px;
  border-radius: 20px;
  background: conic-gradient(from 20deg, rgba(56,221,248,.15), #38ddf8, rgba(37,99,255,.25), #38ddf8, rgba(56,221,248,.15));
  content: '';
}

.sg-assistant-mascot::after {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ecfeff;
  box-shadow: 0 0 7px 2px #38ddf8, 0 0 18px 5px rgba(14,165,255,.7);
  content: '';
}

.sg-assistant-mascot img {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 56px;
  border-radius: 16px;
  object-fit: cover;
  object-position: center top;
  filter: saturate(1.08) contrast(1.04) drop-shadow(0 4px 6px rgba(2,17,48,.25));
  transform-origin: 50% 78%;
  transform-style: preserve-3d;
  will-change: transform, filter;
}

.sg-assistant-launcher span:last-child { display: grid; text-align: left; line-height: 1.08; }
.sg-assistant-launcher small { margin-bottom: 4px; color: #c9d7f5; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.sg-assistant-launcher b { font-size: 13px; }
.sg-assistant.is-open .sg-assistant-launcher { visibility: hidden; }

.sg-assistant-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto auto auto;
  width: min(410px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 128px));
  overflow: hidden;
  border: 1px solid rgba(18, 101, 238, .25);
  border-radius: 24px;
  color: var(--sg-assistant-ink);
  background: #f7f9fd;
  box-shadow: 0 28px 80px rgba(5, 18, 45, .32);
}

.sg-assistant-panel[hidden] { display: none; }

.sg-assistant-panel > header {
  display: grid;
  grid-template-columns: 44px 1fr 38px 38px;
  align-items: center;
  gap: 9px;
  padding: 15px;
  color: #fff;
  background: linear-gradient(135deg, #071a42, #143e83);
}

.sg-assistant-avatar {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(49, 216, 245, .7);
  border-radius: 14px;
  background: #eef8ff;
  box-shadow: 0 0 18px rgba(49,216,245,.2);
  perspective: 260px;
}

.sg-assistant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(1.3);
  transform-origin: 50% 18%;
  will-change: transform;
}

.sg-assistant-panel header div { min-width: 0; }
.sg-assistant-panel header small { color: #86a7df; font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.sg-assistant-panel header h2 { margin: 2px 0; color: #fff; font: 700 15px Sora, sans-serif; }
.sg-assistant-panel header p { display: flex; align-items: center; gap: 5px; margin: 0; color: #b9c9e8; font-size: 10px; }
.sg-assistant-panel header p i { width: 7px; height: 7px; border-radius: 50%; background: #39e6a5; box-shadow: 0 0 10px #39e6a5; }
.sg-assistant-panel header button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: #d6e2f8;
  background: rgba(255,255,255,.07);
  cursor: pointer;
}
.sg-assistant-panel header button:hover { color: #fff; background: rgba(255,255,255,.14); }

.sg-assistant-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.sg-assistant-message { max-width: 87%; }
.sg-assistant-message p { margin: 0; padding: 11px 13px; border-radius: 15px 15px 15px 4px; color: #1c2941; background: #fff; box-shadow: 0 3px 16px rgba(16, 38, 78, .07); font-size: 13px; line-height: 1.48; white-space: pre-line; }
.sg-assistant-message.user { align-self: flex-end; }
.sg-assistant-message.user p { border-radius: 15px 15px 4px 15px; color: #fff; background: var(--sg-assistant-blue); }
.sg-assistant-message.typing p { color: #5a6b87; }
.sg-assistant-message.error p { color: #8d2430; background: #fff2f3; }

.sg-assistant-products { display: grid; gap: 9px; width: 100%; }
.sg-assistant-product { display: grid; grid-template-columns: 76px 1fr; gap: 11px; padding: 10px; border: 1px solid #dce4f3; border-radius: 15px; background: #fff; }
.sg-assistant-product img { width: 76px; height: 76px; object-fit: contain; border-radius: 10px; background: #f4f6fa; }
.sg-assistant-product div { display: grid; align-content: start; min-width: 0; }
.sg-assistant-product small { overflow: hidden; color: #60708d; font-size: 9px; font-weight: 700; letter-spacing: .04em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.sg-assistant-product h3 { display: -webkit-box; margin: 4px 0 5px; overflow: hidden; color: #14213a; font: 700 12px/1.3 Sora, sans-serif; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.sg-assistant-product strong { color: #0b469f; font-size: 14px; }
.sg-assistant-product div > span { margin-top: 1px; color: #6b7890; font-size: 9px; }
.sg-assistant-product a, .sg-assistant-actions a { display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-top: 8px; border-radius: 9px; color: #fff; background: var(--sg-assistant-blue); font-size: 11px; font-weight: 800; text-decoration: none; }
.sg-assistant-product a { justify-self: start; padding: 7px 9px; }
.sg-assistant-product a .material-symbols-outlined, .sg-assistant-actions a .material-symbols-outlined { font-size: 14px; }

.sg-assistant-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.sg-assistant-actions a { margin: 0; padding: 9px 11px; }
.sg-assistant-actions.fallback a { color: #17498f; background: #e7effd; }

.sg-assistant-suggestions { display: flex; gap: 7px; padding: 0 14px 10px; overflow-x: auto; }
.sg-assistant-suggestions[hidden] { display: none; }
.sg-assistant-suggestions button { flex: 0 0 auto; padding: 8px 10px; border: 1px solid #c9d7ef; border-radius: 999px; color: #17498f; background: #edf3ff; font-size: 10px; font-weight: 700; cursor: pointer; }

.sg-assistant-form { display: grid; grid-template-columns: 1fr 42px; align-items: end; gap: 8px; margin: 0 12px; padding: 8px; border: 1px solid #cbd7ea; border-radius: 16px; background: #fff; }
.sg-assistant-form textarea { width: 100%; max-height: 112px; padding: 7px 5px; resize: none; border: 0; outline: 0; color: #14213a; background: transparent; font: 13px/1.4 Inter, sans-serif; }
.sg-assistant-form button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 12px; color: #fff; background: var(--sg-assistant-blue); cursor: pointer; }
.sg-assistant-form button:disabled { cursor: wait; opacity: .55; }
.sg-assistant-disclaimer { margin: 7px 14px 10px; color: #66758f; font-size: 11px; line-height: 1.35; text-align: center; }
.sg-assistant-disclaimer a { color: #17498f; font-weight: 700; }

.sg-assistant button:focus-visible, .sg-assistant a:focus-visible, .sg-assistant textarea:focus-visible { outline: 3px solid rgba(49, 216, 245, .7); outline-offset: 2px; }

@media (max-width: 620px) {
  .sg-assistant { right: 12px; bottom: 84px; }
  .sg-assistant-launcher { min-height: 58px; padding: 5px; border-radius: 18px; }
  .sg-assistant-mascot { flex-basis: 56px; width: 56px; height: 56px; }
  .sg-assistant-mascot img { width: 52px; height: 54px; }
  .sg-assistant-launcher span:last-child { display: none; }
  .sg-assistant-panel { position: fixed; inset: 12px 12px 76px; width: auto; height: auto; border-radius: 20px; }
}

@media (prefers-reduced-motion: no-preference) {
  .sg-assistant-panel { animation: sg-assistant-enter .18s ease-out; transform-origin: right bottom; }
  .sg-assistant-mascot { animation: sg-assistant-mascot-hop 3.6s cubic-bezier(.34, 1.25, .64, 1) infinite; transform-origin: 50% 100%; will-change: transform; }
  .sg-assistant-mascot img { animation: sg-assistant-mage-idle 3.8s ease-in-out infinite; }
  .sg-assistant-mascot::before { animation: sg-assistant-aura-spin 7s linear infinite; }
  .sg-assistant-mascot::after { animation: sg-assistant-magic-pulse 1.7s ease-in-out infinite; }
  .sg-assistant-avatar img { animation: sg-assistant-avatar-breathe 4.2s ease-in-out infinite; }
  .sg-assistant-launcher:hover .sg-assistant-mascot img { animation-duration: 1.45s; }
  @keyframes sg-assistant-enter { from { opacity: 0; transform: translateY(8px) scale(.98); } }
  @keyframes sg-assistant-mascot-hop {
    0%, 18%, 72%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    24% { transform: translate3d(0, 2px, 0) scale3d(1.04, .96, 1); }
    34% { transform: translate3d(0, -8px, 8px) scale3d(.99, 1.025, 1); }
    41% { transform: translate3d(0, -11px, 12px) rotateZ(-.7deg) scale(1.01); }
    49% { transform: translate3d(0, -5px, 5px) rotateZ(.5deg) scale3d(1.01, .995, 1); }
    56% { transform: translate3d(0, 2px, 0) scale3d(1.045, .955, 1); }
    63% { transform: translate3d(0, -1px, 0) scale3d(.995, 1.005, 1); }
  }
  @keyframes sg-assistant-mage-idle {
    0%, 100% { filter: saturate(1.08) contrast(1.04) drop-shadow(0 4px 6px rgba(2,17,48,.25)); transform: translate3d(0, 1px, 0) rotateY(-5deg) rotateZ(-.5deg) scale(1); }
    50% { filter: saturate(1.14) contrast(1.06) drop-shadow(0 8px 10px rgba(14,165,255,.32)); transform: translate3d(0, -4px, 10px) rotateY(6deg) rotateZ(.6deg) scale(1.035); }
  }
  @keyframes sg-assistant-avatar-breathe {
    0%, 100% { transform: scale(1.3) translateY(0) rotateY(-2deg); }
    50% { transform: scale(1.34) translateY(-1px) rotateY(3deg); }
  }
  @keyframes sg-assistant-aura-spin { to { transform: rotate(360deg); } }
  @keyframes sg-assistant-magic-pulse {
    0%, 100% { opacity: .55; transform: scale(.72); }
    50% { opacity: 1; transform: scale(1.16); }
  }
}
