#bdaic-chatbot, #bdaic-chatbot * { box-sizing: border-box; }
#bdaic-chatbot { position: fixed; right: 22px; bottom: 22px; z-index: 999999; font-family: Arial, Helvetica, sans-serif; }
#bdaic-open { width: 62px; height: 62px; border-radius: 50%; border: none; background: var(--bdaic-primary, #0f75bc); color: #fff; font-size: 28px; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
#bdaic-panel { display: none; width: 370px; max-width: calc(100vw - 28px); height: 580px; max-height: calc(100vh - 40px); background: #fff; border-radius: 18px; box-shadow: 0 14px 50px rgba(0,0,0,.28); overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
#bdaic-panel.active { display: flex; flex-direction: column; }
.bdaic-header { background: linear-gradient(135deg, var(--bdaic-primary, #0f75bc), #084b82); color: #fff; padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; }
.bdaic-header strong { display: block; font-size: 16px; line-height: 1.25; }
.bdaic-header span { display: inline-block; margin-top: 3px; font-size: 12px; opacity: .9; }
#bdaic-close { background: rgba(255,255,255,.18); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; }
#bdaic-messages { flex: 1; overflow-y: auto; padding: 14px; background: #f5f8fb; }
.bdaic-msg { display: flex; margin: 0 0 10px; }
.bdaic-msg > div { padding: 10px 12px; border-radius: 14px; max-width: 88%; font-size: 14px; line-height: 1.45; white-space: normal; }
.bdaic-msg.bot { justify-content: flex-start; }
.bdaic-msg.bot > div { background: #fff; color: #1f2937; border: 1px solid rgba(15,117,188,.08); }
.bdaic-msg.user { justify-content: flex-end; }
.bdaic-msg.user > div { background: var(--bdaic-primary, #0f75bc); color: #fff; }
.bdaic-typing > div { opacity: .7; font-style: italic; }
.bdaic-actions { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #e7edf3; }
.bdaic-actions a, .bdaic-actions button { flex: 1; text-align: center; text-decoration: none; border: 1px solid var(--bdaic-primary, #0f75bc); background: #fff; color: var(--bdaic-primary, #0f75bc); border-radius: 999px; font-size: 13px; font-weight: 600; padding: 8px 9px; cursor: pointer; }
.bdaic-actions a:first-child { background: var(--bdaic-primary, #0f75bc); color: #fff; }
.bdaic-input-row { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #e7edf3; }
#bdaic-input { flex: 1; resize: none; min-height: 42px; max-height: 90px; border: 1px solid #d6e1ea; border-radius: 12px; padding: 10px; font-size: 14px; outline: none; }
#bdaic-input:focus { border-color: var(--bdaic-primary, #0f75bc); box-shadow: 0 0 0 3px rgba(15,117,188,.1); }
#bdaic-send { width: 70px; border: none; background: var(--bdaic-primary, #0f75bc); color: #fff; border-radius: 12px; font-weight: 700; cursor: pointer; }
#bdaic-lead-form { padding: 12px; background: #fff; border-top: 1px solid #e7edf3; }
.bdaic-lead-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; color: #1f2937; }
#bdaic-lead-form input { width: 100%; border: 1px solid #d6e1ea; border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; font-size: 13px; outline: none; }
#bdaic-lead-form input:focus { border-color: var(--bdaic-primary, #0f75bc); box-shadow: 0 0 0 3px rgba(15,117,188,.1); }
.bdaic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#bdaic-submit-lead { width: 100%; border: none; border-radius: 10px; padding: 10px 12px; background: var(--bdaic-primary, #0f75bc); color: #fff; font-weight: 700; cursor: pointer; }
#bdaic-submit-lead:disabled { opacity: .65; cursor: wait; }
@media (max-width: 480px) {
  #bdaic-chatbot { right: 12px; bottom: 12px; }
  #bdaic-panel { width: calc(100vw - 24px); height: calc(100vh - 30px); border-radius: 16px; }
  .bdaic-grid { grid-template-columns: 1fr; gap: 0; }
}
.bdaic-lead-card { margin: 6px 14px 14px; border-radius: 14px; box-shadow: 0 8px 24px rgba(15,117,188,.12); }
.bdaic-lead-desc { color: #52616f; font-size: 12.5px; line-height: 1.4; margin: -2px 0 9px; }
#bdaic-messages #bdaic-lead-form { border: 1px solid rgba(15,117,188,.12); }
#bdaic-open.has-avatar { padding: 0; overflow: hidden; background: #fff; border: 3px solid var(--bdaic-primary, #0f75bc); }
#bdaic-open.has-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.bdaic-header-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bdaic-header-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); background: #fff; flex: 0 0 auto; }
.bdaic-msg-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; margin-right: 7px; align-self: flex-end; border: 1px solid rgba(15,117,188,.16); background: #fff; }
.bdaic-msg.bot > .bdaic-msg-avatar + div { max-width: calc(88% - 35px); }
.bdaic-deal-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 4px 0 12px; }
.bdaic-deal-actions button { border: 1px solid rgba(15,117,188,.25); background: #fff; color: var(--bdaic-primary, #0f75bc); border-radius: 999px; padding: 7px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 12px rgba(15,117,188,.08); }
.bdaic-deal-actions button:first-child { background: var(--bdaic-primary, #0f75bc); color: #fff; }

/* v1.8.0: launcher title and stronger mobile scaling */
.bdaic-launcher { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.bdaic-open-title { max-width: 190px; padding: 7px 11px; border-radius: 999px; background: #fff; color: #1f2937; font-size: 12.5px; font-weight: 700; line-height: 1.25; text-align: center; box-shadow: 0 8px 22px rgba(0,0,0,.18); border: 1px solid rgba(15,117,188,.14); }
.bdaic-open-title:after { content: ""; display: block; width: 8px; height: 8px; background: #fff; border-right: 1px solid rgba(15,117,188,.14); border-bottom: 1px solid rgba(15,117,188,.14); transform: rotate(45deg); position: absolute; }
.bdaic-launcher .bdaic-open-title { position: relative; }
.bdaic-launcher .bdaic-open-title:after { left: calc(50% - 4px); bottom: -5px; }

@media (max-width: 480px) {
  #bdaic-chatbot { right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); left: auto; }
  .bdaic-open-title { max-width: min(220px, calc(100vw - 28px)); font-size: 12px; padding: 6px 10px; }
  #bdaic-open { width: 58px; height: 58px; }
  #bdaic-panel { position: fixed; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); top: max(8px, env(safe-area-inset-top)); width: auto; height: auto; max-width: none; max-height: none; border-radius: 16px; }
  .bdaic-header { padding: 12px 13px; }
  .bdaic-header strong { font-size: 15px; }
  .bdaic-header span { font-size: 11.5px; }
  #bdaic-messages { padding: 10px; }
  .bdaic-msg > div { max-width: 90%; font-size: 13.5px; padding: 9px 10px; }
  .bdaic-actions { padding: 8px; gap: 6px; }
  .bdaic-actions a, .bdaic-actions button { font-size: 12px; padding: 8px 6px; }
  .bdaic-input-row { padding: 9px; gap: 7px; }
  #bdaic-input { min-height: 40px; font-size: 13.5px; }
  #bdaic-send { width: 58px; }
  #bdaic-lead-form { padding: 10px; }
  .bdaic-lead-card { margin: 6px 10px 10px; }
}

@media (max-width: 360px) {
  #bdaic-send { width: 52px; font-size: 12px; }
  .bdaic-actions { flex-wrap: wrap; }
  .bdaic-actions a, .bdaic-actions button { min-width: calc(50% - 4px); }
  .bdaic-deal-actions button { font-size: 12px; padding: 7px 8px; }
}
