/* ==========================================================================
   WEB360 — Visitor Assistant (chatbot) — UNIVERSAL BASELINE WIDGET STYLES
   --------------------------------------------------------------------------
   Phase: FRONTEND UI/UX DESIGN REVIEW. No backend.
   - Namespaced .mtchat / .mtchat__* (BEM), collision-safe (cf. .mt-overlay__*).
   - Driven by a local --mtc-* token layer that maps from the site's --mt-*
     tokens with safe fallbacks. A template polishes the widget LATER by
     overriding ONLY these --mtc-* vars, e.g.:
         body.tpl-fable5 .mtchat { --mtc-accent: #f59e0b; --mtc-radius: 14px; }
     No `if (ACTIVE_TEMPLATE)` anywhere — pure token contract (§40, §22).
   - Dark-safe: where a template defines --mt-surface / --mt-text dark, the
     widget follows automatically. Baseline (no such tokens) renders light.
   - Respects prefers-reduced-motion.
   ========================================================================== */

.mtchat {
  /* ---- local token layer (the ONLY thing a template override should touch) ---- */
  --mtc-accent:        var(--mt-brand-primary, #2f6bff);
  --mtc-accent-strong: var(--mt-brand-primary-hover, #1f57e6);
  --mtc-on-accent:     var(--mt-neutral-0, #ffffff);
  --mtc-surface:       var(--mt-surface, #ffffff);
  --mtc-surface-sunk:  var(--mt-surface-subtle, #eef1f5);
  --mtc-bot-bubble:    var(--mt-surface-subtle, #f1f3f7);
  --mtc-text:          var(--mt-text, #1c2430);
  --mtc-text-soft:     var(--mt-text-muted, #667085);
  --mtc-border:        var(--mt-border, rgba(18, 28, 45, .12));
  --mtc-radius:        var(--mt-radius-lg, 18px);
  --mtc-radius-md:     var(--mt-radius-md, 12px);
  --mtc-radius-sm:     var(--mt-radius-sm, 9px);
  --mtc-font:          var(--mt-font-sans, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
  --mtc-ok:            #1f8f4e;
  --mtc-danger:        #c23b3b;
  --mtc-shadow:        0 20px 50px -14px rgba(16, 24, 40, .30), 0 6px 16px -6px rgba(16, 24, 40, .14);
  --mtc-shadow-launch: 0 10px 26px -6px rgba(16, 24, 40, .34);

  --mtc-pad:      16px;
  --mtc-panel-w:  384px;
  --mtc-panel-h:  min(620px, calc(100vh - 132px));
  --mtc-msg-size: 15px;
  --mtc-z:        1200;

  position: fixed;
  z-index: var(--mtc-z);
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  font-family: var(--mtc-font);
  color: var(--mtc-text);
  -webkit-font-smoothing: antialiased;
}

/* launcher side (config: launcher.position) */
.mtchat--right { right: max(20px, env(safe-area-inset-right, 0px)); }
.mtchat--left  { left:  max(20px, env(safe-area-inset-left, 0px)); }

/* density (config: layout_preset) */
.mtchat--compact {
  --mtc-panel-w: 340px;
  --mtc-pad: 13px;
  --mtc-msg-size: 14px;
  --mtc-panel-h: min(560px, calc(100vh - 132px));
}

/* visibility (config: launcher.visibility) */
@media (max-width: 767px) { .mtchat--vis-desktop { display: none !important; } }
@media (min-width: 768px) { .mtchat--vis-mobile  { display: none !important; } }

.mtchat *, .mtchat *::before, .mtchat *::after { box-sizing: border-box; }
.mtchat button { font-family: inherit; margin: 0; }
.mtchat__sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   LAUNCHER
   ========================================================================== */
.mtchat__launcher {
  display: inline-flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 20px;
  border: 0; border-radius: 999px;
  background: var(--mtc-accent); color: var(--mtc-on-accent);
  font-size: 15px; font-weight: 600; letter-spacing: .01em;
  cursor: pointer;
  box-shadow: var(--mtc-shadow-launch);
  transition: transform .18s ease, background-color .18s ease;
}
.mtchat__launcher:hover { background: var(--mtc-accent-strong); transform: translateY(-1px); }
.mtchat__launcher:focus-visible { outline: 3px solid var(--mtc-accent); outline-offset: 3px; }
.mtchat__launcher-icon,
.mtchat__launcher-close { font-size: 18px; display: inline-flex; }
.mtchat__launcher-close { display: none; }
.mtchat__launcher-label { white-space: nowrap; }

/* open: launcher collapses to a circular close affordance */
.mtchat.is-open .mtchat__launcher { width: 52px; height: 52px; padding: 0; justify-content: center; }
.mtchat.is-open .mtchat__launcher-label,
.mtchat.is-open .mtchat__launcher-icon { display: none; }
.mtchat.is-open .mtchat__launcher-close { display: inline-flex; }

/* narrow screens: label hidden, launcher is a circle */
@media (max-width: 480px) {
  .mtchat__launcher { width: 54px; padding: 0; justify-content: center; }
  .mtchat__launcher-label { display: none; }
}

/* ==========================================================================
   ATTENTION STATE  (open_behavior = auto_minimized)
   The launcher itself "beats" (subtle scale + red glow) ~3 times, then settles.
   The RED "1" badge is a DECOUPLED sibling of the launcher, so it stays visually
   stable while the launcher pulses, and it remains after the beat settles until
   the visitor opens the assistant. One state class: .mtchat--attn on the root,
   cleared the instant the panel opens (openPanel -> clearAttention).
   ========================================================================== */
.mtchat__badge {
  position: absolute; top: -4px; inset-inline-end: -4px;   /* anchored to .mtchat == launcher box */
  display: none;                       /* shown only in the attention state */
  min-width: 18px; height: 18px; box-sizing: border-box;
  padding: 0 4px; border-radius: 999px;
  background: #e5342b; color: #fff;    /* RED badge, WHITE "1" */
  font: 700 11px/18px var(--mtc-font);
  text-align: center; letter-spacing: 0;
  box-shadow: 0 0 0 2px var(--mtc-surface);   /* separates it from the launcher; adapts to dark */
  pointer-events: none;                /* decorative, never interactive */
}
.mtchat--attn .mtchat__badge { display: block; }
@media (max-width: 480px) { .mtchat__badge { top: -3px; inset-inline-end: -3px; } }

/* the launcher beats: scale + glow, 3 finite beats, then back to normal */
.mtchat--attn .mtchat__launcher {
  animation: mtchat-beat 1.25s ease-in-out 3;
  transform-origin: center;
}
@keyframes mtchat-beat {
  0%, 100% { transform: scale(1);
             box-shadow: var(--mtc-shadow-launch), 0 0 0 0 rgba(229, 52, 43, 0); }
  42%      { transform: scale(1.08);
             box-shadow: var(--mtc-shadow-launch), 0 0 22px 5px rgba(229, 52, 43, .48); }
}
/* defensive: the badge is never shown while the panel is open */
.mtchat.is-open .mtchat__badge { display: none; }

/* reduced motion: no scale, no animated pulse — RED "1" stays + a static halo */
@media (prefers-reduced-motion: reduce) {
  .mtchat--attn .mtchat__launcher {
    animation: none;
    box-shadow: var(--mtc-shadow-launch), 0 0 0 3px rgba(229, 52, 43, .32);
  }
}

/* ==========================================================================
   PEEK TEASER (config: welcome_message; only when open_behavior = manual)
   ========================================================================== */
.mtchat__peek {
  position: absolute; bottom: 66px;
  width: max-content; max-width: min(280px, calc(100vw - 40px));
  padding: 12px 34px 12px 14px;
  background: var(--mtc-surface); color: var(--mtc-text);
  border: 1px solid var(--mtc-border); border-radius: var(--mtc-radius-md);
  box-shadow: var(--mtc-shadow);
  font-size: 13.5px; line-height: 1.45; cursor: pointer;
  animation: mtchat-rise .26s ease both;
}
.mtchat--right .mtchat__peek { right: 4px; }
.mtchat--left  .mtchat__peek { left: 4px; }
.mtchat__peek[hidden] { display: none; }
.mtchat__peek-text { margin: 0; }
.mtchat__peek-close {
  position: absolute; top: 5px; right: 5px;
  width: 22px; height: 22px; border: 0; border-radius: 6px;
  background: transparent; color: var(--mtc-text-soft); cursor: pointer; font-size: 12px;
}
.mtchat__peek-close:hover { background: var(--mtc-surface-sunk); color: var(--mtc-text); }

/* ==========================================================================
   PANEL
   ========================================================================== */
.mtchat__panel {
  position: absolute; bottom: 68px;
  width: var(--mtc-panel-w); max-width: calc(100vw - 40px);
  height: var(--mtc-panel-h);
  display: flex; flex-direction: column;
  background: var(--mtc-surface);
  border: 1px solid var(--mtc-border);
  border-radius: var(--mtc-radius);
  box-shadow: var(--mtc-shadow);
  overflow: hidden;
  animation: mtchat-panel-in .2s cubic-bezier(.2, .7, .3, 1) both;
}
.mtchat--right .mtchat__panel { right: 0; transform-origin: bottom right; }
.mtchat--left  .mtchat__panel { left: 0;  transform-origin: bottom left; }
.mtchat__panel[hidden] { display: none; }

@keyframes mtchat-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes mtchat-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes mtchat-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mtchat-spin { to { transform: rotate(360deg); } }
@keyframes mtchat-blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-2px); }
}

/* ---- header ---- */
.mtchat__header {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px var(--mtc-pad);
  border-bottom: 1px solid var(--mtc-border);
  background: var(--mtc-surface);
}
.mtchat__avatar {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mtc-accent); color: var(--mtc-on-accent);
  font-weight: 700; font-size: 15px;
}
.mtchat__identity { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.mtchat__name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mtchat__status { font-size: 12px; color: var(--mtc-text-soft); display: flex; align-items: center; gap: 6px; }
.mtchat__status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mtc-ok); }
/* header controls — Minimize + Close (both collapse to the launcher; state kept) */
.mtchat__hdr-controls { margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 2px; }
.mtchat__hdr-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--mtc-text-soft); cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.mtchat__hdr-btn:hover { background: var(--mtc-surface-sunk); color: var(--mtc-text); }
.mtchat__hdr-btn:focus-visible { outline: 2px solid var(--mtc-accent); outline-offset: 1px; }
/* legacy single-selector kept for back-compat */
.mtchat__close { background: transparent; color: var(--mtc-text-soft); }

/* ---- progress (subtle, conversational — NOT a form step counter) ---- */
.mtchat__progress { flex: 0 0 auto; height: 2px; background: var(--mtc-border); }
.mtchat__progress-bar { display: block; height: 100%; width: 0; background: var(--mtc-accent); transition: width .45s ease; }

/* ---- conversation log ---- */
.mtchat__log {
  flex: 1 1 auto;
  overflow-y: auto; overscroll-behavior: contain;
  padding: var(--mtc-pad);
  display: flex; flex-direction: column; gap: 10px;
  background: var(--mtc-surface);
}
.mtchat__msg { display: flex; }
.mtchat__msg--bot  { justify-content: flex-start; }
.mtchat__msg--user { justify-content: flex-end; }
.mtchat__bubble {
  max-width: 84%;
  padding: 10px 13px;
  font-size: var(--mtc-msg-size); line-height: 1.5;
  border-radius: 14px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  animation: mtchat-rise .2s ease both;
}
.mtchat__msg--bot  .mtchat__bubble { background: var(--mtc-bot-bubble); color: var(--mtc-text); border-bottom-left-radius: 4px; }
.mtchat__msg--user .mtchat__bubble { background: var(--mtc-accent); color: var(--mtc-on-accent); border-bottom-right-radius: 4px; }

/* typing indicator */
.mtchat__typing .mtchat__bubble { display: inline-flex; align-items: center; gap: 4px; padding: 12px 14px; }
.mtchat__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mtc-text-soft); animation: mtchat-blink 1.2s infinite ease-in-out; }
.mtchat__typing i:nth-child(2) { animation-delay: .18s; }
.mtchat__typing i:nth-child(3) { animation-delay: .36s; }

/* ==========================================================================
   ACTION AREA (quick replies / input / CTA / completed / error)
   ========================================================================== */
.mtchat__action {
  flex: 0 0 auto;
  border-top: 1px solid var(--mtc-border);
  padding: 12px var(--mtc-pad);
  background: var(--mtc-surface);
  display: flex; flex-direction: column; gap: 8px;
}
.mtchat__action:empty { display: none; }

/* quick replies — balanced 2-column grid for any number of choices */
.mtchat__choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.mtchat__chip {
  width: 100%; min-height: 44px;                 /* equal width + comfortable touch target */
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  border: 1px solid var(--mtc-accent);
  background: transparent; color: var(--mtc-accent);
  padding: 8px 12px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; line-height: 1.3; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
/* an odd trailing choice (1 alone, 3rd of 3, 5th of 5 …) fills its row cleanly */
.mtchat__choices > .mtchat__chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mtchat__chip:hover:not(:disabled) { background: var(--mtc-accent); color: var(--mtc-on-accent); }
.mtchat__chip:focus-visible { outline: 2px solid var(--mtc-accent); outline-offset: 2px; }
.mtchat__chip:disabled { opacity: .45; cursor: default; }
/* genuinely tiny screens only: single column */
@media (max-width: 340px) {
  .mtchat__choices { grid-template-columns: 1fr; }
  .mtchat__choices > .mtchat__chip:last-child:nth-child(odd) { grid-column: auto; }
}

/* text input */
.mtchat__form { display: flex; gap: 8px; align-items: flex-end; }
.mtchat__input {
  flex: 1 1 auto; width: 100%;
  border: 1px solid var(--mtc-border); border-radius: var(--mtc-radius-sm);
  padding: 10px 12px; font-size: 14px; line-height: 1.4;
  color: var(--mtc-text); background: var(--mtc-surface);
  resize: none; max-height: 120px; font-family: inherit;
}
.mtchat__input::placeholder { color: var(--mtc-text-soft); }
.mtchat__input:focus { outline: 2px solid var(--mtc-accent); outline-offset: 0; border-color: transparent; }
.mtchat__input--error { border-color: var(--mtc-danger); }
.mtchat__send {
  flex: 0 0 auto; width: 40px; height: 40px;
  border: 0; border-radius: var(--mtc-radius-sm);
  background: var(--mtc-accent); color: var(--mtc-on-accent);
  cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
}
.mtchat__send:hover:not(:disabled) { background: var(--mtc-accent-strong); }
.mtchat__send:disabled { opacity: .45; cursor: default; }
.mtchat__hint { margin: 0; font-size: 12px; color: var(--mtc-text-soft); }
.mtchat__hint--error { color: var(--mtc-danger); }

/* final CTA */
.mtchat__cta {
  width: 100%;
  border: 0; border-radius: var(--mtc-radius-sm);
  background: var(--mtc-accent); color: var(--mtc-on-accent);
  padding: 12px 16px; font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.mtchat__cta:hover:not([disabled]) { background: var(--mtc-accent-strong); }
.mtchat__cta[disabled] { opacity: .75; cursor: default; }
.mtchat__cta-wrap { display: flex; flex-direction: column; gap: 6px; }
.mtchat__cta-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--mtc-text-soft); text-align: center; }
.mtchat__spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: mtchat-spin .7s linear infinite;
}

