/* Модуль «Чаты»: живой инбокс и особенности мини-виджетами.
   Разметка — resources/views/site/modules/chats.blade.php, сценарий демо — chats.js */
.chx, .chf {
    --c-wa: #1c8f4e; --c-wa-bg: #e5f6ec;
    --c-app: var(--accent); --c-app-bg: var(--accent-soft);
    --c-voice: #6a4fd0; --c-voice-bg: #f1edfd;
    --c-call: #0b7487; --c-call-bg: #e2f3f6;
    --c-ai: #6a4fd0; --c-ai-bg: #f1edfd;
    --c-wait: #a8650b; --c-wait-bg: #fdf1dc;
    --ce: cubic-bezier(.2, .7, .2, 1);
}
.chx-head { max-width: 780px; }
.chx-head .lead { margin-top: 18px; }

/* ── Окно ── */
.chx-app {
    position: relative; margin-top: 44px; background: #fff; border: 1px solid var(--line-card); border-radius: 16px;
    box-shadow: 0 1px 2px rgba(20, 20, 19, .04), 0 30px 80px rgba(20, 20, 19, .10); overflow: hidden; user-select: none; font-size: 13px;
}
.chx.is-fast .chx-app *, .chx.is-fast .chx-app *::before, .chx.is-fast .chx-app *::after { transition: none !important; animation-duration: 0s !important; }
.chx-bar { display: flex; align-items: center; gap: 18px; min-height: 60px; padding: 8px 14px 8px 18px; border-bottom: 1px solid var(--line); }
.chx-crumbs { display: flex; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.chx-crumbs i { font-style: normal; color: var(--ph); }
.chx-crumbs b { color: var(--ink); font-weight: 600; font-size: 15px; }
.chx-kpis { margin-left: auto; display: flex; gap: 6px; }
.chx-kpi { position: relative; min-width: 120px; padding: 6px 12px 7px; border-radius: 10px; background: var(--hover-soft); border: 1px solid var(--line); }
.chx-kpi > span { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chx-kpi > b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.chx-kpi.is-ai > span { color: var(--c-ai); }
.chx-kpi-bar { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 3px; border-radius: 3px; background: #ecebf6; overflow: hidden; }
.chx-kpi-bar i { display: block; height: 100%; background: var(--c-ai); border-radius: inherit; transition: width .8s var(--ce); }
.chx-kpi.is-wait.is-hot { background: var(--c-wait-bg); border-color: #f3dcb2; }
.chx-kpi.is-wait.is-hot b { color: var(--c-wait); }
.chx-kpi b.is-bump { animation: chx-bump .5s var(--ce); }
@keyframes chx-bump { 40% { transform: scale(1.18); color: var(--accent); } }

.chx-body { display: grid; grid-template-columns: 300px minmax(0, 1fr) 280px; height: 580px; }

/* Очередь */
.chx-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #fff; }
.chx-search { display: flex; align-items: center; gap: 7px; height: 32px; margin: 12px 12px 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ph); white-space: nowrap; overflow: hidden; }
.chx-tabs { display: flex; gap: 2px; margin: 0 12px; padding: 3px; border-radius: 9px; background: var(--chip); }
.chx-tabs span { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 28px; border-radius: 7px; color: var(--ink-2); font-weight: 500; white-space: nowrap; transition: background .25s, color .25s; }
.chx-tabs span[aria-current] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 20, 19, .08); }
.chx-tabs b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e4e4df; font-size: 11px; display: grid; place-items: center; font-variant-numeric: tabular-nums; transition: background .25s, color .25s; }
.chx-tabs span[data-tab='wait'].is-hot b { background: var(--c-wait); color: #fff; }
.chx-ops { display: flex; align-items: center; gap: 4px; margin: 10px 14px 6px; }
.chx-ops-l { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 12px; color: var(--muted); }
.chx-ops-l i { width: 7px; height: 7px; border-radius: 50%; background: #22a35a; }
.chx-av { --h: 210; width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; font-style: normal; color: hsl(var(--h) 45% 32%); background: hsl(var(--h) 70% 92%); }
.chx-av-sm { width: 24px; height: 24px; font-size: 10px; }
.chx-items { flex: 1; overflow: hidden; padding: 4px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.chx-it {
    position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 10px; padding: 9px 10px; border-radius: 10px;
    transition: background .25s, opacity .5s, transform .5s var(--ce), max-height .5s var(--ce), padding .5s; max-height: 90px;
    animation: chx-in .55s var(--ce) both;
}
@keyframes chx-in { from { opacity: 0; transform: translateX(-24px); } }
.chx-it .chx-av { grid-row: 1 / 3; align-self: center; position: relative; }
.chx-it .chx-av .chx-chb { position: absolute; right: -4px; bottom: -3px; }
.chx-it-n { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chx-it-t { grid-column: 2 / 4; color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chx-it-time { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.chx-it-st { grid-column: 2 / 4; justify-self: start; margin-top: 3px; }
.chx-it.is-sel { background: var(--accent-soft); }
.chx-it.is-wait { background: var(--c-wait-bg); }
.chx-it.is-wait .chx-it-time { color: var(--c-wait); font-weight: 600; }
.chx-it.is-done { opacity: .55; }
.chx-it.is-flash::after { content: ''; position: absolute; inset: 0; border-radius: inherit; border: 1.5px solid #22a35a; animation: chx-flash 1s ease-out forwards; pointer-events: none; }
@keyframes chx-flash { from { opacity: 1; } to { opacity: 0; transform: scale(1.03); } }

/* Бейджи канала и статусы */
.chx-chb { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 6px; border: 2px solid #fff; background: var(--c-app); color: #fff; font-style: normal; }
.chx-chb .i { width: 10px; height: 10px; }
.chx-chb[data-ch='wa'] { background: var(--c-wa); }
.chx-chb[data-ch='voice'] { background: var(--c-voice); }
.chx-chb[data-ch='call'] { background: var(--c-call); }
.chx-chl { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 500; color: var(--c-app); }
.chx-chl[data-ch='wa'] { color: var(--c-wa); }
.chx-chl[data-ch='voice'] { color: var(--c-voice); }
.chx-chl[data-ch='call'] { color: var(--c-call); }
.chx-st { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--ink-2); }
.chx-st:empty { display: none; }
.chx-st .i { width: 11px; height: 11px; }
.chx-st[data-s='ai'] { background: var(--c-ai-bg); color: var(--c-ai); }
.chx-st[data-s='ai'] .i { animation: chx-spark 1.4s ease-in-out infinite; }
@keyframes chx-spark { 50% { transform: rotate(18deg) scale(1.2); } }
.chx-st[data-s='solved'], .chx-st[data-s='back'] { background: var(--ok-soft); color: var(--ok); }
.chx-st[data-s='solved'] { animation: chx-pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes chx-pop { from { transform: scale(.6); opacity: 0; } }
.chx-st[data-s='waiting'] { background: var(--c-wait); color: #fff; }
.chx-st[data-s='taken'] { background: var(--accent); color: #fff; }
.chx-st[data-s='call'] { background: var(--c-call-bg); color: var(--c-call); }

/* Переписка */
.chx-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #fbfbfa; }
.chx-th-head { display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #fff; flex: none; }
.chx-th-head:not(.is-on) > * { visibility: hidden; }
.chx-th-who { min-width: 0; display: flex; flex-direction: column; }
.chx-th-who b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chx-th-head .chx-st { margin-left: auto; }
.chx-msgs { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.chx-msgs-in { position: absolute; left: 18px; right: 18px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.chx-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ph); }
.chx-m { max-width: 78%; padding: 9px 12px; border-radius: 14px; line-height: 1.42; font-size: 13.5px; animation: chx-msg .4s var(--ce) both; }
@keyframes chx-msg { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.chx-m small { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; margin-bottom: 3px; }
.chx-m.is-in { align-self: flex-start; background: #fff; border: 1px solid var(--line-card); border-bottom-left-radius: 4px; }
.chx-m.is-ai { align-self: flex-end; background: var(--c-ai-bg); color: #2b2163; border-bottom-right-radius: 4px; }
.chx-m.is-ai small { color: var(--c-ai); }
.chx-m.is-op { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chx-m.is-op small { color: rgba(255, 255, 255, .8); }
.chx-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chx-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ai); opacity: .35; animation: chx-dot 1.1s infinite; }
.chx-dots i:nth-child(2) { animation-delay: .15s; }
.chx-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chx-dot { 30% { opacity: 1; transform: translateY(-3px); } }
/* голосовое */
.chx-voice { display: flex; align-items: center; gap: 8px; }
.chx-voice > span:first-child { width: 26px; height: 26px; border-radius: 50%; background: var(--c-voice); color: #fff; display: grid; place-items: center; flex: none; }
.chx-wave { display: flex; align-items: center; gap: 2px; height: 22px; }
.chx-wave i { width: 3px; border-radius: 2px; background: #b9aef0; height: var(--h); transition: background .2s; }
.chx-wave.is-play i { animation: chx-wv .9s ease-in-out infinite; animation-delay: var(--dl); }
@keyframes chx-wv { 50% { transform: scaleY(.45); background: var(--c-voice); } }
.chx-voice em { font-style: normal; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chx-tr { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--ink-2); font-style: italic; animation: chx-msg .4s var(--ce) both; }
.chx-tr::before { content: '✎ '; font-style: normal; color: var(--c-voice); }
/* карточки действий в чате */
.chx-act-card { align-self: flex-end; width: 260px; max-width: 86%; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line-card); box-shadow: 0 8px 22px rgba(20, 20, 19, .07); animation: chx-msg .45s var(--ce) both; position: relative; }
.chx-ac-h { display: flex; align-items: center; gap: 10px; }
.chx-ac-h > span:first-child { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.chx-act-card.is-sign .chx-ac-h > span:first-child { background: var(--c-ai-bg); color: var(--c-ai); }
.chx-ac-h b { display: block; font-size: 13.5px; }
.chx-ac-h small { display: block; font-size: 12px; color: var(--muted); }
.chx-ac-sum { margin-left: auto; font-size: 15px; font-weight: 700; white-space: nowrap; }
.chx-ac-btn { margin-top: 10px; height: 32px; border-radius: 8px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; transition: background .35s; }
.chx-act-card.is-done .chx-ac-btn { background: var(--ok); }
.chx-act-card.is-done::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 50% 100%, rgba(34, 163, 90, .18), transparent 70%); animation: chx-glow 1.2s ease-out forwards; pointer-events: none; }
@keyframes chx-glow { from { opacity: 1; } to { opacity: 0; } }
/* системные плашки */
.chx-sys { align-self: center; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ink-2); font-size: 11.5px; font-weight: 500; animation: chx-msg .4s var(--ce) both; }
.chx-sys.is-ok { background: var(--ok-soft); color: var(--ok); }
.chx-hand { align-self: stretch; padding: 11px 13px; border-radius: 12px; background: var(--c-wait-bg); border: 1px solid #f1d9ae; animation: chx-msg .45s var(--ce) both; }
.chx-hand-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--c-wait); }
.chx-hand-h .chx-take { margin-left: auto; height: 26px; padding: 0 12px; border-radius: 7px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; font-size: 12px; transition: transform .12s, background .3s; }
.chx-take.is-press, .chx-act.is-press, .chx-send.is-press { transform: scale(.92); }
.chx-hand.is-taken .chx-take { background: var(--ok); }
.chx-hand dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; }
.chx-hand dt { color: var(--muted); }
.chx-hand dd { margin: 0; color: var(--ink); }
.chx-hand .chx-reason { display: inline-block; padding: 1px 7px; border-radius: 6px; background: #fff; border: 1px solid #ecd2a2; font-weight: 500; }
.chx-stamp { position: absolute; right: -10px; top: -14px; transform: rotate(-8deg); padding: 3px 9px; border: 2px solid var(--ok); color: var(--ok); border-radius: 8px; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; animation: chx-stamp .45s cubic-bezier(.3, 1.6, .5, 1) both; background: rgba(255, 255, 255, .85); }
@keyframes chx-stamp { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } }

.chx-compose { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #fff; flex: none; }
.chx-note-t { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 8px; background: #fff7df; color: #8a5a0e; font-size: 12px; font-weight: 500; white-space: nowrap; }
.chx-input { flex: 1; min-width: 0; height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-strong); display: flex; align-items: center; color: var(--ph); white-space: nowrap; overflow: hidden; }
.chx-input.is-typing { color: var(--ink); border-color: var(--accent); }
.chx-input.is-typing span::after { content: ''; display: inline-block; width: 1.5px; height: 15px; background: var(--accent); margin-left: 1px; vertical-align: -3px; animation: chx-caret 1s steps(1) infinite; }
@keyframes chx-caret { 50% { opacity: 0; } }
.chx-send { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; transition: transform .12s; }

/* Карточка клиента */
.chx-card { position: relative; border-left: 1px solid var(--line); padding: 14px 16px; overflow: hidden; background: #fff; }
.chx-card-veil { position: absolute; inset: 0; background: rgba(255, 255, 255, .92); transition: opacity .5s; }
.chx-card.is-on .chx-card-veil { opacity: 0; pointer-events: none; }
.chx-card > * { transition: opacity .5s, transform .5s var(--ce); }
.chx-card:not(.is-on) > :not(.chx-card-veil) { transform: translateY(8px); }
.chx-cap { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 2px 0 10px; }
.chx-card-who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chx-card-who b { display: block; font-size: 14px; }
.chx-card-who small { font-size: 12px; color: var(--muted); }
.chx-rows { margin: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.chx-rows > div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.chx-rows dt { color: var(--muted); }
.chx-rows dd { margin: 0; font-weight: 500; text-align: right; }
.chx-debt dd { position: relative; }
.chx-debt [data-debt-v] { display: inline-block; padding: 0 7px; border-radius: 6px; background: var(--bad-soft); color: var(--bad); font-weight: 600; transition: opacity .3s, transform .3s; }
.chx-debt [data-debt-ok] { position: absolute; right: 0; top: 0; padding: 0 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok); font-weight: 600; opacity: 0; transform: translateY(6px); transition: opacity .3s .15s, transform .3s .15s; }
.chx-debt.is-ok [data-debt-v] { opacity: 0; transform: translateY(-6px); }
.chx-debt.is-ok [data-debt-ok] { opacity: 1; transform: none; }
.chx-acts { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 16px; }
.chx-act { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); font-weight: 500; transition: transform .12s, background .25s, color .25s, border-color .25s; }
.chx-act.is-main.is-hl { background: var(--ink); color: #fff; border-color: var(--ink); }
.chx-hist { display: flex; flex-direction: column; gap: 8px; }
.chx-hist li { display: grid; grid-template-columns: 38px 1fr; gap: 6px; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.chx-hist time { color: var(--faint); font-variant-numeric: tabular-nums; }

/* Курсор */
.chx-cursor { position: absolute; left: 0; top: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .3s; will-change: transform; }
.chx-cursor.is-on { opacity: 1; }
.chx-cursor i { position: absolute; left: -9px; top: -9px; width: 22px; height: 22px; border-radius: 50%; background: rgba(47, 91, 216, .28); transform: scale(0); }
.chx-cursor.is-click i { animation: chx-click .45s ease-out; }
@keyframes chx-click { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }

/* Шаги */
.chx-ctl { display: flex; align-items: flex-start; gap: 24px; margin-top: 18px; }
.chx-steps { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.chx-steps button { position: relative; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px 10px 14px; border-radius: 10px; text-align: left; transition: background .2s; }
.chx-steps button:hover { background: var(--hover-soft); }
.chx-st-n { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-2); transition: background .25s, color .25s; }
.chx-st-t { min-width: 0; }
.chx-st-t b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.chx-st-t small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.chx-st-bar { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.chx-st-bar i { display: block; height: 100%; width: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }
.chx-steps button[data-st='on'] .chx-st-n { background: var(--ink); color: #fff; }
.chx-steps button[data-st='done'] .chx-st-n { background: var(--ok-soft); color: var(--ok); }
.chx-steps button[data-st='done'] .chx-st-bar i { transform: none; background: var(--ok); }
.chx-ctl-btns { display: flex; gap: 8px; padding-top: 6px; }
.chx-ctl-btns .btn { gap: 6px; }

@media (max-width: 1279px) {
    .chx-body { grid-template-columns: 270px minmax(0, 1fr) 250px; }
    .chx-kpi { min-width: 0; }
    .chx-kpi:first-child { display: none; }
}
@media (max-width: 1023px) {
    .chx-body { grid-template-columns: 260px minmax(0, 1fr); }
    .chx-card { display: none; }
    .chx-ctl { flex-direction: column; gap: 10px; }
    .chx-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
}
@media (max-width: 767px) {
    .chx-app { margin-top: 28px; border-radius: 14px; }
    .chx-bar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
    .chx-kpis { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .chx-kpi { padding: 5px 8px 7px; }
    .chx-kpi > span { font-size: 10.5px; white-space: normal; line-height: 1.2; }
    .chx-kpi > b { font-size: 16px; }
    .chx-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 214px 440px; height: auto; }
    .chx-list { border-right: 0; border-bottom: 1px solid var(--line); }
    .chx-search, .chx-ops { display: none; }
    .chx-tabs { margin-top: 10px; }
    .chx-m { max-width: 88%; }
    .chx-note-t { display: none; }
    .chx-steps { grid-template-columns: 1fr; gap: 0; }
    .chx-steps button { padding: 9px 6px 12px; align-items: center; }
    .chx-st-t { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
    .chx-ctl-btns { width: 100%; }
    .chx-ctl-btns .btn { flex: 1; }
    .chx-cursor { display: none; }
}

/* ── Особенности: мини-виджеты ── */
.chf-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.chf-card { border: 1px solid var(--line-card); border-radius: 16px; background: #fff; overflow: hidden; padding-bottom: 22px; }
.chf-wide { grid-column: span 2; }
.chf-card h3 { display: flex; align-items: center; gap: 8px; margin: 20px 20px 6px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.chf-card h3 .i { color: var(--accent); }
.chf-card > p { margin: 0 20px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.chf-vis {
    position: relative; height: 210px; padding: 18px; overflow: hidden; border-bottom: 1px solid var(--line);
    background-color: #fafaf9; background-image: radial-gradient(circle, #e0e0db 1px, transparent 1.3px); background-size: 16px 16px;
}
.chf .chf-vis *, .chf .chf-vis *::after, .chf .chf-vis *::before { animation-play-state: paused; }
.chf.is-on .chf-vis *, .chf.is-on .chf-vis *::after, .chf.is-on .chf-vis *::before { animation-play-state: running; }

/* Каналы → инбокс */
.chf-chs .chf-vis { display: grid; grid-template-columns: 130px minmax(40px, 1fr) 170px; align-items: center; }
.chf-srcs { display: flex; flex-direction: column; gap: 8px; }
.chf-src { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: 9px; background: #fff; border: 1px solid var(--line-card); font-size: 12.5px; font-weight: 500; white-space: nowrap; animation: chf-src 3.5s var(--d) infinite; }
.chf-src .i { color: var(--c-app); }
.chf-src[data-k='0'] .i { color: var(--c-wa); }
.chf-src[data-k='2'] .i { color: var(--c-voice); }
.chf-src[data-k='3'] .i { color: var(--c-ai); }
.chf-src[data-k='4'] .i { color: var(--c-call); }
@keyframes chf-src { 0%, 20%, 100% { transform: none; box-shadow: none; } 6% { transform: translateX(4px); box-shadow: 0 4px 12px rgba(47, 91, 216, .18); } }
.chf-flow { width: 100%; height: 180px; overflow: visible; }
.chf-flow path { fill: none; stroke: #d7d7d1; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.chf-flow circle { fill: var(--accent); }
.chf-inbox { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line-card); box-shadow: 0 8px 24px rgba(20, 20, 19, .06); }
.chf-inbox-h { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.chf-inbox-h .i { color: var(--accent); }
.chf-in-row { position: relative; display: flex; align-items: center; gap: 8px; padding: 4px; border-radius: 8px; animation: chf-row 3.5s var(--d) infinite; }
.chf-in-row .chx-chb { position: absolute; left: 18px; top: 16px; width: 14px; height: 14px; border-width: 1.5px; border-radius: 5px; }
.chf-in-row .chx-chb .i { width: 8px; height: 8px; }
.chf-in-row b { flex: 1; height: 7px; border-radius: 4px; background: #ecece8; }
@keyframes chf-row { 0%, 20%, 100% { background: transparent; } 8% { background: var(--accent-soft); } }

/* Передача с причиной */
.chf-hand .chf-vis { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.chf-hand-top { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 220px; }
.chf-ai, .chf-op { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.chf-ai { background: var(--c-ai-bg); color: var(--c-ai); }
.chf-op { background: var(--accent-soft); color: var(--accent); }
.chf-hand-line { position: relative; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, #cfcfc9 0 5px, transparent 5px 9px); }
.chf-hand-line::after { content: ''; position: absolute; left: 0; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--c-wait); animation: chf-pass 1.6s ease-in-out infinite; }
@keyframes chf-pass { from { left: 0; } to { left: calc(100% - 10px); } }
.chf-hand-from { font-size: 11.5px; color: var(--muted); }
.chf-reasons { position: relative; width: 100%; height: 34px; }
.chf-reasons span { position: absolute; left: 50%; top: 0; transform: translate(-50%, 10px); white-space: nowrap; padding: 7px 12px; border-radius: 999px; background: var(--c-wait-bg); color: var(--c-wait); border: 1px solid #f1d9ae; font-size: 12.5px; font-weight: 600; opacity: 0; animation: chf-reason 8s var(--d) infinite; }
@keyframes chf-reason { 0% { opacity: 0; transform: translate(-50%, 10px); } 4%, 18% { opacity: 1; transform: translate(-50%, 0); } 22%, 100% { opacity: 0; transform: translate(-50%, -10px); } }

/* Операторы */
.chf-assign .chf-vis { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.chf-q { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--c-wait-bg); color: var(--c-wait); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.chf-q i { width: 14px; height: 14px; border-radius: 4px; background: var(--c-wait); animation: chf-q 4.2s var(--d) infinite; }
@keyframes chf-q { 0% { opacity: 0; transform: scale(.4); } 8%, 30% { opacity: 1; transform: none; } 40%, 100% { opacity: 0; transform: translateY(26px) scale(.6); } }
.chf-oprow { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; background: #fff; border: 1px solid var(--line-card); animation: chf-op 4.2s var(--d) infinite; }
@keyframes chf-op { 0%, 30%, 60%, 100% { border-color: var(--line-card); } 40% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } }
.chf-oprow b { font-size: 12.5px; font-weight: 600; flex: 1; }
.chf-load { display: flex; gap: 3px; }
.chf-load i { width: 7px; height: 14px; border-radius: 2px; background: #ecece8; }
.chf-load i.on { background: var(--accent); }

/* Карточка рядом */
.chf-mini { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; height: 100%; }
.chf-mini-b { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; padding: 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line-card); }
.chf-mini-b i { height: 16px; border-radius: 8px; background: #ecece8; width: 80%; }
.chf-mini-b i:nth-child(2) { align-self: flex-end; background: var(--accent-soft); width: 70%; }
.chf-mini-b i:nth-child(3) { width: 55%; }
.chf-mini-card { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line-card); box-shadow: 0 8px 22px rgba(20, 20, 19, .07); animation: chf-slide 5s infinite; }
@keyframes chf-slide { 0% { transform: translateX(30px); opacity: 0; } 10%, 90% { transform: none; opacity: 1; } 100% { transform: translateX(30px); opacity: 0; } }
.chf-mc-who { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 2px; }
.chf-mc-r { display: flex; justify-content: space-between; gap: 4px; padding: 4px 0; border-top: 1px solid var(--line); font-size: 11.5px; animation: chf-fade 5s var(--d) infinite; }
.chf-mc-r small { color: var(--muted); font-size: 11px; }
.chf-mc-r:last-child b { color: var(--ok); }
@keyframes chf-fade { 0%, 8% { opacity: 0; } 18%, 92% { opacity: 1; } 100% { opacity: 0; } }

/* Ссылки в чат */
.chf-links .chf-vis { display: flex; align-items: center; justify-content: center; }
.chf-lk-stack { position: relative; width: 100%; max-width: 250px; height: 92px; }
.chf-lk { position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line-card); box-shadow: 0 10px 26px rgba(20, 20, 19, .08); opacity: 0; animation: chf-lk 10s var(--d) infinite; }
.chf-lk > span { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.chf-lk b { display: block; font-size: 13.5px; }
.chf-lk small { font-size: 12px; color: var(--muted); }
.chf-lk em { position: absolute; right: 10px; bottom: -11px; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: var(--ok); color: #fff; font-style: normal; font-size: 11px; font-weight: 600; opacity: 0; animation: chf-paid 10s var(--d) infinite; }
@keyframes chf-lk { 0% { opacity: 0; transform: translateY(18px) scale(.96); } 3%, 17% { opacity: 1; transform: none; } 20%, 100% { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes chf-paid { 0%, 9% { opacity: 0; transform: scale(.5); } 11%, 17% { opacity: 1; transform: none; } 20%, 100% { opacity: 0; } }

/* Рассылки */
.chf-camp .chf-vis { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: center; }
.chf-tpl { padding: 12px; border-radius: 12px; background: #e9f5e0; border: 1px solid #d5e9c6; font-size: 12.5px; line-height: 1.45; }
.chf-tpl-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.chf-tpl-h b { font-size: 12px; }
.chf-tpl-h em { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; background: var(--ok); color: #fff; font-style: normal; font-size: 10.5px; font-weight: 600; }
.chf-tpl-btn { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 5px; height: 28px; border-radius: 8px; background: #fff; color: var(--accent); font-weight: 600; }
.chf-cbars { display: flex; flex-direction: column; gap: 9px; }
.chf-cbars > div { display: grid; grid-template-columns: 96px 1fr 44px; align-items: center; gap: 8px; font-size: 12px; }
.chf-cbars span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chf-cbars > div > i { height: 10px; border-radius: 999px; background: #ecece8; overflow: hidden; }
.chf-cbars > div > i > i { display: block; height: 100%; border-radius: inherit; background: var(--c-wa); width: 0; transition: width 1.4s var(--ce) var(--d); }
.chf-cbars > div:last-child > i > i { background: var(--accent); }
.chf.is-seen .chf-cbars > div > i > i { width: calc(var(--w) * 1%); }
.chf-cbars b { text-align: right; font-variant-numeric: tabular-nums; }

/* Гостевой код */
.chf-guest .chf-vis { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.chf-g-l { font-size: 12px; color: var(--muted); }
.chf-code { display: flex; gap: 6px; }
.chf-code span { width: 40px; height: 50px; border-radius: 10px; background: #fff; border: 1px solid var(--line-card); display: grid; place-items: center; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; box-shadow: 0 4px 12px rgba(20, 20, 19, .06); animation: chf-digit 5s var(--d) infinite; }
@keyframes chf-digit { 0% { transform: rotateX(90deg); opacity: 0; } 8%, 100% { transform: none; opacity: 1; } }
.chf-g-ok { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--ok); color: #fff; font-size: 12.5px; font-weight: 600; animation: chf-gok 5s infinite; }
@keyframes chf-gok { 0%, 40% { opacity: 0; transform: translateY(8px); } 50%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* Групповые чаты и звонки */
.chf-groups .chf-vis { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.chf-gchat { display: flex; flex-direction: column; gap: 7px; padding: 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line-card); min-width: 0; }
.chf-gc-h { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.chf-gc-h .i { color: var(--accent); }
.chf-gm { display: flex; gap: 7px; align-items: flex-end; animation: chf-gm 6s var(--d) infinite; }
.chf-gm > span { padding: 5px 9px; border-radius: 10px; background: var(--chip); font-size: 12px; line-height: 1.35; min-width: 0; }
.chf-gm small { display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); }
@keyframes chf-gm { 0% { opacity: 0; transform: translateY(8px); } 6%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.chf-vcall { position: relative; border-radius: 12px; overflow: hidden; background: linear-gradient(160deg, #2b3a6e, #141a33); }
.chf-vc-main { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: rgba(255, 255, 255, .85); }
.chf-vc-av { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .12); animation: chf-speak 1.6s ease-in-out infinite; }
@keyframes chf-speak { 50% { box-shadow: 0 0 0 7px rgba(126, 160, 255, .25); } }
.chf-vc-main small { font-size: 11.5px; }
.chf-vc-self { position: absolute; right: 8px; top: 8px; width: 38px; height: 52px; border-radius: 7px; background: linear-gradient(160deg, #c7b39c, #8a7360); border: 1.5px solid rgba(255, 255, 255, .5); }
.chf-vc-bar { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 8px; }
.chf-vc-bar i { width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; display: grid; place-items: center; }
.chf-vc-bar i.end { background: #e0473f; }
.chf-vc-t { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .35); color: #fff; font-size: 10.5px; }

/* Спам */
.chf-spam .chf-vis { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.chf-sp-msgs { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; max-width: 180px; transition: filter .3s; animation: chf-blur 5s infinite; }
.chf-sp-msgs span { padding: 5px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line-card); font-size: 12px; animation: chf-sp 5s var(--d) infinite; }
@keyframes chf-sp { 0% { opacity: 0; transform: translateX(-10px); } 5%, 100% { opacity: 1; transform: none; } }
@keyframes chf-blur { 0%, 45% { filter: none; opacity: 1; } 55%, 92% { filter: grayscale(1) blur(1.2px); opacity: .45; } 100% { opacity: 1; } }
.chf-lock { position: absolute; left: 50%; top: 40%; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 14px; display: grid; place-items: center; background: var(--ink); color: #fff; box-shadow: 0 10px 26px rgba(20, 20, 19, .25); animation: chf-lock 5s infinite; }
@keyframes chf-lock { 0%, 45% { opacity: 0; transform: scale(1.8); } 52%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.chf-sp-l { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--bad); animation: chf-gok 5s infinite; }

@media (max-width: 1279px) {
    .chf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .chf-grid { grid-template-columns: minmax(0, 1fr); margin-top: 28px; }
    .chf-wide { grid-column: auto; }
    .chf-chs .chf-vis { grid-template-columns: 116px minmax(24px, 1fr) 140px; padding: 14px 12px; }
    .chf-src { font-size: 11.5px; padding: 0 8px; }
    .chf-camp .chf-vis { grid-template-columns: 1fr; height: auto; }
    .chf-groups .chf-vis { grid-template-columns: 1fr 120px; }
}

@media (prefers-reduced-motion: reduce) {
    .chf-vis *, .chf-vis *::before, .chf-vis *::after, .chx-st .i, .chx-dots i { animation: none !important; }
    .chf-reasons span:first-child, .chf-lk:first-child, .chf-lk:first-child em, .chf-g-ok, .chf-lock, .chf-sp-l { opacity: 1; transform: translate(-50%, 0); }
    .chf-lk:first-child, .chf-lk:first-child em, .chf-g-ok, .chf-lock, .chf-sp-l { transform: none; }
    .chf-flow circle { display: none; }
    .chf-cbars > div > i > i { transition: none; }
}
