/* =========================================================  
   247ChatMate — Widget V2
   CLEAN BASELINE — SCROLL SAFE (RECOVERY — STABLE)
   BEHAVIOUR + UX POLISH PASS
   + MIN FIX — LOCK CHIP HEIGHT / NO SHAPE GROWTH
========================================================= */

:root {
  --matewa-accent: #25D366;
  --matewa-accent-dark: #1fb85a;

  --matewa-bg-soft: #f1f5f9;
  --matewa-bg-white: #ffffff;

  --matewa-text-main: #0f172a;
  --matewa-text-muted: #334155;

  --matewa-vertical-gap: 12px;

  --matewa-radius: 22px;
  --matewa-radius-inner: 16px;

  --matewa-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---------------------------------------------------------
   SAFETY
--------------------------------------------------------- */

#matewa-widget,
#matewa-widget * {
  box-sizing: border-box;
}

/* ---------------------------------------------------------
   WIDGET SHELL
--------------------------------------------------------- */

#matewa-widget {
  position: fixed;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);

  width: 320px;
  height: 520px;

  display: flex;
  flex-direction: column;

  visibility: hidden;
  opacity: 0;
  pointer-events: none;

  background: var(--matewa-bg-white);
  border-radius: var(--matewa-radius);
  overflow: hidden;

  box-shadow: 0 32px 70px rgba(0,0,0,.35);
  font-family: var(--matewa-font);

  z-index: 9998;
}

#matewa-widget.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* ---------------------------------------------------------
   HEADER
--------------------------------------------------------- */

.matewa-header {
  height: 64px;
  padding: 0 18px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  );

  color: #fff;
  margin-bottom: calc(var(--matewa-vertical-gap) - 16px);
}

.matewa-header-title {
  font-size: 17px;
  font-weight: 700;
}

.matewa-close {
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;
  border: none;

  background: transparent;
  color: #fff;

  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}

/* ---------------------------------------------------------
   SCROLL AREA (ONLY THIS SCROLLS)
--------------------------------------------------------- */

