/* ============================================================================
   LAWFULDESK — AI CONCIERGE (reference product Parity Reverse-Engineered Look & Feel)
   Floating launcher, contextual teaser bubble, interactive SDR qualification,
   RAG platform Q&A, and live Platform Admin takeover.
   Exact match to reference product snapshot 3: dimensions, typography, buttons, colors.
   ============================================================================ */

:root {
  --bs-cc-font-serif: "BlackstoneSerif", "Canela", Georgia, "Times New Roman", serif;
  --bs-cc-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-cc-ref-dark: #33312c; /* Exact sampled reference product launcher background rgb(51, 49, 44) */
  --bs-cc-ref-hover: #424039;
  --bs-cc-ink: #18181b;
  --bs-cc-muted: #71717a;
  --bs-cc-subtle: #52525b;
  --bs-cc-border: #e4e4e7;
  --bs-cc-green: #10b981;
}

/* Container */
#bs-concierge-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147483647 !important;
  font-family: var(--bs-cc-font-sans);
  -webkit-font-smoothing: antialiased;
  pointer-events: auto !important;
}

/* Floating Launcher Button — LawfulDesk Design System Primary Black Action Button */
.bs-concierge-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 16px 0 8px;
  background: #0f0e0d; /* LawfulDesk Canonical Primary Black */
  color: #ffffff;
  border-radius: 6px; /* LawfulDesk Design System 6px button radius, not capsule 9999px */
  border: 1px solid #0f0e0d;
  box-shadow: 0 8px 24px rgba(15, 14, 13, 0.28), 0 2px 6px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.18s ease,
              border-color 0.18s ease;
  user-select: none;
}
.bs-concierge-launcher:hover {
  background: #262422;
  border-color: #262422;
  transform: translateY(-1.5px);
  box-shadow: 0 12px 28px rgba(15, 14, 13, 0.36);
}
.bs-concierge-launcher:active {
  transform: translateY(0.5px) scale(0.985);
}

/* SQUARE Monogram Mark (mark-white.svg: Solid white rectangle with sharp corners and black serif B) */
.bs-concierge-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #ffffff;
  color: #000000;
  border-radius: 0px !important; /* STRICTLY SHARP SQUARE (radius = 0px) */
  border: none !important; /* Pure solid white square with no outline stroke */
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.bs-concierge-badge svg,
.bs-concierge-badge img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0px !important;
}
.bs-concierge-label {
  font-family: var(--bs-cc-font-sans, "BlackstoneSans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.15px;
  color: #ffffff;
  white-space: nowrap;
}

/* Proactive Speech Bubble */
.bs-concierge-bubble {
  position: absolute;
  bottom: calc(100% + 14px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: #ffffff;
  border-radius: 14px;
  padding: 16px 18px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14), 0 3px 8px rgba(0, 0, 0, 0.04);
  animation: bsCcFadeUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.bs-cc-bubble-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bs-cc-muted);
  margin-bottom: 8px;
}
.bs-cc-bubble-loc::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--bs-cc-green);
  border-radius: 50%;
  display: inline-block;
}
.bs-concierge-bubble-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.bs-concierge-bubble-close:hover {
  background: #f3f4f6;
  color: #111827;
}
.bs-concierge-bubble-text {
  font-size: 13.5px;
  line-height: 1.5;
  color: #1c1b18;
  margin: 0;
  padding-right: 14px;
}

/* ============================================================================
   DRAWER / CHAT WINDOW — EXACT REFERENCE PRODUCT REVERSE-ENGINEERED PARITY (SNAPSHOT 3)
   Clean floating card: 420px wide, 720px high, 14px border radius, white card.
   ============================================================================ */
.bs-concierge-window {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 720px;
  max-height: calc(100vh - 84px);
  background: #ffffff;
  border-radius: 14px; /* Exact corner radius from reference product snapshot */
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.16), 0 4px 14px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bsCcScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header (Snapshot 3: Avatar + LawfulDesk / AI Concierge + clean × close) */
.bs-concierge-header {
  height: 64px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff;
  flex-shrink: 0;
}
.bs-concierge-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bs-concierge-avatar {
  width: 30px;
  height: 30px;
  background: #000000;
  color: #ffffff;
  border-radius: 0px !important; /* STRICTLY SHARP SQUARE (radius = 0px) */
  border: none !important; /* Solid black square on light header background per Design System mark-black.svg */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.bs-concierge-avatar svg,
.bs-concierge-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0px !important;
}
.bs-concierge-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #18181b;
  line-height: 1.25;
}
.bs-concierge-sub {
  font-size: 12px;
  color: #71717a;
  line-height: 1.25;
  margin-top: 2px;
}
.bs-concierge-close {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #71717a;
  font-size: 19px;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 0;
}
.bs-concierge-close:hover {
  color: #18181b;
}

