/* =============================================================================
   Build My Scent — AI assistant chat UI (t254u)
   Build-ready reference CSS. Prefix: bms-chat-
   Reuses theme tokens from theme.json / theme.css when present, with hex
   fallbacks so this file also works in the static prototype.

   BMS-DESIGN-SPRINT P6 2026-11-23: legacy bronze #BE956E retired.
   Gold #E2B26A / UI gold #F5AF49 on Midnight (7.66:1 / 7.87:1).
   Gold-deep #9C6009 on Ivory (4.56:1) / Card (4.85:1) for text, rules and chip borders.
   Light gold is NEVER used as text on Ivory/Card/White (1.72:1, fail).
   ============================================================================= */

/* When this file is loaded inside the WP theme (after theme.css), the :root
   --m/--iv/--br/--brd/--ink/--focus/--card/--mute-d/--mute-l/--serif/--sans/--r
   values already exist. The fallbacks below match theme.json exactly. */
.bms-chat,
.bms-chat-launcher {
  --m: var(--wp--preset--color--midnight, #1B2933);
  --iv: var(--wp--preset--color--ivory, #F5F1E9);
  --br: #E2B26A;                 /* gold on midnight (was bronze #BE956E) */
  --brd: #9C6009;                /* gold-deep text on ivory 4.56:1 (was #7A5530) */
  --ink: var(--wp--preset--color--ink, #17212A);
  --focus: var(--wp--preset--color--focus, #1F6E8A);
  --card: var(--wp--preset--color--card, #FBF9F4);
  --mute-d: var(--wp--preset--color--muted-dark, #C9CED3);
  --mute-l: var(--wp--preset--color--muted-light, #4A5560);
  --serif: var(--wp--preset--font-family--serif, "Cormorant Garamond", "Iowan Old Style", Georgia, serif);
  --sans: var(--wp--preset--font-family--sans, Jost, "Helvetica Neue", Arial, sans-serif);
  --r: 4px;

  /* Chat-only tokens */
  --br-hover: #F5AF49;           /* UI gold hover on midnight (was #CDA884) */
  --br-on-ivory: #9C6009;        /* gold-deep on light grounds, 4.56:1 (was #8E6640) */
  --br-active-shift: 1px;        /* press feedback; color stays --br or --br-hover to keep 4.5:1 */
  --input-border: #6B7580;       /* form.css */
  --input-fill: #fff;
  --draft-bg: #FFF4D6;           /* theme .bms-draft-notice */
  --footer-dark: #141F27;        /* theme footer / launcher active */
  --hover-mid: #223442;          /* theme .bms-media mid; launcher hover */
  --chat-z: 180;                 /* above header 100 and nav sheet 150; below skip-link 200 */
  --chat-panel-width: 24.5rem;   /* 392px */
  --chat-panel-max-h: min(46rem, calc(100dvh - 6.5rem)); /* 736px, or viewport minus header+gaps */
  --chat-offset-d: 1.5rem;       /* 24px desktop */
  --chat-offset-m: 1rem;         /* 16px mobile */
  /* Reserved space so a future sticky mobile CTA bar does not sit under the launcher.
     Default 0: the current theme has no sticky bottom bar (only a 64px sticky header). */
  --bms-chat-clearance-bottom: 0px;
  --bms-chat-clearance-right: 0px;
  --chat-header-h: 3.5rem;       /* 56px */
  --chat-shadow: 0 12px 40px rgba(23, 33, 42, 0.28);
  --chat-shadow-sm: 0 4px 16px rgba(23, 33, 42, 0.25);
  --move: 200ms ease;
  --move-out: 150ms ease;
  --hover-t: 150ms ease;
}

/* Reduced motion: match theme.css (no animation or transition). */
@media (prefers-reduced-motion: reduce) {
  .bms-chat *,
  .bms-chat-launcher,
  .bms-chat-launcher * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Shared focus (mirrors theme.css and form.css) ---------- */
/* Light surfaces: 3px solid #1F6E8A. Dark surfaces: 3px solid gold #E2B26A.
   Form-status pattern: 3px solid gold, offset 2px, scroll-margin-top 96px. */
.bms-chat-launcher:focus-visible,
.bms-chat-iconbtn:focus-visible,
.bms-chat-composer__send:focus-visible {
  outline: 3px solid var(--br);
  outline-offset: 3px;
}
.bms-chat-chip:focus-visible,
.bms-chat-body a:focus-visible,
.bms-chat-form :focus-visible,
.bms-chat-composer__input:focus-visible,
.bms-chat-retry:focus-visible,
.bms-chat-held a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.bms-chat-form input:focus-visible,
.bms-chat-form select:focus-visible,
.bms-chat-form textarea:focus-visible,
.bms-chat-composer__input:focus-visible {
  outline-offset: 2px; /* form.css */
}
.bms-chat-status:focus {
  outline: 3px solid var(--br);
  outline-offset: 2px;
}
.bms-chat-status {
  scroll-margin-top: 96px;
}

/* ---------- Launcher ---------- */
.bms-chat-launcher {
  position: fixed;
  z-index: var(--chat-z);
  right: max(var(--chat-offset-d), env(safe-area-inset-right, 0px), var(--bms-chat-clearance-right));
  bottom: max(var(--chat-offset-d), calc(env(safe-area-inset-bottom, 0px) + 0.5rem), var(--bms-chat-clearance-bottom));
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  min-width: 48px;
  padding: 4px 1rem 4px 4px;
  background: var(--m);
  color: var(--iv);
  border: 1px solid var(--br);
  border-radius: 999px;
  box-shadow: var(--chat-shadow-sm);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--hover-t), border-color var(--hover-t), transform var(--hover-t), padding var(--move), gap var(--move);
}
@media (max-width: 599px) {
  .bms-chat-launcher {
    right: max(var(--chat-offset-m), env(safe-area-inset-right, 0px), var(--bms-chat-clearance-right));
    bottom: max(var(--chat-offset-m), calc(env(safe-area-inset-bottom, 0px) + 0.5rem), var(--bms-chat-clearance-bottom));
  }
}
.bms-chat-launcher__icon {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%; /* BMS-CONCIERGE-ICON-1: clip the wave-E to a circle inside the 4px gold-ring padding */
  overflow: hidden;
}
.bms-chat-launcher__icon img,
.bms-chat-launcher__icon svg {
  display: block;
  width: 40px;
  height: 40px;
}
.bms-chat-launcher__label {
  white-space: nowrap;
  padding-right: 0.25rem;
  color: var(--iv);
}
/* Visible label: full string on desktop. At <=599px use the approved short form
   "Ask our AI assistant" so the pill stays one line and has a better chance
   of sitting beside a consultation CTA. The button's aria-label stays the
   full "Questions? Ask our AI assistant" at every width. If the short pill
   still intersects a CTA, JS collapses to the 48x48 icon-only control. */
.bms-chat-launcher__label-short { display: none; }
@media (max-width: 599px) {
  .bms-chat-launcher__label-full { display: none; }
  .bms-chat-launcher__label-short { display: inline; }
}
.bms-chat-launcher:hover,
.bms-chat-launcher[data-demo-hover] {
  background: var(--hover-mid);
  border-color: rgba(226, 178, 106, 0.8);
}
.bms-chat-launcher:active {
  background: var(--footer-dark);
  transform: translateY(1px);
}
.bms-chat-launcher:disabled,
.bms-chat-launcher[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
/* Icon-only pill (after 80px scroll, or when a primary CTA intersects the reserved corner). */
.bms-chat-launcher.is-collapsed {
  padding: 4px;
  gap: 0;
}
.bms-chat-launcher.is-collapsed .bms-chat-launcher__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* Hide the launcher while the panel is open (JS adds .is-hidden), and while the
   mobile nav sheet is open so it cannot sit on top of the menu. The :has rule is
   a safety net; the theme should also toggle .is-hidden from nav.js. */
.bms-chat-launcher.is-hidden,
html.bms-nav-locked .bms-chat-launcher,
body:has(.bms-nav.is-open) .bms-chat-launcher {
  display: none;
}

/* ---------- Root / panel ---------- */
.bms-chat {
  position: fixed;
  z-index: var(--chat-z);
  right: max(var(--chat-offset-d), env(safe-area-inset-right, 0px));
  bottom: max(var(--chat-offset-d), calc(env(safe-area-inset-bottom, 0px) + 0.5rem));
  width: var(--chat-panel-width);
  max-width: calc(100vw - 2 * var(--chat-offset-d));
  height: var(--chat-panel-max-h);
  max-height: var(--chat-panel-max-h);
  display: flex;
  flex-direction: column;
  background: var(--iv);
  color: var(--ink);
  border: 1px solid var(--br-on-ivory);
  border-radius: 6px; /* theme card radius */
  box-shadow: var(--chat-shadow);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: lining-nums;
  overflow: hidden;
  /* Enter */
  transform-origin: 100% 100%;
  animation: bms-chat-in var(--move) ease-out;
}
@media (max-width: 599px) {
  .bms-chat {
    inset: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-width: none;
    max-height: none;
    height: 100dvh;
    height: 100svh;
    border-radius: 0;
    border: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform-origin: 50% 100%;
  }
}
@keyframes bms-chat-in {
  from { opacity: 0; transform: translateY(0.6rem) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.bms-chat[hidden],
.bms-chat.is-closed {
  display: none;
}

/* ---------- Header (Midnight, like .bms-header) ---------- */
.bms-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex: 0 0 auto;
  min-height: var(--chat-header-h);
  padding: 0 0.35rem 0 0.85rem;
  background: var(--m);
  color: var(--iv);
  border-bottom: 1px solid rgba(226, 178, 106, 0.3); /* decorative, same as site header */
}
.bms-chat-panel__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  min-height: 44px;
  color: var(--iv);
  text-decoration: none;
}
.bms-chat-panel__mark {
  display: block;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%; /* BMS-CONCIERGE-ICON-1: circular mark, same treatment as the launcher icon */
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(226, 178, 106, 0.7);
}
.bms-chat-panel__mark img,
.bms-chat-panel__mark svg {
  display: block;
  width: 28px;
  height: 28px;
}
.bms-chat-panel__title {
  margin: 0;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--iv);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bms-chat-panel__actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}
.bms-chat-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--iv);
  border: 0;
  border-radius: var(--r);
  cursor: pointer;
}
.bms-chat-iconbtn:hover {
  color: var(--br);
  background: rgba(226, 178, 106, 0.14); /* header CTA hover fill */
}
.bms-chat-iconbtn:active {
  background: rgba(226, 178, 106, 0.22);
}
.bms-chat-iconbtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.bms-chat-iconbtn svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* ---------- Body / transcript ---------- */
.bms-chat-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--iv);
}
.bms-chat-transcript {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.bms-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  min-width: 0;
}
.bms-chat-msg--assistant { align-self: flex-start; }
.bms-chat-msg--user      { align-self: flex-end; align-items: flex-end; }
.bms-chat-msg__bubble {
  margin: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  text-wrap: pretty;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.bms-chat-msg--assistant .bms-chat-msg__bubble {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--br-on-ivory);
}
.bms-chat-msg--user .bms-chat-msg__bubble {
  background: var(--m);
  color: var(--iv);
  border: 1px solid var(--m);
}
.bms-chat-msg__bubble p { margin: 0 0 0.6em; }
.bms-chat-msg__bubble p:last-child { margin-bottom: 0; }
.bms-chat-msg__bubble ul,
.bms-chat-msg__bubble ol { margin: 0 0 0.6em; padding-left: 1.25em; }
.bms-chat-msg__bubble ul:last-child,
.bms-chat-msg__bubble ol:last-child { margin-bottom: 0; }
.bms-chat-msg__bubble li + li { margin-top: 0.25em; }
.bms-chat-msg--assistant .bms-chat-msg__bubble li::marker { color: var(--brd, #9C6009); }
.bms-chat-msg--user .bms-chat-msg__bubble li::marker { color: inherit; }
.bms-chat-msg--assistant .bms-chat-msg__bubble a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--brd);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
.bms-chat-msg--assistant .bms-chat-msg__bubble a:hover {
  text-decoration-thickness: 2px;
}
.bms-chat-msg--user .bms-chat-msg__bubble a {
  color: var(--iv);
  text-decoration-color: var(--br);
  text-underline-offset: 0.2em;
}
.bms-chat-msg__meta {
  margin: 0.25rem 0.15rem 0;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--mute-l);
  letter-spacing: 0.02em;
}

/* ---------- Quick-reply chips ---------- */
.bms-chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.15rem 0 0.25rem;
  padding: 0;
  border: 0;
}
.bms-chat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  background: var(--iv);
  color: var(--m);
  border: 1px solid var(--br-on-ivory);
  border-radius: var(--r);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
  text-wrap: pretty;
  transition: background var(--hover-t), border-color var(--hover-t), color var(--hover-t);
}
.bms-chat-chip:hover {
  background: #F7EEDF; /* ivory tinted toward gold, still light */
  border-color: var(--brd);
}
.bms-chat-chip:active {
  transform: translateY(var(--br-active-shift));
}
.bms-chat-chip.is-selected,
.bms-chat-chip[aria-pressed="true"] {
  background: var(--m);
  color: var(--iv);
  border-color: var(--m);
}
.bms-chat-chip.is-selected:hover,
.bms-chat-chip[aria-pressed="true"]:hover {
  background: var(--hover-mid);
  border-color: var(--hover-mid);
  color: var(--iv);
}
.bms-chat-chip[aria-disabled="true"],
.bms-chat-chip:disabled {
  cursor: not-allowed;
  transform: none;
  background: var(--iv);
  color: var(--mute-l); /* 6.76:1, not 45% midnight (2.62:1 fail) */
  border-color: color-mix(in srgb, var(--br-on-ivory) 70%, var(--iv));
  /* color-mix fallback if unsupported: keep --br-on-ivory (still 4.52:1). */
}
.bms-chat-chip.is-selected[aria-disabled="true"],
.bms-chat-chip.is-selected:disabled,
.bms-chat-chip[aria-pressed="true"][aria-disabled="true"] {
  background: var(--m);
  color: var(--iv);
  border-color: var(--m);
  opacity: 1;
}

/* ---------- Composer ---------- */
.bms-chat-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: var(--iv);
  border-top: 1px solid var(--br-on-ivory);
}
.bms-chat-composer__input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  max-height: 8rem;
  resize: none;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--input-fill);
  border: 1px solid var(--input-border);
  border-radius: var(--r);
}
.bms-chat-composer__input::placeholder { color: var(--mute-l); }
.bms-chat-composer__send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0 0.85rem;
  background: var(--br);
  color: var(--m);
  border: 1px solid var(--br);
  border-radius: var(--r);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.bms-chat-composer__send:hover { background: var(--br-hover); border-color: var(--br-hover); }
