/* Site Assistant widget. Brand colours arrive as --sa-primary / --sa-accent on .sa-root. */
.sa-root { --sa-bg: #ffffff; --sa-ink: #172033; --sa-muted: #5f6b7d; --sa-line: #e3e8ef; --sa-soft: #f3f6fa;
  position: fixed; bottom: 20px; z-index: 2147483000; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--sa-ink); }
.sa-right { right: 20px; } .sa-left { left: 20px; }
.sa-root *, .sa-root *::before, .sa-root *::after { box-sizing: border-box; }
.sa-root [hidden] { display: none !important; }

.sa-launcher { width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--sa-primary); color: #fff; box-shadow: 0 10px 30px -8px rgba(15, 23, 42, .45); transition: transform .2s; }
.sa-launcher:hover { transform: translateY(-2px); }
.sa-launcher:focus-visible, .sa-root button:focus-visible, .sa-input:focus-visible { outline: 3px solid var(--sa-accent); outline-offset: 2px; }
.sa-launcher svg { width: 28px; height: 28px; fill: currentColor; }
.sa-left .sa-launcher { margin-right: auto; }
.sa-right .sa-launcher { margin-left: auto; }

.sa-panel { width: 380px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 110px)); margin-bottom: 14px;
  background: var(--sa-bg); border-radius: 18px; box-shadow: 0 24px 60px -18px rgba(15, 23, 42, .4); border: 1px solid var(--sa-line);
  display: flex; flex-direction: column; overflow: hidden; animation: sa-in .2s ease-out; }
@keyframes sa-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sa-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--sa-primary); color: #fff; }
.sa-logo { width: 34px; height: 34px; border-radius: 9px; background: #fff; object-fit: contain; padding: 3px; }
.sa-titles { display: grid; min-width: 0; flex: 1; }
.sa-titles strong { font-size: 15px; }
.sa-sub { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-close { border: 0; background: transparent; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.sa-close:hover { background: rgba(255, 255, 255, .15); }

.sa-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--sa-soft); }
.sa-msg { display: flex; flex-direction: column; max-width: 86%; }
.sa-msg.sa-customer { align-self: flex-end; align-items: flex-end; }
.sa-bubble { padding: 10px 13px; border-radius: 16px; background: var(--sa-bg); border: 1px solid var(--sa-line); overflow-wrap: anywhere; }
.sa-customer .sa-bubble { background: var(--sa-primary); color: #fff; border-color: transparent; border-bottom-right-radius: 5px; }
.sa-ai .sa-bubble, .sa-human .sa-bubble { border-bottom-left-radius: 5px; }
.sa-human .sa-bubble { border-color: var(--sa-accent); }
.sa-error .sa-bubble { background: #fff4f2; border-color: #f3c2b8; color: #8a2a17; }
.sa-who { font-size: 11.5px; font-weight: 600; color: var(--sa-accent); margin: 0 0 3px 4px; }
.sa-bubble a { color: var(--sa-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.sa-customer .sa-bubble a { color: #fff; }

.sa-typing .sa-bubble { display: flex; gap: 4px; padding: 13px 14px; }
.sa-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sa-muted); animation: sa-dot 1.2s infinite ease-in-out; }
.sa-typing span:nth-child(2) { animation-delay: .15s; } .sa-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes sa-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.sa-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 0; background: var(--sa-soft); }
.sa-chip { border: 1px solid var(--sa-primary); color: var(--sa-primary); background: var(--sa-bg); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; cursor: pointer; }
.sa-chip:hover { background: var(--sa-primary); color: #fff; }

.sa-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--sa-line); background: var(--sa-bg); }
.sa-input { flex: 1; resize: none; border: 1px solid var(--sa-line); border-radius: 12px; padding: 10px 12px; font: inherit; color: var(--sa-ink); background: var(--sa-bg); max-height: 120px; }
.sa-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sa-send { width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--sa-accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.sa-send svg { width: 20px; height: 20px; fill: currentColor; }
.sa-foot { margin: 0; padding: 0 12px 10px; font-size: 11.5px; color: var(--sa-muted); text-align: center; background: var(--sa-bg); }

@media (max-width: 480px) {
  .sa-root.sa-open { inset: 0; }
  .sa-open .sa-panel { width: 100vw; max-width: none; height: 100%; margin: 0; border-radius: 0; border: 0; }
  .sa-open .sa-launcher { display: none; }
  .sa-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .sa-form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .sa-input { font-size: 16px; } /* stops iOS zoom */
}
@media (prefers-reduced-motion: reduce) { .sa-panel, .sa-typing span, .sa-launcher { animation: none; transition: none; } }
