/* =====================================================================
   Live chat widget (v3.3). Uses the site theme tokens, so it follows the
   colour theme and light/dark mode. Text on the accent colour always uses
   --accent-contrast (never a hard-coded white) to avoid colour clashes.
   ===================================================================== */
.mjc { --mjc-w: 380px; --mjc-h: 620px; --mjc-r: 22px; position: fixed; right: 20px; bottom: 20px; z-index: 1500; font-family: var(--font, inherit); color: var(--text); }
.mjc *, .mjc *::before, .mjc *::after { box-sizing: border-box; }
.mjc [hidden] { display: none !important; }
.mjc button { font: inherit; cursor: pointer; }

/* launcher */
.mjc-launcher { width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-contrast); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); position: relative; transition: transform .15s, box-shadow .15s; }
.mjc-launcher:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 32px rgba(0, 0, 0, .32); }
.mjc-launcher:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
.mjc-launcher__close { display: none; }
.mjc[data-state="open"] .mjc-launcher__open { display: none; }
.mjc[data-state="open"] .mjc-launcher__close { display: flex; }
.mjc-badge { position: absolute; top: -3px; right: -3px; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 99px; background: #D92D20; color: #fff; font-size: .72rem; font-weight: 700; line-height: 21px; text-align: center; box-shadow: 0 0 0 2px var(--paper-raised, #fff); }

/* panel */
.mjc-panel { position: absolute; right: 0; bottom: 76px; width: var(--mjc-w); height: var(--mjc-h); max-height: calc(100vh - 110px); background: var(--paper-raised); color: var(--text); border-radius: var(--mjc-r); box-shadow: 0 24px 60px rgba(0, 0, 0, .28), 0 0 0 1px var(--line); overflow: hidden; display: flex; flex-direction: column; transform-origin: bottom right; animation: mjc-in .18s ease-out; }
@keyframes mjc-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.mjc-view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* home */
.mjc-home { flex: 1; min-height: 0; overflow-y: auto; background: var(--paper-sunken); }
.mjc-home__top { padding: 30px 26px 26px; color: var(--accent-contrast); background: var(--accent); position: relative; }
.mjc-home__top + .mjc-cards { margin-top: -1px; padding-top: 0; background: linear-gradient(180deg, var(--accent) 0, var(--accent) 60px, transparent 60px); }
.mjc-home__x { position: absolute; top: 12px; right: 12px; color: var(--accent-contrast) !important; }
.mjc-home__hi { margin: 0 0 10px; font-size: 2rem; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; color: var(--accent-contrast); }
.mjc-home__intro { margin: 0 0 14px; font-size: 1rem; line-height: 1.55; color: var(--accent-contrast); opacity: .95; }
.mjc-cards { padding: 0 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.mjc-card { width: 100%; text-align: left; display: block; background: var(--paper-raised); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: 0 6px 20px rgba(0, 0, 0, .08); }
.mjc-card h3 { margin: 0 0 12px; font-size: 1.05rem; color: var(--text); }
.mjc-card--start { display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: transform .15s, box-shadow .15s; }
.mjc-card--start:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .12); }
.mjc-card__txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mjc-card__txt strong { font-size: 1.05rem; color: var(--text); }
.mjc-card__txt small { font-size: .86rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mjc-card__go { color: var(--accent-deep); flex-shrink: 0; }
html[data-mode="dark"] .mjc-card__go { color: var(--accent); }
.mjc-search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-strong, var(--line)); border-radius: 12px; padding: 0 14px; background: var(--paper); color: var(--text-muted); }
.mjc-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.mjc-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 13px 0; font: inherit; font-size: .95rem; color: var(--text); }
.mjc-search input::placeholder { color: var(--text-muted); }
.mjc-help { list-style: none; margin: 10px 0 0; padding: 0; }
.mjc-help li button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 6px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; color: var(--text); border-radius: 8px; }
.mjc-help li:last-child button { border-bottom: 0; }
.mjc-help li button:hover { background: var(--paper-sunken); }
.mjc-help li strong { font-size: .9rem; font-weight: 600; color: var(--text); }
.mjc-help li span { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }
.mjc-help__empty { font-size: .85rem; color: var(--text-muted); padding: 8px 4px; }
.mjc-help__all { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: .84rem; font-weight: 600; color: var(--text) !important; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }

