:root {
  --rachel-black: #111111;
  --rachel-white: #ffffff;
  --rachel-border: rgba(17, 17, 17, 0.12);
  --rachel-muted: #6b7280;
  --rachel-soft: #f5f5f5;
  --rachel-launcher-bg: #111111;
  --rachel-launcher-color: #ffffff;
  --rachel-assistant-bg: #f3f4f6;
  --rachel-assistant-color: #101828;
  --rachel-visitor-bg: #17264a;
  --rachel-visitor-color: #ffffff;
  --rachel-panel-bg: #ffffff;
  --rachel-panel-radius: 24px;
  --rachel-launcher-size: 62px;
  --rachel-panel-width: 420px;
  --rachel-panel-height: 610px;
  --rachel-launcher-radius: 50%;
  --rachel-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  --rachel-soft-border: rgba(15, 23, 42, 0.1);

  /* --- clarity system (consolidated from audit) --- */
  /* neutral ink ramp */
  --rachel-ink-900: #101828;
  --rachel-ink-700: #475467;
  --rachel-ink-500: #667085;
  --rachel-ink-300: #98a2b3;
  --rachel-ink-navy: #17264a;
  /* font weights */
  --rachel-fw-regular: 400;
  --rachel-fw-medium: 500;
  --rachel-fw-semibold: 600;
  --rachel-fw-bold: 700;
  /* type scale */
  --rachel-fs-xs: 11px;   --rachel-lh-xs: 1.3;
  --rachel-fs-sm: 13px;   --rachel-lh-sm: 1.35;
  --rachel-fs-base: 15px; --rachel-lh-base: 1.45;
  --rachel-fs-lg: 16px;   --rachel-lh-lg: 1.25;
  /* radii */
  --r-sm: 8px; --r-md: 13px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;
  /* spacing (4px rhythm) */
  --space-1: 4px; --space-2: 8px; --space-3: 12px;
  --space-4: 16px; --space-5: 20px; --space-6: 24px;

  /* accent — single brand source (defaults to the visitor/brand navy) */
  --rachel-accent: var(--rachel-visitor-bg);
  --rachel-on-accent: var(--rachel-visitor-color);
  /* hairline + elevation scale (replaces ad-hoc shadows) */
  --rachel-hairline: rgba(16, 24, 40, 0.08);
  --rachel-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --rachel-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --rachel-shadow-lg: 0 14px 38px rgba(16, 24, 40, 0.12);
  --rachel-shadow-xl: 0 24px 70px rgba(16, 24, 40, 0.18);
  /* motion system */
  --rachel-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --rachel-dur-fast: 140ms;
  --rachel-dur-base: 220ms;
}

.rachel-chat-root,
.rachel-chat-root * {
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.rachel-chat-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2147483000;
  color: var(--rachel-black);
}

.rachel-chat-root[data-position="bottom-left"] {
  right: auto;
  left: 22px;
}

.rachel-chat-button {
  width: var(--rachel-launcher-size);
  height: var(--rachel-launcher-size);
  border: 0;
  border-radius: var(--rachel-launcher-radius);
  background: var(--rachel-launcher-bg);
  color: var(--rachel-launcher-color);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12), 0 18px 40px rgba(15, 23, 42, 0.18);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--rachel-dur-base) var(--rachel-ease), box-shadow var(--rachel-dur-base) var(--rachel-ease), opacity var(--rachel-dur-base) var(--rachel-ease);
  position: relative;
}

.rachel-chat-button:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16), 0 24px 54px rgba(15, 23, 42, 0.24);
}

.rachel-launcher-icon {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  line-height: 0;
}

.rachel-chat-button svg {
  width: 36px;
  height: 36px;
  display: block;
}

/* ===== Launcher style variants (default = halo) ===== */
.rachel-launcher-pill-label,
.rachel-launcher-accent,
.rachel-launcher-chatbadge {
  display: none;
}

.rachel-launcher-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2ec27e;
  border: 2.5px solid var(--rachel-panel-bg, #ffffff);
  display: none;
}