/* Body / Feed (Snapshot 3: Clean text directly on white background, no card bubbles) */
.bs-concierge-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Messages (Snapshot 3) */
.bs-cc-msg {
  display: flex;
  flex-direction: column;
  word-break: break-word;
  animation: bsCcFadeIn 0.18s ease;
}
.bs-cc-msg.bot {
  align-self: flex-start;
  width: 100%;
}
.bs-cc-msg.user {
  align-self: flex-end;
  max-width: 85%;
}

/* Greeting and AI text: Clean flowing text without bubble box (reference product parity) */
.bs-cc-msg.bot .bs-cc-text {
  font-size: 14px;
  line-height: 1.55;
  color: #18181b;
  font-weight: 400;
  margin: 0;
}
.bs-cc-msg.user .bs-cc-bubble {
  background: #f4f4f5; /* Light grey user pill as in reference product */
  color: #18181b;
  font-weight: 400;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.45;
}
.bs-cc-msg.admin .bs-cc-bubble {
  background: #ecfdf5;
  color: #064e3b;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.45;
}
.bs-cc-admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #047857;
  margin-bottom: 4px;
}
.bs-cc-admin-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--bs-cc-green);
}

.bs-cc-saving {
  font-size: 11.5px;
  color: var(--bs-cc-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-left: 2px;
}
.bs-cc-saving-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bs-cc-muted);
  animation: bsCcPulse 1s infinite alternate;
}

/* ============================================================================
   BOTTOM CONTROLS & FOOTER (EXACT SNAPSHOT 3 REVERSE-ENGINEERED)
   "Ask me things like:" + Clickable text links + [Schedule a Conversation]
   + Crisp 1.5px dark-bordered input box + Tiny disclaimer.
   ============================================================================ */
.bs-concierge-footer {
  padding: 10px 24px 18px 24px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* Section Header: "Ask me things like:" with subtle × dismiss */
.bs-cc-ask-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: #8e8e93;
  margin-bottom: 6px;
}
.bs-cc-ask-dismiss {
  border: none;
  background: transparent;
  color: #a1a1aa;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px;
}
.bs-cc-ask-dismiss:hover {
  color: #18181b;
}

/* Clickable suggestion questions (Snapshot 3: Plain text links) */
.bs-cc-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bs-cc-sugg-link {
  text-align: left;
  border: none;
  background: transparent;
  color: #71717a;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.45;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease;
  display: block;
}
.bs-cc-sugg-link:hover {
  color: #18181b;
  text-decoration: underline;
}

/* Quick reply qualification pills (When asking org_type / team_size) */
.bs-cc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.bs-cc-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid #e4e4e7;
  background: #ffffff;
  color: #18181b;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
  line-height: 1.3;
}
.bs-cc-pill:hover {
  background: #f4f4f5;
  border-color: #d4d4d8;
  color: #000000;
}
.bs-cc-pill.dark {
  background: #18181b;
  color: #ffffff;
  border-color: #18181b;
}
.bs-cc-pill.dark:hover {
  background: #000000;
  border-color: #000000;
}

/* Primary Action Button (Snapshot 3: Solid pitch-black button with 4px radius) */
.bs-cc-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 7px 14px;
  background: #18181b;
  color: #ffffff;
  border-radius: 4px; /* Exact reference product button border-radius */
  font-size: 12px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  margin-top: 4px;
  margin-bottom: 10px;
  transition: background 0.15s ease;
  font-family: inherit;
}
.bs-cc-cta-btn:hover {
  background: #000000;
}

/* Input Form (Snapshot 3: Crisp 1.5px solid dark border, 4px radius) */
.bs-cc-input-box {
  display: flex;
  align-items: center;
  border: 1.5px solid #18181b; /* Crisp dark border matching snapshot 3 */
  border-radius: 4px;
  height: 44px;
  padding: 0 8px 0 14px;
  background: #ffffff;
  box-sizing: border-box;
}
.bs-cc-input-box:focus-within {
  border-color: #000000;
}
.bs-cc-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13.5px;
  font-family: inherit;
  color: #18181b;
  background: transparent;
  padding: 0;
}
.bs-cc-input::placeholder {
  color: #71717a;
}

