:root {
  --xgcb-primary: #00c16a;
  --xgcb-dark: #101828;
  --xgcb-text: #1f2937;
  --xgcb-muted: #667085;
  --xgcb-border: #e5e7eb;
  --xgcb-bg: #ffffff;
  --xgcb-soft: #f8fafc;
}

.xgcb-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 999999;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.xgcb-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(135deg, var(--xgcb-primary), #0ea5e9);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
}

.xgcb-window {
  width: min(380px, calc(100vw - 24px));
  height: 620px;
  max-height: calc(100vh - 100px);
  margin-bottom: 14px;
  background: var(--xgcb-bg);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 80px rgba(16,24,40,.25);
}

.xgcb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #0f172a, #111827);
  color: #fff;
}

.xgcb-title { font-size: 16px; }
.xgcb-subtitle { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 4px; }
.xgcb-header-actions { display: flex; gap: 8px; }

.xgcb-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
}

.xgcb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.xgcb-message {
  display: flex;
  margin-bottom: 14px;
}

.xgcb-message--bot { justify-content: flex-start; }
.xgcb-message--user { justify-content: flex-end; }

.xgcb-bubble {
  max-width: 84%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.xgcb-message--bot .xgcb-bubble {
  background: #fff;
  color: var(--xgcb-text);
  border: 1px solid var(--xgcb-border);
  border-bottom-left-radius: 6px;
}

.xgcb-message--user .xgcb-bubble {
  background: linear-gradient(135deg, var(--xgcb-primary), #0ea5e9);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.xgcb-time {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: .7;
}

.xgcb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 14px;
  background: #fff;
}

.xgcb-chip {
  border: 1px solid var(--xgcb-border);
  background: #fff;
  color: var(--xgcb-text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}

.xgcb-input-wrap {
  display: flex;
  gap: 10px;
  padding: 14px 18px 12px;
  border-top: 1px solid var(--xgcb-border);
  background: #fff;
}

.xgcb-input-wrap input,
.xgcb-lead-form input,
.xgcb-lead-form select,
.xgcb-lead-form textarea {
  width: 100%;
  border: 1px solid var(--xgcb-border);
  background: #fff;
  color: var(--xgcb-text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.xgcb-input-wrap button,
.xgcb-lead-form button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--xgcb-primary), #0ea5e9);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.xgcb-footer-actions {
  display: flex;
  gap: 10px;
  padding: 0 18px 18px;
  background: #fff;
}

.xgcb-secondary-btn {
  flex: 1;
  border: 1px solid var(--xgcb-border);
  background: #fff;
  color: var(--xgcb-text);
  border-radius: 12px;
  padding: 11px 12px;
  cursor: pointer;
}

.xgcb-typing {
  display: flex;
  gap: 6px;
  padding: 0 18px 14px;
  background: #fff;
}

.xgcb-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  animation: xgcb-bounce 1.2s infinite ease-in-out;
}
.xgcb-typing span:nth-child(2){animation-delay:.15s}
.xgcb-typing span:nth-child(3){animation-delay:.3s}

@keyframes xgcb-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .55; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.xgcb-lead-card {
  border: 1px solid var(--xgcb-border);
  border-radius: 18px;
  background: #fff;
  padding: 14px;
  margin-bottom: 12px;
}

.xgcb-lead-card h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--xgcb-dark);
}

.xgcb-lead-form {
  display: grid;
  gap: 10px;
}

@media (max-width: 640px) {
  .xgcb-root { right: 12px; bottom: 12px; }
  .xgcb-window { width: calc(100vw - 24px); height: 76vh; }
}