.matewa-bubbles {
  position: relative;

  flex: 1;
  display: flex;
  flex-direction: column;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 16px;
  padding-bottom: 140px;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------------------------------------------------------
   STREAM
--------------------------------------------------------- */

.matewa-stream {
  display: flex;
  flex-direction: column;
  gap: var(--matewa-vertical-gap);
}

/* ---------------------------------------------------------
   INTRO
--------------------------------------------------------- */

.matewa-intro {
  display: flex;
  flex-direction: column;
  gap: var(--matewa-vertical-gap);
}

.matewa-intro .matewa-bubble {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.matewa-intro .matewa-bubble.is-visible {
  opacity: 1;
}

/* ---------------------------------------------------------
   BUBBLES
--------------------------------------------------------- */

.matewa-bubble {
  padding: 14px 16px;
  border-radius: var(--matewa-radius-inner);
  background: var(--matewa-bg-soft);

  font-size: 15px;
  line-height: 1.5;
  color: #0f172a;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.95),
    0 4px 10px rgba(15,23,42,.12);
}

.matewa-muted {
  color: var(--matewa-text-muted);
}

/* ---------------------------------------------------------
   TASK APPEARANCE
--------------------------------------------------------- */

.matewa-task,
.matewa-notes,
.matewa-phone,
.matewa-contact {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.matewa-task.is-active,
.matewa-notes.is-active,
.matewa-phone.is-active,
.matewa-contact.is-active {
  opacity: 1;
}

/* ---------------------------------------------------------
   CHIPS
--------------------------------------------------------- */

.matewa-chip-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.matewa-chip {
  height: 52px;
  min-height: 52px;
  padding: 6px 8px;

  border-radius: 14px;
  border: 1.5px solid var(--matewa-accent);

  background: #fff;
  color: var(--matewa-accent);

  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  overflow: hidden;

  cursor: pointer;

  transition:
    transform 0.12s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

/* ⭐ MIN FIX — clamp chip label to two lines only */
.matewa-chip-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  width: 100%;
  max-height: 34px;
  overflow: hidden;

  line-height: 1.25;
  text-align: center;
  word-break: normal;
  overflow-wrap: normal;
}

.matewa-chip.is-selected {
  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  );
  color: #fff;
  border-color: transparent;
}

/* ---------------------------------------------------------
   INPUTS
--------------------------------------------------------- */

.matewa-notes,
.matewa-phone,
.matewa-contact {
  display: none;
  flex-direction: column;
  gap: 8px;
}

.matewa-notes.is-active,
.matewa-phone.is-active,
.matewa-contact.is-active {
  display: flex;
}

/* ---------- TEXTAREA (WHATSAPP-LIKE — 1 LINE) ---------- */

.matewa-notes textarea {
  width: 100%;

  font-family: var(--matewa-font);
  font-size: 15px;
  line-height: 1.4;

  padding: 10px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--matewa-accent);

  height: calc(1.4em + 20px);
  max-height: calc(1.4em + 20px);

  resize: none;
  overflow-y: auto;

  display: block;
}

.matewa-notes textarea {
  scroll-behavior: auto;
}

/* ---------------------------------------------------------
   OTHER INPUTS
--------------------------------------------------------- */

.matewa-phone input,
.matewa-contact input {
  height: 48px;
  border-radius: 14px;
  border: 1.5px solid var(--matewa-accent);
  padding: 0 16px;

  font-family: var(--matewa-font);
  font-size: 15px;
}

/* ---------------------------------------------------------
   CHARACTER COUNTER
--------------------------------------------------------- */

.matewa-notes {
  position: relative;
}

/* required for phone helper anchoring */
.matewa-phone {
  position: relative;
}

.matewa-char-counter {
  position: absolute;
  right: 26px; /* pulled inward to clear scrollbar */
  bottom: 8px;

  font-size: 10px;
  font-weight: 600;
  color: var(--matewa-text-muted);

  pointer-events: none;
}

/* ⭐ MIN FIX — micro-lowered to clear bubble radius cleanly */
.matewa-phone .matewa-char-counter {
  bottom: 80px;
}

/* ---------------------------------------------------------
   CTA — CLICK-SAFE MIN FIX (WIDTH ALIGNMENT CORRECTED)
--------------------------------------------------------- */

.matewa-cta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;

  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: var(--matewa-vertical-gap);

  background: linear-gradient(
    to top,
    rgba(255,255,255,0.96),
    rgba(255,255,255,0.92)
  );

  border-radius: 0;

  z-index: 2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.25s ease;
}

.matewa-cta.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 5;
}

.matewa-cta .matewa-chip-group {
  margin-top: 4px;
}

/* ---------------------------------------------------------
   CTA CHIP LAYOUT (2-COLUMN OVERRIDE)
--------------------------------------------------------- */

.matewa-cta .matewa-chip-group {
  grid-template-columns: 1fr 1fr;
}

.matewa-cta .matewa-chip {
  height: 48px;
  min-height: 48px;
  font-size: 14px;
}

.matewa-cta .matewa-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ---------------------------------------------------------
   BRANDING
--------------------------------------------------------- */

.matewa-branding {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;

  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;

  background: #fff;
  border-top: 1px solid #eef2f7;

  font-size: 12px;
  z-index: 3;
}

.matewa-branding a {
  color: var(--matewa-accent);
  font-weight: 600;
}

/* ---------------------------------------------------------
   LAUNCHER
--------------------------------------------------------- */

#matewa-launcher {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);

  height: 52px;
  padding: 0 22px;

  border-radius: 26px;
  border: none;

  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  );

  color: #fff;
  font-size: 15px;
  font-weight: 700;

  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  cursor: pointer;
  z-index: 9999;
}

#matewa-launcher::before {
  content: "Chat on WhatsApp";
}

/* ---------------------------------------------------------
   LAUNCHER HIDE WHEN WIDGET IS OPEN
   Uses authoritative body class from matewa-launcher.js
--------------------------------------------------------- */

body.matewa-launcher-hidden #matewa-launcher {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ---------------------------------------------------------
   LOCKED INPUT VISUAL (PAINT ONLY)
--------------------------------------------------------- */

.matewa-notes textarea.is-locked,
.matewa-phone input.is-locked,
.matewa-contact input.is-locked {
  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  ) !important;

  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: none !important;
  caret-color: transparent;
}

/* ⭐ MIN FIX — locked textarea counter turns white */
.matewa-notes textarea.is-locked ~ .matewa-char-counter {
  color: #ffffff !important;
}

