/* Smart-диалоги — «Входящие». Тот же визуальный язык, что у мини-Telegram в карточке
   аккаунта (список слева, тред справа, пузыри, скелетоны .skeleton/.skel-*), но в
   цветах панели (--color-primary), а не в синем Telegram: это наш инбокс, не чужой клиент. */
#account-panel-chat .sd-toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.sd-search { position: relative; display: flex; align-items: center; flex: 1 1 14rem; min-width: 12rem; }
.sd-search svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--color-text-faint); stroke-width: 1.9; pointer-events: none; }
.sd-search input { width: 100%; height: 38px; border-radius: 11px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); padding: 0 12px 0 36px; font: inherit; font-size: 13px; }
.sd-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.sd-search.is-list { flex: none; margin: 0 10px 8px; }
.sd-select { width: auto; height: 38px; }

/* Чипы аккаунтов — горизонтальная лента, счётчики «ждут» / «у оператора» на каждом. */
.sd-accounts { display: flex; gap: .5rem; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: .75rem; scrollbar-width: thin; }
.sd-acc { display: flex; align-items: center; gap: .55rem; padding: .35rem .7rem .35rem .35rem; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); color: inherit; text-decoration: none; flex: none; max-width: 17rem; transition: background .12s ease, border-color .12s ease; }
.sd-acc:hover { background: var(--color-surface-muted); }
.sd-acc.is-active { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)); }
.sd-acc-ava { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--color-surface-muted); color: var(--color-primary); flex: none; }
.sd-acc-ava.is-all { background: var(--color-primary-bg); }
.sd-acc-ava svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sd-acc-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sd-acc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-acc-sub { font-size: 11.5px; color: var(--color-text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-acc-badges { display: flex; gap: 4px; flex: none; }
.sd-cnt { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.sd-cnt.is-wait { background: var(--color-primary); color: var(--color-on-primary, #fff); }
.sd-cnt.is-op { background: var(--color-warning-bg); color: var(--color-warning-text); }
.sd-acc-empty { font-size: 13px; color: var(--color-text-faint); padding: .5rem; margin: 0; }

/* Оболочка: список + тред. */
.sd-shell { display: grid; grid-template-columns: 320px 1fr; border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; height: calc(100vh - 16rem); min-height: 30rem; background: var(--color-surface); }
.sd-list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--color-border); background: var(--color-surface-muted); }
.sd-list-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.sd-online { width: 9px; height: 9px; border-radius: 50%; background: #31c451; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, #31c451 25%, transparent); }
.sd-list-title { min-width: 0; line-height: 1.25; }
.sd-list-title b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-list-title span { display: block; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-filters { display: flex; gap: 4px; padding: 2px 10px 8px; overflow-x: auto; scrollbar-width: none; }
.sd-filter { flex: none; border: 0; background: transparent; color: var(--color-text-muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.sd-filter:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); color: var(--color-text); }
.sd-filter.is-active { background: var(--color-surface); color: var(--color-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sd-filter i { font-style: normal; font-size: 11px; color: var(--color-text-faint); }
.sd-filter i:empty { display: none; }
.sd-list { flex: 1; overflow-y: auto; padding: 0 8px 10px; }

.sd-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; color: inherit; text-decoration: none; cursor: pointer; }
.sd-row:hover { background: color-mix(in srgb, var(--color-text) 5%, transparent); }
.sd-row.is-active { background: var(--color-primary); }
.sd-row.is-active * { color: var(--color-on-primary, #fff) !important; }
.sd-row.is-active .sd-tag { background: rgba(255,255,255,.2) !important; }
.sd-row.is-active .sd-dot { background: #fff; }
.sd-row.is-operator:not(.is-active) { box-shadow: inset 3px 0 0 var(--color-warning); }
.sd-ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 15px; flex: none; }
.sd-row-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sd-row-top { display: flex; align-items: center; gap: 5px; }
.sd-row-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sd-row-time { font-size: 11px; color: var(--color-text-faint); flex: none; }
.sd-ico { display: inline-flex; color: var(--color-text-faint); flex: none; }
.sd-ico svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sd-row-prev { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-row-prev b { font-weight: 600; color: var(--color-text); }
.sd-row-tags { display: flex; align-items: center; gap: 5px; min-height: 0; }
.sd-row-tags:empty { display: none; }
.sd-tag { font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
.sd-tag.is-acc { background: var(--color-primary-bg); color: var(--color-primary); text-transform: none; letter-spacing: 0; font-weight: 600; }
.sd-tag.is-op { background: var(--color-warning-bg); color: var(--color-warning-text); }
.sd-tag.is-off { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text-muted); }
.sd-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); margin-left: auto; flex: none; }
.sd-row.is-hidden { display: none; }
.sd-empty-list, .sd-empty-thread { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; color: var(--color-text-faint); font-size: 13px; padding: 28px 18px; margin: auto; max-width: 320px; }
.sd-empty-list svg, .sd-empty-thread svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 1.4; opacity: .5; margin-bottom: 6px; }
.sd-empty-thread b { color: var(--color-text); font-weight: 600; font-size: 14px; }

/* Тред. */
/* .sd-shell в селекторах ниже — не украшение: страница Синто-диалога тоже использует
   префикс .sd-* (.sd-composer/.sd-msg/.sd-thread/.sd-toolbar) и её CSS грузится позже;
   без скоупа её flex-direction:column и padding-left ломали тред входящих. */
.sd-shell .sd-thread { display: flex; flex-direction: column; min-height: 0; position: relative; background: var(--color-surface); }
.sd-thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--color-border); min-height: 58px; flex: none; }
.sd-thread-head .sd-ava { width: 38px; height: 38px; font-size: 13px; }
.sd-head-main { min-width: 0; flex: 1; line-height: 1.25; }
.sd-head-main b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-head-main span { display: block; font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-head-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sd-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.sd-state.is-ai { background: var(--color-success-bg); color: var(--color-success-text); }
.sd-state.is-off { background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text-muted); }
.sd-state.is-op { background: var(--color-warning-bg); color: var(--color-warning-text); }
.sd-state .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
/* ИИ отвечает прямо сейчас (печатает/голосовое/фото/стикер/пересылка): «дышащая» плашка + три точки. */
.sd-state.is-busy { background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-primary); animation: sd-busy-glow 1.8s ease-in-out infinite; }
.sd-typing { display: inline-flex; align-items: flex-end; gap: 3px; height: 10px; }
.sd-typing i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: sd-typing-bounce 1.2s ease-in-out infinite; }
.sd-typing i:nth-child(2) { animation-delay: .15s; } .sd-typing i:nth-child(3) { animation-delay: .3s; }
.sd-busy { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 3px 6px; border-radius: 999px; background: color-mix(in srgb, var(--color-primary) 14%, transparent); color: var(--color-primary); vertical-align: middle; }
.sd-busy i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: sd-typing-bounce 1.2s ease-in-out infinite; }
.sd-busy i:nth-child(2) { animation-delay: .15s; } .sd-busy i:nth-child(3) { animation-delay: .3s; }
@keyframes sd-typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes sd-busy-glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 30%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 0%, transparent); } }
.sd-ic { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--color-text-muted); display: grid; place-items: center; cursor: pointer; }
.sd-ic:hover { background: var(--color-surface-muted); color: var(--color-text); }
.sd-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sd-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--color-text-muted); cursor: pointer; padding: 4px 6px; border-radius: 10px; border: 0; background: transparent; font-family: inherit; }
.sd-switch:hover { background: var(--color-surface-muted); }
.sd-switch .knob { width: 36px; height: 20px; border-radius: 999px; background: color-mix(in srgb, var(--color-text) 20%, transparent); position: relative; transition: background .15s ease; flex: none; }
.sd-switch .knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sd-switch.is-on .knob { background: var(--color-success, #31c451); }
.sd-switch.is-on .knob::after { transform: translateX(16px); }
.sd-switch[disabled] { opacity: .6; cursor: default; }

.sd-handoff { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; background: var(--color-warning-bg); border-bottom: 1px solid color-mix(in srgb, var(--color-warning) 35%, transparent); font-size: 12.5px; line-height: 1.45; flex: none; animation: sd-pop .2s ease both; }
.sd-handoff svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--color-warning-text); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.sd-handoff b { color: var(--color-warning-text); }
.sd-handoff .txt { flex: 1; min-width: 0; color: var(--color-text); }
.sd-handoff .txt span { display: block; color: var(--color-text-muted); font-size: 12px; margin-top: 2px; }
.sd-handoff .btn { flex: none; }

.sd-msgs { flex: 1; overflow-y: auto; padding: 14px 18px 8px; display: flex; flex-direction: column; gap: 3px; background: var(--color-bg); overscroll-behavior: contain; }
.sd-day { align-self: center; font-size: 11.5px; color: var(--color-text-muted); background: color-mix(in srgb, var(--color-surface) 90%, var(--color-surface-muted)); border: 1px solid var(--color-border); padding: 3px 12px; border-radius: 999px; margin: 6px 0; position: sticky; top: 0; z-index: 1; backdrop-filter: blur(6px); }
.sd-shell .sd-msg { display: flex; padding-left: 0; animation: sd-pop .18s ease both; }
.sd-msg.out { justify-content: flex-end; }
.sd-msg.cont { margin-top: -1px; }
.sd-bub { position: relative; max-width: min(72%, 560px); padding: 7px 11px 6px; border-radius: 14px; font-size: 14px; line-height: 1.42; word-wrap: break-word; }
/* pre-wrap только на тексте: на всём пузыре он превращал переводы строк разметки в пустые строки. */
.sd-bub .dialogue-bubble-text { white-space: pre-wrap; }
.sd-msg.in .sd-bub { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.sd-msg.out .sd-bub { background: var(--color-primary); color: var(--color-on-primary, #fff); }
.sd-msg.out.is-ai .sd-bub { background: color-mix(in srgb, var(--color-primary) 82%, #7d5bd6); }
.sd-msg.in.tail .sd-bub { border-bottom-left-radius: 5px; }
.sd-msg.out.tail .sd-bub { border-bottom-right-radius: 5px; }
.sd-msg.pending .sd-bub { opacity: .7; }
.sd-msg.failed .sd-bub { background: var(--color-danger); cursor: pointer; }
.sd-tag-who { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .85; margin-bottom: 2px; }
.sd-tag-who svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sd-time { float: right; display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; margin: 6px 0 -2px 10px; color: var(--color-text-faint); white-space: nowrap; }
.sd-msg.out .sd-time { color: color-mix(in srgb, var(--color-on-primary, #fff) 75%, transparent); }
.sd-time svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sd-skel-msgs { display: flex; flex-direction: column; gap: 8px; padding: 8px 4px; margin-top: auto; }
.sd-skel-msgs .skeleton { height: 38px; border-radius: 14px; }
.sd-skel-msgs .skeleton.out { align-self: flex-end; opacity: .75; }
.sd-skel-list { padding: 4px 2px; }
.sd-skel-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; padding: 9px 10px; }
.sd-scrolldown { position: absolute; right: 18px; bottom: 76px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.14); z-index: 2; }
.sd-scrolldown svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sd-scrolldown[hidden] { display: none; }

.sd-shell .sd-composer { display: flex; flex-direction: row; align-items: flex-end; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--color-border); flex: none; }
.sd-shell .sd-composer[hidden] { display: none; }
.sd-composer textarea { flex: 1; resize: none; max-height: 120px; min-height: 42px; border-radius: 14px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); padding: 11px 14px; font: inherit; font-size: 14px; }
.sd-composer textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.sd-send { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; cursor: pointer; background: var(--color-primary); color: var(--color-on-primary, #fff); display: grid; place-items: center; transition: transform .12s ease; }
.sd-send:active { transform: scale(.94); }
.sd-send[disabled] { opacity: .6; cursor: default; }
.sd-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-locked="true"] .sd-composer textarea, [data-locked="true"] .sd-send { pointer-events: none; opacity: .6; }

@keyframes sd-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sd-msg, .sd-handoff { animation: none; } }
@media (max-width: 860px) {
  .sd-shell { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .sd-list-pane { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .sd-list { max-height: 18rem; }
  .sd-thread { height: 32rem; }
  .sd-shell[data-view="thread"] .sd-list-pane { display: none; }
  .sd-shell:not([data-view="thread"]) .sd-thread { display: none; }
  .sd-back { display: grid !important; }
}
.sd-back { display: none; }

/* Цитата «в ответ на …» над текстом сообщения (как в Telegram). */
.sd-reply { display: block; margin-bottom: 4px; padding: 3px 8px; border-left: 2px solid currentColor; border-radius: 4px; font-size: 12.5px; line-height: 1.35; opacity: .85; }
.sd-msg.in .sd-reply { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.sd-msg.out .sd-reply { background: rgba(255,255,255,.16); }
.sd-reply-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.sd-clip { width: 42px; height: 42px; flex: none; border-radius: 12px; border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; display: grid; place-items: center; }
.sd-clip:hover { background: var(--color-surface-muted); color: var(--color-text); }
.sd-clip svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-locked="true"] .sd-clip { pointer-events: none; opacity: .6; }
.sd-photo img { display: block; max-width: 240px; max-height: 260px; border-radius: 10px; margin: 2px 0 4px; }

/* Реакции на сообщениях смарт-диалогов + пикер. */
.sd-bub { position: relative; overflow: visible; }
.sd-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sd-reacts:empty { display: none; }
.sd-react-chip { display: inline-flex; align-items: center; gap: 3px; border: 0; cursor: pointer; font: inherit; font-size: 12px; line-height: 1; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--color-text) 8%, transparent); color: var(--color-text); }
.sd-msg.out .sd-react-chip { background: rgba(255,255,255,.2); color: #fff; }
.sd-react-chip.chosen { box-shadow: inset 0 0 0 1px var(--color-primary); color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 14%, transparent); }
.sd-hover-actions { position: absolute; top: 50%; transform: translateY(-50%); display: flex; gap: 1px; padding: 3px; border-radius: 999px; background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: 0 2px 10px rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 3; }
.sd-msg:hover .sd-hover-actions { opacity: 1; pointer-events: auto; }
.sd-msg.out .sd-bub .sd-hover-actions { right: 100%; margin-right: 6px; }
.sd-msg.in .sd-bub .sd-hover-actions { left: 100%; margin-left: 6px; }
.sd-act-btn { width: 28px; height: 28px; border: 0; background: transparent; color: var(--color-text-muted); border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: background .12s ease, color .12s ease; }
.sd-act-btn:hover { background: var(--color-surface-muted); color: var(--color-primary); }
.sd-act-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sd-replybar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--color-border); background: var(--color-surface-muted); flex: none; }
.sd-replybar[hidden] { display: none; }
.sd-replybar .sd-rb-icon { flex: none; color: var(--color-primary); display: grid; place-items: center; }
.sd-replybar .sd-rb-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; }
.sd-replybar .sd-rb-body { min-width: 0; flex: 1; line-height: 1.25; }
.sd-replybar .sd-rb-body b { display: block; font-size: 12px; color: var(--color-primary); font-weight: 600; }
.sd-replybar .sd-rb-body span { display: block; font-size: 12.5px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-replybar .sd-rb-x { flex: none; width: 30px; height: 30px; border: 0; background: transparent; color: var(--color-text-faint); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.sd-replybar .sd-rb-x:hover { background: var(--color-surface); color: var(--color-text); }
.sd-replybar .sd-rb-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.sd-react-pop { position: absolute; z-index: 6; bottom: 100%; margin-bottom: 4px; display: flex; gap: 2px; padding: 5px 7px; border-radius: 14px; background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: 0 6px 22px rgba(0,0,0,.24); }
.sd-msg.out .sd-react-pop { right: 0; }
.sd-react-pop button { border: 0; background: transparent; cursor: pointer; font-size: 20px; line-height: 1; padding: 3px; border-radius: 8px; }
.sd-react-pop button:hover { background: var(--color-surface-muted); transform: scale(1.15); }

/* Диалог, заблокированный ИИ (собеседник в ЧС) */
.sd-tag.is-blocked { background: color-mix(in srgb, var(--color-danger) 15%, transparent); color: var(--color-danger); }

/* Бейдж: сколько наших сообщений удалили в диалоге (панель не удаляет) */
.sd-tag.is-deleted { background: color-mix(in srgb, var(--color-danger) 12%, transparent); color: var(--color-danger); }

/* Опасная иконка в шапке треда (удалить переписку у обоих) */
.sd-ic.sd-ic-danger:hover { color: var(--color-danger); background: color-mix(in srgb, var(--color-danger) 10%, transparent); }

/* ── Панель настройки голосовых (ГС) — раскрытие с анимацией ── */
.nd-voice-panel { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .34s cubic-bezier(.22,.61,.36,1), opacity .26s ease; }
.nd-voice-panel.is-open { max-height: 1500px; opacity: 1; }
.nd-voice-inner { display: flex; flex-direction: column; gap: 14px; padding: 14px 2px 4px; }
.nd-voice-row { display: flex; flex-direction: column; gap: 8px; }
.nd-voice-cap { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--color-text); }
.nd-voice-pct { font-size: 14px; color: var(--color-primary); font-weight: 700; }
.nd-voice-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--color-surface-muted); outline: none; }
.nd-voice-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--color-primary); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .12s ease; }
.nd-voice-range::-webkit-slider-thumb:hover { transform: scale(1.15); }
.nd-voice-range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--color-primary); cursor: pointer; }
.nd-voice-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nd-voice-glabel { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-faint); width: 100%; margin-top: 4px; }
.nd-voice-chip { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .14s ease; }
.nd-voice-chip:hover { border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border)); color: var(--color-text); transform: translateY(-1px); }
.nd-voice-chip.is-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.nd-voice-test { flex-direction: row; align-items: center; gap: 8px; }
.nd-voice-text { flex: 1; }
.nd-voice-play { position: relative; flex: none; display: inline-flex; align-items: center; gap: 7px; }
.nd-voice-play .btn-spinner { display: none; }
.nd-voice-play.is-loading .ic-play { display: none; }
.nd-voice-play.is-loading .btn-spinner { display: inline-block; }
.nd-voice-play .ic-play { width: 15px; height: 15px; fill: currentColor; }
.nd-voice-panel.is-playing .nd-voice-play { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 55%, transparent); animation: nd-voice-pulse 1.1s ease-out infinite; }
@keyframes nd-voice-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
@media (prefers-reduced-motion: reduce) { .nd-voice-panel, .nd-voice-chip, .nd-voice-play { transition: none; animation: none; } }

