/* =============================================
UNIVERSAL COMPLIANCE & CHAT WIDGET v4.0 PRO
Десктоп: карточка-чат справа снизу, пружинное раскрытие
Мобилки: bottom-sheet, политика на весь экран
============================================= */
.uw-wrapper,
.uw-wrapper *,
.uw-wrapper *::before,
.uw-wrapper *::after {
  box-sizing: border-box !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  -webkit-tap-highlight-color: transparent !important;
}
.uw-wrapper {
  --uw-c: #007bff;
  --uw-bg: #ffffff;
  --uw-text: #333333;
  --uw-rad: 16px;
  --uw-safe-b: env(safe-area-inset-bottom, 0px);
  --uw-safe-r: env(safe-area-inset-right, 0px);
  z-index: 99999 !important;
  position: relative;
  line-height: 1.5 !important;
}
.uw-svg-defs { position: absolute !important; width: 0 !important; height: 0 !important; overflow: hidden !important; }

/* ===================== FAB (кнопка) ===================== */
.uw-fab {
  position: fixed !important;
  bottom: calc(24px + var(--uw-safe-b)) !important;
  right: calc(24px + var(--uw-safe-r)) !important;
  width: 60px !important; height: 60px !important;
  border: none !important; border-radius: 50% !important;
  background: var(--uw-c) !important;
  color: #fff !important;
  cursor: pointer !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22) !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease !important;
  padding: 0 !important; margin: 0 !important;
  touch-action: manipulation !important;
  -webkit-user-select: none !important; user-select: none !important;
  z-index: 99999 !important;
}
.uw-fab::before { /* глянцевый блик */
  content: "" !important; position: absolute !important; inset: 0 !important; border-radius: 50% !important;
  background: radial-gradient(120% 120% at 30% 20%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%) !important;
  pointer-events: none !important;
}
.uw-fab:hover, .uw-fab:focus-visible { transform: scale(1.08) !important; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important; }
.uw-fab:active { transform: scale(0.94) !important; }
.uw-fab:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.7) !important; outline-offset: 2px !important; }
.uw-fab svg { width: 28px !important; height: 28px !important; display: block !important; pointer-events: none !important; }
.uw-fab-open { transform: rotate(90deg) !important; }
.uw-fab-open:hover { transform: rotate(90deg) scale(1.08) !important; }
/* Режим одного мессенджера: фирменный логотип на кнопке */
.uw-fab--brand { background: #fff !important; }
.uw-fab--brand svg { width: 46px !important; height: 46px !important; border-radius: 14px !important; }
/* Индикатор «онлайн» */
.uw-fab-dot {
  position: absolute !important; top: 1px !important; right: 1px !important;
  width: 14px !important; height: 14px !important; border-radius: 50% !important;
  background: #22c55e !important; border: 2.5px solid #fff !important;
}
.uw-fab-dot::after {
  content: "" !important; position: absolute !important; inset: -2px !important; border-radius: 50% !important;
  background: rgba(34, 197, 94, 0.5) !important; animation: uw-ping 2.2s ease-out infinite !important;
}
@keyframes uw-ping { 0% { transform: scale(1); opacity: 0.7; } 80%, 100% { transform: scale(2.2); opacity: 0; } }

/* ===================== ПАНЕЛЬ МИНИ-ЧАТА ===================== */
.uw-panel {
  position: fixed !important;
  bottom: calc(96px + var(--uw-safe-b)) !important;
  right: calc(24px + var(--uw-safe-r)) !important;
  width: min(380px, calc(100vw - 32px)) !important;
  max-height: min(640px, calc(100vh - 120px)) !important;
  display: flex !important; flex-direction: column !important;
  background: var(--uw-bg) !important;
  border-radius: 24px !important;
  overflow: hidden !important;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24) !important;
  transform-origin: bottom right !important;
  transform: scale(0.5) translateY(40px) !important;
  opacity: 0 !important; visibility: hidden !important;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease, visibility 0.35s !important;
  z-index: 99999 !important;
  outline: none !important;
}
.uw-panel.open { transform: none !important; opacity: 1 !important; visibility: visible !important; }

