#gs-lead-assistant-root {
  --gs-accent: #111;
  --gs-dot: #22c55e;
  --gs-width: var(--gs-width);
  --gs-height: var(--gs-height);
  --gs-bg: #fff;
  --gs-fg: #111;
  --gs-muted: rgba(17,17,17,.55);
  --gs-surface: #f6f7f9;
  --gs-border: #e7e7e7;

  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}


/* Keep launcher anchored when panel opens */
#gs-lead-assistant-root {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 10px;
}
.gs-panel {
  margin-top: 0 !important;
}

/* Force send button colors */
#gs-lead-assistant-root .gs-send {
  appearance: none !important;
  border: 1px solid var(--gs-accent) !important;
  background: var(--gs-accent) !important;
  color: #fff !important;
}
#gs-lead-assistant-root .gs-send:hover,
#gs-lead-assistant-root .gs-send:focus,
#gs-lead-assistant-root .gs-send:focus-visible {
  background: var(--gs-accent) !important;
  color: #fff !important;
}

/* Force launcher style to avoid theme overrides */
#gs-lead-assistant-root .gs-launcher {
  appearance: none !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 16px 16px !important;
  cursor: pointer !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.18) !important;
  background: var(--gs-accent) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 14px !important;
  justify-content: center !important;
}
/* Launcher */
.gs-launcher {
  border: 0;
  border-radius: 999px;
  padding: 16px 16px;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  background: var(--gs-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gs-launcher:hover { transform: translateY(-1px); }
#gs-lead-assistant-root .gs-launcher:hover,
#gs-lead-assistant-root .gs-launcher:focus,
#gs-lead-assistant-root .gs-launcher:focus-visible {
  background: var(--gs-accent);
  color: #fff;
}
.gs-launcher:active { transform: translateY(0px); }
.gs-launcher-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gs-dot);
  box-shadow: 0 0 0 4px rgba(34,197,94,.15);
  animation: gs-dot-pulse 1.8s ease-out infinite;
}

@keyframes gs-dot-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.45); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.gs-launcher-text { font-weight: 600; }

