/* =====================================================================
   ИЭММ — ОНЛАЙН-КОНСУЛЬТАНТ «РОМАН» v1 (к js/iemm-consult.js)
   ОТКЛЮЧИТЬ: в /bitrix/php_interface/iemm_consult.php поставить IEMM_CONSULT = false.
   ===================================================================== */
:root { --cs-accent: var(--theme-base-color, #365edc); --cs-ink: #1a1d24; --cs-muted: #8a91a0; --cs-line: #eceff5; --cs-soft: #f4f6fb; }

/* кнопку «наверх» поднимаем над кнопкой чата */
.scroll-to-top { bottom: 104px !important; }

/* ---------- плавающая кнопка ---------- */
.iemm-cs-fab { position: fixed; z-index: 10040; right: 24px; bottom: 24px; width: 62px; height: 62px; border: 0; border-radius: 50%; padding: 0; cursor: pointer; color: #fff;
	background: radial-gradient(120% 120% at 20% 10%, #5b82ff 0%, var(--cs-accent) 55%, #2443b8 100%);
	box-shadow: 0 12px 30px rgba(54, 94, 220, .45), inset 0 1px 0 rgba(255, 255, 255, .25); transition: transform .25s cubic-bezier(.2, .7, .2, 1), opacity .2s, box-shadow .25s; }
.iemm-cs-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 16px 36px rgba(54, 94, 220, .55); }
.iemm-cs-fab::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cs-accent); animation: iemmCsPulse 2.6s ease-out infinite; }
.iemm-cs-fab__ico { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.iemm-cs-fab__dot { position: absolute; top: 5px; right: 5px; width: 13px; height: 13px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.iemm-cs-fab.is-hidden { opacity: 0; transform: scale(.6); pointer-events: none; }
@keyframes iemmCsPulse { 0% { transform: scale(1); opacity: .6; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
.iemm-cs-hint { position: absolute; right: 74px; bottom: 8px; width: max-content; max-width: 220px; padding: 10px 14px; border-radius: 14px 14px 4px 14px; background: #fff; color: var(--cs-ink); font-size: 13px; line-height: 1.4; text-align: left; box-shadow: 0 10px 30px rgba(20, 30, 60, .16); opacity: 0; transform: translateX(8px); pointer-events: none; transition: opacity .3s, transform .3s; }
.iemm-cs-hint b { color: var(--cs-accent); }
.iemm-cs-fab.show-hint .iemm-cs-hint, .iemm-cs-fab:hover .iemm-cs-hint { opacity: 1; transform: none; }

/* ---------- окно чата ---------- */
.iemm-cs { position: fixed; z-index: 10045; right: 24px; bottom: 24px; width: 380px; height: min(620px, calc(100vh - 48px)); display: flex; flex-direction: column;
	border-radius: 22px; background: #fff; overflow: hidden; box-shadow: 0 30px 80px rgba(15, 25, 60, .28), 0 0 0 1px rgba(20, 30, 60, .05);
	opacity: 0; transform: translateY(16px) scale(.97); transform-origin: bottom right; pointer-events: none; transition: opacity .25s, transform .3s cubic-bezier(.2, .7, .2, 1); font-family: inherit; }
.iemm-cs.is-open { opacity: 1; transform: none; pointer-events: auto; }
.iemm-cs__head { display: flex; align-items: center; gap: 12px; padding: 16px 14px 16px 18px; color: #fff;
	background: linear-gradient(135deg, #2443b8 0%, var(--cs-accent) 55%, #5b82ff 100%); }
.iemm-cs__ava { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .18); font-weight: 700; font-size: 17px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.iemm-cs__ava i { position: absolute; right: 0; bottom: 1px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #3a5fe0; }
.iemm-cs__who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.iemm-cs__who b { font-size: 16px; color: #fff; }
.iemm-cs__who small { font-size: 12px; opacity: .85; color: #fff; }
.iemm-cs__icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; transition: background .15s; }
.iemm-cs__icon:hover { background: rgba(255, 255, 255, .25); }

.iemm-cs__body { flex: 1; overflow-y: auto; padding: 18px 16px 8px; background: var(--cs-soft); scroll-behavior: smooth; overscroll-behavior: contain; }
.iemm-cs__body::-webkit-scrollbar { width: 6px; }
.iemm-cs__body::-webkit-scrollbar-thumb { background: #d6dbe6; border-radius: 3px; }
.iemm-cs__msg { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 10px; }
.iemm-cs__msg.is-new { animation: iemmCsIn .3s cubic-bezier(.2, .7, .2, 1); }
@keyframes iemmCsIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.iemm-cs__mini { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--cs-accent); color: #fff; font-size: 12px; font-weight: 700; }
.iemm-cs__bubble { position: relative; max-width: 82%; padding: 10px 14px 18px; border-radius: 16px 16px 16px 4px; background: #fff; color: var(--cs-ink); font-size: 14px; line-height: 1.45; box-shadow: 0 1px 2px rgba(20, 30, 60, .06); word-wrap: break-word; }
.iemm-cs__time { position: absolute; right: 10px; bottom: 4px; font-size: 10.5px; color: var(--cs-muted); }
.iemm-cs__msg--me { justify-content: flex-end; }
.iemm-cs__msg--me .iemm-cs__bubble { border-radius: 16px 16px 4px 16px; background: var(--cs-accent); color: #fff; }
.iemm-cs__msg--me .iemm-cs__time { color: rgba(255, 255, 255, .75); }
.iemm-cs__typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.iemm-cs__typing i { width: 7px; height: 7px; border-radius: 50%; background: #b5bccb; animation: iemmCsDot 1.2s infinite; }
.iemm-cs__typing i:nth-child(2) { animation-delay: .15s; }
.iemm-cs__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes iemmCsDot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.iemm-cs__card { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--cs-soft); font-size: 13px; }
.iemm-cs__card div { padding: 3px 0; }
.iemm-cs__card span { display: block; font-size: 11.5px; color: var(--cs-muted); }
.iemm-cs__cap { margin-top: 10px; }
.iemm-cs__cap img { display: block; border-radius: 8px; border: 1px solid var(--cs-line); max-width: 100%; height: auto; }

.iemm-cs__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 4px; background: var(--cs-soft); max-height: 132px; overflow-y: auto; }
.iemm-cs__chips.is-empty { padding: 0; }
.iemm-cs__chips button { height: 34px; padding: 0 14px; border: 1px solid rgba(54, 94, 220, .35); border-radius: 99px; background: #fff; color: var(--cs-accent); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s, transform .15s, border-color .15s; }
.iemm-cs__chips button:hover { background: var(--cs-accent); color: #fff; border-color: var(--cs-accent); transform: translateY(-1px); }
.iemm-cs__chips button.is-ghost { border-color: var(--cs-line); color: var(--cs-muted); }
.iemm-cs__chips button.is-ghost:hover { background: #e9edf5; color: var(--cs-ink); }

.iemm-cs__form { display: flex; gap: 8px; padding: 10px 12px; margin: 0; background: #fff; border-top: 1px solid var(--cs-line); }
.iemm-cs__form.is-off { opacity: .55; }
.iemm-cs__input { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid #e3e7ef; border-radius: 12px; background: var(--cs-soft); font-size: 14px; color: var(--cs-ink); outline: 0; transition: border-color .15s, box-shadow .15s, background .15s; }
.iemm-cs__input:focus { border-color: var(--cs-accent); background: #fff; box-shadow: 0 0 0 3px rgba(54, 94, 220, .14); }
.iemm-cs__send { flex: 0 0 44px; height: 44px; border: 0; border-radius: 12px; background: var(--cs-accent); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, box-shadow .15s; }
.iemm-cs__send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(54, 94, 220, .35); }
.iemm-cs__send:disabled { cursor: default; }
.iemm-cs__hp { position: absolute !important; left: -9999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.iemm-cs__foot { padding: 0 14px 10px; background: #fff; font-size: 10.5px; color: var(--cs-muted); text-align: center; line-height: 1.35; }
.iemm-cs__foot a { color: var(--cs-muted) !important; text-decoration: underline; }

/* ---------- мобильная версия ---------- */
@media (max-width: 991px) {
	.iemm-cs-fab { bottom: 100px; right: 16px; width: 56px; height: 56px; }
	.scroll-to-top { bottom: 170px !important; }
}
@media (max-width: 575px) {
	.iemm-cs { right: 0; bottom: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
	.iemm-cs-hint { display: none; }
	html.iemm-cs-lock, html.iemm-cs-lock body { overflow: hidden !important; }
	.iemm-cs__input { font-size: 16px; }
}
@media print { .iemm-cs, .iemm-cs-fab { display: none !important; } }
/* фото консультанта */
.iemm-cs__ava { width: 52px !important; height: 52px !important; }
.iemm-cs__mini { width: 32px !important; height: 32px !important; }
.iemm-cs-hint__ava { flex-basis: 44px !important; width: 44px !important; height: 44px !important; }
.iemm-cs__ava { overflow: visible; background: #fff; }
.iemm-cs__ava img, .iemm-cs__mini img, .iemm-cs-hint__ava img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.iemm-cs__mini { overflow: hidden; background: #e8edf9; padding: 0; }
.iemm-cs-hint { display: flex; align-items: center; gap: 10px; }
.iemm-cs-hint__ava { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(54, 94, 220, .35); }
/* ===== ОНЛАЙН-КОНСУЛЬТАНТ v1 — КОНЕЦ ===== */
