/* Live support widget: a floating chat window anchored bottom-right, next to the launcher.
   Follows v2.css tokens; scoped under .yxs-* so it never touches page styles. No page mask. */
.yxs-root, .yxs-launch {
  --yxs-paper: #F4F4F1;
  --yxs-white: #FFFFFF;
  --yxs-ground: #E8E7E4;
  --yxs-ink: #1D242A;
  --yxs-muted: #5E666D;
  --yxs-line: rgba(29, 36, 42, .14);
  --yxs-control: #7A848D;
  --yxs-accent: #2346D8;
  --yxs-ok: #2E7D52;
  --yxs-error: #B42318;
  --yxs-error-bg: #FBEFEE;
  --yxs-sans: "Inter", "Source Sans 3", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", system-ui, sans-serif;
  --yxs-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --yxs-gap: 24px;
  font-family: var(--yxs-sans);
  color: var(--yxs-ink);
  letter-spacing: 0;
}
html.yxs-locked, html.yxs-locked body { overflow: hidden; }
.yxs-root [hidden], .yxs-launch[hidden], .yxs-launch [hidden], .yxs-panel[hidden] { display: none !important; }
.yxs-root *, .yxs-launch * { box-sizing: border-box; }
.yxs-root p, .yxs-root h2, .yxs-root h3, .yxs-root ol, .yxs-root ul, .yxs-root dl, .yxs-root dd, .yxs-root fieldset { margin: 0; }
.yxs-root :focus-visible, .yxs-launch:focus-visible { outline: 2px solid var(--yxs-accent); outline-offset: 2px; }
.yxs-ic { width: 18px; height: 18px; flex: none; }
.yxs-mono { font-family: var(--yxs-mono); font-size: 12px; }
.yxs-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.yxs-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Window */
.yxs-panel {
  --yxs-lift: 0px;
  position: fixed; z-index: 1000; right: var(--yxs-gap); bottom: var(--yxs-gap);
  width: 380px; height: min(600px, calc(100vh - 2 * var(--yxs-gap))); height: min(600px, calc(100dvh - 2 * var(--yxs-gap)));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--yxs-paper); border: 1px solid var(--yxs-line); border-radius: 8px;
  box-shadow: 0 8px 28px rgba(29, 36, 42, .14), 0 1px 3px rgba(29, 36, 42, .08);
  font-size: 15px; line-height: 1.55;
  opacity: 0; transform: translateY(8px); transition: opacity 160ms ease, transform 180ms ease;
}
.yxs-panel.is-open { opacity: 1; transform: none; }
.yxs-panel:focus { outline: none; }

/* Header */
.yxs-head { padding: 12px 8px 10px 16px; border-bottom: 1px solid var(--yxs-line); background: var(--yxs-white); }
.yxs-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.yxs-title-wrap { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.yxs-title { font-size: 16px; line-height: 1.3; font-weight: 600; }
.yxs-live { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--yxs-ink); line-height: 1.35; }
.yxs-live.is-off { color: var(--yxs-muted); }
.yxs-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--yxs-ok); flex: none; }
.yxs-live.is-off .yxs-dot { background: #A1A8AE; }
.yxs-head-act { display: flex; align-items: center; gap: 0; flex: none; }
.yxs-head-act .yxs-icon-btn { width: 40px; height: 40px; }
.yxs-head-act .yxs-icon-btn[aria-expanded="true"] { border-color: var(--yxs-line); background: var(--yxs-paper); color: var(--yxs-accent); }
.yxs-sub { margin-top: 8px; padding-right: 8px; display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.yxs-agent { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--yxs-muted); }
.yxs-agent.is-set { color: var(--yxs-ink); font-weight: 500; }
.yxs-agent .yxs-ic { width: 15px; height: 15px; }
.yxs-agent-t { overflow-wrap: anywhere; }
.yxs-wecom-link { min-height: 28px; font-size: 13px; color: var(--yxs-muted); }
.yxs-wecom-link[aria-expanded="true"] { color: var(--yxs-accent); }
.yxs-code { display: none; }

.yxs-icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--yxs-ink); cursor: pointer; padding: 0;
}
@media (hover: hover) { .yxs-icon-btn:hover { border-color: var(--yxs-line); background: var(--yxs-paper); } }
.yxs-icon-btn.yxs-sm { width: 36px; height: 36px; }
.yxs-icon-btn.yxs-xs { width: 28px; height: 28px; }
.yxs-icon-btn[disabled] { opacity: .5; cursor: default; }

