/* Talkbridge assistant preview: lightweight, site-aligned, mascot launcher */
:root {
  --tba-blue: #0078d4;
  --tba-blue-deep: #0067b8;
  --tba-blue-dark: #164580;
  --tba-navy: #07111f;
  --tba-gray-900: #1b1b1b;
  --tba-gray-600: #505050;
  --tba-gray-500: #6e6e6e;
  --tba-gray-200: #e6e6e6;
  --tba-gray-100: #f2f2f2;
  --tba-gray-50: #fafafa;
  --tba-white: #fff;
  --tba-shadow: 0 12px 40px rgba(7, 17, 31, 0.18);
  --tba-radius: 12px;
  --tba-font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --tba-mascot: url("/assets/assistant/mascot-v2.20261109i.webp");
  --tba-launcher-size: 78px;
}
#tba-root { all: initial; font-family: var(--tba-font); }
#tba-root * { box-sizing: border-box; font-family: inherit; }

.tba-launch-wrap {
  position: fixed; right: 18px; bottom: 18px; z-index: 99990;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.tba-teaser {
  display: none; align-items: center; gap: 6px;
  max-width: min(240px, calc(100vw - 96px));
  background: var(--tba-white); color: var(--tba-gray-900);
  border: 1px solid var(--tba-gray-200); border-radius: 12px;
  padding: 8px 10px 8px 12px; font-size: 13px; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(7, 17, 31, 0.14);
  position: relative;
}
.tba-teaser.show { display: flex; }
.tba-teaser::after {
  content: ""; position: absolute; right: 22px; bottom: -7px;
  width: 12px; height: 12px; background: #fff;
  border-right: 1px solid var(--tba-gray-200); border-bottom: 1px solid var(--tba-gray-200);
  transform: rotate(45deg);
}
.tba-teaser-text { flex: 1; }
.tba-teaser-x {
  border: none; background: transparent; color: var(--tba-gray-500);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px;
  min-width: 32px; min-height: 32px;
}
.tba-teaser-x:hover { color: var(--tba-gray-900); background: var(--tba-gray-100); }

.tba-launcher {
  width: var(--tba-launcher-size); height: var(--tba-launcher-size);
  border-radius: 50%; border: 2px solid #fff; cursor: pointer; padding: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 120, 212, 0.32);
  display: flex; align-items: center; justify-content: center;
  transition: box-shadow .15s, transform .15s;
  overflow: hidden; position: relative;
}
.tba-launcher img {
  width: 78%; height: 78%; object-fit: contain; border-radius: 0;
  display: block; pointer-events: none;
  /* leave padding so idle wave rotate (±6deg) never clips the owl */
}
.tba-launcher:hover { box-shadow: 0 10px 28px rgba(0, 120, 212, 0.42); transform: translateY(-2px); }
.tba-launcher:focus-visible { outline: 3px solid rgba(0,120,212,.45); outline-offset: 3px; }
.tba-launcher[aria-expanded="true"] {
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 120, 212, 0.38);
}

@keyframes tba-idle-bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-4px); }
  60% { transform: translateY(-2px); }
}
@keyframes tba-idle-wave {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-5deg); }
  50% { transform: rotate(4deg); }
  70% { transform: rotate(-2deg); }
}
.tba-launcher.tba-idle { animation: tba-idle-bounce 2.8s ease-in-out infinite; }
.tba-launcher.tba-idle img {
  animation: tba-idle-wave 2.8s ease-in-out infinite;
  transform-origin: 62% 72%;
}
.tba-launcher:hover,
.tba-launcher[aria-expanded="true"],
.tba-launcher.tba-idle:hover { animation: none; }
.tba-launcher:hover img,
.tba-launcher[aria-expanded="true"] img { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .tba-launcher.tba-idle,
  .tba-launcher.tba-idle img,
  .tba-launcher,
  .tba-launcher img {
    animation: none !important;
    transition: none !important;
  }
}

