#aivy-chat-launcher {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 36px);
  min-height: 64px;
  margin: 0;
  padding: 12px 22px 12px 14px;
  border: 1px solid #ffffff24;
  border-radius: 40px;
  background: #22263f;
  color: #fff;
  box-shadow: 0 8px 28px #11172b38;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease;
}
#aivy-chat-launcher:hover { background: #303651; box-shadow: 0 10px 32px #11172b50; }
#aivy-chat-launcher .aivy-chat-launcher__symbol { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: #ed1468; color: #fff; font: 28px/1 Arial, sans-serif; }
#aivy-chat-launcher .aivy-chat-launcher__text { display: grid; gap: 3px; }
#aivy-chat-launcher .aivy-chat-launcher__hint { color: #e0e4f1; font-size: 11px; font-weight: 400; line-height: 1.4; }
#aivy-chat-launcher .aivy-chat-launcher__label { color: #fff; font-size: 15px; font-weight: 600; line-height: 1.3; }
#aivy-chat-dialog { position: fixed; inset: 0; box-sizing: border-box; width: min(1160px, calc(100% - 48px)); height: min(850px, calc(100% - 48px)); height: min(850px, calc(100dvh - 48px)); max-width: none; max-height: none; margin: auto; padding: 0; overflow: hidden; border: 1px solid #dce3ef; border-radius: 20px; background: #fff; color: #22263f; font-family: Arial, sans-serif; box-shadow: 0 24px 100px #080e294d; }
#aivy-chat-dialog[open] { display: flex; flex-direction: column; }
#aivy-chat-dialog::backdrop { background: #11172bc4; }
#aivy-chat-dialog * { box-sizing: border-box; }
#aivy-chat-dialog [hidden] { display: none !important; }
#aivy-chat-dialog .aivy-chat-header { display: flex; justify-content: space-between; align-items: center; flex: none; gap: 16px; padding: 12px 18px 12px 24px; border-bottom: 1px solid #e0e5ef; background: #fff; }
#aivy-chat-dialog .aivy-chat-title { margin: 0; color: #22263f; font-family: inherit; font-size: 17px; font-weight: 600; line-height: 1.4; }
#aivy-chat-dialog .aivy-chat-subtitle { margin: 3px 0 0; color: #536078; font-size: 12px; line-height: 1.4; }
#aivy-chat-dialog .aivy-chat-actions { display: flex; align-items: center; gap: 18px; }
#aivy-chat-dialog .aivy-chat-external { color: #43506b; font-size: 12px; line-height: 1.4; text-decoration: underline; text-underline-offset: 3px; }
#aivy-chat-dialog .aivy-chat-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #f0f3f8; color: #22263f; font: 30px/1 Arial, sans-serif; cursor: pointer; }
#aivy-chat-dialog .aivy-chat-close:hover { background: #e3e8f1; }
#aivy-chat-dialog .aivy-chat-body { position: relative; flex: 1; min-height: 0; background: #f6f8fc; }
#aivy-chat-dialog .aivy-chat-loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #536078; font-size: 14px; }
#aivy-chat-dialog .aivy-chat-frame { position: relative; display: block; width: 100%; height: 100%; border: 0; background: #fff; }
#aivy-chat-dialog .aivy-chat-footer { flex: none; margin: 0; padding: 8px 16px; border-top: 1px solid #e0e5ef; color: #536078; font-size: 11px; line-height: 1.4; text-align: center; background: #fff; }
#aivy-chat-launcher:focus-visible, #aivy-chat-dialog :is(button,a):focus-visible { outline: 3px solid #0073cf; outline-offset: 3px; }
@media (max-width: 700px) {
  #aivy-chat-launcher { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); min-height: 54px; padding: 9px 17px 9px 10px; gap: 9px; }
  #aivy-chat-launcher .aivy-chat-launcher__symbol { flex-basis: 34px; width: 34px; height: 34px; font-size: 25px; }
  #aivy-chat-launcher .aivy-chat-launcher__hint { display: none; }
  #aivy-chat-dialog { width: 100%; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  #aivy-chat-dialog .aivy-chat-header { gap: 8px; padding: max(8px, env(safe-area-inset-top)) 10px 8px 14px; }
  #aivy-chat-dialog .aivy-chat-title { font-size: 15px; }
  #aivy-chat-dialog .aivy-chat-subtitle { display: none; }
  #aivy-chat-dialog .aivy-chat-actions { gap: 10px; }
  #aivy-chat-dialog .aivy-chat-external { max-width: 105px; font-size: 11px; }
  #aivy-chat-dialog .aivy-chat-footer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { #aivy-chat-launcher { transition: none; } }

/* Keep the back-to-top button above Aivy, with a 16px gap. */
body:has(#aivy-chat-launcher) #back-button {
  bottom: calc(max(22px, env(safe-area-inset-bottom)) + 80px) !important;
  right: max(22px, env(safe-area-inset-right));
}
@media (max-width: 700px) {
  body:has(#aivy-chat-launcher) #back-button {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 70px) !important;
    right: max(14px, env(safe-area-inset-right));
  }
}
