/* Scoped chat styles reuse the landing page's cream / navy / indigo tokens. Mobile-first messenger layout. */
.chat-launcher{position:fixed;right:24px;bottom:max(24px,env(safe-area-inset-bottom));z-index:30;display:flex;align-items:center;gap:12px;padding:14px 20px;min-height:54px;border:1px solid #716bee;border-radius:999px;background:var(--ink);color:white;box-shadow:0 8px 28px #19223830;font-size:15px;font-weight:500;transition:transform .15s,background .15s}
.chat-launcher:hover{background:var(--brand-dark);transform:translateY(-2px)}
.chat-launcher svg{width:22px;height:22px;flex:none}

.chat-dialog{position:fixed;inset:auto 24px 24px auto;margin:0;padding:0;width:min(440px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 48px);height:min(720px,calc(100dvh - 48px));border:1px solid var(--line);border-radius:16px;background:var(--paper);color:var(--ink);box-shadow:0 24px 100px #19223845;overflow:hidden;font-size:15px;line-height:1.65}
.chat-dialog::backdrop{background:#19223830;backdrop-filter:blur(2px)}
.chat-dialog[open]{display:flex;flex-direction:column}
.chat-dialog :focus-visible{outline-offset:2px}

/* Header: avatar, name + live status, restart, close */
.chat-header{display:flex;align-items:center;gap:12px;padding:12px 14px 12px 16px;background:var(--ink);color:white;flex:none}
.chat-avatar{width:38px;height:38px;border-radius:50%;background:var(--brand);display:grid;place-items:center;flex:none}
.chat-avatar svg{width:20px;height:20px;color:white}
.chat-head-text{flex:1;min-width:0}
.chat-header h2{font-size:17px;font-weight:600;letter-spacing:0;line-height:1.3;margin:0}
.chat-status{display:flex;align-items:center;gap:6px;font-size:12px;color:#c4c8d8;margin:2px 0 0}
.chat-status:before{content:"";width:7px;height:7px;border-radius:50%;background:#8a90a6;flex:none}
.chat-dialog[data-ready=true] .chat-status:before{background:#3ccf91}
.chat-head-btn{background:none;border:1px solid #4d566e;color:#dfe2ee;border-radius:999px;padding:4px 12px;min-height:36px;font-size:13px}
.chat-close{background:none;border:0;color:white;min-width:40px;min-height:40px;font-size:26px;line-height:1;border-radius:50%}
.chat-close:hover,.chat-head-btn:hover{background:#ffffff14}
.chat-header :focus-visible{outline-color:#b1adff}

/* Conversation */
.chat-scroll{padding:16px;overflow-y:auto;min-height:0;overscroll-behavior:contain;flex:1;display:flex;flex-direction:column;gap:12px}
.chat-log{display:flex;flex-direction:column;gap:12px}
/* Messenger feel: a short conversation sits just above the composer, not at the top of an empty panel. */
.chat-scroll>.chat-welcome{margin-top:auto}
.chat-log:empty{display:none}
.chat-message{padding:11px 14px;background:white;border:1px solid var(--line);border-radius:4px 16px 16px 16px;max-width:88%;overflow-wrap:anywhere;align-self:flex-start}
.chat-message--user{align-self:flex-end;background:var(--brand);border-color:var(--brand);color:white;border-radius:16px 4px 16px 16px}
.chat-message p{margin:0;font-size:15px;white-space:pre-wrap}
.chat-message[data-state=pending]{opacity:.75}
.chat-message[data-state=failed]{background:#fff4e5;border-color:#e2b26b;color:var(--ink)}
.chat-welcome small{display:block;margin-top:6px;font-size:12px;color:var(--muted);line-height:1.5}
.chat-typing{display:flex;gap:4px;padding:14px 16px}
.chat-typing i{width:7px;height:7px;border-radius:50%;background:#9a9db0;animation:chat-dot 1.2s infinite}
.chat-typing i:nth-child(2){animation-delay:.15s}.chat-typing i:nth-child(3){animation-delay:.3s}
@keyframes chat-dot{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
.chat-suggestions{display:flex;flex-wrap:wrap;gap:8px}
.chat-suggestions button,.chat-chip{background:white;border:1px solid #d5d2e7;color:var(--brand-dark);border-radius:999px;padding:7px 14px;min-height:38px;font-size:14px;text-align:left;line-height:1.4}
.chat-suggestions button:hover,.chat-chip:hover{background:var(--lavender)}
.chat-cooldown{font-size:13px;color:#795015;margin:0}
.chat-cooldown:empty{display:none}
.chat-link{align-self:flex-start;background:none;border:0;padding:6px 0;color:var(--brand-dark);text-decoration:underline;text-underline-offset:3px;font-size:14px;min-height:40px}

/* Composer: pill input + round send button */
.chat-dialog .chat-form{flex:none;background:white;margin:0;padding:10px 12px max(12px,env(safe-area-inset-bottom));border:0;border-top:1px solid var(--line);box-shadow:none;display:flex;flex-direction:column;gap:8px}
.chat-form .chat-chip{align-self:flex-start;min-height:34px;padding:5px 12px;font-size:13px}
.chat-compose{display:flex;align-items:flex-end;gap:8px}
.chat-dialog .chat-compose textarea{flex:1;min-height:46px;max-height:140px;resize:none;font-size:16px;line-height:1.45;padding:11px 16px;margin:0;background:var(--paper);border:1px solid #d4d4df;border-radius:23px;overflow-y:auto}
.chat-dialog .chat-compose textarea:focus{border-color:var(--brand);outline:none;box-shadow:0 0 0 3px #4f46e522}
.chat-send{width:46px;height:46px;min-width:46px;border-radius:50%;border:0;background:var(--brand);color:white;display:grid;place-items:center;padding:0;transition:background .15s,transform .1s}
.chat-send svg{width:22px;height:22px}
.chat-send:hover:not(:disabled){background:var(--brand-dark)}
.chat-send:active:not(:disabled){transform:scale(.94)}
.chat-send:disabled{background:#c9c8d8;cursor:default}
.chat-count{font-size:11px;color:var(--muted);text-align:right;margin:-4px 6px 0}
.chat-count:empty{display:none}

/* Callback form (inside the conversation) */
.chat-dialog .chat-callback-form{padding:14px;background:white;border:1px solid var(--line);border-radius:12px;box-shadow:none}
.chat-callback-form h3{font-size:16px;font-weight:600;margin:0 0 4px}
.chat-privacy{font-size:12px;color:var(--muted);margin:0 0 6px;line-height:1.5}
.chat-callback-form label{display:block;font-size:13px;font-weight:500;margin:10px 0 4px}
.chat-callback-form label small{font-weight:400;color:var(--muted)}
.chat-callback-form input:not([type=checkbox]),.chat-callback-form textarea,.chat-callback-form select{width:100%;font-size:16px;padding:9px 12px;border:1px solid #d4d4df;border-radius:10px;background:var(--paper);color:var(--ink);margin:0}
.chat-callback-form textarea{resize:vertical;min-height:52px}
.chat-dialog .chat-consent{display:flex;gap:8px;align-items:center;font-size:13px;font-weight:400;margin:12px 0 0}
.chat-consent input{width:18px;height:18px;min-width:18px;margin:0;accent-color:var(--brand)}
.chat-callback-actions{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:12px}
.chat-primary{background:var(--brand);color:white;border:0;border-radius:999px;padding:10px 20px;min-height:44px;font-size:14px;font-weight:500}
.chat-primary:hover:not(:disabled){background:var(--brand-dark)}
.chat-primary:disabled{opacity:.6}
.chat-callback-status{font-size:13px;margin:8px 0 0}
.chat-callback-status:empty{display:none}

.chat-fallback{padding:12px 24px;text-align:center;font-size:13px}
.chat-fallback a{text-decoration:underline;overflow-wrap:anywhere}

/* Phones: full screen, launcher as compact pill */
@media(max-width:520px){
  .chat-launcher{right:16px;bottom:max(16px,env(safe-area-inset-bottom));padding:12px 18px;min-height:50px}
  .chat-dialog{inset:0;width:100vw;height:100dvh;max-height:100dvh;border-radius:0;border:0}
  .chat-header{padding-top:max(12px,env(safe-area-inset-top))}
  .chat-message{max-width:92%}
}
@media(min-width:521px){.chat-dialog[open]{animation:chat-in .22s ease-out;transform-origin:bottom right}}
@keyframes chat-in{from{opacity:0;transform:translateY(16px) scale(.98)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.chat-typing i{animation:none;opacity:.6}.chat-dialog[open]{animation:none}}
