/* AI / standard-answers chat widget. Uses the theme's color tokens, so it follows dark/light mode. */
.zps-chat{position:fixed;right:1rem;bottom:calc(1rem + env(safe-area-inset-bottom,0px));z-index:150;font-family:var(--body)}
/* Room for the chat button at the very bottom of the page: on phones extra space under the footer,
   on larger screens only a small bottom padding. */
body.has-chat .site-footer{padding-bottom:calc(4.5rem + env(safe-area-inset-bottom,0px))}
@media (min-width:40rem){
  body.has-chat .site-footer{padding-bottom:calc(1.5rem + env(safe-area-inset-bottom,0px))}
}

/* launcher: a gold pill with a speech-bubble icon */
.chat-launcher{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:.5rem;min-height:56px;min-width:56px;padding:0 1.15rem 0 1rem;border:0;border-radius:999px;background:var(--gold);color:var(--on-gold);font:800 1rem var(--display);cursor:pointer;box-shadow:0 8px 24px rgba(0,0,0,.4),0 0 0 3px rgba(242,183,5,.25)}
.chat-launcher:hover{filter:brightness(1.07);transform:translateY(-1px)}
.chat-ico{fill:currentColor}
.chat-ico .bubble{fill:currentColor}
.chat-ico .dot{fill:var(--gold)}
.chat-launcher-label{display:none}
@media (min-width:40rem){.chat-launcher-short{display:none}.chat-launcher-label{display:inline}}
.zps-chat.is-open .chat-launcher,.zps-chat.is-open .chat-teaser{display:none}
@media (prefers-reduced-motion:no-preference){
  .chat-launcher::after{content:"";position:absolute;inset:-4px;border-radius:inherit;border:3px solid var(--gold);opacity:0;animation:zpsring 2.4s ease-out 1.5s 3}
  @keyframes zpsring{0%{transform:scale(.92);opacity:.7}100%{transform:scale(1.25);opacity:0}}
  .chat-launcher{transition:transform .15s ease,filter .15s}
}

/* small "need help?" bubble above the launcher (shown once per visit) */
.chat-teaser{position:absolute;right:0;bottom:calc(100% + .7rem);display:flex;align-items:stretch;width:max-content;max-width:min(16rem,calc(100vw - 2rem));background:var(--surface);color:var(--ink);border:2px solid var(--ink);border-radius:16px 16px 4px 16px;box-shadow:0 10px 28px rgba(0,0,0,.35)}
.chat-teaser[hidden]{display:none}
.chat-teaser-open{padding:.65rem .5rem .65rem .9rem;border:0;background:none;color:inherit;font:700 .95rem/1.25 var(--body);text-align:left;cursor:pointer}
.chat-teaser-x{align-self:flex-start;display:grid;place-items:center;width:30px;height:30px;margin:.25rem .25rem 0 0;border:0;border-radius:50%;background:none;color:var(--muted);cursor:pointer}
.chat-teaser-x svg{fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round}
@media (prefers-reduced-motion:no-preference){.chat-teaser:not([hidden]){animation:zpsrise .35s ease}}

/* panel */
.chat-panel{position:fixed;right:1rem;bottom:calc(1rem + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;width:min(25rem,calc(100vw - 2rem));height:min(38rem,calc(100dvh - 2rem));background:var(--surface);color:var(--ink);border:2px solid var(--ink);border-radius:20px;box-shadow:0 20px 56px rgba(0,0,0,.5);overflow:hidden}
.chat-panel[hidden]{display:none}
@media (prefers-reduced-motion:no-preference){.chat-panel:not([hidden]){animation:zpsrise .28s ease}@keyframes zpsrise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}}
@media (max-width:39.99rem){.chat-panel{inset:.5rem;width:auto;height:auto;border-radius:18px}}

