/* ═══════════════════ Чат-виджет (Jivo-стиль) ═══════════════════ */

.jv-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  /* Жёсткий оранжевый: на /pay и др. страницах бывает --mango2 без --mango-2 */
  background: linear-gradient(
    135deg,
    var(--mango, #ffb33e) 0%,
    var(--mango-2, var(--mango2, #ff7a18)) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,122,24,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.jv-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(255,122,24,0.55);
}
.jv-fab--active { background: #2B2B2B; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
.jv-fab--pulse { animation: jvPulse 2s ease-in-out infinite; }
@keyframes jvPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(255,122,24,0.4); }
  50% { box-shadow: 0 4px 20px rgba(255,122,24,0.4), 0 0 0 10px rgba(255,179,62,0.15); }
}

.jv-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FF3B30;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

.jv-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 9998;
  width: 370px;
  max-height: 520px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  display: none;
  flex-direction: column;
}
.jv-window--open {
  display: flex;
  animation: jvSlideUp 0.25s ease forwards;
}
@keyframes jvSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.jv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #FF9500, #E8720C);
}

.jv-header-ava { position: relative; flex-shrink: 0; }

/* Живой видеоподобный аватар: idle / greet / typing / wait */
.jv-live-ava {
  position: relative;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
  background: transparent;
  transform-origin: center bottom;
}
.jv-live-ava--sm { width: 40px; height: 40px; }
.jv-live-ava--lg {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}
.jv-live-ava__face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: #2a1a0a;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25);
  z-index: 1;
}
.jv-live-ava--lg .jv-live-ava__face {
  box-shadow: 0 8px 28px rgba(0,0,0,0.35), 0 0 0 3px rgba(255,149,0,0.35);
}
.jv-live-ava img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* idle всегда снизу — иначе при смене кадров мигает фон */
.jv-live-ava__idle {
  opacity: 1;
  z-index: 1;
}
.jv-live-ava__talk {
  opacity: 0;
  z-index: 2;
  will-change: opacity;
}
/* плавный «рот» CSS-анимацией — idle не гасим, фон не мигает */
.jv-live-ava[data-state="typing"] .jv-live-ava__talk,
.jv-live-ava--speaking .jv-live-ava__talk {
  animation: jvAvaMouth 0.52s ease-in-out infinite;
}
/* зелёное «онлайн-дыхание» вокруг при печати */
.jv-live-ava__glow {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  background: radial-gradient(circle, rgba(77,202,86,0.28) 0%, rgba(77,202,86,0.08) 55%, transparent 72%);
  box-shadow: 0 0 0 0 rgba(77,202,86,0);
}
.jv-live-ava--lg .jv-live-ava__glow { inset: -8px; }
.jv-live-ava[data-state="typing"] .jv-live-ava__glow,
.jv-live-ava--online .jv-live-ava__glow,
.jv-live-ava--speaking .jv-live-ava__glow {
  animation: jvAvaOnlineGlow 1.6s ease-in-out infinite;
}
.jv-live-ava__ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
  z-index: 3;
}
.jv-live-ava[data-state="idle"] {
  animation: jvAvaBreath 3.6s ease-in-out infinite;
}
.jv-live-ava[data-state="greet"] {
  animation: jvAvaGreet 0.85s ease both;
}
.jv-live-ava[data-state="greet"] .jv-live-ava__ring {
  border-color: rgba(255,255,255,0.55);
  animation: jvAvaRing 0.85s ease-out both;
}
.jv-live-ava[data-state="typing"] {
  animation: jvAvaTalk 1.1s ease-in-out infinite;
}
.jv-live-ava[data-state="typing"] .jv-live-ava__ring {
  border-color: rgba(77,202,86,0.55);
  animation: jvAvaGreenRing 1.7s ease-out infinite;
}
.jv-live-ava[data-state="wait"] {
  animation: jvAvaWait 2.8s ease-in-out infinite;
}
@keyframes jvAvaMouth {
  0%, 100% { opacity: 0; }
  35%, 55% { opacity: 1; }
}
@keyframes jvAvaBreath {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.015) translateY(-0.5px); }
}
@keyframes jvAvaGreet {
  0% { transform: scale(0.94) rotate(-3deg); }
  45% { transform: scale(1.04) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes jvAvaTalk {
  0%, 100% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.02) translateY(-0.5px); }
}
@keyframes jvAvaWait {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}
@keyframes jvAvaRing {
  0% { transform: scale(0.96); opacity: 0.7; }
  100% { transform: scale(1.18); opacity: 0; }
}
@keyframes jvAvaGreenRing {
  0% { transform: scale(0.98); opacity: 0.75; }
  100% { transform: scale(1.22); opacity: 0; }
}
@keyframes jvAvaOnlineGlow {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.96);
    box-shadow: 0 0 8px 2px rgba(77,202,86,0.35);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
    box-shadow: 0 0 16px 5px rgba(77,202,86,0.45);
  }
}
@media (prefers-reduced-motion: reduce) {
  .jv-live-ava,
  .jv-live-ava[data-state],
  .jv-live-ava__ring,
  .jv-live-ava__glow,
  .jv-live-ava__talk,
  .jv-ava-dot { animation: none !important; }
}

