/* ---------- Чат-помощник (assets/js/chat.js) ---------- */
.cbo-chat{--cbo-chat-lift:0px;position:fixed;right:20px;bottom:calc(20px + var(--cbo-chat-lift));z-index:60;
  display:flex;flex-direction:column;align-items:flex-end;gap:12px;font-size:15px;line-height:1.5;
  transition:bottom .2s ease;}
.cbo-chat-launcher{display:inline-flex;align-items:center;gap:9px;border:0;cursor:pointer;
  background:var(--primary);color:#fff;font:inherit;font-weight:600;font-size:15px;
  padding:13px 20px 13px 16px;border-radius:999px;box-shadow:0 10px 28px -10px rgba(69,32,128,.6);
  transition:background .15s,transform .15s;}
.cbo-chat-launcher:hover{background:var(--primary-dark);}
.cbo-chat-launcher:focus-visible,.cbo-chat-btn:focus-visible,.cbo-chat-close:focus-visible,
.cbo-chat-send:focus-visible,.cbo-chat-nudge button:focus-visible{outline:2px solid var(--primary-2);outline-offset:2px;}
.cbo-chat-launcher svg{width:22px;height:22px;fill:#fff;flex:none;}
.cbo-chat.is-open .cbo-chat-launcher{display:none;}

.cbo-chat-nudge{display:none;align-items:flex-start;gap:4px;max-width:280px;background:#fff;
  border:1px solid var(--border);border-radius:var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
  box-shadow:var(--shadow);padding:12px 8px 12px 14px;}
.cbo-chat.has-nudge .cbo-chat-nudge{display:flex;animation:cboChatIn .25s ease;}
.cbo-chat-nudge-text{border:0;background:none;padding:0;text-align:left;font:inherit;font-size:14.5px;
  color:var(--fg);cursor:pointer;}
.cbo-chat-nudge-close{border:0;background:none;color:var(--muted);font-size:20px;line-height:1;
  padding:0 4px;cursor:pointer;}

.cbo-chat-panel{box-sizing:border-box;padding:0;margin:0;width:380px;height:min(620px,calc(100vh - 40px - var(--cbo-chat-lift)));display:flex;
  flex-direction:column;background:#fff;border:1px solid var(--border);border-radius:18px;overflow:hidden;
  box-shadow:0 24px 60px -24px rgba(22,25,43,.4);animation:cboChatIn .2s ease;}
.cbo-chat-panel[hidden]{display:none;}
@keyframes cboChatIn{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}

.cbo-chat-head{display:flex;align-items:center;gap:11px;background:var(--primary);color:#fff;padding:14px 12px 14px 16px;}
.cbo-chat-mark{width:32px;height:32px;flex:none;}
.cbo-chat-titles{display:flex;flex-direction:column;min-width:0;flex:1;}
.cbo-chat-titles b{font-size:15px;font-weight:700;letter-spacing:.01em;}
.cbo-chat-titles span{font-size:12.5px;color:#d9ccf2;}
.cbo-chat-close{border:0;background:rgba(255,255,255,.12);border-radius:10px;width:36px;height:36px;
  display:flex;align-items:center;justify-content:center;cursor:pointer;flex:none;}
.cbo-chat-close:hover{background:rgba(255,255,255,.22);}
.cbo-chat-close svg{width:18px;height:18px;stroke:#fff;stroke-width:2;fill:none;stroke-linecap:round;}

.cbo-chat-log{flex:1;overflow-y:auto;padding:16px 14px 8px;background:var(--bg-2);display:flex;
  flex-direction:column;gap:8px;overscroll-behavior:contain;}
.cbo-chat-msg{display:flex;flex-direction:column;max-width:88%;}
.cbo-chat-msg.is-in{align-self:flex-end;align-items:flex-end;}
.cbo-chat-msg.is-out,.cbo-chat-msg.is-op{align-self:flex-start;}
.cbo-chat-bubble{white-space:pre-line;word-wrap:break-word;overflow-wrap:anywhere;padding:10px 13px;
  border-radius:14px;font-size:14.5px;line-height:1.5;}
.cbo-chat-msg.is-out .cbo-chat-bubble{background:#fff;border:1px solid var(--border);color:var(--fg);border-top-left-radius:4px;}
.cbo-chat-msg.is-op .cbo-chat-bubble{background:var(--primary-soft);border:1px solid #e2d8f3;color:var(--fg);border-top-left-radius:4px;}
.cbo-chat-msg.is-in .cbo-chat-bubble{background:var(--primary);color:#fff;border-top-right-radius:4px;}
.cbo-chat-msg.is-in .cbo-chat-bubble a{color:#fff;}
.cbo-chat-bubble a{color:var(--primary);text-decoration:underline;}
.cbo-chat-who{font-size:12px;font-weight:600;color:var(--primary);margin:0 0 3px 4px;}

.cbo-chat-btns{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 6px;max-width:100%;}
.cbo-chat-btn{display:inline-flex;align-items:center;border:1px solid #d6c9ee;background:#fff;color:var(--primary);
  font:inherit;font-size:13.5px;font-weight:600;line-height:1.3;padding:8px 12px;border-radius:999px;
  cursor:pointer;text-align:left;text-decoration:none;transition:background .15s,border-color .15s;}
.cbo-chat-btn:hover{background:var(--primary-soft);border-color:var(--primary);}
.cbo-chat-btn.is-link::after{content:"↗";margin-left:6px;font-weight:400;}

.cbo-chat-typing{align-self:flex-start;display:flex;gap:4px;background:#fff;border:1px solid var(--border);
  border-radius:14px;border-top-left-radius:4px;padding:12px 14px;}
.cbo-chat-typing span{width:6px;height:6px;border-radius:50%;background:var(--muted);opacity:.4;
  animation:cboChatDot 1s infinite;}
.cbo-chat-typing span:nth-child(2){animation-delay:.15s;}
.cbo-chat-typing span:nth-child(3){animation-delay:.3s;}
@keyframes cboChatDot{50%{opacity:1;transform:translateY(-2px);}}

.cbo-chat-form{display:flex;align-items:flex-end;gap:8px;padding:10px 10px 10px 14px;border-top:1px solid var(--border);background:#fff;}
.cbo-chat-input{flex:1;resize:none;border:1px solid var(--border-2);border-radius:12px;padding:10px 12px;
  font:inherit;font-size:15px;line-height:1.4;max-height:120px;color:var(--fg);background:#fff;}
.cbo-chat-input:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-soft);}
.cbo-chat-send{border:0;background:var(--primary);border-radius:12px;width:44px;height:44px;flex:none;
  display:flex;align-items:center;justify-content:center;cursor:pointer;}
.cbo-chat-send:hover{background:var(--primary-dark);}
.cbo-chat-send svg{width:20px;height:20px;fill:#fff;}
.cbo-chat-foot{padding:0 14px 10px;background:#fff;font-size:12px;color:var(--muted);}
.cbo-chat-foot a{color:var(--muted);text-decoration:underline;}

@media (max-width:600px){
  .cbo-chat{right:14px;bottom:calc(14px + var(--cbo-chat-lift));}
  .cbo-chat-launcher{padding:14px;}
  .cbo-chat-launcher span{display:none;}
  .cbo-chat-launcher svg{width:26px;height:26px;}
  .cbo-chat.is-open{right:0;bottom:0;left:0;top:0;}
  .cbo-chat-panel{width:100%;height:100%;border-radius:0;border:0;}
  .cbo-chat-nudge{max-width:240px;}
  .cbo-chat-input{font-size:16px;}   /* меньше 16px — iOS увеличивает страницу при фокусе */
}
@media (prefers-reduced-motion:reduce){
  .cbo-chat-panel,.cbo-chat.has-nudge .cbo-chat-nudge,.cbo-chat-typing span{animation:none;}
}
