.hfa-root {
  --hfa-accent: #6366f1;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.hfa-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--hfa-accent);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.hfa-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 34px rgba(0, 0, 0, .32); }
.hfa-open .hfa-launcher { transform: scale(.94); }

.hfa-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: min(560px, 72vh);
  background: #fff;
  color: #0f172a;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.hfa-open .hfa-panel { opacity: 1; transform: none; pointer-events: auto; }

.hfa-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px;
  color: #fff;
  background: var(--hfa-accent);
  font-size: 15px;
}
.hfa-head .hfa-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .35);
}
.hfa-head strong { flex: 1; font-weight: 600; }
.hfa-close {
  border: none; background: transparent; color: #fff;
  font-size: 24px; line-height: 1; cursor: pointer; opacity: .85;
  width: 30px; height: 30px; border-radius: 8px;
}
.hfa-close:hover { opacity: 1; background: rgba(255, 255, 255, .16); }

.hfa-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7f8fb;
}

.hfa-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.hfa-bot { align-self: flex-start; background: #fff; border: 1px solid #e5e8ef; border-bottom-left-radius: 5px; }
.hfa-user { align-self: flex-end; background: var(--hfa-accent); color: #fff; border-bottom-right-radius: 5px; }
.hfa-typing { color: #64748b; font-style: italic; }

.hfa-sources { align-self: flex-start; font-size: 12px; color: #64748b; padding: 0 4px; max-width: 88%; }
.hfa-sources span { font-weight: 600; }
.hfa-sources a { color: var(--hfa-accent); text-decoration: none; margin: 0 2px; }
.hfa-sources a:hover { text-decoration: underline; }

.hfa-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e8ef; background: #fff; }
.hfa-input {
  flex: 1;
  border: 1px solid #d7dce6;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  color: #0f172a;
}
.hfa-input:focus { border-color: var(--hfa-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hfa-accent) 18%, transparent); }
.hfa-send {
  border: none; cursor: pointer; color: #fff;
  background: var(--hfa-accent);
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.hfa-send:hover { filter: brightness(1.07); }
.hfa-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 560px) {
  .hfa-root { right: 14px; bottom: 14px; }
  .hfa-panel { width: calc(100vw - 28px); height: 68vh; bottom: 70px; }
}
