.bf-assistant {
  position: fixed;
  left: 20px;
  bottom: 22px;
  z-index: 1100;
  font-family: inherit;
  color: #10233f;
}

.bf-assistant * {
  box-sizing: border-box;
}

.bf-assistant-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid rgba(30, 64, 175, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff 0%, #edf7ff 100%);
  color: #12356b;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.bf-assistant-toggle:hover,
.bf-assistant-toggle:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.24);
  outline: none;
}

.bf-assistant-toggle-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
}

.bf-assistant-panel {
  position: absolute;
  left: 0;
  bottom: 62px;
  width: min(390px, calc(100vw - 28px));
  max-height: min(70vh, 620px);
  display: none;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(12px);
}

.bf-assistant.is-open .bf-assistant-panel {
  display: grid;
}

.bf-assistant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(135deg, #eef7ff 0%, #fff8e6 100%);
}

.bf-assistant-title {
  margin: 0;
  color: #0f2f62;
  font-size: 1.05rem;
  line-height: 1.25;
  font-weight: 900;
}

.bf-assistant-subtitle {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.45;
}

.bf-assistant-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 50%;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
}

.bf-assistant-close:hover,
.bf-assistant-close:focus-visible {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.45);
  outline: none;
}

.bf-assistant-quick {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  scrollbar-width: thin;
}

.bf-assistant-chip {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: #f8fbff;
  color: #1e3a8a;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.bf-assistant-chip:hover,
.bf-assistant-chip:focus-visible {
  border-color: rgba(37, 99, 235, 0.5);
  background: #eff6ff;
  outline: none;
}

.bf-assistant-messages {
  min-height: 230px;
  overflow-y: auto;
  padding: 14px;
  background: #f8fbff;
}

.bf-assistant-msg {
  margin: 0 0 12px;
  padding: 11px 12px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.65;
}

.bf-assistant-msg p {
  margin: 0 0 8px;
}

.bf-assistant-msg p:last-child {
  margin-bottom: 0;
}

.bf-assistant-msg-user {
  margin-left: auto;
  max-width: 84%;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.bf-assistant-msg-bot {
  max-width: 100%;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #10233f;
  border-bottom-left-radius: 6px;
}

.bf-assistant-result {
  display: block;
  padding: 10px 0;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  color: inherit;
  text-decoration: none;
}

.bf-assistant-result:first-of-type {
  margin-top: 8px;
}

.bf-assistant-result strong {
  display: block;
  color: #1d4ed8;
  font-size: 0.92rem;
}

.bf-assistant-result span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.45;
}

.bf-assistant-source-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.bf-assistant-source-list a {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}

.bf-assistant-source-list a:hover,
.bf-assistant-source-list a:focus-visible,
.bf-assistant-result:hover strong,
.bf-assistant-result:focus-visible strong {
  text-decoration: underline;
}

.bf-assistant-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
}

.bf-assistant-input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(148, 163, 184, 0.46);
  border-radius: 14px;
  color: #10233f;
  font-size: 0.92rem;
}

.bf-assistant-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
  outline: none;
}

.bf-assistant-submit {
  flex: 0 0 auto;
  padding: 0 14px;
  border: 0;
  border-radius: 14px;
  background: #f97316;
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
}

.bf-assistant-submit:hover,
.bf-assistant-submit:focus-visible {
  background: #ea580c;
  outline: none;
}

.bf-assistant-note {
  margin-top: 8px;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.45;
}

body.dark-mode .bf-assistant,
body.dark-mode .bf-assistant-msg-bot,
body.dark-mode .bf-assistant-input {
  color: #e5eefb;
}

body.dark-mode .bf-assistant-panel,
body.dark-mode .bf-assistant-msg-bot,
body.dark-mode .bf-assistant-form,
body.dark-mode .bf-assistant-close {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.32);
}

body.dark-mode .bf-assistant-head {
  background: linear-gradient(135deg, #132342 0%, #2b230f 100%);
}

body.dark-mode .bf-assistant-title {
  color: #dbeafe;
}

body.dark-mode .bf-assistant-subtitle,
body.dark-mode .bf-assistant-result span,
body.dark-mode .bf-assistant-note {
  color: #a8b4c7;
}

body.dark-mode .bf-assistant-messages {
  background: #111827;
}

body.dark-mode .bf-assistant-chip,
body.dark-mode .bf-assistant-toggle,
body.dark-mode .bf-assistant-input {
  background: #111827;
  color: #dbeafe;
}

body.dark-mode .bf-assistant-result strong,
body.dark-mode .bf-assistant-source-list a {
  color: #93c5fd;
}

@media (max-width: 768px) {
  .bf-assistant {
    left: 14px;
    right: auto;
    bottom: 84px;
    max-width: calc(100vw - 110px);
  }

  .bf-assistant-toggle {
    min-height: 46px;
    padding: 9px 13px;
    max-width: min(230px, calc(100vw - 112px));
  }

  .bf-assistant-toggle-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bf-assistant-panel {
    left: 0;
    bottom: 58px;
    width: min(360px, calc(100vw - 110px));
    max-width: calc(100vw - 110px);
    max-height: min(72vh, 560px);
    border-radius: 20px;
  }

  .bf-assistant-messages {
    min-height: 210px;
    padding: 12px;
  }
}

@media (max-width: 360px) {
  .bf-assistant {
    max-width: calc(100vw - 88px);
  }

  .bf-assistant-panel {
    width: calc(100vw - 88px);
    max-width: calc(100vw - 88px);
  }
}

@media print {
  .bf-assistant {
    display: none !important;
  }
}
