#cbp-chat-widget-root .cbp-chat-launcher {
  position: fixed;
  bottom: var(--cbp-launcher-bottom, 18px);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(300px, calc(100vw - 36px));
  pointer-events: none;
}

#cbp-chat-widget-root.cbp-pos-right .cbp-chat-launcher {
  right: var(--cbp-launcher-side, 18px);
  left: auto;
  align-items: flex-end;
}

#cbp-chat-widget-root.cbp-pos-left .cbp-chat-launcher {
  left: var(--cbp-launcher-side, 18px);
  right: auto;
  align-items: flex-start;
}

.cbp-chat-launcher > * {
  pointer-events: auto;
}

#cbp-chat-widget-root .cbp-chat-fab {
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--cbp-fab-grad-start, #5b21b6) 0%,
    var(--cbp-fab-grad-mid, #4c1d95) 55%,
    var(--cbp-fab-grad-end, #4338ca) 100%
  );
  color: #fff;
  box-shadow:
    0 8px 28px rgba(76, 29, 149, 0.38),
    0 0 0 3px var(--cbp-fab-ring, rgba(167, 139, 250, 0.45));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  line-height: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

#cbp-chat-widget-root .cbp-chat-fab:hover {
  filter: brightness(1.05);
  box-shadow:
    0 10px 32px rgba(76, 29, 149, 0.42),
    0 0 0 3px var(--cbp-fab-ring, rgba(167, 139, 250, 0.45));
  transform: translateY(-1px);
}

#cbp-chat-widget-root .cbp-chat-fab:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

#cbp-chat-widget-root .cbp-chat-fab:focus {
  outline: 2px solid var(--cbp-fab-ring, rgba(167, 139, 250, 0.65));
  outline-offset: 3px;
}

#cbp-chat-widget-root.cbp-fab-uppercase .cbp-chat-fab-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cbp-chat-fab-icon {
  display: flex;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
}

.cbp-chat-fab-icon svg {
  display: block;
  width: 22px;
  height: 22px;
}

.cbp-chat-fab-label {
  white-space: nowrap;
}

#cbp-chat-widget-root.cbp-pos-right .cbp-chat-launcher-note {
  text-align: right;
}

#cbp-chat-widget-root.cbp-pos-left .cbp-chat-launcher-note {
  text-align: left;
}

.cbp-chat-launcher-note {
  margin: 0;
  padding: 0 4px;
  max-width: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 600;
  color: var(--cbp-note-color, #64748b);
  text-wrap: balance;
}

#cbp-chat-widget-root .cbp-chat-modal {
  position: fixed;
  bottom: var(--cbp-modal-bottom, 140px);
  z-index: 999999;
  width: min(420px, calc(100vw - 36px));
  height: min(560px, calc(100vh - var(--cbp-modal-bottom, 140px) - 24px));
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  display: none;
  overflow: hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

#cbp-chat-widget-root.cbp-pos-right .cbp-chat-modal {
  right: var(--cbp-launcher-side, 18px);
  left: auto;
}

#cbp-chat-widget-root.cbp-pos-left .cbp-chat-modal {
  left: var(--cbp-launcher-side, 18px);
  right: auto;
}

/* Phải cùng độ đặc hiệu với rule display:none phía trên; .cbp-chat-modal.is-open một mình bị thua specificity → modal không bao giờ hiện */
#cbp-chat-widget-root .cbp-chat-modal.is-open {
  display: flex;
  flex-direction: column;
}

.cbp-chat-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cbp-chat-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cbp-chat-title h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  color: #0f172a;
}

.cbp-chat-status {
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e6f7f5;
  color: #0f766e;
  font-weight: 700;
  white-space: nowrap;
}

.cbp-chat-close {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
}

.cbp-chat-close:hover {
  background: rgba(15, 23, 42, 0.06);
}

.cbp-chat-body {
  padding: 14px;
  overflow: auto;
  flex: 1;
  background: #fafafa;
}

.cbp-msg {
  display: flex;
  margin: 10px 0;
}

.cbp-msg.is-user {
  justify-content: flex-end;
}

.cbp-bubble {
  max-width: 85%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.45;
}

.cbp-msg.is-user .cbp-bubble {
  white-space: pre-wrap;
  background: #0f766e;
  border-color: rgba(15, 118, 110, 0.2);
  color: #fff;
}

.cbp-msg.is-assistant .cbp-bubble {
  white-space: normal;
}

.cbp-msg.is-assistant .cbp-bubble p {
  margin: 0 0 0.5em;
}

.cbp-msg.is-assistant .cbp-bubble p:last-child {
  margin-bottom: 0;
}

.cbp-msg.is-assistant .cbp-bubble a {
  color: #0f766e;
  text-decoration: underline;
}

.cbp-msg.is-assistant .cbp-bubble ul,
.cbp-msg.is-assistant .cbp-bubble ol {
  margin: 0.35em 0 0.35em 1.25em;
  padding: 0;
}

.cbp-chat-footer {
  padding: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
}

.cbp-btn {
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
}

.cbp-btn:hover {
  background: rgba(15, 23, 42, 0.04);
}

.cbp-btn.is-primary {
  background: #0f766e;
  border-color: rgba(15, 118, 110, 0.25);
  color: #fff;
}

.cbp-btn.is-primary:hover {
  filter: brightness(0.98);
}

.cbp-input {
  width: 100%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 15px;
  outline: none;
}

.cbp-input:focus {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.cbp-chat-error {
  font-size: 13px;
  color: #b91c1c;
  margin-top: 8px;
}