.rachel-launcher-accent {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c79a5b;
  border: 2px solid var(--rachel-launcher-bg, #0c0c0f);
}

.rachel-launcher-chatbadge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--rachel-launcher-bg, #0c0c0f);
  border: 2px solid var(--rachel-panel-bg, #ffffff);
  place-items: center;
  color: #fff;
}

.rachel-launcher-chatbadge svg {
  width: 13px;
  height: 13px;
}

.rachel-launcher-pill-label {
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--rachel-launcher-color, #ffffff);
}

/* Circle: clean solid circle */
.rachel-chat-root[data-launcher-style="circle"] .rachel-chat-button {
  box-shadow: 0 16px 34px rgba(10, 10, 15, 0.3), 0 3px 8px rgba(10, 10, 15, 0.2);
}

/* Halo (default): depth + faint outer ring + live online dot */
.rachel-chat-root[data-launcher-style="halo"] .rachel-chat-button {
  box-shadow:
    0 16px 34px rgba(10, 10, 15, 0.32),
    0 3px 8px rgba(10, 10, 15, 0.22),
    0 0 0 5px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -10px 18px rgba(0, 0, 0, 0.2);
}

.rachel-chat-root[data-launcher-style="halo"] .rachel-launcher-dot,
.rachel-chat-root[data-launcher-style="line"] .rachel-launcher-dot,
.rachel-chat-root[data-launcher-style="avatar"] .rachel-launcher-dot {
  display: block;
}

/* Line: thin outline icon + live online dot */
.rachel-chat-root[data-launcher-style="line"] .rachel-chat-button {
  box-shadow: 0 16px 34px rgba(10, 10, 15, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Soft: light gray, dark icon */
.rachel-chat-root[data-launcher-style="soft"] .rachel-chat-button {
  background: #f3f4f6;
  color: #15171c;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

/* Avatar: agent photo + chat badge + online dot */
.rachel-chat-root[data-launcher-style="avatar"] .rachel-chat-button {
  background-size: cover;
  background-position: center;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.28);
}

.rachel-chat-root[data-launcher-style="avatar"] .rachel-launcher-icon {
  display: none;
}

.rachel-chat-root[data-launcher-style="avatar"] .rachel-launcher-chatbadge {
  display: grid;
}

/* Avatar style presents a single named agent — never the team-of-3 stack */
.rachel-chat-root[data-launcher-style="avatar"] .rachel-team-stack {
  display: none;
}

/* Pill: icon + "Speak to an expert" label */
.rachel-chat-root[data-launcher-style="pill"] .rachel-chat-button {
  width: auto;
  height: 56px;
  border-radius: 999px;
  padding: 0 22px 0 18px;
  grid-auto-flow: column;
  gap: 10px;
  box-shadow: 0 16px 34px rgba(10, 10, 15, 0.3);
}

.rachel-chat-root[data-launcher-style="pill"] .rachel-chat-button svg {
  width: 24px;
  height: 24px;
}

.rachel-chat-root[data-launcher-style="pill"] .rachel-launcher-pill-label {
  display: inline;
}

/* Pulse: subtle breathing ring */
.rachel-chat-root[data-launcher-style="pulse"] .rachel-chat-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: rachelLauncherPulse 2.4s ease-out infinite;
}

@keyframes rachelLauncherPulse {
  0% { box-shadow: 0 0 0 0 rgba(12, 12, 15, 0.32); }
  70% { box-shadow: 0 0 0 16px rgba(12, 12, 15, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 12, 15, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .rachel-chat-root[data-launcher-style="pulse"] .rachel-chat-button::after { animation: none; }
}

.rachel-launcher-teaser {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 8px;
  width: max-content;
  max-width: min(240px, calc(100vw - 116px));
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--rachel-soft-border);
  border-radius: var(--r-md);
  background: var(--rachel-white);
  color: var(--rachel-black);
  box-shadow: var(--rachel-shadow-lg);
  font-size: var(--rachel-fs-sm);
  line-height: var(--rachel-lh-sm);
  font-weight: var(--rachel-fw-semibold);
  white-space: normal;
  text-align: left;
}

.rachel-launcher-teaser[hidden] {
  display: none;
}

.rachel-launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 2px solid var(--rachel-white);
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  background: #e11937;
  color: #fff;
  font-size: var(--rachel-fs-xs);
  font-weight: var(--rachel-fw-bold);
  line-height: 1;
}

.rachel-launcher-badge[hidden] {
  display: none;
}

.rachel-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: min(var(--rachel-panel-width), calc(100vw - 32px));
  height: min(var(--rachel-panel-height), calc(100vh - 64px));
  height: min(var(--rachel-panel-height), calc(100dvh - 64px));
  background: var(--rachel-panel-bg);
  border: 1px solid var(--rachel-hairline);
  border-radius: max(20px, var(--rachel-panel-radius));
  overflow: hidden;
  box-shadow: var(--rachel-shadow-xl);
  display: none;
  grid-template-rows: auto auto 1fr auto;
  isolation: isolate;
}

.rachel-chat-root[data-position="bottom-left"] .rachel-chat-panel {
  right: auto;
  left: 0;
}

.rachel-chat-root.is-open .rachel-chat-panel {
  display: grid;
  bottom: 0;
  animation: rachelPanelIn var(--rachel-dur-base) var(--rachel-ease) both;
}

.rachel-chat-root.is-closing .rachel-chat-panel {
  animation: rachelPanelOut var(--rachel-dur-fast) var(--rachel-ease) both;
}

.rachel-chat-root.is-expanded .rachel-chat-panel {
  width: min(560px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
  height: min(720px, calc(100dvh - 48px));
}

.rachel-chat-root.is-open .rachel-chat-button {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}

.rachel-chat-header {
  min-width: 0;
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--rachel-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  overflow: hidden;
}

.rachel-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  margin-left: auto;
}

.rachel-chat-person {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  flex: 1 1 auto;
}

.rachel-chat-copy {
  min-width: 0;
}

.rachel-chat-avatar {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4d9c7, #c79874);
  background-position: center;
  background-size: cover;
  position: relative;
  display: grid;
  place-items: center;
  color: #111;
  font-weight: var(--rachel-fw-semibold);
  flex: 0 0 38px;
  overflow: hidden;
}

.rachel-chat-avatar.is-logo {
  background: var(--rachel-white);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: inset 0 0 0 1px rgba(23, 38, 74, 0.03);
}

.rachel-chat-avatar.is-logo img {
  position: static;
  display: block;
  margin: auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
  object-position: center;
  padding: 0;
}

.rachel-chat-avatar.is-logo svg {
  width: 30px;
  height: 30px;
  margin: auto;
  display: block;
  color: #17264a;
}

.rachel-chat-avatar img,
.rachel-team-avatar img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  max-width: none;
  object-fit: cover;
}

