/* Стенд симуляции звонков. */

body { overflow: hidden; }

.st__topbar {
  height: 58px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
}
.st__brand { display: flex; align-items: center; gap: 11px; }
.st__brand-title { font-size: 14px; font-weight: 620; }
.st__brand-sub { font-size: 11.5px; color: var(--text-3); }
.st__picker { display: flex; align-items: center; gap: 9px; }

.st__status { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.st__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.st__status.is-live .st__dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: pulse 2s infinite; }
.st__status.is-live { color: #86efac; }
.st__status.is-busy .st__dot { background: var(--warn); animation: blink .9s infinite; }
.st__status.is-err .st__dot { background: var(--err); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
@keyframes blink { 50% { opacity: .3; } }

.st__grid {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 336px;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 58px);
  overflow: hidden;
}
@media (max-width: 1240px) { .st__grid { grid-template-columns: 232px minmax(0, 1fr) 300px; } }
@media (max-width: 1040px) { .st__grid { grid-template-columns: 1fr; overflow-y: auto; height: auto; } }

.st__panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.st__panel-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; font-weight: 620;
}
.st__panel-head-inline { font-size: 12px; font-weight: 620; color: var(--text-2); }
.st__panel-foot { flex: 0 0 auto; padding: 10px 14px; border-top: 1px solid var(--line); line-height: 1.5; }

/* карта этапов */
.st__map { flex: 1; overflow-y: auto; padding: 10px; }
.st__node {
  position: relative;
  border: 1px solid var(--line);
  border-left: 3px solid var(--node-color, var(--accent));
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 7px;
  cursor: pointer;
  background: var(--bg-2);
  transition: border-color .12s, background .12s;
}
.st__node:hover { background: var(--bg-3); }
.st__node.is-current { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.st__node.is-done { opacity: .45; }
.st__node-title { font-size: 12.5px; font-weight: 600; }
.st__node-meta { font-size: 10.5px; color: var(--text-3); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.st__node-hint { font-size: 11px; color: var(--text-3); margin-top: 5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* разговор */
.st__transcript { flex: 1; overflow-y: auto; padding: 14px 16px; min-height: 0; }
.st__placeholder { display: grid; place-items: center; gap: 7px; height: 100%; color: var(--text-3); text-align: center; }
.st__placeholder-icon { font-size: 38px; opacity: .45; }

.msg { display: flex; gap: 11px; padding: 10px 0; animation: msg-in .18s ease-out; }
@keyframes msg-in { from { opacity: 0; transform: translateY(5px); } }
.msg__avatar {
  flex: 0 0 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; font-size: 14px;
  background: var(--bg-3);
}
.msg__body { flex: 1; min-width: 0; }
.msg__who { font-size: 11px; color: var(--text-3); margin-bottom: 3px; display: flex; align-items: center; gap: 7px; }
.msg__text { line-height: 1.55; }
.msg--client .msg__avatar { background: rgba(245, 158, 11, .14); }
.msg--client .msg__text { color: #fcd34d; }
.msg--manager .msg__avatar { background: var(--accent-soft); }
.msg--system .msg__avatar { background: rgba(100, 116, 139, .16); }
.msg--system .msg__text { color: var(--text-3); font-size: 12.5px; font-style: italic; }
.msg__tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.msg__cursor {
  display: inline-block; width: 7px; height: 14px;
  background: var(--accent-2); vertical-align: text-bottom;
  animation: caret .9s step-end infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.st__partial {
  flex: 0 0 auto; display: flex; gap: 9px; align-items: baseline;
  padding: 8px 16px; border-top: 1px dashed var(--line-2);
  background: rgba(245, 158, 11, .05);
}
.st__partial-label { font-size: 11px; color: var(--warn); font-weight: 600; flex: 0 0 auto; }
.st__partial-text { font-size: 13px; color: #fcd34d; }

.st__composer { flex: 0 0 auto; padding: 11px 16px; border-top: 1px solid var(--line); }
.st__quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.st__quick-chip {
  font-size: 11.5px; padding: 4px 10px; border-radius: 20px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text-2); cursor: pointer;
}
.st__quick-chip:hover { border-color: var(--accent); color: var(--accent-2); }

.st__controls { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.st__call {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 20px; border-radius: 30px;
  border: none; font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; color: #fff;
  transition: transform .1s, filter .12s;
}
.st__call:active { transform: scale(.97); }
.st__call--start { background: linear-gradient(135deg, #22c55e, #16a34a); }
.st__call--stop { background: linear-gradient(135deg, #ef4444, #dc2626); }
.st__call:disabled { opacity: .5; cursor: not-allowed; }
.st__call-icon { font-size: 15px; }

.st__timer { font-size: 12.5px; color: var(--text-3); }
.st__meter { flex: 0 0 90px; height: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.st__meter-fill { height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #f59e0b, #ef4444); transition: width .07s linear; }

/* разбор */
.st__score { flex: 0 0 auto; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.st__events { flex: 1 1 auto; min-height: 60px; overflow-y: auto; padding: 12px 15px; }

.ev {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ev-color, var(--accent));
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-2);
  animation: msg-in .2s ease-out;
}
.ev__head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ev__title { font-weight: 620; font-size: 12.5px; }
.ev__conf { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: auto; }
.ev__evidence { font-size: 11.5px; color: var(--text-2); margin-top: 6px; line-height: 1.5; font-style: italic; }
.ev__action {
  font-size: 11.5px; margin-top: 7px; padding: 7px 9px;
  background: var(--bg); border-radius: 6px; color: #a5b4fc;
  border: 1px solid var(--line); line-height: 1.5;
}
.ev__action b { color: var(--accent-2); font-weight: 600; }

/* Запись в CRM и статистика не должны наезжать друг на друга: панель событий
   отдаёт лишнюю высоту первой, а нижние блоки прижимаются к низу колонки. */
.st__crm {
  flex: 0 0 auto; border-top: 1px solid var(--line);
  padding: 12px 15px; background: var(--bg-1);
  max-height: 46%; display: flex; flex-direction: column;
}
.st__crm .crm-json { flex: 1 1 auto; max-height: none; min-height: 0; margin-top: 8px; font-size: 11px; }

.st__stats {
  flex: 0 0 auto; border-top: 1px solid var(--line);
  padding: 9px 15px; background: var(--bg-1);
  display: flex; gap: 14px; flex-wrap: wrap;
}
.st__stats:empty { display: none; }
.st__stat { font-size: 11px; color: var(--text-3); }
.st__stat b { color: var(--text-2); font-family: var(--mono); }

.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2);
  animation: bounce 1.2s infinite;
}
.thinking span:nth-child(2) { animation-delay: .18s; }
.thinking span:nth-child(3) { animation-delay: .36s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
/* ── озвучка реплик ─────────────────────────────────────────────────────── */

.msg__play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 2px 9px 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.msg__play:hover { color: var(--text); border-color: var(--accent); }
.msg__play.is-active { border-color: var(--accent); }
.msg__play.is-playing { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.msg__play-icon { font-size: 9px; }

.st__autoplay { flex: 0 0 auto; }
.st__autoplay.is-off .switch__track { opacity: .5; }
.st__hint {
  max-width: 320px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
