/* Чат-помощник сайта — виджет в стиле мессенджера */
.cw-btn{position:fixed;right:1.2rem;bottom:1.2rem;z-index:80;display:flex;align-items:center;gap:.6rem;height:3.4rem;padding:0 1.2rem 0 1rem;border:0;border-radius:999px;background:var(--btnBg);color:#fff;font:inherit;font-size:.9rem;font-weight:600;letter-spacing:.01em;cursor:pointer;box-shadow:0 10px 28px rgba(0,0,0,.4);transition:transform .2s,box-shadow .2s}
.cw-btn:hover{transform:translateY(-2px);box-shadow:0 14px 32px rgba(0,0,0,.45)}
.cw-btn svg{width:1.4rem;height:1.4rem;fill:currentColor;flex:none}
.cw-btn__dot{position:absolute;top:.45rem;left:2rem;width:.6rem;height:.6rem;border-radius:50%;background:#2ecc8f;border:2px solid var(--btnBg)}
/* непрочитанное: «1» на кнопке до первого открытия чата */
.cw-btn__badge{display:none;position:absolute;top:-.4rem;right:-.3rem;min-width:1.4rem;height:1.4rem;padding:0 .35rem;border-radius:999px;background:#fff;color:var(--btnBg);font-size:.78rem;font-weight:700;line-height:1.4rem;text-align:center;box-shadow:0 2px 8px rgba(0,0,0,.45);animation:cw-badge .35s ease-out}
.cw-btn--unread .cw-btn__badge{display:block}
.cw-btn--unread .cw-btn__dot{display:none}
@keyframes cw-badge{from{transform:scale(0)}60%{transform:scale(1.2)}to{transform:none}}
.cw-open .cw-btn,.cw-open .cw-nudge{display:none}
.cw [hidden]{display:none!important}
@media (max-width:720px){.cw-btn{bottom:84px;padding:0;width:3.4rem;justify-content:center}.cw-btn__label{display:none}.cw-btn__dot{left:auto;right:.35rem;top:.35rem}.cw-btn__badge{top:-.3rem;right:-.3rem}}

/* подсказка рядом с кнопкой */
.cw-nudge{position:fixed;right:1.2rem;bottom:5.2rem;z-index:79;max-width:260px;padding:.7rem .9rem;border-radius:14px 14px 4px 14px;background:var(--secondaryBg);border:1px solid var(--borderColor);color:var(--mainColor);font-size:.85rem;line-height:1.4;box-shadow:0 10px 28px rgba(0,0,0,.35);opacity:0;transform:translateY(6px);transition:opacity .25s,transform .25s;pointer-events:none}
.cw-nudge.show{opacity:1;transform:none;pointer-events:auto}
@media (max-width:720px){.cw-nudge{bottom:9.2rem}}

/* окно */
.cw{position:fixed;right:1.2rem;bottom:1.2rem;z-index:90;width:min(392px,calc(100vw - 2.4rem));height:min(660px,calc(100vh - 2.4rem));height:min(660px,calc(100dvh - 2.4rem));display:none;flex-direction:column;overflow:hidden;border-radius:20px;background:var(--secondaryBg);border:1px solid var(--borderColor);box-shadow:0 24px 64px rgba(0,0,0,.5);font-family:var(--fontFamily);font-weight:300;font-size:.95rem;line-height:1.45;color:var(--mainColor);transform-origin:bottom right}
.cw-open .cw{display:flex;animation:cw-in .22s ease-out}
@keyframes cw-in{from{opacity:0;transform:translateY(12px) scale(.96)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){.cw-open .cw{animation:none}}
@media (max-width:520px){
  .cw{inset:0;width:auto;height:100vh;height:100dvh;border:0;border-radius:0}
  body.cw-open{overflow:hidden}
}
.cw-open .cookie{display:none}

/* шапка */
.cw__head{display:flex;align-items:center;gap:.75rem;padding:.85rem 1rem;background:linear-gradient(125deg,var(--mainBg),var(--secondaryBg));border-bottom:1px solid var(--borderColor);flex:none}
.cw__ava{position:relative;width:2.5rem;height:2.5rem;border-radius:50%;background:var(--btnBg);display:grid;place-items:center;font-family:var(--fontDecor);font-size:1.1rem;color:#fff;flex:none}
.cw__ava::after{content:"";position:absolute;right:-1px;bottom:-1px;width:.7rem;height:.7rem;border-radius:50%;background:#2ecc8f;border:2px solid var(--mainBg)}
.cw__title{font-weight:600;font-size:.95rem;line-height:1.2}
.cw__sub{font-size:.75rem;color:var(--greyColor);margin-top:2px}
.cw__close{margin-left:auto;width:2.2rem;height:2.2rem;border:0;border-radius:50%;background:transparent;color:var(--greyColor);font-size:1.5rem;cursor:pointer;line-height:1;display:grid;place-items:center}
.cw__close:hover{background:rgba(255,255,255,.06);color:var(--mainColor)}

/* лента */
.cw__body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:1rem .9rem;display:flex;flex-direction:column;gap:.35rem;background:var(--mainBg)}
.cw__day{align-self:center;font-size:.72rem;color:var(--greyColor);background:var(--secondaryBg);padding:.15rem .7rem;border-radius:999px;margin:.2rem 0 .6rem}
.cw__msg{position:relative;max-width:86%;padding:.6rem .8rem .5rem;border-radius:16px;white-space:pre-wrap;overflow-wrap:anywhere;animation:cw-pop .18s ease-out}
@keyframes cw-pop{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.cw__msg--bot{align-self:flex-start;background:var(--secondaryBg);border-bottom-left-radius:5px}
.cw__msg--user{align-self:flex-end;background:var(--btnBg);color:#fff;border-bottom-right-radius:5px}
.cw__msg--bot+.cw__msg--bot,.cw__msg--user+.cw__msg--user{margin-top:-.15rem}
.cw__time{display:block;text-align:right;font-size:.66rem;opacity:.6;margin-top:.25rem;line-height:1}
.cw__msg--sys{align-self:center;max-width:92%;font-size:.78rem;color:var(--greyColor);text-align:center;background:transparent;padding:.35rem .5rem;animation:none}
.cw__msg--sys.ok{color:#2ecc8f}
.cw__typing{align-self:flex-start;display:flex;gap:4px;padding:.7rem .9rem;border-radius:16px;border-bottom-left-radius:5px;background:var(--secondaryBg)}
.cw__typing i{width:.42rem;height:.42rem;border-radius:50%;background:var(--greyColor);animation:cwb 1.1s infinite}
.cw__typing i:nth-child(2){animation-delay:.18s}.cw__typing i:nth-child(3){animation-delay:.36s}
@keyframes cwb{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-2px)}}
@media (prefers-reduced-motion:reduce){.cw__typing i,.cw__msg{animation:none}}

/* быстрые ответы */
.cw__chips{display:flex;flex-wrap:wrap;gap:.4rem;margin:.4rem 0 .2rem;align-self:flex-start;max-width:100%}
.cw__chip{border:1px solid var(--borderColor);background:transparent;color:var(--mainColor);font:inherit;font-size:.82rem;padding:.4rem .75rem;border-radius:999px;cursor:pointer;transition:border-color .15s,background .15s}
.cw__chip:hover{border-color:var(--btnHover);background:rgba(42,157,143,.12)}

/* экран согласия */
.cw__consent{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;justify-content:flex-end;gap:.9rem;padding:1.2rem 1.1rem 1.1rem;background:var(--mainBg);font-size:.86rem;color:var(--greyColor)}
.cw__consent-card{background:var(--secondaryBg);border-radius:16px;border-bottom-left-radius:5px;padding:.9rem 1rem;color:var(--mainColor);font-size:.95rem;line-height:1.45}
.cw__consent label{display:flex;gap:.6rem;align-items:flex-start;cursor:pointer;line-height:1.4}
.cw__consent input{margin:.2rem 0 0;accent-color:var(--btnHover)}
.cw__consent a{color:var(--mainColor);text-decoration:underline;text-underline-offset:2px}
.cw__consent .btn{width:100%;border-radius:12px}
.cw__consent .btn[disabled]{opacity:.45;cursor:not-allowed}

/* ввод */
.cw__foot{flex:none;border-top:1px solid var(--borderColor);padding:.6rem .7rem calc(.5rem + env(safe-area-inset-bottom,0px));background:var(--secondaryBg)}
.cw__row{display:flex;gap:.5rem;align-items:flex-end}
.cw__input{flex:1;resize:none;min-height:2.7rem;max-height:7rem;padding:.7rem .9rem;font:inherit;font-size:16px;line-height:1.35;background:var(--mainBg);border:1px solid var(--borderColor);color:var(--mainColor);border-radius:14px}
.cw__input:focus{outline:0;border-color:var(--btnHover)}
.cw__send{width:2.7rem;height:2.7rem;border:0;border-radius:50%;background:var(--btnBg);color:#fff;cursor:pointer;display:grid;place-items:center;flex:none;transition:transform .15s,opacity .15s}
.cw__send:hover{transform:scale(1.05)}
.cw__send[disabled]{opacity:.4;cursor:default;transform:none}
.cw__send svg{width:1.15rem;height:1.15rem;fill:currentColor;margin-left:2px}
.cw__note{font-size:.68rem;color:var(--greyColor);margin:.45rem .2rem 0;line-height:1.35}
.cw__note a{color:var(--greyColor);text-decoration:underline;text-underline-offset:2px}