.bms-chat-composer__send:active { transform: translateY(1px); }
.bms-chat-composer__send:disabled {
  cursor: not-allowed;
  background: var(--card);
  color: var(--mute-l);
  border-color: var(--input-border);
  transform: none;
}
.bms-chat-composer__send svg { display: block; width: 18px; height: 18px; }

/* ---------- Capture form (mirrors mu-plugin form.css) ---------- */
.bms-chat-card {
  background: var(--card);
  border: 1px solid var(--br-on-ivory);
  border-radius: 6px;
  padding: 0.9rem 1rem 1rem;
}
.bms-chat-card__title {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: lining-nums;
  text-wrap: balance;
}
.bms-chat-card__lede {
  margin: 0 0 0.7rem;
  color: var(--mute-l);
  font-size: 0.95rem;
}
.bms-chat-form { display: grid; gap: 0.65rem; }
.bms-chat-field { display: flex; flex-direction: column; gap: 0.3rem; }
.bms-chat-field label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
}
.bms-chat-req, .bms-chat-opt {
  font-weight: 400;
  color: var(--mute-l);
  font-size: 0.85em;
}
.bms-chat-hint { margin: 0; font-size: 0.85rem; color: var(--mute-l); }
.bms-chat-form input[type="text"],
.bms-chat-form input[type="email"],
.bms-chat-form input[type="tel"],
.bms-chat-form input[type="date"],
.bms-chat-form select,
.bms-chat-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--input-fill);
  border: 1px solid var(--input-border);
  border-radius: var(--r);
}
.bms-chat-form input[aria-invalid="true"],
.bms-chat-form select[aria-invalid="true"],
.bms-chat-form textarea[aria-invalid="true"] {
  border-color: var(--brd);
  border-width: 2px;
  box-shadow: inset 3px 0 0 var(--brd);
}
.bms-chat-field-error {
  color: var(--brd);
  font-size: 0.88rem;
  margin: 0;
  font-weight: 600;
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
}
.bms-chat-field-error::before {
  content: "!";
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: var(--m);
  color: var(--iv);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.bms-chat-consent label {
  display: flex;
  flex-direction: row;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
  font-size: 0.95rem;
}
.bms-chat-consent input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.2rem;
  accent-color: var(--m);
  flex: 0 0 auto;
}
.bms-chat-date-unset {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 44px;
  font-weight: 400;
  font-size: 0.95rem;
}
.bms-chat-date-unset input {
  width: 20px;
  height: 20px;
  accent-color: var(--m);
  flex: 0 0 auto;
}
.bms-chat-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.95rem 1.5rem;
  background: var(--br);
  color: var(--m);
  border: 1px solid var(--br);
  border-radius: var(--r);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.bms-chat-submit:hover { background: var(--br-hover); border-color: var(--br-hover); }
