:root {
  --hfa-green: #174f3a;
  --hfa-green-dark: #0f3829;
  --hfa-gold: #c9a24d;
  --hfa-ink: #17211d;
  --hfa-muted: #617069;
  --hfa-paper: #fffdf8;
  --hfa-line: #dfe6e2;
}

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

.hfa-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999980;
  color: var(--hfa-ink);
  font-family: inherit;
}

.hfa-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 18px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--hfa-green);
  color: #fff;
  box-shadow: 0 12px 34px rgba(12, 43, 31, .28);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.hfa-launcher:hover,
.hfa-launcher:focus-visible {
  background: var(--hfa-green-dark);
  outline: 3px solid rgba(201, 162, 77, .55);
  outline-offset: 2px;
}

.hfa-launcher-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--hfa-gold);
  color: var(--hfa-green-dark);
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 1;
}

.hfa-dialog {
  position: absolute;
  right: 0;
  bottom: 68px;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 110px));
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(23, 79, 58, .18);
  border-radius: 20px;
  background: var(--hfa-paper);
  box-shadow: 0 22px 70px rgba(12, 43, 31, .28);
}

.hfa-dialog[hidden] {
  display: none;
}

.hfa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 16px;
  border-bottom: 3px solid var(--hfa-gold);
  background: var(--hfa-green);
  color: #fff;
}

.hfa-header h2,
.hfa-header p {
  margin: 0;
  color: inherit;
}

.hfa-header h2 {
  font-family: Georgia, serif;
  font-size: 24px;
  line-height: 1.15;
}

.hfa-eyebrow {
  margin-bottom: 4px !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  opacity: .8;
  text-transform: uppercase;
}

.hfa-close {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: 28px/1 Arial, sans-serif;
}

.hfa-close:hover,
.hfa-close:focus-visible {
  background: rgba(255,255,255,.12);
  outline: 2px solid var(--hfa-gold);
}

.hfa-messages {
  overflow-y: auto;
  padding: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(201, 162, 77, .10), transparent 35%),
    var(--hfa-paper);
}

.hfa-message {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
}

.hfa-message p {
  margin: 0;
}

.hfa-message--assistant {
  border: 1px solid var(--hfa-line);
  border-bottom-left-radius: 4px;
  background: #fff;
}

.hfa-message--user {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  background: var(--hfa-green);
  color: #fff;
}

.hfa-privacy-note {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 11px 12px;
  border-left: 3px solid var(--hfa-gold);
  background: #f7f2e7;
  color: #4b514e;
  font-size: 12px;
  line-height: 1.45;
}

.hfa-privacy-note a,
.hfa-sources a {
  color: var(--hfa-green);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hfa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}

.hfa-suggestions button {
  padding: 7px 10px;
  border: 1px solid rgba(23, 79, 58, .28);
  border-radius: 999px;
  background: #fff;
  color: var(--hfa-green);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.hfa-suggestions button:hover,
.hfa-suggestions button:focus-visible {
  border-color: var(--hfa-gold);
  background: #fbf7ee;
  outline: 2px solid rgba(201, 162, 77, .3);
}

.hfa-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.hfa-sources a,
.hfa-contact-link {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 7px;
  background: #eef4f0;
  font-size: 11px;
  text-decoration: none;
}

.hfa-contact-link {
  margin-top: 9px;
  background: var(--hfa-gold);
  color: var(--hfa-green-dark);
  font-weight: 800;
}

.hfa-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--hfa-line);
  background: #fff;
}