.jv-ava-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4DCA56;
  border: 2.5px solid #E8720C;
  z-index: 4;
  box-shadow: 0 0 0 0 rgba(77,202,86,0.5);
}
.jv-header-ava:has([data-state="typing"]) .jv-ava-dot,
.jv-header-ava:has(.jv-live-ava--online) .jv-ava-dot,
.jv-header-ava:has(.jv-live-ava--speaking) .jv-ava-dot {
  animation: jvAvaDotPulse 1.5s ease-in-out infinite;
}
@keyframes jvAvaDotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77,202,86,0.55); transform: scale(1); }
  50% { box-shadow: 0 0 0 5px rgba(77,202,86,0); transform: scale(1.08); }
}

.jv-header-info { flex: 1; min-width: 0; }
.jv-header-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.jv-header-status {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 1px;
}

.jv-header-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.jv-header-close:hover { background: rgba(255,255,255,0.25); }

.jv-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 12px;
  background: #1A1A2E;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,179,62,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,179,62,0.02) 0%, transparent 50%);
}

.jv-welcome {
  text-align: center;
  margin-bottom: 18px;
}
.jv-welcome-text {
  font-size: 14px;
  color: rgba(244,244,246,0.6);
  margin: 0;
}

.jv-msg { display: flex; margin-bottom: 6px; }
.jv-msg--in { justify-content: flex-start; }
.jv-msg--out { justify-content: flex-end; }

.jv-msg-bubble {
  max-width: 85%;
  padding: 10px 14px 6px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.jv-msg--in .jv-msg-bubble {
  background: rgba(255,255,255,0.08);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}
.jv-msg--out .jv-msg-bubble {
  background: linear-gradient(135deg, rgba(255,149,0,0.25), rgba(232,114,12,0.2));
  color: var(--fg);
  border-bottom-right-radius: 4px;
}

.jv-msg-text { display: inline; }

.jv-msg-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--mango);
  margin-bottom: 2px;
}

