.fba {
  --fba-ink: #41492f;
  --fba-cream: #f6f4ee;
  --fba-line: #dcd8cc;
  --fba-text: #1f2318;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99990;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  color: var(--fba-text);
}
.fba *, .fba *::before, .fba *::after { box-sizing: border-box; }

.fba-toggle {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  padding: 12px 18px;
  border: 0; border-radius: 999px;
  background: var(--fba-ink); color: #fff;
  font: inherit; font-weight: 600; letter-spacing: .02em;
  box-shadow: 0 6px 20px rgba(31, 35, 24, .25);
  cursor: pointer;
}
.fba-toggle:hover { filter: brightness(1.1); }
.fba-toggle:focus-visible, .fba button:focus-visible, .fba-input:focus-visible { outline: 3px solid #b9c29a; outline-offset: 2px; }
.fba-toggle svg { width: 20px; height: 20px; }
.fba-open .fba-toggle { display: none; }

.fba-panel {
  display: flex; flex-direction: column;
  width: 360px; height: min(560px, calc(100vh - 40px));
  background: #fff;
  border: 1px solid var(--fba-line); border-radius: 16px;
  box-shadow: 0 12px 40px rgba(31, 35, 24, .25);
  overflow: hidden;
}
.fba-panel[hidden] { display: none; }

.fba-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--fba-ink); color: #fff;
}
.fba-title { display: flex; flex-direction: column; }
.fba-title strong { font-size: 16px; }
.fba-title span { font-size: 12px; opacity: .8; }
.fba-close {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.fba-close:hover { background: rgba(255, 255, 255, .15); }

.fba-log {
  flex: 1; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  background: var(--fba-cream);
}
.fba-msg {
  max-width: 85%;
  padding: 10px 13px; border-radius: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.fba-assistant { align-self: flex-start; background: #fff; border: 1px solid var(--fba-line); border-bottom-left-radius: 4px; }
.fba-user { align-self: flex-end; background: var(--fba-ink); color: #fff; border-bottom-right-radius: 4px; }
.fba-msg a { color: inherit; text-decoration: underline; }
.fba-wait { color: #6b705f; letter-spacing: .2em; }

.fba-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; background: var(--fba-cream); }
.fba-chips[hidden] { display: none; }
.fba-chip {
  padding: 6px 11px; border: 1px solid var(--fba-ink); border-radius: 999px;
  background: #fff; color: var(--fba-ink); font: inherit; font-size: 13px; cursor: pointer;
}
.fba-chip:hover { background: var(--fba-ink); color: #fff; }

.fba-form { display: flex; gap: 8px; padding: 12px 16px; background: var(--fba-cream); border-top: 1px solid var(--fba-line); }
.fba-input {
  flex: 1; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--fba-line); border-radius: 10px;
  background: #fff; color: var(--fba-text); font: inherit; font-size: 16px;
}
.fba-send {
  padding: 10px 14px; border: 0; border-radius: 10px;
  background: var(--fba-ink); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.fba-send:disabled { opacity: .5; cursor: default; }

.fba-foot { margin: 0; padding: 0 16px 12px; background: var(--fba-cream); font-size: 12px; color: #6b705f; }
.fba-foot a { color: var(--fba-ink); font-weight: 600; }

@media (max-width: 480px) {
  .fba { right: 12px; bottom: 12px; }
  .fba-toggle { padding: 11px 16px; }
  .fba-open { top: 12px; left: 12px; }
  .fba-panel { width: 100%; height: 100%; }
}
