.plena-widget {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  grid-template-columns: auto minmax(0, 230px);
  align-items: end;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-18px, 22px, 0) scale(0.96);
  transition: opacity 260ms ease, transform 260ms ease;
}

.plena-widget.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.plena-avatar-button {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: end center;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 70%, rgba(213, 164, 65, 0.26), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 243, 255, 0.94));
  box-shadow: 0 22px 42px rgba(1, 25, 63, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.76);
  cursor: pointer;
}

.plena-avatar-button::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(213, 164, 65, 0.42), transparent 68%);
  opacity: 0.72;
  animation: plenaPulse 2.8s ease-in-out infinite;
}

.plena-avatar-button img {
  position: relative;
  z-index: 1;
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(1, 25, 63, 0.2));
  transform: translateY(4px);
}

.plena-bubble {
  position: relative;
  align-self: center;
  max-width: 230px;
  border: 1px solid rgba(18, 84, 173, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px 14px;
  color: #14213a;
  font: 800 14px/1.28 "Inter", system-ui, sans-serif;
  box-shadow: 0 18px 38px rgba(9, 38, 83, 0.16);
  backdrop-filter: blur(14px);
}

.plena-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 22px;
  width: 12px;
  height: 12px;
  border-left: 1px solid rgba(18, 84, 173, 0.16);
  border-bottom: 1px solid rgba(18, 84, 173, 0.16);
  background: inherit;
  transform: rotate(45deg);
}

.plena-panel {
  position: fixed;
  left: 24px;
  bottom: 140px;
  z-index: 90;
  width: min(420px, calc(100vw - 48px));
  height: min(660px, calc(100svh - 156px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(18, 84, 173, 0.14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(1, 25, 63, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-12px, 18px, 0) scale(0.98);
  transition: opacity 220ms ease, transform 220ms ease;
}

.plena-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
}

.plena-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(1, 25, 63, 0.96), rgba(18, 84, 173, 0.92)),
    #01193f;
  padding: 14px 14px 14px 16px;
  color: #ffffff;
}

.plena-panel-photo {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
  object-position: center top;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.42);
}

.plena-panel-title {
  min-width: 0;
  flex: 1;
}

.plena-panel-title strong {
  display: block;
  font-size: 16px;
  line-height: 1.15;
}

.plena-panel-title span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.plena-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
}

.plena-messages {
  min-height: 0;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(246, 249, 253, 0.96), rgba(255, 255, 255, 0.96)),
    #f6f9fd;
  padding: 18px 14px;
}

.plena-message {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.plena-message-bubble {
  max-width: 86%;
  border-radius: 8px;
  padding: 11px 12px;
  font: 600 14px/1.48 "Inter", system-ui, sans-serif;
  white-space: pre-wrap;
}

.plena-message.assistant .plena-message-bubble {
  border: 1px solid rgba(18, 84, 173, 0.14);
  background: #ffffff;
  color: #14213a;
  box-shadow: 0 10px 24px rgba(9, 38, 83, 0.06);
}

.plena-message.user {
  justify-items: end;
}

.plena-message.user .plena-message-bubble {
  background: #1254ad;
  color: #ffffff;
}

.plena-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
}

.plena-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1254ad;
  animation: plenaTyping 1s ease-in-out infinite;
}

.plena-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.plena-typing span:nth-child(3) {
  animation-delay: 240ms;
}

.plena-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}

.plena-chip {
  border: 1px solid rgba(18, 84, 173, 0.2);
  border-radius: 999px;
  background: #ffffff;
  color: #01193f;
  padding: 8px 10px;
  font: 800 12px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
}

.plena-lead-card {
  display: none;
  margin: 4px 0 14px;
  border: 1px solid rgba(213, 164, 65, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf0, #ffffff);
  padding: 12px;
}

.plena-lead-card.is-open {
  display: block;
}

.plena-lead-card strong {
  display: block;
  margin-bottom: 8px;
  color: #01193f;
  font-size: 14px;
}

.plena-form-grid {
  display: grid;
  gap: 8px;
}

.plena-field {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(18, 84, 173, 0.2);
  border-radius: 8px;
  background: #ffffff;
  color: #14213a;
  font: 700 13px/1.35 "Inter", system-ui, sans-serif;
  padding: 0 11px;
  outline: none;
}

textarea.plena-field {
  min-height: 74px;
  padding-top: 10px;
  resize: vertical;
}

.plena-submit-lead,
.plena-send {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #1254ad;
  color: #ffffff;
  font: 900 13px/1 "Inter", system-ui, sans-serif;
  cursor: pointer;
}

.plena-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid rgba(18, 84, 173, 0.12);
  background: #ffffff;
  padding: 12px;
}

.plena-input {
  min-height: 46px;
  border: 1px solid rgba(18, 84, 173, 0.2);
  border-radius: 8px;
  background: #f9fbff;
  color: #14213a;
  font: 700 14px/1.35 "Inter", system-ui, sans-serif;
  padding: 0 12px;
  outline: none;
}

.plena-send {
  width: 48px;
  display: grid;
  place-items: center;
}

.plena-send svg,
.plena-close svg {
  width: 18px;
  height: 18px;
}

.plena-send:disabled,
.plena-submit-lead:disabled {
  cursor: wait;
  opacity: 0.58;
}

@keyframes plenaPulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.46;
  }

  50% {
    transform: scale(1.08);
    opacity: 0.82;
  }
}

@keyframes plenaTyping {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.36;
  }

  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .plena-widget {
    left: 10px;
    bottom: 12px;
    grid-template-columns: auto minmax(0, 190px);
    gap: 8px;
  }

  .plena-avatar-button {
    width: 82px;
    height: 82px;
  }

  .plena-avatar-button img {
    width: 92px;
    height: 92px;
  }

  .plena-bubble {
    max-width: 190px;
    padding: 10px 11px;
    font-size: 12px;
  }

  .plena-panel {
    left: 10px;
    right: 10px;
    bottom: 104px;
    width: auto;
    height: min(610px, calc(100svh - 118px));
  }

  .plena-message-bubble {
    max-width: 92%;
  }
}
