.chatbot-toggle {
  position: fixed;
  left: 20px;
  bottom: 76px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, #ffd166, #f7c54b);
  color: #2b2b2b;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 1050;
  transition: bottom .3s ease, transform .2s ease;
}

.chatbot-toggle:hover {
  transform: translateY(-2px);
}

.chatbot-toggle.chatbot-raised {
  bottom: 200px;
}

.chatbot-nudge {
  position: fixed;
  left: 20px;
  bottom: 144px;
  max-width: 230px;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 12px 30px 12px 16px;
  box-shadow: var(--shadow);
  z-index: 1049;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(.96);
  transition: opacity .25s ease, transform .25s ease, bottom .3s ease;
}

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

.chatbot-nudge-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: chatbot-nudge-wiggle 2.6s ease 1.2s 2;
}

.chatbot-nudge::after {
  content: '';
  position: absolute;
  left: 26px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 72%, transparent);
  border-right: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
  transform: rotate(45deg);
}

.chatbot-nudge.chatbot-raised {
  bottom: 268px;
}

.chatbot-nudge-text {
  margin: 0;
  font-size: .85rem;
  line-height: 1.4;
  color: var(--text);
}

.chatbot-nudge-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: 0 0;
  color: var(--muted);
  font-size: .75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-nudge-close:hover {
  background: var(--stroke);
  color: var(--text);
}

@keyframes chatbot-nudge-wiggle {
  0%, 100% { transform: translateY(0) scale(1) rotate(0); }
  4% { transform: translateY(0) scale(1) rotate(-3deg); }
  8% { transform: translateY(0) scale(1) rotate(3deg); }
  12% { transform: translateY(0) scale(1) rotate(0); }
}

@media (max-width: 480px) {
  .chatbot-nudge {
    left: 16px;
    bottom: 140px;
    max-width: calc(100vw - 90px);
  }

  .chatbot-nudge.chatbot-raised {
    bottom: 264px;
  }
}

.chatbot-panel {
  position: fixed;
  left: 20px;
  bottom: 142px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 600px;
  max-height: calc(100vh - 160px);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1050;
  transition: bottom .3s ease;
}

.chatbot-panel.chatbot-raised {
  bottom: 266px;
}

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

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--stroke);
  background: var(--bg-soft);
}

.chatbot-title {
  font-weight: 700;
  color: var(--text);
}

.chatbot-close {
  background: 0 0;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.chatbot-close:hover {
  background: var(--stroke);
  color: var(--text);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-msg {
  max-width: 84%;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: .92rem;
  line-height: 1.5;
}

.chatbot-msg p {
  margin: 0;
}

.chatbot-msg p + p {
  margin-top: 6px;
}

.chatbot-msg-bot {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--stroke);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chatbot-msg-user {
  align-self: flex-end;
  background: linear-gradient(180deg, #ffd166, #f7c54b);
  color: #2b2b2b;
  border-bottom-right-radius: 4px;
}

.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px;
}

.chatbot-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: chatbot-typing-bounce 1.2s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: .2s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: .4s;
}

@keyframes chatbot-typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: .5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.chatbot-input:disabled,
.chatbot-send:disabled {
  opacity: .6;
  cursor: default;
}

.chatbot-quick-replies {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 0 14px 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}

.chatbot-chip {
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .2s ease;
}

.chatbot-chip:hover {
  background: var(--stroke);
}

.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--stroke);
}

.chatbot-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--bg-soft);
  color: var(--text);
  font-size: .9rem;
}

.chatbot-input:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 1px;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid #e1b748;
  background: linear-gradient(180deg, #ffd166, #f7c54b);
  color: #2b2b2b;
  font-size: 1rem;
  cursor: pointer;
}

.chatbot-send:hover {
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .chatbot-panel {
    left: 12px;
    right: 12px;
    top: 16px;
    bottom: 132px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
  }

  .chatbot-panel.chatbot-raised {
    bottom: 256px;
  }

  .chatbot-toggle {
    left: 16px;
    bottom: 72px;
  }
}