.bms-chat-submit:active { transform: translateY(1px); }
.bms-chat-submit:disabled {
  cursor: not-allowed;
  background: var(--card);
  color: var(--mute-l);
  border-color: var(--input-border);
  transform: none;
}
.bms-chat-form-errors {
  border: 1px solid var(--br);
  border-left: 5px solid var(--m);
  background: var(--card);
  padding: 1rem 1.2rem;
  border-radius: var(--r);
  color: var(--m);
}
.bms-chat-form-errors > p:first-child { font-weight: 600; margin: 0 0 0.4rem; }
.bms-chat-form-errors ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.bms-chat-form-errors a { color: var(--brd); font-weight: 600; text-decoration: underline; }

/* Held (form off until CEO approves activation) */
.bms-chat-held {
  background: var(--draft-bg);
  border: 1px solid var(--brd);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
}
.bms-chat-held h3 {
  margin: 0 0 0.45rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: lining-nums;
  text-wrap: balance;
}
.bms-chat-held p { margin: 0 0 0.7em; color: var(--ink); }
.bms-chat-held p:last-child { margin-bottom: 0; }
.bms-chat-held a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--brd);
  text-underline-offset: 0.2em;
}

/* Handoff + summary */
.bms-chat-handoff,
.bms-chat-summary {
  background: var(--card);
  border: 1px solid var(--br-on-ivory);
  border-radius: 6px;
  padding: 1rem 1.1rem;
}
.bms-chat-handoff h3,
.bms-chat-summary h3 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: lining-nums;
  text-wrap: balance;
}
.bms-chat-handoff p,
.bms-chat-summary p { margin: 0 0 0.6em; }
.bms-chat-handoff p:last-child,
.bms-chat-summary p:last-child { margin-bottom: 0; }
.bms-chat-summary dl {
  margin: 0.6rem 0 0;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.95rem;
}
.bms-chat-summary dt {
  font-weight: 500;
  color: var(--mute-l);
  margin: 0;
}
.bms-chat-summary dd {
  margin: 0;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 599px) {
  .bms-chat-summary dl { grid-template-columns: 1fr; gap: 0.1rem; }
  .bms-chat-summary dt { margin-top: 0.45rem; }
  .bms-chat-summary dt:first-child { margin-top: 0; }
}

