#bgnm-chat-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 99999;
  font-family: Arial, sans-serif;
}

/* Launcher button */
#bgnm-chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 28px;
  border: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  cursor: pointer;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

#bgnm-chat-fab .launcher-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Panel */
#bgnm-chat-panel {
  width: 360px;
  height: 560px;
  display: none;
  flex-direction: column;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  overflow: hidden;
  background: #fff;
}

/* Header */
#bgnm-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #e9e9e9;
}

#bgnm-chat-header .chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#bgnm-chat-header .chat-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

#bgnm-chat-title.chat-title {
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#bgnm-chat-minimize {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
}

/* Messages */
#bgnm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bgnm-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.3;
  white-space: pre-wrap;
}

.bgnm-user { align-self: flex-end; background: #efefef; }
.bgnm-assistant { align-self: flex-start; background: #f7f7ff; }

/* Status */
#bgnm-chat-status {
  padding: 6px 12px;
  font-size: 12px;
  border-top: 1px solid #e9e9e9;
  color: #666;
}

/* Input form */
#bgnm-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e9e9e9;
}

#bgnm-chat-input {
  flex: 1;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  padding: 10px;
}

#bgnm-chat-send {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
}

/* Tip */
.bgnm-chat-tip {
  padding: 8px 12px;
  font-size: 12px;
  color: #6b7280;
  border-top: 1px solid #e9e9e9;
}

.bgnm-chat-tip code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 6px;
}

/* Keywords */
.bgnm-chat-keywords {
  margin: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.bgnm-chat-kw-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.bgnm-chat-kw-desc {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.bgnm-chat-kw-desc code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 6px;
}

.bgnm-kw-group { margin-top: 10px; }
.bgnm-kw-group-title {
  font-weight: 700;
  font-size: 12px;
  color: #111827;
  margin-bottom: 6px;
}

.bgnm-kw-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.bgnm-kw-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  cursor: pointer;
  user-select: none;
}

.bgnm-kw-chip:hover { background: #f3f4f6; }


/* Collapsible Quick Keywords */
.bgnm-chat-kw-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.bgnm-chat-kw-chevron {
  font-size: 14px;
  line-height: 1;
  color: #6b7280;
}

.bgnm-chat-kw-body {
  margin-top: 8px;
}


/* Header action buttons */
.bgnm-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#bgnm-chat-newchat {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

#bgnm-chat-newchat:hover { background: #f3f4f6; }


#bgnm-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#bgnm-chat-input:disabled {
  background: #f3f4f6;
}


/* Handoff to human + footer */
.bgnm-chat-handoff {
  margin: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.bgnm-chat-handoff-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.bgnm-chat-handoff-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.bgnm-chat-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid #111827;
  background: #111827;
  color: #fff;
  font-size: 12px;
}

.bgnm-chat-primary:hover { opacity: 0.9; }

.bgnm-chat-secondary {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.bgnm-chat-secondary:hover { background: #f3f4f6; }

.bgnm-chat-handoff-note {
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.bgnm-chat-footer {
  padding: 8px 12px;
  font-size: 12px;
  color: #6b7280;
  border-top: 1px solid #e9e9e9;
}

.bgnm-chat-disclaimer {
  font-size: 12px;
  color: #6b7280;
}

.bgnm-chat-links {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7280;
}

.bgnm-chat-links a {
  color: #6b7280;
  text-decoration: none;
}

.bgnm-chat-links a:hover { text-decoration: underline; }

.bgnm-chat-links .sep { margin: 0 6px; }



/* Shipping estimator */
.bgnm-chat-shipping {
  margin: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.bgnm-chat-ship-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.bgnm-chat-ship-title {
  font-weight: 700;
}

.bgnm-chat-ship-chevron {
  font-size: 14px;
  line-height: 1;
  color: #6b7280;
}

.bgnm-chat-ship-body {
  margin-top: 8px;
}

.bgnm-chat-ship-desc {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 10px;
}

.bgnm-chat-ship-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.bgnm-chat-ship-label {
  font-size: 12px;
  color: #374151;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bgnm-chat-ship-input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}

@media (max-width: 420px) {
  .bgnm-chat-ship-form {
    grid-template-columns: 1fr;
  }
}


/* Shipping estimate feature disabled by default */
#bgnm-chat-shipping { display: none; }


/* Need a human feature disabled by default */
#bgnm-chat-handoff { display: none; }


/* Status bar + reconnect */
.bgnm-chat-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bgnm-chat-status-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.bgnm-chat-status-btn:hover { background: #f3f4f6; }

/* Toast */
.bgnm-chat-toast {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 8px 10px 0 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-size: 12px;
  color: #374151;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* Starter prompts */
.bgnm-chat-starters {
  margin: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.bgnm-chat-starters-title {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.bgnm-chat-starters-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bgnm-chat-chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
  cursor: pointer;
  user-select: none;
}

.bgnm-chat-chip:hover { background: #f3f4f6; }

/* Assistant links */
.bgnm-assistant a {
  color: inherit;
  text-decoration: underline;
}
