/* Чат-виджет сайта «Альтера-Аудит». Изолированные стили (префикс .acw-). */
.acw-root { position: fixed; z-index: 99990; bottom: 24px; }
.acw-root.acw-right { right: 24px; }
.acw-root.acw-left { left: 24px; }

/* CTA-кнопка */
.acw-cta {
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, #149394, #0c4141);
  color: #fff; border: none; cursor: pointer;
  padding: 13px 20px; border-radius: 999px;
  font: 600 15px/1 -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: 0 10px 30px rgba(12,65,65,.35);
  transition: transform .2s ease, box-shadow .2s ease, opacity .25s ease;
  transform: translateY(8px); opacity: 0;
}
.acw-cta.acw-in { transform: translateY(0); opacity: 1; }
.acw-cta:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(12,65,65,.45); }
.acw-cta svg { width: 20px; height: 20px; }
.acw-cta .acw-dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; background: #ef4444; border: 2px solid #fff; border-radius: 50%; display: none; }
.acw-cta.acw-has-unread .acw-dot { display: block; }

/* Панель */
.acw-panel {
  position: absolute; bottom: 0; width: 374px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 48px);
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(12,65,65,.28); display: flex; flex-direction: column;
  transform: translateY(16px) scale(.98); opacity: 0; transform-origin: bottom right;
  visibility: hidden; pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .22s ease, visibility .28s;
}
.acw-root.acw-left .acw-panel { transform-origin: bottom left; }
.acw-right .acw-panel { right: 0; } .acw-left .acw-panel { left: 0; }
.acw-panel.acw-open { transform: translateY(0) scale(1); opacity: 1; visibility: visible; pointer-events: auto; }

