.raissa-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 90;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(145deg, #21325b, #00a8ff);
  color: white;
  box-shadow: 0 16px 40px rgba(0, 168, 255, 0.4);
  display: grid;
  place-items: center;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
  animation: raissa-pulse 2.8s ease-in-out infinite;
}

.raissa-fab:hover {
  transform: scale(1.08) rotate(-4deg);
  box-shadow: 0 20px 48px rgba(0, 168, 255, 0.5);
}

.raissa-fab__avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  overflow: hidden;
}

.raissa-fab__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.raissa-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.75rem;
  z-index: 95;
  width: min(400px, calc(100vw - 1.5rem));
  height: min(560px, calc(100vh - 7.5rem));
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: raissa-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.raissa-panel.is-open {
  display: flex;
}

.raissa-panel__head {
  padding: 1rem 1.1rem;
  background: linear-gradient(120deg, #1b2d50, #21325b 45%, #0077b8);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.raissa-panel__avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 168, 255, 0.35);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  overflow: hidden;
}

.raissa-panel__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.raissa-panel__meta {
  flex: 1;
  min-width: 0;
}

.raissa-panel__meta strong {
  display: block;
  font-size: 0.98rem;
}

.raissa-panel__meta span {
  font-size: 0.78rem;
  opacity: 0.8;
}

.raissa-panel__close {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.raissa-panel__close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.raissa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background:
    radial-gradient(400px 200px at 100% 0%, rgba(0, 168, 255, 0.08), transparent),
    #f7faff;
}

.raissa-msg {
  max-width: 88%;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: normal;
  animation: rise 0.35s var(--ease) both;
}

.raissa-msg p {
  margin: 0 0 0.55rem;
}

.raissa-msg p:last-child {
  margin-bottom: 0;
}

.raissa-msg ul,
.raissa-msg ol {
  margin: 0.35rem 0 0.55rem;
  padding-left: 1.2rem;
}

.raissa-msg li {
  margin: 0.2rem 0;
}

.raissa-msg a {
  color: var(--brand, #00a8ff);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.raissa-msg--user a {
  color: #fff;
}

.raissa-msg strong {
  color: var(--brand-deep, #21325b);
  font-weight: 700;
}

.raissa-msg--user strong {
  color: inherit;
}

.raissa-msg code {
  font-size: 0.86em;
  background: rgba(33, 50, 91, 0.08);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.raissa-msg--bot {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 4px;
}

.raissa-msg--user {
  align-self: flex-end;
  background: linear-gradient(135deg, #21325b, #00a8ff);
  color: white;
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.raissa-msg--system {
  align-self: center;
  background: transparent;
  color: var(--ink-faint);
  font-size: 0.78rem;
  padding: 0.2rem;
}

.raissa-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 0.75rem 0.9rem;
}

.raissa-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  animation: typing 1.1s infinite ease-in-out;
}

.raissa-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.raissa-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.raissa-composer {
  border-top: 1px solid var(--line);
  background: white;
  padding: 0.65rem 0.75rem;
}

.raissa-composer__row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.6rem;
}

.raissa-form {
  display: flex;
  flex: 1;
  gap: 0.35rem;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.raissa-form[hidden] {
  display: none !important;
}

.raissa-composer.is-recording .raissa-attach,
.raissa-composer.is-recording .raissa-attach-preview {
  display: none !important;
}

.raissa-attach[hidden],
.raissa-mic[hidden] {
  display: none !important;
}

.raissa-form input {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  outline: none;
  min-width: 0;
  background: #fff;
}

.raissa-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.15);
}

.raissa-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

.raissa-mic,
.raissa-attach,
.raissa-send,
.raissa-rec__cancel,
.raissa-rec__send,
.raissa-voice__play {
  border: none;
  background: transparent;
  color: #54656f;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.raissa-mic:hover,
.raissa-attach:hover,
.raissa-send:hover,
.raissa-rec__cancel:hover,
.raissa-rec__send:hover,
.raissa-voice__play:hover {
  background: rgba(0, 0, 0, 0.05);
}

.raissa-attach-preview {
  padding: 0.45rem 0.15rem 0.15rem;
}

.raissa-attach-preview[hidden] {
  display: none !important;
}

.raissa-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 12px;
  background: #eef6fc;
  border: 1px solid var(--line);
}

.raissa-attach-chip img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
}

.raissa-attach-chip__icon {
  font-size: 1.2rem;
}

.raissa-attach-chip__name {
  font-size: 0.82rem;
  color: var(--ink);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.raissa-attach-chip__x {
  border: none;
  background: transparent;
  cursor: pointer;
  color: #54656f;
  font-size: 0.9rem;
  padding: 0.15rem 0.35rem;
}

.raissa-msg--file {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: min(92%, 260px);
  padding: 0.45rem;
}

.raissa-msg__img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
}

.raissa-msg__doc {
  padding: 0.55rem 0.65rem;
  font-size: 0.88rem;
}

.raissa-msg__caption {
  padding: 0.15rem 0.35rem 0.25rem;
  font-size: 0.88rem;
  line-height: 1.35;
}

.raissa-send,
.raissa-rec__send {
  color: #00a8ff;
}

.raissa-mic[hidden],
.raissa-rec__cancel[hidden] {
  display: none !important;
}

/* Gravação: mesma linha do composer */
.raissa-rec {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  margin: 0;
}

.raissa-rec[hidden] {
  display: none !important;
}

.raissa-rec__time {
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  color: #00a8ff;
  font-weight: 700;
  min-width: 2.4rem;
  flex-shrink: 0;
}

.raissa-rec__wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 1.75rem;
  min-width: 0;
  overflow: hidden;
}

