/* Website assistant widget */
.bmg-chat-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 20px 0 16px;
  background: var(--teal, #069caa); color: #fff; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 650; font-size: 1rem;
  box-shadow: 0 14px 30px -10px rgba(3, 14, 33, .55);
  transition: background-color .15s, transform .12s;
}
.bmg-chat-launcher:hover { background: var(--teal-dark, #057885); transform: translateY(-2px); }
.bmg-chat-launcher svg { width: 24px; height: 24px; }
.bmg-chat-launcher.is-open { display: none; }

.bmg-chat {
  position: fixed; right: 20px; bottom: 20px; z-index: 901;
  width: min(400px, calc(100vw - 24px)); height: min(620px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: var(--ink, #0e2240); border-radius: 16px;
  box-shadow: 0 30px 70px -20px rgba(3, 14, 33, .6); border: 1px solid #dce3ec;
}
.bmg-chat[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .bmg-chat:not([hidden]) { animation: bmg-open .22s cubic-bezier(.2, .7, .2, 1); }
  @keyframes bmg-open { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
}
.bmg-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; background: var(--navy, #071b3b); color: #fff; }
.bmg-chat-head img { border-radius: 8px; }
.bmg-chat-head div { flex: 1; min-width: 0; }
.bmg-chat-head h2 { font-size: 1.05rem; font-stretch: 85%; margin: 0; line-height: 1.2; color: #fff; }
.bmg-chat-head p { margin: 2px 0 0; font-size: .8rem; color: #a9b8cf; line-height: 1.3; }
.bmg-chat-close { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center; }
.bmg-chat-close:hover { background: rgba(255, 255, 255, .1); }
.bmg-chat-close svg { width: 18px; height: 18px; }

.bmg-chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f3f6f9; }
.bmg-msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.bmg-msg p { margin: 0 0 .5em; }
.bmg-msg p:last-child { margin: 0; }
.bmg-msg ul { margin: .3em 0; padding-inline-start: 1.1em; }
.bmg-assistant { align-self: flex-start; background: #fff; border: 1px solid #dce3ec; border-end-start-radius: 4px; }
.bmg-user { align-self: flex-end; background: var(--navy, #071b3b); color: #fff; border-end-end-radius: 4px; white-space: pre-wrap; }
.bmg-msg a { color: var(--teal-dark, #057885); font-weight: 600; }
.bmg-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bmg-links a { font-size: .8rem; text-decoration: none; border: 1px solid #b9c6d6; border-radius: 999px; padding: 3px 10px; color: var(--ink, #0e2240); font-weight: 600; }
.bmg-links a:hover { border-color: var(--teal, #069caa); color: var(--teal-dark, #057885); }
.bmg-typing { display: inline-flex; gap: 4px; align-items: center; min-height: 40px; }
.bmg-typing span:not(.visually-hidden) { width: 7px; height: 7px; border-radius: 50%; background: #9fb0c6; }
@media (prefers-reduced-motion: no-preference) {
  .bmg-typing span:not(.visually-hidden) { animation: bmg-dot 1.2s infinite ease-in-out; }
  .bmg-typing span:nth-child(2) { animation-delay: .15s; }
  .bmg-typing span:nth-child(3) { animation-delay: .3s; }
  @keyframes bmg-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
}

.bmg-chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: #f3f6f9; }
.bmg-chat-suggest[hidden] { display: none; }
.bmg-chat-suggest button {
  font: inherit; font-size: .84rem; text-align: start; line-height: 1.3; cursor: pointer;
  padding: 8px 12px; border-radius: 10px; border: 1px solid #b9c6d6; background: #fff; color: var(--ink, #0e2240);
}
.bmg-chat-suggest button:hover { border-color: var(--teal, #069caa); color: var(--teal-dark, #057885); }

.bmg-chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid #dce3ec; background: #fff; }
.bmg-chat-form[hidden] { display: none; }
.bmg-chat-form textarea {
  flex: 1; resize: none; font: inherit; font-size: .95rem; line-height: 1.4; padding: 10px 12px; min-height: 44px; max-height: 120px;
  border: 1.5px solid #b9c6d6; border-radius: 10px; color: var(--ink, #0e2240);
}
.bmg-chat-form textarea:focus { outline: none; border-color: var(--teal, #069caa); box-shadow: 0 0 0 3px rgba(6, 156, 170, .2); }
.bmg-chat-send { width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: var(--teal, #069caa); color: #fff; cursor: pointer; display: grid; place-items: center; }
.bmg-chat-send:hover { background: var(--teal-dark, #057885); }
.bmg-chat-send svg { width: 18px; height: 18px; }

.bmg-chat-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 12px 10px; font-size: .74rem; color: #4b5b73; background: #fff; }
.bmg-chat-foot a { color: inherit; }
.bmg-chat-team { font: inherit; font-size: .82rem; font-weight: 650; color: var(--teal-dark, #057885); background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

.bmg-chat-lead { flex: 1; overflow-y: auto; padding: 18px 16px; display: grid; gap: 12px; align-content: start; background: #fff; }
.bmg-chat-lead[hidden] { display: none; }
.bmg-chat-lead h3 { margin: 0; font-size: 1.15rem; }
.bmg-chat-lead > p { margin: -6px 0 4px; color: #4b5b73; font-size: .9rem; }
.bmg-chat-lead label { display: grid; gap: 5px; font-weight: 600; font-size: .88rem; }
.bmg-chat-lead input, .bmg-chat-lead textarea { font: inherit; font-size: .95rem; padding: 10px 12px; border: 1.5px solid #b9c6d6; border-radius: 8px; font-weight: 400; }
.bmg-chat-lead input:focus, .bmg-chat-lead textarea:focus { outline: none; border-color: var(--teal, #069caa); box-shadow: 0 0 0 3px rgba(6, 156, 170, .2); }
.bmg-chat-lead-err { color: #8a1526; font-size: .88rem; margin: 0; }
.bmg-chat-lead-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bmg-chat-cancel { font: inherit; background: none; border: 0; color: #4b5b73; cursor: pointer; text-decoration: underline; padding: 10px 4px; }

@media (max-width: 520px) {
  .bmg-chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .bmg-chat-launcher { right: 14px; bottom: 14px; }
  .bmg-chat-launcher span { display: none; }
  .bmg-chat-launcher { padding: 0 14px; }
}
body.menu-open .bmg-chat-launcher { display: none; }
.bmg-msg p[dir="auto"] { unicode-bidi: plaintext; text-align: start; }
@media print { .bmg-chat-launcher, .bmg-chat { display: none !important; } }
