:root {
  --vfai-black: #101010;
  --vfai-gold: #f4b41a;
  --vfai-blue: #5f99e6;
  --vfai-border: #e8e8ec;
  --vfai-text: #18181b;
  --vfai-muted: #71717a;
  --vfai-bg: #ffffff;
  --vfai-soft: #f7f7f9;
}

.vfai-root, .vfai-root * { box-sizing: border-box; }
.vfai-root { font-family: inherit; color: var(--vfai-text); }
.vfai-root button, .vfai-root textarea { font: inherit; }

.vfai-launcher {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 999998;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--vfai-black);
  color: #fff;
  box-shadow: 0 12px 32px rgba(0,0,0,.22);
  cursor: pointer;
}
.vfai-launcher:hover { transform: translateY(-1px); }
.vfai-root.vfai-open .vfai-launcher { opacity: 0; pointer-events: none; transform: translateY(8px); }
.vfai-launcher__icon {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--vfai-gold); color: #111; font-weight: 900; font-size: 17px;
}
.vfai-launcher__text { font-weight: 800; font-size: 14px; }

.vfai-panel {
  position: fixed;
  right: 22px;
  bottom: 154px;
  z-index: 999999;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100dvh - 190px));
  min-height: 470px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 20px;
  background: var(--vfai-bg);
  box-shadow: 0 24px 70px rgba(0,0,0,.25);
  opacity: 0;
  transform: translateY(14px) scale(.985);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.vfai-panel[hidden] { display: none !important; }
.vfai-panel.is-open { opacity: 1; transform: none; pointer-events: auto; }

.vfai-root--inline .vfai-panel {
  position: relative;
  right: auto; bottom: auto; z-index: 1;
  width: 100%; max-width: 760px; height: 720px; margin: 20px auto;
  opacity: 1; transform: none; pointer-events: auto;
}

