/* Baseline Assistant widget. Brand: #029CD5, Spectral for display, IBM Plex Sans for text. */
.ba-root {
  --ba-brand: #029CD5;
  --ba-brand-dark: #027AA8;
  --ba-ink: #13222C;
  --ba-muted: #5A6A75;
  --ba-line: #DCE6EC;
  --ba-surface: #F3F8FB;
  --ba-white: #FFFFFF;
  --ba-urgent: #B42318;
  --ba-urgent-bg: #FEF3F2;
  --ba-radius: 16px;
  --ba-font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ba-display: "Spectral", Georgia, "Times New Roman", serif;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  font-family: var(--ba-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ba-ink);
  -webkit-font-smoothing: antialiased;
}
.ba-root *, .ba-root *::before, .ba-root *::after { box-sizing: border-box; }
/* Zero-specificity reset so the component rules below always win, while theme styles don't leak in. */
.ba-root :where(button, input, select, textarea) { font: inherit; color: inherit; margin: 0; letter-spacing: normal; text-transform: none; }

/* Launcher */
.ba-launcher {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  padding: 12px 18px 12px 14px;
  border: 0; border-radius: 999px;
  background: var(--ba-brand); color: var(--ba-white);
  box-shadow: 0 8px 24px rgba(2, 60, 90, .25);
  cursor: pointer; font-weight: 500;
  transition: transform .15s ease, background .15s ease;
}
.ba-launcher:hover { background: var(--ba-brand-dark); transform: translateY(-1px); }
.ba-launcher:focus-visible { outline: 3px solid #9ADCF5; outline-offset: 2px; }
.ba-launcher-icon {
  width: 22px; height: 22px; flex: none;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z'/%3E%3C/svg%3E");
}
.ba-open .ba-launcher-label { display: none; }
.ba-open .ba-launcher { padding: 12px; }

/* Panel */
.ba-panel {
  position: absolute; right: 0; bottom: 64px;
  width: 384px; height: min(640px, calc(100vh - 110px));
  display: flex; flex-direction: column;
  background: var(--ba-white);
  border: 1px solid var(--ba-line); border-radius: var(--ba-radius);
  box-shadow: 0 24px 60px rgba(10, 40, 60, .22);
  overflow: hidden;
}
.ba-panel[hidden] { display: none; }

.ba-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px 14px 18px;
  background: var(--ba-brand); color: var(--ba-white);
}
.ba-header-text { flex: 1; min-width: 0; }
.ba-title { font-family: var(--ba-display); font-size: 19px; font-weight: 600; line-height: 1.2; }
.ba-sub { font-size: 12px; opacity: .9; margin-top: 2px; }
.ba-close, .ba-reset {
  border: 0; background: transparent; color: var(--ba-white); cursor: pointer; border-radius: 8px;
}
.ba-close { font-size: 26px; line-height: 1; width: 36px; height: 36px; }
.ba-reset { font-size: 12px; padding: 6px 8px; opacity: .9; }
.ba-close:hover, .ba-reset:hover { background: rgba(255, 255, 255, .15); }
.ba-close:focus-visible, .ba-reset:focus-visible { outline: 2px solid var(--ba-white); }

.ba-log { flex: 1; overflow-y: auto; padding: 16px; background: var(--ba-white); overscroll-behavior: contain; }

.ba-msg { max-width: 92%; margin: 0 0 12px; padding: 11px 14px; border-radius: 14px; word-wrap: break-word; }
.ba-bot { background: var(--ba-surface); border: 1px solid #E6EFF4; border-top-left-radius: 4px; }
.ba-user { margin-left: auto; background: var(--ba-brand); color: var(--ba-white); border-top-right-radius: 4px; white-space: pre-wrap; }
.ba-in { animation: ba-rise .2s ease-out; }
@keyframes ba-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.ba-text p { margin: 0 0 8px; }
.ba-text p:last-child, .ba-text ul:last-child { margin-bottom: 0; }
.ba-text ul { margin: 0 0 8px; padding-left: 20px; }
.ba-text li { margin: 2px 0; }
.ba-text a, .ba-link { color: var(--ba-brand-dark); text-decoration: underline; text-underline-offset: 2px; }
.ba-text strong { font-weight: 600; }

.ba-links { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ba-line); display: flex; flex-direction: column; gap: 4px; }
.ba-links-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ba-muted); }
.ba-link { font-size: 14px; }