.rachel-avatar-fallback {
  position: relative;
  z-index: 1;
}

.rachel-chat-avatar.has-image .rachel-avatar-fallback,
.rachel-chat-avatar.has-image .rachel-logo-fallback,
.rachel-team-avatar.has-image .rachel-avatar-fallback {
  visibility: hidden;
}

.rachel-chat-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.rachel-chat-status {
  color: var(--rachel-ink-500);
  font-size: var(--rachel-fs-xs);
  line-height: var(--rachel-lh-xs);
  font-weight: var(--rachel-fw-medium);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rachel-team-stack {
  display: flex;
  align-items: center;
  margin-left: auto;
  min-width: 68px;
  justify-content: flex-end;
}

.rachel-team-stack[hidden] {
  display: none;
}

.rachel-team-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  aspect-ratio: 1 / 1;
  margin-left: -8px;
  border: 2px solid var(--rachel-panel-bg);
  border-radius: 50%;
  background: linear-gradient(145deg, #f4d9c7, #c79874);
  background-position: center;
  background-size: cover;
  position: relative;
  display: grid;
  place-items: center;
  color: #111;
  font-size: var(--rachel-fs-xs);
  font-weight: var(--rachel-fw-medium);
  flex: 0 0 28px;
  overflow: hidden;
}

.rachel-team-avatar:first-child {
  margin-left: 0;
}

.rachel-team-overflow {
  background: var(--rachel-black);
  color: var(--rachel-white);
  font-size: var(--rachel-fs-xs);
}

.rachel-chat-menu,
.rachel-chat-expand,
.rachel-chat-mute,
.rachel-chat-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--rachel-ink-500);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background var(--rachel-dur-fast) var(--rachel-ease), color var(--rachel-dur-fast) var(--rachel-ease), transform var(--rachel-dur-fast) var(--rachel-ease);
}

.rachel-chat-menu:hover,
.rachel-chat-expand:hover,
.rachel-chat-mute:hover,
.rachel-chat-close:hover {
  background: rgba(15, 23, 42, 0.07);
  color: var(--rachel-ink-navy);
  transform: translateY(-1px);
}

.rachel-chat-menu:active,
.rachel-chat-expand:active,
.rachel-chat-mute:active,
.rachel-chat-close:active {
  background: rgba(17, 17, 17, 0.13);
  transform: translateY(0) scale(0.96);
}

