.k360-chat{
  position:fixed;
  right:clamp(1rem,3vw,2rem);
  bottom:clamp(1rem,3vw,2rem);
  z-index:160;
  font-family:var(--font-body);
}

.k360-chat__launcher{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:.65rem;
  min-height:54px;
  padding:.85rem 1.1rem;
  border-radius:999px;
  background:var(--primary);
  color:#fff;
  border:1px solid rgba(255,255,255,.18);
  box-shadow:0 18px 40px rgba(0,32,67,.22);
  font-weight:800;
}

.k360-chat__launcher svg{width:22px;height:22px;color:var(--accent)}
.k360-chat__pulse{
  position:absolute;
  inset:-5px;
  border-radius:inherit;
  border:1px solid rgba(152,255,0,.5);
  animation:k360-chat-pulse 1.8s ease-out infinite;
}

.k360-chat__panel{
  position:absolute;
  right:0;
  bottom:74px;
  width:min(410px,calc(100vw - 2rem));
  height:min(660px,calc(100vh - 7rem));
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto auto auto;
  overflow:hidden;
  border-radius:24px;
  background:#fff;
  border:1px solid rgba(0,32,67,.12);
  box-shadow:0 26px 80px rgba(0,32,67,.24);
  opacity:0;
  transform:translateY(16px) scale(.96);
  pointer-events:none;
  transition:opacity .25s var(--ease-out),transform .25s var(--ease-out);
}

.k360-chat.is-open .k360-chat__panel{
  opacity:1;
  transform:none;
  pointer-events:auto;
}

.k360-chat__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  padding:1.05rem 1.15rem;
  background:linear-gradient(135deg,var(--primary),#064f66);
  color:#fff;
}

.k360-chat__head strong{display:block;font-family:var(--font-display);font-size:1rem}
.k360-chat__eyebrow{
  display:block;
  color:var(--accent);
  font-size:.72rem;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.k360-chat__close{
  width:36px;
  height:36px;
  border-radius:50%;
  display:grid;
  place-items:center;
  color:#fff;
  background:rgba(255,255,255,.12);
  font-size:1.35rem;
}

.k360-chat__reset{
  border:1px solid rgba(255,255,255,.22);
  border-radius:999px;
  background:rgba(255,255,255,.12);
  color:#fff;
  padding:.5rem .7rem;
  font-size:.72rem;
  font-weight:800;
  white-space:nowrap;
}

.k360-chat__body{
  min-height:0;
  padding:1rem;
  overflow:auto;
  background:
    linear-gradient(180deg,#f7fafe,#eef3f8);
}

.k360-chat__msg{
  display:flex;
  flex-direction:column;
  gap:.22rem;
  max-width:86%;
  margin-bottom:.75rem;
}

.k360-chat__msg.is-user{margin-left:auto;align-items:flex-end}
.k360-chat__msg.is-bot,.k360-chat__msg.is-operator,.k360-chat__msg.is-system{align-items:flex-start}
.k360-chat__msg.is-pending{opacity:.72}
.k360-chat__msg.is-failed .k360-chat__bubble{outline:1px solid #ff6b6b}

.k360-chat__bubble{
  border-radius:18px;
  padding:.72rem .85rem;
  line-height:1.45;
  font-size:.92rem;
  color:var(--primary);
  background:#fff;
  box-shadow:0 10px 24px rgba(0,32,67,.08);
}

.k360-chat__msg.is-user .k360-chat__bubble{
  background:var(--primary);
  color:#fff;
  border-bottom-right-radius:6px;
}

.k360-chat__msg.is-bot .k360-chat__bubble{
  border-bottom-left-radius:6px;
  border:1px solid rgba(152,255,0,.45);
}

.k360-chat__msg.is-operator .k360-chat__bubble{
  border-bottom-left-radius:6px;
  border:1px solid rgba(0,158,247,.25);
}

.k360-chat__msg.is-system .k360-chat__bubble{
  background:#fff8dd;
  color:#6d5600;
}

.k360-chat__meta{
  color:#6d7890;
  font-size:.72rem;
  padding-inline:.2rem;
}

.k360-chat__typing{
  display:inline-flex;
  gap:.28rem;
  align-items:center;
}

.k360-chat__typing i{
  width:6px;
  height:6px;
  border-radius:50%;
  background:var(--accent-deep);
  animation:k360-chat-dot 1s infinite ease-in-out;
}

.k360-chat__typing i:nth-child(2){animation-delay:.12s}
.k360-chat__typing i:nth-child(3){animation-delay:.24s}

.k360-chat__quick{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
  max-height:112px;
  overflow:auto;
  padding:.85rem 1rem .25rem;
  background:#fff;
  border-top:1px solid rgba(0,32,67,.08);
}

.k360-chat__quick button{
  border:1px solid rgba(0,32,67,.14);
  background:#f6f9fc;
  color:var(--primary);
  border-radius:999px;
  padding:.48rem .7rem;
  font-weight:800;
  font-size:.76rem;
}

.k360-chat__consent{
  display:flex;
  gap:.55rem;
  align-items:flex-start;
  padding:.65rem 1rem;
  background:#fff;
  color:#5a6478;
  font-size:.74rem;
  line-height:1.35;
}

.k360-chat__consent input{
  margin-top:.15rem;
  accent-color:var(--primary);
}

.k360-chat__form{
  display:grid;
  grid-template-columns:1fr 44px;
  gap:.55rem;
  padding:.8rem 1rem 1rem;
  background:#fff;
}

.k360-chat__form input{
  min-width:0;
  border:1px solid rgba(0,32,67,.12);
  border-radius:999px;
  padding:.86rem 1rem;
  color:var(--primary);
  background:#f8fafc;
}

.k360-chat__form input:focus{
  outline:none;
  border-color:var(--accent-deep);
  background:#fff;
}

.k360-chat__form button{
  width:44px;
  height:44px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:var(--accent);
  color:var(--primary);
}

.k360-chat__form svg{width:20px;height:20px}

@keyframes k360-chat-pulse{
  from{opacity:.8;transform:scale(.98)}
  to{opacity:0;transform:scale(1.18)}
}

@keyframes k360-chat-dot{
  0%,80%,100%{transform:translateY(0);opacity:.45}
  40%{transform:translateY(-4px);opacity:1}
}

@media (max-width:640px){
  .k360-chat{
    right:1rem;
    bottom:1rem;
    left:1rem;
    display:flex;
    justify-content:flex-end;
  }

  .k360-chat__panel{
    position:fixed;
    left:0;
    right:0;
    bottom:0;
    width:100%;
    height:min(82vh,720px);
    border-radius:24px 24px 0 0;
  }

  .k360-chat__launcher span:last-child{display:none}
}
