/* ------------------------------------------------------------------
   Talk to our AI agent (assets/chat.js). A panel that rises from the help launcher on wide screens, full screen on
   phones. The agent's face is our HumAI mark (it breathes while it thinks); replies
   stream in with a cursor, and WhatsApp is one tap away from the first reply.
   ------------------------------------------------------------------ */

/* the agent's face: our HumAI mark in neon on a dark tile, with a live dot; it breathes while it thinks */
.agent { --s: 40px; position: relative; flex: none; display: grid; place-items: center; width: var(--s); height: var(--s); border-radius: 30%;
  background: linear-gradient(150deg, #0b3a33, var(--coach) 60%); box-shadow: inset 0 0 0 1px rgb(3 253 124 / .18), 0 4px 14px rgb(2 23 20 / .18); color: var(--neon); }
.agent svg { width: 56%; height: 56%; filter: drop-shadow(0 0 6px rgb(3 253 124 / .35)); }
.agent::after { content: ""; position: absolute; top: -2px; right: -2px; width: 28%; height: 28%; min-width: 9px; min-height: 9px; border: 2px solid #fff; border-radius: 50%; background: var(--neon); }
.agent.is-thinking { animation: agent-glow 1.2s ease-in-out infinite; }
.agent.is-thinking svg { animation: agent-breathe 1.2s ease-in-out infinite; }
@keyframes agent-glow { 50% { box-shadow: inset 0 0 0 1px rgb(3 253 124 / .4), 0 0 0 5px rgb(3 253 124 / .18), 0 4px 14px rgb(2 23 20 / .18); } }
@keyframes agent-breathe { 50% { scale: .86; } }
.agent--sm { --s: 28px; border-radius: 9px; }
.agent--sm::after { display: none; }
.agent--lg { --s: 76px; border-radius: 24px; box-shadow: inset 0 0 0 1px rgb(3 253 124 / .2), 0 14px 36px rgb(2 23 20 / .22), 0 0 0 8px color-mix(in srgb, var(--neon) 12%, transparent); }
.agent--lg::after { width: 18px; height: 18px; border-width: 3px; top: -4px; right: -4px; }
.chat__head .agent::after { border-color: var(--coach); }

.chat { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; height: 100dvh; background: #fff; color: var(--body);
  visibility: hidden; opacity: 0; translate: 0 24px; transition: opacity .3s ease, translate .5s var(--ex), visibility 0s linear .5s; }
.chat.is-open { visibility: visible; opacity: 1; translate: none; transition: opacity .3s ease, translate .5s var(--ex); }
.chat-open, .chat-open body { overflow: hidden; }
html.chat-open :is(.help, .mbar) { opacity: 0; pointer-events: none; transition: opacity .15s ease; }
@media (min-width: 861px) {
  .chat { inset: auto 22px 22px auto; width: 440px; height: min(700px, calc(100vh - 100px)); border-radius: 26px; overflow: hidden;
    box-shadow: 0 40px 100px rgb(5 25 20 / .3), 0 0 0 1px rgb(2 23 20 / .08); transform-origin: 100% 100%; }
  .chat:not(.is-open) { scale: .95; }
  .chat.is-open { scale: 1; transition: opacity .3s ease, translate .5s var(--ex), scale .5s var(--ex); }
  .chat-open, .chat-open body { overflow: auto; }
}

/* the agent's header */
.chat__head { flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--coach); color: #fff; }
.chat__who { display: grid; flex: 1; min-width: 0; gap: 1px; }
.chat__who b { display: flex; align-items: center; gap: 7px; font-size: 16px; font-weight: 600; }
.chat__who em { padding: 3px 7px; border-radius: 6px; background: var(--neon); font: 700 10px/1 var(--font); letter-spacing: .1em; font-style: normal; color: var(--coach); }
.chat__who small { display: flex; align-items: center; gap: 6px; overflow: hidden; font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; color: color-mix(in srgb, #fff 72%, transparent); }
.chat__who small::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 0 3px rgb(3 253 124 / .2); }
.chat__wa { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 13px; border-radius: 100px; background: rgb(255 255 255 / .08); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .2); font-size: 13px; font-weight: 600; color: #fff; transition: background-color .2s ease; }
.chat__wa:hover { background: rgb(255 255 255 / .16); }
.chat__wa .wa-icon { width: 16px; height: 16px; color: #25d366; }
.chat__close { position: relative; flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgb(255 255 255 / .08); cursor: pointer; transition: background-color .2s ease, rotate .4s var(--ex); }
.chat__close:hover { background: rgb(255 255 255 / .16); rotate: 90deg; }
.chat__close i { position: absolute; left: 12px; right: 12px; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: #fff; rotate: 45deg; }
.chat__close i + i { rotate: -45deg; }
.chat__close:focus-visible, .chat__wa:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }
@media (max-width: 420px) { .chat__wa { width: 38px; padding: 0; justify-content: center; } .chat__wa span { display: none; } }

/* the conversation */
.chat__log { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 26px 16px 14px; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
  background: radial-gradient(130% 42% at 50% 0%, color-mix(in srgb, var(--neon) 12%, #fff) 0%, #fff 70%) no-repeat; }
.chat__log:focus-visible { outline: 2px solid var(--teal); outline-offset: -4px; }
.chat__hello { display: grid; justify-items: center; gap: 10px; margin: 4px 0 14px; text-align: center; }
.chat__hello .agent { margin-bottom: 8px; }
.chat__hello h2 { margin: 0; font: 900 32px/1.08 var(--serif); letter-spacing: -0.025em; color: var(--coach); }
.chat__hello p { max-width: 330px; margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.chat__row { display: flex; align-items: flex-end; gap: 8px; animation: chat-in .45s var(--ex) both; }
.chat__row--me { justify-content: flex-end; }
.chat__msg { max-width: 82%; margin: 0; padding: 11px 15px; border-radius: 20px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat__row--ai .chat__msg { border-bottom-left-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgb(2 23 20 / .06), 0 0 0 1px rgb(2 23 20 / .08); color: var(--coach); }
.chat__row--me .chat__msg { border-bottom-right-radius: 6px; background: var(--coach); color: #fff; }
.chat__msg a { white-space: nowrap; font-weight: 600; color: var(--teal-ink); text-decoration: underline; text-underline-offset: 3px; }
.chat__msg.is-streaming::after { content: ""; display: inline-block; width: .5em; height: 1em; margin-inline-start: 2px; vertical-align: -.15em; border-radius: 2px; background: var(--teal); animation: chat-caret .9s steps(1) infinite; }
.chat__msg--err { align-self: stretch; max-width: none; margin: 0; padding: 11px 15px; border-radius: 16px; background: #fff3ef; box-shadow: inset 0 0 0 1px #f3cfc2; font-size: 14px; color: #8a2d10; }
@keyframes chat-in { from { opacity: 0; translate: 0 12px; } }
@keyframes chat-caret { 50% { opacity: 0; } }
.chat__dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.chat__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: chat-dot 1s ease-in-out infinite; }
.chat__dots i:nth-child(2) { animation-delay: .15s; }
.chat__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 60%, 100% { opacity: .3; translate: 0 0; } 30% { opacity: 1; translate: 0 -4px; } }

/* suggested starts, under the agent's first question */
.chat__starts { display: grid; gap: 8px; margin: 2px 0 0 36px; animation: chat-in .5s var(--ex) .15s both; }
.chat__starts button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px rgb(2 23 20 / .1); text-align: start; cursor: pointer; transition: box-shadow .25s ease, background-color .25s ease, translate .3s var(--ex); }
.chat__starts span { display: grid; flex: 1; min-width: 0; gap: 2px; }
.chat__starts b { font-size: 14.5px; font-weight: 600; color: var(--coach); }
.chat__starts small { overflow: hidden; font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); }
.chat__starts svg { flex: none; width: 16px; height: 16px; color: var(--teal-ink); transition: translate .3s var(--ex); }
.chat__starts button:hover { background: color-mix(in srgb, var(--neon) 8%, #fff); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--neon) 70%, var(--teal)); }
.chat__starts button:hover svg { translate: 3px 0; }
.chat__starts button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* WhatsApp, as early as possible: one tap from the welcome screen ... */
.chat__quick { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 360px; margin-top: 8px; padding: 10px 14px 10px 10px; border-radius: 18px; background: #fff; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #25d366 55%, transparent), 0 6px 18px rgb(37 211 102 / .12); text-align: start; color: var(--coach); transition: box-shadow .25s ease, translate .3s var(--ex); }
.chat__quick .wa-icon { flex: none; width: 40px; height: 40px; padding: 9px; border-radius: 50%; background: #25d366; color: #fff; }
.chat__quick span { display: grid; flex: 1; min-width: 0; gap: 1px; }
.chat__quick b { font-size: 14.5px; font-weight: 600; }
.chat__quick small { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.chat__quick > svg:last-child { flex: none; width: 16px; height: 16px; color: #128c4a; transition: translate .3s var(--ex); }
.chat__quick:hover { box-shadow: inset 0 0 0 2px #25d366, 0 10px 24px rgb(37 211 102 / .2); }
.chat__quick:hover > svg:last-child { translate: 3px 0; }

/* ... a big card right after the agent's first reply ... */
.chat__go { position: relative; display: grid; gap: 8px; margin: 2px 0 4px 36px; padding: 18px 16px 14px; border-radius: 20px; background: linear-gradient(160deg, #e9fbf0, #fff 70%); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, #25d366 45%, transparent); animation: chat-in .5s var(--ex) .2s both; }
.chat__go-ic { position: absolute; top: -14px; right: 14px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #25d366; color: #fff; box-shadow: 0 6px 14px rgb(37 211 102 / .35); }
.chat__go-ic .wa-icon { width: 18px; height: 18px; }
.chat__go > b { font: 600 21px/1.2 var(--serif); letter-spacing: -0.01em; color: var(--coach); }
.chat__go > p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--body); }
.chat__go > a { display: flex; align-items: center; justify-content: center; gap: 9px; height: 50px; margin-top: 4px; border-radius: 100px; background: #25d366; font-size: 16px; font-weight: 600; color: #fff; box-shadow: 0 10px 24px rgb(37 211 102 / .3); animation: chat-nudge 2.4s ease-in-out 1.2s 3; }
.chat__go > a .wa-icon { width: 20px; height: 20px; }
.chat__go > a svg:last-child { width: 16px; height: 16px; }
.chat__go > a:hover { filter: brightness(.95); }
.chat__go > button { justify-self: center; padding: 4px; border: 0; background: none; font: 500 12.5px/1.3 var(--font); color: var(--muted); cursor: pointer; }
.chat__go > button u { font-weight: 600; color: var(--teal-ink); text-underline-offset: 2px; }
@keyframes chat-nudge { 0%, 70%, 100% { scale: 1; } 80% { scale: 1.04; } 90% { scale: .98; } }

/* ... and one strong button above the box from then on */
.chat__hand { flex: none; padding: 8px 12px 2px; animation: chat-in .45s var(--ex) both; }
.chat__hand[hidden], .chat__hand.is-tucked { display: none; }
.chat__carry { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 100px; background: #25d366; white-space: nowrap; color: #fff; transition: filter .2s ease; }
.chat__carry:hover { filter: brightness(.95); }
.chat__carry .wa-icon { flex: none; width: 18px; height: 18px; }
.chat__carry b { font-size: 14.5px; font-weight: 600; }
.chat__carry small { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; color: rgb(255 255 255 / .85); }
.chat__carry small::before { content: "· "; }

/* out of today's messages */
.chat__limit { display: grid; gap: 10px; margin: 4px 0; padding: 18px; border-radius: 20px; background: var(--coach); color: #fff; animation: chat-in .45s var(--ex) both; }
.chat__limit b { font: 600 22px/1.2 var(--serif); }
.chat__limit p { margin: 0; font-size: 14px; line-height: 1.5; color: color-mix(in srgb, #fff 78%, transparent); }
.chat__limit a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; margin-top: 4px; border-radius: 100px; background: #25d366; font-size: 15px; font-weight: 600; color: #fff; }
.chat__limit a .wa-icon { width: 18px; height: 18px; }
.chat__limit button { justify-self: center; padding: 4px; border: 0; background: none; font: 600 13.5px/1.2 var(--font); color: var(--neon); cursor: pointer; }

/* leave a number */
.chat__lead { display: grid; gap: 8px; margin: 4px 0; padding: 16px; border-radius: 20px; background: #fff; box-shadow: 0 0 0 1px rgb(2 23 20 / .1); animation: chat-in .45s var(--ex) both; }
.chat__lead > b { font: 600 21px/1.2 var(--serif); color: var(--coach); }
.chat__lead > p { margin: 0 0 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.chat__lead input:not([type="checkbox"]) { height: 46px; padding: 0 14px; border: 1px solid rgb(2 23 20 / .12); border-radius: 14px; background: #f7f9f8; font: 16px var(--font); color: var(--coach); }
.chat__lead input:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; background: #fff; }
.chat__lead label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.chat__lead label input { flex: none; width: 16px; height: 16px; margin-top: 1px; accent-color: var(--coach); }
.chat__lead button { height: 46px; border: 0; border-radius: 100px; background: var(--coach); font: 600 14.5px/1 var(--font); color: #fff; cursor: pointer; }
.chat__lead button:disabled { opacity: .6; cursor: wait; }
.chat__lead-err { margin: 0; font-size: 12.5px; color: #a3330f; }
.chat__lead-err[hidden] { display: none; }
.chat__hp { position: absolute; left: -9999px; width: 1px; height: 1px; }
.chat__done { display: grid; gap: 10px; padding: 16px; border-radius: 20px; background: color-mix(in srgb, var(--neon) 14%, #fff); animation: chat-in .45s var(--ex) both; }
.chat__done p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--coach); }
.chat__done a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; border-radius: 100px; background: #25d366; font-size: 15px; font-weight: 600; color: #fff; }
.chat__done .wa-icon { width: 18px; height: 18px; }

/* writing to the agent */
.chat__form { position: relative; flex: none; display: flex; align-items: flex-end; gap: 8px; margin: 4px 12px 0; padding: 6px 6px 6px 16px; border-radius: 26px; background: #fff; box-shadow: 0 0 0 1.5px rgb(2 23 20 / .14), 0 8px 24px rgb(2 23 20 / .06); transition: box-shadow .25s ease; }
.chat__form:focus-within { box-shadow: 0 0 0 2px var(--coach), 0 0 0 6px color-mix(in srgb, var(--neon) 35%, transparent); }
.chat__form textarea { flex: 1; min-width: 0; height: 42px; max-height: 120px; padding: 10px 0; overflow: hidden; border: 0; background: none; resize: none; font: 16px/1.4 var(--font); color: var(--coach); outline: none; }
.chat__form textarea::placeholder { color: color-mix(in srgb, var(--coach) 48%, #fff); }
.chat__form button { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--neon); color: var(--coach); cursor: pointer; transition: transform .2s var(--ex), opacity .2s ease, background-color .2s ease; }
.chat__form button svg { width: 18px; height: 18px; }
.chat__form button:disabled { background: rgb(2 23 20 / .08); color: rgb(2 23 20 / .35); cursor: default; }
.chat__form button:not(:disabled):active { transform: scale(.9); }
.chat__form button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.chat__count { position: absolute; top: -19px; right: 16px; font-size: 11px; font-weight: 600; color: var(--muted); }
.chat__count:empty { display: none; }
.chat__form.is-locked { box-shadow: 0 0 0 1.5px rgb(2 23 20 / .08); background: #f4f6f5; }
.chat__form.is-locked textarea::placeholder { color: var(--muted); }
.chat__foot { flex: none; margin: 0; padding: 9px 16px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); font-size: 11.5px; line-height: 1.4; text-align: center; color: var(--muted); }
.chat__foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat__left { font-weight: 600; color: var(--teal-ink); }
.chat__left.is-low { color: #a35a00; }
.chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .chat, .chat.is-open, .chat__row, .chat__starts, .chat__hand, .chat__lead, .chat__done, .chat__limit, .chat__go, .chat__go > a { transition: none; animation: none; }
  .agent, .agent svg, .chat__dots i, .chat__msg.is-streaming::after { animation: none; }
  .chat__log { scroll-behavior: auto; }
}
