/* Виджет консультанта Sivik. Самодостаточен: подключается на любую страницу
   одним <link> и одним <script>, чужую вёрстку не трогает. */

.sv-chat, .sv-chat * { box-sizing: border-box; }

.sv-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 9998;
  width: 60px; height: 60px; border: 0; border-radius: 50%;
  background: #fca800; color: #fff; cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .22);
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, background .18s ease;
}
.sv-fab:hover { background: #e09600; transform: scale(1.06); }
.sv-fab svg { width: 28px; height: 28px; fill: #fff; }
.sv-fab.sv-hidden { display: none; }
.sv-fab::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid #fca800; animation: sv-pulse 2.4s infinite;
}
@keyframes sv-pulse {
  0%   { transform: scale(1);    opacity: .7; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

.sv-teaser {
  position: fixed; right: 92px; bottom: 32px; z-index: 9998;
  max-width: 250px; background: #fff; color: #1c2126;
  border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .16); cursor: pointer;
  animation: sv-slide .35s ease;
}
.sv-teaser b { display: block; margin-bottom: 2px; }
.sv-teaser .sv-teaser-x {
  position: absolute; top: 4px; right: 8px; border: 0; background: none;
  font-size: 17px; line-height: 1; color: #9aa5b0; cursor: pointer;
}
@keyframes sv-slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sv-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 9999;
  width: 400px; max-width: calc(100vw - 32px);
  height: 620px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .26);
  display: none; flex-direction: column;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1c2126;
}
.sv-panel.sv-open { display: flex; animation: sv-slide .22s ease; }

.sv-head { background: #1c2126; color: #fff; padding: 13px 16px; display: flex; align-items: center; gap: 11px; }
.sv-avatar { width: 36px; height: 36px; border-radius: 50%; background: #fca800; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.sv-head-t { flex: 1; min-width: 0; }
.sv-head-t b { display: block; font-size: 15px; }
.sv-head-t span { font-size: 12px; color: #9aa5b0; }
.sv-x { border: 0; background: none; color: #9aa5b0; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 2px; }
.sv-x:hover { color: #fff; }

.sv-body { flex: 1; overflow-y: auto; padding: 16px; background: #f5f7f9; }

.sv-msg { margin-bottom: 13px; display: flex; }
.sv-msg-in  { justify-content: flex-start; }
.sv-msg-out { justify-content: flex-end; }
.sv-bubble {
  max-width: 86%; padding: 10px 13px; border-radius: 12px;
  font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
}
.sv-msg-in  .sv-bubble { background: #fff; border: 1px solid #e6e9ec; border-bottom-left-radius: 4px; }
.sv-msg-out .sv-bubble { background: #fca800; color: #fff; border-bottom-right-radius: 4px; }
.sv-bubble ul { margin: 6px 0 0 18px; padding: 0; }
.sv-bubble li { margin-bottom: 3px; }
.sv-bubble b { font-weight: 600; }


.sv-lead-card { background: #e8f6ec; border: 1px solid #b7e0c2; border-radius: 10px; padding: 11px 13px; font-size: 13.5px; color: #1e5b30; margin-bottom: 13px; }
.sv-lead-card b { display: block; margin-bottom: 3px; }

.sv-err { background: #fdecea; border: 1px solid #f5c6c2; color: #8f2c22; border-radius: 10px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 13px; }

.sv-typing { display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid #e6e9ec; border-radius: 12px; border-bottom-left-radius: 4px; width: fit-content; }
.sv-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b9c2ca; animation: sv-blink 1.3s infinite; }
.sv-typing i:nth-child(2) { animation-delay: .18s; }
.sv-typing i:nth-child(3) { animation-delay: .36s; }
@keyframes sv-blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.sv-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 16px 12px; background: #f5f7f9; }
.sv-chips button {
  border: 1px solid #dfe4e8; background: #fff; color: #1c2126;
  border-radius: 16px; padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.sv-chips button:hover { border-color: #fca800; color: #b57600; }

.sv-foot { border-top: 1px solid #e6e9ec; padding: 10px 12px; background: #fff; }
.sv-input { display: flex; gap: 8px; align-items: flex-end; }
.sv-input textarea {
  flex: 1; resize: none; border: 1px solid #dfe4e8; border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14.5px; max-height: 110px; min-height: 42px;
  outline: none; font-family: inherit;
}
.sv-input textarea:focus { border-color: #fca800; }
.sv-send {
  flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 10px;
  background: #fca800; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.sv-send:disabled { background: #d8dde1; cursor: default; }
.sv-send svg { width: 19px; height: 19px; fill: #fff; }
.sv-note { font-size: 11px; color: #9aa5b0; text-align: center; margin-top: 7px; }

@media (max-width: 480px) {
  .sv-panel { right: 0; bottom: 0; width: 100%; max-width: 100%; height: 100%; max-height: 100%; border-radius: 0; }
  .sv-teaser { right: 90px; max-width: calc(100vw - 120px); }
  .sv-fab { right: 14px; bottom: 14px; }
}
