/* ============================================================
   AMPLIFY — Max the Copilot (floating lower-right assistant)
   Sunrise studio light idiom (2026-11-01) · loaded on every admin page
   z-order: 750 — above page chrome (400–700), below modals (800)
   and toasts (900).
   ============================================================ */

/* ---------- collapsed: the floating spark ---------- */
.cp-fab{
  position:fixed;right:22px;bottom:22px;z-index:750;
  width:56px;height:56px;border-radius:50%;cursor:pointer;
  border:1px solid var(--maroon-deep);
  background:linear-gradient(160deg,var(--maroon),var(--maroon-deep));
  color:#fff;font-size:24px;line-height:1;
  display:flex;align-items:center;justify-content:center;
  box-shadow:var(--shadow-lift);
  transition:transform .18s ease, box-shadow .25s ease;
}
.cp-fab:hover{
  transform:translateY(-2px) scale(1.05);
  box-shadow:var(--shadow-lift);
}
.cp-fab .cp-spark{
  display:inline-block;
  animation:cp-breathe 3.4s ease-in-out infinite;
  text-shadow:none;
}
@keyframes cp-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.12)}}
.cp-badge{
  position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;
  padding:0 5px;border-radius:10px;
  background:var(--burnt-btn);
  color:#fff;font-size:11px;font-weight:800;line-height:20px;text-align:center;
  border:1px solid var(--white);
  box-shadow:var(--shadow-soft);
}
.cp-badge[hidden]{display:none}

/* ---------- open: the chat panel ---------- */
.cp-panel{
  position:fixed;right:22px;bottom:22px;z-index:750;
  width:min(380px, calc(100vw - 28px));
  max-height:min(70vh, 640px);
  display:flex;flex-direction:column;overflow:hidden;
  border-radius:18px;border:1px solid var(--tan);
  background:var(--cream);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  box-shadow:var(--shadow-lift);
  animation:cp-rise .22s ease;
}
@keyframes cp-rise{from{opacity:0;transform:translateY(14px) scale(.98)}to{opacity:1;transform:none}}
.cp-panel[hidden]{display:none}

.cp-head{
  display:flex;align-items:center;gap:10px;flex:0 0 auto;
  padding:12px 14px 10px;
  border-bottom:1px solid var(--tan);
}
.cp-head .cp-title{
  font-weight:800;letter-spacing:.02em;
  color:var(--maroon);
}
.cp-head .cp-sub{font-size:11px;color:var(--ink-dim-2)}
.cp-x{
  margin-left:auto;width:30px;height:30px;border-radius:9px;cursor:pointer;
  border:1px solid var(--tan);background:transparent;
  color:var(--ink-dim-2);font-size:14px;
}
.cp-x:hover{color:var(--ink-2);background:var(--tan-soft)}

/* suggestions strip */
.cp-sugg{flex:0 0 auto;max-height:132px;overflow-y:auto;padding:8px 12px 2px}
.cp-sugg:empty{display:none}
.cp-sugg .cp-sg-h{font-size:10px;font-weight:800;letter-spacing:.1em;color:var(--tan-text);text-transform:uppercase;margin:0 2px 6px}
.cp-sg{
  display:flex;align-items:flex-start;gap:8px;margin-bottom:6px;padding:7px 9px;
  border-radius:10px;border:1px solid var(--tan);
  background:var(--white);font-size:12px;color:var(--ink-2);
}
.cp-sg input[type=checkbox]{margin-top:2px;accent-color:var(--blue-2);cursor:pointer}
.cp-sg.done{opacity:.45;text-decoration:line-through}

/* message list */
.cp-msgs{flex:1 1 auto;overflow-y:auto;padding:12px 14px;display:flex;flex-direction:column;gap:10px;min-height:120px}
.cp-m{max-width:88%;padding:9px 12px;border-radius:14px;font-size:13px;line-height:1.5;white-space:pre-wrap;word-wrap:break-word}
.cp-m.user{
  align-self:flex-end;border-bottom-right-radius:5px;color:#fff;
  background:var(--blue-2);
}
.cp-m.bot{
  align-self:flex-start;border-bottom-left-radius:5px;color:var(--ink-2);
  background:var(--white);border:1px solid var(--tan);
}
.cp-m.err{border-color:var(--danger);background:var(--danger-soft);color:var(--danger)}
.cp-hello{font-size:12.5px;color:var(--ink-dim-2);text-align:center;padding:10px 6px}

/* thinking indicator */
.cp-think{flex:0 0 auto;display:flex;align-items:center;gap:8px;padding:2px 16px 8px;font-size:12px;color:var(--ink-dim-2)}
.cp-think[hidden]{display:none}
.cp-think i{width:6px;height:6px;border-radius:50%;background:var(--blue-2);animation:cp-dot 1.1s ease-in-out infinite}
.cp-think i:nth-child(2){animation-delay:.18s}
.cp-think i:nth-child(3){animation-delay:.36s}
@keyframes cp-dot{0%,100%{opacity:.25;transform:translateY(0)}50%{opacity:1;transform:translateY(-3px)}}

/* input row */
.cp-inrow{
  flex:0 0 auto;display:flex;gap:8px;padding:10px 12px 12px;
  border-top:1px solid var(--tan);
}
.cp-in{
  flex:1;resize:none;max-height:110px;padding:10px 12px;border-radius:12px;
  border:1px solid var(--tan);background:var(--white);
  color:var(--ink-2);font:inherit;font-size:13px;line-height:1.4;
}
.cp-in:focus{outline:none;border-color:var(--blue-2);box-shadow:0 0 0 3px var(--blue-soft)}
.cp-send{
  flex:0 0 auto;align-self:flex-end;width:40px;height:40px;border-radius:12px;cursor:pointer;
  border:1px solid var(--burnt-btn);
  background:var(--burnt-btn);
  color:#fff;font-size:16px;font-weight:800;
}
.cp-send:hover{background:var(--burnt-deep);border-color:var(--burnt-deep)}
.cp-send:disabled{opacity:.5;cursor:default}

@media (max-width:700px){
  .cp-fab{right:14px;bottom:calc(16px + env(safe-area-inset-bottom))}
  .cp-panel{right:14px;left:14px;bottom:calc(16px + env(safe-area-inset-bottom));width:auto}
}
/* portrait phones: the bottom tab bar exists — float above it */
@media (max-width:820px) and (orientation:portrait){
  .cp-fab{bottom:calc(84px + env(safe-area-inset-bottom))}
  .cp-panel{bottom:calc(84px + env(safe-area-inset-bottom))}
}
/* ≤640px: smaller spark (48px) + it yields/hides — see app.css V12 block
   (body:has rules there outrank these by specificity on purpose) */
@media (max-width:640px){
  .cp-fab{width:48px;height:48px;font-size:20px;right:12px}
}
/* desktop: the queue's sticky bulk bar owns the bottom edge — the spark rises */
@media (min-width:641px){
  body:has(.action-bar:not([hidden])) .cp-fab{bottom:104px}
}
