/* ── Чат-виджет «Ольга» · Works Groups (красная гамма сайта) ─────────────── */
:root{
  --cw-c1:#ef4444; --cw-c2:#dc2626; --cw-c3:#b91c1c; --cw-accent:#f59e0b;
  --cw-grad:linear-gradient(135deg,#ef4444 0%,#dc2626 55%,#b91c1c 100%);
  --cw-ink:#0f172a;
}

/* FAB */
.cw-fab{
  position:fixed;right:20px;bottom:84px;z-index:9000;
  width:62px;height:62px;border-radius:50%;border:0;cursor:pointer;
  background:var(--cw-grad);color:#fff;font-size:26px;line-height:1;
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 10px 28px rgba(220,38,38,.42);
  transition:transform .2s ease, box-shadow .2s ease;
}
.cw-fab:hover{transform:translateY(-2px) scale(1.05);box-shadow:0 14px 34px rgba(220,38,38,.5)}
.cw-fab::after{
  content:"";position:absolute;top:6px;right:6px;width:13px;height:13px;border-radius:50%;
  background:#22c55e;border:2px solid #fff;
  animation:cw-pulse 2s infinite;
}
@keyframes cw-pulse{0%{box-shadow:0 0 0 0 rgba(34,197,94,.55)}70%{box-shadow:0 0 0 8px rgba(34,197,94,0)}100%{box-shadow:0 0 0 0 rgba(34,197,94,0)}}
.cw-fab.is-hidden{opacity:0;pointer-events:none;transform:scale(.6)}

/* Тизер */
.cw-teaser{
  position:fixed;right:20px;bottom:156px;z-index:9000;
  max-width:250px;background:#fff;color:var(--cw-ink);border-radius:16px 16px 4px 16px;
  padding:12px 34px 12px 14px;font-size:13.5px;line-height:1.45;
  box-shadow:0 12px 30px rgba(2,6,23,.18);border:1px solid rgba(2,6,23,.06);
  cursor:pointer;animation:cw-teaser-in .35s ease both;
}
.cw-teaser::before{
  content:attr(data-persona);position:absolute;top:-9px;left:14px;background:var(--cw-accent);color:#3a2400;
  font-size:10px;font-weight:700;padding:2px 8px;border-radius:999px;letter-spacing:.02em;
}
.cw-teaser__close{
  position:absolute;top:6px;right:8px;border:0;background:transparent;color:#94a3b8;
  font-size:16px;line-height:1;cursor:pointer;padding:2px
}
@keyframes cw-teaser-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* Панель */
.cw-panel{
  position:fixed;right:20px;bottom:156px;z-index:9001;
  width:min(384px,calc(100vw - 24px));height:min(560px,calc(100vh - 180px));
  background:#fff;border-radius:20px;overflow:hidden;
  box-shadow:0 24px 60px rgba(2,6,23,.28);
  display:none;flex-direction:column;
}
.cw-panel.is-open{display:flex;animation:cw-panel-in .28s cubic-bezier(.22,1,.36,1) both}
@keyframes cw-panel-in{from{opacity:0;transform:translateY(18px) scale(.98)}to{opacity:1;transform:none}}

/* Шапка */
.cw-head{
  display:flex;justify-content:space-between;align-items:center;gap:10px;
  padding:14px 16px;background:var(--cw-grad);color:#fff;
}
.cw-head__id{display:flex;align-items:center;gap:11px;min-width:0}
.cw-avatar{
  width:42px;height:42px;border-radius:50%;flex:0 0 auto;
  background:rgba(255,255,255,.2);border:2px solid rgba(255,255,255,.55);
  display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px;
}
.cw-name{font-weight:700;font-size:15px;line-height:1.1}
.cw-status{font-size:11.5px;opacity:.92;display:flex;align-items:center;gap:5px;margin-top:2px}
.cw-dot{width:8px;height:8px;border-radius:50%;background:#4ade80;box-shadow:0 0 6px #4ade80}
.cw-close{background:transparent;border:0;color:#fff;font-size:24px;line-height:1;cursor:pointer;padding:0 4px;opacity:.85}
.cw-close:hover{opacity:1}

/* Лента */
.cw-log{flex:1;overflow:auto;padding:14px;background:#f6f9fc;display:flex;flex-direction:column;gap:10px}
.cw-msg{
  margin:0;padding:10px 13px;border-radius:16px;font-size:14px;line-height:1.5;
  max-width:82%;white-space:pre-wrap;word-break:break-word;
  box-shadow:0 1px 2px rgba(2,6,23,.06);animation:cw-msg-in .22s ease both
}
@keyframes cw-msg-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.cw-msg--user{align-self:flex-end;background:var(--cw-grad);color:#fff;border-bottom-right-radius:5px}
.cw-msg--assistant{align-self:flex-start;background:#fff;color:var(--cw-ink);border:1px solid #e3edf5;border-bottom-left-radius:5px}
.cw-msg--system{align-self:center;background:#eefdf3;border:1px solid #bbf7d0;color:#15803d;font-size:12.5px;max-width:92%;text-align:center;border-radius:12px}

/* Печатает… */
.cw-typing{padding:2px 16px 8px;font-size:12px;color:#94a3b8;display:flex;align-items:center;gap:8px;background:#f6f9fc}
.cw-typing[hidden]{display:none!important}
.cw-typing::before{
  content:"";width:34px;height:10px;flex:0 0 auto;
  background-image:radial-gradient(circle 3px at 5px 5px,#b91c1c 90%,transparent),
                   radial-gradient(circle 3px at 17px 5px,#b91c1c 90%,transparent),
                   radial-gradient(circle 3px at 29px 5px,#b91c1c 90%,transparent);
  animation:cw-typing 1s infinite
}
@keyframes cw-typing{0%,100%{opacity:.35}50%{opacity:1}}

/* Ввод */
.cw-form{display:flex;align-items:center;gap:8px;border-top:1px solid #e8eff6;padding:10px 12px;background:#fff}
.cw-input{flex:1;border:1px solid #dbe6f0;background:#f8fafc;border-radius:999px;padding:11px 15px;font-size:14px;outline:none;transition:border .15s}
.cw-input:focus{border-color:var(--cw-c2);background:#fff}
.cw-send{
  border:0;background:var(--cw-grad);color:#fff;width:42px;height:42px;flex:0 0 auto;border-radius:50%;
  cursor:pointer;font-size:18px;display:flex;align-items:center;justify-content:center;transition:transform .12s
}
.cw-send:hover{transform:scale(1.07)}

/* Мобильный фулскрин */
@media(max-width:480px){
  .cw-panel{
    top:0;right:0;bottom:0;left:0;width:100%;height:100dvh;max-height:none;
    border-radius:0;
  }
  .cw-panel.is-open{animation:cw-panel-in-mob .26s ease both}
  .cw-head{padding-top:calc(14px + env(safe-area-inset-top))}
  .cw-form{padding-bottom:calc(10px + env(safe-area-inset-bottom))}
  .cw-teaser{right:14px;max-width:210px}
}
@keyframes cw-panel-in-mob{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}