.raissa-rec__wave i {
  display: block;
  flex: 1 1 0;
  max-width: 4px;
  min-width: 2px;
  height: 35%;
  border-radius: 2px;
  background: #00a8ff;
  opacity: 0.85;
  transform-origin: center;
  animation: raissa-wave 1s ease-in-out infinite;
}

.raissa-rec__wave i:nth-child(3n) { animation-delay: 0.12s; height: 70%; }
.raissa-rec__wave i:nth-child(3n+1) { animation-delay: 0.24s; height: 100%; }
.raissa-rec__wave i:nth-child(3n+2) { animation-delay: 0.06s; height: 48%; }
.raissa-rec__wave i:nth-child(4n) { animation-delay: 0.3s; height: 82%; }
.raissa-rec__wave i:nth-child(5n) { animation-delay: 0.18s; height: 55%; }

/* Player estilo WhatsApp (cores da Raissa) */
.raissa-msg--audio {
  padding: 0.45rem 0.65rem 0.4rem;
  max-width: min(92%, 280px);
}

.raissa-msg--user.raissa-msg--audio {
  background: linear-gradient(135deg, #00a8ff, #0086e0);
}

.raissa-voice {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 200px;
  width: 240px;
  max-width: 100%;
}

.raissa-voice audio {
  display: none;
}

.raissa-voice__play {
  width: 2.1rem;
  height: 2.1rem;
  color: #21325b;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.raissa-msg--user .raissa-voice__play {
  color: #0086e0;
  background: #fff;
}

.raissa-msg--bot .raissa-voice__play {
  color: #0086e0;
  background: #e8f6ff;
}

.raissa-voice__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.raissa-voice__track {
  position: relative;
  height: 1.35rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.raissa-voice__wave {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 100%;
}

.raissa-voice__wave--base {
  opacity: 0.4;
}

.raissa-voice__wave--played {
  opacity: 1;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 200px;
}

.raissa-voice__wave i {
  display: block;
  flex: 1 1 0;
  max-width: 3px;
  min-width: 2px;
  height: var(--h, 40%);
  border-radius: 1px;
  background: currentColor;
}

.raissa-msg--user .raissa-voice__wave {
  color: #fff;
}

.raissa-msg--bot .raissa-voice__wave {
  color: #5a6b7d;
}

.raissa-voice__progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  overflow: hidden;
  pointer-events: none;
}

.raissa-voice__knob {
  position: absolute;
  right: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.35);
  z-index: 1;
}

.raissa-msg--user .raissa-voice__knob {
  background: #e8f6ff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.raissa-msg--bot .raissa-voice__knob {
  background: #00a8ff;
}

.raissa-voice__dur {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  line-height: 1;
}

.raissa-msg--user .raissa-voice__dur {
  color: rgba(255, 255, 255, 0.92);
}

.raissa-msg--bot .raissa-voice__dur {
  color: #5a6b7d;
}

@keyframes raissa-wave {
  0%,
  100% {
    transform: scaleY(0.4);
    opacity: 0.55;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes raissa-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes raissa-pulse {
  0%,
  100% {
    box-shadow: 0 16px 40px rgba(0, 168, 255, 0.4);
  }
  50% {
    box-shadow: 0 16px 40px rgba(0, 168, 255, 0.55), 0 0 0 12px rgba(0, 168, 255, 0.12);
  }
}

@keyframes typing {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 520px) {
  .raissa-panel {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 5.25rem;
  }

  .raissa-fab {
    right: 0.9rem;
    bottom: 5.5rem;
  }
}