/* Send Button: Subtle square button on right with arrow → */
.bs-cc-send-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: none;
  background: #f4f4f5;
  color: #71717a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.bs-cc-send-btn.active,
.bs-cc-send-btn:hover:not(:disabled) {
  background: #18181b;
  color: #ffffff;
}
.bs-cc-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Disclaimer (Snapshot 3: Tiny grey text with Privacy Policy link) */
.bs-cc-disclaimer {
  font-size: 11px;
  line-height: 1.45;
  color: #71717a;
  text-align: center;
  margin: 8px 0 0;
}
.bs-cc-disclaimer a {
  color: #71717a;
  text-decoration: underline;
}
.bs-cc-disclaimer a:hover {
  color: #18181b;
}

/* Animations */
@keyframes bsCcFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bsCcScaleUp {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes bsCcFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bsCcPulse {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

/* Responsive mobile viewports */
@media (max-width: 480px) {
  #bs-concierge-root {
    bottom: 16px;
    right: 16px;
  }
  .bs-concierge-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 80px);
    bottom: 0;
    right: 0;
  }
}

/* answer links (rev 20 Nov 2026) */
.bs-cc-links { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 0; }
.bs-cc-link { font-size: 13px; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bs-cc-link:focus-visible, .bs-cc-pill:focus-visible, .bs-cc-sugg-link:focus-visible, .bs-cc-send-btn:focus-visible, .bs-concierge-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* G-179: neutral system line (a person joined / chat handed back). Plain text, no name. */
.bs-cc-msg.system { align-self: center; max-width: 92%; text-align: center; font-size: 12px; line-height: 1.4; color: #52525b; padding: 4px 12px; border-top: 1px solid var(--bs-cc-border); border-bottom: 1px solid var(--bs-cc-border); animation: none; }

/* G-182: contrast >= 4.5:1 on white (measured), tap targets and keyboard-safe height on touch widths */
.bs-cc-ask-header { color: #5f5f66; }
.bs-cc-ask-dismiss { color: #5f5f66; }
.bs-concierge-bubble-close { color: #5f5f66; }
.bs-cc-send-btn { color: #52525b; }
.bs-cc-send-btn.active, .bs-cc-send-btn:hover:not(:disabled) { color: #ffffff; }
@media (max-width: 768px), (pointer: coarse) {
  .bs-concierge-launcher { min-height: 44px; }
  .bs-concierge-close { width: 44px; height: 44px; font-size: 24px; margin-right: -10px; }
  .bs-concierge-bubble-close { width: 40px; height: 40px; top: 2px; right: 2px; font-size: 20px; }
  .bs-cc-ask-dismiss { min-width: 40px; min-height: 40px; font-size: 18px; }
  .bs-cc-sugg-link { min-height: 40px; display: flex; align-items: center; padding: 4px 0; font-size: 13.5px; }
  .bs-cc-pill { min-height: 40px; padding: 8px 16px; font-size: 13.5px; }
  .bs-cc-cta-btn { min-height: 40px; padding: 8px 16px; font-size: 13px; }
  .bs-cc-send-btn { width: 44px; height: 44px; min-width: 44px; flex-shrink: 0; }
  .bs-cc-input-box { height: 52px; }
  .bs-cc-input { font-size: 16px; min-height: 44px; } /* 16px stops the iOS zoom on focus */
  .bs-cc-link { display: inline-flex; align-items: center; min-height: 40px; }
  .bs-cc-disclaimer a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 2px; vertical-align: middle; } /* G-182: measured 81x32 */
}
@media (max-width: 768px) {
  #bs-concierge-root { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
  .bs-concierge-bubble { max-width: calc(100vw - 24px); }
  .bs-concierge-window { width: calc(100vw - 24px); max-width: calc(100vw - 24px); height: 640px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .bs-concierge-body { padding: 16px 16px 8px; }
  .bs-concierge-footer { padding: 8px 16px 12px; }
  .bs-concierge-header { padding: 0 8px 0 16px; height: 56px; }
}
@media (max-width: 480px) {
  .bs-concierge-window { height: calc(100vh - 24px); height: calc(100dvh - 24px); }
}
/* G-191: the open panel sat 3 px off-screen at 375 px (absolute inside a zero-width fixed root). On phones pin it to the viewport with equal 12 px gutters, so it fits at 320, 375 and 414 px whatever the root's width is. */
@media (max-width: 768px) {
  .bs-concierge-window { position: fixed; left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; box-sizing: border-box; }
}