/* status pill */
.mjc-status { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 600; padding: 4px 10px 4px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent-contrast) 14%, transparent); color: var(--accent-contrast); }
.mjc-status i { width: 8px; height: 8px; border-radius: 50%; background: #F79009; box-shadow: 0 0 0 3px color-mix(in srgb, #F79009 30%, transparent); }
.mjc-status.is-online i { background: #12B76A; box-shadow: 0 0 0 3px rgba(18, 183, 106, .3); }
.mjc-status--sm { padding: 0; background: none; font-weight: 500; font-size: .76rem; opacity: .92; }

/* shared header */
.mjc-head { display: flex; align-items: center; gap: 6px; padding: 14px 12px; background: var(--accent); color: var(--accent-contrast); flex-shrink: 0; min-height: 72px; }
.mjc-head__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mjc-head__title { flex: 1; font-size: 1.2rem; font-weight: 700; color: var(--accent-contrast); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mjc-iconbtn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.mjc-iconbtn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.mjc-iconbtn:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; }

/* menu */
.mjc-menuwrap { position: relative; }
.mjc-menu { position: absolute; right: 0; top: 46px; z-index: 5; min-width: 240px; background: var(--paper-raised); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, .2); padding: 6px; }
.mjc-menu::before { content: ""; position: absolute; top: -7px; right: 14px; width: 12px; height: 12px; background: var(--paper-raised); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.mjc-menu button, .mjc-menu a { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; background: none; color: var(--text) !important; font-size: .95rem; text-align: left; border-radius: 10px; text-decoration: none; }
.mjc-menu button:hover, .mjc-menu a:hover { background: var(--paper-sunken); }
.mjc-menu svg { color: var(--text-muted); flex-shrink: 0; }

/* thread */
.mjc-offline { padding: 10px 16px; font-size: .84rem; background: var(--warn-soft, #FEF0C7); color: var(--text); border-bottom: 1px solid var(--line); }
.mjc-thread { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--paper-raised); scroll-behavior: smooth; }
.mjc-day { align-self: center; font-size: .72rem; font-weight: 600; color: var(--text-muted); background: var(--paper-sunken); border-radius: 99px; padding: 3px 10px; margin: 10px 0 6px; }
.mjc-row { display: flex; gap: 10px; align-items: flex-end; max-width: 100%; }
.mjc-row--visitor { justify-content: flex-end; }
.mjc-row + .mjc-row--staff.is-first, .mjc-row + .mjc-row--visitor.is-first { margin-top: 10px; }
.mjc-av { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; background: var(--paper-sunken); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.mjc-av img { width: 100%; height: 100%; object-fit: cover; }
.mjc-av--ghost { visibility: hidden; }
.mjc-col { display: flex; flex-direction: column; gap: 3px; max-width: 78%; min-width: 0; }
.mjc-row--visitor .mjc-col { align-items: flex-end; }
.mjc-who { font-size: .78rem; color: var(--text-muted); padding: 0 4px; }
.mjc-bubble { padding: 10px 14px; border-radius: 16px; font-size: .95rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.mjc-row--staff .mjc-bubble { background: #0B7A48; color: #fff; border-bottom-left-radius: 6px; }
html[data-mode="dark"] .mjc-row--staff .mjc-bubble { background: #0B7A48; }
.mjc-row--visitor .mjc-bubble { background: var(--accent); color: var(--accent-contrast); border-bottom-right-radius: 6px; }
.mjc-bubble a { color: inherit; text-decoration: underline; }
.mjc-bubble--emoji { background: transparent !important; color: inherit !important; font-size: 2.2rem; padding: 0 4px; line-height: 1.1; }
.mjc-time { font-size: .7rem; color: var(--text-muted); padding: 0 4px; }
.mjc-row.is-pending .mjc-bubble { opacity: .6; }
.mjc-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--paper-sunken); border: 1px solid var(--line); color: var(--text) !important; text-decoration: none; max-width: 260px; }
.mjc-file:hover { border-color: var(--accent); }
.mjc-file__ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: .66rem; font-weight: 800; text-transform: uppercase; flex-shrink: 0; }
.mjc-file__meta { min-width: 0; display: flex; flex-direction: column; }
.mjc-file__meta strong { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mjc-file__meta small { font-size: .75rem; color: var(--text-muted); }
.mjc-img { display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); max-width: 230px; background: var(--paper-sunken); }
.mjc-img img { display: block; max-width: 100%; max-height: 220px; object-fit: cover; }
.mjc-quick { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 12px 0 4px; }
.mjc-quick button { border: 1.5px solid var(--accent); background: var(--paper-raised); color: var(--accent-deep); border-radius: 14px; padding: 9px 18px; font-size: .95rem; box-shadow: 0 2px 6px rgba(0, 0, 0, .06); transition: background .15s, color .15s; }
html[data-mode="dark"] .mjc-quick button { color: var(--accent); }
.mjc-quick button:hover, .mjc-quick button:focus-visible,
html[data-mode] .mjc-quick button:hover, html[data-mode] .mjc-quick button:focus-visible { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); outline: 0; }
.mjc-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.mjc-typing i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; animation: mjc-dot 1s infinite; }
.mjc-typing i:nth-child(2) { animation-delay: .15s; } .mjc-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mjc-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: .9; } }