/* Panel */
.gs-panel {
  width: var(--gs-width);
  height: var(--gs-height);
  margin-top: 10px;
  border-radius: 16px;
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  background: var(--gs-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gs-hidden { display: none !important; }

.gs-header {
  padding: 12px 12px;
  background: var(--gs-header-bg, #0b0b0b);
  color: var(--gs-header-fg, #fff);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gs-header-title { display: flex; align-items: center; gap: 10px; }
.gs-avatar {
  width: 34px; height: 34px;
  border-radius: 12px;
  background: var(--gs-accent);
  border: 1px solid rgba(255,255,255,.12);
  display: grid; place-items: center;
  font-weight: 800;
}
.gs-title { font-size: 14px; font-weight: 800; line-height: 1.1; }
.gs-subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }
.gs-close {
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  width: 36px; height: 36px;
  border-radius: 10px;
}
.gs-close:hover { background: rgba(255,255,255,.08); }

/* Messages */
.gs-messages {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
  background: var(--gs-surface);
}

.gs-row { display: flex; flex-direction: column; margin: 6px 0; }
.gs-row-user { align-items: flex-end; }
.gs-row-bot { align-items: flex-start; }

.gs-bubble {
  max-width: 86%;
  padding: 16px 16px;
  border-radius: 14px;
  white-space: pre-wrap;
  line-height: 1.2;
  font-size: 14px;
}
.gs-bubble-user {
  background: var(--gs-accent);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.gs-bubble-bot {
  background: var(--gs-bg);
  color: var(--gs-fg);
  border: 1px solid var(--gs-border);
  border-bottom-left-radius: 6px;
}
.gs-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--gs-muted);
}

/* Typing indicator */
.gs-typing { display: inline-flex; gap: 6px; align-items: center; }
.gs-typing-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: #999;
  animation: gsBounce 1.05s infinite;
}
.gs-typing-dot:nth-child(2) { animation-delay: .15s; }
.gs-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes gsBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* Footer */
.gs-footer {
  padding: 10px;
  border-top: 1px solid var(--gs-border);
  background: var(--gs-bg);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.gs-input {
  flex: 1;
  resize: none;
  border-radius: 12px;
  border: 1px solid var(--gs-border);
  padding: 10px 10px;
  outline: none;
  font-size: 14px;
  line-height: 1.2;
  max-height: 120px;
}
.gs-input:focus { border-color: #bdbdbd; }
.gs-send {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 0;
  background: var(--gs-accent);
  color: #fff;
  cursor: pointer;
  font-size: 16px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gs-send:hover { transform: translateY(-1px); }
.gs-send:active { transform: translateY(0px); }

@media (max-width: 420px) {
  .gs-panel { width: calc(100vw - 24px); height: 70vh; }
}

@media (max-width: 640px) {
  #gs-lead-assistant-root {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    align-items: stretch;
  }
  #gs-lead-assistant-root .gs-panel {
    width: 100vw !important;
    height: 85vh !important;
    border-radius: 0 !important;
  }
  .gs-launcher-wrap {
    right: 12px !important;
    bottom: 12px !important;
  }
}


/* Markdown styling inside bot bubbles */
.gs-bubble-bot p { margin: 0 0 1px 0; }
.gs-bubble-bot p:last-child { margin-bottom: 0; }
.gs-bubble-bot ul, .gs-bubble-bot ol { margin: 2px 0 2px 14px; padding: 0; }
.gs-bubble-bot li { margin: 1px 0; }
.gs-bubble-bot a { color: var(--gs-accent); text-decoration: underline; }
.gs-bubble-bot strong { font-weight: 800; }
.gs-bubble-bot code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 13px; background: rgba(0,0,0,.04); padding: 1px 6px; border-radius: 8px; }
.gs-bubble-bot pre { background: rgba(0,0,0,.04); padding: 10px; border-radius: 12px; overflow: auto; }


/* Theme handling */
#gs-lead-assistant-root[data-theme="dark"] {
  --gs-bg: #0b0b0b;
  --gs-fg: #ffffff;
  --gs-muted: rgba(255,255,255,.65);
  --gs-surface: #111214;
  --gs-border: rgba(255,255,255,.12);
  --gs-header-bg: #0b0b0b;
  --gs-header-fg: #ffffff;
}

#gs-lead-assistant-root[data-theme="dark"] .gs-launcher-hint{
  color: #ffffff;
}
#gs-lead-assistant-root[data-theme="dark"] .gs-hint-close{
  color: #ffffff;
}
#gs-lead-assistant-root[data-theme="dark"] #gs-lead-assistant-root[data-theme="light"] {
  --gs-bg: #ffffff;
  --gs-fg: #111111;
  --gs-muted: rgba(17,17,17,.55);
  --gs-surface: #f6f7f9;
  --gs-border: #e7e7e7;
  --gs-header-bg: #0b0b0b;
  --gs-header-fg: #ffffff;
}

@media (prefers-color-scheme: dark) {
  #gs-lead-assistant-root[data-theme="auto"] {
    --gs-bg: #0b0b0b;
    --gs-fg: #ffffff;
    --gs-muted: rgba(255,255,255,.65);
    --gs-surface: #111214;
    --gs-border: rgba(255,255,255,.12);
    --gs-header-bg: #0b0b0b;
    --gs-header-fg: #ffffff;
  #gs-lead-assistant-root[data-theme="auto"] .gs-launcher-hint{
    color: #ffffff;
  }
  #gs-lead-assistant-root[data-theme="auto"] .gs-hint-close{
    color: #ffffff;
  }
}
}
  #gs-lead-assistant-root[data-theme="auto"] }/* Admin-only RAG debug */
.gs-rag-debug{
  margin-top:8px;
  font-size:11px;
  opacity:.8;
}
.gs-rag-details{ margin-top:6px; }
.gs-rag-details summary{ cursor:pointer; font-size:11px; opacity:.85; }
.gs-rag-box{
  margin-top:8px;
  padding:8px;
  border:1px solid var(--gs-border);
  border-radius:12px;
  background: rgba(0,0,0,.03);
  max-height:180px;
  overflow:auto;
}
#gs-lead-assistant-root[data-theme="dark"] .gs-rag-box,
@media (prefers-color-scheme: dark){
  #gs-lead-assistant-root[data-theme="auto"] .gs-rag-box{
    background: rgba(255,255,255,.06);
  }
}
.gs-rag-item{ margin-bottom:10px; }
.gs-rag-item:last-child{ margin-bottom:0; }
.gs-rag-fn{ font-weight:800; font-size:11px; }
.gs-rag-sn{ font-size:11px; opacity:.85; white-space:pre-wrap; }