.rachel-chat-menu:focus-visible,
.rachel-chat-expand:focus-visible,
.rachel-chat-mute:focus-visible,
.rachel-chat-close:focus-visible {
  outline: 2px solid rgba(17, 17, 17, 0.32);
  outline-offset: 2px;
}

.rachel-chat-root.is-muted .rachel-chat-mute {
  background: rgba(225, 25, 55, 0.1);
  color: #b91c1c;
}

.rachel-chat-mute {
  display: none;
}

.rachel-chat-root[data-template="command"] .rachel-chat-panel {
  border-color: rgba(23, 38, 74, 0.2);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.3);
}

.rachel-chat-root[data-template="command"] .rachel-chat-header {
  background: var(--rachel-launcher-bg);
  color: var(--rachel-launcher-color);
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.rachel-chat-root[data-template="command"] .rachel-chat-status,
.rachel-chat-root[data-template="command"] .rachel-chat-menu,
.rachel-chat-root[data-template="command"] .rachel-chat-expand,
.rachel-chat-root[data-template="command"] .rachel-chat-close {
  color: rgba(255, 255, 255, 0.74);
}

.rachel-chat-root[data-template="command"] .rachel-chat-menu:hover,
.rachel-chat-root[data-template="command"] .rachel-chat-expand:hover,
.rachel-chat-root[data-template="command"] .rachel-chat-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.rachel-chat-root[data-template="command"] .rachel-call-cta {
  background: #f1f5ff;
  border-bottom-color: rgba(47, 47, 220, 0.12);
}

.rachel-chat-root[data-template="command"] .rachel-chat-messages {
  background: #fbfcff;
}

.rachel-chat-root[data-template="command"] .rachel-message {
  border-radius: 18px;
}

.rachel-chat-root[data-template="command"] .rachel-chat-form {
  background: #fbfcff;
}

.rachel-chat-root[data-template="studio"] .rachel-chat-panel {
  border-color: rgba(122, 74, 36, 0.12);
  box-shadow: 0 28px 80px rgba(72, 48, 28, 0.24);
}

.rachel-chat-root[data-template="studio"] .rachel-chat-header,
.rachel-chat-root[data-template="studio"] .rachel-chat-form {
  background: var(--rachel-panel-bg);
}

.rachel-chat-root[data-template="studio"] .rachel-chat-messages {
  background:
    radial-gradient(circle at top left, rgba(154, 90, 46, 0.08), transparent 34%),
    var(--rachel-panel-bg);
}

.rachel-chat-root[data-template="studio"] .rachel-message,
.rachel-chat-root[data-template="studio"] .rachel-typing {
  border-radius: 24px;
}

.rachel-chat-root[data-template="studio"] .rachel-call-cta {
  background: #f8efe4;
  border-bottom-color: rgba(122, 74, 36, 0.12);
}

.rachel-chat-root[data-template="studio"] .rachel-chat-button {
  box-shadow: 0 20px 48px rgba(90, 54, 30, 0.28);
}

.rachel-call-cta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 12px 14px;
  padding: 12px 14px;
  color: #101828;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.06);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.12s ease;
}

.rachel-call-cta[hidden] {
  display: none;
}

.rachel-call-cta:hover {
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 10px 24px rgba(15, 23, 42, 0.1);
}

.rachel-call-cta:active {
  transform: translateY(1px);
}

.rachel-call-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--rachel-launcher-bg);
  color: var(--rachel-launcher-color);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.rachel-call-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--rachel-fs-sm);
  line-height: var(--rachel-lh-sm);
  font-weight: var(--rachel-fw-semibold);
}

.rachel-call-number {
  color: #17264a;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  font-weight: 800;
}

.rachel-chat-messages {
  overflow-y: auto;
  padding: var(--space-5) var(--space-4) var(--space-4);
  background: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}

.rachel-time-separator {
  margin: 0 auto var(--space-4);
  width: fit-content;
  max-width: 100%;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--rachel-ink-500);
  font-size: var(--rachel-fs-xs);
  font-weight: var(--rachel-fw-medium);
}

.rachel-message {
  width: fit-content;
  max-width: 80%;
  margin: 0 0 14px;
  padding: 13px 15px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.42;
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: rachelMsgIn var(--rachel-dur-base) var(--rachel-ease) both;
}

/* group consecutive same-sender bubbles: tighter gap + one timestamp per run */
.rachel-message.assistant:has(+ .rachel-message.assistant),
.rachel-message.visitor:has(+ .rachel-message.visitor) {
  margin-bottom: var(--space-1);
}

