/* ClientoraHQ sales chat (chat.js) — same HUD tokens as landing.css / tools.css, with fallbacks */
.cqc { --c-cyan: var(--cyan, #29e6ff); --c-ink: var(--cyan-ink, #01121c); --c-bg: var(--bg-2, #050f1b); --c-bg2: var(--bg-3, #081a2a);
  --c-line: var(--line, rgba(41, 230, 255, .16)); --c-hi: var(--line-hi, rgba(41, 230, 255, .45)); --c-text: var(--text, #e6f8ff); --c-text2: var(--text-2, #a7c6d6); --c-text3: var(--text-3, #7f9fb2);
  position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  font: 400 15px/1.5 "Inter", "Segoe UI", system-ui, sans-serif; color: var(--c-text); }
.cqc [hidden] { display: none !important; }
.cqc button { font: inherit; color: inherit; cursor: pointer; }
.cqc svg { width: 22px; height: 22px; flex: none; }

.cqc-launch { display: inline-flex; align-items: center; gap: 8px; height: 54px; padding: 0 20px 0 16px; border: 0; border-radius: 999px;
  background: var(--c-cyan); color: var(--c-ink) !important; font-weight: 700 !important; box-shadow: 0 12px 32px rgba(41, 230, 255, .28), 0 2px 8px rgba(0, 0, 0, .4); transition: transform .2s, background .2s; }
.cqc-launch:hover { background: var(--cyan-2, #7df3ff); transform: translateY(-2px); }
.cqc-open .cqc-launch { padding: 0 16px; }
.cqc-open .cqc-launch span { display: none; }

.cqc-nudge { position: relative; max-width: 280px; padding: 14px 40px 14px 16px; border: 1px solid var(--c-hi); border-radius: 16px 16px 4px 16px;
  background: var(--c-bg2); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); animation: cqc-in .35s ease-out; }
.cqc-nudge-text { all: unset; cursor: pointer; display: block; font: 500 15px/1.45 "Inter", "Segoe UI", system-ui, sans-serif; color: var(--c-text); }
.cqc-nudge-text:focus-visible { outline: 2px solid var(--c-cyan); outline-offset: 4px; border-radius: 4px; }
.cqc-nudge-x, .cqc-x { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--c-text3) !important; }
.cqc-nudge-x svg, .cqc-x svg { width: 16px; height: 16px; }
.cqc-nudge-x:hover, .cqc-x:hover { color: var(--c-text) !important; background: rgba(255, 255, 255, .06); }

.cqc-panel { position: relative; display: flex; flex-direction: column; width: 380px; height: min(580px, calc(100vh - 110px)); overflow: hidden;
  border: 1px solid var(--c-hi); border-radius: 18px; background: var(--c-bg); box-shadow: 0 24px 64px rgba(0, 0, 0, .6), 0 0 44px rgba(41, 230, 255, .08); animation: cqc-in .25s ease-out; }
.cqc-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 48px 14px 16px; border-bottom: 1px solid var(--c-line); background: var(--c-bg2); }
.cqc-head b { display: block; font-size: 15px; }
.cqc-head small { display: block; font-size: 12px; color: var(--c-text3); }
.cqc-head .cqc-x { top: 50%; transform: translateY(-50%); }
.cqc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-cyan); box-shadow: 0 0 12px var(--c-cyan); }

.cqc-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.cqc-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cqc-assistant { align-self: flex-start; background: var(--c-bg2); border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.cqc-user { align-self: flex-end; background: var(--c-cyan); color: var(--c-ink); border-bottom-right-radius: 4px; }
.cqc-msg a { color: var(--c-cyan); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.cqc-err { border-color: rgba(255, 170, 90, .45); color: var(--c-text2); }
.cqc-typing::after { content: "•••"; letter-spacing: 3px; color: var(--c-text3); animation: cqc-blink 1.2s infinite; }
.cqc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cqc-chips button { padding: 8px 12px; border: 1px solid var(--c-hi); border-radius: 999px; background: transparent; font-size: 14px !important; color: var(--c-cyan) !important; }
.cqc-chips button:hover { background: rgba(41, 230, 255, .1); }

.cqc-foot { padding: 10px 12px 4px; border-top: 1px solid var(--c-line); }
.cqc-form { display: flex; align-items: flex-end; gap: 8px; }
.cqc-input { flex: 1; resize: none; overflow-y: hidden; box-sizing: border-box; min-height: 44px; max-height: 120px; padding: 11px 12px; border: 1px solid var(--c-line); border-radius: 12px;
  background: var(--c-bg2); color: var(--c-text); font: 400 16px/1.4 "Inter", "Segoe UI", system-ui, sans-serif; }
.cqc-input:focus { outline: none; border-color: var(--c-cyan); }
.cqc-send { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--c-cyan); color: var(--c-ink) !important; }
.cqc-send:disabled { opacity: .5; cursor: wait; }
.cqc-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 2px 0; font-size: 12px; }
.cqc-count { color: var(--c-text3); }
.cqc-link { padding: 4px 0; border: 0; background: none; font-size: 12px !important; color: var(--c-text2) !important; text-decoration: underline; text-underline-offset: 2px; }
.cqc-link:hover { color: var(--c-cyan) !important; }
.cqc-fine { margin: 0; padding: 2px 14px 10px; font-size: 11px; color: var(--c-text3); }

.cqc-lead { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--c-hi); border-radius: 14px; background: var(--c-bg2); }
.cqc-lead p { margin: 0; font-size: 14px; color: var(--c-text2); }
.cqc-lead label { display: grid; gap: 4px; font-size: 13px; color: var(--c-text2); }
.cqc-lead input:not([type=checkbox]) { padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-bg); color: var(--c-text); font: 400 16px/1.3 "Inter", system-ui, sans-serif; }
.cqc-lead input:focus { outline: none; border-color: var(--c-cyan); }
.cqc-lead .cqc-agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; }
.cqc-agree input { margin-top: 3px; accent-color: var(--c-cyan); }
.cqc-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cqc-lead-err { color: #ffb36b !important; }
.cqc-lead-go { padding: 11px; border: 0; border-radius: 10px; background: var(--c-cyan); color: var(--c-ink) !important; font-weight: 700 !important; }
.cqc-lead-go:disabled { opacity: .6; }

.cqc :focus-visible { outline: 2px solid var(--c-cyan); outline-offset: 2px; }
@keyframes cqc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes cqc-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .cqc-panel, .cqc-nudge, .cqc-typing::after { animation: none; } }

/* phones: the panel becomes a sheet across the bottom of the screen */
@media (max-width: 520px) {
  .cqc { right: 16px; bottom: 16px; }
  .cqc-launch span { display: none; }
  .cqc-launch { width: 54px; padding: 0; justify-content: center; }
  .cqc-panel { position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; height: min(640px, calc(100dvh - 16px)); }
  .cqc-open .cqc-launch { display: none; }
  .cqc-nudge { max-width: calc(100vw - 32px); }
}

/* the home page's own floating buttons: the chat replaces the contact button, and back-to-top steps aside */
body:has(.cqc) .fab { display: none; }
body:has(.cqc-open) .totop, body:has(.cqc-nudge:not([hidden])) .totop { opacity: 0; pointer-events: none; }
