.blb-widget,
.blb-widget *,
.blb-widget *::before,
.blb-widget *::after {
  box-sizing: border-box;
}

.blb-widget {
  --blb-wa: #25d366;
  --blb-wa-dark: #075e54;
  --blb-wa-deep: #054d44;
  --blb-chat-bg: #efe7db;
  --blb-bot: #ffffff;
  --blb-user: #dcf8c6;
  --blb-ink: #111b21;
  --blb-muted: #667781;
  --blb-line: #d1d7db;
  --blb-error-bg: #ffe3e3;
  --blb-error: #b42318;
  --blb-shadow: 0 12px 34px rgba(17, 27, 33, 0.22);
  bottom: max(18px, env(safe-area-inset-bottom));
  color: var(--blb-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  z-index: 999999;
}

.blb-fab {
  align-items: center;
  background: var(--blb-wa);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.38), 0 3px 10px rgba(17, 27, 33, 0.18);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  height: 62px;
  justify-content: center;
  padding: 0;
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 160ms ease, background 160ms ease;
  width: 62px;
}

.blb-fab:hover {
  background: #20bd5a;
  box-shadow: 0 10px 26px rgba(37, 211, 102, 0.44), 0 4px 12px rgba(17, 27, 33, 0.2);
  transform: translateY(-2px);
}

.blb-fab:focus-visible,
.blb-close:focus-visible,
.blb-send:focus-visible,
.blb-option:focus-visible,
.blb-input:focus-visible {
  outline: 3px solid rgba(37, 211, 102, 0.35);
  outline-offset: 3px;
}

.blb-fab__icon {
  display: inline-grid;
  height: 34px;
  place-items: center;
  width: 34px;
}

.blb-fab__icon svg {
  height: 34px;
  width: 34px;
}

.blb-fab__label {
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.blb-panel {
  background: var(--blb-chat-bg);
  border: 1px solid rgba(17, 27, 33, 0.1);
  border-radius: 8px;
  bottom: 78px;
  box-shadow: var(--blb-shadow);
  display: grid;
  grid-template-rows: auto minmax(270px, 1fr) auto;
  max-height: min(650px, calc(100vh - 112px));
  opacity: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  transform: translateY(10px) scale(0.985);
  transform-origin: bottom right;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
  width: min(390px, calc(100vw - 28px));
}

.blb-widget--open .blb-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.blb-panel[hidden] {
  display: none;
}

.blb-panel__header {
  align-items: center;
  background: var(--blb-wa-dark);
  color: #ffffff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 64px;
  padding: 10px 12px;
}

.blb-panel__header > div {
  min-width: 0;
  padding-left: 48px;
  position: relative;
}

.blb-panel__header > div::before {
  background: #d9fdd3;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65);
  content: "";
  height: 38px;
  left: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
}

.blb-panel__header > div::after {
  background: var(--blb-wa);
  border: 2px solid var(--blb-wa-dark);
  border-radius: 999px;
  bottom: 1px;
  content: "";
  height: 11px;
  left: 28px;
  position: absolute;
  width: 11px;
}

.blb-panel__eyebrow {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 2px 0 0;
  order: 2;
}

.blb-panel h2 {
  color: #ffffff;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.blb-close {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 38px;
  height: 38px;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease, color 150ms ease;
  width: 38px;
}

.blb-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.blb-messages {
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 255, 255, 0.28) 0 1px, transparent 1.5px),
    radial-gradient(circle at 58px 42px, rgba(17, 27, 33, 0.055) 0 1px, transparent 1.5px),
    var(--blb-chat-bg);
  background-size: 76px 76px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 16px 14px 18px;
  scrollbar-width: thin;
}

.blb-message {
  border-radius: 7.5px;
  box-shadow: 0 1px 0.5px rgba(17, 27, 33, 0.13);
  font-size: 14px;
  line-height: 1.38;
  max-width: 82%;
  padding: 7px 9px 8px;
  position: relative;
  word-break: break-word;
}

.blb-message--bot {
  align-self: flex-start;
  background: var(--blb-bot);
  color: var(--blb-ink);
}

.blb-message--bot::before {
  border-bottom: 8px solid transparent;
  border-right: 8px solid var(--blb-bot);
  content: "";
  left: -7px;
  position: absolute;
  top: 0;
}

.blb-message--user {
  align-self: flex-end;
  background: var(--blb-user);
  color: var(--blb-ink);
}

.blb-message--user::before {
  border-bottom: 8px solid transparent;
  border-left: 8px solid var(--blb-user);
  content: "";
  position: absolute;
  right: -7px;
  top: 0;
}

.blb-message--error {
  align-self: flex-start;
  background: var(--blb-error-bg);
  color: var(--blb-error);
}

.blb-options {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 5px;
  max-width: 92%;
}

.blb-option {
  background: #ffffff;
  border: 1px solid rgba(7, 94, 84, 0.18);
  border-radius: 999px;
  color: var(--blb-wa-dark);
  cursor: pointer;
  font: 650 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 34px;
  padding: 0 12px;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.blb-option:hover {
  background: #e7ffdb;
  border-color: rgba(7, 94, 84, 0.32);
  color: var(--blb-wa-deep);
  transform: translateY(-1px);
}

.blb-input-row {
  align-items: center;
  background: #f0f2f5;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 9px 10px;
}

.blb-input {
  appearance: none;
  background: #ffffff;
  border: 0;
  border-radius: 999px;
  color: var(--blb-ink);
  flex: 1;
  font: 15px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 42px;
  min-width: 0;
  padding: 0 15px;
  transition: box-shadow 150ms ease;
}

.blb-input::placeholder {
  color: var(--blb-muted);
  opacity: 1;
}

.blb-input:focus {
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.34);
  outline: 0;
}

.blb-send {
  align-items: center;
  background: var(--blb-wa);
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 42px;
  height: 42px;
  justify-content: center;
  padding: 0;
  transition: background 150ms ease, transform 150ms ease;
}

.blb-send:hover {
  background: #20bd5a;
}

.blb-send:active {
  transform: translateY(1px);
}

.blb-input:disabled,
.blb-send:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@media (max-width: 520px) {
  .blb-widget {
    bottom: max(16px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
  }

  .blb-panel {
    bottom: 76px;
    max-height: min(640px, calc(100vh - 100px));
    right: -2px;
    width: calc(100vw - 28px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blb-fab,
  .blb-panel,
  .blb-close,
  .blb-send,
  .blb-option,
  .blb-input {
    transition: none;
  }
}