.matewa-notes textarea.is-locked::placeholder,
.matewa-phone input.is-locked::placeholder,
.matewa-contact input.is-locked::placeholder {
  color: rgba(255,255,255,.9) !important;
}

/* ---------------------------------------------------------
   FOCUS STATE
--------------------------------------------------------- */

.matewa-notes textarea:focus,
.matewa-phone input:focus,
.matewa-contact input:focus {
  outline: none !important;
  border-color: var(--matewa-accent);
  box-shadow: 0 0 0 2px rgba(37,211,102,.25);
}

.matewa-notes textarea:not(.is-locked):focus,
.matewa-phone input:not(.is-locked):focus,
.matewa-contact input:not(.is-locked):focus {
  background: #f6fff9;
}

/* =========================================================
   PHONE HELPER — INLINE, STABLE, TEXT-SWAP ONLY
   Restores helper under input + Mickey-mouse warning
========================================================= */

/* override absolute positioning for PHONE ONLY */
.matewa-phone .matewa-char-counter {
  position: static;
  margin-top: 4px;
  padding-left: 16px;

  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;

  color: var(--matewa-text-muted);
  text-align: left;

  pointer-events: none;
}

/* =========================================================
   CONTACT HELPER — EXACT MATCH TO PHONE HELPER
   Reserved space, text-swap only
========================================================= */

.matewa-contact .matewa-soft-hint {
  display: block;

  height: 14px;
  margin-top: 4px;
  padding-left: 16px;

  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;

  color: var(--matewa-text-muted);
  text-align: left;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.matewa-contact .matewa-soft-hint.is-visible {
  opacity: 1;
}

/* =========================================================
   FINAL MICRO-RHYTHM FIX — PHONE + CONTACT HELPERS
   Symmetric spacing, no layout shift, text-swap only
========================================================= */

/* shared helper rhythm (phone + contact) */
.matewa-phone .matewa-char-counter,
.matewa-contact .matewa-soft-hint {
  display: block;

  margin-top: 4px;
  margin-bottom: 4px;

  padding-left: 16px;

  font-size: 12px;
  line-height: 1.3;
  font-weight: 500;

  color: var(--matewa-text-muted);
  opacity: 0.8;

  pointer-events: none;
}

/* ensure helpers never push layout when empty */
.matewa-contact .matewa-soft-hint {
  height: 14px;
}

/* warnings override colour only (no spacing change) */
.matewa-phone .matewa-char-counter.is-warning,
.matewa-contact .matewa-soft-hint.is-warning {
  color: var(--matewa-text-muted);
  opacity: 1;
}

/* =========================================================
   RTL SUPPORT — MINIMAL, AUTO (NO BLOAT)
========================================================= */

#matewa-wrapper[dir="rtl"] {
  direction: rtl;
}

#matewa-wrapper[dir="rtl"] .matewa-stream,
#matewa-wrapper[dir="rtl"] .matewa-intro,
#matewa-wrapper[dir="rtl"] .matewa-bubble,
#matewa-wrapper[dir="rtl"] .matewa-phone .matewa-char-counter,
#matewa-wrapper[dir="rtl"] .matewa-contact .matewa-soft-hint {
  text-align: right;
}

#matewa-wrapper[dir="rtl"] .matewa-chip-group {
  direction: rtl;
}

#matewa-wrapper[dir="rtl"] .matewa-char-counter {
  right: auto;
  left: 26px;
}

/* =========================================================
   HARD ISOLATION — GRID SAFE + PROPER WEIGHT
========================================================= */

#matewa-widget .matewa-chip {
  appearance: none !important;
  -webkit-appearance: none !important;
  all: unset;

  box-sizing: border-box;
  width: 100% !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  height: 52px !important;
  min-height: 52px !important;
  padding: 6px 8px !important;

  border-radius: 14px !important;
  border: 1.5px solid var(--matewa-accent) !important;

  background: #fff !important;
  color: var(--matewa-accent) !important;

  font-family: var(--matewa-font) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;

  text-align: center !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  overflow: hidden !important;

  cursor: pointer !important;
  box-shadow: none !important;

  -webkit-font-smoothing: antialiased !important;
  text-rendering: optimizeLegibility !important;
}