.ba-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ba-action {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--ba-brand); background: var(--ba-white); color: var(--ba-brand-dark);
  font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; line-height: 1.3;
}
.ba-root .ba-action:hover, .ba-root .ba-action:focus, .ba-root .ba-action:active { background: #E8F6FC; color: var(--ba-brand-dark); border-color: var(--ba-brand); }
.ba-root .ba-action-primary { background: var(--ba-brand); color: var(--ba-white); }
.ba-root .ba-action-primary:hover, .ba-root .ba-action-primary:focus, .ba-root .ba-action-primary:active { background: var(--ba-brand-dark); border-color: var(--ba-brand-dark); color: var(--ba-white); }
.ba-action:disabled { opacity: .6; cursor: default; }
.ba-root a.ba-action { color: var(--ba-brand-dark); }
.ba-root a.ba-action-primary { color: var(--ba-white); }

.ba-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.ba-chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--ba-line); background: var(--ba-white);
  font-size: 13.5px; cursor: pointer; text-align: left;
}
.ba-root .ba-chip:hover, .ba-root .ba-chip:focus, .ba-root .ba-chip:active { background: #E8F6FC; border-color: var(--ba-brand); color: var(--ba-brand-dark); }
.ba-root .ba-chip:focus-visible { outline: 2px solid var(--ba-brand); outline-offset: 1px; }

.ba-urgent { background: var(--ba-urgent-bg); border-color: #FECDCA; border-left: 4px solid var(--ba-urgent); }
.ba-urgent .ba-text { color: #7A271A; font-weight: 500; }

.ba-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.ba-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9FB3BF; animation: ba-dot 1.2s infinite ease-in-out; }
.ba-typing span:nth-child(2) { animation-delay: .15s; }
.ba-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes ba-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ba-composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ba-line); background: var(--ba-white); }
.ba-input {
  flex: 1; resize: none; min-height: 42px; max-height: 120px;
  padding: 10px 12px; border: 1px solid var(--ba-line); border-radius: 12px; background: var(--ba-white);
  line-height: 1.4; outline: none;
}
.ba-input:focus { border-color: var(--ba-brand); box-shadow: 0 0 0 3px rgba(2, 156, 213, .15); }
.ba-send {
  flex: none; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--ba-brand); color: var(--ba-white); font-size: 20px; font-weight: 600; cursor: pointer;
}
.ba-send:hover { background: var(--ba-brand-dark); }
.ba-send:disabled { opacity: .5; cursor: default; }
.ba-foot { padding: 0 14px 10px; font-size: 11.5px; color: var(--ba-muted); background: var(--ba-white); }

/* Message form */
.ba-form { max-width: 100%; }
.ba-form-title { font-family: var(--ba-display); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.ba-form-note { margin: 0 0 10px; font-size: 13px; color: var(--ba-muted); }
.ba-field { display: block; margin-bottom: 10px; }
.ba-field-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.ba-field-note { display: block; font-size: 12px; color: var(--ba-muted); margin-top: 3px; }
.ba-field input, .ba-field select, .ba-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--ba-line); border-radius: 10px; background: var(--ba-white);
}
.ba-field input:focus, .ba-field select:focus, .ba-field textarea:focus { outline: none; border-color: var(--ba-brand); box-shadow: 0 0 0 3px rgba(2, 156, 213, .15); }
.ba-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.ba-form-status { font-size: 13px; color: var(--ba-urgent); min-height: 0; }