/* identify card (also the gate before a first chat) */
.mjc.is-gated .mjc-quick { display: none; }
.mjc-identify { margin: 0 14px 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .06); }
.mjc-identify strong { font-size: 1rem; color: var(--text); }
.mjc-identify p { margin: 0 0 2px; font-size: .84rem; color: var(--text-muted); }
.mjc-identify input { width: 100%; border: 1px solid var(--line-strong, var(--line)); border-radius: 10px; padding: 11px 12px; font: inherit; font-size: .92rem; background: var(--paper-raised); color: var(--text); }
.mjc-identify input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.mjc-identify__row { display: flex; gap: 8px; justify-content: flex-end; }
.mjc-btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; background: var(--accent); color: var(--accent-contrast); }
.mjc-btn--ghost { background: var(--paper-sunken); color: var(--text); }
.mjc-err { font-size: .8rem; color: var(--danger, #D92D20); min-height: 1em; }

/* composer */
.mjc-compose { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 10px 10px 10px 18px; border-top: 1px solid var(--line); background: var(--paper-raised); flex-shrink: 0; }
.mjc-compose textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: .95rem; line-height: 1.4; color: var(--text); padding: 10px 0; max-height: 120px; }
.mjc-compose textarea::placeholder { color: var(--text-muted); }
.mjc-compose__tools { display: flex; align-items: center; gap: 0; color: var(--text); }
.mjc-compose__tools .mjc-iconbtn { width: 38px; height: 38px; color: var(--text); }
.mjc-send { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; }
.mjc-emojis { position: absolute; right: 10px; bottom: 62px; width: 276px; max-height: 220px; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 36px rgba(0, 0, 0, .18); z-index: 6; }
.mjc-emojis button { border: 0; background: none; font-size: 1.35rem; line-height: 1; padding: 5px 0; border-radius: 8px; }
.mjc-emojis button:hover { background: var(--paper-sunken); }

/* upload + drop + toast */
.mjc-drop { position: absolute; inset: 72px 0 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: color-mix(in srgb, var(--paper-raised) 90%, transparent); border: 3px dashed var(--accent); border-radius: 0 0 var(--mjc-r) var(--mjc-r); color: var(--text); font-weight: 600; }
.mjc-upbar { padding: 8px 16px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; background: var(--paper-raised); }
.mjc-upbar i { display: block; height: 5px; border-radius: 99px; background: var(--paper-sunken); overflow: hidden; }
.mjc-upbar b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.mjc-toast { position: absolute; left: 14px; right: 14px; bottom: 74px; z-index: 8; padding: 10px 14px; border-radius: 12px; background: var(--text); color: var(--paper-raised); font-size: .85rem; box-shadow: 0 10px 24px rgba(0, 0, 0, .2); }

/* article */
.mjc-article { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 24px; font-size: .92rem; line-height: 1.65; color: var(--text); }
.mjc-article h1 { font-size: 1.25rem; margin: 0 0 12px; color: var(--text); }
.mjc-article p, .mjc-article li { color: var(--text); }
.mjc-article img { max-width: 100%; height: auto; border-radius: 10px; }
.mjc-article a { color: var(--accent-deep); }
.mjc-article__more { display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; font-weight: 600; }

/* bottom tabs */
.mjc-tabs { display: flex; flex-shrink: 0; border-top: 1px solid var(--line); background: var(--paper-raised); box-shadow: 0 -4px 14px rgba(0, 0, 0, .04); }
.mjc-tabs button { flex: 1; height: 64px; border: 0; background: none; color: var(--text); display: flex; align-items: center; justify-content: center; position: relative; }
.mjc-tabs button.is-on { color: var(--accent-deep); }
html[data-mode="dark"] .mjc-tabs button.is-on { color: var(--accent); }
.mjc-tabs__dot { position: absolute; top: 16px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: #D92D20; }
.mjc[data-view="chat"] .mjc-tabs, .mjc[data-view="article"] .mjc-tabs { display: none; }

/* phones: full screen */
@media (max-width: 560px) {
    .mjc { right: 14px; bottom: 14px; }
    .mjc[data-state="open"] .mjc-panel { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; bottom: auto; right: auto; }
    .mjc[data-state="open"] .mjc-launcher { display: none; }
    .mjc-home__x { display: inline-flex; }
}
@media (min-width: 561px) { .mjc-home__x { display: none; } .mjc--popout .mjc-home__x { display: none; } }
body.has-bottomnav .mjc { bottom: calc(80px + env(safe-area-inset-bottom)); }
body:has(.svx-buybar) .mjc { bottom: 84px; }
@media (min-width: 901px) { body.has-bottomnav .mjc { bottom: 20px; } }

/* pop-out window: the panel is the page */
.mjc--popout { position: static; }
.mjc--popout .mjc-launcher { display: none; }
.mjc--popout .mjc-panel { position: static; width: min(420px, 100vw); height: min(680px, 100vh); max-height: 100vh; animation: none; }
