.reviver-ai-launcher {
  position: fixed;
  z-index: 1250;
  right: 24px;
  bottom: 24px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(19, 79, 79, .18);
  border-radius: 50%;
  background: #9aca3c;
  color: #123f49;
  box-shadow: 0 14px 32px rgba(17, 63, 62, .22);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

/* O sistema global de animação de botões usa position:relative. O assistente
   precisa permanecer preso à viewport, inclusive depois que recebe essa classe. */
.ip-app .reviver-ai-launcher { position: fixed; }

.reviver-ai-launcher .site-icon { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reviver-ai-launcher:hover { background: #acd84b; box-shadow: 0 17px 38px rgba(17, 63, 62, .28); transform: translateY(-3px); }
.reviver-ai-launcher:focus-visible { outline: 3px solid rgba(35, 111, 115, .28); outline-offset: 3px; }
.reviver-ai-launcher.is-active { background: #236f73; color: #fff; box-shadow: 0 11px 25px rgba(17, 63, 62, .2); }
.reviver-ai-launcher.is-active .site-icon { animation: reviver-ai-bot-awake 420ms cubic-bezier(.2,.8,.2,1) both; }
.reviver-ai-launcher[hidden] { display: none; }

.reviver-ai-launcher.is-hero {
  position: absolute;
  z-index: 1250;
  top: -62px;
  right: -72px;
  bottom: auto;
  animation: reviver-ai-arrive 620ms 850ms cubic-bezier(.2,.8,.2,1) both;
}

.ip-app .reviver-ai-launcher.is-hero { position: absolute; }

.reviver-ai-launcher::after {
  position: absolute;
  right: calc(100% + 10px);
  width: max-content;
  max-width: 170px;
  padding: 7px 9px;
  border-radius: 6px;
  background: #174f4f;
  color: #fff;
  content: "Pergunte à Reviver";
  font-family: Inter, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateX(5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.reviver-ai-launcher:hover::after,
.reviver-ai-launcher:focus-visible::after { opacity: 1; transform: translateX(0); }

.reviver-ai-panel {
  position: fixed;
  z-index: 1300;
  right: 24px;
  bottom: 94px;
  display: grid;
  width: min(390px, calc(100vw - 32px));
  max-height: min(650px, calc(100vh - 120px));
  overflow: hidden;
  grid-template-rows: auto minmax(170px, 1fr) auto auto;
  border: 1px solid rgba(19, 79, 79, .18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 65px rgba(15, 58, 57, .25);
  font-family: Inter, Arial, sans-serif;
  color: #183d3d;
  transform-origin: bottom right;
  will-change: opacity, transform;
}

.reviver-ai-panel[hidden] { display: none; }
.reviver-ai-panel.is-opening { animation: reviver-ai-open 520ms cubic-bezier(.22, .68, .28, 1) both; }
.reviver-ai-panel.is-closing { animation: reviver-ai-close 300ms cubic-bezier(.4, 0, .65, 1) both; pointer-events: none; }
.reviver-ai-panel.is-opening .reviver-ai-header > *,
.reviver-ai-panel.is-opening .reviver-ai-form,
.reviver-ai-panel.is-opening .reviver-ai-suggestions,
.reviver-ai-panel.is-opening .reviver-ai-messages { animation: reviver-ai-content-in 420ms 120ms cubic-bezier(.22,.68,.28,1) both; }
.reviver-ai-panel.is-opening .reviver-ai-header > * { animation-delay: 80ms; }
.reviver-ai-panel.is-opening .reviver-ai-form { animation-delay: 230ms; }
.reviver-ai-panel.is-opening .reviver-ai-suggestions { animation-delay: 185ms; }
.reviver-ai-header { display: flex; align-items: center; gap: 11px; min-height: 66px; padding: 12px 13px; background: #174f4f; color: #fff; }
.reviver-ai-avatar { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #9aca3c; color: #123f49; }
.reviver-ai-avatar .site-icon { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reviver-ai-heading { min-width: 0; flex: 1; }
.reviver-ai-heading strong, .reviver-ai-heading small { display: block; }
.reviver-ai-heading strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.reviver-ai-heading small { margin-top: 2px; color: #cde0dd; font-size: 10px; }
.reviver-ai-close, .reviver-ai-send { display: grid; place-items: center; border: 0; cursor: pointer; }
.reviver-ai-close { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; }
.reviver-ai-close:hover { background: rgba(255,255,255,.18); }
.reviver-ai-close .site-icon, .reviver-ai-send .site-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.reviver-ai-messages { min-height: 210px; overflow-y: auto; padding: 15px 14px 8px; background: #f6f9f7; scroll-behavior: smooth; }
.reviver-ai-message { width: fit-content; max-width: 88%; margin: 0 0 10px; padding: 10px 11px; border-radius: 7px; background: #fff; box-shadow: 0 1px 3px rgba(18,63,73,.08); font-size: 12px; line-height: 1.55; white-space: pre-wrap; animation: reviver-ai-message-in 430ms cubic-bezier(.22,.68,.28,1) both; }
.reviver-ai-message.is-user { margin-left: auto; background: #dff0ba; color: #173e3d; }
.reviver-ai-message.is-loading { color: #687c78; }
.reviver-ai-message.is-loading::after { display: inline-block; min-width: 1.5em; margin-left: 3px; vertical-align: bottom; color: #236f73; content: "•••"; letter-spacing: 2px; animation: reviver-ai-typing 950ms ease-in-out infinite; }
.reviver-ai-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; animation: reviver-ai-actions-in 400ms 100ms cubic-bezier(.22,.68,.28,1) both; }
.reviver-ai-action { display: inline-flex; min-height: 31px; align-items: center; padding: 6px 9px; border: 1px solid #bdd694; border-radius: 6px; background: #fff; color: #236f73; font: 700 11px/1.2 Inter, Arial, sans-serif; text-decoration: none; }
.reviver-ai-action:hover { border-color: #86ad40; background: #f2f8e8; }

.reviver-ai-suggestions { display: flex; gap: 6px; overflow-x: auto; padding: 9px 13px; border-top: 1px solid #e0e9e5; background: #fff; scrollbar-width: thin; }
.reviver-ai-suggestion { min-height: 30px; flex: 0 0 auto; padding: 6px 9px; border: 1px solid #d1dfda; border-radius: 6px; background: #fff; color: #236f73; font: 650 10px/1.2 Inter, Arial, sans-serif; cursor: pointer; }
.reviver-ai-suggestion:hover { border-color: #8eb84b; background: #f5f9ee; }
.reviver-ai-form { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 8px; padding: 11px 12px; border-top: 1px solid #e0e9e5; background: #fff; }
.reviver-ai-input { min-width: 0; height: 42px; padding: 9px 11px; border: 1px solid #cbdad5; border-radius: 6px; outline: 0; background: #fff; color: #183d3d; font: 500 12px/1.2 Inter, Arial, sans-serif; }
.reviver-ai-input:focus { border-color: #57979a; box-shadow: 0 0 0 3px rgba(35,111,115,.12); }
.reviver-ai-send { width: 42px; height: 42px; border-radius: 6px; background: #236f73; color: #fff; transition: background 160ms ease, transform 160ms ease; }
.reviver-ai-send:hover { background: #174f4f; transform: translateY(-1px); }
.reviver-ai-send:active { transform: scale(.94); }
.reviver-ai-send:disabled, .reviver-ai-input:disabled { cursor: wait; opacity: .65; }

@keyframes reviver-ai-open {
  from { opacity: 0; transform: translateY(34px) scale(.92); }
  45% { opacity: .82; }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes reviver-ai-close { to { opacity: 0; transform: translateY(24px) scale(.94); } }
@keyframes reviver-ai-content-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes reviver-ai-message-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes reviver-ai-actions-in { from { opacity: 0; transform: translateY(9px); } }
@keyframes reviver-ai-bot-awake { 45% { transform: rotate(-7deg) scale(1.1); } }
@keyframes reviver-ai-typing { 0%, 100% { opacity: .28; transform: translateY(1px); } 50% { opacity: 1; transform: translateY(-1px); } }
@keyframes reviver-ai-arrive { from { opacity: 0; transform: translate(-14px, 12px) scale(.8); } }

@media (max-width: 1180px) {
  .reviver-ai-launcher.is-hero { top: 14px; right: 14px; }
}

@media (max-width: 680px) {
  .ip-app .reviver-ai-launcher,
  .ip-app .reviver-ai-launcher.is-hero {
    position: fixed;
    top: auto;
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }
  .reviver-ai-launcher.is-active { opacity: 0; pointer-events: none; transform: scale(.82); }
  .reviver-ai-launcher::after { display: none; }
  .reviver-ai-panel {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-height: min(620px, calc(72dvh - env(safe-area-inset-bottom)));
    grid-template-rows: auto minmax(112px, 1fr) auto auto;
    border-radius: 18px;
    transform-origin: bottom center;
  }
  .reviver-ai-header { min-height: 58px; padding: 9px 11px; }
  .reviver-ai-avatar { width: 36px; height: 36px; }
  .reviver-ai-heading strong { font-size: 13px; }
  .reviver-ai-heading small { font-size: 9px; }
  .reviver-ai-close { width: 38px; height: 38px; }
  .reviver-ai-messages { min-height: 112px; padding: 12px 11px 5px; }
  .reviver-ai-message { max-width: 94%; margin-bottom: 8px; padding: 9px 10px; font-size: 11px; line-height: 1.45; }
  .reviver-ai-suggestions {
    display: grid;
    max-height: 86px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 10px;
  }
  .reviver-ai-suggestion { width: 100%; min-height: 34px; padding: 6px 7px; white-space: normal; }
  .reviver-ai-form { grid-template-columns: minmax(0, 1fr) 44px; gap: 7px; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); }
  .reviver-ai-input { height: 44px; font-size: 16px; }
  .reviver-ai-send { width: 44px; height: 44px; }
}

@media (max-width: 390px) {
  .reviver-ai-panel { max-height: min(560px, calc(74dvh - env(safe-area-inset-bottom))); }
  .reviver-ai-suggestions { grid-template-columns: 1fr; max-height: 78px; }
}

@media (max-height: 520px) {
  .reviver-ai-launcher.is-active { opacity: 0; pointer-events: none; transform: scale(.82); }
  .reviver-ai-panel {
    right: 8px;
    bottom: 8px;
    max-height: calc(100dvh - 16px);
    grid-template-rows: auto minmax(72px, 1fr) auto auto;
  }
  .reviver-ai-header { min-height: 56px; padding-block: 8px; }
  .reviver-ai-messages { min-height: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .reviver-ai-launcher.is-hero,
  .reviver-ai-launcher.is-active .site-icon { animation: none; }
  .reviver-ai-panel.is-opening { animation: reviver-ai-open-reduced 320ms ease-out both !important; }
  .reviver-ai-panel.is-closing { animation: reviver-ai-close-reduced 220ms ease-in both !important; }
  .reviver-ai-panel.is-opening .reviver-ai-header > *,
  .reviver-ai-panel.is-opening .reviver-ai-form,
  .reviver-ai-panel.is-opening .reviver-ai-suggestions,
  .reviver-ai-panel.is-opening .reviver-ai-messages {
    animation: reviver-ai-content-reduced 260ms 55ms ease-out both !important;
  }
  .reviver-ai-message { animation: reviver-ai-message-reduced 280ms ease-out both !important; }
  .reviver-ai-actions { animation: reviver-ai-actions-reduced 260ms 50ms ease-out both !important; }
  .reviver-ai-messages { scroll-behavior: auto; }
}

@keyframes reviver-ai-open-reduced {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes reviver-ai-close-reduced { to { opacity: 0; transform: translateY(4px); } }
@keyframes reviver-ai-content-reduced { from { opacity: 0; } to { opacity: 1; } }
@keyframes reviver-ai-message-reduced { from { opacity: 0; } to { opacity: 1; } }
@keyframes reviver-ai-actions-reduced { from { opacity: 0; } to { opacity: 1; } }
