/*
 * BA Helpdesk — the public pages (2026-10-11): help center, contact form, the customer's
 * conversation page and the website chat panel. Stand-alone (no app.css): it runs under its
 * own enforcing CSP and is framed on members' websites. The accent follows the business's
 * colour (--a, set through the CSSOM by help.js — never an inline style). Light and dark follow
 * the visitor (or the chat's theme setting). Mobile-first; every control ≥44px; inputs 16px.
 */
:root {
  --bg: #f6f5fb; --panel: #ffffff; --ink: #17142b; --ink-2: #3c3858; --muted: #625d7d;
  --line: #e6e3f0; --line-2: #d6d2e6; --hover: rgba(23, 20, 43, .05);
  --ok: #15803d; --ok-tint: #e8f7ee; --bad: #b91c1c; --bad-tint: #fde8e8;
  --a: #7a33ff; --a-ink: #5b21b6; --a-soft: #f1ebff; --on-a: #ffffff;
  --shadow: 0 1px 2px rgba(23, 20, 43, .06), 0 8px 24px rgba(23, 20, 43, .06);
  --radius: 20px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html.dark {
  --bg: #100e1d; --panel: #1a1730; --ink: #f3f1fb; --ink-2: #d6d2ea; --muted: #a7a2c3;
  --line: #2c2847; --line-2: #3a3559; --hover: rgba(255, 255, 255, .06);
  --ok: #5fe0a6; --ok-tint: #0f2c23; --bad: #ff8a9a; --bad-tint: #35141f;
  --a-ink: #c4a8ff; --a-soft: #2a2150;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
a { color: var(--a-ink); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.app { flex: 1 0 auto; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 20px 24px; }
.loading { display: grid; place-items: center; min-height: 240px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--a-soft); border-top-color: var(--a); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); font: 500 15px var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { box-shadow: inset 0 0 0 1px var(--line-2), inset 0 0 0 999px var(--hover); }
.btn.primary { background: var(--a); color: var(--on-a); box-shadow: none; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
.link { background: none; border: 0; padding: 0 2px; font: 500 14.5px var(--font); color: var(--a-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 44px; }
.msg-box { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; margin: 0 0 12px; overflow-wrap: anywhere; }
.msg-box.bad { background: var(--bad-tint); color: var(--bad); }
.msg-box.ok { background: var(--ok-tint); color: var(--ok); }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.card.center { text-align: center; max-width: 520px; margin: 48px auto; display: grid; gap: 12px; justify-items: center; }
.big { font-size: 40px; }
.foot { text-align: center; font-size: 12.5px; color: var(--muted); padding: 22px 16px calc(16px + env(safe-area-inset-bottom)); }
.foot a { color: var(--muted); }
.field { display: grid; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label { font-weight: 500; font-size: 14px; color: var(--ink-2); }
.field input, .field textarea, .comp textarea, .search input { font: inherit; font-size: 15px; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; min-height: 44px; width: 100%; }
.field textarea { resize: vertical; line-height: 1.5; min-height: 140px; }
.field input:focus, .field textarea:focus, .comp textarea:focus, .search input:focus { outline: none; border-color: var(--a); box-shadow: 0 0 0 3px var(--a-soft); }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.f-err { font-size: 13.5px; color: var(--bad); font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ── Help center ───────────────────────────────────────────────────── */
.hc-top { background: var(--a); color: var(--on-a); }
.hc-top-in { max-width: 980px; margin: 0 auto; padding: 22px 20px 64px; }
.hc-brand { display: flex; align-items: center; gap: 10px; color: var(--on-a); text-decoration: none; font-weight: 600; font-size: 16px; min-height: 44px; }
.hc-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; background: rgba(255,255,255,.2); }
.hc-top h1 { font-size: 32px; margin: 26px 0 8px; overflow-wrap: anywhere; }
.hc-top p { opacity: .92; max-width: 60ch; white-space: pre-line; overflow-wrap: anywhere; }
.search { position: relative; margin-top: 22px; max-width: 620px; }
.search input { min-height: 54px; font-size: 16px; padding-left: 44px; border: 0; box-shadow: 0 6px 22px rgba(0,0,0,.14); }
.search .s-ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
.hc-body { margin-top: -36px; }
.results { display: grid; gap: 8px; margin-bottom: 18px; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 26px; }
.cat { display: grid; gap: 6px; padding: 20px; border-radius: 18px; background: var(--panel); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; align-content: start; min-height: 120px; }
.cat:hover { box-shadow: var(--shadow), inset 0 0 0 2px var(--a); }
.cat .c-ic { font-size: 26px; }
.cat strong { font-size: 17px; overflow-wrap: anywhere; }
.cat span { color: var(--ink-2); font-size: 14px; overflow-wrap: anywhere; }
.sec-h { font-size: 18px; margin: 8px 0 12px; }
/* No categories: the heading is the first thing under the hero — clear the 36px overlap. */
.hc-body > .results:empty + .sec-h { margin-top: 52px; }
.art-links { list-style: none; margin: 0 0 24px; padding: 0; background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.art-links li + li { border-top: 1px solid var(--line); }
.art-links a { display: grid; gap: 2px; padding: 14px 18px; text-decoration: none; color: var(--ink); min-height: 52px; }
.art-links a:hover { background: var(--hover); }
.art-links a strong { font-weight: 500; overflow-wrap: anywhere; }
.art-links a span { color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.contact-cta { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 20px; border-radius: 18px; background: var(--a-soft); margin: 10px 0 0; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--muted); margin: 22px 0 14px; }
.crumbs a { color: var(--muted); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.slim-top { background: var(--panel); border-bottom: 1px solid var(--line); }
.slim-top-in { max-width: 980px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slim-top .hc-brand { color: var(--ink); }
.slim-top .link { display: inline-flex; align-items: center; }
.article { padding: 32px; }
.article h1 { font-size: 30px; margin-bottom: 8px; overflow-wrap: anywhere; }
.article .updated { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.prose { font-size: 16.5px; line-height: 1.7; color: var(--ink-2); overflow-wrap: anywhere; }
.prose p { margin: 0 0 16px; }
.prose h2 { font-size: 21px; margin: 28px 0 10px; color: var(--ink); }
.prose h3 { font-size: 17.5px; margin: 22px 0 8px; color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 24px; }
.prose li { margin: 5px 0; }
.prose code { font: 14.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--a-soft); padding: 1px 6px; border-radius: 6px; }
.helpful { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.helpful .btn { min-width: 88px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; margin-top: 4px; }
.side h2 { font-size: 15px; margin: 0 0 10px; }

/* ── Conversation (portal + chat) ─────────────────────────────────── */
.thread { display: grid; gap: 12px; }
.m { display: grid; gap: 4px; max-width: 86%; }
.m.you { justify-self: end; justify-items: end; }
.m .who { font-size: 12.5px; color: var(--muted); padding: 0 4px; }
.m .b { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.m.you .b { border-radius: 16px 16px 4px 16px; background: var(--a); color: var(--on-a); box-shadow: none; }
.m.you .b a { color: var(--on-a); }
.m.ai .b { background: var(--a-soft); box-shadow: none; }
.m .at { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.files { display: flex; gap: 6px; flex-wrap: wrap; }
.file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 36px; padding: 4px 10px; border-radius: 10px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-size: 13.5px; text-decoration: none; }
.file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-att img { display: block; max-width: 220px; max-height: 200px; border-radius: 12px; }
.typing { font-size: 13px; color: var(--muted); min-height: 20px; padding: 0 4px; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.comp { display: grid; gap: 8px; }
.comp textarea { min-height: 52px; max-height: 180px; resize: none; line-height: 1.45; }
.comp-row { display: flex; gap: 8px; align-items: center; }
.comp-row .grow { flex: 1 1 auto; }
.ic-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; font-size: 18px; flex: 0 0 auto; }
.ic-btn:hover { background: var(--hover); color: var(--ink); }
.ic-btn svg { width: 22px; height: 22px; }
.send { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--a); color: var(--on-a); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.send svg { width: 20px; height: 20px; }
.send[aria-disabled="true"] { opacity: .55; }
.pending { display: flex; gap: 6px; flex-wrap: wrap; }
.pend { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--a-soft); font-size: 13px; max-width: 100%; }
.pend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.pend button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.rate { display: grid; gap: 10px; padding: 16px; border-radius: 16px; background: var(--a-soft); text-align: center; justify-items: center; }
.stars { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.stars button { min-width: 52px; min-height: 52px; border-radius: 14px; border: 0; background: var(--panel); font-size: 24px; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-2); }
.stars button:hover, .stars button.on { box-shadow: inset 0 0 0 2px var(--a); }
.portal { max-width: 720px; margin: 0 auto; padding-top: 22px; }
.portal-head { display: grid; gap: 4px; margin-bottom: 16px; }
.portal-head h1 { font-size: 24px; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--a-soft); color: var(--a-ink); }
.badge.done { background: var(--ok-tint); color: var(--ok); }
.portal .card { padding: 20px; }
.portal .comp { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ── The chat panel (/help/embed/<key>) ───────────────────────────── */
html.embed, html.embed body { height: 100%; min-height: 0; }
html.embed body { background: var(--panel); overflow: hidden; }
.chat { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--panel); }
.ch-head { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; background: var(--a); color: var(--on-a); }
.ch-head .face { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: rgba(255,255,255,.2); font-weight: 700; font-size: 18px; flex: 0 0 auto; }
.ch-head .face img { width: 100%; height: 100%; object-fit: cover; }
.ch-head .t { flex: 1 1 auto; min-width: 0; display: grid; }
.ch-head .t strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-head .t span { font-size: 12.5px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.ch-head .t .on::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; }
.ch-head .t .off::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .45; display: inline-block; }
.ch-head .hb { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--on-a); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.ch-head .hb:hover { background: rgba(255,255,255,.16); }
.ch-head .hb svg { width: 22px; height: 22px; }
.ch-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: grid; gap: 14px; align-content: start; background: var(--bg); }
.ch-foot { flex: 0 0 auto; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.ch-brand { text-align: center; font-size: 11.5px; color: var(--muted); padding-top: 6px; }
.ch-brand a { color: var(--muted); }
.greet { padding: 14px 16px; border-radius: 4px 16px 16px 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.away { padding: 12px 14px; border-radius: 14px; background: var(--a-soft); color: var(--ink-2); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.topics { display: flex; gap: 8px; flex-wrap: wrap; }
.topic { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--panel); color: var(--a-ink); box-shadow: inset 0 0 0 1.5px var(--a); font: 500 14px var(--font); cursor: pointer; text-align: left; }
.topic:hover { background: var(--a); color: var(--on-a); }
.box { padding: 14px; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 10px; }
.box h2 { font-size: 15px; }
.convs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.convs button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; text-align: left; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font: inherit; min-height: 52px; }
.convs button:hover { background: var(--hover); }
.convs strong { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convs .p { grid-column: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convs .w { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--muted); display: grid; justify-items: end; gap: 4px; }
.convs .new-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--a); }
.arts { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.arts button, .arts a { width: 100%; display: grid; text-align: left; padding: 10px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font: 500 14.5px var(--font); min-height: 44px; text-decoration: none; }
.arts button:hover, .arts a:hover { background: var(--hover); }
.arts span { font-weight: 400; font-size: 13px; color: var(--muted); }
.ch-search { position: relative; }
.ch-search input { font: inherit; font-size: 15px; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; min-height: 44px; width: 100%; }
.ch-search input:focus { outline: none; border-color: var(--a); box-shadow: 0 0 0 3px var(--a-soft); }
.ch-article h2 { font-size: 20px; margin-bottom: 10px; overflow-wrap: anywhere; }
.ch-article .prose { font-size: 15px; }
.pre-form { display: grid; gap: 4px; }
.pre-form .field { margin-bottom: 10px; }
.preview-note { font-size: 12.5px; color: var(--muted); text-align: center; padding: 4px 0 2px; }

@media (max-width: 760px) {
  .two { grid-template-columns: minmax(0, 1fr); }
  .hc-top h1 { font-size: 26px; }
  .article { padding: 22px 18px; }
  .article h1 { font-size: 24px; }
}
@media (max-width: 560px) {
  .app { padding: 0 12px 16px; }
  .card { padding: 22px 18px; }
  .field input, .field textarea, .comp textarea, .search input, .ch-search input { font-size: 16px; }
  .m { max-width: 92%; }
  .hc-top-in { padding: 16px 16px 56px; }
  .slim-top-in { padding: 6px 12px; }
}
.mt { margin-top: 14px; }
.mt-s { margin-top: 4px; }
.center-t { text-align: center; }
.portal .badge { justify-self: start; }
