/* Rexo, the Dubai Motocross website chat: the launcher and the panel (Mazimo's chat panel in the Dubai Motocross colours:
   navy #0F1F44, accent blue #2A529F, highlight yellow #FCC71F). Loaded by chatWidget(); every class starts with dmx-. */
.dmx-chat {
  --dmx-navy: #0F1F44; --dmx-night: #070B16; --dmx-accent: #2A529F; --dmx-accent-dark: #1C3A75; --dmx-hl: #FCC71F;
  --dmx-ink: #0A0F1E; --dmx-muted: #565b69; --dmx-line: #E3E0D8; --dmx-bg: #F5F2EC; --dmx-field: #F0EEE8; --dmx-wa: #25D366; --dmx-staff: #FFF5D1;
  --dmx-font: var(--b-font, 'Manrope', 'Helvetica Neue', Arial, sans-serif); --dmx-head: var(--h-font, 'Barlow Condensed', 'Arial Narrow', sans-serif);
  font: 500 15px/1.5 var(--dmx-font); color: var(--dmx-ink);
}
/* the chat takes the WhatsApp button's corner: WhatsApp moves into the chat */
body:has(.dmx-chat) .wa-float { display: none !important; }
.dmx-chat *, .dmx-chat *::before, .dmx-chat *::after { box-sizing: border-box; }
.dmx-i { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.dmx-i svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dmx-face { display: block; flex: none; }
/* Rexo's badge, as in Mazimo (FACE_DISK #060b09, FACE_LIT #fdfefe) */
.dmx-face__disk { fill: #060b09; }
.dmx-face__lit { fill: #fdfefe; }

/* ── the launcher ─────────────────────────────────────────────── */
.dmx-chat-fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 46;
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  background: var(--dmx-wa); color: #fff; box-shadow: 0 8px 24px rgba(7, 11, 22, .25); text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: transform .2s cubic-bezier(.2, .7, .2, 1), box-shadow .2s;
}
.dmx-chat-fab.is-live { background: #060b09; box-shadow: 0 0 0 2px rgba(252, 199, 31, .9), 0 10px 26px rgba(7, 11, 22, .32); }
.dmx-chat-fab:hover { transform: translateY(-2px); }
.dmx-chat-fab.is-pop { transform: scale(1.08); }
.dmx-chat-fab:focus-visible { outline: 3px solid var(--dmx-accent); outline-offset: 3px; }
.dmx-chat-fl { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: scale(.6) rotate(-20deg); transition: opacity .25s, transform .25s; pointer-events: none; }
.dmx-chat-fl.is-on { opacity: 1; transform: none; }
.dmx-chat-fl .dmx-i, .dmx-chat-fl > svg { width: 28px; height: 28px; }
.dmx-chat-fl.is-wa { color: var(--dmx-wa); }
.dmx-chat-fab:not(.is-live) .dmx-chat-fl.is-wa { color: #fff; }
.dmx-chat-fl .dmx-face { width: 48px; height: 48px; }
.dmx-chat-dot { position: absolute; top: 1px; right: 1px; width: 15px; height: 15px; border-radius: 50%; background: #e0342a; border: 2px solid #fff; }
.dmx-chat-dot[hidden] { display: none; }

/* ── the panel: a card from 761 px ────────────────────────────── */
.dmx-chat-panel {
  position: fixed; right: 18px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  width: min(392px, calc(100vw - 36px)); height: min(640px, calc(100vh - 120px)); max-height: calc(100vh - 120px);
  display: flex; flex-direction: column; overflow: hidden; background: var(--dmx-bg); border-radius: 22px;
  box-shadow: 0 28px 70px rgba(7, 11, 22, .3), 0 0 0 1px rgba(15, 31, 68, .08);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transform-origin: bottom right; pointer-events: none;
  transition: opacity .22s, transform .22s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .22s;
}
.dmx-chat-panel[data-dmx-open="1"] { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity .22s, transform .22s cubic-bezier(.2, .7, .2, 1); }
.dmx-chat-panel[data-instant="1"] { transition: none; }
.dmx-chat-scrim { position: fixed; inset: 0; z-index: 69; background: rgba(7, 11, 22, .45); opacity: 0; transition: opacity .22s; }
.dmx-chat-scrim.is-on { opacity: 1; }
.dmx-chat-scrim[hidden] { display: none; }
.dmx-chat-grab { display: none; }

.dmx-chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--dmx-navy); color: #fff; flex: none; position: relative; }
.dmx-chat-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--dmx-accent) 0 62%, var(--dmx-hl) 62% 100%); }
.dmx-chat-ava .dmx-face { border-radius: 50%; box-shadow: 0 0 0 2px rgba(252, 199, 31, .55); }
.dmx-chat-who { flex: 1; min-width: 0; }
.dmx-chat-title { margin: 0; font: italic 800 22px/1 var(--dmx-head); text-transform: uppercase; letter-spacing: .02em; outline: none; }
.dmx-chat-status { margin: 3px 0 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #d4d9e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmx-chat-status i { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; flex: none; }
.dmx-chat-status i.is-rest { background: #9aa3b8; }
.dmx-chat-status i.is-team { background: var(--dmx-hl); }
.dmx-chat-rb { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 0; cursor: pointer; background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; transition: background .15s; }
.dmx-chat-rb:hover { background: rgba(255, 255, 255, .2); }
.dmx-chat-rb.is-wa { background: var(--dmx-wa); color: #fff; }
.dmx-chat-rb.is-wa:hover { background: #1fb957; }
.dmx-chat-rb:focus-visible, .dmx-chat-title:focus-visible { outline: 2px solid var(--dmx-hl); outline-offset: 2px; }

/* ── the conversation ─────────────────────────────────────────── */
.dmx-chat-log { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 14px 12px 10px; }
.dmx-m { display: flex; flex-direction: column; margin-top: 2px; min-width: 0; }
.dmx-m[data-pos="solo"], .dmx-m[data-pos="first"] { margin-top: 10px; }
.dmx-m.is-pending { opacity: .7; }
.dmx-row { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.dmx-ava { width: 26px; flex: none; display: grid; place-items: end center; }
.dmx-m[data-pos="first"] .dmx-ava > *, .dmx-m[data-pos="middle"] .dmx-ava > * { visibility: hidden; }
.dmx-team { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--dmx-hl); color: var(--dmx-navy); font: 800 12px/1 var(--dmx-font); }
.dmx-bub { margin: 0; max-width: calc(100% - 34px); padding: 9px 13px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  background: #fff; color: var(--dmx-ink); border: 1px solid var(--dmx-line); border-radius: 18px; }
.dmx-m[data-role="assistant"][data-pos="first"] .dmx-bub { border-bottom-left-radius: 6px; }
.dmx-m[data-role="assistant"][data-pos="middle"] .dmx-bub { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.dmx-m[data-role="assistant"][data-pos="last"] .dmx-bub { border-top-left-radius: 6px; }
.dmx-m[data-role="visitor"] .dmx-row { justify-content: flex-end; }
.dmx-m[data-role="visitor"] .dmx-bub { background: var(--dmx-accent); border-color: var(--dmx-accent); color: #fff; max-width: 84%; }
.dmx-m[data-role="visitor"][data-pos="first"] .dmx-bub { border-bottom-right-radius: 6px; }
.dmx-m[data-role="visitor"][data-pos="middle"] .dmx-bub { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.dmx-m[data-role="visitor"][data-pos="last"] .dmx-bub { border-top-right-radius: 6px; }
.dmx-m[data-role="staff"] .dmx-bub { background: var(--dmx-staff); border-color: #EBCB6B; }
.dmx-m[data-role="staff"][data-pos="first"] .dmx-bub { border-bottom-left-radius: 6px; }
.dmx-m[data-role="staff"][data-pos="middle"] .dmx-bub { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.dmx-m[data-role="staff"][data-pos="last"] .dmx-bub { border-top-left-radius: 6px; }
.dmx-who { margin: 8px 0 3px 34px; font-size: 11.5px; font-weight: 700; color: var(--dmx-muted); }
.dmx-cap { margin: 10px 0 6px; text-align: center; font-size: 11.5px; color: var(--dmx-muted); }
.dmx-m[data-role="visitor"] .dmx-cap:last-child { text-align: right; margin: 4px 2px 0; }
.dmx-cap--note { margin: 12px 8px; padding: 6px 10px; border-radius: 10px; background: rgba(15, 31, 68, .06); }
.dmx-ind { margin-left: 34px; }

/* typing: a face and three square dots, in turn */
.dmx-typing { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 8px; background: #fff; border: 1px solid var(--dmx-line); border-radius: 18px; }
.dmx-typing .dmx-face { margin-right: 3px; }
.dmx-typing b { width: 6px; height: 6px; border-radius: 1px; background: var(--dmx-navy); animation: dmx-dot 1s infinite ease-in-out; }
.dmx-typing b:nth-of-type(2) { animation-delay: .15s; }
.dmx-typing b:nth-of-type(3) { animation-delay: .3s; background: var(--dmx-hl); }
@keyframes dmx-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* chips: links, hand-off, quick replies */
.dmx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-width: 0; }
.dmx-quick { margin-top: 12px; }
.dmx-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; max-width: 100%; padding: 0 13px; border-radius: 999px; cursor: pointer;
  background: #fff; border: 1px solid var(--dmx-line); color: var(--dmx-accent-dark); font: 700 13px/1.15 var(--dmx-font); text-decoration: none; transition: background .15s, border-color .15s; }
.dmx-chip span:not(.dmx-i) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dmx-chip:hover { border-color: var(--dmx-accent); background: #f7f9ff; }
.dmx-chip .dmx-i { width: 16px; height: 16px; }
.dmx-chip.is-wa { background: var(--dmx-wa); border-color: var(--dmx-wa); color: #06341a; }
.dmx-chip.is-wa:hover { background: #1fb957; }
.dmx-chip.is-main { background: var(--dmx-hl); border-color: var(--dmx-hl); color: var(--dmx-navy); }
.dmx-chip.is-main:hover { background: #f0b90f; }
.dmx-chip:focus-visible, .dmx-prod:focus-visible, .dmx-branch a:focus-visible, .dmx-react:focus-visible, .dmx-btn:focus-visible { outline: 2px solid var(--dmx-accent); outline-offset: 2px; }

/* product cards: photo, brand, title, today's price */
.dmx-prods { display: grid; gap: 6px; margin-top: 8px; min-width: 0; }
.dmx-prod { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 10px 7px 7px; background: #fff; border: 1px solid var(--dmx-line); border-radius: 14px; color: var(--dmx-ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.dmx-prod:hover { border-color: var(--dmx-accent); transform: translateY(-1px); }
.dmx-prod img { width: 56px; height: 56px; object-fit: contain; border-radius: 9px; background: #fff; }
.dmx-prod__t { display: grid; gap: 1px; min-width: 0; }
.dmx-prod__t small { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--dmx-muted); }
.dmx-prod__t b { font-size: 13.5px; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.dmx-prod__p { font-size: 13.5px; font-weight: 800; color: var(--dmx-accent-dark); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.dmx-prod__p small { font-weight: 600; color: var(--dmx-muted); }
.dmx-prod__p s { font-weight: 600; color: var(--dmx-muted); font-size: 12px; }
.dmx-prod__p em { font-style: normal; font-size: 11.5px; color: #b3261e; font-weight: 700; }

/* store cards */
.dmx-branches { display: grid; gap: 6px; margin-top: 8px; }
.dmx-branch { display: grid; gap: 2px; padding: 10px 12px; background: #fff; border: 1px solid var(--dmx-line); border-left: 4px solid var(--dmx-hl); border-radius: 14px; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.dmx-branch b { font: italic 800 17px/1.1 var(--dmx-head); text-transform: uppercase; color: var(--dmx-navy); }
.dmx-branch__ph { font-weight: 700; }
.dmx-branch__h { color: var(--dmx-muted); font-size: 12px; }
.dmx-branch__a { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dmx-branch__a a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 11px; border-radius: 999px; background: var(--dmx-navy); color: #fff; font-weight: 700; font-size: 12.5px; text-decoration: none; }
.dmx-branch__a a:hover { background: var(--dmx-accent); }
.dmx-branch__a .dmx-i { width: 15px; height: 15px; }

/* helpful / okay / not helpful */
.dmx-reacts { display: flex; gap: 4px; margin-top: 6px; }
.dmx-react { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; padding: 4px 4px 2px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: 600 10.5px/1.2 var(--dmx-font); color: var(--dmx-muted); transition: background .15s, opacity .15s; }
.dmx-react:hover:not(:disabled) { background: rgba(15, 31, 68, .06); }
.dmx-react:disabled { cursor: default; opacity: .4; }
.dmx-react[aria-pressed="true"] { opacity: 1; color: var(--dmx-navy); }

/* the "leave my number" card */
.dmx-card { margin-top: 10px; padding: 14px; background: #fff; border: 1px solid var(--dmx-line); border-radius: 16px; display: grid; gap: 8px; min-width: 0; }
.dmx-card__t { margin: 0; font: italic 800 18px/1.1 var(--dmx-head); text-transform: uppercase; color: var(--dmx-navy); }
.dmx-card__s { margin: 0; font-size: 13px; color: var(--dmx-muted); }
.dmx-card__err { margin: 0; font-size: 13px; color: #b3261e; font-weight: 600; }
.dmx-card__err[hidden] { display: none; }
.dmx-field { display: grid; gap: 3px; font-size: 12.5px; font-weight: 700; color: var(--dmx-muted); min-width: 0; }
.dmx-field input, .dmx-field select { width: 100%; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--dmx-line); border-radius: 10px; background: var(--dmx-field); color: var(--dmx-ink); font: 500 16px/1.2 var(--dmx-font); }
.dmx-field input:focus, .dmx-field select:focus { outline: 2px solid var(--dmx-accent); outline-offset: 0; border-color: transparent; background: #fff; }
.dmx-card__a { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.dmx-btn { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--dmx-line); background: #fff; color: var(--dmx-ink); font: 800 13px/1 var(--dmx-font); cursor: pointer; }
.dmx-btn.is-main { background: var(--dmx-accent); border-color: var(--dmx-accent); color: #fff; }
.dmx-btn.is-main:hover { background: var(--dmx-accent-dark); }
.dmx-btn:disabled { opacity: .6; cursor: wait; }

/* the field */
.dmx-chat-err { margin: 0; padding: 6px 14px; font-size: 13px; color: #b3261e; background: #fff4f2; border-top: 1px solid #f3d0cb; flex: none; }
.dmx-chat-err[hidden] { display: none; }
.dmx-chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: #fff; border-top: 1px solid var(--dmx-line); flex: none; }
.dmx-chat-form textarea { flex: 1; min-width: 0; height: 42px; min-height: 42px; max-height: 112px; resize: none; padding: 10px 15px; border: 1px solid var(--dmx-line); border-radius: 21px; background: var(--dmx-field); color: var(--dmx-ink); font: 500 16px/1.35 var(--dmx-font); }
.dmx-chat-form textarea::placeholder { color: #6d7180; }
.dmx-chat-form textarea:focus { outline: 2px solid var(--dmx-accent); outline-offset: 0; border-color: transparent; background: #fff; }
.dmx-chat-send { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--dmx-accent); color: #fff; cursor: pointer; transition: background .15s, opacity .15s; }
.dmx-chat-send:hover:not(:disabled) { background: var(--dmx-accent-dark); }
.dmx-chat-send:disabled { opacity: .4; cursor: default; }
.dmx-chat-send:focus-visible { outline: 2px solid var(--dmx-hl); outline-offset: 2px; }
.dmx-chat-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* ── a phone: a bottom sheet ──────────────────────────────────── */
@media (max-width: 760px) {
  .dmx-chat-fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); width: 54px; height: 54px; }
  .dmx-chat-panel {
    left: 0; right: 0; bottom: var(--dmx-kb, 0px); width: 100%; max-width: 100%;
    height: 88vh; height: min(88dvh, calc(var(--dmx-vh, 100dvh) - 10px)); max-height: none;
    border-radius: 22px 22px 0 0; transform: translateY(100%); transform-origin: bottom center;
  }
  .dmx-chat-panel[data-dmx-open="1"] { transform: translateY(var(--dmx-dy, 0px)); }
  .dmx-chat-panel.is-drag { transition: none; }
  .dmx-chat-grab { display: grid; place-items: center; height: 18px; background: var(--dmx-navy); flex: none; touch-action: none; cursor: grab; }
  .dmx-chat-grab i { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
  .dmx-chat-head { padding-top: 4px; touch-action: none; }
  .dmx-bub { font-size: 15px; }
}
@media (max-width: 360px) {
  .dmx-chat-rb { width: 34px; height: 34px; }
  .dmx-chat-title { font-size: 19px; }
  .dmx-ind { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dmx-chat-fab, .dmx-chat-fl, .dmx-chat-panel, .dmx-chat-panel[data-dmx-open="1"], .dmx-chat-scrim, .dmx-prod, .dmx-chat-log { transition: none !important; scroll-behavior: auto; }
  .dmx-typing b { animation: none; opacity: .7; }
}
@media print { .dmx-chat { display: none !important; } }