/* completed */
.mtchat__done { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.mtchat__done-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--mtc-ok); font-weight: 600; font-size: 13.5px; }
.mtchat__restart {
  border: 1px solid var(--mtc-border); background: transparent; color: var(--mtc-text-soft);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.mtchat__restart:hover { color: var(--mtc-text); border-color: var(--mtc-text-soft); }

/* error / fallback */
.mtchat__error {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid rgba(194, 59, 59, .35); background: rgba(194, 59, 59, .07);
  color: var(--mtc-danger);
  padding: 10px 12px; border-radius: var(--mtc-radius-sm); font-size: 13.5px;
}
.mtchat__error button {
  align-self: flex-start; border: 0; border-radius: 6px;
  background: var(--mtc-danger); color: #fff;
  padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}

/* disclaimer (config: consent_text) */
.mtchat__disclaimer {
  flex: 0 0 auto; margin: 0;
  padding: 8px var(--mtc-pad) 12px;
  text-align: center; font-size: 11px; color: var(--mtc-text-soft);
  background: var(--mtc-surface);
}

/* ==========================================================================
   MOBILE (config: mobile_behavior = bottom_sheet | full_screen | hidden)
   ========================================================================== */
.mtchat__backdrop { display: none; }

@media (max-width: 767px) {
  .mtchat { bottom: max(16px, env(safe-area-inset-bottom, 0px)); }

  .mtchat--m-hidden { display: none !important; }

  .mtchat.is-open .mtchat__backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(12, 18, 28, .45);
    animation: mtchat-fade .2s ease both;
  }

  .mtchat__panel { --mtc-panel-w: 100%; max-width: 100%; }

  /* larger tap targets for the header controls on touch */
  .mtchat__hdr-btn { width: 40px; height: 40px; font-size: 17px; }

  /* bottom sheet (preferred) */
  .mtchat--m-sheet .mtchat__panel {
    position: fixed; left: 0; right: 0; bottom: 0;
    width: 100%; height: 88vh; height: 88dvh;
    border-radius: 18px 18px 0 0;
    transform-origin: bottom center;
    animation: mtchat-sheet-in .24s cubic-bezier(.2, .7, .3, 1) both;
  }
  @keyframes mtchat-sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }

  /* full screen */
  .mtchat--m-full .mtchat__panel {
    position: fixed; inset: 0;
    width: 100%; height: 100vh; height: 100dvh;
    border-radius: 0;
  }
  .mtchat--m-full .mtchat.is-open .mtchat__backdrop { display: none; }

  .mtchat__disclaimer { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
}