.chat-head{display:flex;align-items:center;gap:.65rem;padding:.7rem .8rem;background:var(--green);color:var(--on-green)}
.chat-avatar{display:grid;place-items:center;flex:none;width:42px;height:42px;border-radius:50%;background:var(--gold)}
.chat-id{flex:1;min-width:0}
.chat-title-row{display:flex;align-items:center;gap:.4rem;min-width:0}
.chat-title{font-family:var(--display);font-stretch:108%;font-weight:800;font-size:1.05rem;line-height:1.1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-badge{flex:none;padding:.05rem .4rem;border-radius:999px;background:var(--gold);color:var(--on-gold);font:800 .7rem var(--display)}
.chat-status{display:flex;align-items:center;gap:.35rem;margin-top:.15rem;font-size:.8rem;opacity:.92;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-online{flex:none;width:.5rem;height:.5rem;border-radius:50%;background:#46e08a;box-shadow:0 0 0 3px rgba(70,224,138,.25)}
.chat-langs{display:flex;flex:none;border:2px solid currentColor;border-radius:999px;overflow:hidden}
.chat-langs[hidden]{display:none}
.chat-langs button{min-width:36px;height:34px;padding:0 .45rem;border:0;background:transparent;color:inherit;font:800 .8rem var(--display);cursor:pointer}
.chat-langs button[aria-pressed="true"]{background:var(--on-green);color:var(--green)}
.chat-close{display:inline-flex;align-items:center;justify-content:center;flex:none;width:38px;height:38px;border:2px solid currentColor;border-radius:50%;background:transparent;color:inherit;cursor:pointer}
.chat-close svg,.chat-send-ico{fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.chat-close:hover{background:var(--on-green);color:var(--green)}

.chat-log{flex:1;overflow-y:auto;padding:1rem .9rem;display:flex;flex-direction:column;gap:.65rem;background:var(--bg);overscroll-behavior:contain;scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){.chat-log{scroll-behavior:auto}}
.chat-log:focus-visible{outline-offset:-3px}
.chat-msg{max-width:88%;padding:.65rem .9rem;border-radius:16px;line-height:1.45;font-size:1rem;white-space:pre-wrap;overflow-wrap:anywhere}
.chat-msg a{color:inherit;font-weight:700}
.chat-msg.bot{align-self:flex-start;background:var(--surface);border:2px solid var(--line);border-bottom-left-radius:4px}
.chat-msg.me{align-self:flex-end;background:var(--gold);color:var(--on-gold);border-bottom-right-radius:4px;font-weight:500}
.chat-msg.note{align-self:center;max-width:100%;background:transparent;color:var(--muted);font-size:.88rem;text-align:center;padding:.2rem .5rem}
@media (prefers-reduced-motion:no-preference){.chat-msg{animation:zpsrise .22s ease}}

/* link buttons inside answers (instead of long URLs) */
.chat-actions{display:flex;flex-wrap:wrap;gap:.45rem;margin-top:.65rem;white-space:normal}
.chat-action{display:inline-flex;align-items:center;gap:.4rem;min-height:40px;padding:0 .9rem;border-radius:999px;background:var(--gold);color:var(--on-gold)!important;font:800 .92rem var(--body);text-decoration:none}
.chat-action:hover{filter:brightness(1.08)}
.chat-action svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}

.chat-chips{display:flex;flex-wrap:wrap;gap:.5rem;margin-top:.1rem}
.chat-chip{min-height:44px;padding:.45rem 1rem;border:2px solid var(--ink);border-radius:999px;background:var(--surface);color:var(--ink);font:700 .95rem var(--body);cursor:pointer}
.chat-chip:hover,.chat-chip.suggested{background:var(--green);border-color:var(--green);color:var(--on-green)}
.chat-typing{display:inline-flex;gap:.25rem;align-items:center;padding:.15rem 0}
.chat-typing i{width:.5rem;height:.5rem;border-radius:50%;background:var(--muted);opacity:.5}
@media (prefers-reduced-motion:no-preference){.chat-typing i{animation:zpsdot 1s infinite ease-in-out}.chat-typing i:nth-child(2){animation-delay:.15s}.chat-typing i:nth-child(3){animation-delay:.3s}@keyframes zpsdot{0%,80%,100%{opacity:.25}40%{opacity:1}}}

.chat-quick{display:flex;flex-wrap:wrap;gap:.4rem;padding:.6rem .9rem 0;background:var(--surface);border-top:2px solid var(--line)}
.chat-quick:empty{display:none}
.chat-quick a{display:inline-flex;align-items:center;gap:.35rem;min-height:36px;padding:0 .8rem;border:2px solid var(--line);border-radius:999px;color:var(--ink);font:700 .9rem var(--body);text-decoration:none}
.chat-quick a:hover{border-color:var(--gold)}
.chat-quick svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}

.chat-form{display:flex;gap:.5rem;padding:.6rem .9rem;background:var(--surface)}
.chat-input{flex:1;min-width:0;min-height:48px;padding:.5rem 1rem;border:2px solid var(--ink);border-radius:999px;background:var(--bg);color:var(--ink);font:400 1rem var(--body)}
.chat-input:disabled{opacity:.6}
.chat-send{display:inline-flex;align-items:center;justify-content:center;gap:.4rem;flex:none;min-height:48px;min-width:48px;padding:0 1.1rem;border:0;border-radius:999px;background:var(--gold);color:var(--on-gold);font:800 1rem var(--display);cursor:pointer}
.chat-send:disabled{opacity:.5;cursor:default}
.chat-send-ico{display:none}
@media (max-width:25rem){.chat-send{padding:0}.chat-send-text{display:none}.chat-send-ico{display:block}}
.chat-note{padding:0 .9rem .7rem;background:var(--surface);color:var(--muted);font-size:.8rem;line-height:1.3}

@media print{.zps-chat{display:none}}

/* tighter header on phones so the full name fits */
@media (max-width:39.99rem){
  .chat-head{gap:.5rem;padding:.65rem .7rem}
  .chat-avatar{width:36px;height:36px}
  .chat-avatar svg{width:22px;height:22px}
  .chat-langs button{min-width:32px;height:32px;padding:0 .35rem}
  .chat-close{width:34px;height:34px}
  .chat-title{font-size:1rem}
}

/* Phones: no big empty band under the footer. The copyright line wraps in the space left of the chat button instead. */
@media (max-width:39.99rem){
  body.has-chat .site-footer{padding-bottom:calc(1rem + env(safe-area-inset-bottom,0px))}
  body.has-chat .footer-bar{padding-right:6.5rem;text-align:left;justify-content:flex-start}
  body.has-chat .footer-copy{justify-content:flex-start;margin:0;min-height:44px;align-items:center}
}

/* Human SMS handoff */
.chat-human{display:flex;align-items:center;gap:.65rem;padding:.65rem .9rem;background:var(--surface);border-top:2px solid var(--line);flex-shrink:0}
.chat-human-label{flex:1;margin:0;font-size:.85rem;line-height:1.3;color:var(--ink)}
.chat-human-link{display:inline-flex;align-items:center;justify-content:center;min-height:40px;padding:.35rem .7rem;border-radius:999px;background:var(--gold);color:#10261e;font-weight:700;text-decoration:none;text-align:center;flex-shrink:0}
.chat-human-link:hover{text-decoration:underline}
.chat-log{min-height:0}

/* Modal chat: keep the page stationary and size the panel to the visible viewport. */
html.zps-chat-locked,html.zps-chat-locked body{overflow:hidden!important;overscroll-behavior:none}
html.zps-chat-locked{height:100%}
.zps-chat.is-open{inset:0;z-index:10000;isolation:isolate;overscroll-behavior:none}
.zps-chat.is-open::before{content:"";position:fixed;inset:0;background:rgba(0,0,0,.46);touch-action:none;z-index:0}
.zps-chat.is-open .chat-panel{z-index:1;bottom:auto;top:calc(var(--chat-vtop,0px) + max(.5rem,calc(var(--chat-vh,100dvh) - 39rem)));height:min(38rem,calc(var(--chat-vh,100dvh) - 1rem));max-height:calc(var(--chat-vh,100dvh) - 1rem);animation:none}
.chat-head,.chat-human,.chat-quick,.chat-form,.chat-note{flex-shrink:0}
.chat-log{flex:1 1 0;min-height:0;overscroll-behavior:contain;overflow-y:auto;-webkit-overflow-scrolling:touch;scroll-behavior:auto}
.chat-log>*{flex-shrink:0}
.chat-form .chat-input{width:0;min-width:0;min-height:48px;font-size:max(16px,1rem);padding:.5rem .8rem;border-radius:12px;pointer-events:auto;touch-action:manipulation}
.chat-form .chat-send{pointer-events:auto;touch-action:manipulation}
.chat-log{touch-action:pan-y}
.chat-note{margin:0}
@media (max-width:39.99rem){
  .zps-chat.is-open .chat-panel{top:calc(var(--chat-vtop,0px) + .25rem);right:.25rem;left:.25rem;bottom:auto;width:auto;height:calc(var(--chat-vh,100dvh) - .5rem);max-height:calc(var(--chat-vh,100dvh) - .5rem);border-radius:14px}
  .chat-form{padding-bottom:calc(.6rem + env(safe-area-inset-bottom,0px))}
  .chat-keyboard .chat-form{padding-bottom:.45rem}
}
/* Prioritize the conversation and composer when the keyboard leaves little room. */
.chat-compact .chat-head{padding:.35rem .6rem}
.chat-compact .chat-human{padding:.3rem .6rem;gap:.4rem}
.chat-compact .chat-human-label{font-size:.75rem}
.chat-compact .chat-human-link{min-height:36px}
.chat-compact .chat-quick{display:none}
.chat-compact .chat-form{padding:.35rem .6rem}
.chat-compact .chat-note{font-size:.72rem;padding:0 .6rem .25rem}
.chat-compact .chat-log{padding:.5rem .6rem}

@media (max-width:39.99rem){.chat-keyboard .chat-note{display:none}.chat-keyboard .chat-quick{display:none}.chat-keyboard .chat-human{padding:.3rem .6rem}.chat-keyboard .chat-human-label{font-size:.75rem}}