.jv-msg-time {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.tw-cursor { color: var(--mango); font-weight: 300; opacity: 0; }
.tw-cursor.tw-blink { animation: cursorBlink 0.9s step-end infinite; }
@keyframes cursorBlink { 0%,100%{opacity:1} 50%{opacity:0} }

.jv-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.jv-typing-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  display: block;
  animation: jvDot 1.4s ease-in-out infinite;
}
.jv-typing-dots i:nth-child(2) { animation-delay: 0.2s; }
.jv-typing-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes jvDot {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.jv-system-msg {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  padding: 8px 16px;
  line-height: 1.4;
}

.jv-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #141428;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.jv-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--fg);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.jv-input::placeholder { color: var(--faint); }
.jv-input:focus { border-color: rgba(255,179,62,0.4); }

.jv-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(
    135deg,
    var(--mango, #ffb33e) 0%,
    var(--mango-2, var(--mango2, #ff7a18)) 100%
  );
  color: #1a1206;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow 0.2s, transform 0.15s;
}
.jv-send:hover {
  box-shadow: 0 4px 14px rgba(255,122,24,0.4);
  transform: scale(1.05);
}

@media (max-width: 620px) {
  .jv-fab { bottom: 16px; right: 16px; width: 54px; height: 54px; }
  .jv-fab--active { display: none !important; }
  .jv-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .jv-window--open { transform: none; }
  .jv-header { padding: 14px 16px; }
  .jv-live-ava--sm { width: 36px; height: 36px; }
  .jv-body { flex: 1; padding: 14px 12px 10px; min-height: 0; }
  .jv-msg-bubble { font-size: 14px; max-width: 88%; }
  .jv-footer { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .jv-input { padding: 10px 14px; font-size: 15px; }
  .jv-send { width: 40px; height: 40px; }
}

:root { --faint: rgba(244,244,246,0.34); }
.jv-fab, .jv-window, .jv-window * { pointer-events: auto; }

.jv-actions { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; }
.jv-actions--tail { margin: 12px 0 8px; }
.jv-chips-lead {
  font-size: 12px; font-weight: 600; color: rgba(244,244,246,0.55);
  margin: 0 0 8px;
}
.jv-chips {
  display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px;
}
.jv-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #fff; text-decoration: none; font: inherit;
  transition: border-color .15s, background .15s;
}
.jv-chip:hover {
  border-color: rgba(255,179,62,0.5);
  background: rgba(255,179,62,0.1);
  text-decoration: none;
}
.jv-chip b { font-size: 14px; font-weight: 700; }
.jv-chip span { font-size: 13px; color: #ffb33e; font-weight: 700; }
.jv-chip--hit {
  border-color: rgba(255,149,0,0.55);
  background: linear-gradient(135deg, rgba(255,149,0,0.2), rgba(232,114,12,0.12));
}
.jv-install-block {
  margin: 8px 0 4px;
  padding: 10px 0 0;
}
.jv-action {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--fg, #f4f4f6); cursor: pointer;
  text-decoration: none; font: inherit;
  transition: border-color .15s, background .15s, transform .12s;
}
.jv-action:hover { border-color: rgba(255,179,62,0.45); background: rgba(255,179,62,0.08); text-decoration: none; }
.jv-action--primary {
  border-color: rgba(255,149,0,0.55);
  background: linear-gradient(135deg, rgba(255,149,0,0.22), rgba(232,114,12,0.14));
}
/* Догонялка оплаты: мягкий зелёный «ещё раз», мягкий красный «оператор» */
.jv-action--pay {
  border-color: rgba(84, 214, 138, 0.45);
  background: linear-gradient(135deg, rgba(52, 208, 88, 0.22), rgba(34, 160, 70, 0.12));
}
.jv-action--pay:hover {
  border-color: rgba(84, 214, 138, 0.7);
  background: linear-gradient(135deg, rgba(52, 208, 88, 0.32), rgba(34, 160, 70, 0.18));
}
.jv-action--pay .jv-action-title { color: #e8ffe8; }
.jv-action--pay .jv-action-sub { color: rgba(180, 240, 190, 0.72); }
.jv-action--pay .jv-action-ico {
  color: #6dff9a;
  background: rgba(52, 208, 88, 0.2);
  box-shadow: 0 0 0 1px rgba(84, 214, 138, 0.28);
}
.jv-action--danger,
.jv-action--pay-op {
  border-color: rgba(255, 107, 107, 0.42);
  background: linear-gradient(135deg, rgba(255, 90, 90, 0.18), rgba(200, 60, 70, 0.1));
}
.jv-action--danger:hover,
.jv-action--pay-op:hover {
  border-color: rgba(255, 120, 120, 0.65);
  background: linear-gradient(135deg, rgba(255, 90, 90, 0.28), rgba(200, 60, 70, 0.16));
}
.jv-action--danger .jv-action-title,
.jv-action--pay-op .jv-action-title { color: #ffe4e4; }
.jv-action--danger .jv-action-sub,
.jv-action--pay-op .jv-action-sub { color: rgba(255, 190, 190, 0.72); }
.jv-action--danger .jv-action-ico,
.jv-action--pay-op .jv-action-ico {
  color: #ff8a8a;
  background: rgba(255, 90, 90, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 120, 120, 0.28);
}
.jv-linkish {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: rgba(244,244,246,0.45);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.jv-linkish:hover { color: rgba(244,244,246,0.75); }
.jv-action--success {
  border-color: rgba(52, 208, 88, 0.55);
  background: linear-gradient(135deg, rgba(52, 208, 88, 0.28), rgba(34, 160, 70, 0.16));
}
.jv-action--success:hover {
  border-color: rgba(84, 214, 138, 0.75);
  background: linear-gradient(135deg, rgba(52, 208, 88, 0.38), rgba(34, 160, 70, 0.22));
}
.jv-action--success .jv-action-title { color: #e8ffe8; }
.jv-action--success .jv-action-sub { color: rgba(180, 240, 190, 0.75); }
.jv-action--success .jv-action-ico {
  background: rgba(52, 208, 88, 0.22);
  color: #6dff9a;
  box-shadow: 0 0 0 1px rgba(84, 214, 138, 0.25);
}
.jv-action--muted { opacity: 0.92; }
.jv-action-ico {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  color: #ffb33e;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.jv-action-ico svg { width: 22px; height: 22px; display: block; }
.jv-action--install {
  border-color: rgba(90, 170, 255, 0.5);
  background: linear-gradient(135deg, rgba(70, 150, 255, 0.26), rgba(40, 110, 220, 0.14));
}
.jv-action--install:hover {
  border-color: rgba(120, 190, 255, 0.72);
  background: linear-gradient(135deg, rgba(70, 150, 255, 0.36), rgba(40, 110, 220, 0.2));
}
.jv-action--install .jv-action-title { color: #e8f4ff; }
.jv-action--install .jv-action-sub { color: rgba(170, 210, 255, 0.75); }
.jv-action--install .jv-action-ico {
  color: #7ec8ff;
  background: rgba(80, 160, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(100, 180, 255, 0.28);
}
.jv-action--operator .jv-action-ico {
  color: #c5b4ff;
  background: rgba(160, 130, 255, 0.14);
}
.jv-action-body { min-width: 0; flex: 1; padding-top: 1px; }
.jv-action-title { display: block; font-size: 14px; font-weight: 700; color: #fff; line-height: 1.25; }
.jv-action-sub { display: block; font-size: 12px; color: rgba(244,244,246,0.55); margin-top: 3px; line-height: 1.35; }

.jv-back {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 0 10px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.04);
  color: rgba(244,244,246,0.7); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.jv-back:hover { color: #fff; border-color: rgba(255,255,255,0.22); }

.jv-panel { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.jv-label { font-size: 12px; font-weight: 600; color: rgba(244,244,246,0.55); }
.jv-field {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.25);
  color: #fff; font: inherit; font-size: 14px; outline: none;
}
.jv-field:focus { border-color: rgba(255,179,62,0.45); }
.jv-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 16px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #ffb33e, #ff7a18); color: #1a0e00;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.jv-btn:hover { filter: brightness(1.05); text-decoration: none; }
.jv-btn--ghost {
  background: rgba(255,255,255,0.06); color: #f4f4f6;
  border: 1px solid rgba(255,255,255,0.12);
}
.jv-hint { font-size: 12px; color: rgba(244,244,246,0.4); line-height: 1.4; margin: 0; }

.jv-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 10px; }
.jv-tab {
  padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: rgba(244,244,246,0.65);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.jv-tab--on { border-color: rgba(255,149,0,0.55); color: #fff; background: rgba(255,149,0,0.14); }
.jv-tab-you { color: #ffb33e; font-weight: 700; }

.jv-guide-head { font-size: 13px; color: rgba(244,244,246,0.65); margin: 0 0 10px; }
.jv-video-wrap { margin: 0 0 12px; }
.jv-video { width: 100%; border-radius: 12px; background: #000; max-height: 200px; }
.jv-video-fallback { font-size: 12px; color: rgba(244,244,246,0.4); margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px dashed rgba(255,255,255,0.1); }
.jv-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.jv-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; color: rgba(244,244,246,0.85); }
.jv-step-n {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,179,62,0.18); color: #ffb33e; font-size: 12px; font-weight: 800;
}
.jv-guide-links { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.jv-msg-text b { color: #ffe7b0; font-weight: 700; }