/* ⭐ MIN FIX — hard clamp chip label to two lines only */
#matewa-widget .matewa-chip .matewa-chip-label {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;

  width: 100% !important;
  max-height: 34px !important;
  overflow: hidden !important;

  line-height: 1.25 !important;
  text-align: center !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

#matewa-widget .matewa-chip.is-selected {
  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  ) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* =========================================================
   VIEWPORT SAFETY FIX (BODY FIXED COMPAT)
========================================================= */

#matewa-widget {
  position: fixed !important;
  bottom: 96px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

/* =========================================================
   ELEMENTOR HARD OVERRIDE — CLOSE (X) BUTTON
   Surgical force reset
========================================================= */

#matewa-widget .matewa-close {
  appearance: none !important;
  -webkit-appearance: none !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 44px !important;
  height: 44px !important;

  padding: 1px 6px !important;
  margin: 0 !important;

  background: transparent !important;
  color: #ffffff !important;

  border: none !important;
  border-radius: 50% !important;

  font-family: Arial, sans-serif !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  line-height: normal !important;

  box-sizing: border-box !important;
  text-align: center !important;

  box-shadow: none !important;
  text-shadow: none !important;

  transition: background 0.18s ease !important, opacity 0.18s ease !important;
}

#matewa-widget .matewa-close:hover,
#matewa-widget .matewa-close:focus-visible {
  background: rgba(255, 255, 255, 0.18) !important;
  outline: none !important;
}

/* =========================================================
   SPACING AUDIT PATCH — VISUAL RHYTHM ONLY
   NO BEHAVIOUR CHANGES
========================================================= */

/* ---------------------------------------------------------
   1. BUBBLE → CHIP GRID BREATHING ROOM
   (fixes tight chip screen)
--------------------------------------------------------- */

.matewa-task .matewa-chip-group {
  margin-top: calc(var(--matewa-vertical-gap) + 4px);
}

/* ---------------------------------------------------------
   2. INPUT GROUP RHYTHM
   (fixes optional/helper spacing feeling off)
--------------------------------------------------------- */

.matewa-notes,
.matewa-phone,
.matewa-contact {
  gap: 8px;
}

/* ---------------------------------------------------------
   4. CTA CHIP GROUP BREATHING ROOM
--------------------------------------------------------- */

.matewa-cta .matewa-chip-group {
  margin-top: 8px;
}

/* ---------------------------------------------------------
   5. STREAM RHYTHM MICRO-BALANCE
--------------------------------------------------------- */

.matewa-stream {
  gap: calc(var(--matewa-vertical-gap) + 2px);
}

/* =========================================================
   OPTIONAL LABEL — ATTACH TO INPUT ABOVE
   Spacing only
========================================================= */

.matewa-phone .matewa-char-counter,
.matewa-contact .matewa-soft-hint {
  margin-top: -2px;
  margin-bottom: 8px;
}

/* =========================================================
   CONTACT SOFT CONFIRM — STRONG VISUAL CONFIRM
   Same visual language as locked fields, but still editable on refocus
========================================================= */

.matewa-contact input.is-soft-confirmed {
  background: linear-gradient(
    180deg,
    var(--matewa-accent),
    var(--matewa-accent-dark)
  ) !important;

  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: none !important;
  caret-color: transparent;
}

.matewa-contact input.is-soft-confirmed::placeholder {
  color: rgba(255,255,255,.9) !important;
}

/* =========================================================
   PHASE 5-A-7A — FRONTEND WIDGET VISUAL FLOW FIT CORRECTION
   Visual/layout only. Preserves chip fit rules and handoff behaviour.
========================================================= */

#matewa-widget {
  width: 320px;
  height: 520px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  box-shadow:
    0 30px 72px rgba(15, 23, 42, 0.28),
    0 10px 24px rgba(15, 23, 42, 0.14);
}

#matewa-widget .matewa-header {
  height: 60px;
  padding: 0 12px 0 16px;
  background:
    radial-gradient(circle at 22% 0%, rgba(255, 255, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #15803d 0%, #057a29 100%);
}

#matewa-widget .matewa-header-title {
  font-size: 15px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  max-width: 118px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
}

#matewa-widget .matewa-bubbles {
  padding: 14px;
  padding-bottom: 122px;
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 211, 102, 0.07), transparent 30%),
    #ffffff;
}

