/* Live support. Customer side (support.js): the launcher, the reply peek and the chat panel, on every public page and /app.
   Staff side (staff-support.js): the Support inbox in the staff console. Tokens come from brand.css. */

/* ============================================================== customer: launcher */
.vxs { --vxs-edge: 20px; --vxs-lift: 0px; --vxs-dodge: 0px; --vxs-bottom: max(var(--vxs-edge), calc(env(safe-area-inset-bottom) + 12px)); --vxs-right: max(var(--vxs-edge), calc(env(safe-area-inset-right) + 12px)); --vxs-launch-h: 52px; --vxs-ok: #3ccf8e; --vxs-unread: #d93d35; font: 400 15px/1.5 var(--body); color: var(--fg); }
/* Two independent shifts: --vxs-lift follows the scroll (footer, sticky calls to action), --vxs-dodge eases over a button once scrolling stops. */
.vxs-dock { position: fixed; right: var(--vxs-right); bottom: var(--vxs-bottom); z-index: 90; display: grid; justify-items: end; gap: 12px; pointer-events: none; transform: translate3d(0, calc(var(--vxs-lift) * -1), 0); translate: 0 calc(var(--vxs-dodge) * -1); transition: translate .45s var(--ease-out); }
.vxs-dock > * { pointer-events: auto; }
.vxs-dock[hidden] { display: none; }
/* Toasts sit above the launcher. The launcher's tokens live on .vxs, so the same sum is written out here (home bar included). */
html.vxs-on .toasts { bottom: calc(max(20px, env(safe-area-inset-bottom) + 12px) + 72px); }

.vxs-launch { position: relative; display: inline-flex; align-items: center; gap: 10px; height: var(--vxs-launch-h); padding: 0 22px 0 16px; border: 0; border-radius: 999px; background: var(--brand-solid); color: #fff; font: 600 15px/1 var(--body); letter-spacing: -.005em; cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(13, 10, 60, .2), 0 10px 28px -8px rgba(54, 44, 190, .55);
  opacity: 0; transform: translate3d(0, 14px, 0) scale(.94);
  transition: opacity .45s var(--ease-out), transform .55s var(--ease-out), background-color .18s ease, box-shadow .25s var(--ease-out); }
.vxs.is-ready .vxs-launch { opacity: 1; transform: none; }
.vxs-launch:hover { background: var(--brand-solid-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(13, 10, 60, .2), 0 14px 34px -8px rgba(54, 44, 190, .62); }
@media (hover: hover) and (pointer: fine) { .vxs.is-ready .vxs-launch:hover { transform: translate3d(0, -2px, 0); } }
.vxs.is-ready .vxs-launch:active { transform: scale(.96); transition-duration: .12s; }
.vxs-launch:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 999px; }
.vxs-launch-ic { position: relative; display: grid; place-items: center; width: 24px; height: 24px; }
.vxs-launch-ic svg { grid-area: 1 / 1; transition: opacity .2s ease, transform .35s var(--ease-out); }
.vxs-ic-down { opacity: 0; transform: rotate(-90deg) scale(.6); }
.vxs.is-open .vxs-ic-chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.vxs.is-open .vxs-ic-down { opacity: 1; transform: none; }
/* A small live dot on the icon when someone is at the inbox right now. */
.vxs-launch-dot { position: absolute; top: -1px; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: var(--vxs-ok); box-shadow: 0 0 0 2px var(--brand-solid); opacity: 0; transform: scale(.4); transition: opacity .3s ease, transform .4s var(--ease-out); }
.vxs.is-online .vxs-launch-dot { opacity: 1; transform: none; }
.vxs.is-open .vxs-launch-dot { opacity: 0; }
.vxs-badge { position: absolute; top: -6px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--vxs-unread); color: #fff; font: 700 12px/22px var(--body); text-align: center; box-shadow: 0 0 0 2px var(--bg); font-variant-numeric: tabular-nums; opacity: 0; transform: scale(.4); transition: opacity .2s ease, transform .35s var(--ease-out); pointer-events: none; }
.vxs.has-unread .vxs-badge { opacity: 1; transform: none; }
.vxs.bump .vxs-badge { animation: vxs-bump .6s var(--ease-out); }
@keyframes vxs-bump { 0% { transform: scale(.4); } 45% { transform: scale(1.18); } 100% { transform: none; } }

/* ============================================================== customer: the reply peek */
.vxs-peek { position: relative; width: min(316px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-pop); opacity: 0; transform: translate3d(0, 8px, 0) scale(.97); transform-origin: 100% 100%; transition: opacity .25s var(--ease-out), transform .4s var(--ease-out); }
.vxs-peek.is-in { opacity: 1; transform: none; }
.vxs-peek[hidden] { display: none; }
.vxs-peek-open { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; width: 100%; padding: 12px 34px 12px 12px; border: 0; background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; border-radius: 16px; }
.vxs-peek-ava { width: 32px; height: 32px; border-radius: 9px; }
.vxs-peek-copy { display: grid; gap: 2px; min-width: 0; }
.vxs-peek-name { font: 700 13.5px/1.3 var(--body); }
.vxs-peek-text { font-size: 14px; line-height: 1.45; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.vxs-peek-x { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: none; color: var(--fg-3); cursor: pointer; }
.vxs-peek-x:hover { background: var(--sunken); color: var(--fg); }

/* ============================================================== customer: the panel */
.vxs-panel { position: fixed; z-index: 91; right: var(--vxs-right); bottom: calc(var(--vxs-bottom) + var(--vxs-launch-h) + 14px + var(--vxs-lift));
  width: min(392px, calc(100vw - 32px)); height: min(640px, calc(100vh - var(--vxs-bottom) - var(--vxs-launch-h) - var(--vxs-lift) - 40px));
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--fg); border-radius: 20px;
  box-shadow: 0 0 0 1px rgba(124, 128, 156, .3), 0 2px 8px -2px rgba(13, 17, 23, .14), 0 32px 64px -24px rgba(13, 17, 23, .45);
  transform-origin: calc(100% - 26px) calc(100% + 26px); opacity: 0; transform: translate3d(0, 10px, 0) scale(.95); visibility: hidden;
  transition: opacity .16s ease, transform .22s var(--ease-out), visibility 0s linear .22s; }
@supports (height: 100dvh) { .vxs-panel { height: min(640px, calc(100dvh - var(--vxs-bottom) - var(--vxs-launch-h) - var(--vxs-lift) - 40px)); } }
.vxs-panel.is-open { opacity: 1; transform: none; visibility: visible; transition: opacity .2s ease, transform .38s var(--ease-out), visibility 0s; }
.vxs-panel:focus { outline: none; }
:root[data-theme="dark"] .vxs-panel { box-shadow: 0 0 0 1px rgba(160, 164, 200, .22), 0 32px 64px -20px rgba(0, 0, 0, .8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vxs-panel { box-shadow: 0 0 0 1px rgba(160, 164, 200, .22), 0 32px 64px -20px rgba(0, 0, 0, .8); } }

/* Header: ink in both themes, like the site nav. */
.vxs-head { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: start; padding: 16px 12px 16px 18px; background: var(--ink); color: var(--night-fg); isolation: isolate; overflow: hidden; box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .06); }
.vxs-head::before { content: ""; position: absolute; inset: -60% -20% auto 30%; height: 220%; z-index: -1; background: radial-gradient(closest-side, rgba(104, 96, 245, .26), transparent 72%); pointer-events: none; }
.vxs-ava { position: relative; flex: none; width: 44px; height: 44px; margin-top: 1px; }
.vxs-ava img { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .12); }
.vxs-ava-dot { position: absolute; right: -3px; bottom: -3px; width: 13px; height: 13px; border-radius: 50%; background: var(--night-fg-2); box-shadow: 0 0 0 2.5px var(--ink); opacity: 0; transition: opacity .3s ease, background-color .3s ease; }
.vxs.is-online .vxs-ava-dot { opacity: 1; background: var(--vxs-ok); }
.vxs-hg { min-width: 0; padding-top: 1px; }
.vxs-title { font: 700 17px/1.2 var(--display); letter-spacing: -.02em; color: var(--night-fg); }
.vxs-tag { margin-top: 3px; font-size: 13.5px; line-height: 1.4; color: var(--night-fg-2); }
.vxs-status { display: flex; align-items: center; gap: 7px; margin-top: 8px; font: 500 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--night-fg-2); }
.vxs-status[hidden] { display: none; }
.vxs-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--night-fg-2); opacity: .7; }
.vxs-status.on { color: #8fe3bd; }
.vxs-status.on .vxs-dot { background: var(--vxs-ok); opacity: 1; }
.vxs-status.on .vxs-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--vxs-ok); animation: vxs-ping 2.4s var(--ease-out) infinite; }
@keyframes vxs-ping { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(2.6); opacity: 0; } }
.vxs-x { display: grid; place-items: center; width: 38px; height: 38px; margin: -3px 0 0; border: 0; border-radius: 10px; background: transparent; color: var(--night-fg-2); cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.vxs-x:hover { background: rgba(255, 255, 255, .08); color: var(--night-fg); }
.vxs-x:focus-visible { outline: 2px solid var(--night-brand); outline-offset: 0; }

/* Messages */
.vxs-body { position: relative; flex: 1; min-height: 0; display: flex; }
.vxs-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.vxs-list:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 0; }
.vxs-list > :first-child:not(.vxs-intro) { margin-top: auto; }
.vxs-intro { padding: 4px 2px 10px; display: grid; gap: 10px; }
.vxs-intro-h { font: 700 21px/1.15 var(--display); letter-spacing: -.025em; }
.vxs-intro-p { font-size: 14.5px; line-height: 1.55; color: var(--fg-2); }
.vxs-intro-try { margin-top: 6px; font: 500 11.5px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.vxs-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vxs-chip { border: 1px solid var(--line-3); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 8px 13px; font: 500 13.5px/1.25 var(--body); text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .16s var(--ease-out); }
.vxs-chip:hover { border-color: var(--brand); background: var(--brand-tint); }
.vxs-chip:active { transform: scale(.97); }
.vxs-keep { margin-top: 6px; font-size: 12.5px; color: var(--fg-3); }
.vxs-keep a { color: var(--fg-2); }

.vxs-day { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.vxs-day::before, .vxs-day::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.vxs-sys { align-self: center; max-width: 88%; margin: 10px 0; text-align: center; font-size: 13px; line-height: 1.45; color: var(--fg-3); }
.vxs-g { display: flex; gap: 9px; margin-top: 8px; }
.vxs-g.me { justify-content: flex-end; }
.vxs-g-ava { flex: none; align-self: flex-end; width: 28px; height: 28px; border-radius: 8px; margin-bottom: 21px; }
.vxs-g-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: 84%; }
.vxs-g.me .vxs-g-col { align-items: flex-end; }
.vxs-g-name { font-size: 12.5px; font-weight: 600; color: var(--fg-3); margin: 0 0 2px 2px; }
.vxs-msg { padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; width: fit-content; max-width: 100%; }
.vxs-g.them .vxs-msg { background: var(--surface); border: 1px solid var(--line-2); color: var(--fg); border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.vxs-g.them .vxs-msg:first-of-type { border-top-left-radius: 18px; }
.vxs-g.them .vxs-msg:last-of-type { border-bottom-left-radius: 18px; }
.vxs-g.me .vxs-msg { background: var(--brand-solid); color: #fff; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.vxs-g.me .vxs-msg:first-of-type { border-top-right-radius: 18px; }
.vxs-g.me .vxs-msg:last-of-type { border-bottom-right-radius: 18px; }
.vxs-g.me .vxs-g-col > .vxs-msg:only-of-type { border-radius: 18px 18px 6px 18px; }
.vxs-g.them .vxs-g-col > .vxs-msg:only-of-type { border-radius: 18px 18px 18px 6px; }
.vxs-msg.is-sending { opacity: .62; }
.vxs-msg.is-failed { background: transparent !important; color: var(--fg) !important; box-shadow: inset 0 0 0 1.5px var(--bad); }
.vxs-msg.is-new { animation: vxs-msg-in .36s var(--ease-out) both; }
.vxs-g.me .vxs-msg.is-new { transform-origin: 100% 100%; }
.vxs-g.them .vxs-msg.is-new { transform-origin: 0 100%; }
@keyframes vxs-msg-in { from { opacity: 0; transform: translate3d(0, 8px, 0) scale(.96); } }
.vxs-time, .vxs-state { font: 400 11.5px/1.3 var(--mono); color: var(--fg-3); margin: 2px 4px 0; font-variant-numeric: tabular-nums; }
.vxs-state.bad { font-family: var(--body); font-size: 12.5px; color: var(--bad); }
.vxs-link { border: 0; background: none; padding: 0; color: var(--brand-fg); font: 600 12.5px/1.3 var(--body); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.vxs-jump { position: absolute; left: 50%; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 14px; border: 0; border-radius: 999px; background: var(--fg); color: var(--bg); font: 600 13px/1 var(--body); box-shadow: var(--shadow-pop); transform: translateX(-50%); cursor: pointer; animation: vxs-fade .25s var(--ease-out); }
.vxs-jump[hidden] { display: none; }
@keyframes vxs-fade { from { opacity: 0; } }

/* Composer */
.vxs-compose { flex: none; display: grid; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-2); }
.vxs-note { margin: -10px -12px 2px; padding: 10px 16px; background: var(--sunken); color: var(--fg-2); font-size: 13px; line-height: 1.45; border-bottom: 1px solid var(--line-1); }
.vxs-note[hidden], .vxs-who[hidden], .vxs-signed[hidden] { display: none; }
.vxs-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.vxs-fld { display: grid; gap: 4px; min-width: 0; }
.vxs-fld label { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.vxs-opt { font-weight: 400; color: var(--fg-3); }
.vxs-in { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-3); border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 14.5px; }
.vxs-in:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.vxs-who-hint { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.4; color: var(--fg-3); }
.vxs-signed { font-size: 12.5px; color: var(--fg-3); overflow-wrap: anywhere; }
.vxs-err { font-size: 13px; font-weight: 500; color: var(--bad); }
.vxs-err:empty { display: none; }
.vxs-field { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; background: var(--bg); border: 1px solid var(--line-3); border-radius: 16px; transition: border-color .15s ease, box-shadow .2s ease; }
.vxs-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.vxs-ta { flex: 1; min-width: 0; min-height: 36px; max-height: 132px; padding: 7px 0; border: 0; background: transparent; color: var(--fg); font-size: 15px; line-height: 1.45; resize: none; outline: none; }
.vxs-ta::placeholder { color: var(--fg-3); }
.vxs-send { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 11px; background: var(--brand-solid); color: #fff; cursor: pointer; transition: opacity .15s ease, transform .16s var(--ease-out), background-color .15s ease; }
.vxs-send:hover:not([disabled]) { background: var(--brand-solid-hover); }
.vxs-send:active:not([disabled]) { transform: scale(.92); }
.vxs-send[disabled] { opacity: .38; cursor: default; }
.vxs-send:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.vxs-meta { display: flex; justify-content: space-between; gap: 10px; min-height: 15px; padding: 0 4px; font: 400 11.5px/1.3 var(--mono); color: var(--fg-3); }
.vxs-keys { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vxs-meta:has(.vxs-count:not(:empty)) .vxs-keys { display: none; }
.vxs-count { margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--fg-3); }
.vxs-count.near { color: var(--warn); font-weight: 500; }
@media (pointer: coarse) { .vxs-keys { display: none; } .vxs-meta:has(.vxs-count:empty) { display: none; } }

/* ============================================================== customer: next to a page's own controls */
/* An open Studio sheet is a modal: the launcher and the panel step out of the way until it closes (html.ssh-open, studio-sheet.js). */
html.ssh-open .vxs { visibility: hidden; }
/* The Studio's workspace: the round launcher, so it covers as little of the rail as it can. */
body.has-sw-dock .vxs { --vxs-launch-h: 52px; }
body.has-sw-dock .vxs-launch { width: 52px; padding: 0; justify-content: center; }
body.has-sw-dock .vxs-launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* On a phone the Studio's bar carries its own Live support button (data-support-open), so the floating one is not drawn twice. */
@media (max-width: 767px) { html.vxs-docked .vxs-dock { display: none; } }

/* ============================================================== customer: phones */
@media (max-width: 560px) {
  .vxs { --vxs-edge: 16px; --vxs-launch-h: 56px; }
  .vxs-launch { width: 56px; padding: 0; justify-content: center; }
  .vxs-launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .vxs-launch-ic, .vxs-launch-ic svg { width: 26px; height: 26px; }
  .vxs.is-open .vxs-dock { visibility: hidden; transition: visibility 0s linear .2s; }
  .vxs-panel { inset: 0; width: auto; height: auto; border-radius: 0; box-shadow: none; transform-origin: 50% 100%; transform: translate3d(0, 28px, 0); }
  @supports (height: 100dvh) { .vxs-panel { height: 100dvh; bottom: auto; } }
  .vxs-head { padding-top: calc(14px + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); }
  .vxs-list { padding-inline: 14px; }
  .vxs-g-col { max-width: 86%; }
  .vxs-ta { font-size: 16px; }   /* 16 px stops iOS zooming into the field */
  .vxs-in { font-size: 16px; }
  html.vxs-on .toasts { bottom: calc(max(16px, env(safe-area-inset-bottom) + 12px) + 68px); }
}
html.vxs-lock, html.vxs-lock body { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .vxs-launch, .vxs-peek, .vxs-panel, .vxs-panel.is-open { transform: none !important; transition: opacity .2s ease, visibility 0s linear .2s !important; }
  .vxs-panel.is-open { transition: opacity .2s ease, visibility 0s !important; }
  .vxs-msg.is-new { animation: vxs-fade .2s ease both; }
  .vxs-status.on .vxs-dot::after, .vxs.bump .vxs-badge { animation: none; }
}
@media print { .vxs { display: none !important; } }

/* ============================================================== staff: Support inbox */
.sx-tab-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--vxs-unread, #d93d35); color: #fff; font: 700 11.5px/1 var(--body); font-variant-numeric: tabular-nums; }
.sx-tab-badge[hidden] { display: none; }
.sx { --sx-h: calc(100vh - 168px); display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); height: max(520px, var(--sx-h)); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); overflow: hidden; }
@supports (height: 100dvh) { .sx { --sx-h: calc(100dvh - 168px); } }
.sx-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line-2); }
.sx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line-2); }
.sx-tools .grow { flex: 1; }
.sx-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunken); border-radius: 10px; }
.sx-seg button { border: 0; background: none; color: var(--fg-3); padding: 6px 10px; border-radius: 8px; font: 600 13px/1 var(--body); cursor: pointer; }
.sx-seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(13, 17, 23, .12); }
.sx-alerts { display: inline-flex; align-items: center; gap: 6px; }
.sx-alerts svg { width: 16px; height: 16px; }
.sx-alerts[aria-pressed="true"] { color: var(--ok); }
.sx-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.sx-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 4px 11px; width: 100%; padding: 13px 14px 13px 11px; border: 0; border-left: 3px solid transparent; border-bottom: 1px solid var(--line-1); background: none; color: var(--fg); text-align: left; font: inherit; cursor: pointer; transition: background-color .12s ease; }
.sx-item:hover { background: var(--sunken); }
.sx-item[aria-current="true"] { background: var(--brand-tint); border-left-color: var(--brand); }
.sx-item:focus-visible { outline-offset: -3px; }
.sx-init { grid-row: span 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--sunken); color: var(--fg-2); font: 700 15px/1 var(--display); text-transform: uppercase; }
.sx-item.is-unread .sx-init { background: var(--brand-solid); color: #fff; }
.sx-name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-item.is-unread .sx-name { font-weight: 700; }
.sx-when { font: 400 11.5px/1.6 var(--mono); color: var(--fg-3); white-space: nowrap; text-align: right; }
.sx-prev { grid-column: 2; font-size: 13.5px; color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-item.is-unread .sx-prev { color: var(--fg); }
.sx-count { grid-column: 3; justify-self: end; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand-solid); color: #fff; font: 700 11.5px/20px var(--body); text-align: center; }
.sx-tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; font: 400 11.5px/1.4 var(--mono); color: var(--fg-3); }
.sx-tags b { font-weight: 500; color: var(--brand-fg); }
.sx-tags .closed { color: var(--fg-3); font-style: italic; }
.sx-empty { padding: 28px 18px; color: var(--fg-3); font-size: 14px; }
.sx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.sx-convo { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sx-blank { margin: auto; padding: 32px; max-width: 42ch; text-align: center; color: var(--fg-3); display: grid; gap: 10px; justify-items: center; }
.sx-blank img { width: 56px; height: 56px; border-radius: 16px; }
.sx-blank h3 { color: var(--fg); font-size: 1.15rem; }
.sx-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line-2); }
.sx-back { display: none; }
.sx-who { flex: 1; min-width: 0; }
.sx-who h3 { font-size: 1.05rem; overflow-wrap: anywhere; }
.sx-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font: 400 12px/1.5 var(--mono); color: var(--fg-3); }
.sx-meta a { color: var(--fg-2); }
.sx-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 18px 10px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.sx-msgs > :first-child { margin-top: auto; }
.sx-day { display: flex; align-items: center; gap: 12px; margin: 12px 0 6px; font: 500 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--fg-3); }
.sx-day::before, .sx-day::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.sx-m { max-width: min(78%, 620px); display: grid; gap: 3px; margin-top: 6px; }
.sx-m.customer { align-self: flex-start; }
.sx-m.staff { align-self: flex-end; justify-items: end; }
.sx-m.system { align-self: center; text-align: center; font-size: 13px; color: var(--fg-3); }
.sx-b { padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.sx-m.customer .sx-b { background: var(--surface); border: 1px solid var(--line-2); border-bottom-left-radius: 6px; }
.sx-m.staff .sx-b { background: var(--brand-solid); color: #fff; border-bottom-right-radius: 6px; }
.sx-m.is-sending .sx-b { opacity: .6; }
.sx-by { font: 400 11.5px/1.3 var(--mono); color: var(--fg-3); padding: 0 4px; }
.sx-compose { display: grid; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line-2); }
.sx-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sx-quick::-webkit-scrollbar { display: none; }
.sx-quick button { flex: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line-3); background: var(--bg); color: var(--fg-2); border-radius: 999px; padding: 6px 11px; font: 500 13px/1.2 var(--body); cursor: pointer; }
.sx-quick button:hover { border-color: var(--brand); color: var(--fg); background: var(--brand-tint); }
.sx-quick .sx-edit { border-style: dashed; color: var(--fg-3); }
.sx-field { display: flex; align-items: flex-end; gap: 8px; padding: 5px 5px 5px 14px; background: var(--bg); border: 1px solid var(--line-3); border-radius: 14px; }
.sx-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.sx-ta { flex: 1; min-width: 0; min-height: 38px; max-height: 180px; padding: 8px 0; border: 0; background: transparent; color: var(--fg); font-size: 15px; line-height: 1.45; resize: none; outline: none; }
.sx-send { flex: none; min-height: 38px; padding: 0 16px; border-radius: 10px; }
.sx-foot { display: flex; justify-content: space-between; gap: 10px; font: 400 11.5px/1.3 var(--mono); color: var(--fg-3); padding: 0 4px; }
@media (pointer: coarse) { .sx-foot > span:first-child { display: none; } }   /* no Enter key to speak of on a touch keyboard */
.sx-foot .near { color: var(--warn); }
.sx-qedit[hidden] { display: none; }
.sx-qedit { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--line-3); border-radius: 12px; background: var(--bg); }
.sx-qedit textarea { min-height: 150px; font-size: 14px; }
.sx-qedit .row { margin-top: 0; }
.sx-off { padding: 14px 16px; margin: 12px; border-radius: 10px; background: var(--warn-tint); color: var(--fg); font-size: 14px; }

@media (max-width: 760px) {
  .sx { grid-template-columns: 1fr; --sx-h: calc(100vh - 190px); border-radius: 12px; }
  @supports (height: 100dvh) { .sx { --sx-h: calc(100dvh - 190px); } }
  .sx-head { padding: 8px 12px 12px; }
  .sx-head .chip { margin-left: auto; }
  .sx-who { order: 1; flex-basis: 100%; }
  .sx-back { margin-left: -8px; }
  .sx.has-sel .sx-side { display: none; }
  .sx:not(.has-sel) .sx-main { display: none; }
  .sx-side { border-right: 0; }
  .sx-back { display: inline-flex; }
  .sx-m { max-width: 88%; }
  .sx-ta { font-size: 16px; }
}