.hfa-form textarea {
  min-height: 46px;
  max-height: 110px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid #bac8c1;
  border-radius: 10px;
  color: var(--hfa-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
}

.hfa-form textarea:focus {
  border-color: var(--hfa-green);
  outline: 3px solid rgba(23, 79, 58, .14);
}

.hfa-form button[type="submit"] {
  align-self: stretch;
  min-width: 78px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--hfa-green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.hfa-form button:disabled {
  cursor: wait;
  opacity: .62;
}

.hfa-form-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--hfa-muted);
  font-size: 10px;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .hfa-root {
    right: 14px;
    bottom: 14px;
  }

  .hfa-dialog {
    position: fixed;
    inset: 10px 10px 76px;
    width: auto;
    height: auto;
  }

  .hfa-launcher-label {
    display: none;
  }

  .hfa-launcher {
    padding-right: 8px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hfa-dialog {
    animation: hfa-in .18s ease-out;
  }

  @keyframes hfa-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}


/* 1.5.0: readable conversation, stable controls and narrow-screen support. */
.hfa-root { --hfa-paper: #f7f8f5; }
.hfa-root [hidden] { display: none !important; }
.hfa-dialog { width: min(460px, calc(100vw - 28px)); height: min(760px, calc(100dvh - 110px)); grid-template-rows: auto auto minmax(0,1fr) auto; }
.hfa-header { padding: 20px; }
.hfa-toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--hfa-line); background: #fff; }
.hfa-root .hfa-action { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px 10px; border: 1px solid var(--hfa-line); border-radius: 8px; background: #fff; color: var(--hfa-green-dark); font-weight: 600; line-height: 1.3; font-family: inherit; font-size: 12px; text-decoration: none; cursor: pointer; }
.hfa-root .hfa-action:hover { background: #edf3ef; border-color: var(--hfa-green); }
.hfa-root :is(button,a,summary):focus-visible { outline: 3px solid var(--hfa-gold); outline-offset: 2px; }
.hfa-messages { min-height: 0; overscroll-behavior: contain; padding: 18px; }
.hfa-message { max-width: 95%; padding: 14px 16px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.hfa-message p { white-space: pre-wrap; color: inherit; }
.hfa-message--user { max-width: 86%; }
.hfa-message-label { display: block; margin-bottom: 5px; font-size: 10px; font-weight: 700; letter-spacing: .04em; opacity: .75; }
.hfa-sources { padding-top: 8px; border-top: 1px solid var(--hfa-line); }
.hfa-sources a { min-height: 34px; align-items: center; font-size: 12px; }
.hfa-answer-mode { display: block; margin-top: 9px; color: #54665b; font-size: 11px; }
.hfa-privacy-note { display: block; border-radius: 8px; }
.hfa-privacy-note summary { cursor: pointer; font-weight: 700; line-height: 1.5; }
.hfa-privacy-note span { display: block; margin-top: 8px; }
.hfa-help-note { font-size: 11px; background: #eef3ef; border-color: #879d90; }
.hfa-suggestions { gap: 8px; }
.hfa-suggestions button { min-height: 39px; font-size: 12px; border-radius: 10px; text-align: left; }
.hfa-suggestions button:disabled { opacity: .6; cursor: wait; }
.hfa-form { padding: 14px; gap: 8px; }
.hfa-form textarea { font-size: 16px; min-width: 0; }
.hfa-form .hfa-context { grid-column: 1/-1; justify-self: start; text-align: left; background: #eef3ef; }
.hfa-form-hint { font-size: 11px; }
.hfa-status { grid-column: 1/-1; margin: 0; color: var(--hfa-green-dark); font-size: 12px; }
.hfa-counter { font-size: 10px; color: var(--hfa-muted); align-self: center; }
.hfa-form > .hfa-action:last-child { justify-self: end; }
@media (max-width:520px) {
  .hfa-dialog { inset: max(8px, env(safe-area-inset-top)) 8px auto; width: auto; height: calc(100dvh - 90px - env(safe-area-inset-top)); max-height: none; }
  .hfa-root { bottom: max(14px, env(safe-area-inset-bottom)); }
  .hfa-header { padding: 14px 16px; }
  .hfa-header h2 { font-size: 23px; }
  .hfa-messages { padding: 12px; }
  .hfa-toolbar { gap: 4px; padding: 8px; }
  .hfa-root .hfa-action { min-height: 38px; }
}

/* Version 2.0: guided entry, source cards, accessible controls and keyboard viewport. */
.hfa-dialog { width: min(490px, calc(100vw - 28px)); border-radius: 24px; }
.hfa-header { background: linear-gradient(120deg,#123e2e,#235c43); }
.hfa-version { display: inline-block; margin-left: 5px; padding: 3px 6px; border: 1px solid #bbd1bf; border-radius: 5px; vertical-align: middle; color: #f5deb0; font: 600 11px/1.3 sans-serif; }
.hfa-welcome { padding: 8px 0 16px; }
.hfa-welcome-mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px; border-radius: 14px; background: #e7eddf; color: #184b36; font: 30px/1 Georgia,serif; }
.hfa-welcome .hfa-eyebrow { color: #52624f; font-size: 9px; }
.hfa-welcome h3 { margin: 6px 0 10px; color: #173d2d; font: 29px/1.15 Georgia,serif; letter-spacing: -.5px; }
.hfa-welcome p { margin: 0; font-size: 14px; line-height: 1.6; color: #405448; }
.hfa-suggestions { display: grid; grid-template-columns: 1fr 1fr; }
.hfa-suggestions button { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 13px; min-height: 78px; background: #fff; font-size: 13px; }
.hfa-suggestions button:first-child { grid-column: 1/-1; min-height: 70px; background: #eaf0e6; border-color: #a7b9a5; }
.hfa-suggestions button:last-child { grid-column: 1/-1; min-height: 68px; }
.hfa-suggestions span { color: #526557; font-size: 11px; font-weight: 400; }
.hfa-disclosure { color: #546057; font-size: 11px; line-height: 1.5; margin: 12px 0; }
.hfa-message--assistant { max-width: 100%; width: 100%; border-radius: 16px 16px 16px 4px; box-shadow: 0 3px 10px #183b2205; }
.hfa-root .hfa-card-title { margin: 4px 0 10px; color: #173d2d; font: 23px/1.2 Georgia,serif; }
.hfa-steps { list-style: decimal; margin: 14px 0; padding-left: 23px; }
.hfa-steps li { padding: 5px 0 5px 5px; font-size: 14px; line-height: 1.55; }
.hfa-steps li::marker { color: #28543b; font-weight: bold; }
.hfa-primary-link { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: 9px; background: #194c36; color: #fff !important; font-size: 13px; font-weight: 700; text-decoration: none; }
.hfa-primary-link:hover { background: #0e3423; }
.hfa-followups { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.hfa-root .hfa-followups .hfa-action { min-height: 44px; border-color: #b9cbbd; background: #f3f7ef; }
.hfa-root .hfa-latest { background: #eaf0df; }
.hfa-message-label { color: #496053; opacity: 1; }
.hfa-message--user .hfa-message-label { color: #e2eadf; }
.hfa-counter { color: #54635a; }
.hfa-form-hint::after { content: ' Keine persönlichen Daten eingeben.'; }
.hfa-root .hfa-close { min-width: 44px; min-height: 44px; }
@media (max-width:520px) {
 .hfa-dialog { top: calc(var(--hfa-viewport-top, 0px) + max(8px, env(safe-area-inset-top))); height: calc(var(--hfa-viewport-height, 100dvh) - 16px - env(safe-area-inset-top)); border-radius: 18px; }
 .hfa-is-open .hfa-launcher { visibility: hidden; }
 .hfa-header h2 { font-size: 21px; }
 .hfa-toolbar .hfa-action { min-height: 44px; font-size: 11px; padding: 6px 8px; }
 .hfa-welcome h3 { font-size: 26px; }
 .hfa-form { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}
@media (max-height:500px) {
 .hfa-header { padding: 8px 12px; }
 .hfa-eyebrow { display: none; }
 .hfa-form { padding: 8px; }
}
