.ask-fred {
  position: fixed;
  right: 1rem;
  bottom: 0.9rem;
  z-index: 1200;
  display: grid;
  justify-items: end;
  gap: 0.75rem;
  pointer-events: none;
}

.ask-fred > * {
  pointer-events: auto;
}

.ask-fred-launcher {
  display: inline-flex;
  min-height: 3.65rem;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #061b46;
  color: #fff;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  font: inherit;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 14, 41, 0.32), 3px 3px 0 var(--gold);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ask-fred-launcher:hover,
.ask-fred-launcher:focus-visible {
  transform: translateY(-2px);
  background: #0b3376;
  box-shadow: 0 18px 42px rgba(0, 14, 41, 0.38), 4px 4px 0 var(--gold);
}

.ask-fred-launcher-avatar,
.ask-fred-avatar {
  position: relative;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 50%;
  background: #eef4ff;
}

.ask-fred-launcher-avatar {
  width: 2.9rem;
  height: 2.9rem;
  border: 2px solid var(--gold);
}

.ask-fred-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid rgba(255, 255, 255, 0.72);
}

.ask-fred-launcher-avatar img,
.ask-fred-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transform: scale(1.08);
}

.ask-fred-launcher-copy {
  display: grid;
  gap: 0.05rem;
  text-align: left;
  line-height: 1.05;
}

.ask-fred-launcher-copy strong {
  font-size: 0.96rem;
  font-weight: 900;
}

.ask-fred-launcher-copy small {
  color: #dce7fb;
  font-size: 0.7rem;
  font-weight: 700;
}

.ask-fred-panel {
  width: min(25.5rem, calc(100vw - 1.5rem));
  max-height: min(42rem, calc(100vh - 8.5rem));
  overflow: hidden;
  border: 1px solid #d9e2ef;
  border-radius: 20px;
  background: #f7f9fc;
  color: #14213d;
  box-shadow: 0 28px 80px rgba(0, 14, 41, 0.34);
}

.ask-fred-panel[hidden] {
  display: none;
}

.ask-fred-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 88% -20%, rgba(246, 196, 69, 0.24), transparent 10rem),
    #061b46;
  color: #fff;
}

.ask-fred-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.ask-fred-kicker {
  margin: 0 0 0.1rem;
  color: #dce7fb;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ask-fred-header h2 {
  max-width: none;
  margin: 0;
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
}

.ask-fred-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.32rem 0 0;
  color: #dfe9f8;
  font-size: 0.73rem;
  font-weight: 700;
}

.ask-fred-status span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #7ee2a8;
  box-shadow: 0 0 0 3px rgba(126, 226, 168, 0.14);
}

.ask-fred-close {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
}

.ask-fred-close:hover,
.ask-fred-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

.ask-fred-body {
  background:
    linear-gradient(rgba(6, 27, 70, 0.025) 1px, transparent 1px),
    #f7f9fc;
  background-size: 100% 2.75rem;
}

.ask-fred-messages {
  display: grid;
  gap: 0.7rem;
  max-height: 20rem;
  overflow-y: auto;
  padding: 1rem 1rem 0.8rem;
  scroll-behavior: smooth;
}

.ask-fred-message {
  width: fit-content;
  max-width: 90%;
  margin: 0;
  border-radius: 15px;
  padding: 0.72rem 0.82rem;
  font-size: 0.9rem;
  line-height: 1.48;
}

.ask-fred-message--assistant {
  justify-self: start;
  border: 1px solid #dbe4ef;
  border-bottom-left-radius: 5px;
  background: #fff;
  color: #1b2a44;
  box-shadow: 0 4px 14px rgba(6, 27, 70, 0.06);
}

.ask-fred-message--user {
  justify-self: end;
  border-bottom-right-radius: 5px;
  background: #0b3376;
  color: #fff;
  font-weight: 700;
}

.ask-fred-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  min-width: 3.2rem;
}

.ask-fred-typing span {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: #7890b0;
  animation: askFredTyping 900ms infinite ease-in-out;
}

.ask-fred-typing span:nth-child(2) {
  animation-delay: 130ms;
}

.ask-fred-typing span:nth-child(3) {
  animation-delay: 260ms;
}

.ask-fred-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  padding: 0 1rem 0.95rem;
}

.ask-fred.has-chat .ask-fred-quick {
  display: none;
}

.ask-fred-quick button,
.ask-fred-quick-link {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #bccae0;
  border-radius: 999px;
  background: #fff;
  color: #0b3376;
  padding: 0.38rem 0.68rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.ask-fred-quick button:hover,
.ask-fred-quick button:focus-visible,
.ask-fred-quick-link:hover,
.ask-fred-quick-link:focus-visible {
  border-color: #0b3376;
  background: #edf3ff;
}

.ask-fred-compose {
  border-top: 1px solid #d9e2ef;
  background: #fff;
  padding: 0.78rem 0.9rem 0.8rem;
}

.ask-fred-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
}

.ask-fred-form input {
  min-width: 0;
  min-height: 2.9rem;
  border: 1px solid #bac7da;
  border-radius: 11px;
  background: #fff;
  color: #14213d;
  padding: 0.6rem 0.75rem;
  font: inherit;
  outline: none;
}