.rachel-message.assistant:has(+ .rachel-message.assistant) .rachel-message-time,
.rachel-message.visitor:has(+ .rachel-message.visitor) .rachel-message-time {
  display: none;
}

.rachel-message-time {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--rachel-fs-xs);
  line-height: 1.1;
  opacity: 0.75;
  font-weight: var(--rachel-fw-medium);
}

.rachel-message.assistant {
  background: var(--rachel-assistant-bg);
  color: var(--rachel-assistant-color);
  /* signature sharp corner on the aligned (left) edge — the grouping rules below
     tighten the matching bottom corner so a run of bubbles stitches together */
  border-top-left-radius: var(--r-sm);
  box-shadow: inset 0 0 0 1px var(--rachel-hairline);
}

.rachel-message.visitor {
  background: var(--rachel-accent);
  color: var(--rachel-on-accent);
  margin-left: auto;
  border-top-right-radius: var(--r-sm);
  box-shadow: var(--rachel-shadow-md);
}

/* Connected bubble grouping for consecutive same-sender runs */
.rachel-message.is-first,
.rachel-message.is-middle {
  margin-bottom: 3px;
}

.rachel-message.assistant.is-first,
.rachel-message.assistant.is-middle {
  border-bottom-left-radius: 8px;
}

.rachel-message.visitor.is-first,
.rachel-message.visitor.is-middle {
  border-bottom-right-radius: 8px;
}

/* Delivered -> Seen read receipt: a row BELOW the latest visitor message */
.rachel-message-receipt {
  display: block;
  width: fit-content;
  margin: -7px 2px 12px auto;
  font-size: 11px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: right;
  color: #98a2b3;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.rachel-message-receipt.is-seen {
  color: #667085;
}

.rachel-system-message {
  width: fit-content;
  max-width: 86%;
  margin: 0 auto 14px;
  padding: 8px 14px;
  border-radius: 16px;
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  font-weight: 750;
  text-wrap: balance;
}

/* The queue/intro opener is a full sentence (the rapport line), not a short status pill.
   The heavy 750 weight + centered layout made a whole paragraph read as a shouty block, so
   render it as a calm, normal-weight message at a readable size. */
.rachel-system-message[data-rachel-queue-message] {
  max-width: 92%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  color: #475467;
  text-wrap: pretty;
}

/* Tidio "Lyro is typing" style: borderless inline row, no bubble */
.rachel-typing {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 2px 0 14px;
  padding: 4px 2px;
  width: fit-content;
  background: none;
}

.rachel-typing.is-active {
  display: flex;
}

.rachel-typing-avatar {
  width: 22px;
  height: 22px;
  min-width: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f4d9c7, #c79874);
  background-size: cover;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #111;
  font-size: 10px;
  font-weight: 800;
}

.rachel-typing-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rachel-typing-avatar.has-image .rachel-avatar-fallback {
  visibility: hidden;
}

/* Tidio-style "[name] is typing..." with a soft shimmer sweeping the text */
.rachel-typing-label {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.2px;
  white-space: nowrap;
  background: linear-gradient(100deg, #6b7280 0%, #6b7280 40%, #cbd2db 50%, #6b7280 60%, #6b7280 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rachelTypingShimmer 2s linear infinite;
}

@keyframes rachelTypingShimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rachel-typing-label {
    animation: none;
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
  }
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .rachel-typing-label {
    background: none;
    color: #6b7280;
    -webkit-text-fill-color: #6b7280;
    animation: none;
  }
}

.rachel-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rachel-menu-panel {
  display: grid;
  gap: var(--space-2);
  width: min(100%, 340px);
  margin: 0 0 var(--space-3);
  padding: var(--space-2);
  border: 1px solid var(--rachel-hairline);
  border-radius: var(--r-lg);
  background: var(--rachel-white);
  box-shadow: var(--rachel-shadow-lg);
}

.rachel-menu-panel strong {
  font-size: var(--rachel-fs-sm);
  line-height: var(--rachel-lh-sm);
  font-weight: var(--rachel-fw-semibold);
}

.rachel-menu-back,
.rachel-menu-options button {
  width: 100%;
  border: 1px solid var(--rachel-border);
  border-color: var(--rachel-hairline);
  border-radius: var(--r-md);
  background: #ffffff;
  color: var(--rachel-ink-900);
  cursor: pointer;
  padding: var(--space-3);
  font-size: var(--rachel-fs-sm);
  font-weight: var(--rachel-fw-medium);
  text-align: left;
}