/* WeCom QR (header drop-down and in-chat card) */
.yxs-wecom { display: flex; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--yxs-line); background: var(--yxs-white); }
.yxs-qr { width: 120px; height: 120px; flex: none; border: 1px solid var(--yxs-line); border-radius: 4px; background: #fff; object-fit: contain; }
.yxs-qr-sm { width: 104px; height: 104px; }
.yxs-wecom-t { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.yxs-wecom-h { font-size: 14px; font-weight: 500; line-height: 1.45; }
.yxs-qr-ph { font-size: 12px; color: #7A4810; background: #F6EBDD; padding: 2px 6px; border-radius: 3px; }
.yxs-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; background: var(--yxs-white) !important; border: 1px solid var(--yxs-line); }
.yxs-card .yxs-body-t { grid-column: 1 / -1; }
.yxs-card-t { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 13px; min-width: 0; }
.yxs-from-agent.yxs-card-msg { max-width: 100%; }

/* Views */
.yxs-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.yxs-chat, .yxs-briefview { background: var(--yxs-paper); }
.yxs-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px 24px; }
.yxs-foot { padding: 12px 16px; border-top: 1px solid var(--yxs-line); background: var(--yxs-paper); }
.yxs-subhead { display: flex; align-items: center; gap: 8px; padding: 4px 12px; border-bottom: 1px solid var(--yxs-line); background: var(--yxs-white); min-height: 44px; }
.yxs-subtitle { font-size: 14px; font-weight: 600; margin-left: auto !important; padding-right: 4px; }
.yxs-back { font-size: 13px; text-decoration: none; }
.yxs-brief-intro { margin: 0 0 16px; }

/* Chat log */
.yxs-banner { padding: 8px 16px; font-size: 13px; background: #FFF6E5; color: #6B4A00; border-bottom: 1px solid var(--yxs-line); }
.yxs-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 14px; }
.yxs-log:focus-visible { outline-offset: -2px; }
.yxs-msg { max-width: 88%; display: flex; flex-direction: column; min-width: 0; }
.yxs-from-visitor { align-self: flex-end; align-items: flex-end; }
.yxs-from-agent { align-self: flex-start; }
.yxs-from-system { align-self: stretch; max-width: none; }
.yxs-meta { display: flex; gap: 8px; font-size: 12px; color: var(--yxs-muted); margin-bottom: 3px; }
.yxs-meta time { font-family: var(--yxs-mono); }
.yxs-body { padding: 8px 12px; border-radius: 6px; font-size: 14px; line-height: 1.55; min-width: 0; max-width: 100%; }
.yxs-from-agent .yxs-body { background: var(--yxs-white); border: 1px solid var(--yxs-line); }
.yxs-from-visitor .yxs-body { background: var(--yxs-ground); }
.yxs-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.yxs-body-t { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.yxs-body-t .yxs-ic { width: 15px; height: 15px; }
.yxs-body-t + .yxs-text { margin-top: 4px; }
.yxs-body-file { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.yxs-body-file .yxs-ic { width: 15px; height: 15px; color: var(--yxs-muted); }
.yxs-welcome-note { margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--yxs-muted); line-height: 1.45; }
.yxs-welcome-note .yxs-ic { width: 13px; height: 13px; margin-top: 2px; }
.yxs-sys { text-align: center; font-size: 12px; color: var(--yxs-muted); padding: 0 8px; }
.yxs-read { margin-top: 3px; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--yxs-muted); }
.yxs-read .yxs-ic { width: 14px; height: 14px; color: var(--yxs-accent); }
.yxs-msg.is-pending .yxs-body { opacity: .7; }
.yxs-msg.is-failed .yxs-body { opacity: 1; outline: 1px solid var(--yxs-error); }
.yxs-msg.is-failed .yxs-meta span:last-child { color: var(--yxs-error); }
.yxs-retry { margin-top: 2px; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--yxs-error); }
.yxs-typing { min-height: 20px; padding: 0 16px; font-size: 12px; color: var(--yxs-muted); }

/* Optional contact card */
.yxs-contact { padding: 10px 12px; border: 1px solid var(--yxs-line); border-radius: 6px; background: var(--yxs-white); }
.yxs-contact-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; font-size: 13px; line-height: 1.45; }
.yxs-contact-h > .yxs-ic { width: 15px; height: 15px; margin-top: 2px; color: var(--yxs-muted); }
.yxs-contact-h .yxs-icon-btn { margin: -4px -6px 0 0; color: var(--yxs-muted); }
.yxs-contact-row { margin-top: 8px; display: flex; gap: 8px; }
.yxs-root .yxs-contact-in { flex: 1; min-width: 0; min-height: 40px; padding: 8px 10px; font-size: 15px; }
.yxs-contact .yxs-btn-sm { min-height: 40px; padding: 0 14px; }
.yxs-contact .yxs-err { margin-top: 6px; }