.ask-fred-form input:focus {
  border-color: #0b3376;
  box-shadow: 0 0 0 3px rgba(11, 51, 118, 0.1);
}

.ask-fred-form input::placeholder {
  color: #71819a;
}

.ask-fred-form button {
  min-height: 2.9rem;
  border: 0;
  border-radius: 11px;
  background: var(--gold);
  color: #111;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.ask-fred-form button:hover,
.ask-fred-form button:focus-visible {
  filter: brightness(0.96);
}

.ask-fred-handoff {
  display: flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  margin-top: 0.55rem;
  border: 1px solid #d5deea;
  border-radius: 10px;
  background: #f7f9fc;
  color: #0b3376;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.ask-fred-handoff:hover,
.ask-fred-handoff:focus-visible {
  border-color: #0b3376;
  background: #edf3ff;
}

.ask-fred-handoff[hidden] {
  display: none;
}

.ask-fred-note {
  margin: 0.55rem 0 0;
  color: #6b7890;
  font-size: 0.67rem;
  line-height: 1.35;
  text-align: center;
}

body.ask-fred-open .sticky-cta {
  opacity: 0;
  pointer-events: none;
}

/* Keep the launcher clear of the temporary analytics-consent panel. */
body:has(.analytics-choice:not([hidden])) .ask-fred {
  bottom: calc(var(--analytics-choice-space, 150px) + max(0.75rem, env(safe-area-inset-bottom)));
}

body.analytics-choice-open .ask-fred-panel:not([hidden]) {
  display: flex;
  flex-direction: column;
  max-height: min(42rem, calc(100dvh - var(--analytics-choice-space, 150px) - 96px));
}

body.analytics-choice-open .ask-fred-body { min-height: 0; overflow-y: auto; }
body.analytics-choice-open .ask-fred-compose { flex: 0 0 auto; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes askFredTyping {
  0%, 70%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  35% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (max-width: 699px) {
  .ask-fred {
    right: 0.5rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  body.ask-fred-open {
    overflow: hidden;
  }

  body.ask-fred-open .ask-fred {
    top: calc(var(--ask-fred-visual-top, 0px) + max(0.35rem, env(safe-area-inset-top)));
    right: 0.35rem;
    bottom: auto;
    left: 0.35rem;
    height: calc(var(--ask-fred-visual-height, 100dvh) - max(0.7rem, env(safe-area-inset-top)) - max(0.35rem, env(safe-area-inset-bottom)));
    display: block;
  }

  body.ask-fred-open .ask-fred-launcher {
    display: none;
  }

  .ask-fred-panel {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    border-radius: 17px;
  }

  body.ask-fred-open .ask-fred-panel {
    display: flex;
    width: 100%;
    height: 100%;
    max-height: none;
    flex-direction: column;
  }

  body.ask-fred-open.analytics-choice-open .ask-fred {
    height: calc(var(--ask-fred-visual-height, 100dvh) - var(--analytics-choice-space, 150px) - max(0.7rem, env(safe-area-inset-top)) - max(0.7rem, env(safe-area-inset-bottom)));
  }

  .ask-fred-panel:focus {
    outline: none;
  }

  .ask-fred-header {
    align-items: center;
    padding: 0.62rem 0.7rem;
  }

  .ask-fred-avatar {
    width: 2.5rem;
    height: 2.5rem;
  }

  .ask-fred-kicker {
    display: none;
  }

  .ask-fred-header h2 {
    font-size: 1.15rem;
    line-height: 1.1;
  }

  .ask-fred-status {
    margin-top: 0.12rem;
    font-size: 0.68rem;
  }

  .ask-fred-close {
    width: 2.75rem;
    height: 2.75rem;
  }

  .ask-fred-body {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: hidden;
  }

  .ask-fred-messages {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    padding: 0.75rem 0.75rem 0.65rem;
  }

  .ask-fred-message {
    max-width: 94%;
    font-size: 0.9rem;
    line-height: 1.42;
  }

  .ask-fred-quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
    gap: 0.4rem;
    padding: 0 0.75rem 0.75rem;
  }

  .ask-fred-quick button,
  .ask-fred-quick-link {
    min-height: 2.75rem;
    border-radius: 12px;
    padding: 0.5rem 0.55rem;
    font-size: 0.74rem;
  }

  .ask-fred-compose {
    flex: 0 0 auto;
    padding: 0.62rem 0.7rem calc(0.62rem + env(safe-area-inset-bottom));
  }

  .ask-fred-form input,
  .ask-fred-form button {
    min-height: 2.75rem;
  }

  .ask-fred-note {
    margin-top: 0.38rem;
    font-size: 0.61rem;
  }

  .ask-fred-launcher {
    min-height: 3.45rem;
  }

  .ask-fred-launcher-avatar {
    width: 2.7rem;
    height: 2.7rem;
  }
}

@media (max-width: 390px) {
  .ask-fred-launcher-copy small {
    display: none;
  }

  .ask-fred-quick {
    gap: 0.34rem;
  }

  .ask-fred-quick button,
  .ask-fred-quick-link {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ask-fred-launcher,
  .ask-fred-messages,
  .ask-fred-typing span {
    transition: none;
    scroll-behavior: auto;
    animation: none;
  }
}
