/* ============ MABK AI CHAT WIDGET (bottom-right consultant) ============ */
.mchat{ position:fixed; right:20px; bottom:20px; z-index:120; font-family:var(--font-body,'Inter',sans-serif); }
/* открытый чат поверх cookie-баннера (z-index 250), иначе баннер перехватывает тапы по форме на мобиле */
.mchat.open{ z-index:300; }

/* launcher button */
.mchat__btn{
  position:relative; width:62px; height:62px; border:0; border-radius:50%; cursor:pointer;
  background:linear-gradient(135deg,var(--accent,#2D7FF9),var(--accent-h,#1E6FFF));
  box-shadow:0 12px 30px rgba(45,127,249,.4);
  display:flex; align-items:center; justify-content:center;
  transition:transform .2s ease, box-shadow .2s ease;
}
.mchat__btn:hover{ transform:translateY(-2px); box-shadow:0 16px 38px rgba(45,127,249,.5); }
.mchat__btn svg{ width:24px; height:24px; fill:#fff; }
/* pulsing ring - "мерцание" (то же кольцо и у кнопки звонка .cbk-fab) */
.mchat__btn::after{
  content:''; position:absolute; inset:0; border-radius:50%;
  border:2px solid var(--accent,#2D7FF9); opacity:0;
  animation:mchat-pulse 2.6s ease-out infinite;
}
@keyframes mchat-pulse{
  0%{ transform:scale(1); opacity:.55; }
  70%{ transform:scale(1.45); opacity:0; }
  100%{ transform:scale(1.45); opacity:0; }
}
@media (prefers-reduced-motion:reduce){ .mchat__btn::after{ animation:none; } }
.mchat__dot{
  position:absolute; top:4px; right:4px; width:12px; height:12px; border-radius:50%;
  background:var(--live,#34C759); border:2px solid #fff;
}

/* teaser bubble */
.mchat__teaser{
  position:absolute; right:74px; bottom:10px; white-space:nowrap;
  background:var(--raised,#ECEFF4); color:var(--text,#2B3242);
  font-size:13.5px; font-weight:600; padding:10px 14px; border-radius:14px;
  box-shadow:var(--nm-sm,4px 4px 9px #C6CCD8,-4px -4px 9px #fff);
  opacity:0; transform:translateY(6px); pointer-events:none;
  transition:opacity .4s ease, transform .4s ease;
}
.mchat__teaser.show{ opacity:1; transform:translateY(0); pointer-events:auto; }

/* panel */
.mchat__panel{
  position:absolute; right:0; bottom:76px;
  width:min(380px, calc(100vw - 40px));
  height:min(560px, calc(100vh - 130px));
  display:none; flex-direction:column; overflow:hidden;
  background:var(--bg,#E8ECF2); border-radius:20px;
  box-shadow:0 18px 50px rgba(43,50,66,.28);
}
.mchat.open .mchat__panel{ display:flex; }
.mchat.open .mchat__btn::after{ animation:none; }

/* header */
.mchat__head{
  display:flex; align-items:center; gap:10px; padding:13px 14px;
  background:linear-gradient(135deg,var(--accent,#2D7FF9),var(--accent-h,#1E6FFF));
}
.mchat__ava{ width:38px; height:38px; border-radius:50%; background:#fff; object-fit:cover; }
.mchat__who{ flex:1; min-width:0; }
.mchat__who b{ display:block; color:#fff; font-size:14.5px; line-height:1.2; }
.mchat__who span{ display:flex; align-items:center; gap:5px; color:rgba(255,255,255,.85); font-size:11.5px; }
.mchat__who span::before{ content:''; width:7px; height:7px; border-radius:50%; background:var(--live,#34C759); }
.mchat__close{
  width:34px; height:34px; border:0; border-radius:50%; cursor:pointer;
  background:rgba(255,255,255,.16); color:#fff; font-size:16px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.mchat__close:hover{ background:rgba(255,255,255,.28); }

/* messages */
.mchat__log{ flex:1; overflow-y:auto; padding:14px 12px; display:flex; flex-direction:column; gap:9px; }
.mchat__msg{ max-width:84%; padding:9px 13px; border-radius:15px; font-size:14px; line-height:1.45; white-space:pre-wrap; word-break:break-word; }
.mchat__msg--bot{ align-self:flex-start; background:var(--raised,#ECEFF4); color:var(--text,#2B3242); box-shadow:var(--nm-sm,4px 4px 9px #C6CCD8,-4px -4px 9px #fff); border-bottom-left-radius:5px; }
.mchat__msg--user{ align-self:flex-end; background:var(--accent,#2D7FF9); color:#fff; border-bottom-right-radius:5px; }
.mchat__msg--err{ background:#FBE9E9; color:#8C2F2F; }
/* typing dots */
.mchat__typing{ display:inline-flex; gap:4px; padding:4px 0; }
.mchat__typing i{ width:7px; height:7px; border-radius:50%; background:var(--text-3,#8A93A6); animation:mchat-tp 1.1s infinite; }
.mchat__typing i:nth-child(2){ animation-delay:.18s; }
.mchat__typing i:nth-child(3){ animation-delay:.36s; }
@keyframes mchat-tp{ 0%,60%,100%{ opacity:.35; transform:translateY(0);} 30%{ opacity:1; transform:translateY(-3px);} }

/* quick replies */
.mchat__chips{ display:flex; flex-wrap:wrap; gap:7px; padding:0 12px 6px; }
.mchat__chip{
  border:0; cursor:pointer; border-radius:999px; padding:8px 13px; font-size:13px; font-weight:600;
  color:var(--accent-ink,#0B5BD3); background:var(--raised,#ECEFF4);
  box-shadow:var(--nm-sm,4px 4px 9px #C6CCD8,-4px -4px 9px #fff);
}
.mchat__chip:hover{ color:var(--accent-h,#1E6FFF); }

/* composer */
.mchat__form{ display:flex; gap:8px; padding:10px 12px 6px; }
.mchat__inp{
  flex:1; min-width:0; height:44px; border:0; border-radius:13px; padding:0 14px;
  font:inherit; font-size:14px; color:var(--text,#2B3242); background:var(--raised,#ECEFF4);
  box-shadow:inset 3px 3px 7px var(--nm-dark,#C6CCD8), inset -3px -3px 7px var(--nm-light,#fff);
}
.mchat__inp:focus{ outline:2px solid var(--accent-soft,#DCE8FE); }
.mchat__send{
  width:44px; height:44px; flex:0 0 auto; border:0; border-radius:13px; cursor:pointer;
  background:var(--accent,#2D7FF9); display:flex; align-items:center; justify-content:center;
}
.mchat__send:hover{ background:var(--accent-h,#1E6FFF); }
.mchat__send:disabled{ opacity:.5; cursor:default; }
.mchat__send svg{ width:20px; height:20px; fill:#fff; }

/* footer */
.mchat__foot{ padding:0 12px 11px; display:flex; flex-direction:column; gap:6px; }
.mchat__lead{
  border:0; cursor:pointer; height:40px; border-radius:12px; font-size:13.5px; font-weight:700;
  color:var(--accent-ink,#0B5BD3); background:var(--accent-soft,#DCE8FE);
}
.mchat__lead:hover{ filter:brightness(1.04); }
.mchat__note{ font-size:10.5px; color:var(--text-3,#8A93A6); text-align:center; }
.mchat__note a{ color:inherit; text-decoration:underline; }

/* mobile */
@media (max-width:520px){
  .mchat{ right:14px; bottom:86px; }
  .mchat__panel{
    position:fixed; right:0; left:0; bottom:0; width:100%;
    height:min(86dvh, 640px); border-radius:20px 20px 0 0;
  }
  .mchat__teaser{ display:none; }
  .mchat.open .mchat__btn{ display:none; }
}
