/* Собрано из workspace/restohub-chat/widget.html: npm run chat-widget */
#rhcw { position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
    font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
  #rhcw * { box-sizing: border-box; }

  /* Кнопка запуска */
  .rhcw-launch { width: 60px; height: 60px; border-radius: 50%; background: #DA2118; border: none;
    cursor: pointer; box-shadow: 0 8px 24px rgba(218,33,24,.35); display: flex; align-items: center;
    justify-content: center; transition: transform .2s ease, background .2s ease; position: relative;
    animation: rhcwLaunchIn .5s cubic-bezier(.34,1.56,.64,1) .25s both; }
  .rhcw-launch:hover { transform: scale(1.06); background: #c41d15; }
  /* Пульсирующее кольцо-радар за кнопкой */
  .rhcw-launch::before { content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: #DA2118; z-index: -1; animation: rhcwPulse 2s ease-out infinite 1s; }
  #rhcw.chat-open .rhcw-launch::before { animation: none; } /* не пульсируем при открытом чате */
  @keyframes rhcwLaunchIn { 0% { opacity: 0; transform: scale(0); } 100% { opacity: 1; transform: scale(1); } }
  @keyframes rhcwPulse {
    0% { transform: scale(1); opacity: .55; }
    70% { transform: scale(1.9); opacity: 0; }
    100% { transform: scale(1.9); opacity: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .rhcw-launch { animation: none; }
    .rhcw-launch::before { animation: none; display: none; }
    .rhcw-typing__dots i { animation: none; opacity: .8; }
  }
  .rhcw-launch svg { width: 28px; height: 28px; color: #fff; }
  .rhcw-launch__dot { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px;
    background: #00a651; border: 2px solid #fff; border-radius: 50%; display: none;
    font-size: 10px; color: #fff; align-items: center; justify-content: center; font-weight: 700; }
  .rhcw-launch__dot.on { display: flex; }

  /* Всплывашка-приглашение */
  .rhcw-teaser { position: absolute; right: 74px; bottom: 6px; width: 320px; max-width: calc(100vw - 100px);
    background: #fff; border: 2px solid #DA2118; border-radius: 18px; padding: 16px 18px;
    box-shadow: 0 16px 40px rgba(0,0,0,.16); display: none; align-items: flex-start; gap: 12px;
    cursor: pointer; animation: rhcwTeaserIn .3s ease; }
  .rhcw-teaser.on { display: flex; }
  .rhcw-teaser::after { content: ''; position: absolute; right: -9px; bottom: 22px; width: 0; height: 0;
    border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 9px solid #DA2118; }
  @keyframes rhcwTeaserIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
  .rhcw-teaser__ava { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
  .rhcw-teaser__name { font-size: 15px; font-weight: 800; color: #242428; margin-bottom: 3px; }
  .rhcw-teaser__text { font-size: 13px; line-height: 1.45; color: #3a3a44; }
  .rhcw-teaser__close { position: absolute; top: 8px; right: 10px; background: none; border: none;
    color: #b0b0b8; font-size: 18px; line-height: 1; cursor: pointer; padding: 2px; }
  .rhcw-teaser__close:hover { color: #666; }

  /* Панель */
  .rhcw-panel { position: absolute; right: 0; bottom: 76px; width: 370px; height: 540px;
    max-height: calc(100vh - 110px); background: #fff; border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,.24); display: none; flex-direction: column;
    animation: rhcwIn .22s ease; }
  .rhcw-panel.open { display: flex; }
  @keyframes rhcwIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

  .rhcw-head { background: #242428; color: #fff; padding: 16px 20px; display: flex;
    align-items: center; gap: 12px; flex-shrink: 0; }
  .rhcw-head__ava { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.15); }
  .rhcw-head__title { font-size: 15px; font-weight: 700; line-height: 1.2; }
  .rhcw-head__sub { font-size: 12px; color: #b7b7bf; margin-top: 2px; }
  .rhcw-head__close { margin-left: auto; background: none; border: none; color: #b7b7bf;
    font-size: 22px; cursor: pointer; line-height: 1; padding: 4px; }
  .rhcw-head__close:hover { color: #fff; }

  .rhcw-body { flex: 1; overflow-y: auto; padding: 20px; background: #f7f6f4; }

  /* Форма */
  .rhcw-intro { font-size: 14px; line-height: 1.55; color: #3a3a44; margin: 0 0 18px; }
  .rhcw-field { margin-bottom: 14px; }
  .rhcw-label { display: block; font-size: 13px; font-weight: 600; color: #242428; margin-bottom: 6px; }
  .rhcw-input { width: 100%; border: 1px solid #d8d8de; border-radius: 10px; padding: 12px 14px;
    font-size: 15px; font-family: inherit; color: #242428; background: #fff; outline: none; transition: border-color .15s; }
  .rhcw-input:focus { border-color: #DA2118; }
  .rhcw-input.err { border-color: #d4322a; }
  .rhcw-input.ok { border-color: #00a651; }
  .rhcw-hint { font-size: 12px; color: #d4322a; margin-top: 5px; display: none; }
  .rhcw-hint.on { display: block; }
  .rhcw-check { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: #5b5b66;
    line-height: 1.45; cursor: pointer; margin: 16px 0; }
  .rhcw-check input { margin-top: 1px; width: 18px; height: 18px; accent-color: #DA2118; flex-shrink: 0; }
  .rhcw-check a { color: #DA2118; text-decoration: underline; }
  .rhcw-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .rhcw-submit { width: 100%; border: none; background: #DA2118; color: #fff; font-weight: 700;
    font-size: 15px; padding: 14px; border-radius: 11px; cursor: pointer; font-family: inherit; transition: background .2s; }
  .rhcw-submit:hover { background: #c41d15; }
  .rhcw-submit:disabled { opacity: .5; cursor: not-allowed; }

  /* Лента сообщений */
  .rhcw-msgs { display: flex; flex-direction: column; gap: 10px; }
  .rhcw-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 14px;
    line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
  .rhcw-msg--manager { align-self: flex-start; background: #fff; border: 1px solid #e7e7ec;
    border-bottom-left-radius: 4px; color: #242428; }
  .rhcw-msg--visitor { align-self: flex-end; background: #DA2118; color: #fff; border-bottom-right-radius: 4px; }
  .rhcw-msg--sys { align-self: center; background: none; color: #8a8a90; font-size: 12px; text-align: center; max-width: 100%; }
  /* «Менеджер печатает»: пока посетитель ждёт ответа, окно не выглядит мёртвым */
  .rhcw-typing { align-self: flex-start; display: none; align-items: center; gap: 8px; padding: 10px 14px;
    background: #fff; border: 1px solid #e7e7ec; border-radius: 14px; border-bottom-left-radius: 4px;
    color: #8a8a90; font-size: 12px; line-height: 1.4; }
  .rhcw-typing.on { display: inline-flex; }
  .rhcw-typing__dots { display: inline-flex; gap: 4px; }
  .rhcw-typing__dots i { width: 6px; height: 6px; border-radius: 50%; background: #b5b5bd;
    animation: rhcwDot 1.2s infinite ease-in-out; }
  .rhcw-typing__dots i:nth-child(2) { animation-delay: .15s; }
  .rhcw-typing__dots i:nth-child(3) { animation-delay: .3s; }
  @keyframes rhcwDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

  /* Ввод */
  .rhcw-compose { flex-shrink: 0; border-top: 1px solid #e7e7ec; background: #fff; padding: 12px;
    display: none; gap: 8px; align-items: flex-end; }
  .rhcw-compose.on { display: flex; }
  .rhcw-textarea { flex: 1; border: 1px solid #d8d8de; border-radius: 12px; padding: 10px 14px;
    font-size: 14px; font-family: inherit; resize: none; max-height: 100px; outline: none; }
  .rhcw-textarea:focus { border-color: #DA2118; }
  .rhcw-send { width: 42px; height: 42px; border-radius: 50%; background: #DA2118; border: none;
    cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
  .rhcw-send:hover { background: #c41d15; }
  .rhcw-send svg { width: 20px; height: 20px; color: #fff; }
  .rhcw-send:disabled { opacity: .5; cursor: not-allowed; }

  @media (max-width: 480px) {
    #rhcw { right: 16px; bottom: 16px; }
    /* Окно на телефоне - не во весь экран (решение владельца 17.09.2026): поля по 16,
       высота не больше 520 и не меньше 56 до верха экрана. Высота от видимой области
       (dvh): в Safari на iPhone 100vh - экран со скрытыми панелями браузера, и окно
       упиралось в верх. Снизу окно над кнопкой: 16 + 60 + 14. Строка с vh - запас
       для браузеров без dvh */
    .rhcw-panel { width: calc(100vw - 32px); bottom: 74px; max-height: none;
      height: min(520px, calc(100vh - 220px));
      height: min(520px, calc(100dvh - 146px - env(safe-area-inset-top, 0px))); }
    .rhcw-teaser { width: calc(100vw - 90px); }
  }