/* --- Шапка --- */
.uw-panel-head {
  display: flex !important; align-items: center !important; gap: 12px !important;
  padding: 16px !important;
  background: var(--uw-c) !important;
  background: linear-gradient(135deg, var(--uw-c), rgba(0, 0, 0, 0.35)) !important;
  background-blend-mode: normal, multiply !important;
  color: #fff !important;
  flex-shrink: 0 !important;
}
.uw-avatar {
  position: relative !important; width: 44px !important; height: 44px !important; flex-shrink: 0 !important;
  border-radius: 50% !important; background: rgba(255, 255, 255, 0.2) !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
}
.uw-avatar svg { width: 24px !important; height: 24px !important; }
.uw-avatar-dot {
  position: absolute !important; right: -1px !important; bottom: -1px !important;
  width: 12px !important; height: 12px !important; border-radius: 50% !important;
  background: #22c55e !important; border: 2px solid #fff !important;
}
.uw-head-info { flex: 1 1 auto !important; min-width: 0 !important; }
.uw-head-title { font-size: 15px !important; font-weight: 700 !important; line-height: 1.3 !important; }
.uw-head-status { display: flex !important; align-items: center !important; gap: 6px !important; font-size: 12px !important; opacity: 0.92 !important; }
.uw-status-dot { width: 7px !important; height: 7px !important; border-radius: 50% !important; background: #4ade80 !important; animation: uw-blink 2s infinite !important; flex-shrink: 0 !important; }
@keyframes uw-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.uw-panel-close {
  margin-left: auto !important; flex-shrink: 0 !important;
  width: 36px !important; height: 36px !important; border: none !important; border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.14) !important; color: #fff !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  cursor: pointer !important; transition: background 0.15s !important;
}
.uw-panel-close:hover { background: rgba(255, 255, 255, 0.28) !important; }
.uw-panel-close svg { width: 15px !important; height: 15px !important; }

/* --- Тело чата --- */
.uw-panel-body {
  padding: 16px !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  background-image: radial-gradient(rgba(127, 127, 127, 0.14) 1px, transparent 1px) !important;
  background-size: 14px 14px !important;
  display: flex !important; flex-direction: column !important; gap: 10px !important;
}
/* «печатает…» */
.uw-typing {
  display: none !important; align-self: flex-start !important;
  background: #fff !important; border-radius: 4px 14px 14px 14px !important;
  padding: 13px 14px !important; gap: 5px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}
