/* ============================================================
   Happy Solutions Assistant — chat widget
   ============================================================ */
.hsa{ position:fixed; inset:0; z-index:90; pointer-events:none; }
.hsa__scrim{ position:absolute; inset:0; background:rgba(10,28,16,.42); opacity:0; transition:opacity .28s ease; }
.hsa__panel{
  position:absolute; right:clamp(14px,3vw,28px); bottom:clamp(14px,3vw,28px);
  width:min(420px, calc(100vw - 28px)); height:min(640px, calc(100svh - 40px));
  background:#fff; border-radius:22px; box-shadow:0 30px 70px rgba(8,28,15,.34);
  display:flex; flex-direction:column; overflow:hidden;
  transform:translateY(24px) scale(.97); opacity:0;
  transition:transform .32s cubic-bezier(.2,.7,.3,1), opacity .26s ease;
}
.hsa.open{ pointer-events:auto; }
.hsa.open .hsa__scrim{ opacity:1; }
.hsa.open .hsa__panel{ transform:none; opacity:1; }

/* header */
.hsa__head{
  display:flex; align-items:center; gap:12px; padding:15px 16px;
  background:linear-gradient(135deg,var(--green-800),var(--green-700)); color:#fff; flex:none;
}
.hsa__av{ width:42px; height:42px; border-radius:50%; background:rgba(255,255,255,.16); display:grid; place-items:center; flex:none; }
.hsa__av img{ width:30px; height:30px; }
.hsa__id b{ font-family:var(--font-head); font-weight:800; font-size:1rem; display:block; line-height:1.1; }
.hsa__id span{ font-size:.76rem; color:#cfe6c0; display:flex; align-items:center; gap:6px; }
.hsa__id span::before{ content:""; width:7px; height:7px; border-radius:50%; background:#7bd88f; box-shadow:0 0 0 0 rgba(123,216,143,.6); animation:hsaDot 2s infinite; }
@keyframes hsaDot{ 70%{ box-shadow:0 0 0 6px rgba(123,216,143,0);} }
.hsa__close{ margin-left:auto; width:38px; height:38px; border-radius:11px; display:grid; place-items:center; color:#fff; transition:background .2s; }
.hsa__close:hover{ background:rgba(255,255,255,.16); }
.hsa__close .icon{ width:22px; height:22px; }

/* progress */
.hsa__prog{ height:3px; background:rgba(255,255,255,.18); flex:none; }
.hsa__prog i{ display:block; height:100%; width:0%; background:var(--lime); transition:width .4s ease; }

/* body */
.hsa__body{ flex:1; overflow-y:auto; padding:18px 16px 8px; display:flex; flex-direction:column; gap:12px; scroll-behavior:smooth; background:var(--mist); }
.hsa__body::-webkit-scrollbar{ width:8px; }
.hsa__body::-webkit-scrollbar-thumb{ background:#d4ddcc; border-radius:8px; }

.hsa-row{ display:flex; gap:9px; align-items:flex-end; max-width:90%; }
.hsa-row.bot{ align-self:flex-start; }
.hsa-row.user{ align-self:flex-end; flex-direction:row-reverse; }
.hsa-row__av{ width:28px; height:28px; border-radius:50%; background:var(--green-100); display:grid; place-items:center; flex:none; margin-bottom:2px; }
.hsa-row__av img{ width:20px; height:20px; }
.hsa-bub{
  padding:11px 14px; border-radius:16px; font-size:.95rem; line-height:1.5; max-width:100%;
  box-shadow:0 1px 2px rgba(16,40,25,.07);
}
.hsa-row.bot .hsa-bub{ background:#fff; color:var(--ink); border-bottom-left-radius:5px; }
.hsa-row.user .hsa-bub{ background:var(--green-700); color:#fff; border-bottom-right-radius:5px; }
.hsa-bub b{ font-weight:700; }
.hsa-bub.photos{ display:flex; flex-wrap:wrap; gap:6px; padding:8px; }
.hsa-bub.photos img{ width:64px; height:64px; object-fit:cover; border-radius:9px; }

/* typing */
.hsa-typing{ display:flex; gap:4px; padding:13px 14px; }
.hsa-typing i{ width:7px; height:7px; border-radius:50%; background:#b7c4ad; animation:hsaType 1.2s infinite; }
.hsa-typing i:nth-child(2){ animation-delay:.18s; } .hsa-typing i:nth-child(3){ animation-delay:.36s; }
@keyframes hsaType{ 0%,60%,100%{ transform:translateY(0); opacity:.5;} 30%{ transform:translateY(-4px); opacity:1;} }

/* footer / input zone */
.hsa__foot{ flex:none; border-top:1px solid var(--line); background:#fff; padding:12px; }
.hsa-chips{ display:flex; flex-wrap:wrap; gap:8px; }
.hsa-chip{
  font-family:var(--font-head); font-weight:600; font-size:.86rem; color:var(--green-800);
  background:var(--green-50); border:1.5px solid var(--green-100); border-radius:var(--r-pill);
  padding:.5em .9em; transition:all .16s; cursor:pointer;
}
.hsa-chip:hover{ background:var(--green-700); color:#fff; border-color:var(--green-700); transform:translateY(-1px); }
.hsa-input{ display:flex; gap:8px; align-items:flex-end; }
.hsa-input textarea, .hsa-input input{
  flex:1; font-family:var(--font-body); font-size:.95rem; color:var(--ink);
  background:var(--mist); border:1.5px solid var(--line); border-radius:14px;
  padding:.7em .85em; resize:none; max-height:120px; line-height:1.4;
}
.hsa-input textarea:focus, .hsa-input input:focus{ outline:none; border-color:var(--green-500); background:#fff; }
.hsa-send{
  width:44px; height:44px; flex:none; border-radius:13px; background:var(--green-700); color:#fff;
  display:grid; place-items:center; transition:background .2s, transform .15s;
}
.hsa-send:hover{ background:var(--green-600); }
.hsa-send:disabled{ background:#c4d0bb; cursor:default; }
.hsa-send .icon{ width:20px; height:20px; }
.hsa-skip{ background:none; color:var(--slate); font-family:var(--font-head); font-weight:600; font-size:.82rem; padding:.4em .2em; cursor:pointer; text-decoration:underline; }
.hsa-skip:hover{ color:var(--green-700); }

/* photo upload */
.hsa-up{ display:flex; flex-direction:column; gap:10px; }
.hsa-up__drop{
  border:2px dashed var(--green-100); border-radius:14px; padding:16px; text-align:center;
  color:var(--slate); font-size:.9rem; cursor:pointer; transition:border-color .2s, background .2s;
  display:flex; flex-direction:column; align-items:center; gap:6px;
}
.hsa-up__drop:hover{ border-color:var(--green-500); background:var(--green-50); }
.hsa-up__drop .icon{ width:26px; height:26px; color:var(--green-600); }
.hsa-prev{ display:flex; flex-wrap:wrap; gap:8px; }
.hsa-prev__item{ position:relative; width:62px; height:62px; border-radius:10px; overflow:hidden; box-shadow:var(--sh-1); }
.hsa-prev__item img{ width:100%; height:100%; object-fit:cover; }
.hsa-prev__rm{ position:absolute; top:2px; right:2px; width:20px; height:20px; border-radius:50%; background:rgba(0,0,0,.6); color:#fff; display:grid; place-items:center; }
.hsa-prev__rm .icon{ width:13px; height:13px; }
.hsa-up__actions{ display:flex; align-items:center; justify-content:space-between; gap:10px; }

/* launcher tab inside chip already exists (.fab-quote) */

/* mobile: full sheet */
@media (max-width: 520px){
  .hsa__panel{ right:0; bottom:0; width:100vw; height:100svh; border-radius:0; }
}
@media (prefers-reduced-motion: reduce){
  .hsa__panel{ transition:opacity .2s; transform:none; }
  .hsa__id span::before, .hsa-typing i{ animation:none; }
}