/* Ensure icons are centered */
.gs-launcher svg,
.gs-send svg {
  display: block;
  width: 18px;
  height: 18px;
}
.gs-send svg path,
.gs-close svg path {
  stroke: currentColor;
  fill: none;
}


.gs-lead-debug{ margin-top:6px; font-size:11px; opacity:.8; }


/* Accent close icon */
#gs-lead-assistant-root .gs-close{
  color: #fff;
  background: var(--gs-accent);
  border: 1px solid var(--gs-accent);
}
#gs-lead-assistant-root .gs-close:hover,
#gs-lead-assistant-root .gs-close:focus,
#gs-lead-assistant-root .gs-close:focus-visible{
  color: #fff;
  background: var(--gs-accent);
  border-color: var(--gs-accent);
}

/* Close button icon centering */
.gs-close svg{
  display:block;
  width:18px;
  height:18px;
}


/* Launcher hint close */
.gs-hint-close{
  position:absolute;
  top:6px;
  right:8px;
  color: #111;
  font-size:12px;
  line-height:1;
  cursor:pointer;
  user-select:none;
}
.gs-hint-close:hover,
.gs-hint-close:focus,
.gs-hint-close:focus-visible{
  color: var(--gs-accent);
}

/* Launcher hint */
.gs-launcher-wrap{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  z-index: 2147483000;
}
.gs-launcher-hint{
  position: relative;
  max-width: 260px;
  padding: 16px 16px;
  border: 1px solid var(--gs-border);
  border-radius: 14px;
  background: var(--gs-bg);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  color: #111;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
}
.gs-launcher-hint:after{
  content:"";
  position:absolute;
  right: 18px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  transform: rotate(45deg);
  background: var(--gs-bg);
  border-right: 1px solid var(--gs-border);
  border-bottom: 1px solid var(--gs-border);
}


/* When launcher is wrapped, prevent double-fixed positioning */
.gs-launcher-wrap .gs-launcher{
  position: static !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
}


/* Compact spacing for bot message paragraphs */
/* Force bubble wrap */
#gs-lead-assistant-root .gs-bubble{
  overflow-wrap: anywhere;
  word-break: break-word;
}

.gs-chat-message p {
  margin: 0 0 0.45em 0;
}

.gs-chat-message p:last-child {
  margin-bottom: 0;
}

.gs-chat-message ul,
.gs-chat-message ol {
  margin: 0.3em 0 0.5em 1.1em;
}

.gs-chat-message li {
  margin: 0.15em 0;
}

/* Robust centering for close (X) button */
.gs-close {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.gs-close svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}


/* Animated speech bubble hint (invites users to open chat) */
@keyframes gsHintFloat {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}
@keyframes gsHintPulse {
  0% { box-shadow: 0 10px 30px rgba(0,0,0,.12); }
  50% { box-shadow: 0 14px 36px rgba(0,0,0,.18); }
  100% { box-shadow: 0 10px 30px rgba(0,0,0,.12); }
}

.gs-launcher-hint--animated{
  animation: gsHintFloat 2.8s ease-in-out infinite, gsHintPulse 2.8s ease-in-out infinite;
}

#gs-lead-assistant-root[data-theme="dark"] .gs-launcher-hint,
#gs-lead-assistant-root[data-theme="auto"] .gs-launcher-hint {
  background: #ffffff;
  color: #111111;
  border-color: #e7e7e7;
}
#gs-lead-assistant-root[data-theme="dark"] .gs-launcher-hint:after,
#gs-lead-assistant-root[data-theme="auto"] .gs-launcher-hint:after {
  background: #ffffff;
  border-right-color: #e7e7e7;
  border-bottom-color: #e7e7e7;
}
#gs-lead-assistant-root[data-theme="dark"] .gs-hint-close,
#gs-lead-assistant-root[data-theme="auto"] .gs-hint-close {
  color: #111111;
}
