/* Website chat (round 7 v10, owner Nov 2): a launcher bottom-right and a panel in the site's own monochrome system,
   light and dark from the site tokens, a full-screen sheet on phones. chat.js builds it only when /api/chat/status is on. */
/* The launcher (owner, Nov 3: "keep a minimal icon for chat"): a small ink circle with a plain chat outline. Open on a
   desktop, the outline turns into a close mark; on a phone the sheet covers it. */
.lc-launch{position:fixed;right:20px;bottom:20px;z-index:70;display:grid;place-items:center;width:48px;height:48px;padding:0;border:0;border-radius:50%;
  background:var(--ink);color:var(--bg);box-shadow:0 1px 2px rgb(0 0 0 / .1),0 8px 20px -12px rgb(0 0 0 / .45);cursor:pointer;
  -webkit-tap-highlight-color:transparent;transition:transform .2s var(--ease),opacity .2s var(--ease)}
.lc-launch:hover{transform:translateY(-1px)}
.lc-launch:active{transform:scale(.95)}
.lc-launch:focus-visible{outline:2px solid var(--focus);outline-offset:3px}
.lc-launch svg{grid-area:1/1;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;
  transition:opacity .18s var(--ease),transform .25s var(--ease)}
.lc-launch .lc-i-x{width:20px;height:20px;opacity:0;transform:rotate(-45deg) scale(.7)}
.lc-launch[aria-expanded=true] .lc-i-chat{opacity:0;transform:scale(.7)}
.lc-launch[aria-expanded=true] .lc-i-x{opacity:1;transform:none}
.lc-dot{position:absolute;top:0;right:0;width:12px;height:12px;border-radius:50%;background:var(--bg);box-shadow:inset 0 0 0 3px var(--ink),0 0 0 2px var(--bg)}
.lc-dot[hidden]{display:none}
html[data-theme=dark] .lc-launch{box-shadow:0 0 0 1px rgb(255 255 255 / .12),0 8px 20px -12px rgb(0 0 0 / .9)}

.lc-panel{position:fixed;right:20px;bottom:80px;z-index:70;display:flex;flex-direction:column;width:380px;height:min(600px,calc(100vh - 120px));overflow:hidden;
  border-radius:20px;background:var(--raised);color:var(--ink);box-shadow:0 0 0 1px var(--line-strong),0 2px 4px rgb(0 0 0 / .04),0 28px 64px -24px rgb(0 0 0 / .35);
  font:400 14px/20px var(--font);transform-origin:100% 100%;animation:lc-in .28s var(--ease)}
.lc-panel[hidden]{display:none}
.lc-panel:focus{outline:none}
html[data-theme=dark] .lc-panel{background:#141415;box-shadow:0 0 0 1px #2a2a2c,0 28px 64px -24px rgb(0 0 0 / .9)}
@keyframes lc-in{from{opacity:0;transform:translateY(8px) scale(.97)}}
.lc-panel p{margin:0}
.lc-head{display:flex;align-items:center;gap:12px;padding:14px 12px 14px 16px;border-bottom:1px solid var(--line)}
.lc-mark{display:grid;flex:none;place-items:center;width:32px;height:32px;border-radius:9px;background:var(--ink);color:var(--bg)}
.lc-mark svg{width:15px;height:15px;fill:currentColor}
.lc-who{flex:1;min-width:0}
.lc-title{font-size:15px;font-weight:500;line-height:20px}
.lc-sub{color:var(--muted);font-size:12px;line-height:16px}
.lc-x{display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:none;color:var(--muted);cursor:pointer}
.lc-x:hover{background:var(--surface);color:var(--ink)}
.lc-x:focus-visible,.lc-chip:focus-visible,.lc-send:focus-visible,.lc-new:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
.lc-x svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}

