/* Preview-only chat widget. Not on the live playbook Worker. */
.mba-preview-banner {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #231769;
  color: #fffdf8;
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
  padding: 0.45rem 1rem;
}
.mba-preview-banner a {
  color: #ece6f6;
  text-decoration: underline;
}

.mba-chat-root {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 50;
  font-family: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;
  color: #231769;
}

.mba-chat-toggle {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: #5d10b8;
  color: #fffdf8;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.05rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px color-mix(in srgb, #5d10b8 35%, transparent);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.mba-chat-toggle:hover,
.mba-chat-toggle:focus-visible {
  background: #431397;
  outline: 2px solid #431397;
  outline-offset: 2px;
}
.mba-chat-toggle[aria-expanded="true"] {
  display: none;
}

.mba-chat-panel {
  width: min(22.5rem, calc(100vw - 1.6rem));
  height: min(32rem, calc(100vh - 6rem));
  background: #fffdf8;
  border: 1px solid #e4ddd0;
  border-radius: 1rem;
  box-shadow: 0 16px 40px color-mix(in srgb, #231769 18%, transparent);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mba-chat-panel[hidden] {
  display: none !important;
}

.mba-chat-header {
  background: #5d10b8;
  color: #fffdf8;
  padding: 0.85rem 1rem 0.7rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.mba-chat-header h2 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fffdf8;
}
.mba-chat-disclaimer {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #ece6f6;
}
.mba-chat-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #fffdf8;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
}
.mba-chat-close:hover,
.mba-chat-close:focus-visible {
  outline: 2px solid #ece6f6;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

.mba-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.9rem 0.9rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f3eee4;
}
.mba-chat-bubble {
  max-width: 92%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.8rem;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mba-chat-bubble[data-role="agent"] {
  background: #fffdf8;
  border: 1px solid #e4ddd0;
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
}
.mba-chat-bubble[data-role="user"] {
  background: #ece6f6;
  color: #231769;
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
}
.mba-chat-bubble[data-role="error"] {
  background: #fffdf8;
  border: 1px solid #431397;
  align-self: flex-start;
}
.mba-chat-who {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5d10b8;
  margin-bottom: 0.2rem;
}

.mba-chat-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem;
  background: #fffdf8;
  border-top: 1px solid #e4ddd0;
}
.mba-chat-form input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 1px solid #e4ddd0;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: #231769;
  background: #fffdf8;
}
.mba-chat-form input[type="text"]:focus {
  outline: 2px solid #5d10b8;
  outline-offset: 1px;
  border-color: #5d10b8;
}
.mba-chat-form button[type="submit"] {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #5d10b8;
  color: #fffdf8;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}
.mba-chat-form button[type="submit"]:hover,
.mba-chat-form button[type="submit"]:focus-visible {
  background: #431397;
}
.mba-chat-form button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 480px) {
  .mba-chat-root {
    right: 0.7rem;
    bottom: 0.7rem;
  }
  .mba-chat-panel {
    width: min(100vw - 1.2rem, 22.5rem);
    height: min(70vh, 32rem);
  }
}
