.hasa-root,
.hasa-root * {
  box-sizing: border-box;
}

.hasa-root {
  --hasa-surface: #fff;
  --hasa-bg: #f4f7f5;
  --hasa-text: #17221c;
  --hasa-muted: #68756d;
  --hasa-border: #e1e8e3;
  --hasa-shadow: 0 24px 70px rgba(12, 39, 27, .22);
  color: var(--hasa-text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.hasa-floating {
  bottom: max(20px, env(safe-area-inset-bottom));
  position: fixed;
  z-index: 999999;
}

.hasa-pos-right { right: 20px; }
.hasa-pos-left { left: 20px; }

.hasa-launcher {
  align-items: center;
  background: var(--hasa-primary);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(10, 50, 31, .28);
  color: #fff;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-weight: 700;
  gap: 10px;
  margin: 0;
  min-height: 58px;
  padding: 7px 18px 7px 8px;
  transition: transform .2s ease, box-shadow .2s ease;
}

/* Keep HATRI's existing WhatsApp and LINE shortcuts above the AI launcher. */
body .floating-contact {
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 66px));
  right: 20px;
}

.hasa-pos-right .hasa-launcher { margin-left: auto; }
.hasa-pos-left .hasa-launcher { margin-right: auto; }

.hasa-launcher:hover {
  box-shadow: 0 16px 38px rgba(10, 50, 31, .34);
  transform: translateY(-2px);
}

.hasa-launcher:focus-visible,
.hasa-root button:focus-visible,
.hasa-root a:focus-visible,
.hasa-root textarea:focus-visible,
.hasa-root input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hasa-accent) 70%, #fff);
  outline-offset: 2px;
}

.hasa-launcher-icon {
  align-items: center;
  background: var(--hasa-accent);
  border-radius: 50%;
  display: flex;
  height: 44px;
  justify-content: center;
  width: 44px;
}

.hasa-launcher svg {
  fill: var(--hasa-primary);
  height: 25px;
  width: 25px;
}

.hasa-panel {
  background: var(--hasa-surface);
  border: 1px solid rgba(17, 63, 45, .12);
  border-radius: 22px;
  box-shadow: var(--hasa-shadow);
  display: flex;
  flex-direction: column;
  height: min(680px, calc(100dvh - 45px));
  max-height: 680px;
  overflow: hidden;
  width: min(398px, calc(100vw - 28px));
}

.hasa-floating .hasa-panel {
  bottom: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
  transform: translateY(14px) scale(.97);
  transition: opacity .2s ease, transform .2s ease;
}

.hasa-pos-right .hasa-panel { right: 0; }
.hasa-pos-left .hasa-panel { left: 0; }

.hasa-floating.hasa-open .hasa-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.hasa-floating.hasa-open .hasa-launcher {
  opacity: 0;
  pointer-events: none;
}