.uw-panel.uw-intro .uw-typing { display: flex !important; }
.uw-panel.s1 .uw-typing { display: none !important; }
.uw-typing span { width: 7px !important; height: 7px !important; border-radius: 50% !important; background: #9aa0a6 !important; animation: uw-typing 1s infinite !important; }
.uw-typing span:nth-child(2) { animation-delay: 0.15s !important; }
.uw-typing span:nth-child(3) { animation-delay: 0.3s !important; }
@keyframes uw-typing { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-4px); opacity: 1; } }
/* пузыри сообщений */
.uw-msg {
  align-self: flex-start !important; max-width: 88% !important;
  background: #fff !important; color: var(--uw-text) !important;
  border-radius: 4px 16px 16px 16px !important;
  padding: 10px 14px !important;
  font-size: 14px !important; line-height: 1.45 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08) !important;
  opacity: 0 !important; transform: translateY(10px) !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
  word-wrap: break-word !important;
}
.uw-panel.s1 [data-step="1"],
.uw-panel.s2 [data-step="2"],
.uw-panel.s3 [data-step="3"] { opacity: 1 !important; transform: none !important; }
/* карточки мессенджеров */
.uw-msgr-cards { display: flex !important; flex-direction: column !important; gap: 10px !important; }
.uw-msgr-card {
  display: flex !important; align-items: center !important; gap: 12px !important;
  padding: 10px 12px !important;
  background: #fff !important;
  border: 1px solid rgba(0, 0, 0, 0.07) !important;
  border-radius: 16px !important;
  text-decoration: none !important; color: var(--uw-text) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s !important;
  touch-action: manipulation !important;
}
.uw-msgr-card:hover, .uw-msgr-card:focus-visible {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12) !important;
  border-color: var(--uw-c) !important;
}
.uw-msgr-logo { width: 44px !important; height: 44px !important; flex-shrink: 0 !important; display: flex !important; }
.uw-msgr-logo svg { width: 44px !important; height: 44px !important; border-radius: 12px !important; }
.uw-msgr-text { display: flex !important; flex-direction: column !important; flex: 1 1 auto !important; min-width: 0 !important; }
.uw-msgr-text strong { font-size: 15px !important; font-weight: 700 !important; }
.uw-msgr-text small { font-size: 12px !important; color: #777 !important; }
.uw-msgr-arrow { width: 18px !important; height: 18px !important; color: #bbb !important; flex-shrink: 0 !important; transition: transform 0.2s, color 0.2s !important; }
.uw-msgr-arrow svg { width: 100% !important; height: 100% !important; }
.uw-msgr-card:hover .uw-msgr-arrow { transform: translateX(3px) !important; color: var(--uw-c) !important; }
/* сноска про политику (информирование без чекбокса) */
.uw-panel-note {
  font-size: 11.5px !important; color: #8a8a8a !important;
  line-height: 1.5 !important; text-align: center !important;
  padding: 2px 8px 4px !important;
}
.uw-panel-note a { color: var(--uw-c) !important; text-decoration: underline !important; cursor: pointer !important; }

/* ===================== ТИЗЕР ===================== */
.uw-teaser {
  position: fixed !important;
  bottom: calc(96px + var(--uw-safe-b)) !important;
  right: calc(24px + var(--uw-safe-r)) !important;
  max-width: 260px !important;
  background: #fff !important; color: var(--uw-text) !important;
  border-radius: 16px 16px 4px 16px !important;
  padding: 12px 34px 12px 14px !important;
  font-size: 13.5px !important; line-height: 1.45 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18) !important;
  opacity: 0 !important; transform: translateY(10px) scale(0.9) !important;
  transition: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  z-index: 99998 !important;
}
.uw-teaser.show { opacity: 1 !important; transform: none !important; }
.uw-teaser-text { cursor: pointer !important; }
.uw-teaser-close {
  position: absolute !important; top: 6px !important; right: 6px !important;
  width: 24px !important; height: 24px !important; border: none !important;
  background: transparent !important; color: #999 !important; cursor: pointer !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
}
.uw-teaser-close svg { width: 11px !important; height: 11px !important; }

/* ============================================================
COOKIE BANNER — mobile-first
============================================================ */
.uw-banner {
  position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
  background: var(--uw-bg) !important;
  border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
  padding: 14px 16px calc(14px + var(--uw-safe-b)) 16px !important;
  box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.1) !important;
  display: block !important;
  transform: translateY(100%) !important;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  font-size: 13px !important; color: var(--uw-text) !important; line-height: 1.5 !important;
  z-index: 99998 !important; max-width: 100% !important; margin: 0 !important;
}
.uw-banner.show { transform: translateY(0) !important; }
.uw-banner.keyboard-hidden { transform: translateY(100%) !important; }
.uw-banner-text { display: block !important; margin-bottom: 12px !important; text-align: center !important; word-wrap: break-word !important; }
.uw-banner-text a { color: var(--uw-c) !important; text-decoration: underline !important; cursor: pointer !important; }
.uw-btn {
  display: block !important; width: 100% !important;
  background: var(--uw-c) !important; color: #fff !important; border: none !important;
  padding: 12px 20px !important; min-height: 44px !important; border-radius: 10px !important;
  cursor: pointer !important; font-weight: 600 !important; font-size: 14px !important;
  white-space: nowrap !important; transition: opacity 0.2s, transform 0.1s !important;
  touch-action: manipulation !important; -webkit-user-select: none !important; user-select: none !important;
  text-align: center !important;
}
.uw-btn:hover { opacity: 0.9 !important; }
.uw-btn:active { transform: scale(0.98) !important; }

@media (min-width: 769px) {
  .uw-banner {
    left: 50% !important; right: auto !important; bottom: 28px !important;
    width: min(620px, calc(100vw - 48px)) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important; border-radius: var(--uw-rad) !important;
    padding: 18px 22px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16) !important;
    display: flex !important; align-items: center !important; gap: 20px !important;
    font-size: 13.5px !important;
    transform: translate(-50%, 130%) !important;
  }
  .uw-banner.show { transform: translate(-50%, 0) !important; }
  .uw-banner.keyboard-hidden { transform: translate(-50%, 130%) !important; }
  .uw-banner-text { flex: 1 1 auto !important; margin-bottom: 0 !important; text-align: left !important; }
  .uw-btn { width: auto !important; min-width: 140px !important; flex-shrink: 0 !important; padding: 12px 28px !important; }
}

