.hl-chatbot {
  --hl-chatbot-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  --hl-chatbot-right: clamp(14px, 2vw, 24px);
  --hl-chatbot-panel-clearance: 18px;
  --hl-border: rgba(245, 244, 240, 0.22);
  --hl-text: #F5F4F0;
  --hl-muted: rgba(245, 244, 240, 0.72);
  --hl-user-start: #E63946;
  --hl-user-end: #B8222D;
  position: fixed;
  right: var(--hl-chatbot-right);
  bottom: var(--hl-chatbot-bottom);
  z-index: 990;
  pointer-events: none;
  font-family: var(--font-body, 'Inter'), -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.hl-chatbot * {
  box-sizing: border-box;
}

.hl-chatbot__toggle {
  position: relative;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(245, 244, 240, 0.28);
  border-radius: 8px;
  padding: 11px 14px;
  background: rgba(11, 11, 13, 0.96);
  backdrop-filter: none;
  color: var(--hl-text);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(245, 244, 240, 0.12);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.22s ease;
}

.hl-chatbot__toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(245, 244, 240, 0.16);
}

.hl-chatbot__toggle:focus-visible {
  outline: 2px solid rgba(230, 57, 70, 0.85);
  outline-offset: 2px;
}

.hl-chatbot__toggle-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E63946;
  line-height: 0;
}

.hl-chatbot__toggle-icon svg {
  width: 16px;
  height: 16px;
  fill: #F5F4F0;
}

.hl-chatbot__toggle-badge {
  position: absolute;
  top: -6px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  border-radius: 8px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #E63946;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 5px 14px rgba(230, 57, 70, 0.34);
}

.hl-chatbot__toggle-badge[hidden] {
  display: none;
}

.hl-chatbot__panel {
  pointer-events: auto;
  position: absolute;
  right: 0;
  bottom: 0;
  width: min(412px, calc(100vw - 24px));
  height: min(650px, calc(100dvh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance)));
  max-height: calc(100dvh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 8px;
  border: 1px solid var(--hl-border);
  background: rgba(11, 11, 13, 0.96);
  backdrop-filter: none;
  box-shadow: 0 32px 72px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(245, 244, 240, 0.12);
  overflow: hidden;
  transform-origin: bottom right;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, transform 0.24s ease, visibility 0.24s ease;
}

@supports not (height: 100dvh) {
  .hl-chatbot__panel {
    height: min(650px, calc(100vh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance)));
    max-height: calc(100vh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance));
  }
}

.hl-chatbot__panel::before,
.hl-chatbot__panel::after {
  content: '';
  display: none;
}

.hl-chatbot__panel::after {
  display: none;
}

.hl-chatbot[data-open='true'] .hl-chatbot__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.hl-chatbot[data-open='true'] .hl-chatbot__toggle {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.hl-chatbot__header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(245, 244, 240, 0.06);
}

.hl-chatbot__title {
  margin: 0;
  color: var(--hl-text);
  font-size: 0.98rem;
  font-weight: 650;
}

.hl-chatbot__subtitle {
  margin: 2px 0 0;
  color: var(--hl-muted);
  font-size: 0.82rem;
}

.hl-chatbot__close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #F5F4F0;
  font-size: 1.14rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: none;
}

.hl-chatbot__close:hover {
  background: rgba(230, 57, 70, 0.18);
}

.hl-chatbot__messages {
  position: relative;
  z-index: 1;
  padding: 16px 14px;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hl-chatbot__messages::-webkit-scrollbar {
  width: 7px;
}

.hl-chatbot__messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 8px;
}

.hl-chatbot__message-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.hl-chatbot__message-row--user {
  justify-content: flex-end;
}

.hl-chatbot__message-body {
  max-width: 83%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.hl-chatbot__message-row--user .hl-chatbot__message-body {
  align-items: flex-end;
  order: 1;
}

.hl-chatbot__message-row--user .hl-chatbot__avatar {
  order: 2;
}

.hl-chatbot__avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.hl-chatbot__avatar--bot {
  color: #e9f4ff;
  background: #2A2D34;
  border: 1px solid rgba(245, 244, 240, 0.28);
}

.hl-chatbot__avatar--user {
  color: #F5F4F0;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.hl-chatbot__message {
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 0.92rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
  animation: hl-chatbot-bubble-in 0.22s ease;
}

.hl-chatbot__message--bot {
  color: #F5F4F0;
  border: 1px solid rgba(245, 244, 240, 0.2);
  background: rgba(245, 244, 240, 0.08);
  backdrop-filter: none;
  border-bottom-left-radius: 8px;
}

.hl-chatbot__message--user {
  color: #F5F4F0;
  border: 1px solid rgba(230, 57, 70, 0.52);
  background: var(--hl-user-start);
  box-shadow: 0 10px 24px rgba(230, 57, 70, 0.24);
  border-bottom-right-radius: 8px;
}

.hl-chatbot__time {
  margin: 0 4px;
  color: rgba(245, 244, 240, 0.58);
  font-size: 0.67rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.hl-chatbot__message--typing {
  padding: 11px 12px;
}

.hl-chatbot__typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 28px;
  justify-content: center;
}

.hl-chatbot__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 8px;
  background: rgba(245, 244, 240, 0.95);
  animation: hl-chatbot-dot-pulse 1s ease-in-out infinite;
}