#matewa-widget .matewa-stream {
  gap: 12px;
}

#matewa-widget .matewa-bubble {
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.085);
}

#matewa-widget .matewa-muted {
  background: #ecfdf3;
  border-color: rgba(37, 211, 102, 0.18);
  color: #14532d;
}

/* Keep the proven chip contract: fixed cards, two-line clamp, no oversized labels. */
#matewa-widget .matewa-task .matewa-chip-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

#matewa-widget .matewa-task .matewa-chip {
  height: 50px !important;
  min-height: 50px !important;
  padding: 6px 7px !important;
  border-color: rgba(5, 122, 41, 0.28) !important;
  color: #057a29 !important;
  background: #ffffff !important;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.055) !important;
}

#matewa-widget .matewa-task .matewa-chip:hover,
#matewa-widget .matewa-task .matewa-chip:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.095) !important;
}

#matewa-widget .matewa-task .matewa-chip.is-selected {
  background: linear-gradient(180deg, #15803d 0%, #057a29 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

#matewa-widget .matewa-task .matewa-chip .matewa-chip-label {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  width: 100% !important;
  max-height: 30px !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  font-size: 11.2px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  text-align: center !important;
}

#matewa-widget .matewa-notes {
  margin-top: 7px;
  gap: 8px;
}

#matewa-widget .matewa-notes .matewa-bubble {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 750;
  color: #14532d;
  background: #ecfdf3;
  border-color: rgba(37, 211, 102, 0.18);
}

#matewa-widget .matewa-notes textarea {
  min-height: 96px;
  height: 96px;
  max-height: 96px;
  padding: 12px 14px 27px;
  border-color: rgba(5, 122, 41, 0.30);
  background: #ffffff;
  font-size: 14px;
  line-height: 1.42;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 8px 18px rgba(15, 23, 42, 0.06);
}

#matewa-widget .matewa-notes .matewa-char-counter {
  right: 18px;
  bottom: 11px;
  color: #64748b;
}

#matewa-widget .matewa-phone-field {
  position: relative;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}

#matewa-widget .matewa-phone-country-picker {
  position: relative;
  min-width: 0;
  z-index: 20;
}

#matewa-widget .matewa-phone-field--no-country-selector {
  grid-template-columns: minmax(0, 1fr);
}

#matewa-widget .matewa-phone-country-picker.is-hidden {
  display: none !important;
}

#matewa-widget .matewa-phone-country-picker select.matewa-phone-country {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

#matewa-widget .matewa-phone-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 48px;
  padding: 0 8px;
  border: 1.5px solid rgba(15, 23, 42, 0.14);
  border-radius: 14px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.04);
}

#matewa-widget .matewa-phone-code:hover {
  border-color: rgba(15, 23, 42, 0.22);
  background: #ffffff;
}

#matewa-widget .matewa-phone-code:focus-visible,
#matewa-widget .matewa-phone-country-picker.is-open .matewa-phone-code {
  border-color: rgba(5, 122, 41, 0.42);
  background: #f8fffb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.14);
}

#matewa-widget .matewa-phone-code.is-locked,
#matewa-widget .matewa-phone-code:disabled {
  opacity: 1;
  cursor: default;
}

#matewa-widget .matewa-phone-country-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  font-size: 15px;
  line-height: 1;
}

#matewa-widget .matewa-phone-country-dial {
  display: inline-block;
  flex: 0 0 auto;
  min-width: 28px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

#matewa-widget .matewa-phone-country-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 80;
  width: min(292px, calc(100vw - 48px));
  max-height: 238px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  background: #ffffff;
  pointer-events: auto;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

#matewa-widget .matewa-phone-country-menu[hidden] {
  display: none !important;
}

#matewa-widget .matewa-phone-country-option {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 62px;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #0f172a;
  font-family: var(--matewa-font);
  font-size: 13px;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
}

#matewa-widget .matewa-phone-country-option:hover,
#matewa-widget .matewa-phone-country-option:focus-visible,
#matewa-widget .matewa-phone-country-option.is-selected {
  background: #ecfdf3;
  outline: none;
}

#matewa-widget .matewa-phone-country-option-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  font-size: 16px;
  line-height: 1;
}

#matewa-widget .matewa-phone-country-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

