/* =================== TOKENS =================== */
:root {
  --green-900: #084d10;
  --green-700: #0c881e;
  --green-500: #2bb036;
  --green-50:  #eaf7ec;
  --green-100: #d1eedb;
  --orange:    #f5a623;
  --orange-d:  #e29010;
  --ink:       #1a1f24;
  --ink-2:     #4b5563;
  --muted:     #6b7280;
  --line:      #e5e7eb;
  --bg:        #ffffff;
  --bg-soft:   #f6f8f6;
  --white:     #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.15);
  --topbar-h:  68px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body { min-height: 100vh; min-height: 100dvh; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* =================== TOPBAR =================== */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar__inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo-img {
  height: 40px;
  width: auto;
  max-width: 160px;
  display: inline-block;
}
.brand-mark {
  width: 38px; height: 38px;
  background: var(--orange);
  color: var(--green-900);
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; letter-spacing: -0.5px;
  box-shadow: 0 2px 6px rgba(245,166,35,.3);
}
.brand-name {
  font-weight: 800; font-size: 22px;
  color: var(--green-700);
  letter-spacing: -0.5px;
}

.topnav {
  flex: 1;
  display: flex;
  gap: 4px;
}
.topnav__link {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.topnav__link:hover { background: var(--green-50); color: var(--green-700); }

.topbar__actions {
  display: flex;
  gap: 4px;
}
.action {
  border: 0;
  background: transparent;
  color: var(--green-700);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
}
.action:hover { background: var(--green-50); }
.action__lbl { font-size: 11px; }

.menu-toggle {
  display: none;
  border: 0; background: transparent;
  color: var(--green-700);
  width: 40px; height: 40px;
  border-radius: 8px;
  align-items: center; justify-content: center;
}

/* =================== HERO (banner real do e-agro) =================== */
.hero {
  position: relative;
  width: 100%;
  background: var(--green-700);
  overflow: hidden;
  aspect-ratio: 1320 / 420;
  max-height: 60vh;
}
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.hero__cta {
  position: absolute;
  left: 6%;
  bottom: 14%;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px;
  background: var(--white);
  color: var(--green-700);
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transition: transform .12s ease, box-shadow .15s ease;
}
.hero__cta:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.hero__cta:active { transform: translateY(0); }

/* =================== SERVIÇOS (cards) =================== */
.services {
  background: var(--white);
  padding: 28px 22px 56px;
}
.services__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
.service-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 20px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.service-card[data-chat] { cursor: pointer; }
.service-card[data-chat]:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--green-100);
}
.service-card__icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: #e6f3fb;
  color: #1c8cd9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.service-card:not([data-chat]) .service-card__icon {
  background: #fdecd0;
  color: var(--orange);
}

/* Pulso azul no card destacado (o que leva pra Eva) */
.service-card.pulse { position: relative; }
.service-card.pulse::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  border: 2.5px solid #1c8cd9;
  pointer-events: none;
  animation: service-card-pulse 2.4s infinite ease-out;
}
@keyframes service-card-pulse {
  0%   { transform: scale(1); opacity: 0.75; }
  70%  { transform: scale(1.06); opacity: 0; }
  100% { transform: scale(1.06); opacity: 0; }
}
.service-card h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: -0.2px;
  line-height: 1.25;
}
.service-card p {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.45;
  margin: 0 0 16px;
  flex: 1;
}
.service-card__link {
  color: var(--green-700);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
}
.service-card__link:hover { color: var(--green-900); }

/* =================== FABs (chat popup + mensageiro) =================== */
.chat-fab {
  position: fixed;
  bottom: 22px; right: 96px;        /* deixou o canto pro messenger-fab */
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--green-700);
  color: var(--white);
  border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(12,136,30,.4);
  z-index: 50;
  transition: transform .2s ease, background .15s ease, opacity .2s ease;
}
.chat-fab:hover { background: var(--green-900); transform: scale(1.06); }
.chat-fab:active { transform: scale(0.96); }
.chat-fab.hidden { opacity: 0; pointer-events: none; transform: scale(0.5); }

.messenger-fab {
  position: fixed;
  bottom: 22px; right: 22px;
  width: 62px; height: 62px;
  border-radius: 50%;
  background: #25D366;              /* fica como "anel" verde em volta da imagem */
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(37,211,102,.4);
  z-index: 50;
  transition: transform .2s ease, box-shadow .15s ease;
  /* overflow: hidden removido — estava cortando o pulso. A imagem se autoclipa com border-radius. */
}
.messenger-fab:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(37,211,102,.55); }
.messenger-fab:active { transform: scale(0.96); }
.messenger-fab__img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
/* Pulso herdado da .chat-fab__pulse — agora padronizado em azul nos dois FABs */