.hl-chatbot__typing-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.hl-chatbot__typing-dot:nth-child(3) {
  animation-delay: 0.24s;
}

.hl-chatbot__footer {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(42, 45, 52, 0.72);
  backdrop-filter: none;
}

.hl-chatbot__quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 98px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.hl-chatbot__quick-replies[hidden] {
  display: none;
}

.hl-chatbot__quick-reply {
  border: 1px solid rgba(245, 244, 240, 0.28);
  border-radius: 8px;
  background: rgba(245, 244, 240, 0.08);
  color: #F5F4F0;
  padding: 7px 11px;
  font-size: 0.78rem;
  font-weight: 570;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hl-chatbot__quick-reply:hover {
  border-color: rgba(230, 57, 70, 0.68);
  background: rgba(230, 57, 70, 0.16);
  transform: translateY(-1px);
}

.hl-chatbot__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.hl-chatbot__input {
  min-width: 0;
  border-radius: 8px;
  border: 1px solid rgba(245, 244, 240, 0.3);
  background: rgba(245, 244, 240, 0.08);
  color: #F5F4F0;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.2;
  padding: 10px 13px;
}

.hl-chatbot__input::placeholder {
  color: rgba(245, 244, 240, 0.66);
}

.hl-chatbot__input:focus {
  outline: none;
  border-color: rgba(230, 57, 70, 0.95);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.2);
}

.hl-chatbot__send {
  border: 0;
  border-radius: 8px;
  background: #E63946;
  color: #F5F4F0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 640;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(230, 57, 70, 0.28);
}

.hl-chatbot__send:hover {
  filter: brightness(1.06);
}

.hl-chatbot__handoff {
  display: block;
  text-align: center;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid rgba(230, 57, 70, 0.42);
  background: rgba(230, 57, 70, 0.18);
  color: #F5F4F0;
  font-size: 0.86rem;
  font-weight: 620;
  padding: 9px 12px;
}

.hl-chatbot__handoff:hover {
  filter: brightness(1.07);
}

.hl-chatbot__handoff--secondary {
  border-color: rgba(245, 244, 240, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: #F5F4F0;
}

.hl-chatbot__send:disabled,
.hl-chatbot__input:disabled,
.hl-chatbot__quick-reply:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

@keyframes hl-chatbot-liquid {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(8%, -6%, 0) scale(1.06);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes hl-chatbot-bubble-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hl-chatbot-dot-pulse {
  0%,
  80%,
  100% {
    opacity: 0.32;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-1px);
  }
}

@media (max-width: 900px) {
  .hl-chatbot {
    --hl-chatbot-right: 12px;
    --hl-chatbot-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .hl-chatbot__panel {
    width: min(410px, calc(100vw - 16px));
  }

  .hl-chatbot__toggle-label {
    display: none;
  }
}

@media (max-width: 760px) {
  .hl-chatbot {
    left: auto;
    right: 10px;
    --hl-chatbot-right: 10px;
    --hl-chatbot-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    --hl-chatbot-panel-clearance: 12px;
  }

  body:has([data-netlify-deploy-id]) .hl-chatbot {
    --hl-chatbot-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  .hl-chatbot__toggle {
    margin-left: auto;
  }

  .hl-chatbot__panel {
    width: min(410px, calc(100vw - 16px));
    height: min(620px, calc(100dvh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance)));
    max-height: calc(100dvh - var(--hl-chatbot-bottom) - var(--hl-chatbot-panel-clearance));
    border-radius: 8px;
  }

  .hl-chatbot__messages {
    padding: 14px 12px;
  }

  .hl-chatbot__message-body {
    max-width: 88%;
  }

  .hl-chatbot__quick-replies {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    padding-bottom: 2px;
  }

  .hl-chatbot__quick-reply {
    white-space: nowrap;
    flex-shrink: 0;
  }
}
