/* Единый чат-виджет ПрорабСтрой (vanilla, без зависимостей) */
.prw-root { position: fixed; bottom: 74px; right: 24px; z-index: 950; }
@media (max-width: 640px) { .prw-root { bottom: 84px; right: 16px; } }

/* Launcher */
.prw-launcher {
  width: 56px; height: 56px; border-radius: 50%;
  background: hsl(152 44% 30%); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(45,106,79,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.prw-launcher:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(45,106,79,0.45); }
.prw-badge {
  position: absolute; top: -4px; right: -4px;
  background: #dc2626; color: white; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px; border: 2px solid white;
}

/* Тизер */
.prw-teaser {
  position: absolute; bottom: 4px; right: 72px;
  max-width: 240px; min-width: 190px;
  background: #fff;
  border: 1px solid hsl(214 32% 91%);
  border-radius: 16px; border-bottom-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px 14px;
  cursor: pointer; text-align: left;
  animation: prwTeaserIn 0.3s ease;
}
.prw-teaser::after {
  content: ''; position: absolute; bottom: 8px; right: -5px;
  width: 10px; height: 10px; transform: rotate(45deg);
  background: #fff;
  border-right: 1px solid hsl(214 32% 91%);
  border-bottom: 1px solid hsl(214 32% 91%);
}
.prw-teaser-text { font-size: 13px; line-height: 1.45; color: hsl(222 47% 11%); }
.prw-teaser-close {
  position: absolute; top: 6px; right: 6px;
  width: 18px; height: 18px; border-radius: 50%;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: hsl(215 16% 47%); opacity: 0.6; transition: opacity 0.15s;
}
.prw-teaser-close:hover { opacity: 1; }
.prw-teaser-close svg { display: block; }
@keyframes prwTeaserIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 640px) { .prw-teaser { max-width: calc(100vw - 96px); right: 68px; bottom: 0; } }

/* Окно чата */
.prw-window {
  position: absolute; bottom: 70px; right: 0;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  flex-direction: column; overflow: hidden;
  animation: prwWindowOpen 0.25s ease;
}
@keyframes prwWindowOpen { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 640px) {
  .prw-window { width: calc(100vw - 32px); height: calc(100vh - 120px); }
}

/* Шапка */
.prw-header {
  background: hsl(152 44% 30%); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.prw-header-info { display: flex; align-items: center; gap: 10px; }
.prw-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.prw-header-title { font-size: 15px; font-weight: 600; line-height: 1.2; }
.prw-header-subtitle { font-size: 12px; opacity: 0.85; display: flex; align-items: center; gap: 5px; }
.prw-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-flex; flex-shrink: 0; }
.prw-close {
  background: transparent; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0;
}
.prw-close:hover { background: rgba(255,255,255,0.15); }

/* Сообщения */
.prw-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: hsl(210 40% 96%);
  scroll-behavior: smooth;
}
.prw-messages::-webkit-scrollbar { width: 4px; }
.prw-messages::-webkit-scrollbar-track { background: transparent; }
.prw-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.prw-msg { display: flex; flex-direction: column; gap: 6px; max-width: 85%; }
.prw-msg-user { align-self: flex-end; align-items: flex-end; }
.prw-msg-bot { align-self: flex-start; align-items: flex-start; }
.prw-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5;
  word-wrap: break-word; white-space: pre-wrap;
}
.prw-msg-user .prw-bubble {
  background: hsl(152 44% 30%); color: #fff;
  border-bottom-right-radius: 4px;
}
.prw-msg-bot .prw-bubble {
  background: #fff; color: hsl(222 47% 11%);
  border: 1px solid hsl(214 32% 91%);
  border-bottom-left-radius: 4px;
}

/* Печатает */
.prw-typing {
  padding: 12px 16px; background: #fff; border: 1px solid hsl(214 32% 91%);
  border-radius: 14px; border-bottom-left-radius: 4px;
  display: flex; gap: 4px; align-items: center;
}
.prw-typing-dot {
  width: 7px; height: 7px; border-radius: 50%; background: hsl(215 16% 47%);
  animation: prwTypingBounce 1.4s infinite ease-in-out;
}
.prw-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.prw-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes prwTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Ввод */
.prw-input-area {
  display: flex; gap: 8px; padding: 10px 12px;
  background: #fff; border-top: 1px solid hsl(214 32% 91%);
  flex-shrink: 0;
}
.prw-input {
  flex: 1; padding: 10px 14px; font-size: 14px;
  border: 1px solid hsl(214 32% 91%); border-radius: 20px;
  background: hsl(0 0% 100%); color: hsl(222 47% 11%);
  outline: none; transition: border-color 0.15s;
  font-family: inherit;
}
.prw-input:focus { border-color: hsl(152 44% 30%); }
.prw-input::placeholder { color: hsl(215 16% 47%); }
.prw-input:disabled { opacity: 0.6; }
.prw-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: hsl(152 44% 30%); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s, transform 0.15s;
}
.prw-send:hover:not(:disabled) { background: hsl(152 44% 20%); transform: scale(1.05); }
.prw-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Футер */
.prw-footer {
  padding: 6px 12px; font-size: 11px; color: hsl(215 16% 47%);
  text-align: center; background: #fff;
  border-top: 1px solid hsl(214 32% 91%);
  display: flex; align-items: center; justify-content: center; gap: 4px;
  flex-shrink: 0;
}
.prw-footer-phone { color: hsl(152 44% 30%); text-decoration: none; font-weight: 500; }
.prw-footer-phone:hover { text-decoration: underline; }

@media print { .prw-root { display: none !important; } }