#ae-chat {
  --ae-ink: #322e2d;
  --ae-brand: #644696;
  --ae-accent: #d5d800;
  --ae-paper: #ffffff;
  --ae-muted: #625d65;
  --ae-line: #e6e0ef;
  color: var(--ae-ink);
  font: 15px/1.5 Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  position: fixed;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--ae-keyboard-inset, 0px));
  z-index: 99990;
  text-align: left;
  -webkit-text-size-adjust: 100%;
}

#ae-chat *, #ae-chat *::before, #ae-chat *::after { box-sizing: border-box; }
#ae-chat [hidden] { display: none !important; }
#ae-chat button, #ae-chat input, #ae-chat textarea, #ae-chat a { font: inherit; letter-spacing: normal; }
#ae-chat button { appearance: none; cursor: pointer; text-transform: none; margin: 0; }
#ae-chat button:disabled { cursor: default; }
#ae-chat a { text-decoration: underline; text-underline-offset: 3px; color: var(--ae-ink); }
#ae-chat a:hover { text-decoration-thickness: 2px; }
#ae-chat button:focus-visible, #ae-chat a:focus-visible, #ae-chat input:focus-visible, #ae-chat textarea:focus-visible, #ae-chat [tabindex]:focus-visible {
  outline: 3px solid var(--ae-brand);
  outline-offset: 3px;
}
#ae-chat p, #ae-chat h2 { padding: 0; margin: 0; }

#ae-chat .ae-chat__launcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px 7px 7px;
  min-height: 44px;
  max-width: calc(100vw - 100px - env(safe-area-inset-left) - env(safe-area-inset-right));
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 30px;
  color: var(--ae-paper);
  background: var(--ae-brand);
  box-shadow: 0 4px 20px #64469624;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.35;
}
#ae-chat.ae-chat--open .ae-chat__launcher { display: none; }
#ae-chat.ae-chat--open { z-index: 2147483647; }
#ae-chat .ae-chat__launcher:hover { background: #503879; }
#ae-chat .ae-chat__launcher:focus-visible, #ae-chat .ae-chat__close:focus-visible { outline-color: var(--ae-accent); }
#ae-chat .ae-chat__mark {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ae-accent);
  border-radius: 50%;
  color: var(--ae-accent);
  font: italic 24px/1 "Montserrat Alternates", Montserrat, sans-serif;
  padding: 0 2px 3px 0;
}

#ae-chat .ae-chat__panel {
  position: absolute;
  display: flex;
  flex-direction: column;
  right: 0;
  bottom: 0;
  width: min(410px, calc(100vw - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  height: min(560px, calc(100vh - 72px));
  height: min(560px, calc(var(--ae-available-height, 100dvh) - 72px - env(safe-area-inset-bottom)));
  max-height: calc(var(--ae-available-height, 100dvh) - 72px - env(safe-area-inset-bottom));
  min-height: 0;
  overflow: hidden;
  background: var(--ae-paper);
  border: 1px solid var(--ae-line);
  border-radius: 19px;
  box-shadow: 0 16px 60px #322e2d29, 0 2px 10px #322e2d0a;
}
#ae-chat.ae-chat--expanded .ae-chat__panel {
  width: min(580px, calc(100vw - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  height: min(760px, calc(var(--ae-available-height, 100dvh) - 72px - env(safe-area-inset-bottom)));
}

#ae-chat .ae-chat__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
  gap: 12px;
  padding: 12px 14px 12px 20px;
  color: var(--ae-paper);
  background: var(--ae-brand);
}
#ae-chat .ae-chat__heading-group { min-width: 0; }
#ae-chat .ae-chat__header-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
#ae-chat .ae-chat__expand {
  min-height: 44px;
  padding: 6px 7px;
  color: #fff;
  background: transparent;
  border: 1px solid #ffffff70;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.2;
}
#ae-chat .ae-chat__expand:hover { background: #ffffff14; }
#ae-chat .ae-chat__expand:focus-visible { outline-color: var(--ae-accent); }
#ae-chat .ae-chat__title {
  color: var(--ae-paper);
  font: 600 17px/1.3 Montserrat, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-wrap: break-word;
}
#ae-chat .ae-chat__close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #ffffff80;
  border-radius: 50%;
  color: var(--ae-paper);
  background: transparent;
  font-size: 26px;
  font-weight: 300;
  line-height: 38px;
}
#ae-chat .ae-chat__close:hover { background: #ffffff14; }

#ae-chat .ae-chat__context {
  flex: 0 0 auto;
  padding: 11px 22px 12px;
  border-bottom: 1px solid var(--ae-line);
  background: #f5f2f9;
}
#ae-chat .ae-chat__context-label {
  display: block;
  color: var(--ae-muted);
  font-size: 10px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .08em;
}
#ae-chat .ae-chat__context-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 3px;
}
#ae-chat .ae-chat__privacy {
  grid-column: 1 / -1;
  padding: 0;
  color: var(--ae-muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}