.rachel-menu-back {
  width: fit-content;
  background: transparent;
}

.rachel-menu-options {
  display: grid;
  gap: var(--space-2);
}

/* Full-panel menu / home overlay view (replaces the inline menu bubble) */
.rachel-menu-view {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: inherit;
  overflow: hidden;
  animation: rachelPanelIn 0.16s ease-out both;
}

.rachel-menu-view[hidden] {
  display: none;
}

.rachel-menu-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.rachel-menu-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 9px;
  transition: background 0.16s ease, color 0.16s ease;
}

.rachel-menu-back-btn:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #17264a;
}

.rachel-menu-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 18px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

.rachel-menu-greeting {
  text-align: center;
  margin-bottom: 20px;
}

.rachel-menu-avatar {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #f4d9c7, #c79874);
  display: grid;
  place-items: center;
}

.rachel-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rachel-menu-hello {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 850;
  color: #101828;
  line-height: 1.2;
}

.rachel-menu-sub {
  margin: 0;
  font-size: 13px;
  color: #667085;
}

.rachel-menu-questions {
  display: grid;
  gap: 9px;
}

.rachel-menu-questions button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  color: #101828;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.rachel-menu-questions button:hover {
  border-color: rgba(15, 23, 42, 0.16);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.rachel-menu-questions button:active {
  transform: translateY(0);
}

.rachel-menu-q-label {
  flex: 1 1 auto;
  min-width: 0;
}

.rachel-menu-q-arrow {
  flex: 0 0 auto;
  color: #98a2b3;
  display: grid;
  place-items: center;
}