/* ── Голос: доработка (видимая шкала, метки, состояния кнопки) ── */
.nd-voice-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--color-primary) 0 var(--fill,35%), var(--color-surface-muted) var(--fill,35%) 100%); }
.nd-voice-range::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: transparent; }
.nd-voice-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--color-primary); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .12s ease; }
.nd-voice-range::-webkit-slider-thumb:hover { transform: scale(1.18); }
.nd-voice-range::-moz-range-track { height: 8px; border-radius: 999px; background: var(--color-surface-muted); }
.nd-voice-range::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--color-primary); }
.nd-voice-range::-moz-range-thumb { width: 16px; height: 16px; border: 3px solid var(--color-primary); border-radius: 50%; background: #fff; cursor: pointer; }
.nd-voice-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--color-text-faint); margin-top: 5px; padding: 0 2px; }
/* кнопка «Прослушать»: три состояния — покой (play), загрузка (spinner), проигрывание (wave) */
.nd-voice-play .ic-wave { display: none; }
.nd-voice-play .ic-wave rect { fill: currentColor; transform-origin: center bottom; }
.nd-voice-panel.is-playing .nd-voice-play .ic-play { display: none; }
.nd-voice-panel.is-playing .nd-voice-play .ic-wave { display: inline-block; }
.nd-voice-panel.is-playing .nd-voice-play .ic-wave rect { animation: nd-wave 0.9s ease-in-out infinite; }
.nd-voice-panel.is-playing .nd-voice-play .ic-wave rect:nth-child(2) { animation-delay: .15s; }
.nd-voice-panel.is-playing .nd-voice-play .ic-wave rect:nth-child(3) { animation-delay: .3s; }
.nd-voice-panel.is-playing .nd-voice-play .ic-wave rect:nth-child(4) { animation-delay: .45s; }
@keyframes nd-wave { 0%,100% { transform: scaleY(.5); } 50% { transform: scaleY(1.15); } }
.nd-voice-play.is-loading { opacity: .85; cursor: progress; }
.nd-voice-play.is-loading .ic-play, .nd-voice-play.is-loading .ic-wave { display: none; }
@media (prefers-reduced-motion: reduce) { .nd-voice-play .ic-wave rect { animation: none !important; } }

