.fbair-widget,
.fbair-widget * { box-sizing: border-box; }

.fbair-widget {
  --fbair-primary: #0f8f9d;
  --fbair-ink: #15313a;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999999;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fbair-ink);
  line-height: 1.45;
}

.fbair-launcher {
  display: grid;
  width: 62px;
  height: 62px;
  margin-left: auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fbair-primary);
  color: #fff;
  box-shadow: 0 14px 35px rgba(15, 75, 85, .28);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.fbair-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(15, 75, 85, .34); }
.fbair-launcher:focus-visible, .fbair-panel button:focus-visible, .fbair-panel textarea:focus-visible, .fbair-panel input:focus-visible { outline: 3px solid rgba(15, 143, 157, .26); outline-offset: 2px; }
.fbair-launcher svg { width: 29px; height: 29px; fill: currentColor; }

.fbair-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  width: min(390px, calc(100vw - 30px));
  height: min(620px, calc(100vh - 120px));
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(15, 49, 58, .08);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(19, 49, 57, .22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}

.fbair-panel.is-open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.fbair-header {
  display: flex;
  min-height: 78px;
  padding: 16px 18px;
  align-items: center;
  gap: 12px;
  background: var(--fbair-primary);
  color: #fff;
}

.fbair-avatar { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; background: rgba(255,255,255,.15); font-size: 13px; font-weight: 800; }
.fbair-header > div:nth-child(2) { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.fbair-header strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.fbair-header span { margin-top: 2px; font-size: 12px; opacity: .88; }
.fbair-header i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #8ef0b2; box-shadow: 0 0 0 3px rgba(142,240,178,.18); }
.fbair-close { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font: 300 26px/1 sans-serif; cursor: pointer; }

.fbair-messages { flex: 1; overflow-y: auto; padding: 18px 15px 10px; background: #f6fafb; scroll-behavior: smooth; }
.fbair-message { display: flex; margin: 0 0 12px; }
.fbair-message--assistant { align-items: flex-start; flex-direction: column; }
.fbair-message--user { justify-content: flex-end; }
.fbair-bubble { max-width: 86%; padding: 11px 13px; border-radius: 16px 16px 16px 5px; background: #fff; box-shadow: 0 2px 10px rgba(21,49,58,.07); color: #24424a; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.fbair-message--user .fbair-bubble { border-radius: 16px 16px 5px 16px; background: var(--fbair-primary); color: #fff; }
.fbair-message.is-loading .fbair-bubble { animation: fbair-pulse 1.15s ease-in-out infinite; }
@keyframes fbair-pulse { 50% { opacity: .55; } }

.fbair-sources { margin-top: 9px; padding-top: 7px; border-top: 1px solid #e5eef0; font-size: 11px; white-space: normal; }
.fbair-sources summary { color: #70858b; cursor: pointer; }
.fbair-source-links { display: flex; flex-wrap: wrap; gap: 4px 8px; padding-top: 5px; }
.fbair-sources a { color: var(--fbair-primary); text-decoration: underline; text-underline-offset: 2px; }
.fbair-suggestions { display: flex; max-width: 94%; margin-top: -5px; flex-wrap: wrap; gap: 6px; }
.fbair-suggestions button { padding: 6px 9px; border: 1px solid #b8dadd; border-radius: 999px; background: #fff; color: var(--fbair-primary); font: 700 11px/1.2 inherit; cursor: pointer; }
.fbair-suggestions button:hover { background: #eef8f9; }
.fbair-suggestions button:disabled { opacity: .55; cursor: default; }

.fbair-quick { display: flex; overflow-x: auto; padding: 8px 12px 10px; gap: 7px; background: #f6fafb; scrollbar-width: none; }
.fbair-quick::-webkit-scrollbar { display: none; }
.fbair-quick button { padding: 7px 11px; flex: 0 0 auto; border: 1px solid #b8dadd; border-radius: 999px; background: #fff; color: var(--fbair-primary); font: 700 12px/1.2 inherit; cursor: pointer; }
.fbair-quick button:hover { background: #eef8f9; }

.fbair-compose { display: flex; padding: 11px 12px 7px; align-items: flex-end; gap: 8px; border-top: 1px solid #e7eef0; background: #fff; }
.fbair-compose textarea { min-height: 42px; max-height: 100px; padding: 10px 12px; flex: 1; resize: none; border: 1px solid #d8e4e6; border-radius: 13px; background: #fff; color: #17333a; font: 14px/1.4 inherit; }
.fbair-compose button { display: grid; width: 42px; height: 42px; padding: 0; flex: 0 0 auto; place-items: center; border: 0; border-radius: 12px; background: var(--fbair-primary); color: #fff; font-size: 17px; cursor: pointer; }
.fbair-credit { padding: 2px 12px 8px; background: #fff; color: #91a2a6; font-size: 9px; text-align: center; letter-spacing: .03em; }

.fbair-lead-form { width: min(92%, 300px); padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 2px 12px rgba(21,49,58,.09); }
.fbair-lead-form label { display: block; margin-bottom: 9px; color: #3e5960; font-size: 11px; font-weight: 700; }
.fbair-lead-form input[type="text"], .fbair-lead-form input[type="tel"], .fbair-lead-form textarea { width: 100%; margin-top: 4px; padding: 8px 9px; border: 1px solid #d5e2e4; border-radius: 9px; color: #17333a; font: 13px/1.35 inherit; }
.fbair-lead-form .fbair-consent { display: flex; align-items: flex-start; gap: 7px; font-weight: 400; line-height: 1.35; }
.fbair-consent input { margin-top: 2px; flex: 0 0 auto; accent-color: var(--fbair-primary); }
.fbair-lead-form > button { width: 100%; padding: 10px; border: 0; border-radius: 10px; background: var(--fbair-primary); color: #fff; font: 700 13px/1.2 inherit; cursor: pointer; }
.fbair-lead-form > button:disabled { opacity: .6; cursor: wait; }
.fbair-honeypot { position: absolute !important; left: -99999px !important; opacity: 0 !important; }
.fbair-form-error { margin-top: 7px; color: #b42318; font-size: 11px; }

@media (max-width: 520px) {
  .fbair-widget { right: 14px; bottom: 14px; }
  .fbair-launcher { width: 56px; height: 56px; }
  .fbair-panel { position: fixed; inset: 10px 10px 80px; width: auto; height: auto; border-radius: 18px; transform-origin: bottom center; }
}

@media (prefers-reduced-motion: reduce) {
  .fbair-launcher, .fbair-panel { transition: none; }
  .fbair-messages { scroll-behavior: auto; }
}