#ae-chat .ae-chat__cookies {
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ae-ink);
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#ae-chat .ae-chat__preview {
  flex: 0 0 auto;
  padding: 6px 22px;
  color: #171717;
  background: var(--ae-accent);
  font-size: 11px;
  font-weight: 600;
}

#ae-chat .ae-chat__conversation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c0b1d4 transparent;
}
#ae-chat .ae-chat__log { padding: 17px 17px 7px; }
#ae-chat .ae-chat__permission-privacy { display: inline-block; margin-top: 8px; font-size: 12px; }
#ae-chat .ae-chat__permission-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#ae-chat .ae-chat__permission-yes, #ae-chat .ae-chat__permission-change {
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--ae-brand);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
#ae-chat .ae-chat__permission-yes { background: var(--ae-brand); color: #fff; }
#ae-chat .ae-chat__permission-change { background: #fff; color: var(--ae-brand); }
#ae-chat .ae-chat__permission-yes:disabled, #ae-chat .ae-chat__permission-change:disabled { opacity: .55; }
#ae-chat .ae-chat__message {
  max-width: 94%;
  margin: 0 0 17px;
  padding: 12px 14px;
  border-radius: 4px 15px 15px;
  border: 1px solid var(--ae-line);
  background: #f5f2f9;
  overflow-wrap: anywhere;
}
#ae-chat .ae-chat__message--user {
  margin-left: auto;
  background: #f9f9e6;
  border-color: var(--ae-accent);
  border-radius: 15px 4px 15px 15px;
}
#ae-chat .ae-chat__speaker {
  display: block;
  margin-bottom: 5px;
  color: var(--ae-brand);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .035em;
}
#ae-chat .ae-chat__message-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
#ae-chat .ae-chat__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
#ae-chat .ae-chat__action {
  display: inline-block;
  padding: 8px 11px;
  border: 1px solid #797b00;
  border-radius: 7px;
  color: #171717;
  font-size: 12px;
  font-weight: 600;
  background: var(--ae-accent);
  text-decoration: none;
}
#ae-chat .ae-chat__action:hover { background: #e4e652; }
#ae-chat .ae-chat__action--article { color: var(--ae-brand); border-color: #c0b1d4; background: #fff; }
#ae-chat .ae-chat__action--article:hover { background: #ece5f5; }

#ae-chat .ae-chat__feedback { flex: 0 0 auto; padding: 0 20px; }
#ae-chat .ae-chat__status {
  color: var(--ae-muted);
  font-size: 12px;
  line-height: 1.45;
}
#ae-chat .ae-chat__status:not(:empty) { padding: 1px 0 9px; }
#ae-chat .ae-chat__recovery { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-bottom: 10px; }
#ae-chat .ae-chat__retry {
  padding: 6px 10px;
  border: 1px solid var(--ae-brand);
  border-radius: 6px;
  background: #f5f2f9;
  color: var(--ae-ink);
  font-size: 12px;
}
#ae-chat .ae-chat__error-contact { font-size: 12px; }

#ae-chat .ae-chat__form { flex: 0 0 auto; margin: 0; padding: 8px 17px 10px; }
#ae-chat .ae-chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 0 0 0 6px;
  border: 1px solid #8a7f93;
  border-radius: 12px;
  background: #fff;
}
#ae-chat .ae-chat__composer:focus-within { border-color: var(--ae-brand); box-shadow: 0 0 0 1px var(--ae-brand); }
#ae-chat .ae-chat__input {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 88px;
  padding: 10px 2px;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  color: var(--ae-ink);
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
}
#ae-chat .ae-chat__input::placeholder { color: var(--ae-muted); opacity: 1; }
/* The composer already indicates focus; avoid a second rectangular outline. */
#ae-chat textarea.ae-chat__input:focus,
#ae-chat textarea.ae-chat__input:focus-visible {
  outline: none;
  box-shadow: none;
}
#ae-chat .ae-chat__input:disabled { opacity: .65; }
#ae-chat .ae-chat__send {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ae-brand);
  border-radius: 7px;
  color: #fff;
  background: var(--ae-brand);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
#ae-chat .ae-chat__send:not(:disabled):hover { background: #503879; }
#ae-chat .ae-chat__send:disabled { border-color: var(--ae-line); background: #f0edf4; color: var(--ae-muted); }
#ae-chat .ae-chat__form-meta {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  padding: 5px 1px 0;
  font-size: 9px;
  color: var(--ae-muted);
}
#ae-chat .ae-chat__count { white-space: nowrap; }

#ae-chat .ae-chat__footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px 10px;
  padding: 8px 17px 10px;
  border-top: 1px solid var(--ae-line);
  background: #f5f2f9;
}
#ae-chat .ae-chat__contact { font-size: 10px; }
#ae-chat .ae-chat__reset {
  padding: 4px 0;
  color: var(--ae-muted);
  background: none;
  border: 0;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#ae-chat .ae-chat__reset:disabled { opacity: .5; text-decoration: none; }
