/* Beatrix floating widget — landing page */
.bx-fab {
  position: fixed;
  z-index: 70;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0.35rem 1rem 0.35rem 0.35rem;
  border: 0;
  border-radius: 999px;
  background: #0d2137;
  color: #fff;
  box-shadow: 0 10px 28px rgba(13, 33, 55, 0.28);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  -webkit-tap-highlight-color: transparent;
}
.bx-fab img {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}
.bx-fab:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: 3px;
}
.bx-fab-label { padding-right: 0.2rem; white-space: nowrap; }

.bx-dock {
  position: fixed;
  z-index: 71;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  width: min(24.5rem, calc(100vw - 1.5rem));
  height: min(34rem, calc(var(--beatrix-vh, 100dvh) - 1.5rem));
  max-height: calc(var(--beatrix-vh, 100dvh) - 1.5rem);
  display: flex;
  flex-direction: column;
  border-radius: 1rem;
  overflow: hidden;
  background: #e8eef4;
  box-shadow: 0 18px 48px rgba(13, 33, 55, 0.32);
  border: 1px solid rgba(13, 33, 55, 0.08);
  box-sizing: border-box;
}
.bx-dock[hidden] { display: none !important; }
.bx-dock-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-shrink: 0;
  padding: 0.7rem 0.75rem;
  background: #0d2137;
  color: #fff;
}
.bx-dock-head img {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}
.bx-dock-head h2 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}
.bx-dock-sub {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.bx-dock-dot { color: #22c55e; font-size: 0.65rem; }
.bx-dock-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}
.bx-dock-new,
.bx-dock-close {
  border: 0;
  background: transparent;
  color: #fff;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0.92;
}
.bx-dock-new:hover,
.bx-dock-close:hover { opacity: 1; background: rgba(255,255,255,0.1); }
.bx-dock-new:focus-visible,
.bx-dock-close:focus-visible {
  outline: 2px solid #f5c518;
  outline-offset: 2px;
}
.bx-dock-new svg { display: block; }
@media (max-width: 480px) {
  .bx-dock-new,
  .bx-dock-close {
    width: 2.1rem;
    height: 2.1rem;
  }
}
.bx-dock-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.85rem 0.75rem;
  -webkit-overflow-scrolling: touch;
}
.bx-dock-bubble {
  max-width: 88%;
  width: fit-content;
  margin: 0 0 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.85rem;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 0.5px rgba(13, 33, 55, 0.06);
  box-sizing: border-box;
}
.bx-dock-bubble.is-ai {
  background: #fff;
  color: #0d2137;
  border-bottom-left-radius: 0.25rem;
}
.bx-dock-bubble.is-user {
  margin-left: auto;
  background: #d9fdd3;
  color: #0d2137;
  border-bottom-right-radius: 0.25rem;
}
.bx-dock-bubble.is-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  white-space: normal;
}
.bx-typing-label {
  color: rgba(13, 33, 55, 0.62);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
}
.bx-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  min-height: 1.1rem;
}
.bx-typing span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #7b8b9c;
  animation: bx-dot 1.05s infinite ease-in-out;
}
.bx-typing span:nth-child(2) { animation-delay: 0.15s; }
.bx-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bx-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.bx-dock-time {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  opacity: 0.65;
  text-align: right;
}
.bx-dock-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.55rem 0.6rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  background: #f0f4f8;
  border-top: 1px solid rgba(13, 33, 55, 0.08);
}
.bx-dock-form textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 2.5rem;
  max-height: 6rem;
  margin: 0;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(13, 33, 55, 0.14);
  border-radius: 1.15rem;
  resize: none;
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
  background: #fff;
  color: #0d2137;
}
.bx-dock-send {
  flex: 0 0 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: #f5c518;
  color: #0d2137;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bx-dock-send:disabled { opacity: 0.4; cursor: not-allowed; }
.bx-dock-send svg { width: 1.05rem; height: 1.05rem; display: block; }

/* Reply message */
.bx-dock-bubble {
  position: relative;
  touch-action: pan-y;
  --bx-swipe: 0px;
  --bx-swipe-p: 0;
  transition: transform 0.18s ease;
  -webkit-touch-callout: none;
}
.bx-dock-bubble.is-swiping {
  transition: none;
  z-index: 1;
}
.bx-dock-bubble .bx-reply-swipe-icon {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  width: 1.55rem;
  height: 1.55rem;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(84, 101, 111, 0.12);
  color: #54656f;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transform: translate3d(calc(-1 * var(--bx-swipe, 0px)), -50%, 0) scale(0.55);
  will-change: transform, opacity;
}
.bx-dock-bubble .bx-reply-swipe-icon svg {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
}
.bx-dock-bubble.is-swiping .bx-reply-swipe-icon {
  opacity: var(--bx-swipe-p, 0);
  transform: translate3d(calc(-1 * var(--bx-swipe, 0px)), -50%, 0)
    scale(calc(0.55 + (0.45 * var(--bx-swipe-p, 0))));
}
/* Legacy permanent reply button — never show */
.bx-dock-bubble .bx-reply-btn {
  display: none !important;
}
.bx-dock-bubble .bx-reply-quote {
  display: block;
  width: 100%;
  margin: 0 0 0.3rem;
  padding: 0.3rem 0.45rem;
  border: 0;
  border-left: 3px solid #06cf9c;
  border-radius: 0.3rem;
  background: rgba(13, 33, 55, 0.06);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.bx-dock-bubble.is-user .bx-reply-quote {
  background: rgba(255, 255, 255, 0.4);
  border-left-color: #128c7e;
}
.bx-reply-quote-name {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: #0b7a4b;
}
.bx-reply-quote-text {
  display: block;
  font-size: 0.78rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bx-dock-bubble.bx-reply-flash {
  outline: 2px solid #06cf9c;
  outline-offset: 2px;
}
.bx-reply-preview {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
  width: 100%;
  flex: 1 0 100%;
  order: -1;
  margin: 0 0 0.25rem;
  padding: 0.4rem 0.45rem;
  border-radius: 0.55rem;
  background: #e4ebf2;
  box-sizing: border-box;
}
.bx-reply-preview[hidden] { display: none !important; }
.bx-reply-preview-bar {
  width: 3px;
  border-radius: 3px;
  background: #06cf9c;
  flex-shrink: 0;
}
.bx-reply-preview-body { flex: 1 1 auto; min-width: 0; }
.bx-reply-preview-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0b7a4b;
}
.bx-reply-preview-text {
  font-size: 0.8rem;
  color: rgba(13, 33, 55, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bx-reply-preview-close {
  border: 0;
  background: transparent;
  color: #54656f;
  font-size: 1.2rem;
  line-height: 1;
  width: 1.6rem;
  height: 1.6rem;
  cursor: pointer;
}
.bx-reply-menu {
  position: fixed;
  z-index: 2000;
  min-width: 11rem;
  padding: 0.35rem 0;
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: 0 2px 5px 0 rgba(11, 20, 26, 0.19), 0 8px 18px 4px rgba(11, 20, 26, 0.15);
  border: 0;
}
.bx-reply-menu[hidden] { display: none !important; }
.bx-reply-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.7rem 1rem;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 400;
  color: #111b21;
  text-align: left;
}
.bx-reply-menu-item:hover { background: #f5f6f6; }
.bx-reply-menu-item svg {
  width: 1.15rem;
  height: 1.15rem;
  color: #54656f;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .bx-fab-label { display: none; }
  .bx-fab { padding: 0.3rem; min-height: 0; }
  .bx-dock {
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--beatrix-vv-top, 0px);
    width: 100%;
    max-width: 100%;
    height: var(--beatrix-vh, 100dvh);
    max-height: var(--beatrix-vh, 100dvh);
    border-radius: 0;
    border: 0;
  }
  .bx-dock-form {
    padding: 0.5rem 0.55rem max(0.5rem, env(safe-area-inset-bottom, 0px));
  }
  .bx-dock-form textarea {
    min-height: 3rem;
    font-size: 16px;
  }
  .bx-dock-send {
    width: 3rem;
    height: 3rem;
    flex-basis: 3rem;
  }
}
