.chat-btn{
  position:fixed;bottom:28px;right:28px;z-index:8998;
  width:64px;height:64px;
  background:var(--slate);border:1px solid rgba(169,143,122,.4);
  cursor:pointer;display:flex;align-items:center;justify-content:center;
  color:var(--gold);
  box-shadow:0 4px 28px rgba(58,49,44,.3);
  transition:background .3s,border-color .3s,transform .35s cubic-bezier(0.16,1,0.3,1),color .3s;
}
.chat-btn:hover{background:var(--gold);border-color:var(--gold);color:var(--off-white);transform:scale(1.06)}
.chat-btn.open{background:var(--gold);border-color:var(--gold);color:var(--off-white)}
.chat-btn svg{width:26px;height:26px;transition:opacity .25s,transform .25s;flex-shrink:0}
.chat-btn-close-svg{opacity:0;transform:scale(0.7);position:absolute}
.chat-btn.open .chat-btn-icon-svg{opacity:0;transform:scale(0.7)}
.chat-btn.open .chat-btn-close-svg{opacity:1;transform:scale(1)}

.chat-btn-badge{
  position:absolute;top:-6px;right:-6px;
  background:var(--gold);color:var(--off-white);
  font-family:'Jost',sans-serif;font-size:.44rem;font-weight:500;
  letter-spacing:.14em;text-transform:uppercase;
  padding:3px 6px;line-height:1;
  transition:background .3s;
}
.chat-btn.open .chat-btn-badge{background:var(--slate)}

/* pulsing ring gdy nieaktywny */
.chat-btn:not(.open)::after{
  content:'';position:absolute;inset:-6px;
  border:2px solid rgba(169,143,122,.35);
  animation:chatpulse 2.8s ease-out infinite;
}
@keyframes chatpulse{
  0%{transform:scale(1);opacity:.7}
  70%{transform:scale(1.18);opacity:0}
  100%{transform:scale(1.18);opacity:0}
}

/* proaktywna dymka */
.chat-proactive{
  position:fixed;bottom:106px;right:28px;z-index:8997;
  background:var(--slate);border:1px solid rgba(169,143,122,.38);
  box-shadow:0 4px 24px rgba(58,49,44,.26);
  padding:14px 38px 14px 16px;max-width:260px;
  transform:translateY(10px) scale(0.96);opacity:0;pointer-events:none;
  transition:transform .4s cubic-bezier(0.16,1,0.3,1),opacity .35s ease;
}
.chat-proactive.show{transform:translateY(0) scale(1);opacity:1;pointer-events:all}
.chat-proactive::after{
  content:'';position:absolute;bottom:-7px;right:24px;
  width:13px;height:7px;background:var(--slate);
  clip-path:polygon(0 0,100% 0,50% 100%);
}
.chat-proactive-text{
  font-family:'Jost',sans-serif;font-weight:300;font-size:.79rem;
  line-height:1.65;color:rgba(243,238,231,.82);
}
.chat-proactive-text strong{
  display:block;font-family:'Cormorant',serif;font-style:italic;
  font-weight:300;font-size:.95rem;color:var(--gold);margin-bottom:4px;
}
.chat-proactive-x{
  position:absolute;top:8px;right:8px;
  background:none;border:none;cursor:pointer;
  color:rgba(243,238,231,.3);font-size:.85rem;line-height:1;padding:2px 4px;
  transition:color .3s;
}
.chat-proactive-x:hover{color:rgba(243,238,231,.8)}

.chat-window{
  position:fixed;bottom:100px;right:28px;z-index:8999;
  width:360px;max-height:530px;
  background:var(--off-white);border:1px solid var(--border-gold);
  box-shadow:0 8px 52px rgba(58,49,44,.22);
  display:flex;flex-direction:column;
  transform:translateY(18px) scale(0.97);opacity:0;pointer-events:none;
  transition:transform .38s cubic-bezier(0.16,1,0.3,1),opacity .32s ease;
}
.chat-window.open{transform:translateY(0) scale(1);opacity:1;pointer-events:all}

