/* ===== Онлайн-чат ReservPoint (мост к Telegram) ===== */
.cwidget, .cchat-launcher, .cchat {
  --c-primary:#F26522; --c-primary-dark:#D4551A; --c-dark:#1A1A1A;
  --c-ink:#24272A; --c-light:#f5f7fa; --c-border:#e6e8eb;
  --c-shadow:0 24px 60px rgba(20,22,24,.18);
  /* Сторона: переопределяется инлайном из настроек (право/лево) */
  --c-pos-right:clamp(16px,3vw,32px);
  --c-pos-left:auto;
}

/* Вкладка-лаунчер (десктоп) — z-index выше cookie-баннера (999) и модалок (10000) */
.cchat-launcher{
  position:fixed; bottom:0; z-index:999998;
  right:var(--c-pos-right); left:var(--c-pos-left);
  display:inline-flex; align-items:center; gap:10px; height:46px; padding:0 22px;
  border-radius:14px 14px 0 0; background:var(--c-primary); color:#fff;
  font-family:inherit; font-weight:700; font-size:15px; line-height:1;
  box-shadow:0 -8px 26px rgba(242,101,34,.4); cursor:pointer; border:0;
  transition:background .15s ease, transform .15s ease;
}
.cchat-launcher:hover{ background:var(--c-primary-dark); transform:translateY(-3px); }
.cchat-launcher svg{ width:22px; height:22px; flex:none; }

/* Панель чата */
.cchat{
  position:fixed; bottom:clamp(16px,3vw,32px); z-index:999999;
  right:var(--c-pos-right); left:var(--c-pos-left);
  width:min(var(--c-width,370px), calc(100vw - 32px));
  height:min(var(--c-height,580px), calc(100dvh - 130px));
  background:#fff; border-radius:20px; box-shadow:var(--c-shadow);
  display:none; flex-direction:column; overflow:hidden;
  font-family:inherit;
}
.cchat.open{ display:flex; }
.cchat__head{
  background:var(--c-dark); color:#fff; padding:15px 16px;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  font-weight:700; font-size:14.5px; flex:none;
}
.cchat__head-title{ display:flex; align-items:center; gap:9px; }
.cchat__head-logo{ width:26px; height:26px; border-radius:7px; background:var(--c-primary); display:inline-flex; align-items:center; justify-content:center; flex:none; }
.cchat__head-logo svg{ width:16px; height:16px; }
.cchat__head-sub{ font-weight:500; font-size:12px; opacity:.7; margin-top:1px; }
.cchat__close{ color:#fff; font-size:18px; line-height:1; padding:4px 6px; flex:none; cursor:pointer; background:none; border:0; opacity:.8; }
.cchat__close:hover{ opacity:1; }

.cchat__prechat{ flex:1; padding:20px 16px; display:flex; flex-direction:column; gap:12px; }
.cchat__prechat p{ color:var(--c-ink); font-size:15px; line-height:1.5; margin:0 0 auto; }
.cchat__field{
  width:100%; border:1px solid var(--c-border); border-radius:12px;
  padding:12px 14px; font-size:15px; color:var(--c-ink); background:#fff; font-family:inherit;
}
.cchat__field:focus{ outline:none; border-color:var(--c-primary); }
.cchat__start,.cchat__send{
  background:var(--c-primary); color:#fff; border:0; border-radius:12px;
  font-family:inherit; font-weight:700; font-size:15px; padding:12px 14px; cursor:pointer;
  transition:background .15s ease;
}
.cchat__start:hover,.cchat__send:hover{ background:var(--c-primary-dark); }
.cchat__policy{ font-size:11px; color:#98a0a8; line-height:1.4; }
.cchat__policy a{ color:var(--c-primary); text-decoration:underline; }

.cchat__body{ flex:1; overflow-y:auto; padding:16px 14px 6px; display:flex; flex-direction:column; gap:8px; background:var(--c-light); }
.cchat__msg{ max-width:82%; padding:9px 13px; border-radius:14px; font-size:14.5px; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; }
.cchat__msg--visitor{ align-self:flex-end; background:var(--c-primary); color:#fff; border-bottom-right-radius:4px; }
.cchat__msg--manager,.cchat__msg--bot{ align-self:flex-start; background:#fff; color:var(--c-ink); border:1px solid var(--c-border); border-bottom-left-radius:4px; }

.cchat__input{ display:flex; gap:8px; padding:10px 12px; border-top:1px solid var(--c-border); background:#fff; flex:none; }
.cchat__input .cchat__field{ flex:1; }
.cchat__send{ flex:none; width:48px; padding:0; font-size:18px; }

/* Состояние «идёт переписка» */
.cchat.chatting .cchat__prechat{ display:none; }
.cchat.chatting .cchat__body{ display:flex; }
.cchat.chatting .cchat__input{ display:flex; }

/* ── Мобильные: круглая кнопка (как у Jivo) + панель на всю ширину ── */
@media (max-width:560px){
  .cchat{
    right:8px; left:8px; width:auto; bottom:8px;
    height:min(76dvh,560px);
  }
  .cchat-launcher{
    bottom:16px;
    width:58px; height:58px; padding:0; gap:0;
    border-radius:50%;
    justify-content:center;
    box-shadow:0 6px 20px rgba(242,101,34,.45);
  }
  .cchat-launcher span{ display:none; }   /* только иконка */
  .cchat-launcher svg{ width:26px; height:26px; }
}
