/* Motion is local to the conversation, with no animation runtime. */
.popoto-chat-launcher {
  --chat-ease: cubic-bezier(.16, 1, .3, 1);
  position: fixed; z-index: 45;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom) + var(--chat-keyboard-offset, 0px));
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 58px; padding: 10px 19px 10px 12px; border: 0; border-radius: 30px;
  background: #4d2a9b; color: #fff; box-shadow: 0 10px 28px #33215a30;
  font-size: 14px; font-weight: 500;
  transition: transform 220ms var(--chat-ease), background-color 180ms;
}
.popoto-chat-launcher:hover { background: #5d35b5; transform: translateY(-3px); }
.popoto-chat-launcher:active { transform: scale(.97); }
.popoto-chat-launcher-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #ffffff1a; transition: transform 300ms var(--chat-ease); }
.popoto-chat-launcher svg { width: 21px; height: 21px; }
.popoto-chat-launcher-copy { display: grid; gap: 2px; text-align: left; line-height: 1.3; }
.popoto-chat-launcher-copy [data-chat-presence] { color: #e2d8fa; font-size: 11px; font-weight: 400; }
.popoto-chat-launcher-copy [data-chat-presence]::before { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 5px 1px 0; border-radius: 50%; background: #cdb9f4; }
.popoto-chat-launcher.is-online [data-chat-presence]::before { background: #a4edcd; }
.popoto-chat-launcher[aria-expanded="true"] .popoto-chat-launcher-icon { transform: rotate(-8deg); }
.popoto-chat-panel svg, .popoto-chat-launcher svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.popoto-chat-panel {
  --chat-ease: cubic-bezier(.16, 1, .3, 1); --chat-sent: #6940cf;
  position: fixed; z-index: 46;
  inset: auto max(20px, env(safe-area-inset-right)) calc(90px + env(safe-area-inset-bottom) + var(--chat-keyboard-offset, 0px)) auto;
  display: none; flex-direction: column;
  width: min(400px, calc(100vw - 32px)); height: 620px;
  max-height: calc(var(--chat-viewport-height, 100dvh) - 112px - env(safe-area-inset-bottom));
  margin: 0; padding: 0; border: 0; border-radius: 24px; overflow: hidden;
  background: var(--paper); color: var(--ink); box-shadow: 0 24px 72px #21143c38;
  font: 400 14px/1.55 Inter, 'Helvetica Neue', sans-serif; transform-origin: bottom right;
}
.popoto-chat-panel:not([popover]).is-open { display: flex; animation: popoto-chat-open 360ms var(--chat-ease); }
.popoto-chat-panel:popover-open { display: flex; animation: popoto-chat-open 360ms var(--chat-ease); }
.popoto-chat-panel::backdrop { background: transparent; }
html[data-theme="dark"] .popoto-chat-panel { --chat-sent: #7143da; box-shadow: 0 24px 72px #000b; background: #111014; }
.popoto-chat-panel ::selection { background: #cbb7f6; color: #291c48; }
.popoto-chat-header { display: flex; align-items: center; gap: 13px; flex: none; padding: 23px 22px; background: #4d2a9b; color: #fff; }
.popoto-chat-avatar { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 15px; background: #684bb4; }
.popoto-chat-header .popoto-chat-brandmark { width: 25px; height: 25px; fill: #fff; stroke: none; }
.popoto-chat-header > .popoto-chat-identity { flex: 1; min-width: 0; }
.popoto-chat-header h2 { margin: 0 0 6px; font-size: 27px; line-height: 1; letter-spacing: -.04em; font-weight: 600; }
.popoto-chat-header h2 > span { color: #c7b0ff; }
.popoto-chat-header h2:focus { outline: none; }
.popoto-chat-header p { color: #e4d9ff; font-size: 12px; margin: 0; }
.popoto-chat-availability { display: flex; align-items: center; gap: 7px; }
.popoto-chat-availability-dot { width: 6px; height: 6px; border-radius: 50%; background: #cdb9f4; }
.popoto-chat-panel.is-online .popoto-chat-availability-dot { background: #a4edcd; }
.popoto-chat-close { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; margin: 0 -8px 0 0; padding: 12px; border: 0; border-radius: 50%; background: transparent; color: #fff; transition: background-color 160ms, transform 180ms var(--chat-ease); }
.popoto-chat-close:hover { background: #ffffff1a; transform: rotate(90deg); }
.popoto-chat-close svg { width: 19px; height: 19px; }
.popoto-chat-preview { flex: none; margin: 0; padding: 8px 22px; background: var(--surface-accent); color: var(--violet-text); font-size: 11px; }
.popoto-chat-log { flex: 1; min-height: 40px; overflow-y: auto; overscroll-behavior: contain; padding: 24px 22px 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.popoto-chat-welcome { padding: 4px 4px 14px; }
.popoto-chat-welcome-art { width: 90px; height: 72px; margin-bottom: 18px; color: var(--violet-text); }
.popoto-chat-welcome-art .chat-art-mark { fill: var(--violet-text); stroke: none; }
.popoto-chat-welcome-art .chat-art-outline { stroke: var(--line-accent); stroke-width: 1.4; }
.popoto-chat-welcome-art .chat-art-spark { stroke: var(--amber); stroke-width: 1.6; }
.popoto-chat-panel.is-open .chat-art-outline { animation: popoto-chat-line 650ms var(--chat-ease); }
.popoto-chat-panel.is-open .chat-art-mark { animation: popoto-chat-mark 600ms var(--chat-ease); }
.popoto-chat-welcome h3 { margin: 0 0 12px; font-size: 33px; font-weight: 500; line-height: 1.08; letter-spacing: -.035em; text-wrap: balance; }
.popoto-chat-welcome h3 span { display: block; color: var(--violet-text); }
.popoto-chat-welcome p { max-width: 33ch; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.popoto-chat-message { width: fit-content; max-width: 90%; margin: 0 0 20px; overflow-wrap: anywhere; }
.popoto-chat-message.is-visitor { margin-left: auto; }
.popoto-chat-bubble { padding: 13px 16px; border-radius: 5px 18px 18px 18px; background: var(--surface); }
.popoto-chat-bubble > p { white-space: pre-wrap; margin: 0; font-size: 14px; line-height: 1.65; }
.popoto-chat-message.is-visitor .popoto-chat-bubble { border-radius: 18px 5px 18px 18px; background: var(--chat-sent); color: #fff; }
.popoto-chat-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin: 0 3px 6px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.popoto-chat-meta strong { color: var(--ink); font-size: 11px; font-weight: 500; }
.popoto-chat-delivery { display: block; margin: 6px 3px 0; color: var(--muted); font-size: 10px; text-align: right; }
.popoto-chat-delivery.is-failed { color: var(--error); }
.popoto-chat-message.is-new { animation: popoto-chat-message 320ms var(--chat-ease); }
.popoto-chat-resend { display: block; min-height: 44px; margin-top: 3px; padding: 8px 3px; border: 0; background: transparent; color: var(--violet-text); font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.popoto-chat-connection { flex: none; margin: 0; padding: 0 22px 12px; color: var(--muted); font-size: 12px; }
.popoto-chat-connection button { min-height: 44px; padding: 6px 0; border: 0; background: transparent; color: var(--violet-text); font-weight: 500; }
.popoto-chat-form { flex: none; padding: 17px 20px 10px; background: var(--surface); }
.popoto-chat-form label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 500; }
.popoto-chat-email-field { margin-bottom: 13px; }
.popoto-chat-email-details { margin: 0 0 6px; }
.popoto-chat-email-details summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; color: var(--violet-text); font-size: 12px; }
.popoto-chat-email-details summary svg { width: 16px; height: 16px; flex: none; }
.popoto-chat-email-details summary::after { content: ''; width: 6px; height: 6px; margin-left: auto; margin-right: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 180ms var(--chat-ease); }
.popoto-chat-email-details[open] summary::after { transform: rotate(225deg); }
.popoto-chat-email-details summary::-webkit-details-marker { display: none; }
.popoto-chat-panel.is-away .popoto-chat-email-details summary { display: none; }
.popoto-chat-email-field input { width: 100%; min-height: 46px; padding: 11px 13px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.4; caret-color: var(--violet-text); transition: border-color 160ms; }
.popoto-chat-email-field input:focus-visible { border-color: var(--violet-text); }
.popoto-chat-email-field input::placeholder { color: var(--muted); opacity: 1; }
.popoto-chat-email-error { margin: 6px 0 0; color: var(--error); font-size: 12px; }
.popoto-chat-form [aria-invalid="true"] { border-color: var(--error); }
.popoto-chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 5px; border: 1px solid var(--field-line); border-radius: 16px; background: var(--paper); transition: border-color 160ms; }
.popoto-chat-compose:focus-within { border-color: var(--violet-text); }
.popoto-chat-compose textarea { display: block; flex: 1; width: 0; min-width: 0; min-height: 48px; height: 48px; max-height: 120px; padding: 11px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); caret-color: var(--violet-text); font-size: 16px; line-height: 1.5; resize: none; }
.popoto-chat-compose textarea::placeholder { color: var(--muted); opacity: 1; }
.popoto-chat-compose textarea:focus-visible { outline-offset: 0; }
.popoto-chat-send { display: grid; place-items: center; flex: 0 0 46px; min-height: 46px; width: 46px; padding: 11px; border: 0; border-radius: 12px; background: var(--chat-sent); color: #fff; transition: background-color 160ms, transform 160ms var(--chat-ease); }
.popoto-chat-send svg { width: 22px; height: 22px; transition: transform 200ms var(--chat-ease); }
.popoto-chat-send:hover { background: #5931b5; }
.popoto-chat-send:hover svg { transform: translate(2px, -2px); }
.popoto-chat-send:active { transform: scale(.94); }
.popoto-chat-send:disabled { background: var(--surface-soft); color: var(--muted); cursor: wait; }
.popoto-chat-send.is-sending svg { animation: popoto-chat-sending 800ms ease-in-out infinite; }
.popoto-chat-panel.is-page-hidden * { animation-play-state: paused; }
.popoto-chat-send-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.popoto-chat-feedback { margin: 8px 0 0; color: var(--error); font-size: 12px; }
.popoto-chat-feedback:empty { display: none; }
.popoto-chat-feedback.is-neutral { color: var(--muted); }
.popoto-chat-feedback.is-success { color: var(--success); }
.popoto-chat-privacy { flex: none; margin: 0; padding: 0 20px 16px; background: var(--surface); color: var(--muted); font-size: 11px; line-height: 1.5; }
.popoto-chat-privacy a { color: var(--violet-text); text-decoration: underline; text-underline-offset: 3px; }
.popoto-chat-panel :focus-visible, .popoto-chat-launcher:focus-visible { outline: 2px solid var(--violet-text); outline-offset: 3px; }
.popoto-chat-header :focus-visible { outline-color: #fff; }
.popoto-chat-log:focus-visible { outline-offset: -3px; }
@keyframes popoto-chat-open { from { opacity: .3; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes popoto-chat-message { from { opacity: .5; transform: translateY(9px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes popoto-chat-mark { from { transform: translate(-5px, 7px) rotate(-8deg); } to { transform: none; } }
@keyframes popoto-chat-line { from { stroke-dasharray: 200; stroke-dashoffset: 200; } to { stroke-dasharray: 200; stroke-dashoffset: 0; } }
@keyframes popoto-chat-sending { 50% { opacity: .35; transform: translate(2px, -2px); } }
@supports (transition-behavior: allow-discrete) and (overlay: auto) {
  .popoto-chat-panel[popover] { opacity: 0; transform: translateY(14px) scale(.97); transition: opacity 180ms ease-out, transform 240ms var(--chat-ease), display 240ms, overlay 240ms; transition-behavior: allow-discrete; }
  .popoto-chat-panel:popover-open { opacity: 1; transform: none; animation: none; transition-duration: 360ms; }
  @starting-style { .popoto-chat-panel:popover-open { opacity: 0; transform: translateY(18px) scale(.96); } }
}
@media (max-width: 440px) {
  .popoto-chat-launcher { right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom) + var(--chat-keyboard-offset, 0px)); min-height: 54px; }
  .popoto-chat-panel { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom) + var(--chat-keyboard-offset, 0px)); width: calc(100vw - 24px); max-height: calc(var(--chat-viewport-height, 100dvh) - 94px - env(safe-area-inset-bottom)); border-radius: 22px; }
  .popoto-chat-header { padding: 18px; }
  .popoto-chat-log { padding: 20px 18px 14px; }
  .popoto-chat-welcome h3 { font-size: 30px; }
  .popoto-chat-welcome-art { width: 76px; height: 60px; margin-bottom: 15px; }
  .popoto-chat-form { padding: 14px 16px 10px; }
  .popoto-chat-preview, .popoto-chat-connection { padding-inline: 18px; }
  .popoto-chat-privacy { padding: 0 16px 14px; }
}
.popoto-chat-panel.is-compact { bottom: calc(12px + env(safe-area-inset-bottom) + var(--chat-keyboard-offset, 0px)); max-height: calc(var(--chat-viewport-height, 100dvh) - 24px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) var(--surface); }
.popoto-chat-panel.is-compact > :not(.popoto-chat-log) { flex: none; }
.popoto-chat-panel.is-compact .popoto-chat-header { padding: 9px 16px; gap: 10px; }
.popoto-chat-panel.is-compact .popoto-chat-header h2 { margin-bottom: 4px; font-size: 22px; }
.popoto-chat-panel.is-compact .popoto-chat-header p { font-size: 11px; }
.popoto-chat-panel.is-compact .popoto-chat-avatar { flex-basis: 34px; width: 34px; height: 34px; border-radius: 11px; }
.popoto-chat-panel.is-compact .popoto-chat-brandmark { width: 20px; height: 20px; }
.popoto-chat-panel.is-compact .popoto-chat-preview { padding: 6px 16px; font-size: 11px; }
.popoto-chat-panel.is-compact .popoto-chat-log { min-height: 0; padding: 10px 16px; }
.popoto-chat-panel.is-compact .popoto-chat-welcome { padding: 0; }
.popoto-chat-panel.is-compact .popoto-chat-welcome-art { display: none; }
.popoto-chat-panel.is-compact .popoto-chat-welcome h3 { margin-bottom: 7px; font-size: 23px; }
.popoto-chat-panel.is-compact .popoto-chat-welcome h3 span { display: inline; }
.popoto-chat-panel.is-compact .popoto-chat-welcome p { font-size: 12px; }
.popoto-chat-panel.is-compact .popoto-chat-message { margin-bottom: 12px; }
.popoto-chat-panel.is-compact .popoto-chat-bubble { padding: 10px 13px; }
.popoto-chat-panel.is-compact .popoto-chat-connection { padding: 0 16px 6px; }
.popoto-chat-panel.is-compact .popoto-chat-form { padding: 9px 16px 6px; }
.popoto-chat-panel.is-compact .popoto-chat-email-field { margin-bottom: 8px; }
.popoto-chat-panel.is-compact .popoto-chat-form label { margin-bottom: 5px; }
.popoto-chat-panel.is-compact .popoto-chat-compose textarea { max-height: 48px; }
.popoto-chat-panel.is-compact .popoto-chat-feedback { margin-top: 5px; }
.popoto-chat-panel.is-compact .popoto-chat-privacy { padding: 0 16px 9px; line-height: 1.4; }
.popoto-chat-launcher.is-chat-open-compact { display: none; }
@media (prefers-reduced-motion: reduce) {
  .popoto-chat-panel, .popoto-chat-panel[popover], .popoto-chat-launcher, .popoto-chat-panel * { animation: none !important; transition-duration: 80ms !important; }
  .popoto-chat-panel[popover], .popoto-chat-panel:popover-open, .popoto-chat-launcher:hover, .popoto-chat-launcher:active, .popoto-chat-close:hover, .popoto-chat-send:active, .popoto-chat-send:hover svg { transform: none; }
  @starting-style { .popoto-chat-panel:popover-open { transform: none; } }
}
.reduce-motion .popoto-chat-panel, .reduce-motion .popoto-chat-panel *, .reduce-motion .popoto-chat-launcher { animation: none !important; transition-duration: 80ms !important; }
.reduce-motion .popoto-chat-panel[popover], .reduce-motion .popoto-chat-panel:popover-open, .reduce-motion .popoto-chat-launcher:hover, .reduce-motion .popoto-chat-close:hover, .reduce-motion .popoto-chat-send:hover svg { transform: none; }

/* Leave the page readable on small screens; the full label stays accessible. */
@media (max-width: 600px) {
  .popoto-chat-launcher { inline-size: 56px; block-size: 56px; min-inline-size: 56px; padding: 10px; border-radius: 50%; justify-content: center; }
  .popoto-chat-launcher-copy { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .popoto-chat-launcher.is-online::after { content: ''; position: absolute; inset-block-start: 2px; inset-inline-end: 2px; inline-size: 10px; block-size: 10px; border: 2px solid var(--paper); border-radius: 50%; background: #a4edcd; }
}