/* Connecting state: a real specialist visibly "preparing", not a spinner (Avatar-Presence). */
.rachel-connecting {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  width: fit-content;
  max-width: 88%;
  margin: 6px auto 16px;
  padding: 18px 24px 15px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  background: #ffffff;
  color: #475467;
  text-align: center;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.rachel-connecting.is-active {
  display: flex;
  animation: rachelConnectIn 0.4s ease both;
}

.rachel-connecting.is-exiting {
  animation: rachelConnectOut 0.36s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.rachel-connecting-avatar-zone {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
}

.rachel-connecting-halo {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rachel-launcher-bg, #17264a) 0%, transparent 66%);
  animation: rachelConnectHalo 4.5s ease-in-out infinite;
  z-index: 0;
}

.rachel-connecting-avatar {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #f4d9c7, #c79874);
  display: grid;
  place-items: center;
  color: #111;
  font-weight: 800;
  box-shadow: 0 0 0 3px #fff, 0 6px 16px rgba(15, 23, 42, 0.16);
  animation: rachelConnectBreathe 4.5s ease-in-out infinite;
}

.rachel-connecting-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rachel-connecting-avatar .rachel-avatar-fallback {
  position: relative;
  z-index: 1;
  font-size: 18px;
}

.rachel-connecting-avatar.has-image .rachel-avatar-fallback {
  visibility: hidden;
}

.rachel-connecting-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.rachel-connecting-name {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
  opacity: 0;
  animation: rachelConnectName 0.45s ease forwards;
  animation-delay: 1.8s;
}

.rachel-connecting-name[hidden] {
  display: none;
}

.rachel-connecting-status {
  font-size: 12.5px;
  color: #6b7280;
  line-height: 1.3;
  min-height: 16px;
  transition: opacity 0.22s ease;
}

.rachel-connecting-status.is-fading {
  opacity: 0;
}

/* Gentle shimmer sweep so the wait reads as live, not stalled */
.rachel-connecting-estimate {
  font-size: 11px;
  line-height: 1.25;
  background: linear-gradient(100deg, #9ca3af 0%, #9ca3af 42%, #cbd2db 50%, #9ca3af 58%, #9ca3af 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: rachelConnectEstimateShimmer 3s linear infinite;
}

@keyframes rachelConnectEstimateShimmer {
  0% { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .rachel-connecting-estimate {
    background: none;
    color: #9ca3af;
    -webkit-text-fill-color: #9ca3af;
    animation: none;
  }
}

.rachel-connecting-estimate[hidden] {
  display: none;
}

.rachel-chat-avatar.is-entering {
  animation: rachelAvatarEnter 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rachelConnectBreathe {
  0%, 100% { transform: scale(0.97); }
  50% { transform: scale(1.03); }
}

@keyframes rachelConnectHalo {
  0%, 100% { opacity: 0.14; transform: scale(0.9); }
  50% { opacity: 0.34; transform: scale(1.06); }
}

@keyframes rachelConnectName {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rachelConnectIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rachelConnectOut {
  to { opacity: 0; transform: translateY(-10px) scale(0.94); }
}

@keyframes rachelAvatarEnter {
  from { opacity: 0; transform: translateX(10px) scale(0.82); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rachel-connecting.is-active,
  .rachel-connecting.is-exiting,
  .rachel-connecting-avatar,
  .rachel-connecting-halo,
  .rachel-connecting-name,
  .rachel-connecting-estimate,
  .rachel-chat-avatar.is-entering {
    animation: none;
  }
  .rachel-connecting-name { opacity: 1; }
  .rachel-connecting-halo { opacity: 0.28; }
  .rachel-connecting-estimate { color: #9ca3af; -webkit-text-fill-color: #9ca3af; }
}

/* Typing motion is the text-ellipsis wave defined on .rachel-typing-ell above */

@keyframes rachelConnectSpin {
  to { transform: rotate(360deg); }
}

@keyframes rachelPanelIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.rachel-chat-form {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--rachel-panel-bg);
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
}

.rachel-prechat {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
}

.rachel-prechat[hidden] {
  display: none;
}

.rachel-prechat strong {
  font-size: var(--rachel-fs-sm);
  line-height: var(--rachel-lh-sm);
  font-weight: var(--rachel-fw-semibold);
}

.rachel-prechat input {
  min-height: 44px;
  border: 1px solid rgba(15, 23, 42, 0.13);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: var(--rachel-fs-sm);
}

.rachel-prechat input[hidden] {
  display: none;
}

.rachel-prechat button {
  min-height: 44px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--rachel-launcher-bg);
  color: var(--rachel-launcher-color);
  cursor: pointer;
  font-weight: var(--rachel-fw-semibold);
}

.rachel-drop-overlay {
  position: absolute;
  inset: 84px 14px 92px;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: var(--space-1);
  border: 2px dashed rgba(17, 17, 17, 0.28);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  text-align: center;
  pointer-events: none;
}

.rachel-drop-overlay[hidden] {
  display: none;
}

.rachel-drop-overlay strong {
  font-size: var(--rachel-fs-lg);
  font-weight: var(--rachel-fw-semibold);
}

.rachel-drop-overlay span {
  color: var(--rachel-ink-500);
  font-size: var(--rachel-fs-xs);
  font-weight: var(--rachel-fw-medium);
}

.rachel-attachment-tray {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.rachel-attachment-tray[hidden] {
  display: none;
}

.rachel-emoji-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 9px;
  margin-bottom: 4px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14);
  max-height: 196px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.2) transparent;
}

.rachel-emoji-picker[hidden] {
  display: none;
}

.rachel-emoji-picker button {
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  display: grid;
  place-items: center;
  transition: transform 0.14s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.14s ease;
}

.rachel-emoji-picker button:hover {
  transform: scale(1.28);
  background: #f3f4f6;
}

.rachel-emoji-picker button:active {
  transform: scale(1.06);
}

.rachel-attachment-chip {
  max-width: 100%;
  min-width: 0;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: var(--r-pill);
  background: #f7f7f7;
  color: var(--rachel-ink-900);
  font-size: var(--rachel-fs-xs);
}

.rachel-attachment-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.rachel-attachment-chip span:not(.rachel-video-chip) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rachel-attachment-chip button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  color: var(--rachel-ink-500);
  font-size: 16px;
  line-height: 1;
}

.rachel-video-chip {
  width: 28px;
  height: 20px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  background: #111;
  color: #fff;
  font-size: 9px;
  font-weight: var(--rachel-fw-semibold);
}

.rachel-emoji,
.rachel-attach {
  width: 40px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--rachel-ink-500);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.rachel-emoji:hover,
.rachel-attach:hover {
  color: var(--rachel-launcher-bg);
  transform: translateY(-1px);
}

/* No ugly oval ring on mouse click; clean ring only for keyboard users */
.rachel-emoji:focus,
.rachel-attach:focus,
.rachel-chat-send:focus {
  outline: none;
}

.rachel-emoji:focus-visible,
.rachel-attach:focus-visible,
.rachel-chat-send:focus-visible {
  outline: 2px solid rgba(23, 38, 74, 0.3);
  outline-offset: 2px;
}

.rachel-attach[hidden] {
  display: none;
}

.rachel-chat-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 46px;
  min-height: 46px;
  max-height: 124px;
  border: 0;
  border-radius: 0;
  padding: 12px 8px;
  resize: none;
  font-size: var(--rachel-fs-base);
  line-height: 1.35;
  outline: none;
  overflow-y: auto;
  vertical-align: top;
  color: var(--rachel-black);
  background: transparent;
}

.rachel-chat-input::placeholder {
  color: var(--rachel-ink-500);
  opacity: 1;
}

.rachel-chat-input:focus,
.rachel-chat-input:focus-visible {
  outline: none;
  border: 0;
  box-shadow: none;
}

.rachel-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--rachel-accent);
  color: var(--rachel-on-accent);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--rachel-shadow-sm);
}

