:root {
  --hhais-accent: #1f6feb;
  --hhais-accent-ink: #ffffff;
  --hhais-bg: #ffffff;
  --hhais-ink: #1a1a1a;
  --hhais-muted: #6b7280;
  --hhais-line: #e5e7eb;
  --hhais-radius: 14px;
  --hhais-width: 360px;
  --hhais-height: 520px;
  --hhais-shadow: 0 10px 40px rgba(0, 0, 0, 0.16);
  --hhais-font: inherit;
}

#hhais-root { font-family: var(--hhais-font); }

/* Panel */
.hhais-panel {
  display: flex;
  flex-direction: column;
  background: var(--hhais-bg);
  color: var(--hhais-ink);
  border: 1px solid var(--hhais-line);
  border-radius: var(--hhais-radius);
  overflow: hidden;
}
.hhais-inline { width: 100%; max-width: var(--hhais-width, 560px); height: var(--hhais-height, 520px); margin: 1rem auto; box-shadow: var(--hhais-shadow); }
.hhais-floating {
  position: fixed; bottom: 90px; right: 20px; z-index: 99999;
  width: var(--hhais-width, 360px); height: var(--hhais-height, 520px); box-shadow: var(--hhais-shadow);
}
.hhais-hidden { display: none; }

@media (max-width: 480px) {
  .hhais-floating {
    right: 0; left: 0; bottom: 0; top: 0;
    width: auto; height: auto;
    border-radius: 0; border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hhais-typing span { animation: none; }
  .hhais-card { transition: none; }
}

/* Header */
.hhais-header {
  background: var(--hhais-accent);
  color: var(--hhais-accent-ink);
  padding: 14px 16px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.hhais-close {
  background: transparent; border: 0; color: inherit;
  font-size: 22px; line-height: 1; cursor: pointer; opacity: .85;
}
.hhais-close:hover { opacity: 1; }

/* Log */
.hhais-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }

/* Bubbles */
.hhais-bubble {
  max-width: 85%;
  padding: 10px 13px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.hhais-assistant { align-self: flex-start; background: #f3f4f6; border-bottom-left-radius: 4px; }
.hhais-user { align-self: flex-end; background: var(--hhais-accent); color: var(--hhais-accent-ink); border-bottom-right-radius: 4px; }

/* Typing */
.hhais-typing { display: flex; gap: 4px; }
.hhais-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--hhais-muted);
  animation: hhais-blink 1.2s infinite both;
}
.hhais-typing span:nth-child(2) { animation-delay: .2s; }
.hhais-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes hhais-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Cards */
.hhais-cards { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.hhais-card {
  display: flex; text-decoration: none; color: inherit;
  border: 1px solid var(--hhais-line); border-radius: 12px; overflow: hidden;
  transition: box-shadow .15s ease, transform .15s ease;
}
.hhais-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-1px); }
.hhais-card-img { width: 96px; min-height: 96px; background-size: cover; background-position: center; flex-shrink: 0; }
.hhais-noimg { background: linear-gradient(135deg, #e5e7eb, #f3f4f6); }
.hhais-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.hhais-card-title { font-weight: 600; font-size: 14px; }
.hhais-card-meta { font-size: 12px; color: var(--hhais-muted); }
.hhais-card-price { font-size: 13px; font-weight: 600; color: var(--hhais-accent); }

/* Form */
.hhais-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--hhais-line); }
.hhais-input {
  flex: 1; padding: 10px 12px; font-size: 14px;
  font-family: var(--hhais-font, inherit);
  line-height: 1.4;
  border: 1px solid var(--hhais-line); border-radius: 10px; outline: none;
  resize: none; overflow-y: auto; max-height: 120px;
  box-sizing: border-box; min-height: 40px;
}
.hhais-input:focus { border-color: var(--hhais-accent); }
.hhais-send {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--hhais-accent); color: var(--hhais-accent-ink); font-size: 18px;
}
.hhais-send:hover { filter: brightness(.95); }

/* Launcher */
.hhais-launcher {
  position: fixed; bottom: 20px; right: 20px; z-index: 99999;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--hhais-accent); color: var(--hhais-accent-ink);
  font-size: 15px; font-weight: 600; box-shadow: var(--hhais-shadow);
}
.hhais-launcher:hover { filter: brightness(.96); }

/* Chips (starters + follow-up refinements) */
.hhais-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: stretch; }
.hhais-starters { margin-top: 2px; }
.hhais-chip {
  border: 1px solid var(--hhais-accent);
  color: var(--hhais-accent);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.hhais-chip:hover { background: var(--hhais-accent); color: var(--hhais-accent-ink); }

/* Match-reason ticks on cards */
.hhais-card-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.hhais-tick {
  font-size: 11px;
  color: #1a7f37;
  background: rgba(26, 127, 55, 0.10);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}

/* Card rating */
.hhais-card-rating { font-size: 12px; color: #b8860b; font-weight: 600; margin-left: 6px; }

/* Lead capture form */
.hhais-lead {
  align-self: stretch;
  border: 1px solid var(--hhais-line);
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hhais-lead-title { font-weight: 600; font-size: 14px; color: var(--hhais-ink); }
.hhais-lead-sub { font-size: 12px; color: var(--hhais-muted); }
.hhais-lead-email {
  padding: 9px 11px; font-size: 14px;
  border: 1px solid var(--hhais-line); border-radius: 8px; outline: none;
}
.hhais-lead-email:focus { border-color: var(--hhais-accent); }
.hhais-lead-consent { display: flex; gap: 8px; font-size: 12px; color: var(--hhais-muted); line-height: 1.4; align-items: flex-start; }
.hhais-lead-consent input { margin-top: 2px; }
.hhais-lead-consent a { color: var(--hhais-accent); }
.hhais-lead-btn {
  align-self: flex-start;
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--hhais-accent); color: var(--hhais-accent-ink);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
}
.hhais-lead-btn:disabled { opacity: .6; cursor: default; }
.hhais-lead-msg { font-size: 12px; color: #b91c1c; min-height: 1em; }
