/* Chat (Phase 5, P5-N5): the panel, the home question box/card and the launchers' script switch. One file for the city look
   (public/assets/style.css) and the hub look (public/css/hub.css): the local --cx-* tokens read whichever of the two
   stylesheets is on the page, so no colour, radius or font of either is redefined here (absolute rule 10). Nothing is
   written inline: the page's CSP has no style-src 'unsafe-inline'. */
.chat-fab, .cx-panel, .cx-ask, .cx-fab, .cx-hub-btn {
  --cx-acc: var(--sea, var(--blue));
  --cx-acc-hi: var(--sea-hi, var(--blue));
  --cx-soft: var(--tint, var(--blue-50));
  --cx-line: var(--hair, var(--line));
  --cx-bg2: var(--bg-2, var(--soft));
  --cx-ink: var(--ink);
  --cx-ink2: var(--ink-2);
  --cx-ink3: var(--ink-3);
  --cx-card: var(--r-card, var(--r-l));
  --cx-shadow: var(--shadow-3, var(--sh-3));
}

/* script on / script off: a button with JavaScript, a plain link (or note) without */
html.js .cx-nojs { display: none !important; }
html:not(.js) .cx-js { display: none !important; }
.cx-vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- panel ---------- */
.cx-panel { position: fixed; z-index: 310; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; width: 400px; max-width: calc(100vw - 32px); height: min(640px, calc(100vh - 32px)); height: min(640px, calc(100dvh - 32px)); background: #fff; color: var(--cx-ink); border: 1px solid var(--cx-line); border-radius: var(--cx-card); box-shadow: var(--cx-shadow); overflow: hidden; font-family: var(--font); line-height: 1.5; }
.cx-panel.cx-sheet { inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
@media (max-width: 639px) { .cx-panel { inset: 0; width: 100%; max-width: none; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; } }
body:has(.cx-panel) .chat-fab, body:has(.cx-panel) .cx-fab { display: none; }
.cx-head { flex: none; display: flex; align-items: flex-start; gap: 2px; padding: 12px 8px 10px 20px; border-bottom: 1px solid var(--cx-line); background: #fff; }
.cx-id { flex: 1; min-width: 0; padding-top: 8px; }
.cx-title { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em; }
.cx-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--cx-ink3); }
.cx-sub a, .cx-notice a, .cx-ask-foot a, .cx-nojs a { color: var(--cx-ink3); text-decoration: underline; text-underline-offset: .18em; }
.cx-ib { flex: none; display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border: 0; border-radius: 22px; background: transparent; color: var(--cx-ink2); font: 600 13px/1 var(--font); cursor: pointer; }
.cx-ib:hover { background: var(--cx-bg2); }
.cx-panel :focus-visible, .cx-ask :focus-visible, .cx-fab:focus-visible, .cx-hub-btn:focus-visible { outline: 3px solid var(--cx-acc-hi); outline-offset: 2px; }
.cx-log { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 12px; overscroll-behavior: contain; }
.cx-hello > p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--cx-ink2); }
.cx-chips, .cx-ask-chips, .cx-msgs, .cx-src ul, .cx-nf ul { margin: 0; padding: 0; list-style: none; }
.cx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cx-chip { min-height: 44px; padding: 8px 16px; border: 1px solid var(--cx-line); border-radius: 980px; background: #fff; color: var(--cx-ink); font: 400 15px/1.3 var(--font); text-align: left; cursor: pointer; }
.cx-chip:hover { border-color: var(--cx-ink3); background: var(--cx-bg2); }
.cx-msgs > li + li { margin-top: 18px; }
.cx-u { display: flex; justify-content: flex-end; }
.cx-u p { max-width: 86%; margin: 0; padding: 10px 15px; border-radius: 20px 20px 6px 20px; background: var(--cx-ink); color: #fff; overflow-wrap: anywhere; white-space: pre-wrap; }
.cx-a p { margin: 0; font-size: 15.5px; line-height: 1.6; }
.cx-a p + p { margin-top: 10px; }
.cx-status { display: flex; align-items: center; gap: 8px; font-size: 14px !important; line-height: 1.4 !important; color: var(--cx-ink3); }
.cx-status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cx-acc); }
.cx-cap { font-size: 13px !important; line-height: 1.5 !important; color: var(--cx-ink3); }
.cx-src { margin-top: 12px; padding: 10px 14px 12px; border: 1px solid var(--cx-line); border-radius: 12px; background: var(--cx-bg2); }
.cx-src h3 { margin: 0 0 4px; font-size: 13px; font-weight: 700; color: var(--cx-ink2); letter-spacing: 0; }
.cx-src h4 { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.cx-group + .cx-group { margin-top: 10px; }
.cx-src li, .cx-nf li { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font-size: 14.5px; }
.cx-src li + li, .cx-nf li { border-top: 1px solid var(--cx-line); }
.cx-src a, .cx-nf a { min-height: 24px; color: var(--cx-acc-hi); text-decoration: underline; text-underline-offset: .18em; }
.cx-kind { flex: none; min-width: 3.2em; padding: 0 8px; border-radius: 999px; background: var(--cx-soft); color: var(--cx-acc-hi); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; letter-spacing: 0; }
.cx-nf { margin-top: 6px; padding: 12px 14px; border: 1px solid var(--cx-line); border-radius: 12px; background: #fff; }
.cx-nf strong { display: block; font-size: 15.5px; }
.cx-nf > p { margin-top: 2px !important; font-size: 14px !important; color: var(--cx-ink3); }
.cx-nf ul { margin-top: 8px; }
.cx-nf .cx-nf-act { margin-top: 10px !important; }
.cx-fb, .cx-err { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; }
.cx-fb { border: 1px solid var(--cx-line); background: var(--cx-soft); }
.cx-err { border: 1px solid #f0b6b9; background: #fff5f5; color: #7a1519; }
.cx-fb p + p, .cx-err p + button { margin-top: 8px; }
.cx-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--cx-acc-hi); border-radius: 12px; background: var(--cx-acc-hi); color: #fff !important; font: 700 15px/1 var(--font); text-decoration: none !important; cursor: pointer; }
.cx-btn--sec { background: #fff; color: var(--cx-acc-hi) !important; }
.cx-btn[disabled] { opacity: .55; cursor: not-allowed; }
.cx-form { flex: none; padding: 10px 16px 14px; border-top: 1px solid var(--cx-line); background: #fff; }
.cx-notice { margin: 0 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--cx-ink3); }
.cx-row { display: flex; align-items: flex-end; gap: 8px; }
.cx-row textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; resize: none; padding: 10px 16px; border: 1px solid var(--cx-ink3); border-radius: 22px; background: #fff; color: var(--cx-ink); font: 400 16px/1.4 var(--font); }
.cx-row textarea:disabled { background: var(--cx-bg2); }
.cx-send { flex: none; min-width: 64px; height: 44px; padding: 0 16px; border: 0; border-radius: 22px; background: var(--cx-acc-hi); color: #fff; font: 700 15px/1 var(--font); cursor: pointer; }
.cx-send[disabled] { background: var(--cx-line); color: var(--cx-ink3); cursor: not-allowed; }
.cx-count { display: flex; justify-content: space-between; gap: 8px; margin: 4px 0 0; font-size: 12.5px; color: var(--cx-ink3); }
.cx-count output { font-variant-numeric: tabular-nums; }

/* ---------- hub question card ---------- */
.cx-ask { margin: 28px 0 0; padding: 24px 26px 18px; max-width: 760px; background: #fff; border: 1px solid var(--cx-line); border-radius: var(--cx-card); box-shadow: var(--cx-shadow); }
.cx-ask-k { margin: 0; font-size: 13px; font-weight: 700; color: var(--cx-acc-hi); }
.cx-ask-h { margin: 6px 0 14px; font-size: clamp(22px, 3vw, 28px); line-height: 1.25; letter-spacing: -.035em; }
.cx-ask-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 18px; border: 1px solid var(--cx-ink3); border-radius: 999px; background: #fff; }
.cx-ask-row:focus-within { outline: 3px solid var(--cx-acc-hi); outline-offset: 2px; }
.cx-ask-row input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; color: var(--cx-ink); font: 400 16px/1.2 var(--font); }
.cx-ask-row input:focus { outline: none; }
.cx-ask-go { flex: none; min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--cx-acc-hi); color: #fff; font: 700 15px/1 var(--font); cursor: pointer; }
.cx-ask-meta { margin: 8px 0 0; font-size: 13px; color: var(--cx-ink3); }
.cx-ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cx-ask-chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--cx-line); border-radius: 999px; background: var(--cx-bg2); color: var(--cx-ink); font: 400 15px/1.2 var(--font); cursor: pointer; }
.cx-ask-chip:hover { background: var(--cx-soft); }
.cx-nojs { margin: 0; font-size: 14px; color: var(--cx-ink2); }
.cx-ask-foot { display: grid; gap: 2px; margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--cx-line); font-size: 13px; color: var(--cx-ink3); }
@media (max-width: 560px) { .cx-ask { padding: 18px 16px 14px; } }

/* ---------- hub launchers: a floating button above 1180 px, a button in the phone bar below ---------- */
.cx-fab { position: fixed; z-index: 90; right: 24px; bottom: 24px; display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 20px 0 16px; border: 0; border-radius: 999px; background: var(--cx-acc-hi); color: #fff; box-shadow: var(--cx-shadow); font: 700 16px/1 var(--font); cursor: pointer; }
.cx-fab .ic { width: 22px; height: 22px; }
@media (max-width: 1180px) { .cx-fab { display: none !important; } }
.cx-hub-btn { cursor: pointer; background: var(--cx-soft); color: var(--cx-acc-hi); }
.cx-hub-btn .ic { width: 20px; height: 20px; }
@media (min-width: 1181px) { .cx-hub-btn { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .cx-panel, .cx-fab { transition: none; animation: none; } }
.hk-notice { margin: 8px 4px 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-3, #5F6878); }
.hk-notice a { color: inherit; text-decoration: underline; text-underline-offset: .18em; }
