/* FLEX APO — floating contact widget ("chatbot" style avatar bubble) */
.fa-chat{position:fixed;right:20px;bottom:20px;z-index:970;font-family:var(--body);}
.fa-chat *{box-sizing:border-box;}

/* -- launcher bubble -- */
.fa-chat-btn{
  position:relative;width:66px;height:66px;border-radius:50%;border:0;padding:0;
  background:var(--white);cursor:pointer;box-shadow:var(--shadow);
  display:flex;align-items:center;justify-content:center;
  animation:fa-settle .6s ease-out;
  transition:transform .25s ease,box-shadow .25s ease;
}
.fa-chat-btn:hover{transform:translateY(-2px) scale(1.04);}
.fa-chat-btn:focus-visible{outline:3px solid var(--g600);outline-offset:3px;}
.fa-chat.open .fa-chat-btn{animation:none;}

.fa-avatar{
  position:relative;width:100%;height:100%;border-radius:50%;overflow:hidden;
  border:3px solid var(--g900);background:var(--white);
}
.fa-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 8%;display:block;}

.fa-dot{
  position:absolute;right:2px;bottom:2px;width:16px;height:16px;border-radius:50%;
  background:var(--lime);border:3px solid var(--white);
}
.fa-dot::after{
  content:"";position:absolute;inset:-4px;border-radius:50%;border:2px solid var(--lime);
  opacity:.55;animation:fa-pulse 2.2s ease-out infinite;
}
.fa-chat-btn .i-close{display:none;color:var(--g900);}
.fa-chat.open .fa-chat-btn .fa-avatar{display:none;}
.fa-chat.open .fa-chat-btn .i-close{display:flex;align-items:center;justify-content:center;width:100%;height:100%;}
.fa-chat.open .fa-chat-btn{background:var(--tint);}
.fa-chat.open .fa-chat-btn .i-close svg{width:26px;height:26px;stroke:var(--g900);fill:none;stroke-width:2.2;stroke-linecap:round;}

/* -- greeting nudge bubble, shown once -- */
.fa-nudge{
  position:absolute;right:80px;bottom:10px;width:max-content;max-width:200px;background:var(--white);
  color:var(--ink);padding:11px 30px 11px 14px;border-radius:14px 14px 4px 14px;box-shadow:var(--shadow);
  font-size:13px;line-height:1.4;opacity:0;transform:translateY(6px);pointer-events:none;
  transition:opacity .35s ease,transform .35s ease;
}
.fa-nudge.show{opacity:1;transform:translateY(0);pointer-events:auto;}
.fa-chat.open .fa-nudge{opacity:0;pointer-events:none;}
.fa-nudge-close{
  position:absolute;top:6px;right:6px;width:18px;height:18px;border:0;border-radius:50%;
  background:transparent;color:var(--muted);font-size:15px;line-height:1;cursor:pointer;
  display:flex;align-items:center;justify-content:center;padding:0;
}
.fa-nudge-close:hover{background:var(--tint);color:var(--ink);}

/* -- panel -- */
.fa-panel{
  position:absolute;right:0;bottom:82px;width:min(360px,calc(100vw - 40px));
  background:var(--white);border-radius:var(--radius);box-shadow:var(--shadow);
  border:1px solid var(--line);overflow:hidden;
  opacity:0;transform:translateY(14px) scale(.98);pointer-events:none;
  transition:opacity .22s ease,transform .22s ease;
}
.fa-chat.open .fa-panel{opacity:1;transform:translateY(0) scale(1);pointer-events:auto;}

.fa-panel-head{
  display:flex;align-items:center;gap:10px;padding:14px 16px;
  background:linear-gradient(135deg,var(--g900),var(--g700));color:var(--white);
}
.fa-panel-head .fa-avatar{width:42px;height:42px;flex:0 0 auto;border-width:2px;border-color:rgba(255,255,255,.7);}
.fa-panel-id{flex:1;min-width:0;}
.fa-panel-id b{display:block;font-family:var(--display);font-size:14px;line-height:1.2;}
.fa-panel-id span{display:flex;align-items:center;gap:5px;font-size:11.5px;opacity:.88;margin-top:2px;}
.fa-panel-id span i{width:6px;height:6px;border-radius:50%;background:var(--lime);display:inline-block;}