.lc-log{flex:1;display:flex;flex-direction:column;gap:8px;padding:16px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.lc-msg{max-width:82%;padding:9px 13px;border-radius:16px;overflow-wrap:anywhere;white-space:pre-wrap}
.lc-msg.is-new{animation:lc-msg .22s var(--ease)}
@keyframes lc-msg{from{opacity:0;transform:translateY(4px)}}
.lc-msg.from-assistant,.lc-msg.from-team{align-self:flex-start;border-bottom-left-radius:6px;background:var(--surface)}
html[data-theme=dark] .lc-msg.from-assistant,html[data-theme=dark] .lc-msg.from-team{background:#232325}
.lc-msg.from-you{align-self:flex-end;border-bottom-right-radius:6px;background:var(--ink);color:var(--bg)}
.lc-msg.is-pending{opacity:.6}
.lc-name{align-self:flex-start;margin:4px 0 -4px 4px;color:var(--muted);font-size:12px;line-height:16px}
.lc-note{align-self:center;margin:4px 0;color:var(--muted);font-size:12px;line-height:16px;text-align:center}
.lc-chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.lc-chip{min-height:32px;padding:0 12px;border:0;border-radius:999px;background:none;box-shadow:inset 0 0 0 1px var(--line-strong);color:var(--ink);font:500 13px/1 var(--font);cursor:pointer;transition:background-color .15s var(--ease)}
.lc-chip:hover{background:var(--surface)}
.lc-typing{display:flex;gap:4px;align-self:flex-start;padding:13px 14px;border-radius:16px;border-bottom-left-radius:6px;background:var(--surface)}
html[data-theme=dark] .lc-typing{background:#232325}
.lc-typing i{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:lc-dot 1.2s infinite ease-in-out}
.lc-typing i:nth-child(2){animation-delay:.15s}.lc-typing i:nth-child(3){animation-delay:.3s}
@keyframes lc-dot{0%,60%,100%{opacity:.35;transform:none}30%{opacity:1;transform:translateY(-2px)}}
.lc-end{display:grid;justify-items:center;gap:10px;margin:8px 0}
.lc-new{min-height:36px;padding:0 16px;border:0;border-radius:999px;background:var(--ink);color:var(--bg);font:500 13px/1 var(--font);cursor:pointer}

.lc-error{padding:0 16px 8px;color:var(--ink-2);font-size:12px;line-height:16px}
.lc-error[hidden]{display:none}
.lc-form{display:flex;align-items:flex-end;gap:8px;margin:0 12px;padding:8px 8px 8px 14px;border-radius:18px;box-shadow:inset 0 0 0 1px var(--line-strong);background:var(--bg)}
html[data-theme=dark] .lc-form{background:#0e0e0f}
.lc-form:focus-within{box-shadow:inset 0 0 0 1px var(--ink)}
.lc-form textarea{flex:1;min-width:0;max-height:120px;margin:0;padding:6px 0;border:0;background:none;color:var(--ink);font:400 15px/20px var(--font);resize:none;outline:none}
.lc-form textarea::placeholder{color:var(--faint)}
.lc-hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
.lc-send{display:grid;flex:none;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:50%;background:var(--ink);color:var(--bg);cursor:pointer;transition:opacity .15s var(--ease)}
.lc-send:disabled{opacity:.25;cursor:default}
.lc-send svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.lc-fine{padding:8px 16px 12px;color:var(--muted);font-size:12px;line-height:16px;text-align:center}
.lc-fine a{color:inherit;text-decoration:underline;text-underline-offset:2px}

@media (max-width:640px){
  .lc-launch{right:16px;bottom:16px}
  .lc-panel{inset:0;width:auto;height:100%;height:100dvh;border-radius:0;box-shadow:none;animation:lc-up .3s var(--ease)}
  html[data-theme=dark] .lc-panel{box-shadow:none}
  .lc-launch[aria-expanded=true]{opacity:0;pointer-events:none}
  html.lc-open,html.lc-open body{overflow:hidden;overscroll-behavior:none}
  .lc-head{padding-top:max(14px,env(safe-area-inset-top))}
  .lc-fine{padding-bottom:max(12px,env(safe-area-inset-bottom))}
  .lc-form textarea{font-size:16px}
}
@keyframes lc-up{from{transform:translateY(24px);opacity:0}}
@media (prefers-reduced-motion:reduce){.lc-panel,.lc-msg.is-new,.lc-typing i{animation:none}.lc-launch,.lc-launch svg{transition:none}}
@media print{.lc-launch,.lc-panel{display:none}}