.rachel-chat-send,
.rachel-emoji,
.rachel-attach,
.rachel-prechat button,
.rachel-menu-back,
.rachel-menu-options button,
.rachel-emoji-picker button {
  transition: transform var(--rachel-dur-fast) var(--rachel-ease), box-shadow var(--rachel-dur-fast) var(--rachel-ease), border-color var(--rachel-dur-fast) var(--rachel-ease), background var(--rachel-dur-fast) var(--rachel-ease);
}

.rachel-prechat button:hover,
.rachel-menu-options button:hover,
.rachel-emoji-picker button:hover {
  transform: translateY(-1px);
  box-shadow: var(--rachel-shadow-md);
}

.rachel-chat-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: var(--rachel-shadow-md);
}

.rachel-chat-send:active,
.rachel-emoji:active,
.rachel-attach:active,
.rachel-prechat button:active,
.rachel-menu-back:active,
.rachel-menu-options button:active,
.rachel-emoji-picker button:active {
  transform: translateY(0) scale(0.96);
}

.rachel-chat-send:disabled {
  opacity: 0.45;
  cursor: wait;
}

.rachel-chat-form.is-disabled .rachel-chat-input {
  color: var(--rachel-ink-300);
  background: transparent;
}

.rachel-chat-form.is-disabled .rachel-chat-send {
  cursor: wait;
}

.rachel-chat-form.is-disabled .rachel-attach {
  cursor: wait;
  opacity: 0.5;
}

.rachel-message-attachments {
  margin-top: var(--space-2);
  display: grid;
  gap: var(--space-2);
}

.rachel-message-attachment {
  font-size: var(--rachel-fs-xs);
  color: inherit;
  opacity: 0.8;
}

.rachel-message-attachment img {
  display: block;
  width: min(180px, 100%);
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--r-sm);
}

@media (max-width: 600px) {
  .rachel-chat-root {
    right: 16px;
    left: auto;
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .rachel-chat-root[data-position="bottom-left"] {
    right: auto;
    left: 16px;
  }

  .rachel-chat-panel {
    position: fixed;
    inset: 0;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }

  .rachel-chat-root[data-position="bottom-left"] .rachel-chat-panel {
    right: 0;
    left: 0;
  }

  .rachel-chat-root.is-open .rachel-chat-panel {
    bottom: 0;
  }

  .rachel-chat-header {
    padding: var(--space-4) var(--space-4) var(--space-3);
    gap: var(--space-2);
  }

  .rachel-chat-name {
    font-size: var(--rachel-fs-base);
  }

  .rachel-chat-status {
    font-size: var(--rachel-fs-xs);
  }

  .rachel-chat-messages {
    padding: var(--space-4);
  }

  .rachel-message {
    max-width: 80%;
    font-size: var(--rachel-fs-base);
  }

  .rachel-team-stack {
    display: none;
  }

  .rachel-call-cta {
    grid-template-columns: auto 1fr;
  }

  .rachel-call-number {
    display: none;
  }
}

/* --- motion + focus + reduced-motion (audit additions) --- */
@keyframes rachelPanelOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(0.985); }
}

@keyframes rachelMsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Keyboard a11y outline for controls, but never a frame on the composer input
   (its caret is the focus cue) — and no :focus-within frame on the form. */
.rachel-chat-root :focus-visible:not(.rachel-chat-input) {
  outline: 2px solid var(--rachel-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .rachel-chat-root *,
  .rachel-chat-root *::before,
  .rachel-chat-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .rachel-connecting-signal {
    animation: none !important;
    border-top-color: currentColor;
  }
}
