/* =========================================================
   Chatbot IQ — interface do site da Fran
   Usa os tokens do R3 (site.css). Isolado sob .fcb.
   ========================================================= */
.fcb {
  --fcb-paper: var(--paper, #fcf8f9);
  --fcb-blush: var(--blush, #f9e1e5);
  --fcb-cocoa: var(--cocoa, #61423a);
  --fcb-cocoa-deep: var(--cocoa-deep, #4a312b);
  --fcb-cocoa-2: var(--cocoa-2, #74524a);
  --fcb-on-cocoa: var(--on-cocoa, #fbeee9);
  --fcb-champagne: var(--champagne, #d8c29e);
  --fcb-gold-soft: var(--gold-soft, #c9aa79);
  --fcb-gold-ink: var(--gold-ink, #86663a);
  --fcb-line: var(--line-gold, rgba(201, 170, 121, .55));
  --fcb-ease: var(--ease, cubic-bezier(.16, 1, .3, 1));
  font-family: var(--sans, system-ui, sans-serif);
  color: var(--fcb-cocoa);
}
.fcb svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.fcb-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Lançador ---------- */
.fcb-launcher {
  position: fixed; z-index: 45; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: inline-flex; align-items: center; gap: 0;
  height: 56px; min-width: 56px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--fcb-line);
  background: rgba(252, 248, 249, .94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--fcb-cocoa);
  box-shadow: 0 14px 32px -18px rgba(74, 49, 43, .6);
  cursor: pointer; touch-action: manipulation;
  transition: bottom .45s var(--fcb-ease), box-shadow .3s var(--fcb-ease), transform .3s var(--fcb-ease);
}
.fcb-launcher__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--fcb-blush); }
.fcb-launcher__label {
  max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0;
  font: 500 .92rem/1 var(--sans, system-ui); letter-spacing: .005em;
  transition: max-width .45s var(--fcb-ease), opacity .3s var(--fcb-ease), margin .45s var(--fcb-ease);
}
.fcb-launcher:hover .fcb-launcher__label,
.fcb-launcher:focus-visible .fcb-launcher__label { max-width: 180px; opacity: 1; margin: 0 10px 0 10px; }
.fcb-launcher:hover { box-shadow: 0 18px 36px -18px rgba(74, 49, 43, .7); }
.fcb-launcher:active { transform: scale(.97); }
.fcb-launcher:focus-visible { outline: 2px solid var(--fcb-cocoa); outline-offset: 3px; }
.fcb-launcher__dot {
  position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--fcb-gold-soft); box-shadow: 0 0 0 2px var(--fcb-paper);
  opacity: 0; transition: opacity .3s var(--fcb-ease);
}
/* O ponto aparece quando chegou resposta (do assistente ou da Fran) que a pessoa ainda não viu */
.fcb.has-unread:not([data-state="open"]) .fcb-launcher__dot { opacity: 1; }
/* Não cobre a ação fixa de agendar do celular */
@media (max-width: 1199px) {
  .dock.is-visible ~ .fcb .fcb-launcher { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .dock.is-visible ~ .fcb .fcb-panel { bottom: calc(152px + env(safe-area-inset-bottom)); height: min(640px, calc(100dvh - 190px)); }
}

/* ---------- Painel ---------- */
.fcb-panel {
  position: fixed; z-index: 60; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 120px));
  border-radius: 24px; overflow: hidden;
  background: var(--fcb-paper);
  box-shadow: 0 30px 70px -30px rgba(74, 49, 43, .55), 0 0 0 1px rgba(201, 170, 121, .28);
  transform-origin: bottom right;
}
.fcb-panel[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .fcb[data-state="open"] .fcb-panel { animation: fcb-in .42s var(--fcb-ease) both; }
}
@keyframes fcb-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.fcb-head {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: 14px 10px 14px 16px;
  background: var(--fcb-blush);
  border-bottom: 1px solid var(--fcb-line);
}
.fcb-head__mark { width: 40px; height: 40px; padding: 7px; border-radius: 50%; background: var(--fcb-paper); box-shadow: inset 0 0 0 1px var(--fcb-line); object-fit: contain; flex: none; }
.fcb-head__id { flex: 1; min-width: 0; }
.fcb-head__name { margin: 0; font: 400 1.18rem/1.1 var(--serif, Georgia, serif); letter-spacing: -.01em; color: var(--fcb-cocoa-deep); }
.fcb-head__sub { margin: 2px 0 0; font: 500 .78rem/1.3 var(--sans, system-ui); letter-spacing: .01em; color: var(--fcb-cocoa-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcb-head__status { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; font-size: .78rem; color: var(--fcb-cocoa-2); }
.fcb-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fcb-gold-soft); box-shadow: 0 0 0 3px rgba(201, 170, 121, .25); }
.fcb-icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--fcb-cocoa); cursor: pointer;
  transition: background-color .25s var(--fcb-ease);
}
.fcb-icon-btn:hover { background: rgba(252, 248, 249, .7); }
.fcb-icon-btn:focus-visible, .fcb-send:focus-visible, .fcb-chip:focus-visible, .fcb-log:focus-visible { outline: 2px solid var(--fcb-cocoa); outline-offset: 2px; }

.fcb-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 14px 10px; scrollbar-color: var(--fcb-champagne) transparent; }
.fcb-log { display: flex; flex-direction: column; gap: 10px; outline: none; border-radius: 8px; }

/* Bolhas */
.fcb-msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.fcb-msg p { margin: 0; white-space: pre-wrap; }
/* Resposta escrita pela própria Fran (no painel dela) */
.fcb-msg--fran { align-self: flex-start; background: #fff; color: var(--fcb-cocoa-deep); border: 1px solid var(--fcb-gold-soft); border-bottom-left-radius: 6px; }
.fcb-msg--fran strong { font: 600 .78rem/1.2 var(--sans, system-ui); letter-spacing: .04em; text-transform: uppercase; color: var(--fcb-gold-ink); margin-bottom: 3px; }
/* Aviso do atendimento (a Fran entrou, encerrou...) */
.fcb-msg--aviso { align-self: center; max-width: 92%; padding: 4px 10px; background: transparent; color: var(--fcb-cocoa-2); font-size: .8rem; text-align: center; }
/* Falha de envio ou de conexão: diz o que houve e, se for o caso, oferece o WhatsApp */
.fcb-alert { align-self: stretch; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 10px 12px;
  border-radius: 14px; background: #fbf0dc; color: #6b4a12; font-size: .88rem; line-height: 1.4; }
.fcb-alert p { margin: 0; }
/* Ações fixas (Agendar online), logo abaixo da conversa */
.fcb-actions { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 14px 0; background: var(--fcb-paper); }
.fcb-actions:empty { display: none; }
.fcb-actions .fcb-chip { min-height: 40px; }
.fcb-actions .fcb-chip svg { width: 18px; height: 18px; }
.fcb-send:disabled { opacity: .55; cursor: progress; }
.fcb-msg strong { display: block; margin-bottom: 4px; font: 400 1.08rem/1.2 var(--serif, Georgia, serif); color: var(--fcb-cocoa-deep); }
.fcb-msg--bot { align-self: flex-start; background: var(--fcb-blush); color: var(--fcb-cocoa); border-bottom-left-radius: 6px; }
.fcb-msg--user { align-self: flex-end; background: var(--fcb-cocoa); color: var(--fcb-on-cocoa); border-bottom-right-radius: 6px; }
.fcb-msg--typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 14px 16px; background: var(--fcb-blush); border-bottom-left-radius: 6px; }
.fcb-msg--typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--fcb-gold-soft); }
@media (prefers-reduced-motion: no-preference) {
  .fcb-msg--typing span { animation: fcb-dot 1s ease-in-out infinite; }
  .fcb-msg--typing span:nth-child(2) { animation-delay: .15s; }
  .fcb-msg--typing span:nth-child(3) { animation-delay: .3s; }
  .fcb-msg--bot, .fcb-msg--user, .fcb-msg--fran, .fcb-options { animation: fcb-rise .35s var(--fcb-ease) both; }
}
@keyframes fcb-dot { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }
@keyframes fcb-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Opções rápidas */
.fcb-options { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 4px; }
.fcb-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 15px; border-radius: 999px;
  border: 1px solid var(--fcb-gold-soft); background: var(--fcb-paper); color: var(--fcb-cocoa);
  font: 500 .88rem/1.2 var(--sans, system-ui); text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color .25s var(--fcb-ease), border-color .25s var(--fcb-ease);
}
.fcb-chip:hover { background: var(--straw, #ece2cf); }
.fcb-chip--wa { background: var(--fcb-cocoa); border-color: var(--fcb-cocoa); color: var(--fcb-on-cocoa); }
.fcb-chip--wa:hover { background: var(--fcb-cocoa-deep); }
.fcb-chip--wa svg { width: 18px; height: 18px; color: var(--fcb-champagne); }

/* Nota de modo local */
.fcb-note { flex: none; margin: 0; padding: 7px 16px; font-size: .72rem; line-height: 1.35; text-align: center; color: var(--fcb-cocoa-2); background: var(--fcb-paper); border-top: 1px solid rgba(201, 170, 121, .3); }
.fcb-note[hidden] { display: none; }

/* Campo de mensagem */
.fcb-composer {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) 14px;
  background: var(--fcb-paper); border-top: 1px solid var(--fcb-line);
}
.fcb-composer[hidden] { display: none; }
.fcb-composer textarea {
  flex: 1; min-height: 44px; max-height: 120px; resize: none; overflow-y: hidden;
  padding: 11px 14px; border-radius: 22px; border: 1px solid rgba(201, 170, 121, .7);
  background: #fff; color: var(--fcb-cocoa);
  font: 400 1rem/1.4 var(--sans, system-ui);
}
.fcb-composer textarea::placeholder { color: #8a6c64; }
.fcb-composer textarea:focus { outline: 2px solid var(--fcb-cocoa); outline-offset: 1px; border-color: transparent; }
.fcb-send {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  background: var(--fcb-cocoa); color: var(--fcb-on-cocoa); cursor: pointer;
  transition: background-color .25s var(--fcb-ease), transform .25s var(--fcb-ease);
}
.fcb-send:hover { background: var(--fcb-cocoa-deep); }
.fcb-send:active { transform: scale(.96); }
.fcb-frame { width: 100%; height: 100%; border: 0; display: block; }

/* Minimizado (desktop/tablet): só o cabeçalho */
.fcb[data-state="minimized"] .fcb-panel { height: auto !important; }
.fcb[data-state="minimized"] .fcb-body,
.fcb[data-state="minimized"] .fcb-actions,
.fcb[data-state="minimized"] .fcb-note,
.fcb[data-state="minimized"] .fcb-composer { display: none; }
.fcb[data-state="minimized"] [data-fcb-min] svg { transform: rotate(90deg); }

/* ---------- Celular: folha quase em tela cheia ---------- */
@media (max-width: 699px) {
  .fcb-panel {
    top: 0; left: 0; right: 0; bottom: auto;
    width: 100%; height: 100dvh; border-radius: 0;
    box-shadow: none;
  }
  .fcb-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .fcb[data-state="open"] .fcb-launcher { display: none; }
  .fcb-msg { max-width: 90%; }
}
.fcb-lock, .fcb-lock body { overflow: hidden; }

/* Desktop: lançador e painel um pouco mais afastados da borda */
@media (min-width: 1200px) {
  .fcb-launcher { right: 24px; bottom: 24px; }
  .fcb-panel { right: 24px; bottom: 92px; height: min(640px, calc(100dvh - 128px)); }
}
@media (prefers-reduced-motion: reduce) {
  .fcb-launcher, .fcb-launcher__label, .fcb-chip, .fcb-send { transition: none; }
}