.hasa-header {
  align-items: center;
  background: linear-gradient(135deg, var(--hasa-primary), color-mix(in srgb, var(--hasa-primary) 82%, #000));
  color: #fff;
  display: flex;
  gap: 11px;
  min-height: 75px;
  padding: 13px 14px;
}

.hasa-avatar {
  align-items: center;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  display: flex;
  flex: 0 0 46px;
  height: 46px;
  justify-content: center;
  position: relative;
  width: 46px;
}

.hasa-avatar img {
  border-radius: 50%;
  display: block;
  height: 40px;
  object-fit: contain;
  width: 40px;
}

.hasa-avatar span {
  color: var(--hasa-primary);
  font-size: 22px;
  font-weight: 900;
}

.hasa-avatar i {
  background: #35c76f;
  border: 2px solid var(--hasa-primary);
  border-radius: 50%;
  bottom: -1px;
  height: 12px;
  position: absolute;
  right: -1px;
  width: 12px;
}

.hasa-heading {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.hasa-heading strong {
  font-size: 15px;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hasa-heading span {
  color: rgba(255, 255, 255, .78);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hasa-icon-button {
  align-items: center;
  background: rgba(255, 255, 255, .1);
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  height: 36px;
  justify-content: center;
  padding: 0;
  width: 36px;
}

.hasa-icon-button svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
  width: 21px;
}

.hasa-messages {
  background:
    radial-gradient(circle at 15% 0, rgba(227, 173, 24, .08), transparent 28%),
    var(--hasa-bg);
  flex: 1;
  min-height: 180px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 13px 10px;
  scroll-behavior: smooth;
}

.hasa-message {
  display: flex;
  margin: 0 0 10px;
}

.hasa-message-user { justify-content: flex-end; }
.hasa-message-assistant { justify-content: flex-start; }

.hasa-bubble {
  border-radius: 17px;
  box-shadow: 0 2px 8px rgba(18, 63, 45, .06);
  max-width: 88%;
  padding: 10px 12px;
  white-space: pre-line;
  word-break: break-word;
}

.hasa-message-assistant .hasa-bubble {
  background: #fff;
  border: 1px solid var(--hasa-border);
  border-bottom-left-radius: 5px;
}

.hasa-message-user .hasa-bubble {
  background: var(--hasa-primary);
  border-bottom-right-radius: 5px;
  color: #fff;
}

.hasa-typing-row .hasa-bubble {
  align-items: center;
  color: var(--hasa-muted);
  display: flex;
  gap: 4px;
}

.hasa-typing-label {
  font-size: 11px;
  margin-right: 4px;
}

.hasa-typing-row i {
  animation: hasa-bounce 1.25s infinite ease-in-out;
  background: var(--hasa-accent);
  border-radius: 50%;
  height: 5px;
  width: 5px;
}

.hasa-typing-row i:nth-of-type(2) { animation-delay: .16s; }
.hasa-typing-row i:nth-of-type(3) { animation-delay: .32s; }

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

.hasa-products {
  display: grid;
  gap: 9px;
  margin: 2px 0 13px;
}

.hasa-product {
  background: #fff;
  border: 1px solid var(--hasa-border);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 80px 1fr;
  min-height: 95px;
  overflow: hidden;
}

.hasa-product > img {
  height: 100%;
  min-height: 95px;
  object-fit: cover;
  width: 80px;
}

.hasa-product-content {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  padding: 9px 10px;
}

.hasa-product-content strong {
  font-size: 12.5px;
  line-height: 1.35;
}

.hasa-product-content p {
  color: var(--hasa-muted);
  display: -webkit-box;
  font-size: 11px;
  line-height: 1.4;
  margin: 3px 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hasa-price {
  color: var(--hasa-primary);
  font-size: 11px;
  font-weight: 700;
}

.hasa-product-content a {
  color: var(--hasa-primary);
  font-size: 11.5px;
  font-weight: 700;
  margin-top: auto;
  text-decoration: none;
}

.hasa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 13px;
}

.hasa-suggestions button,
.hasa-suggestions a,
.hasa-quick button {
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--hasa-primary) 27%, #fff);
  border-radius: 999px;
  color: var(--hasa-primary);
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
  padding: 7px 10px;
  text-decoration: none;
}

.hasa-suggestions .hasa-lead-cta {
  background: var(--hasa-accent);
  border-color: var(--hasa-accent);
  color: #17221c;
}

.hasa-suggestions .hasa-whatsapp {
  background: #e9fbf0;
  border-color: #a8dfba;
  color: #087a36;
}

.hasa-quick {
  background: #fff;
  border-top: 1px solid var(--hasa-border);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 10px;
  scrollbar-width: none;
}

.hasa-quick::-webkit-scrollbar { display: none; }
.hasa-quick button { flex: 0 0 auto; white-space: nowrap; }

.hasa-composer {
  align-items: flex-end;
  background: #fff;
  border-top: 1px solid var(--hasa-border);
  display: flex;
  gap: 8px;
  padding: 9px 10px 7px;
}

.hasa-composer textarea {
  background: #f6f8f6;
  border: 1px solid #dfe6e1;
  border-radius: 17px;
  color: var(--hasa-text);
  flex: 1;
  font: inherit;
  line-height: 1.4;
  max-height: 104px;
  min-height: 42px;
  outline: 0;
  overflow-y: auto;
  padding: 10px 12px;
  resize: none;
}

.hasa-composer textarea:focus { border-color: var(--hasa-primary); }

.hasa-composer button {
  align-items: center;
  background: var(--hasa-primary);
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex: 0 0 42px;
  height: 42px;
  justify-content: center;
  padding: 0;
  width: 42px;
}

.hasa-composer button:disabled { cursor: wait; opacity: .55; }

.hasa-composer svg {
  fill: currentColor;
  height: 20px;
  width: 20px;
}

.hasa-powered {
  background: #fff;
  color: #8b958f;
  font-size: 9.5px;
  letter-spacing: .03em;
  padding: 0 10px 7px;
  text-align: center;
}

.hasa-powered a { color: inherit; text-decoration: underline; }

.hasa-lead-form {
  background: #fff;
  border-top: 1px solid var(--hasa-border);
  max-height: 72%;
  overflow-y: auto;
  padding: 12px;
}

.hasa-lead-form[hidden] { display: none; }

.hasa-form-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.hasa-form-head strong { font-size: 14px; }

.hasa-form-close {
  background: transparent;
  border: 0;
  color: var(--hasa-muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.hasa-field-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.hasa-lead-form label {
  color: var(--hasa-muted);
  display: block;
  font-size: 10.5px;
  margin-bottom: 7px;
}

.hasa-lead-form input[type="text"],
.hasa-lead-form input[type="email"],
.hasa-lead-form textarea {
  background: #fbfcfb;
  border: 1px solid #dce4df;
  border-radius: 9px;
  color: var(--hasa-text);
  display: block;
  font: inherit;
  font-size: 12px;
  margin-top: 3px;
  padding: 8px;
  resize: vertical;
  width: 100%;
}

.hasa-consent {
  align-items: flex-start;
  display: flex !important;
  gap: 6px;
}

.hasa-consent input { margin-top: 2px; }
.hasa-honeypot { left: -9999px !important; opacity: 0 !important; position: absolute !important; }

.hasa-submit-lead {
  background: var(--hasa-primary);
  border: 0;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  width: 100%;
}

.hasa-form-status {
  color: #b42318;
  font-size: 11px;
  margin: 6px 0 0;
}

.hasa-form-status.is-success { color: #087a36; }

.hasa-inline {
  margin: 20px auto;
  max-width: 720px;
}

.hasa-inline .hasa-panel {
  height: 720px;
  max-height: 85dvh;
  width: 100%;
}

.hasa-inline .hasa-icon-button { display: none; }

@media (max-width: 520px) {
  .hasa-pos-right,
  .hasa-pos-left {
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 10px;
    right: 10px;
  }

  .hasa-launcher {
    margin: 0 0 0 auto;
    min-height: 54px;
  }

  .hasa-pos-left .hasa-launcher { margin: 0 auto 0 0; }

  body .floating-contact {
    bottom: max(76px, calc(env(safe-area-inset-bottom) + 66px));
    right: 10px;
  }

  .hasa-floating .hasa-panel {
    border-radius: 18px;
    height: calc(100dvh - 20px);
    max-height: none;
    width: 100%;
  }

  .hasa-pos-right .hasa-panel,
  .hasa-pos-left .hasa-panel {
    left: 0;
    right: 0;
  }

  .hasa-header { min-height: 70px; }
  .hasa-bubble { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  .hasa-root *,
  .hasa-root *::before,
  .hasa-root *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