/* Composer */
.yxs-compose { display: flex; align-items: flex-end; gap: 6px; padding: 10px 10px 10px 8px; border-top: 1px solid var(--yxs-line); background: var(--yxs-white); }
.yxs-compose-tools { display: flex; align-items: center; gap: 0; padding-bottom: 4px; }
.yxs-compose-tools .yxs-icon-btn { color: var(--yxs-muted); }
.yxs-root .yxs-compose-input { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; resize: none; font-size: 15px; padding: 10px 12px; }
.yxs-send { background: var(--yxs-ink); color: #fff; }
@media (hover: hover) { .yxs-send:hover { background: var(--yxs-accent); border-color: var(--yxs-accent); } }

/* Brief form */
.yxs-group { border: 0; padding: 0; min-width: 0; }
.yxs-group + .yxs-group, .yxs-group + .yxs-two, .yxs-two + .yxs-field, .yxs-field + .yxs-check, .yxs-check + .yxs-field { margin-top: 22px; }
.yxs-legend { padding: 0; margin-bottom: 10px; font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.yxs-field + .yxs-field, .yxs-field + .yxs-two, .yxs-two + .yxs-two { margin-top: 14px; }
.yxs-group > .yxs-two { margin-top: 14px; }
.yxs-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.yxs-two > .yxs-field + .yxs-field { margin-top: 0; }
.yxs-label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.yxs-req, .yxs-opt { font-size: 12px; font-weight: 400; color: var(--yxs-muted); }
.yxs-req { color: var(--yxs-ink); }
.yxs-root input[type="text"], .yxs-root input[type="email"], .yxs-root input[type="number"], .yxs-root input[type="date"], .yxs-root textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--yxs-control); border-radius: 4px;
  background: var(--yxs-white); color: var(--yxs-ink); font: inherit; font-size: 16px; line-height: 1.4;
}
.yxs-root input::placeholder, .yxs-root textarea::placeholder { color: #8A9299; }
.yxs-root input:focus, .yxs-root textarea:focus { outline: 2px solid var(--yxs-accent); outline-offset: -1px; border-color: var(--yxs-accent); }
.yxs-root [aria-invalid="true"] { border-color: var(--yxs-error) !important; }
.yxs-root .yxs-form textarea { resize: vertical; min-height: 80px; }
.yxs-hint { margin-top: 6px; font-size: 12px; color: var(--yxs-muted); line-height: 1.5; }
.yxs-err { margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--yxs-error); }
.yxs-err .yxs-ic { width: 14px; height: 14px; margin-top: 3px; }
.yxs-summary { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 10px 12px; border-left: 3px solid var(--yxs-error); background: var(--yxs-error-bg); color: var(--yxs-error); font-size: 13px; }
.yxs-summary .yxs-ic { width: 16px; height: 16px; margin-top: 2px; }

