#bdb-chatbot {
  --chat-primary: #111111;
  --chat-accent: #f5c542;
  --chat-bottom-desktop: 22px;
  --chat-bottom-mobile: 190px;
  --chat-edge-gap: 14px;
  position: fixed;
  bottom: var(--chat-bottom-desktop);
  z-index: 2147481000;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #111;
}

#bdb-chatbot[data-position="left"] { left: 18px; }
#bdb-chatbot[data-position="right"] { right: 18px; }
#bdb-chatbot * { box-sizing: border-box; }
#bdb-chatbot,
.bdb-chatbot__panel,
.bdb-chatbot__messages,
.bdb-chatbot__form {
  max-width: 100vw;
}

.bdb-chatbot__button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 999px;
  background: #fff;
  color: #111;
  min-height: 58px;
  padding: 8px 14px 8px 8px;
  box-shadow: 0 18px 45px rgba(0,0,0,.22);
  cursor: pointer;
}

.bdb-chatbot__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--chat-accent);
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
}

.bdb-chatbot__button-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.bdb-chatbot__button-text strong { font-size: 13px; }
.bdb-chatbot__button-text span { font-size: 11px; color: #555; }

.bdb-chatbot__panel {
  position: absolute;
  bottom: 72px;
  width: min(410px, calc(100vw - 28px));
  height: min(720px, calc(100dvh - var(--chat-bottom-desktop) - 92px));
  min-height: min(560px, calc(100dvh - var(--chat-bottom-desktop) - 92px));
  max-height: calc(100dvh - var(--chat-bottom-desktop) - 92px);
  display: none;
  flex-direction: column;
  background: #fff;
  border: 1px solid #d8dde5;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
  overflow: hidden;
}

#bdb-chatbot[data-position="left"] .bdb-chatbot__panel { left: 0; }
#bdb-chatbot[data-position="right"] .bdb-chatbot__panel { right: 0; }
#bdb-chatbot.is-open .bdb-chatbot__panel { display: flex; }

.bdb-chatbot__head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: var(--chat-primary);
  color: #fff;
}

.bdb-chatbot__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bdb-chatbot__mini {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--chat-accent);
  color: #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex: 0 0 auto;
}

.bdb-chatbot__head-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex: 0 0 auto;
  border: 2px solid var(--chat-accent);
  background: #fff;
}

.bdb-chatbot__title strong,
.bdb-chatbot__title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bdb-chatbot__title strong { font-size: 14px; }
.bdb-chatbot__title span { font-size: 11px; color: rgba(255,255,255,.7); }

.bdb-chatbot__close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.bdb-chatbot__messages {
  flex: 1 1 auto;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.bdb-chatbot__msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: min(86%, 100%);
}

.bdb-chatbot__msg--bot {
  align-self: flex-start;
  background: #f3f5f7;
  color: #111;
  border-bottom-left-radius: 4px;
}

.bdb-chatbot__msg--user {
  align-self: flex-end;
  background: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bdb-chatbot__link {
  color: inherit;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bdb-chatbot__msg--bot .bdb-chatbot__link {
  color: #0b5cab;
}

.bdb-chatbot__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
  margin: 4px 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--chat-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}

.bdb-chatbot__action:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.bdb-chatbot__action + .bdb-chatbot__action {
  margin-top: 6px;
}

.bdb-chatbot__chips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}

.bdb-chatbot__chip {
  border: 1px solid #d8dde5;
  border-radius: 999px;
  background: #fff;
  color: #111;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.bdb-chatbot__form {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e6e9ee;
  background: #fff;
}

.bdb-chatbot__input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid #d8dde5;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 16px;
  line-height: 1.4;
  max-width: 100%;
}

.bdb-chatbot__send {
  width: 44px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--chat-primary);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.bdb-chatbot__footnote {
  flex: 0 0 auto;
  padding: 0 14px 12px;
  color: #6b7280;
  font-size: 11px;
}

@media (max-width: 640px) {
  #bdb-chatbot input,
  #bdb-chatbot textarea,
  #bdb-chatbot select {
    font-size: 16px;
    line-height: 1.4;
  }

  #bdb-chatbot {
    bottom: min(var(--chat-bottom-mobile), 42dvh);
    left: 12px;
    right: 12px;
  }
  #bdb-chatbot[data-position="left"],
  #bdb-chatbot[data-position="right"] {
    left: 12px;
    right: 12px;
  }
  .bdb-chatbot__button {
    margin-left: auto;
    width: fit-content;
    max-width: 100%;
  }
  .bdb-chatbot__panel {
    left: 0;
    right: 0;
    width: 100%;
    height: calc(100dvh - min(var(--chat-bottom-mobile), 42dvh) - 86px);
    min-height: min(480px, calc(100dvh - min(var(--chat-bottom-mobile), 42dvh) - 86px));
    max-height: calc(100dvh - min(var(--chat-bottom-mobile), 42dvh) - 86px);
  }
}

@supports not (height: 100dvh) {
  .bdb-chatbot__panel {
    height: min(720px, calc(100vh - var(--chat-bottom-desktop) - 92px));
    min-height: min(560px, calc(100vh - var(--chat-bottom-desktop) - 92px));
    max-height: calc(100vh - var(--chat-bottom-desktop) - 92px);
  }

  @media (max-width: 640px) {
    .bdb-chatbot__panel {
      height: calc(100vh - 170px);
      min-height: min(480px, calc(100vh - 170px));
      max-height: calc(100vh - 170px);
    }
  }
}

@media (max-height: 560px) {
  .bdb-chatbot__panel {
    bottom: 62px;
    height: calc(100dvh - var(--chat-bottom-desktop) - 76px);
    min-height: 260px;
    max-height: calc(100dvh - var(--chat-bottom-desktop) - 76px);
  }

  .bdb-chatbot__messages {
    min-height: 80px;
  }
}
