.chatbot {
  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 80;
  font-family: var(--font-body);
}

.chatbot-trigger {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 48px;
  padding: .78rem 1rem;
  border: 1px solid rgba(23,37,54,.1);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(180deg, #54aef0, var(--blue));
  box-shadow: 0 18px 44px rgba(23,37,54,.2);
  font-weight: 900;
  cursor: pointer;
}

.chatbot-trigger:focus-visible,
.chatbot-close:focus-visible,
.chatbot-form button:focus-visible,
.chatbot-quick-actions button:focus-visible,
.chatbot-action:focus-visible {
  outline: 3px solid rgba(242,140,56,.55);
  outline-offset: 3px;
}

.chatbot-trigger-icon {
  position: relative;
  width: 24px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 4px;
}

.chatbot-trigger-icon::before,
.chatbot-trigger-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 14px;
  height: 14px;
  border-bottom: 2px solid #fff;
}

.chatbot-trigger-icon::before {
  left: 0;
  transform: rotate(34deg);
}

.chatbot-trigger-icon::after {
  right: 0;
  transform: rotate(-34deg);
}

.chatbot-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + .85rem);
  display: grid;
  grid-template-rows: auto minmax(140px, 1fr) auto auto;
  width: min(390px, calc(100vw - 2rem));
  max-height: min(680px, calc(100vh - 6rem));
  overflow: hidden;
  border: 1px solid rgba(23,37,54,.09);
  border-radius: 18px;
  background: linear-gradient(180deg, #f5fbff, #fff);
  box-shadow: 0 28px 86px rgba(23,37,54,.24);
}

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

.chatbot-panel:not([hidden]) {
  animation: chatbotRise 220ms var(--ease) both;
}

.chatbot-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 20%, rgba(255,216,77,.28) 0 12%, transparent 13%),
    linear-gradient(135deg, rgba(255,255,255,.95), rgba(226,244,255,.9));
  border-bottom: 1px solid rgba(23,37,54,.08);
}

.chatbot-eyebrow {
  margin: 0 0 .15rem;
  color: rgba(23,37,54,.56);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.chatbot-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.chatbot-close {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(23,37,54,.1);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.chatbot-messages {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  overflow-y: auto;
  padding: 1rem;
}

.chatbot-message {
  max-width: 88%;
  padding: .82rem .92rem;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(23,37,54,.08);
}

.chatbot-message p,
.chatbot-message li {
  margin: 0;
  color: rgba(23,37,54,.78);
  font-size: .96rem;
  line-height: 1.48;
}

.chatbot-message p + p,
.chatbot-message p + ul,
.chatbot-message ul + p {
  margin-top: .55rem;
}

.chatbot-message ul {
  margin: .55rem 0 0;
  padding-left: 1.1rem;
}

.chatbot-message li + li {
  margin-top: .3rem;
}

.chatbot-message.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(62,155,232,.16);
}

.chatbot-message.typing {
  min-width: 72px;
}

.chatbot-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  min-height: 22px;
}

.chatbot-typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--blue);
  opacity: .42;
  animation: chatbotTypingDot 900ms var(--ease) infinite;
}

.chatbot-typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.chatbot-typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

.chatbot-message.user {
  align-self: flex-end;
  color: #fff;
  background: var(--blue);
}

.chatbot-message.user p,
.chatbot-message.user li {
  color: #fff;
}

.chatbot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}

.chatbot-action {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: .48rem .65rem;
  border-radius: 999px;
  color: #8a430c;
  background: var(--orange-soft);
  border: 1px solid #ffd0a9;
  font-size: .86rem;
  font-weight: 900;
  text-decoration: none;
}

.chatbot-prompts {
  padding: .55rem 1rem;
  border-top: 1px solid rgba(23,37,54,.07);
}

.chatbot-prompts p {
  margin: 0 0 .35rem;
  color: rgba(23,37,54,.58);
  font-size: .76rem;
  font-weight: 900;
}

.chatbot-quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: .32rem;
}

.chatbot-quick-actions button {
  width: 100%;
  min-height: 32px;
  padding: .34rem .58rem;
  border: 1px solid rgba(62,155,232,.2);
  border-radius: 12px;
  color: var(--blue-dark);
  background: #fff;
  font-size: .84rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.chatbot-quick-actions button[disabled] {
  cursor: wait;
  opacity: .58;
}

.chatbot-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  padding: .85rem 1rem 1rem;
  background: #fff;
  border-top: 1px solid rgba(23,37,54,.07);
}

.chatbot-form input {
  width: 100%;
  min-height: 44px;
  padding: .7rem .8rem;
  border: 1px solid rgba(23,37,54,.16);
  border-radius: 999px;
  font: inherit;
}

.chatbot-form button {
  min-height: 44px;
  padding: .68rem .85rem;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--orange);
  font-weight: 900;
  cursor: pointer;
}

.chatbot-form button[disabled] {
  cursor: wait;
  opacity: .65;
}

.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;
}

@keyframes chatbotRise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes chatbotTypingDot {
  0%, 100% {
    opacity: .32;
    transform: translateY(0);
  }
  45% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 520px) {
  .chatbot {
    right: .75rem;
    bottom: .75rem;
    left: .75rem;
  }

  .chatbot-trigger {
    margin-left: auto;
  }

  .chatbot-panel {
    left: 0;
    right: 0;
    width: auto;
    max-height: min(620px, calc(100vh - 5.5rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot-panel:not([hidden]) {
    animation: none;
  }

  .chatbot-typing-dots i {
    animation: none;
  }
}