.yxs-seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--yxs-control); border-radius: 4px; overflow: hidden; background: var(--yxs-white); }
.yxs-seg.is-invalid { border-color: var(--yxs-error); }
.yxs-seg-item { position: relative; display: flex; }
.yxs-seg-item + .yxs-seg-item { border-left: 1px solid var(--yxs-line); }
.yxs-seg-item input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.yxs-seg-item span { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px 4px; font-size: 14px; font-weight: 500; line-height: 1.25; }
.yxs-seg-item input:checked + span { background: var(--yxs-ink); color: #fff; }
.yxs-seg-item input:focus-visible + span { outline: 2px solid var(--yxs-accent); outline-offset: -4px; }
.yxs-seg-item:hover input:not(:checked) + span { background: var(--yxs-paper); }

.yxs-drop { position: relative; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 64px; padding: 12px; border: 1px dashed var(--yxs-control); border-radius: 4px; background: var(--yxs-white); color: var(--yxs-muted); text-align: center; }
.yxs-drop.is-over { border-color: var(--yxs-accent); background: #F1F3FC; }
.yxs-drop.is-invalid { border-color: var(--yxs-error); }
.yxs-drop-t { font-size: 14px; }
.yxs-link { color: var(--yxs-ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.yxs-link:hover { color: var(--yxs-accent); }
.yxs-drop:focus-within { border-color: var(--yxs-accent); }
.yxs-drop:focus-within .yxs-link { outline: 2px solid var(--yxs-accent); outline-offset: 2px; }
.yxs-privacy { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--yxs-ink); }
.yxs-privacy .yxs-ic { width: 14px; height: 14px; }

.yxs-files { list-style: none; padding: 0; }
.yxs-files:not(:empty) { margin-top: 10px; border-top: 1px solid var(--yxs-line); }
.yxs-file { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--yxs-line); }
.yxs-file > .yxs-ic { color: var(--yxs-muted); }
.yxs-file.is-done > .yxs-ic { color: var(--yxs-ok); }
.yxs-file.is-bad > .yxs-ic, .yxs-file.is-bad .yxs-file-st { color: var(--yxs-error); }
.yxs-file-main { min-width: 0; display: flex; flex-direction: column; }
.yxs-file-name { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; line-height: 1.4; }
.yxs-file-meta { font-size: 12px; color: var(--yxs-muted); font-family: var(--yxs-mono); }
.yxs-file-act { display: flex; gap: 2px; }
.yxs-bar { display: block; height: 3px; margin-top: 6px; background: var(--yxs-ground); overflow: hidden; }
.yxs-bar i { display: block; height: 100%; width: 0; background: var(--yxs-ink); transition: width 120ms linear; }

.yxs-check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-size: 14px; position: relative; }
.yxs-check input { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; left: 0; cursor: pointer; }
.yxs-box { width: 20px; height: 20px; flex: none; border: 1px solid var(--yxs-control); border-radius: 4px; background: var(--yxs-white); display: inline-flex; align-items: center; justify-content: center; color: transparent; }
.yxs-box .yxs-ic { width: 14px; height: 14px; }
.yxs-check input:checked + .yxs-box { background: var(--yxs-ink); border-color: var(--yxs-ink); color: #fff; }
.yxs-check input:focus-visible + .yxs-box { outline: 2px solid var(--yxs-accent); outline-offset: 2px; }
.yxs-local { margin-top: 22px; font-size: 12px; color: var(--yxs-muted); }

.yxs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border: 0; border-radius: 4px; background: var(--yxs-ink); color: #fff; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color 160ms ease;
}
@media (hover: hover) { .yxs-btn:hover { background: var(--yxs-accent); } }
.yxs-btn[disabled] { background: #6D757C; cursor: progress; }
.yxs-btn .yxs-ic { width: 16px; height: 16px; }
.yxs-btn-wide { width: 100%; }
.yxs-btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.yxs-text-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 2px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--yxs-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.yxs-text-btn:hover { color: var(--yxs-accent); }
.yxs-text-btn .yxs-ic { width: 14px; height: 14px; }

/* Launcher: always present while the window is closed. Small ink tab, 4px radius, no motion.
   --yxs-lift is set by JS when page controls (carousel dots/play) sit underneath. */
.yxs-launch {
  --yxs-lift: 0px;
  position: fixed; right: 24px; bottom: calc(24px + var(--yxs-lift)); z-index: 999;
  display: inline-flex; align-items: center; gap: 8px; height: 44px; max-width: calc(100vw - 48px); padding: 0 14px 0 12px;
  border: 1px solid var(--yxs-ink); border-radius: 4px; background: var(--yxs-ink); color: #fff;
  font-size: 14px; font-weight: 500; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(29, 36, 42, .14);
}
@media (hover: hover) { .yxs-launch:hover { background: var(--yxs-accent); border-color: var(--yxs-accent); } }
.yxs-launch .yxs-ic { width: 18px; height: 18px; }
.yxs-launch-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yxs-badge {
  min-width: 20px; height: 20px; padding: 0 6px; margin-right: -4px; border-radius: 10px; background: #fff; color: var(--yxs-ink);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center;
}
/* The fixed launcher would sit over the page's last line; this spacer lets the footer scroll clear of it. */
.yxs-spacer { height: 72px; }

@media (max-width: 767px) {
  .yxs-launch {
    right: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom) + 8px) + var(--yxs-lift));
    width: 44px; padding: 0; justify-content: center; max-width: none;
  }
  .yxs-launch .yxs-launch-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .yxs-launch .yxs-badge { position: absolute; top: -8px; right: -8px; margin: 0; border: 1px solid var(--yxs-ink); }
  .yxs-spacer { height: 76px; }
  .yxs-root { --yxs-gap: 16px; }
}
/* Phones: the window takes the whole screen. */
@media (max-width: 599px) {
  .yxs-panel {
    inset: 0; right: 0; bottom: 0; width: 100vw; height: 100%; height: 100dvh; border: 0; border-radius: 0; box-shadow: none;
  }
  .yxs-head { padding-top: max(10px, env(safe-area-inset-top)); }
  .yxs-compose { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .yxs-two { grid-template-columns: 1fr; }
  .yxs-msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  .yxs-panel, .yxs-bar i { transition: none; }
}
/* Compact launcher (opt-in with <script data-compact>): icon only, same footprint as on phones. */
.yxs-launch.is-compact { width: 44px; padding: 0; justify-content: center; max-width: none; }
.yxs-launch.is-compact .yxs-launch-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.yxs-launch.is-compact .yxs-badge { position: absolute; top: -8px; right: -8px; margin: 0; border: 1px solid var(--yxs-ink); }