.vfai-header {
  flex: 0 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #070707;
  color: #fff;
}
.vfai-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vfai-brand__mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px; background: var(--vfai-gold); color: #111;
  font-size: 14px; font-weight: 950; letter-spacing: -.5px;
}
.vfai-brand strong { display: block; font-size: 15px; line-height: 1.2; }
.vfai-brand small { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: #d4d4d8; font-size: 11px; }
.vfai-brand small i { width: 7px; height: 7px; border-radius: 50%; background: #34c759; }
.vfai-close {
  width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.09); color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer;
}

.vfai-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 14px 8px;
  background: linear-gradient(#fff, #fbfbfc);
  scrollbar-width: thin;
}
.vfai-msg { display: flex; margin: 0 0 11px; }
.vfai-msg--assistant { justify-content: flex-start; }
.vfai-msg--user { justify-content: flex-end; }
.vfai-bubble {
  max-width: 86%; padding: 10px 12px; border-radius: 14px;
  font-size: 13.5px; line-height: 1.47; white-space: pre-wrap; overflow-wrap: anywhere;
}
.vfai-msg--assistant .vfai-bubble { background: #f1f2f4; color: #202124; border-bottom-left-radius: 4px; }
.vfai-msg--user .vfai-bubble { background: var(--vfai-black); color: #fff; border-bottom-right-radius: 4px; }

.vfai-products { display: grid; gap: 8px; margin: -2px 0 14px; }
.vfai-product {
  display: grid; grid-template-columns: 54px 1fr 18px; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid var(--vfai-border); border-radius: 13px;
  background: #fff; color: inherit !important; text-decoration: none !important;
}
.vfai-product:hover { border-color: #c7c9d1; box-shadow: 0 5px 14px rgba(0,0,0,.06); }
.vfai-product__media { position: relative; width: 54px; height: 54px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: #f5f5f7; }
.vfai-product__media img { position: relative; z-index: 2; width: 54px; height: 54px; object-fit: contain; border-radius: 9px; background: #fff; }
.vfai-product__fallback { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: #8a8a91; font-size: 12px; font-weight: 900; letter-spacing: .3px; }
.vfai-product__media.has-image .vfai-product__fallback { visibility: hidden; }
.vfai-product__body { min-width: 0; display: block; }
.vfai-product__body strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.25; }
.vfai-product__meta { display: block; margin-top: 5px; color: var(--vfai-muted); font-size: 11.5px; }
.vfai-product__arrow { font-size: 25px; color: #9a9aa0; }

.vfai-action-row { margin: -3px 0 13px; }
.vfai-primary-action, .vfai-secondary-action {
  width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: center;
  border-radius: 11px; font-size: 13px; font-weight: 800; text-decoration: none !important; cursor: pointer;
}
.vfai-primary-action { background: var(--vfai-gold); color: #111 !important; border: 1px solid var(--vfai-gold); }
.vfai-secondary-action { background: #fff; color: #111; border: 1px solid #d8d8dd; }

.vfai-suggestions {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 12px 7px;
  background: #fff;
  scrollbar-width: none;
}
.vfai-suggestions::-webkit-scrollbar { display: none; }
.vfai-suggestions.is-used { display: none; }
.vfai-suggestions button {
  flex: 0 0 auto; min-height: 34px; padding: 0 11px;
  border: 1px solid #dedfe4; border-radius: 999px; background: #fff; color: #27272a;
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.vfai-suggestions button:hover { border-color: var(--vfai-gold); }

.vfai-status { flex: 0 0 auto; padding: 4px 14px 7px; color: var(--vfai-muted); background: #fff; font-size: 11px; }
.vfai-form {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: end;
  gap: 8px;
  padding: 10px 11px;
  border-top: 1px solid var(--vfai-border);
  background: #fff;
}
.vfai-form textarea {
  width: 100%; min-height: 42px; max-height: 96px; resize: none;
  padding: 11px 12px; border: 1px solid #d9dae0; border-radius: 12px;
  background: #fff; color: #18181b; outline: none; line-height: 1.35; font-size: 13px;
}
.vfai-form textarea:focus { border-color: var(--vfai-gold); box-shadow: 0 0 0 2px rgba(244,180,26,.15); }
.vfai-send {
  width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--vfai-gold); color: #111; font-size: 19px; font-weight: 900; cursor: pointer;
}
.vfai-send:disabled { opacity: .5; cursor: wait; }
.vfai-hp { position: absolute !important; left: -99999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }

.vfai-footer {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px 9px; background: #fff; color: #8a8a91; font-size: 9.5px;
}
.vfai-footer button { border: 0; padding: 0; background: none; color: #111; font-size: 10px; font-weight: 800; cursor: pointer; }

@media (max-width: 767px) {
  .vfai-launcher { right: 14px; bottom: calc(94px + env(safe-area-inset-bottom)); min-height: 48px; padding-right: 14px; }
  .vfai-launcher__icon { width: 32px; height: 32px; }
  .vfai-panel {
    right: 8px;
    bottom: var(--vfai-mobile-bottom, calc(82px + env(safe-area-inset-bottom)));
    width: calc(100vw - 16px);
    height: var(--vfai-mobile-height, min(620px, calc(100dvh - 104px - env(safe-area-inset-bottom))));
    min-height: 390px;
    border-radius: 18px;
  }
  .vfai-root--inline .vfai-panel { width: 100%; height: min(720px, 82dvh); min-height: 500px; }
  .vfai-header { min-height: 64px; }
  .vfai-brand__mark { width: 38px; height: 38px; border-radius: 10px; }
  .vfai-messages { padding-left: 11px; padding-right: 11px; }
  .vfai-bubble { max-width: 90%; }
}

@media (max-width: 420px) {
  .vfai-launcher__text { display: none; }
  .vfai-launcher { width: 50px; padding: 0; justify-content: center; }
}

/* Convivencia con el widget de WhatsApp ya instalado en Vital Fit. */
#wa .wa__btn_popup {
  right: 14px !important;
  bottom: 165px !important;
}
#wa .wa__popup_chat_box {
  right: 14px !important;
  bottom: 237px !important;
}
body.vfai-chat-open #wa {
  display: none !important;
}


.vfai-whatsapp-action::before {
  content: "💬";
  margin-right: 7px;
  font-size: 14px;
  line-height: 1;
}