/* ===================== МОДАЛКА ПОЛИТИКИ ===================== */
.uw-overlay {
  position: fixed !important; inset: 0 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  z-index: 100000 !important;
  display: none !important; align-items: center !important; justify-content: center !important;
  padding: 20px !important; -webkit-overflow-scrolling: touch !important;
}
.uw-overlay.open { display: flex !important; }
.uw-modal {
  background: #fff !important; width: 100% !important; max-width: 800px !important;
  max-height: min(85vh, 700px) !important; border-radius: var(--uw-rad) !important;
  overflow: hidden !important; display: flex !important; flex-direction: column !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2) !important; margin: 0 !important;
}
.uw-modal-head {
  padding: 16px 24px !important; border-bottom: 1px solid #eee !important;
  display: flex !important; justify-content: space-between !important; align-items: center !important;
  font-weight: 700 !important; font-size: 16px !important; color: #222 !important; flex-shrink: 0 !important;
}
.uw-close {
  background: none !important; border: none !important; font-size: 26px !important; cursor: pointer !important;
  color: #666 !important; padding: 0 !important; margin-left: 16px !important; line-height: 1 !important;
  width: 40px !important; height: 40px !important; border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  flex-shrink: 0 !important; transition: background 0.15s, color 0.15s !important;
}
.uw-close:hover { background: rgba(0, 0, 0, 0.06) !important; color: #222 !important; }
.uw-modal-body {
  flex: 1 1 auto !important; min-height: 0 !important; padding: 24px !important;
  overflow-y: auto !important; font-size: 14px !important; line-height: 1.7 !important; color: #444 !important;
  -webkit-overflow-scrolling: touch !important; overscroll-behavior: contain !important; word-wrap: break-word !important;
}
.uw-modal-body h3 { margin: 24px 0 12px !important; color: #222 !important; font-size: 16px !important; font-weight: 700 !important; }
.uw-modal-body h3:first-child { margin-top: 0 !important; }
.uw-modal-body p, .uw-modal-body li { margin-bottom: 8px !important; }
.uw-modal-body ul { padding-left: 20px !important; margin-bottom: 12px !important; }
.uw-modal-body strong { color: #222 !important; }

/* ===================== ЧЕКБОКС В ФОРМАХ ===================== */
.uw-consent-wrap {
  display: flex !important; align-items: flex-start !important; gap: 10px !important;
  margin-top: 14px !important; font-size: 12px !important; color: #666 !important; line-height: 1.5 !important;
}
.uw-consent-wrap input[type="checkbox"] {
  margin-top: 3px !important; flex-shrink: 0 !important; accent-color: var(--uw-c) !important;
  min-width: 18px !important; min-height: 18px !important; touch-action: manipulation !important;
}
.uw-consent-wrap label { cursor: pointer !important; }
.uw-consent-wrap a { color: var(--uw-c) !important; text-decoration: underline !important; cursor: pointer !important; }
.uw-form-err { color: #d32f2f !important; font-size: 12px !important; display: none !important; margin-top: 6px !important; font-weight: 500 !important; }

/* ============================================================
MOBILE (до 768px): чат — bottom-sheet, политика на весь экран
============================================================ */
@media (max-width: 768px) {
  .uw-fab { bottom: calc(16px + var(--uw-safe-b)) !important; right: calc(16px + var(--uw-safe-r)) !important; width: 56px !important; height: 56px !important; }
  .uw-fab svg { width: 26px !important; height: 26px !important; }
  .uw-fab--brand svg { width: 42px !important; height: 42px !important; }
  .uw-panel {
    left: 0 !important; right: 0 !important; bottom: 0 !important;
    width: 100% !important; max-height: 88vh !important;
    border-radius: 24px 24px 0 0 !important;
    transform: translateY(100%) !important; transform-origin: bottom center !important;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s, visibility 0.35s !important;
  }
  .uw-panel::before { /* ручка bottom-sheet */
    content: "" !important; position: absolute !important; top: 6px !important; left: 50% !important;
    transform: translateX(-50%) !important; width: 44px !important; height: 4px !important;
    border-radius: 2px !important; background: rgba(255, 255, 255, 0.5) !important; z-index: 2 !important;
  }
  .uw-teaser { right: 16px !important; bottom: calc(88px + var(--uw-safe-b)) !important; }
  .uw-banner { padding: 12px 14px calc(12px + var(--uw-safe-b)) 14px !important; font-size: 12px !important; }
  .uw-banner-text { margin-bottom: 10px !important; line-height: 1.45 !important; }
  .uw-btn { padding: 11px 16px !important; font-size: 13px !important; min-height: 42px !important; }
  /* политика на весь экран */
  .uw-overlay { padding: 0 !important; align-items: stretch !important; background: var(--uw-bg) !important; }
  .uw-modal {
    width: 100% !important; max-width: 100% !important; height: 100% !important; max-height: 100% !important;
    border-radius: 0 !important; box-shadow: none !important; margin: 0 !important;
    animation: uw-slide-up 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
  .uw-modal-head {
    padding: 12px 16px !important; font-size: 14px !important;
    position: sticky !important; top: 0 !important; background: var(--uw-bg) !important;
    z-index: 1 !important; border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  }
  .uw-close { width: 36px !important; height: 36px !important; font-size: 22px !important; margin-left: 8px !important; }
  .uw-modal-body { padding: 14px 16px calc(14px + var(--uw-safe-b)) 16px !important; font-size: 13px !important; line-height: 1.55 !important; }
  .uw-modal-body h3 { font-size: 13px !important; margin: 16px 0 6px !important; text-transform: uppercase !important; letter-spacing: 0.3px !important; }
  .uw-modal-body h3:first-child { margin-top: 0 !important; }
  .uw-modal-body p, .uw-modal-body li { margin-bottom: 6px !important; }
  .uw-modal-body ul { padding-left: 18px !important; margin-bottom: 10px !important; }
}
@keyframes uw-slide-up { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 360px) {
  .uw-fab { width: 50px !important; height: 50px !important; }
  .uw-fab svg { width: 24px !important; height: 24px !important; }
  .uw-fab--brand svg { width: 38px !important; height: 38px !important; }
  .uw-msgr-logo, .uw-msgr-logo svg { width: 38px !important; height: 38px !important; }
  .uw-modal-head { font-size: 13px !important; padding: 10px 14px !important; }
  .uw-modal-body { padding: 12px 14px calc(12px + var(--uw-safe-b)) 14px !important; font-size: 12px !important; }
}

/* ===================== ДОСТУПНОСТЬ ===================== */
@media (prefers-reduced-motion: reduce) {
  .uw-fab, .uw-panel, .uw-banner, .uw-btn, .uw-modal, .uw-close, .uw-teaser, .uw-msg, .uw-msgr-card,
  .uw-fab-dot::after, .uw-status-dot, .uw-typing span {
    transition: none !important; animation: none !important;
  }
}

/* ===================== ТЁМНАЯ ТЕМА ===================== */
@media (prefers-color-scheme: dark) {
  .uw-wrapper { --uw-bg: #1e1e1e !important; --uw-text: #e0e0e0 !important; }
  .uw-panel { box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5) !important; }
  .uw-panel-body { background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px) !important; }
  .uw-msg { background: #2a2a2a !important; color: #e6e6e6 !important; }
  .uw-typing { background: #2a2a2a !important; }
  .uw-msgr-card { background: #262626 !important; border-color: #3a3a3a !important; color: #e6e6e6 !important; }
  .uw-msgr-text small { color: #9a9a9a !important; }
  .uw-fab--brand { background: #2a2a2a !important; }
  .uw-teaser { background: #2a2a2a !important; color: #e6e6e6 !important; }
  .uw-modal { background: #1e1e1e !important; }
  .uw-modal-head { border-bottom-color: #333 !important; color: #fff !important; background: #1e1e1e !important; }
  .uw-modal-body { color: #ccc !important; }
  .uw-modal-body h3, .uw-modal-body strong { color: #fff !important; }
  .uw-banner { border-top-color: #333 !important; }
  .uw-close { color: #aaa !important; }
  .uw-close:hover { background: rgba(255, 255, 255, 0.1) !important; color: #fff !important; }
  .uw-consent-wrap { color: #aaa !important; }
}
/* ============================================================
v4.1 — РЕЖИМ РАБОЧЕГО ВРЕМЕНИ (онлайн/офлайн)
============================================================ */
/* Кнопка офлайн: индикатор серый, без пульсации */
.uw-fab--offline .uw-fab-dot { background: #94a3b8 !important; }
.uw-fab--offline .uw-fab-dot::after { animation: none !important; opacity: 0 !important; }
/* Шапка чата офлайн */
.uw-status-dot--off { background: #f59e0b !important; animation: none !important; }
.uw-avatar-dot--off { background: #f59e0b !important; }
/* Офлайн-пузырь: янтарный акцент */
.uw-msg--offline {
  background: #fff7e6 !important;
  border-left: 3px solid #f59e0b !important;
}
@media (prefers-color-scheme: dark) {
  .uw-msg--offline { background: #33291a !important; }
}