/* ═══════════ Site-wide launcher ═══════════ */
/* Accessibility and consent widgets commonly sit at the maximum stacking
   value in the same corner. Sitting just below max keeps the launcher
   clickable without covering an accessibility control, and --pqa-bottom
   lets the two be separated vertically when they share a corner. */
/*
 * The wrapper is a positioning container, not a click target.
 *
 * A fixed element with only bottom and inset-inline-end set stretches
 * wider than its button, so clicks landed on empty wrapper area and the
 * handler on the button never fired. pointer-events:none makes the empty
 * space transparent to the cursor; the interactive children opt back in.
 */
.pqa-launcher{position:fixed;bottom:var(--pqa-bottom,20px);z-index:2147483000;
  display:flex;flex-direction:column;align-items:flex-end;gap:.5rem;
  width:max-content;max-width:calc(100vw - 32px);
  pointer-events:none;
  --line:#DDE4EC;--ink:#0F1E2E;--mut:#64788C;--accent:#0B6E99;--paper:#F5F8FA}
.pqa-pos-start{align-items:flex-start}

/* Everything the visitor can actually interact with */
.pqa-launcher > *,
.pqa-launch-btn,
.pqa-panel,
.pqa-badge{pointer-events:auto}
.pqa-pos-end{inset-inline-end:20px}
.pqa-pos-start{inset-inline-start:20px}

.pqa-launch-btn{display:inline-flex;align-items:center;gap:.5rem;
  background:var(--ink);color:#fff;border:0;border-radius:28px;
  padding:.75rem 1.25rem;font:inherit;font-size:.92rem;font-weight:500;
  cursor:pointer;box-shadow:0 4px 18px rgba(15,30,46,.22);
  transition:transform .15s ease,box-shadow .15s ease}
.pqa-launch-btn:hover{transform:translateY(-1px);box-shadow:0 6px 22px rgba(15,30,46,.28)}
.pqa-launch-btn:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.pqa-launch-icon{display:flex;line-height:0}
.is-open .pqa-launch-btn{background:var(--accent)}

/*
 * The panel is bounded by the viewport, not by a fixed height.
 *
 * A fixed log height plus head, input and footer overflowed the space
 * above the button and clipped the top of the conversation. The height is
 * now derived from what is actually available, and the log takes whatever
 * is left after the fixed rows.
 */
.pqa-panel{position:absolute;bottom:calc(100% + 12px);
  width:min(420px,calc(100vw - 32px));
  max-height:calc(100vh - var(--pqa-bottom,20px) - 96px);
  pointer-events:auto;
  background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;
  box-shadow:0 12px 40px rgba(15,30,46,.2);display:flex;flex-direction:column}
.pqa-pos-end .pqa-panel{inset-inline-end:0}
.pqa-pos-start .pqa-panel{inset-inline-start:0}
.pqa-panel[hidden]{display:none}

.pqa-panel-head{display:flex;align-items:flex-start;gap:.75rem;padding:.9rem 1.1rem;
  background:var(--ink);color:#fff}
.pqa-panel-head strong{display:block;font-size:.95rem}
.pqa-panel-head span{display:block;font-size:.78rem;color:#A9BCCC;margin-top:.15rem}
.pqa-panel-close{margin-inline-start:auto;background:transparent;border:0;color:#A9BCCC;
  font-size:1.5rem;line-height:1;cursor:pointer;padding:0 .2rem}
.pqa-panel-close:hover{color:#fff}
.pqa-panel-body{flex:1;min-height:0;display:flex;overflow:hidden}
.pqa-panel-body > .pqa-app{flex:1;min-height:0;display:flex}
.pqa-panel-foot{padding:.55rem 1.1rem;background:var(--paper);border-top:1px solid var(--line);
  font-size:.72rem;color:var(--mut);text-align:center}

/* Chat inside the panel — single column, no side rail */
.pqa-compact{display:flex;flex:1;min-height:0;margin:0;max-width:none;font-size:14px}
.pqa-compact .pqa-chat{border:0;border-radius:0;flex:1;min-height:0;display:flex;flex-direction:column}
.pqa-compact .pqa-log{height:auto;flex:1;min-height:140px}
.pqa-compact .pqa-in{flex:none}
.pqa-compact .pqa-head{display:none}
.pqa-compact .pqa-bub{max-width:90%;font-size:13.5px}
.pqa-compact .pqa-in{border-top:1px solid var(--line)}

@media(max-width:520px){
  .pqa-launcher{bottom:14px;width:auto}
  .pqa-pos-end{inset-inline-end:14px}
  .pqa-pos-start{inset-inline-start:14px}
  .pqa-launch-label{display:none}
  .pqa-launch-btn{padding:.85rem;border-radius:50%}
  .pqa-panel{position:fixed;inset:auto 8px 78px 8px;width:auto}
  .pqa-compact .pqa-log{min-height:120px}
}

@media(prefers-reduced-motion:reduce){
  .pqa-launch-btn{transition:none}
  .pqa-launch-btn:hover{transform:none}
}

/* ═══════════ Governance badge ═══════════ */
.pqa-badge{display:none;width:100%;align-items:center;gap:.45rem;
  background:#0B1826;color:#A9BCCC;border:0;border-top:1px solid rgba(255,255,255,.08);
  padding:.5rem 1.1rem;font:inherit;font-size:.72rem;cursor:pointer;text-align:start;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.pqa-badge[hidden]{display:none}
.pqa-badge:not([hidden]){display:flex}
.pqa-badge:hover{color:#fff}
.pqa-badge .dot{width:6px;height:6px;border-radius:50%;background:#4FD8A8;flex:none}
.pqa-badge.has-deny .dot{background:#F98B8B}
.pqa-badge .chev{margin-inline-start:auto;transition:transform .18s ease}
.badge-open .pqa-badge .chev{transform:rotate(180deg)}

.pqa-badge-list{display:none;background:#0B1826;padding:0 1.1rem .6rem;
  max-height:150px;overflow-y:auto}
.badge-open .pqa-badge-list{display:block}
.pqa-badge-row{display:flex;align-items:center;gap:.5rem;padding:.32rem 0;
  border-top:1px solid rgba(255,255,255,.05);direction:ltr;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.pqa-badge-row .k{font-size:10.5px;color:#fff;flex:1;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap}

.pqa-loading{padding:2.2rem 1.1rem;text-align:center;color:#64788C;font-size:.85rem}

@media(prefers-reduced-motion:reduce){ .pqa-badge .chev{transition:none} }

/* ═══════════════════════════════════════════════
   Full-window mode
   For pages where the conversation is the point, rather than a corner
   affordance. The launcher button still opens and closes it.
   ═══════════════════════════════════════════════ */
.pqa-size-full .pqa-panel{
  position:fixed;
  inset:max(24px, 6vh) max(24px, 6vw) max(24px, 6vh) auto;
  width:min(560px, calc(100vw - 48px));
  max-height:none;
  border-radius:14px}
.pqa-size-full.pqa-pos-start .pqa-panel{
  inset:max(24px, 6vh) auto max(24px, 6vh) max(24px, 6vw)}

/* A dimmed ground makes the panel read as a surface rather than a card */
.pqa-size-full.is-open::before{
  content:"";position:fixed;inset:0;background:rgba(8,18,30,.42);
  pointer-events:auto;z-index:-1;animation:pqa-fade .18s ease}
@keyframes pqa-fade{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.pqa-size-full.is-open::before{animation:none}}

@media(max-width:640px){
  .pqa-size-full .pqa-panel,
  .pqa-size-full.pqa-pos-start .pqa-panel{
    inset:8px;width:auto;border-radius:12px}
}