#matewa-widget .matewa-phone-country-option-dial {
  justify-self: end;
  width: 62px;
  color: #14532d;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

#matewa-widget .matewa-phone-field .matewa-phone-input {
  min-width: 0;
}

#matewa-widget .matewa-phone input,
#matewa-widget .matewa-contact input {
  border-color: rgba(5, 122, 41, 0.26);
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.05);
}

#matewa-widget .matewa-phone input:focus,
#matewa-widget .matewa-contact input:focus,
#matewa-widget .matewa-notes textarea:focus {
  border-color: #057a29;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}

#matewa-widget .matewa-cta {
  bottom: 40px;
  padding: 8px 14px 10px;
  gap: 8px;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.99), rgba(255, 255, 255, 0.93));
  box-shadow: 0 -12px 24px rgba(255, 255, 255, 0.94);
}

#matewa-widget .matewa-cta-prompt,
#matewa-widget .matewa-cta-confirm {
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.32;
  font-weight: 750;
  text-align: center;
}

#matewa-widget .matewa-cta .matewa-chip-group {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 0;
}

#matewa-widget .matewa-cta .matewa-chip {
  height: 46px !important;
  min-height: 46px !important;
  padding: 8px 10px !important;
  justify-content: center !important;
  gap: 8px;
  border-color: rgba(5, 122, 41, 0.30) !important;
  color: #057a29 !important;
  background: #ffffff !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07) !important;
  text-align: center !important;
}

#matewa-widget .matewa-cta .matewa-chip.is-selected {
  background: linear-gradient(180deg, #15803d 0%, #057a29 100%) !important;
  color: #ffffff !important;
}

#matewa-widget .matewa-cta-whatsapp {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #f0fdf4 url('../img/whatsapp.svg') center / 13px 13px no-repeat;
  border: 1px solid rgba(37, 211, 102, 0.25);
}

#matewa-widget .matewa-cta .matewa-chip.is-selected .matewa-cta-whatsapp {
  background-color: #ffffff;
  border-color: rgba(255, 255, 255, 0.78);
}

#matewa-widget .matewa-cta-copy {
  display: block;
  min-width: 0;
}

#matewa-widget .matewa-cta-copy strong {
  display: block;
  color: inherit;
  font-size: 13.5px;
  line-height: 1.1;
  font-weight: 850;
  white-space: nowrap;
}

#matewa-widget .matewa-cta-copy small {
  display: none;
}

@media (max-width: 420px) {
  #matewa-widget {
    left: 12px !important;
    right: 12px !important;
    bottom: 86px !important;
    width: auto;
    max-width: none;
    height: min(520px, calc(100vh - 112px));
    transform: none !important;
  }

  #matewa-widget .matewa-bubbles {
    padding: 14px;
    padding-bottom: 122px;
  }

  #matewa-widget .matewa-task .matewa-chip .matewa-chip-label {
    font-size: 10.8px !important;
  }

  #matewa-widget .matewa-cta-copy strong {
    font-size: 13px;
  }
}

/* =========================================================
   ACCESSIBILITY QA 5-A-8 — FOCUS, CONTRAST AND MOTION
   Minimum CSS only. No widget flow or phone logic changes.
   MIN FIX — replaces harsh black browser-style outline
   with branded accessible green focus ring.
========================================================= */

:root {
  --matewa-accent: #15803d;
  --matewa-accent-dark: #057a29;
}

#matewa-launcher:focus-visible,
#matewa-widget .matewa-chip:focus-visible,
#matewa-widget .matewa-phone-code:focus-visible,
#matewa-widget .matewa-phone-country-option:focus-visible,
#matewa-widget input:focus-visible,
#matewa-widget textarea:focus-visible,
#matewa-widget .matewa-branding a:focus-visible {
  outline: 3px solid rgba(21, 128, 61, 0.58) !important;
  outline-offset: 3px !important;
  box-shadow:
    0 0 0 4px rgba(21, 128, 61, 0.14),
    0 8px 18px rgba(15, 23, 42, 0.08) !important;
}

#matewa-widget .matewa-close:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.96) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(21, 128, 61, 0.34) !important;
}

