.bp-chat-launcher,
.bp-chat-panel {
  font-family: "Plus Jakarta Sans", system-ui, "Segoe UI", Roboto, sans-serif;
}

.bp-chat-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 110;
  min-height: 54px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: #171a3f;
  color: #fff;
  box-shadow: 0 10px 28px #11153638;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}

body.bp-chat-home .bp-chat-launcher {
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 126px);
}

.bp-chat-launcher:hover,
.bp-chat-send:hover {
  filter: brightness(1.08);
}

.bp-chat-launcher:focus-visible,
.bp-chat-panel button:focus-visible,
.bp-chat-panel a:focus-visible,
.bp-chat-panel input:focus-visible {
  outline: 3px solid #5b63d8;
  outline-offset: 3px;
}

.bp-chat-panel[hidden] {
  display: none !important;
}

.bp-chat-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(84px, calc(env(safe-area-inset-bottom) + 76px));
  z-index: 111;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 24px));
  height: min(500px, calc(100dvh - 112px));
  min-height: 320px;
  overflow: hidden;
  border: 1px solid #e2e5ee;
  border-radius: 20px;
  background: #fff;
  color: #20243b;
  box-shadow: 0 18px 60px #11153638;
}

body.bp-chat-home .bp-chat-panel {
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 184px);
  height: min(500px, calc(100dvh - 210px));
}

.bp-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  background: #171a3f;
  color: white;
}

.bp-chat-heading {
  margin: 0;
  color: inherit;
  font-size: 16px;
  line-height: 1.3;
}

.bp-chat-caption {
  margin: 3px 0 0;
  color: #e0e3f0;
  font-size: 12px;
  line-height: 1.4;
}

.bp-chat-header-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.bp-chat-header button {
  min-width: 34px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid #ffffff50;
  border-radius: 8px;
  background: transparent;
  color: white;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.bp-chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 15px;
  overscroll-behavior: contain;
}

.bp-chat-message {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.bp-chat-message.bot {
  align-self: flex-start;
  border: 1px solid #e6e8f0;
  border-bottom-left-radius: 5px;
  background: #f5f6fa;
  color: #343951;
}

.bp-chat-message.visitor {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  background: #171a3f;
  color: #fff;
}

.bp-chat-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  max-width: 94%;
}

.bp-chat-links a,
.bp-chat-topic {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d9ddec;
  border-radius: 999px;
  background: #fff;
  color: #262a66;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}

.bp-chat-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 15px 12px;
}

.bp-chat-compose {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e7e9ef;
}

.bp-chat-compose input {
  min-width: 0;
  flex: 1;
  padding: 11px 12px;
  border: 1px solid #d9dce5;
  border-radius: 10px;
  background: white;
  color: #20243b;
  font: inherit;
  font-size: 14px;
}

.bp-chat-send {
  min-width: 70px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: #ed1c24;
  color: white;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.bp-chat-privacy {
  margin: 0;
  padding: 0 14px 11px;
  color: #687085;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 560px) {
  .bp-chat-panel {
    right: 12px;
    bottom: max(80px, calc(env(safe-area-inset-bottom) + 72px));
    width: calc(100vw - 24px);
    height: min(500px, calc(100dvh - 112px));
  }

  body.bp-chat-home .bp-chat-panel {
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 184px);
    height: min(460px, calc(100dvh - 210px));
  }

  body.bp-chat-home .bp-chat-launcher {
    right: 16px;
    bottom: calc(max(18px, env(safe-area-inset-bottom)) + 126px);
  }
}

@media (max-height: 560px) {
  .bp-chat-panel,
  body.bp-chat-home .bp-chat-panel {
    min-height: 0;
    height: calc(100dvh - 32px);
    bottom: 16px;
  }
}