.tba-panel {
  position: fixed; right: 18px; bottom: calc(var(--tba-launcher-size) + 28px); z-index: 99991;
  width: min(380px, calc(100vw - 24px)); height: min(560px, calc(100vh - 120px));
  background: var(--tba-white); border-radius: var(--tba-radius);
  box-shadow: var(--tba-shadow); border: 1px solid var(--tba-gray-200);
  display: none; flex-direction: column; overflow: hidden;
}
.tba-panel.open { display: flex; }
.tba-head {
  background: linear-gradient(135deg, var(--tba-blue-deep), var(--tba-blue));
  color: var(--tba-white); padding: 12px 10px 12px 14px; flex-shrink: 0;
  display: flex; gap: 10px; align-items: flex-start;
}
.tba-head-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: #fff;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.tba-head-avatar img { width: 86%; height: 86%; border-radius: 0; object-fit: contain; display: block; }
.tba-head-text { min-width: 0; flex: 1; }
.tba-head h2 { margin: 0 0 4px; font-size: 15px; font-weight: 650; color: #fff !important; letter-spacing: -0.2px; }
.tba-head p { margin: 0; font-size: 12.5px; opacity: .92; line-height: 1.4; }
.tba-head-actions {
  display: flex; gap: 2px; flex-shrink: 0; margin-top: -2px;
}
.tba-icon-btn {
  appearance: none; border: none; background: transparent; color: #fff;
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-weight: 600;
  transition: background .12s;
}
.tba-icon-btn:hover { background: rgba(255,255,255,.18); }
.tba-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; background: rgba(255,255,255,.22); }
.tba-icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.tba-badge {
  display: inline-block; margin-top: 8px; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; background: rgba(255,255,255,.18);
  padding: 3px 8px; border-radius: 999px;
}
.tba-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 8px; background: var(--tba-gray-50);
  display: flex; flex-direction: column; gap: 10px;
}
.tba-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.tba-row.team { align-self: flex-start; }
.tba-row.user { align-self: flex-end; flex-direction: row-reverse; }
.tba-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--tba-gray-200); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.tba-avatar img { width: 86%; height: 86%; object-fit: contain; display: block; }
.tba-msg {
  max-width: calc(100% - 36px); padding: 10px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.5; color: var(--tba-gray-900);
}
.tba-msg.team { background: var(--tba-white); border: 1px solid var(--tba-gray-200); border-bottom-left-radius: 4px; }
.tba-msg.user { background: var(--tba-blue); color: #fff; border-bottom-right-radius: 4px; }
.tba-msg a { color: var(--tba-blue-deep); font-weight: 600; }
.tba-msg.user a { color: #fff; text-decoration: underline; }
.tba-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tba-chip {
  border: 1px solid #cfe3f7; background: #eef6ff; color: var(--tba-blue-deep);
  font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 999px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.tba-chip:hover { background: #deecf9; border-color: var(--tba-blue); }
.tba-foot {
  border-top: 1px solid var(--tba-gray-200); padding: 10px; background: var(--tba-white);
  flex-shrink: 0; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  max-height: min(68%, 420px);
}
.tba-panel.tba-lead-open .tba-messages {
  display: none !important;
}
.tba-panel.tba-lead-open .tba-foot {
  flex: 1 1 auto; max-height: none; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-top: none;
}
.tba-form-row { display: flex; gap: 8px; }
.tba-input {
  flex: 1; border: 1px solid var(--tba-gray-200); border-radius: 8px; padding: 10px 12px;
  font-size: 13.5px; outline: none; background: var(--tba-gray-50); color: var(--tba-gray-900);
}
.tba-input:focus { border-color: var(--tba-blue); background: #fff; box-shadow: 0 0 0 3px rgba(0,120,212,.12); }
.tba-send {
  border: none; background: var(--tba-blue); color: #fff; border-radius: 8px; padding: 0 14px;
  font-weight: 650; font-size: 13px; cursor: pointer;
}
.tba-send:hover { background: var(--tba-blue-deep); }
.tba-send:disabled { opacity: .5; cursor: not-allowed; }
.tba-note { font-size: 11px; color: var(--tba-gray-500); margin: 6px 2px 0; line-height: 1.35; }
.tba-lead { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.tba-lead-back {
  align-self: flex-start;
  border: none; background: transparent; color: var(--tba-blue-deep);
  font-size: 13px; font-weight: 650; cursor: pointer;
  padding: 8px 4px; min-height: 40px; margin: -4px 0 0;
  border-radius: 6px;
}
.tba-lead-back:hover { background: #eef6ff; }
.tba-lead-back:focus-visible { outline: 2px solid var(--tba-blue); outline-offset: 1px; }
.tba-lead label { font-size: 11px; font-weight: 650; color: var(--tba-gray-600); }
.tba-lead input, .tba-lead select, .tba-lead textarea {
  width: 100%; border: 1px solid var(--tba-gray-200); border-radius: 8px; padding: 9px 11px;
  font-size: 13px; background: #fff; outline: none;
}
.tba-lead textarea { min-height: 56px; max-height: 96px; resize: vertical; }
.tba-lead input:focus, .tba-lead select:focus, .tba-lead textarea:focus {
  border-color: var(--tba-blue); box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.tba-actions {
  display: flex; flex-direction: column; gap: 8px; margin-top: 10px;
  position: static; background: transparent;
  padding: 4px 0 8px; z-index: auto;
  border-top: none; box-shadow: none;
}
.tba-actions .tba-btn { width: 100%; }
.tba-actions .tba-status { margin: 0 0 4px; order: -1; }
.tba-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 14px; border-radius: 6px; font-size: 13px; font-weight: 650; cursor: pointer; border: none;
  min-height: 40px;
}
.tba-btn-primary { background: var(--tba-blue); color: #fff; }
.tba-btn-primary:hover { background: var(--tba-blue-deep); }
.tba-btn-outline { background: #fff; color: var(--tba-gray-900); border: 1.5px solid var(--tba-gray-200); }
.tba-btn-outline:hover { border-color: var(--tba-gray-900); }
.tba-preview-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100000;
  background: #07111f; color: #fff; font-size: 12px; text-align: center; padding: 8px 12px;
  font-family: var(--tba-font);
}
.tba-preview-banner strong { color: #6db3f7; }
@media (max-width: 480px) {
  .tba-launch-wrap { right: 12px; bottom: 12px; }
  :root { --tba-launcher-size: 72px; }
  .tba-panel { right: 8px; left: 8px; width: auto; bottom: calc(var(--tba-launcher-size) + 20px); height: min(70vh, 560px); }
  .tba-icon-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
}

/* Only two owls: header + launcher. Hide per-message avatars. */
.tba-messages .tba-avatar { display: none !important; }
.tba-msg { max-width: 100%; }

/* Stay under cookie banner (z-index 99999); clear space on mobile when banner is shown */
#tba-root .tba-launch-wrap { z-index: 99990; }
#tba-root .tba-panel { z-index: 99991; }
@media (max-width: 480px) {
  body:has(#tbCookieBanner) #tba-root .tba-launch-wrap { bottom: 118px; }
  body:has(#tbCookieBanner) #tba-root .tba-panel { bottom: calc(var(--tba-launcher-size) + 130px); height: min(58vh, 520px); }
}
.tba-turnstile-wrap { margin: 10px 0 6px; min-height: 65px; }

@media (max-height: 700px) {
  .tba-panel { height: min(560px, calc(100vh - 96px)); }
}

.tba-status {
  font-size: 12.5px; line-height: 1.4; margin: 0; padding: 8px 10px;
  border-radius: 8px; background: #f2f2f2; color: var(--tba-gray-900);
}
.tba-status:empty { display: none; }
.tba-status-error { background: #fde7e9; color: #a4262c; border: 1px solid #f1aeb5; }
.tba-status-success { background: #dff6dd; color: #0b6a0b; border: 1px solid #9fd89f; }
.tba-status-info { background: #eef6ff; color: var(--tba-blue-deep); border: 1px solid #cfe3f7; }
.tba-btn:disabled { opacity: .7; cursor: wait; }

.tba-sent {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 28px 16px 24px;
  min-height: 160px;
}
.tba-sent-icon { line-height: 0; }
.tba-sent-title {
  font-size: 18px; font-weight: 750; color: #0b6a0b; letter-spacing: 0.01em;
}
.tba-sent-text {
  font-size: 13.5px; line-height: 1.45; color: var(--tba-gray-600); max-width: 260px;
}