@media (max-width: 480px) {
  .chat-fab { right: 86px; width: 56px; height: 56px; }
  .messenger-fab { width: 56px; height: 56px; }
}
/* Pulso azul padronizado — mesmo visual do card CPR Digital, só com scale maior pros FABs */
.chat-fab__pulse {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2.5px solid #1c8cd9;
  background: transparent;
  pointer-events: none;
  z-index: -1;
  animation: pulse 2.4s infinite ease-out;
}
@keyframes pulse {
  0%   { transform: scale(1); opacity: 0.75; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* =================== CHAT PANEL =================== */
.chat-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 60;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.chat-backdrop.open { opacity: 1; pointer-events: auto; }

.chat-panel {
  position: fixed;
  inset: 0;
  bottom: var(--kb-h, 0px);
  background: var(--bg-soft);
  z-index: 70;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), opacity .25s ease, bottom .2s ease;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
.chat-panel.open { transform: translateY(0); pointer-events: auto; }
@media (min-width: 768px) {
  .chat-panel {
    inset: auto;
    bottom: 22px; right: 22px;
    width: 400px; height: 640px;
    max-height: calc(100vh - 44px);
    border-radius: 18px;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
  .chat-panel.open { transform: translateY(0) scale(1); opacity: 1; }
}

.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 18px 14px 14px;
  background: var(--bg-soft);
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #cbd5d1; border-radius: 4px; }

.welcome { text-align: center; padding: 24px 12px 10px; color: var(--ink-2); }
.welcome__avatar {
  width: 88px; height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 14px;
  display: block;
  box-shadow: 0 4px 16px rgba(12,136,30,.25);
  border: 3px solid var(--white);
}
.welcome h3 { color: var(--green-900); font-size: 20px; margin: 0 0 6px; font-weight: 700; }
.welcome p { margin: 0 0 18px; font-size: 14px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.quick-action {
  border: 1px solid var(--green-500);
  background: var(--white);
  color: var(--green-700);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  transition: background .15s ease;
}
.quick-action:hover { background: var(--green-50); }

.msg { margin: 10px 0; display: flex; gap: 8px; align-items: flex-end; }
.msg.user { justify-content: flex-end; }
.msg.user .avatar { display: none; }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 14.5px;
  word-wrap: break-word;
}
.msg.user .bubble {
  background: var(--green-700);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.msg.eva .bubble {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}
.msg.eva .bubble strong { color: var(--green-900); font-weight: 600; }
.msg.system { justify-content: center; }
.msg.system .avatar { display: none; }
.msg.system .bubble {
  background: #fff8e7;
  color: #92400e;
  border: 1px solid #fcd980;
  font-size: 12.5px;
  font-style: italic;
  max-width: 90%;
  text-align: center;
  border-radius: 8px;
}

.typing {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 8px 46px;
  color: var(--muted);
  font-size: 13.5px;
  font-style: italic;
}
.typing::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green-500);
  animation: typing-dot 1.2s infinite ease-in-out;
}
@keyframes typing-dot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

.composer {
  background: var(--white);
  border-top: 1px solid var(--line);
  padding: 8px 12px 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.composer__toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}
.toolbar-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--green-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.toolbar-btn:hover { background: var(--green-50); }
.toolbar-btn--icon {
  padding: 6px;
  width: 30px; height: 30px;
  justify-content: center;
  color: var(--muted);
}
.toolbar-btn--icon:hover { background: #f1f3f5; color: var(--ink); }
.composer__row {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--green-50);
  border-radius: 22px;
  padding: 4px 4px 4px 6px;
  border: 1px solid var(--green-100);
}
.composer__attach-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--green-700);
  cursor: pointer;
  transition: background .15s ease;
  flex-shrink: 0;
}
.composer__attach-icon:hover { background: var(--green-100); }
.composer__row:focus-within { border-color: var(--green-500); background: var(--white); }
.composer textarea {
  flex: 1; border: 0; background: transparent; outline: none;
  resize: none; padding: 9px 0;
  font-size: 14.5px; max-height: 120px;
  color: var(--ink);
}
.composer textarea::placeholder { color: var(--muted); }
.composer__send {
  width: 38px; height: 38px; border: 0;
  border-radius: 50%;
  background: var(--orange);
  color: var(--green-900);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .12s ease;
}
.composer__send:hover { background: var(--orange-d); }
.composer__send:active { transform: scale(0.95); }
.composer__send:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
#file-input { display: none; }

/* =================== RESPONSIVE =================== */
@media (max-width: 1100px) {
  .services__inner { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .topnav { display: none; }
}
@media (max-width: 720px) {
  .topbar__actions { display: none; }
  .menu-toggle { display: inline-flex; }
  .services__inner { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .services { padding: 22px 16px 40px; }
  .hero { aspect-ratio: 16 / 9; max-height: 50vh; }
  .hero__cta { padding: 9px 18px; font-size: 13.5px; bottom: 10%; left: 5%; }
}
@media (max-width: 480px) {
  .services__inner { grid-template-columns: 1fr; }
  .hero { aspect-ratio: 4 / 3; max-height: 45vh; }
}