/* Typing indicator */
.bms-chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 1.2rem;
}
.bms-chat-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--br-on-ivory); /* gold-deep 4.56:1 on ivory */
  animation: bms-chat-dot 1.2s ease-in-out infinite;
}
.bms-chat-typing__dot:nth-child(2) { animation-delay: 0.2s; }
.bms-chat-typing__dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bms-chat-dot {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.bms-chat-typing__label { /* reduced-motion / SR fallback text */
  font-size: 0.95rem;
  color: var(--mute-l);
}
.bms-chat-typing__label[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .bms-chat-typing__dot { display: none; }
  .bms-chat-typing__label[hidden] { display: inline; }
}

/* Skeleton */
.bms-chat-skeleton { display: grid; gap: 0.55rem; width: 16rem; max-width: 100%; min-width: 10rem; }
.bms-chat-msg:has(.bms-chat-skeleton) { width: 85%; max-width: 85%; }
.bms-chat-skeleton__line {
  height: 0.7rem;
  border-radius: 4px;
  background: #CECDC8; /* midnight 18% on ivory, decorative */
  animation: bms-chat-pulse 1.4s ease-in-out infinite;
}
.bms-chat-skeleton__line:nth-child(1) { width: 100%; }
.bms-chat-skeleton__line:nth-child(2) { width: 86%; }
.bms-chat-skeleton__line:nth-child(3) { width: 62%; }
@keyframes bms-chat-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Error / offline */
.bms-chat-error {
  border: 1px solid var(--br);
  border-left: 5px solid var(--m);
  background: var(--card);
  color: var(--m);
  border-radius: var(--r);
  padding: 1rem 1.1rem;
}
.bms-chat-error h3 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: lining-nums;
}
.bms-chat-error p { margin: 0 0 0.8rem; }
.bms-chat-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--m);
  border: 1px solid var(--br-on-ivory);
  border-radius: var(--r);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.bms-chat-retry:hover { background: #F7EEDF; border-color: var(--brd); }

/* Live region (visually hidden, same pattern as .screen-reader-text) */
.bms-chat-live,
.bms-chat .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 200% zoom / narrow overflow safety */
.bms-chat-panel__header,
.bms-chat-composer { min-width: 0; }
.bms-chat-chip { max-width: 100%; }

/* Hide the composer when a capture, held, or terminal card is the primary action.
   The UI script toggles .is-composer-off on .bms-chat. */
.bms-chat.is-composer-off .bms-chat-composer { display: none; }

/* Offer chips ("Yes, I'd like a follow-up" / "No thanks") sit on one row
   at 360 and 390 (measured 265px including gap, 328px available at 360).
   Below that (or at 200% zoom) they stack as full-width 44px targets. */
@media (max-width: 320px) {
  .bms-chat-chips--offer .bms-chat-chip {
    flex: 1 1 100%;
  }
}

.bms-chat-consent-q {
  margin: 0.8rem 0 0.5rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink);
}