.chat-header{
  background:var(--slate);padding:15px 18px;
  display:flex;align-items:center;gap:12px;flex-shrink:0;
}
.chat-header-avatar{
  width:36px;height:36px;flex-shrink:0;
  border:1px solid rgba(169,143,122,.4);
  display:flex;align-items:center;justify-content:center;
  color:var(--gold);font-size:.9rem;
}
.chat-header-info{flex:1;min-width:0}
.chat-header-name{
  font-family:'Cormorant',serif;font-style:italic;font-weight:300;
  font-size:1rem;color:var(--off-white);line-height:1.2;
}
.chat-header-status{
  font-family:'Jost',sans-serif;font-size:.5rem;
  letter-spacing:.26em;text-transform:uppercase;
  color:rgba(243,238,231,.34);margin-top:3px;
}
.chat-x{
  background:none;border:none;cursor:pointer;padding:4px;
  color:rgba(243,238,231,.36);font-size:1rem;line-height:1;
  transition:color .3s;flex-shrink:0;
}
.chat-x:hover{color:rgba(243,238,231,.9)}

.chat-messages{
  flex:1;overflow-y:auto;padding:18px 14px;
  display:flex;flex-direction:column;gap:10px;
  scroll-behavior:smooth;
}
.chat-messages::-webkit-scrollbar{width:3px}
.chat-messages::-webkit-scrollbar-track{background:transparent}
.chat-messages::-webkit-scrollbar-thumb{background:var(--border-gold)}

.chat-msg{
  max-width:84%;
  font-family:'Jost',sans-serif;font-weight:300;
  font-size:.8rem;line-height:1.72;padding:10px 13px;
}
.chat-msg.assistant{
  background:var(--blush);color:var(--text-dark);
  align-self:flex-start;border-left:2px solid var(--border-gold);
}
.chat-msg.user{
  background:var(--slate);color:rgba(243,238,231,.88);
  align-self:flex-end;
}
.chat-msg.typing{
  background:var(--blush);align-self:flex-start;
  padding:13px 16px;border-left:2px solid var(--border-gold);
}
.chat-dots{display:flex;gap:5px;align-items:center}
.chat-dots span{
  width:6px;height:6px;background:var(--gold);
  border-radius:50%;
  animation:chatdot .85s infinite ease-in-out;
}
.chat-dots span:nth-child(2){animation-delay:.14s}
.chat-dots span:nth-child(3){animation-delay:.28s}
@keyframes chatdot{
  0%,80%,100%{transform:scale(0.55);opacity:.35}
  40%{transform:scale(1);opacity:1}
}

.chat-footer{
  padding:10px 14px;border-top:1px solid var(--border-gold);
  display:flex;gap:8px;flex-shrink:0;background:var(--off-white);
}
.chat-input{
  flex:1;font-family:'Jost',sans-serif;font-weight:300;font-size:.8rem;
  color:var(--text-dark);background:var(--blush);
  border:1px solid var(--border-gold);padding:9px 11px;
  outline:none;resize:none;height:40px;min-height:40px;max-height:96px;
  overflow-y:hidden;transition:border-color .3s;
}
.chat-input:focus{border-color:var(--gold)}
.chat-input::placeholder{color:rgba(58,49,44,.32)}
.chat-send{
  width:40px;height:40px;flex-shrink:0;
  background:var(--gold);border:none;cursor:pointer;
  color:var(--off-white);font-size:.95rem;
  display:flex;align-items:center;justify-content:center;
  transition:background .3s;
}
.chat-send:hover{background:var(--slate)}
.chat-send:disabled{background:var(--blush-mid);cursor:default}

@media(max-width:480px){
  .chat-window{left:12px;right:12px;width:auto;bottom:86px}
  .chat-btn{bottom:16px;right:16px;width:52px;height:52px}
}