/* Phones: full-width sheet */
@media (max-width: 520px) {
  .ba-root { right: 16px; bottom: 16px; left: auto; }
  .ba-open { left: 0; right: 0; bottom: 0; top: 0; }
  .ba-open .ba-panel { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; border: 0; bottom: 0; }
  .ba-open .ba-launcher { display: none; }
  .ba-launcher-label { display: none; }
  .ba-launcher { padding: 14px; }
  .ba-root .ba-input { font-size: 16px; } /* prevents iOS zoom on focus */
}

@media (prefers-reduced-motion: reduce) {
  .ba-in, .ba-typing span, .ba-launcher { animation: none; transition: none; }
}

/* Theme-proof states: Kadence (and most themes) style button:hover/focus globally. */
.ba-root .ba-launcher:hover, .ba-root .ba-launcher:focus, .ba-root .ba-launcher:active { background: var(--ba-brand-dark); color: var(--ba-white); }
.ba-root .ba-send:hover, .ba-root .ba-send:focus, .ba-root .ba-send:active { background: var(--ba-brand-dark); color: var(--ba-white); }
.ba-root .ba-close:hover, .ba-root .ba-close:focus, .ba-root .ba-reset:hover, .ba-root .ba-reset:focus { background: rgba(255, 255, 255, .15); color: var(--ba-white); }
.ba-root .ba-chip, .ba-root .ba-action, .ba-root .ba-send, .ba-root .ba-close, .ba-root .ba-reset, .ba-root .ba-launcher { box-shadow: none; text-decoration: none; }

/* Admin-only "Fix this answer" link */
.ba-root .ba-fix { display: block; margin-top: 10px; padding: 0; border: 0; background: none; color: var(--ba-muted); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.ba-root .ba-fix:hover, .ba-root .ba-fix:focus { background: none; color: var(--ba-brand-dark); }

/* Fit quiz */
.ba-root .ba-chip-quiz { background: var(--ba-brand); border-color: var(--ba-brand); color: var(--ba-white); font-weight: 500; }
.ba-root .ba-chip-quiz:hover, .ba-root .ba-chip-quiz:focus, .ba-root .ba-chip-quiz:active { background: var(--ba-brand-dark); border-color: var(--ba-brand-dark); color: var(--ba-white); }
.ba-quiz { max-width: 100%; }
.ba-quiz-progress { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ba-muted); }
.ba-quiz-bar { height: 4px; background: var(--ba-line); border-radius: 4px; margin: 6px 0 10px; overflow: hidden; }
.ba-quiz-bar span { display: block; height: 100%; background: var(--ba-brand); border-radius: 4px; transition: width .25s ease; }
.ba-quiz-q { margin: 0 0 10px; font-weight: 500; }
.ba-quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.ba-root .ba-quiz-opt {
  width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--ba-line); background: var(--ba-white); color: var(--ba-ink);
  font-size: 14px; line-height: 1.35; cursor: pointer; box-shadow: none; text-decoration: none;
}
.ba-root .ba-quiz-opt:hover, .ba-root .ba-quiz-opt:focus { background: #E8F6FC; border-color: var(--ba-brand); color: var(--ba-ink); }
.ba-root .ba-quiz-opt:focus-visible { outline: 2px solid var(--ba-brand); outline-offset: 1px; }
.ba-root .ba-quiz-opt[aria-pressed="true"] { background: var(--ba-brand); border-color: var(--ba-brand); color: var(--ba-white); }
.ba-root .ba-quiz-exit { margin-left: auto; padding: 8px 4px; border: 0; background: none; color: var(--ba-muted); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; box-shadow: none; }
.ba-root .ba-quiz-exit:hover, .ba-root .ba-quiz-exit:focus { background: none; color: var(--ba-brand-dark); }
.ba-check { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; cursor: pointer; }
.ba-check input { width: 16px; height: 16px; accent-color: var(--ba-brand); }
@media (prefers-reduced-motion: reduce) { .ba-quiz-bar span { transition: none; } }