/* ==========================================================================
   REVIEW-ONLY STATE DOCK  (visible only with ?mtchat_preview=1)
   Not part of the product; a visual QA aid for this design pass.
   ========================================================================== */
.mtchat__preview {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 10px;
  z-index: 1300;
  display: flex; flex-wrap: wrap; gap: 4px;
  max-width: calc(100vw - 20px);
  padding: 6px; border-radius: 10px;
  background: #10151f;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5);
}
.mtchat__preview button {
  border: 0; border-radius: 6px;
  background: #263041; color: #cfe0ff;
  font: 600 11px/1 var(--mtc-font, system-ui);
  padding: 6px 9px; cursor: pointer;
}
.mtchat__preview button:hover { background: #33425c; }
.mtchat__preview-sep { width: 1px; align-self: stretch; background: #33425c; margin: 2px 3px; }

/* ==========================================================================
   STYLE B — WHATSAPP-INSPIRED  (scoped to .mtchat--style-whatsapp)
   --------------------------------------------------------------------------
   Style A ("standard") rules above are NOT modified. This block only adds
   overrides that apply when the resolved style is "whatsapp". The palette is
   deliberately its own (green header, chat wallpaper, tinted bubbles) — the
   goal is that it reads as a WhatsApp-style conversation, not the neutral
   assistant. Conversation logic / flow / config architecture are unchanged.
   ========================================================================== */
.mtchat--style-whatsapp {
  --mtc-wa-header:        #075e54;   /* header band            */
  --mtc-wa-header-text:   #ffffff;
  --mtc-wa-accent:        #25d366;   /* send / launcher / CTA  */
  --mtc-wa-accent-strong: #1da851;
  --mtc-wa-bubble-in:     #ffffff;   /* incoming (assistant)   */
  --mtc-wa-bubble-out:    #d9fdd3;   /* outgoing (visitor)     */
  --mtc-wa-text:          #111b21;
  --mtc-wa-meta:          #667781;   /* timestamps             */
  --mtc-wa-wallpaper:     #ece5dd;   /* conversation backdrop  */
  --mtc-wa-inputbar:      #f0f2f5;
}

/* launcher + peek */
.mtchat--style-whatsapp .mtchat__launcher { background: var(--mtc-wa-accent); }
.mtchat--style-whatsapp .mtchat__launcher:hover { background: var(--mtc-wa-accent-strong); }

/* header */
.mtchat--style-whatsapp .mtchat__header {
  background: var(--mtc-wa-header); color: var(--mtc-wa-header-text);
  border-bottom-color: rgba(0, 0, 0, .18);
}
.mtchat--style-whatsapp .mtchat__avatar { background: rgba(255, 255, 255, .22); color: #fff; }
.mtchat--style-whatsapp .mtchat__name { color: #fff; }
.mtchat--style-whatsapp .mtchat__status { color: rgba(255, 255, 255, .82); flex-wrap: wrap; }
.mtchat--style-whatsapp .mtchat__status-dot { background: #a7f3c9; }
.mtchat--style-whatsapp .mtchat__status-sep { margin: 0 2px; opacity: .55; }
.mtchat--style-whatsapp .mtchat__substatus { font-size: 11px; color: rgba(255, 255, 255, .68); margin-top: 1px; }
.mtchat--style-whatsapp .mtchat__hdr-btn,
.mtchat--style-whatsapp .mtchat__close { color: rgba(255, 255, 255, .85); }
.mtchat--style-whatsapp .mtchat__hdr-btn:hover,
.mtchat--style-whatsapp .mtchat__close:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.mtchat--style-whatsapp .mtchat__progress-bar { background: var(--mtc-wa-accent); }

/* conversation area — subtle chat wallpaper (CSS only, no image asset) */
.mtchat--style-whatsapp .mtchat__log {
  background-color: var(--mtc-wa-wallpaper);
  background-image:
    radial-gradient(rgba(0, 0, 0, .028) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, .022) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  background-position: 0 0, 12px 12px;
}

/* bubbles */
.mtchat--style-whatsapp .mtchat__bubble {
  position: relative;
  min-width: 62px; max-width: 82%;
  padding: 6px 9px 7px;
  border-radius: 8px;
  color: var(--mtc-wa-text);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .10);
}
.mtchat--style-whatsapp .mtchat__bubble::after { content: ""; display: block; clear: both; }
.mtchat--style-whatsapp .mtchat__msg--bot  .mtchat__bubble { background: var(--mtc-wa-bubble-in);  border-top-left-radius: 2px; }
.mtchat--style-whatsapp .mtchat__msg--user .mtchat__bubble { background: var(--mtc-wa-bubble-out); border-top-right-radius: 2px; }
.mtchat--style-whatsapp .mtchat__msg--bot  .mtchat__bubble::before,
.mtchat--style-whatsapp .mtchat__msg--user .mtchat__bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 12px; }
.mtchat--style-whatsapp .mtchat__msg--bot  .mtchat__bubble::before { left: -6px;  background: var(--mtc-wa-bubble-in);  clip-path: polygon(100% 0, 0 0, 100% 100%); }
.mtchat--style-whatsapp .mtchat__msg--user .mtchat__bubble::before { right: -6px; background: var(--mtc-wa-bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.mtchat--style-whatsapp .mtchat__btext { display: inline; }
.mtchat--style-whatsapp .mtchat__meta {
  float: right; margin: 4px 0 -2px 10px;
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; color: var(--mtc-wa-meta); user-select: none;
}
.mtchat--style-whatsapp .mtchat__tick { color: #53bdeb; font-size: 11px; line-height: 1; }

/* typing bubble */
.mtchat--style-whatsapp .mtchat__typing .mtchat__bubble { background: var(--mtc-wa-bubble-in); }
.mtchat--style-whatsapp .mtchat__typing i { background: var(--mtc-wa-meta); }

/* quick replies — WhatsApp "reply" look (layout is the shared balanced grid) */
.mtchat--style-whatsapp .mtchat__chip {
  background: #fff; border-color: rgba(0, 0, 0, .08);
  color: #027eb5; border-radius: 7px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08);
}
.mtchat--style-whatsapp .mtchat__chip:hover:not(:disabled) { background: #f5f6f6; color: #027eb5; }

/* input bar */
.mtchat--style-whatsapp .mtchat__action,
.mtchat--style-whatsapp .mtchat__disclaimer { background: var(--mtc-wa-inputbar); }
.mtchat--style-whatsapp .mtchat__form { align-items: center; }
.mtchat--style-whatsapp .mtchat__input {
  background: #fff; border-color: transparent; border-radius: 999px;
  padding: 10px 14px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06);
}
.mtchat--style-whatsapp .mtchat__input:focus { outline-color: var(--mtc-wa-accent); }
.mtchat--style-whatsapp .mtchat__send { background: var(--mtc-wa-accent); border-radius: 50%; }
.mtchat--style-whatsapp .mtchat__send:hover:not(:disabled) { background: var(--mtc-wa-accent-strong); }

/* final WhatsApp handoff */
.mtchat__handoff { display: flex; flex-direction: column; gap: 10px; }
.mtchat__handoff-note { margin: 0; font-size: 13px; line-height: 1.5; color: var(--mtc-text-soft); }
.mtchat__wa-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--mtc-wa-accent, #25d366); color: #fff;
  font-size: 15px; font-weight: 700; padding: 12px 16px;
}
.mtchat__wa-cta:hover { background: var(--mtc-wa-accent-strong, #1da851); }

/* handoff demo preview (review build only) */
.mtchat__handoff-demo { display: flex; flex-direction: column; gap: 6px; }
.mtchat__handoff-demo-tag { margin: 0; font-size: 11.5px; color: var(--mtc-text-soft); }
.mtchat__handoff-demo-lbl {
  margin: 6px 0 0; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--mtc-text-soft);
}
.mtchat__handoff-demo-url {
  display: block; word-break: break-all;
  font-size: 11.5px; color: var(--mtc-text);
  background: var(--mtc-surface-sunk); border-radius: 6px; padding: 8px;
}
.mtchat__handoff-demo-msg {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-size: 12px; line-height: 1.45; color: var(--mtc-text);
  background: var(--mtc-surface-sunk); border-radius: 6px; padding: 8px;
  max-height: 180px; overflow: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .mtchat *, .mtchat *::before, .mtchat *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .mtchat__launcher:hover { transform: none; }
}
