.bp-chat-root {
  --bp-chat-navy: #082f49;
  --bp-chat-teal: #0f8b83;
  --bp-chat-soft: #f3f8f8;
  --bp-chat-ink: #17212b;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  font-family: Manrope, "Segoe UI", sans-serif;
}

.bp-chat-launcher {
  border: 0;
  border-radius: 999px;
  min-height: 52px;
  padding: 0 18px 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #16a39a 0%, var(--bp-chat-teal) 55%, #08736d 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(8, 47, 73, 0.22);
  cursor: pointer;
}

.bp-chat-launcher:hover { filter: brightness(1.05); }

.bp-chat-panel {
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 100px));
  background: #fff;
  border: 1px solid #dce7eb;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(8, 47, 73, 0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 12px;
}

.bp-chat-root.is-open .bp-chat-panel { display: flex; }
.bp-chat-root.is-open .bp-chat-launcher { display: none; }

.bp-chat-header {
  background: var(--bp-chat-navy);
  color: #fff;
  padding: 14px 14px 12px;
  display: grid;
  gap: 8px;
}

.bp-chat-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.bp-chat-header p {
  margin: 0;
  opacity: 0.8;
  font-size: 0.82rem;
}

.bp-chat-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.bp-chat-close,
.bp-chat-agent {
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

.bp-chat-agent.is-waiting {
  background: #e8b43c;
  border-color: #e8b43c;
  color: #082f49;
}

.bp-chat-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: var(--bp-chat-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bp-chat-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.bp-chat-bubble small {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.7;
}

.bp-chat-bubble.visitor {
  align-self: flex-end;
  background: var(--bp-chat-teal);
  color: #fff;
}

.bp-chat-bubble.ai,
.bp-chat-bubble.agent,
.bp-chat-bubble.system {
  align-self: flex-start;
  background: #fff;
  color: var(--bp-chat-ink);
  border: 1px solid #dce7eb;
}

.bp-chat-bubble.agent { border-color: #9fd9d2; }
.bp-chat-bubble.system { opacity: 0.9; font-style: italic; }

.bp-chat-preform {
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #fff;
  flex: 1;
  align-content: start;
}

.bp-chat-preform[hidden],
.bp-chat-messages[hidden],
.bp-chat-compose[hidden] {
  display: none !important;
}

.bp-chat-preform p {
  margin: 0;
  color: #667685;
  font-size: 0.9rem;
  line-height: 1.45;
}

.bp-chat-preform label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--bp-chat-navy);
}

.bp-chat-preform input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dce7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.bp-chat-compose {
  border-top: 1px solid #dce7eb;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fff;
}

.bp-chat-compose textarea {
  width: 100%;
  min-height: 64px;
  resize: none;
  border: 1px solid #dce7eb;
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

.bp-chat-compose-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

.bp-chat-send {
  border: 0;
  border-radius: 10px;
  background: var(--bp-chat-teal);
  color: #fff;
  font-weight: 800;
  padding: 10px 14px;
  cursor: pointer;
}

.bp-chat-send:disabled { opacity: 0.5; cursor: wait; }

.bp-chat-meta {
  font-size: 0.75rem;
  color: #667685;
}

@media (max-width: 520px) {
  .bp-chat-root { right: 12px; bottom: 12px; }
}