#ae-chat .ae-chat__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  #ae-chat { right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom) + var(--ae-keyboard-inset, 0px)); }
  #ae-chat.ae-chat--open { z-index: 2147483647; }
  #ae-chat .ae-chat__launcher { padding-right: 13px; font-size: 12px; }
  #ae-chat .ae-chat__panel {
    position: fixed;
    top: auto;
    left: calc(var(--ae-viewport-left, 0px) + 12px + env(safe-area-inset-left));
    right: auto;
    bottom: calc(var(--ae-keyboard-inset, 0px) + 8px + env(safe-area-inset-bottom));
    width: calc(var(--ae-available-width, 100vw) - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
    height: calc((var(--ae-available-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * .82);
    max-height: calc(var(--ae-available-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 14px;
  }
  #ae-chat .ae-chat__header { min-height: 52px; padding: 4px 8px 4px 14px; gap: 8px; }
  #ae-chat .ae-chat__title { font-size: 14px; }
  #ae-chat.ae-chat--expanded .ae-chat__panel,
  #ae-chat.ae-chat--keyboard .ae-chat__panel {
    width: calc(var(--ae-available-width, 100vw) - 24px - env(safe-area-inset-left) - env(safe-area-inset-right));
    height: calc(var(--ae-available-height, 100dvh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  #ae-chat .ae-chat__context { padding: 8px 14px; }
  #ae-chat .ae-chat__context-title { -webkit-line-clamp: 1; }
  #ae-chat .ae-chat__log { padding: 12px 12px 6px; }
  #ae-chat .ae-chat__message { margin-bottom: 12px; padding: 10px 12px; }
  #ae-chat .ae-chat__form { padding: 6px 12px; }
  #ae-chat .ae-chat__input { font-size: 16px; }
  #ae-chat .ae-chat__form-meta { display: none; }
  #ae-chat .ae-chat__footer { padding: 6px 12px; gap: 4px 8px; }
  #ae-chat.ae-chat--keyboard .ae-chat__context,
  #ae-chat.ae-chat--keyboard .ae-chat__footer > .ae-chat__contact,
  #ae-chat.ae-chat--keyboard .ae-chat__reset,
  #ae-chat.ae-chat--keyboard .ae-chat__actions { display: none; }
  #ae-chat.ae-chat--keyboard .ae-chat__footer { display: block; padding: 4px 8px; }
  #ae-chat.ae-chat--keyboard .ae-chat__privacy { font-size: 10px; }
  #ae-chat.ae-chat--keyboard .ae-chat__log { padding-top: 8px; }
}

@media (min-width: 601px) {
  #ae-chat.ae-chat--compact .ae-chat__panel { height: calc(var(--ae-available-height, 100dvh) - 72px - env(safe-area-inset-bottom)); }
  #ae-chat.ae-chat--compact .ae-chat__header { padding-top: 8px; padding-bottom: 8px; }
}
#ae-chat.ae-chat--compact .ae-chat__context { padding-top: 7px; padding-bottom: 7px; flex-shrink: 0; }
#ae-chat.ae-chat--compact .ae-chat__context-label { display: none; }
#ae-chat.ae-chat--compact .ae-chat__context-title { -webkit-line-clamp: 1; margin: 0; }
#ae-chat.ae-chat--compact .ae-chat__preview { padding-top: 4px; padding-bottom: 4px; font-size: 10px; }
#ae-chat.ae-chat--compact .ae-chat__log { padding-top: 8px; }
#ae-chat.ae-chat--compact .ae-chat__form-meta { display: none; }
#ae-chat.ae-chat--compact .ae-chat__footer { padding-top: 6px; padding-bottom: 6px; gap: 4px 8px; }

body.ae-recaptcha-footer:has(#ae-recaptcha-notice) .grecaptcha-badge { visibility: hidden !important; }
body.ae-recaptcha-footer #ae-recaptcha-notice {
  box-sizing: border-box;
  position: static;
  clear: both;
  width: 100%;
  padding: 12px 20px;
  margin: 0;
  border-top: 1px solid #e6e0ef;
  color: #625d65;
  background: #f5f2f9;
  font: 11px/1.6 Raleway, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
}
body.ae-recaptcha-footer #ae-recaptcha-notice p { margin: 0; padding: 0; font: inherit; color: inherit; }
body.ae-recaptcha-footer #ae-recaptcha-notice a {
  color: #644696;
  text-decoration: underline;
  text-underline-offset: 3px;
}
body.ae-recaptcha-footer #ae-recaptcha-notice a:focus-visible {
  outline: 2px solid #644696;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  #ae-chat .ae-chat__launcher, #ae-chat .ae-chat__action { transition: background-color .15s ease; }
}
