/* "Ask about your analysis" (app-paid-chat.js): a button at the foot of the window, and the panel it opens beside the
   page. On View A's tokens, so the light theme (app-theme-light.css) carries it. Under the skip
   link, over the views' own menus and cards (30–40). No style attributes. */
.pd-chat{position:fixed;right:20px;bottom:20px;z-index:200;display:flex;flex-direction:column;align-items:flex-end;pointer-events:none}
.pd-chat>*{pointer-events:auto}
.pd-chat-launch{display:inline-flex;align-items:center;gap:10px;min-height:48px;padding:10px 20px 10px 16px;border:0;border-radius:999px;
  background:var(--cyan);color:var(--bg);font:inherit;font-weight:600;box-shadow:0 10px 30px rgba(0,0,0,.35);cursor:pointer}
.pd-chat-launch:hover{box-shadow:0 12px 34px rgba(0,0,0,.45);text-decoration:underline;text-underline-offset:3px}
/* Docked: the bubble alone in a round button, the words folded away but still its name for screen readers. They open
   out on hover, on keyboard focus, and now and then by themselves (.is-wide, app-paid-chat.js). The phone has its own
   round button (app-phone.css). */
@media (min-width:641px){
  .pd-chat-launch{width:auto;min-width:48px;height:48px;gap:0;padding:0 15px;justify-content:center;transition:padding .25s ease,gap .25s ease}
  .pd-chat-launch-t{max-width:0;overflow:hidden;white-space:nowrap;opacity:0;transition:max-width .3s ease,opacity .2s ease}
  .pd-chat-launch:is(:hover,:focus-visible,.is-wide){gap:10px;padding:0 20px 0 16px}
  .pd-chat-launch:is(:hover,:focus-visible,.is-wide) .pd-chat-launch-t{max-width:16em;opacity:1}
}
@media (min-width:641px) and (prefers-reduced-motion:reduce){
  .pd-chat-launch,.pd-chat-launch-t{transition:none}
}
/* A speech bubble, drawn: a rounded box with a tail at its foot. */
.pd-chat-icon{position:relative;width:18px;height:14px;border:2px solid currentColor;border-radius:7px;flex:none}
.pd-chat-icon::after{content:"";position:absolute;left:2px;bottom:-6px;width:6px;height:6px;border-left:2px solid currentColor;border-bottom:2px solid currentColor;background:var(--cyan);transform:skewY(-30deg)}

.pd-chat-panel{display:flex;flex-direction:column;width:min(420px,calc(100vw - 32px));height:min(620px,calc(100vh - 40px));height:min(620px,calc(100dvh - 40px));
  border:1px solid var(--line2);border-radius:18px;background:var(--card);color:var(--fg);box-shadow:0 24px 60px rgba(0,0,0,.45);overflow:hidden}
.pd-chat-panel[hidden]{display:none}
.pd-chat-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 8px 10px 18px;border-bottom:1px solid var(--line)}
.pd-chat-h{font-size:1.05rem;margin:0}
.pd-chat-close{position:relative;width:44px;height:44px;flex:none;border:0;border-radius:50%;background:transparent;color:var(--fg);cursor:pointer}
.pd-chat-close::before,.pd-chat-close::after{content:"";position:absolute;left:50%;top:50%;width:16px;height:2px;border-radius:1px;background:currentColor}
.pd-chat-close::before{transform:translate(-50%,-50%) rotate(45deg)}
.pd-chat-close::after{transform:translate(-50%,-50%) rotate(-45deg)}
.pd-chat-close:hover{background:var(--line)}

/* Positioned, so a message's offsetTop is measured from here (app-paid-chat.js scrolls an answer to its start). */
.pd-chat-body{position:relative;flex:1;overflow-y:auto;overscroll-behavior:contain;padding:14px 18px}
.pd-chat-intro{margin:0 0 12px;color:var(--dim);font-size:.94rem}
.pd-chat-log{display:flex;flex-direction:column;gap:10px;list-style:none;margin:0;padding:0}
.pd-chat-msg{max-width:92%;padding:10px 14px;border-radius:14px;font-size:.94rem;line-height:1.5}
.pd-chat-msg p{margin:0}
.pd-chat-msg p+p,.pd-chat-msg p+ul,.pd-chat-msg ul+p{margin-top:8px}
.pd-chat-msg ul{margin:6px 0 0;padding-left:18px;list-style:disc}
.pd-chat-msg li{margin:3px 0}
.pd-chat-msg.is-you{align-self:flex-end;border-bottom-right-radius:4px;background:var(--cyan);color:var(--bg);white-space:pre-wrap}
.pd-chat-msg.is-bot{align-self:flex-start;border:1px solid var(--line);border-bottom-left-radius:4px;background:var(--card2)}
.pd-chat-msg.is-wait{display:inline-flex;align-items:center;gap:8px;color:var(--dim)}
.pd-chat-msg.is-error{border-color:var(--red)}
.pd-chat-msg.is-error .link{margin-top:6px}
.pd-chat-dots{display:inline-flex;gap:4px}
.pd-chat-dots i{width:6px;height:6px;border-radius:50%;background:currentColor;animation:pd-chat-dot 1.2s infinite ease-in-out}
.pd-chat-dots i:nth-child(2){animation-delay:.15s}
.pd-chat-dots i:nth-child(3){animation-delay:.3s}
@keyframes pd-chat-dot{0%,80%,100%{opacity:.25;transform:none}40%{opacity:1;transform:translateY(-3px)}}

.pd-chat-suggest{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
.pd-chat-suggest[hidden]{display:none}
.pd-chat-chip{min-height:40px;padding:8px 14px;line-height:1.35;text-align:left;white-space:normal}
.pd-chat-chip:focus-visible{outline:2px solid var(--yellow);outline-offset:2px}
.pd-chat-chip[disabled]{opacity:.5;cursor:not-allowed}

.pd-chat-form{display:flex;align-items:flex-end;gap:8px;padding:12px 14px 8px;border-top:1px solid var(--line)}
.pd-chat-input{flex:1;min-height:44px;max-height:140px;resize:vertical;padding:10px 12px;border:1px solid var(--line2);border-radius:12px;
  background:var(--bg2);color:var(--fg);font:inherit;font-size:.94rem;line-height:1.4}
.pd-chat-input::placeholder{color:var(--dim2)}
.pd-chat-send{min-height:44px}
.pd-chat-fine{margin:0;padding:0 16px 12px;color:var(--dim2);font-size:.8rem;line-height:1.45}

/* A phone: the panel takes the width of the window, and most of its height. */
@media (max-width:640px){
  .pd-chat{left:12px;right:12px;bottom:12px}
  .pd-chat-panel{width:100%;height:min(80vh,calc(100vh - 24px));height:min(80dvh,calc(100dvh - 24px))}
}
@media (prefers-reduced-motion:reduce){.pd-chat-dots i{animation:none;opacity:.6}}
@media print{.pd-chat{display:none}}