/* ── Редактор голоса (ГС): волна-сигнатура + фейдеры ── */
.nd-voice-inner { padding: 16px 2px 6px; gap: 18px; }
.nd-voice-block { display: flex; flex-direction: column; gap: 9px; }
.nd-wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 48px; padding: 6px 10px; border-radius: 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 8%, transparent), transparent); }
.nd-wave span { width: 3px; height: 20%; border-radius: 3px; background: linear-gradient(180deg, var(--color-primary), color-mix(in srgb, var(--cyan, #2ca6a4) 80%, var(--color-primary)));
  opacity: .45; transform-origin: center; transition: height .2s ease, opacity .2s ease; }
.nd-voice-panel.is-playing .nd-wave span { animation: nd-wv 0.85s ease-in-out infinite; animation-delay: calc(var(--i) * 40ms); opacity: 1; }
@keyframes nd-wv { 0%,100% { height: 16%; } 45% { height: 92%; } 70% { height: 40%; } }
.nd-voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.nd-fader { display: flex; flex-direction: column; gap: 8px; }
.nd-fader-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 12.5px; color: var(--color-text-muted); }
.nd-fader-head span { font-weight: 600; }
.nd-fader-head b { font-size: 13px; color: var(--color-primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.nd-fader-wide { }
@media (max-width: 640px) { .nd-voice-grid { grid-template-columns: 1fr; } }


/* ===== Микшер голоса (вертикальные фейдеры, «как на пульте») ===== */
.nd-mixer { border: 1px solid var(--color-border); border-radius: 16px; padding: 16px 12px 12px;
  background:
    radial-gradient(130% 90% at 50% -20%, color-mix(in srgb, var(--color-primary) 12%, transparent), transparent 62%),
    linear-gradient(180deg, color-mix(in srgb, #000 16%, var(--color-surface)), var(--color-surface));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 7%, transparent), inset 0 -22px 34px rgba(0,0,0,.28); }
.nd-mixer-strips { display: flex; gap: 4px; align-items: stretch; justify-content: space-between; overflow-x: auto; padding: 2px; }
.mx-strip { flex: 1 1 0; min-width: 60px; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.mx-val { font-size: 13px; font-weight: 700; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.mx-val i { font-style: normal; font-size: 11px; opacity: .7; margin-left: 1px; }
.mx-track { position: relative; width: 46px; height: 164px; }
.mx-slot { position: absolute; top: 11px; bottom: 11px; left: 0; right: 0; }
.mx-rail { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 6px; border-radius: 999px;
  background: var(--color-surface-muted); box-shadow: inset 0 1px 3px rgba(0,0,0,.55), inset 0 -1px 0 color-mix(in srgb,#fff 5%,transparent); }
.mx-fill { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 6px; border-radius: 999px; height: var(--fill, 0%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-primary) 55%, var(--cyan, #2ca6a4)), var(--color-primary));
  box-shadow: 0 0 7px color-mix(in srgb, var(--color-primary) 45%, transparent); transition: height .05s linear; }
.mx-detent { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 16px; height: 2px; border-radius: 2px;
  background: color-mix(in srgb, var(--color-text-faint) 65%, transparent); }
.mx-cap { position: absolute; left: 50%; bottom: var(--fill, 0%); transform: translate(-50%, 50%); width: 34px; height: 18px; border-radius: 5px;
  background: linear-gradient(180deg, #fcfcff, #d5d5e4); border: 1px solid color-mix(in srgb, var(--color-primary) 55%, #000);
  box-shadow: 0 3px 6px rgba(0,0,0,.5), inset 0 1px 0 #fff; pointer-events: none; transition: transform .12s ease, box-shadow .12s ease; }
.mx-cap::before { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; transform: translateY(-50%); height: 0;
  border-top: 1px solid rgba(0,0,0,.32); box-shadow: 0 3px 0 rgba(0,0,0,.15), 0 -3px 0 rgba(0,0,0,.15); }
.mx-track:hover .mx-cap { transform: translate(-50%, 50%) scale(1.07); box-shadow: 0 4px 9px rgba(0,0,0,.55), inset 0 1px 0 #fff; }
.mx-track:active .mx-cap { transform: translate(-50%, 50%) scale(1.03); }
.mx-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; writing-mode: vertical-lr; direction: rtl; background: transparent; }
.mx-range:focus-visible { opacity: .001; }
.mx-range:focus-visible ~ .mx-cap { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 55%, transparent), 0 3px 6px rgba(0,0,0,.5); }
.mx-name { font-size: 10.5px; text-align: center; color: var(--color-text-muted); font-weight: 600; line-height: 1.15;
  min-height: 2.3em; display: flex; align-items: center; letter-spacing: .01em; }
.nd-voice-panel.is-playing .mx-fill { animation: mx-glow 1s ease-in-out infinite; }
@keyframes mx-glow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.4); } }
@media (max-width: 560px) { .mx-strip { min-width: 58px; } .mx-track { height: 148px; } }
@media (prefers-reduced-motion: reduce) { .mx-fill, .mx-cap { transition: none; animation: none !important; } }

/* Манера озвучки (стиль подачи → instructions TTS, не зачитывается) */
.nd-voice-style { display: flex; flex-direction: column; gap: 6px; }
.nd-voice-style-in { width: 100%; resize: vertical; min-height: 40px; line-height: 1.4; }
.nd-voice-style-hint { margin: 0; font-size: 11.5px; color: var(--color-text-faint); line-height: 1.35; }

/* Тумблер живых вставок (невербалка в []) */
.nd-voice-cues { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 2px 0; }
.nd-voice-cues input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--color-primary); flex: none; cursor: pointer; }
.nd-voice-cues-txt { display: flex; flex-direction: column; gap: 2px; }
.nd-voice-cues-txt b { font-size: 13px; font-weight: 600; color: var(--color-text); }
.nd-voice-cues-txt i { font-style: normal; font-size: 11.5px; color: var(--color-text-faint); line-height: 1.35; }


/* =================== Редизайн редактора ГС =================== */
.nd-voice-inner { gap: 22px; }
.nd-sec { display: flex; flex-direction: column; gap: 12px; }
.nd-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--color-text-faint); }

/* Каст голоса — карточки с иконками */
.nd-voice-picker { display: flex; flex-direction: column; gap: 14px; }
.nd-vc-group { display: flex; flex-direction: column; gap: 9px; }
.nd-vc-glabel { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-faint); }
.nd-vc-gic { width: 15px; height: 15px; display: inline-grid; place-items: center; color: var(--color-text-muted); }
.nd-vc-gic svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nd-vc-row { display: flex; flex-wrap: wrap; gap: 9px; }
.nd-voice-chip { display: inline-flex; align-items: center; gap: 9px; padding: 6px 14px 6px 6px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .12s ease, border-color .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease; }
.nd-vc-ic { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: hsl(var(--vh, 265) 42% 24%); color: hsl(var(--vh, 265) 82% 80%);
  box-shadow: inset 0 0 0 1px hsl(var(--vh, 265) 55% 45% / .55); transition: background .14s ease, color .14s ease; }
.nd-vc-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nd-vc-ic svg.ic-fill { fill: currentColor; stroke: none; }
.nd-voice-chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border)); color: var(--color-text); }
.nd-voice-chip.is-on { background: color-mix(in srgb, var(--color-primary) 16%, var(--color-surface)); border-color: var(--color-primary); color: #fff;
  box-shadow: 0 0 0 1px var(--color-primary), 0 6px 16px color-mix(in srgb, var(--color-primary) 28%, transparent); }
.nd-voice-chip.is-on .nd-vc-ic { background: var(--color-primary); color: #fff; box-shadow: none; }
.nd-vc-auto .nd-vc-ic { background: color-mix(in srgb, var(--color-primary) 28%, var(--color-surface-muted)); color: var(--color-primary); box-shadow: none; }

/* Иконки над фейдерами микшера */
.nd-mixer { padding-top: 12px; }
.nd-mixer .nd-wave { margin: 0 6px 12px; }
.mx-strip { gap: 8px; }
.mx-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  color: var(--color-text-muted); background: color-mix(in srgb, #fff 4%, transparent); border: 1px solid var(--color-border); }
.mx-ic svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mx-ic svg.ic-fill { fill: currentColor; stroke: none; }
.mx-strip.mx-strip--center .mx-ic, .mx-strip .mx-track:hover ~ .mx-name { }

/* Частота голосового — отдельная карточка, горизонтальный фейдер */
.nd-freq { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, color-mix(in srgb, #fff 3%, var(--color-surface)), var(--color-surface)); }
.nd-freq-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--color-primary) 20%, var(--color-surface-muted)); color: var(--color-primary); }
.nd-freq-ic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nd-freq-body { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.nd-freq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.nd-freq-head b { font-size: 14px; font-weight: 600; color: var(--color-text); }
.nd-freq-val { font-size: 16px; font-weight: 800; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.nd-freq-hint { font-size: 12px; color: var(--color-text-faint); line-height: 1.35; }
.nd-freq-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--color-primary) 0 var(--fill, 35%), var(--color-surface-muted) var(--fill, 35%) 100%); }
.nd-freq-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 4px solid var(--color-primary); cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.4); transition: transform .12s ease; }
.nd-freq-range::-webkit-slider-thumb:hover { transform: scale(1.14); }
.nd-freq-range::-moz-range-thumb { width: 15px; height: 15px; border: 4px solid var(--color-primary); border-radius: 50%; background: #fff; cursor: pointer; }
.nd-freq-range::-moz-range-track { height: 8px; border-radius: 999px; background: var(--color-surface-muted); }
.nd-freq-range::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--color-primary); }
@media (max-width: 560px) { .nd-freq { flex-direction: row; } .nd-vc-row { gap: 7px; } }