.fa-panel-body{padding:16px;}

/* -- message log -- */
.fa-log{max-height:240px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;margin-bottom:12px;padding-right:2px;}
.fa-log::-webkit-scrollbar{width:6px;}
.fa-log::-webkit-scrollbar-thumb{background:var(--line);border-radius:6px;}
.fa-bubble{max-width:88%;padding:10px 13px;border-radius:14px;font-size:13.5px;line-height:1.5;word-wrap:break-word;}
.fa-bubble-bot{align-self:flex-start;background:var(--tint);border:1px solid var(--line);color:var(--text);border-radius:14px 14px 14px 4px;}
.fa-bubble-user{align-self:flex-end;background:var(--g900);color:var(--white);border-radius:14px 14px 4px 14px;}
.fa-bubble-cta{display:inline-block;margin-top:8px;font-size:12.5px;font-weight:700;color:var(--g800);text-decoration:underline;}
.fa-bubble-user .fa-bubble-cta{color:var(--white);}

.fa-typing{display:flex;align-items:center;gap:4px;padding:12px 14px;}
.fa-typing span{width:6px;height:6px;border-radius:50%;background:var(--muted);opacity:.4;display:inline-block;animation:fa-typing-blink 1s infinite ease-in-out;}
.fa-typing span:nth-child(2){animation-delay:.15s;}
.fa-typing span:nth-child(3){animation-delay:.3s;}

/* -- quick actions -- */
.fa-actions{display:grid;gap:8px;margin-bottom:12px;}
.fa-action{
  display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;
  border:1px solid var(--line);background:var(--bg);color:var(--ink);text-decoration:none;
  font-size:13px;font-weight:600;transition:border-color .18s ease,background .18s ease;
}
.fa-action:hover{border-color:var(--g600);background:var(--tint2);}
.fa-action .ico{width:17px;height:17px;flex:0 0 auto;stroke:var(--g700);fill:none;stroke-width:2;color:var(--g700);}

/* -- text input row -- */
.fa-input-row{display:flex;gap:8px;}
.fa-input{
  flex:1;min-width:0;padding:10px 12px;border-radius:12px;border:1px solid var(--line);
  font-size:13px;font-family:var(--body);color:var(--ink);background:var(--bg);
}
.fa-input:focus{outline:none;border-color:var(--g600);}
.fa-send{
  flex:0 0 auto;width:38px;height:38px;border-radius:50%;border:0;background:var(--g900);
  color:var(--white);display:flex;align-items:center;justify-content:center;cursor:pointer;
  transition:background .18s ease;
}
.fa-send:hover{background:var(--g700);}
.fa-send .ico{width:16px;height:16px;stroke:var(--white);fill:none;stroke-width:2.4;}

.fa-panel-foot{padding:0 16px 16px;font-size:11px;color:var(--muted);text-align:center;}

@keyframes fa-settle{0%{transform:translateY(18px) scale(.85);opacity:0;}100%{transform:translateY(0) scale(1);opacity:1;}}
@keyframes fa-pulse{0%{transform:scale(.7);opacity:.6;}100%{transform:scale(1.6);opacity:0;}}
@keyframes fa-typing-blink{0%,80%,100%{opacity:.3;transform:translateY(0);}40%{opacity:1;transform:translateY(-2px);}}

@media (max-width:480px){
  .fa-chat{right:14px;bottom:14px;}
  .fa-chat-btn{width:58px;height:58px;}
  .fa-nudge{right:68px;max-width:190px;}
  .fa-panel{bottom:72px;width:min(320px,calc(100vw - 28px));}
  .fa-log{max-height:200px;}
}
@media (prefers-reduced-motion: reduce){
  .fa-chat-btn{animation:none;}
  .fa-dot::after{animation:none;}
  .fa-typing span{animation:none;}
}