/* BMS-SITE-COMPLETE-1 SC-09: at 390/360 the labeled "AI scent concierge" pill
   covers body text while scrolling. CSS only: use the existing 48x48 icon-only
   treatment on narrow screens, and add footer clearance so the last lines are
   not hidden behind it. */
@media (max-width: 400px) {
  .bms-chat-launcher {
    padding: 4px;
    gap: 0;
  }
  .bms-chat-launcher .bms-chat-launcher__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  body:has(.bms-chat-launcher) .bms-footer {
    padding-bottom: calc(2rem + 4.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* BMS-SITE-BUTTONUP-1 BU-11: reserve space at the bottom of every page so the
   fixed launcher does not cover the last footer/content lines while scrolling.
   Live SC-09 already icon-only-collapses the pill at max-width 400px and padded
   .bms-footer only at that breakpoint. Home and mood pages use .bh26 .ftr, not
   .bms-footer, so they had no clearance. This rule applies at all widths.
   Connect Now is not changed. Mid-page overlap of a fixed pill can still occur
   while scrolling; visitors can now scroll the covered block clear of the pill. */
body:has(.bms-chat-launcher) .bms-footer,
body:has(.bms-chat-launcher) .bh26 .ftr {
  padding-bottom: calc(2rem + 5.5rem + env(safe-area-inset-bottom, 0px));
}
html:has(.bms-chat-launcher) {
  scroll-padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

/* =============================================================================
   BMS-DESIGN-SPRINT P6 2026-11-23: AI scent concierge panel restyle per MAX
   REVIEW.md ("Chat panel and Connect Now UI"): button fill midnight #1B2933 with
   gold-deep #9C6009 on ivory; chips with gold-deep borders. CSS only; markup, JS,
   content and the public name "AI scent concierge" are unchanged.
   ============================================================================= */
.bms-chat-panel { border-color: var(--br-on-ivory); }
.bms-chat-panel__header { border-bottom: 2px solid var(--br); } /* gold hairline under the midnight header */
.bms-chat-composer__send,
.bms-chat-submit {
  background: var(--m);
  color: var(--br);                       /* gold on midnight 7.66:1 */
  border: 1px solid var(--br-on-ivory);   /* gold-deep edge against ivory */
}
.bms-chat-composer__send:hover,
.bms-chat-submit:hover {
  background: var(--hover-mid);
  color: var(--br-hover);                 /* #F5AF49 on #223442 */
  border-color: var(--br-on-ivory);
}
.bms-chat-composer__send:disabled,
.bms-chat-submit:disabled {
  background: var(--card);
  color: var(--mute-l);
  border-color: var(--input-border);
}
.bms-chat-chip { border-color: var(--br-on-ivory); }
.bms-chat-chip:hover { border-color: var(--m); }
.bms-chat-form-errors,
.bms-chat-error { border-color: var(--br-on-ivory); border-left-color: var(--m); }
.bms-chat-launcher { border-color: var(--br); }
.bms-chat-launcher:hover { border-color: var(--br-hover); }

/* 0.5.12-ds-chat-focus-1: the whole pill (icon and label) is the typed-chat entry.
   cursor/hover/focus already exist on .bms-chat-launcher; keep the same pointer on children
   so the icon image does not show a default arrow. */
.bms-chat-launcher,
.bms-chat-launcher__icon,
.bms-chat-launcher__icon img,
.bms-chat-launcher__label,
.bms-chat-launcher__label-full,
.bms-chat-launcher__label-short {
  cursor: pointer;
}