#matewa-widget .matewa-chip:focus-visible,
#matewa-widget .matewa-phone-code:focus-visible,
#matewa-widget .matewa-phone-country-option:focus-visible {
  box-shadow:
    0 0 0 4px rgba(21, 128, 61, 0.16),
    0 10px 22px rgba(15, 23, 42, 0.10) !important;
}

#matewa-widget .matewa-chip.is-selected:focus-visible,
#matewa-widget .matewa-cta .matewa-chip.is-selected:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.96) !important;
  outline-offset: 3px !important;
  box-shadow:
    0 0 0 6px rgba(21, 128, 61, 0.38),
    0 10px 22px rgba(15, 23, 42, 0.12) !important;
}

@media (prefers-reduced-motion: reduce) {
  #matewa-launcher,
  #matewa-widget,
  #matewa-widget * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
/* 247ChatMate language selector */
#matewa-widget .matewa-lang-switcher {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 6px;
  z-index: 30;
}

#matewa-widget .matewa-lang-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 30px;
  min-width: 118px;
  max-width: 158px;
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 999px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 3px 10px rgba(0,0,0,.10);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#matewa-widget .matewa-lang-button:hover,
#matewa-widget .matewa-lang-button[aria-expanded="true"] {
  background: rgba(255,255,255,.24);
  border-color: rgba(255,255,255,.58);
}

#matewa-widget .matewa-lang-name {
  display: inline-block;
  max-width: 104px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#matewa-widget .matewa-lang-flag {
  width: 21px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
  flex: 0 0 21px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.75), 0 1px 3px rgba(0,0,0,.20);
}

#matewa-widget .matewa-lang-globe { display: none !important; }
#matewa-widget .matewa-lang-fallback { display: none !important; }
#matewa-widget .matewa-lang-emoji {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  font-size: 18px;
  line-height: 1;
  filter: saturate(1.18);
}

#matewa-widget .matewa-lang-caret {
  font-size: 10px;
  opacity: .95;
  flex: 0 0 auto;
  transform: translateY(-1px);
}

#matewa-widget .matewa-lang-menu {
  position: absolute;
  top: 36px;
  right: 0;
  width: 232px;
  max-height: 204px; /* roughly 5 languages visible */
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(0,0,0,.24);
  z-index: 9999;
  overscroll-behavior: contain;
}

#matewa-widget .matewa-lang-menu::-webkit-scrollbar {
  width: 8px;
}

#matewa-widget .matewa-lang-menu::-webkit-scrollbar-thumb {
  background: rgba(20, 184, 112, .35);
  border-radius: 999px;
}

#matewa-widget .matewa-lang-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #12231f;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

#matewa-widget .matewa-lang-option .matewa-lang-globe { display: none !important; }

#matewa-widget .matewa-lang-option .matewa-lang-option-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#matewa-widget .matewa-lang-option:hover,
#matewa-widget .matewa-lang-option[aria-selected="true"] {
  background: rgba(20, 184, 112, .13);
  color: #14532d;
}

#matewa-widget .matewa-lang-loader {
  position: absolute;
  inset: 52px 0 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.98);
  z-index: 20;
  pointer-events: none;
}

#matewa-widget .matewa-lang-loader-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 42px);
  padding: 12px 16px;
  border: 1px solid rgba(20,184,112,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 10px 28px rgba(15,23,42,.12);
  color: #14532d;
  font-size: 12.5px;
  font-weight: 800;
}

#matewa-widget .matewa-lang-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(20,184,112,.22);
  border-top-color: rgba(20,184,112,.95);
  border-radius: 50%;
  animation: matewa-lang-spin .75s linear infinite;
  flex: 0 0 auto;
}

#matewa-widget .matewa-lang-loader-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@keyframes matewa-lang-spin {
  to { transform: rotate(360deg); }
}


/* Strict language loading: never show half-English content while a selected language is being prepared. */
#matewa-widget.matewa-lang-loading .matewa-stream,
#matewa-widget.matewa-lang-loading .matewa-cta {
  visibility: hidden !important;
}
#matewa-widget.matewa-lang-loading .matewa-branding {
  opacity: .28;
}

#matewa-widget .matewa-chip-translation-missing .matewa-chip-label::after {
  content: "";
}


/* Language selector off means off, including after reset/replay. */
#matewa-widget.matewa-language-selector-disabled .matewa-lang-switcher{
  display:none!important;
}
