/* SUPPORT, THE CHAT IN THE DASHBOARD (support.js). Tokens are the dashboard's own --alg-* set, so every theme (light, dark, sapphire) and
   the accent picker carry over. Desktop: a 392px panel above a bottom-right button. Phone (<= 700px): a full-screen sheet with a back arrow;
   the button sits above the tab bar. Nothing here styles anything outside #supwidget, except the one rule below the button
   needs: room at the foot of the page. */
/* THE BUTTON MUST NOT SIT ON THE LAST ROW (2026-11-11 audit: it covered a Connect button on Integrations and the "Included" badge on
   Plan & billing). While the button shows (desktop, not open), the page gets a foot as tall as the button and its margin, so the last
   row of any screen can always be scrolled clear of it. */
@media (min-width:701px){body:has(#supwidget:not([hidden]):not(.open)) #main{padding-bottom:72px}}
#supwidget{position:fixed;right:20px;bottom:20px;z-index:900;font-family:var(--alg-font,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);color:var(--alg-text-primary)}
#supwidget[hidden]{display:none}
#supwidget *{box-sizing:border-box}
.sup-fab{position:relative;display:inline-flex;align-items:center;gap:10px;min-height:48px;padding:0 20px 0 16px;border:0;border-radius:999px;cursor:pointer;
  background:var(--alg-fill);color:var(--alg-fill-ink);font:600 15px/1 var(--alg-font,inherit);box-shadow:0 8px 24px -8px rgba(6,9,19,.45),0 2px 6px rgba(6,9,19,.18)}
.sup-fab:hover{filter:brightness(1.07)}
.sup-fab:focus-visible,.sup-x:focus-visible,.sup-back:focus-visible,.sup-send:focus-visible{outline:3px solid var(--alg-accent);outline-offset:2px}
.sup-fab svg{width:22px;height:22px;flex:none;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sup-badge{position:absolute;top:-6px;right:-4px;min-width:22px;height:22px;padding:0 6px;border-radius:999px;display:flex;align-items:center;justify-content:center;
  background:var(--alg-attention,#E8590C);color:#fff;font:700 12px/1 var(--alg-font,inherit);border:2px solid var(--alg-bg)}
.sup-badge[hidden]{display:none}
#supwidget.open .sup-fab{display:none}

.sup-panel{position:absolute;right:0;bottom:0;width:392px;max-width:calc(100vw - 24px);height:min(600px,calc(100vh - 40px));display:flex;flex-direction:column;overflow:hidden;
  background:var(--alg-surface);border:1px solid var(--alg-card-border);border-radius:20px;box-shadow:0 24px 60px -12px rgba(6,9,19,.45)}
.sup-panel[hidden]{display:none}
.sup-head{display:flex;align-items:flex-start;gap:12px;padding:16px 14px 14px 16px;border-bottom:1px solid var(--alg-card-border)}
.sup-ava{flex:none;width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--alg-brand-soft,var(--alg-surface-variant));color:var(--alg-accent)}
.sup-ava svg{width:21px;height:21px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sup-ht{flex:1;min-width:0}
.sup-title{margin:0;font:700 17px/1.25 var(--alg-font,inherit)}
.sup-sub{margin:3px 0 0;font-size:13px;line-height:1.4;color:var(--alg-text-secondary)}
.sup-x,.sup-back{flex:none;width:40px;height:40px;border:0;border-radius:12px;background:transparent;color:var(--alg-text-primary);cursor:pointer;display:flex;align-items:center;justify-content:center}
.sup-x:hover,.sup-back:hover{background:var(--alg-surface-variant)}
.sup-x svg,.sup-back svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.sup-back{display:none}

.sup-log{flex:1;overflow-y:auto;overscroll-behavior:contain;padding:14px 14px 6px;display:flex;flex-direction:column;gap:12px;background:var(--alg-bg)}
.sup-empty{margin:auto 0;text-align:center;color:var(--alg-text-secondary);font-size:14px;line-height:1.5;padding:0 18px}
.sup-m{display:flex;flex-direction:column;max-width:86%;gap:4px}
.sup-m.me{align-self:flex-end;align-items:flex-end}
.sup-m.them{align-self:flex-start;align-items:flex-start}
.sup-b{margin:0;padding:10px 14px;border-radius:16px;font-size:15px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.sup-m.me .sup-b{background:var(--alg-fill);color:var(--alg-fill-ink);border-bottom-right-radius:6px}
.sup-m.them .sup-b{background:var(--alg-surface);color:var(--alg-text-primary);border:1px solid var(--alg-card-border);border-bottom-left-radius:6px}
.sup-m.team .sup-b{background:var(--alg-brand-soft,var(--alg-surface-variant));border-color:var(--alg-accent)}
.sup-meta{font-size:12px;color:var(--alg-text-secondary);padding:0 4px}
.sup-wait{align-self:stretch;margin:2px 0 0;padding:10px 12px;border-radius:12px;font-size:13px;line-height:1.4;color:var(--alg-text-secondary);background:var(--alg-surface-variant);text-align:center}
.sup-typing{align-self:flex-start;display:flex;gap:5px;padding:12px 14px;border-radius:16px;background:var(--alg-surface);border:1px solid var(--alg-card-border)}
.sup-typing i{width:7px;height:7px;border-radius:50%;background:var(--alg-text-secondary);animation:supdot 1.1s infinite ease-in-out}
.sup-typing i:nth-child(2){animation-delay:.15s}.sup-typing i:nth-child(3){animation-delay:.3s}
@keyframes supdot{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}
@media (prefers-reduced-motion:reduce){.sup-typing i{animation:none;opacity:.7}}

.sup-form{flex:none;padding:10px 14px 0;background:var(--alg-surface);border-top:1px solid var(--alg-card-border)}
.sup-row{display:flex;align-items:flex-end;gap:8px;padding:6px 6px 6px 14px;border:1.5px solid var(--alg-btn-border,var(--alg-card-border));border-radius:16px;background:var(--alg-bg)}
.sup-row:focus-within{border-color:var(--alg-accent)}
.sup-in{flex:1;min-width:0;max-height:120px;resize:none;border:0;outline:0;background:transparent;color:var(--alg-text-primary);font:400 16px/1.45 var(--alg-font,inherit);padding:8px 0}
.sup-in::placeholder{color:var(--alg-text-secondary)}
.sup-send{flex:none;width:44px;height:44px;border:0;border-radius:12px;background:var(--alg-fill);color:var(--alg-fill-ink);cursor:pointer;display:flex;align-items:center;justify-content:center}
.sup-send:disabled{opacity:.45;cursor:not-allowed}
.sup-send svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.sup-err{margin:8px 2px 0;font-size:13px;line-height:1.4;color:var(--alg-danger,#c0392b)}
.sup-err[hidden]{display:none}
.sup-note{margin:8px 2px 0;padding-bottom:12px;font-size:12.5px;line-height:1.4;color:var(--alg-text-secondary)}

@media (max-width:700px){
  #supwidget{right:12px;bottom:calc(var(--tabbar-h,60px) + var(--safe-b,0px) + 12px)}
  /* On a phone the floating button covered the Ask Muse box and the Talk to Muse button (2026-10-27): it is hidden
     here and "Write to Support" sits in the drawer the More tab opens. The open panel still shows full screen. */
  #supwidget:not(.open) .sup-fab{display:none}
  #supwidget.open{right:0;bottom:0}
  .sup-panel{position:fixed;inset:0;width:100vw;max-width:none;height:100vh;height:100dvh;border-radius:0;border:0;padding-top:env(safe-area-inset-top,0px)}
  .sup-back{display:flex}
  .sup-x{display:none}
  .sup-head{align-items:center;padding:10px 12px 12px 6px}
  .sup-form{padding-bottom:var(--safe-b,0px)}
  .sup-m{max-width:90%}
}
@media (prefers-reduced-motion:no-preference){.sup-panel{animation:supin .16s ease-out}@keyframes supin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}}