/* =============== Компактная 2-колоночная раскладка редактора ГС =============== */
.nd-voice-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 18px 24px; align-items: start; }
.nd-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 900px) { .nd-voice-grid { grid-template-columns: 1fr; gap: 16px; } }
.nd-voice-inner { gap: 0; }

/* Компактнее: секции, каст, микшер */
.nd-sec { gap: 10px; }
.nd-voice-picker { gap: 10px; }
.nd-vc-row { gap: 7px; }
.nd-voice-chip { gap: 7px; padding: 4px 11px 4px 4px; font-size: 12.5px; }
.nd-vc-ic { width: 24px; height: 24px; }
.nd-vc-ic svg { width: 14px; height: 14px; }
.nd-mixer { padding: 12px 10px 10px; }
.nd-mixer .nd-wave { height: 40px; margin: 0 4px 10px; }
.nd-mixer-strips { gap: 2px; }
.mx-strip { min-width: 52px; gap: 6px; }
.mx-track { height: 122px; }
.mx-ic { width: 27px; height: 27px; border-radius: 8px; }
.mx-ic svg { width: 16px; height: 16px; }
.mx-name { font-size: 10px; min-height: 2.1em; }
.mx-val { font-size: 12px; }

/* Частота, манера — плотнее */
.nd-freq { padding: 12px 14px; gap: 12px; }
.nd-freq-ic { width: 36px; height: 36px; }
.nd-voice-style-in { min-height: 64px; }
.nd-voice-test { margin-top: 2px; }