.acw-head { background: linear-gradient(135deg, #149394, #0c4141); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 11px; }
.acw-ava { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; overflow: hidden; flex: 0 0 auto; }
.acw-ava img { width: 100%; height: 100%; object-fit: cover; }
.acw-head-i { min-width: 0; flex: 1; }
.acw-head-name { font: 700 15px/1.2 -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.acw-head-sub { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 5px; }
.acw-head-sub .acw-online { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.acw-vkbar { display: flex; align-items: center; gap: 10px; width: 100%; border: none; cursor: pointer; text-align: left; background: #07f; color: #fff; padding: 9px 14px; transition: background .15s; }
.acw-vkbar:hover { background: #0a6fe0; }
.acw-vkbar-ic { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 auto; border-radius: 7px; background: rgba(255,255,255,.18); }
.acw-vkbar-ic svg { width: 18px; height: 18px; }
.acw-vkbar-t { flex: 1; min-width: 0; line-height: 1.25; }
.acw-vkbar-t b { display: block; font: 600 13px/1.25 -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.acw-vkbar-t small { display: block; font-size: 11px; opacity: .85; }
.acw-vkbar-go { flex: 0 0 auto; font-size: 18px; opacity: .9; }
.acw-close { background: transparent; border: none; color: #fff; cursor: pointer; opacity: .8; padding: 4px; }
.acw-close:hover { opacity: 1; }

.acw-body { flex: 1; overflow-y: auto; padding: 16px; background: #f6f9f9; display: flex; flex-direction: column; gap: 10px; }
.acw-msg { max-width: 82%; padding: 10px 13px; border-radius: 15px; font: 14px/1.45 -apple-system, Segoe UI, Roboto, Arial, sans-serif; white-space: pre-wrap; word-wrap: break-word; }
.acw-msg.acw-in2 { background: #fff; color: #1f2937; align-self: flex-start; border-bottom-left-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.acw-msg.acw-out { background: linear-gradient(135deg, #149394, #0f7c7c); color: #fff; align-self: flex-end; border-bottom-right-radius: 5px; }
.acw-msg.acw-sys { align-self: center; background: #e6efef; color: #4b6a6a; font-size: 12.5px; border-radius: 10px; text-align: center; max-width: 92%; }
.acw-msg-row { display: flex; flex-direction: column; gap: 3px; max-width: 100%; }
.acw-msg-row.acw-r-out { align-items: flex-end; }
.acw-mname { font-size: 11px; color: #6b7280; padding: 0 4px; }
.acw-typing { align-self: flex-start; background: #fff; padding: 12px 15px; border-radius: 15px; box-shadow: 0 1px 2px rgba(0,0,0,.06); display: none; }
.acw-typing.acw-show { display: inline-flex; gap: 4px; }
.acw-typing span { width: 7px; height: 7px; background: #9ca3af; border-radius: 50%; animation: acw-bounce 1.2s infinite; }
.acw-typing span:nth-child(2) { animation-delay: .15s; } .acw-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes acw-bounce { 0%,60%,100% { transform: translateY(0); opacity:.5 } 30% { transform: translateY(-5px); opacity:1 } }

.acw-quick { display: flex; flex-wrap: wrap; gap: 7px; align-self: flex-start; max-width: 100%; }
.acw-quick button { background: #fff; border: 1.5px solid #149394; color: #0c4141; border-radius: 999px; padding: 7px 13px; font-size: 13px; cursor: pointer; transition: background .15s; }
.acw-quick button:hover { background: #149394; color: #fff; }

.acw-lead { align-self: stretch; background: #fff; border: 1px solid #e2e8e8; border-radius: 14px; padding: 13px; display: flex; flex-direction: column; gap: 8px; }
.acw-lead input { border: 1px solid #d7e0e0; border-radius: 9px; padding: 9px 11px; font-size: 14px; outline: none; }
.acw-lead input:focus { border-color: #149394; }
.acw-lead button { background: #149394; color: #fff; border: none; border-radius: 9px; padding: 9px; font-weight: 600; cursor: pointer; }
.acw-lead-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.4; color: #5b6a6a; cursor: pointer; }
.acw-lead-consent input { width: 16px; height: 16px; flex: 0 0 auto; margin: 2px 0 0; padding: 0; accent-color: #149394; cursor: pointer; }
.acw-lead-consent a { color: #149394; text-decoration: underline; }
.acw-lead-consent--err { color: #ef4444; }
.acw-lead-consent--err input { outline: 2px solid #ef4444; outline-offset: 1px; }

.acw-foot { padding: 10px 12px 14px; background: #fff; }
.acw-foot-inner { display: flex; align-items: flex-end; gap: 6px; background: #f1f5f5; border: 1.5px solid transparent; border-radius: 22px; padding: 4px 4px 4px 15px; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.acw-foot-inner:focus-within { background: #fff; border-color: #149394; box-shadow: 0 0 0 3px rgba(20,147,148,.12); }
.acw-foot textarea { flex: 1; border: none; background: transparent; padding: 8px 0; font: 14px/1.4 -apple-system, Segoe UI, Roboto, Arial, sans-serif; resize: none; max-height: 96px; outline: none; color: #1f2937; }
.acw-send { background: #149394; color: #fff; border: none; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; transition: background .15s ease, transform .12s ease, opacity .15s ease; }
.acw-send:hover:not(:disabled) { background: #0f7c7c; transform: scale(1.06); }
.acw-send:disabled { opacity: .4; cursor: default; }
.acw-send svg { width: 17px; height: 17px; }

/* Оценка диалога */
.acw-rate { align-self: stretch; background: #fff; border: 1px solid #e2e8e8; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.acw-rate-t { font-size: 14px; font-weight: 600; color: #0c4141; text-align: center; }
.acw-stars { display: flex; gap: 4px; justify-content: center; }
.acw-stars button { background: none; border: none; font-size: 30px; line-height: 1; color: #d7e0e0; cursor: pointer; padding: 0 2px; transition: color .12s, transform .12s; }
.acw-stars button:hover, .acw-stars button.on { color: #f5a623; }
.acw-stars button:hover { transform: scale(1.12); }
.acw-rate-extra { display: flex; flex-direction: column; gap: 8px; }
.acw-rate-extra textarea { border: 1px solid #d7e0e0; border-radius: 9px; padding: 9px 11px; font: 14px/1.4 -apple-system, Segoe UI, Roboto, Arial, sans-serif; resize: none; outline: none; }
.acw-rate-extra textarea:focus { border-color: #149394; }
.acw-rate-q { font-size: 13px; color: #5b6b6b; }
.acw-rate-yn { display: flex; gap: 8px; }
.acw-rate-yn button { flex: 1; background: #fff; border: 1.5px solid #d7e0e0; border-radius: 9px; padding: 8px; font-size: 14px; cursor: pointer; }
.acw-rate-yn button.on { border-color: #149394; background: #149394; color: #fff; }
.acw-rate-send { background: #149394; color: #fff; border: none; border-radius: 9px; padding: 9px; font-weight: 600; cursor: pointer; }
.acw-rate-done { text-align: center; font-size: 14px; color: #0c4141; font-weight: 600; padding: 6px; }

/* Кнопка «Начать новый чат» (после закрытия диалога) */
.acw-newchat { align-self: center; margin-top: 4px; background: #fff; color: #0c4141; border: 1.5px solid #149394; border-radius: 999px; padding: 9px 18px; font: 600 14px/1 -apple-system, Segoe UI, Roboto, Arial, sans-serif; cursor: pointer; transition: background .15s, color .15s; }
.acw-newchat:hover { background: #149394; color: #fff; }