/* Селектор модели озвучки */
.nd-eyebrow-sub { margin-top: 4px; }
.nd-model-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.nd-model-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 14px; border-radius: 12px;
  border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer;
  transition: transform .12s ease, border-color .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease; text-align: left; }
.nd-model-chip:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border)); color: var(--color-text); }
.nd-model-chip.is-on { background: color-mix(in srgb, var(--color-primary) 16%, var(--color-surface)); border-color: var(--color-primary); color: #fff;
  box-shadow: 0 0 0 1px var(--color-primary), 0 6px 16px color-mix(in srgb, var(--color-primary) 26%, transparent); }
.nd-model-name { font-size: 13px; font-weight: 700; }
.nd-model-note { font-size: 10.5px; font-weight: 500; color: var(--color-text-faint); }
.nd-model-chip.is-on .nd-model-note { color: color-mix(in srgb, #fff 75%, transparent); }

/* ===== Плеер голосовых в треде (как в Telegram) ===== */
.sd-voice { --played: 0%; display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 2px 0; }
.sd-voice-btn { position: relative; width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--color-primary); color: var(--color-on-primary, #fff); display: grid; place-items: center; transition: transform .12s ease; }
.sd-msg.out .sd-voice-btn { background: #fff; color: var(--color-primary); }
.sd-voice-btn:active { transform: scale(.94); }
.sd-voice-btn svg { width: 18px; height: 18px; fill: currentColor; }
.sd-voice-btn .ic-pause { display: none; }
.sd-voice.is-playing .sd-voice-btn .ic-play { display: none; }
.sd-voice.is-playing .sd-voice-btn .ic-pause { display: block; }
.sd-voice-btn .sd-voice-sp { display: none; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; animation: sd-spin .7s linear infinite; }
.sd-voice.is-loading .sd-voice-btn svg { display: none; }
.sd-voice.is-loading .sd-voice-btn .sd-voice-sp { display: block; }
@keyframes sd-spin { to { transform: rotate(360deg); } }
.sd-voice-track { position: relative; flex: 1; height: 26px; min-width: 90px; }
.sd-voice-bars { position: absolute; inset: 0; display: flex; align-items: center; gap: 2px; }
.sd-voice-bars i { flex: 1; border-radius: 2px; background: currentColor; opacity: .32; min-height: 3px; }
.sd-msg .sd-voice-bars { color: var(--color-text-muted); }
.sd-msg.out .sd-voice-bars { color: #fff; }
.sd-msg.out .sd-voice-bars i { opacity: .5; }
.sd-voice-bars-fill { opacity: 1; color: var(--color-primary); clip-path: inset(0 calc(100% - var(--played)) 0 0); transition: clip-path .12s linear; }
.sd-msg.out .sd-voice-bars-fill { color: #fff; }
.sd-voice-bars-fill i { opacity: 1; }
.sd-voice.is-playing .sd-voice-bars i { animation: sd-vbar 1s ease-in-out infinite; }
.sd-voice.is-playing .sd-voice-bars i:nth-child(3n) { animation-delay: .15s; }
.sd-voice.is-playing .sd-voice-bars i:nth-child(3n+1) { animation-delay: .3s; }
@keyframes sd-vbar { 0%,100% { transform: scaleY(.85); } 50% { transform: scaleY(1.12); } }
.sd-voice-time { flex: none; font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--color-text-muted); min-width: 30px; text-align: right; }
.sd-msg.out .sd-voice-time { color: color-mix(in srgb, #fff 80%, transparent); }
@media (prefers-reduced-motion: reduce) { .sd-voice.is-playing .sd-voice-bars i { animation: none; } }

/* Подсказка «нет ключа» для ГС/расшифровки */
.nd-key-note { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; margin-bottom: 4px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)); }
.nd-key-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--color-primary) 22%, transparent); color: var(--color-primary); }
.nd-key-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nd-key-body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.nd-key-body b { font-size: 13.5px; font-weight: 700; color: var(--color-text); }
.nd-key-body span { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.4; }
.nd-key-cta { align-self: flex-start; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: #fff;
  background: var(--color-primary); padding: 6px 13px; border-radius: 8px; text-decoration: none; transition: filter .12s ease; }
.nd-key-cta:hover { filter: brightness(1.08); }

/* Стикеры в треде смарт-диалогов */
.sd-sticker{ display:block; max-width:130px; max-height:130px; width:auto; height:auto; border-radius:8px; }

/* ===== Фотоальбом бота ===== */
.nd-album-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.nd-album-hint { font-size: 12px; color: var(--color-text-faint); }
[data-nd-album-count] { color: var(--color-primary); }
.nd-album-modal { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 20px; }
.nd-album-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); }
.nd-album-dialog { position: relative; width: min(760px, 100%); max-height: 88vh; overflow: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 16px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.nd-album-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.nd-album-head b { font-size: 16px; }
.nd-album-x { border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.nd-album-x:hover { background: var(--color-surface-muted); color: var(--color-text); }
.nd-album-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.nd-album-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 2px dashed var(--color-border); border-radius: 14px; cursor: pointer; text-align: center; transition: border-color .14s ease, background .14s ease; }
.nd-album-drop:hover, .nd-album-drop.is-over { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 8%, transparent); }
.nd-album-drop.is-busy { opacity: .6; pointer-events: none; }
.nd-album-drop svg { width: 26px; height: 26px; fill: none; stroke: var(--color-primary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nd-album-drop b { font-size: 13.5px; color: var(--color-text); }
.nd-album-drop span { font-size: 12px; color: var(--color-text-faint); }
.nd-album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-top: 14px; }
.nd-ph-empty { grid-column: 1/-1; text-align: center; color: var(--color-text-faint); padding: 24px; font-size: 13px; }
.nd-ph-card { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--color-border); border-radius: 12px; padding: 8px; background: var(--color-surface-muted); }
.nd-ph-img { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #000; }
.nd-ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nd-ph-desc { width: 100%; resize: vertical; min-height: 44px; font-size: 12.5px; }
.nd-ph-foot { display: flex; gap: 6px; align-items: center; }
.nd-ph-scope { flex: 1; min-width: 0; background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.nd-ph-del { flex: none; width: 34px; height: 34px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.nd-ph-del:hover { color: #e5484d; border-color: color-mix(in srgb, #e5484d 50%, var(--color-border)); }
.nd-ph-del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Фото, отправленное ботом, в треде */
.sd-photo-msg { display: block; max-width: 220px; max-height: 260px; width: auto; height: auto; border-radius: 10px; }

/* Удалённое у собеседника сообщение (deleted_at от вотчера Telegram): приглушённый пузырь + корзинка у времени. */
.sd-msg.is-deleted .sd-bub { opacity: .62; }
.sd-msg.is-deleted .dialogue-bubble-text { text-decoration: line-through; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.sd-del { display: inline-flex; align-items: center; margin-right: 4px; color: var(--color-danger); vertical-align: middle; }
.sd-del svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Чип аккаунта: «непрочитано» и «передано оператору» — разные вещи, и выглядеть должны
   по-разному. Раньше обе были одинаковыми кружками с цифрой, и «1» оператора читалась
   как непрочитанное, которое почему-то возвращается после перезагрузки. */
.sd-cnt.is-op {
  gap: 3px; padding: 0 7px 0 5px; display: inline-flex; align-items: center;
  background: color-mix(in srgb, var(--color-warning-text) 16%, transparent);
  color: var(--color-warning-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-warning-text) 32%, transparent);
}
.sd-cnt.is-op svg { width: 11px; height: 11px; fill: none; }
.sd-cnt.is-op[hidden] { display: none; }

/* Расшифровка голосового: плеер + подпись, а не эмодзи микрофона в строке текста. */
.sd-vtr { display: flex; flex-direction: column; gap: 0.35rem; }
.sd-vtr-body {
  display: flex; flex-direction: column; gap: 0.15rem;
  border-left: 2px solid color-mix(in srgb, var(--color-primary) 55%, transparent);
  padding: 0.1rem 0 0.1rem 0.5rem;
}
.sd-vtr-head {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.sd-vtr-head svg { width: 12px; height: 12px; }
.sd-vtr-text { margin: 0; font-size: 0.9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.sd-row-mic { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; color: var(--color-text-faint); }
