#nsxc-root {
  --nsxc-verde: #37452E;
  --nsxc-dorado: #D9AD6E;
  --nsxc-crema: #F5F0E4;
  --nsxc-tinta: #22281E;
  position: fixed;
  bottom: 20px;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--nsxc-tinta);
}
#nsxc-root.nsxc-pos-right { right: 20px; }
#nsxc-root.nsxc-pos-left { left: 20px; }
#nsxc-root *, #nsxc-root *::before, #nsxc-root *::after { box-sizing: border-box; }

/* Botón flotante */
#nsxc-root .nsxc-launcher {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 0;
  background: var(--nsxc-verde);
  color: var(--nsxc-crema);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .2s ease;
  padding: 0;
}
#nsxc-root .nsxc-launcher:hover { transform: scale(1.06); }
#nsxc-root .nsxc-badge {
  position: absolute; top: -2px; right: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--nsxc-dorado); color: var(--nsxc-tinta);
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid #fff;
}
#nsxc-root.nsxc-open .nsxc-launcher { display: none; }

/* Panel */
#nsxc-root .nsxc-panel {
  position: absolute; bottom: 0;
  width: 370px; height: min(600px, calc(100vh - 40px));
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0; visibility: hidden;
  transform: translateY(16px) scale(.98);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
#nsxc-root.nsxc-pos-right .nsxc-panel { right: 0; }
#nsxc-root.nsxc-pos-left .nsxc-panel { left: 0; }
#nsxc-root.nsxc-open .nsxc-panel { opacity: 1; visibility: visible; transform: none; }

#nsxc-root .nsxc-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  background: var(--nsxc-verde); color: var(--nsxc-crema);
}
#nsxc-root .nsxc-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--nsxc-dorado); color: var(--nsxc-verde);
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 14px;
  display: grid; place-items: center; flex: none;
}
#nsxc-root .nsxc-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#nsxc-root .nsxc-title strong { font-family: Georgia, "Times New Roman", serif; font-size: 15px; font-weight: 600; }
#nsxc-root .nsxc-title span { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; }
#nsxc-root .nsxc-title i { width: 7px; height: 7px; border-radius: 50%; background: #7fd99b; display: inline-block; }
#nsxc-root .nsxc-wa, #nsxc-root .nsxc-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.10); color: var(--nsxc-crema);
  border: 0; cursor: pointer; padding: 0; text-decoration: none;
}
#nsxc-root .nsxc-wa { color: #7fd99b; }
#nsxc-root .nsxc-wa:hover, #nsxc-root .nsxc-close:hover { background: rgba(255,255,255,.20); }

#nsxc-root .nsxc-body {
  flex: 1; overflow-y: auto;
  padding: 16px 14px 8px;
  background: var(--nsxc-crema);
  display: flex; flex-direction: column; gap: 8px;
}
#nsxc-root .nsxc-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 16px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#nsxc-root .nsxc-msg p { margin: 0 0 6px; }
#nsxc-root .nsxc-msg p:last-child { margin: 0; }
#nsxc-root .nsxc-msg ul { margin: 4px 0 6px; padding-left: 18px; }
#nsxc-root .nsxc-msg li { margin: 2px 0; }
#nsxc-root .nsxc-bot {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
#nsxc-root .nsxc-bot a { color: var(--nsxc-verde); font-weight: 600; text-decoration: underline; }
#nsxc-root .nsxc-user {
  align-self: flex-end;
  background: var(--nsxc-verde);
  color: #fff;
  border-bottom-right-radius: 4px;
}
#nsxc-root .nsxc-typing { display: flex; gap: 4px; padding: 14px; }
#nsxc-root .nsxc-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #b9b1a0;
  animation: nsxc-punto 1.2s infinite ease-in-out;
}
#nsxc-root .nsxc-typing span:nth-child(2) { animation-delay: .15s; }
#nsxc-root .nsxc-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes nsxc-punto { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Tarjetas de producto */
#nsxc-root .nsxc-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#nsxc-root .nsxc-bot a.nsxc-card {
  display: flex; align-items: center; gap: 10px;
  padding: 6px; border: 1px solid rgba(34,40,30,.12); border-radius: 12px;
  background: #fff; color: var(--nsxc-tinta); text-decoration: none; font-weight: 400;
}
#nsxc-root .nsxc-bot a.nsxc-card:hover { border-color: var(--nsxc-dorado); background: #fffdf8; }
#nsxc-root .nsxc-card img, #nsxc-root .nsxc-sinfoto {
  width: 46px; height: 46px; flex: none; border-radius: 9px; object-fit: cover; background: #eee; display: block;
}
#nsxc-root .nsxc-card-t { display: flex; flex-direction: column; min-width: 0; }
#nsxc-root .nsxc-card-t b { font-family: Georgia, "Times New Roman", serif; font-size: 13px; line-height: 1.25; font-weight: 600; }
#nsxc-root .nsxc-card-t em { font-style: normal; color: var(--nsxc-verde); font-size: 12px; font-weight: 700; margin-top: 2px; }
#nsxc-root .nsxc-bot a.nsxc-mas { display: inline-block; margin-top: 8px; font-size: 13px; }

#nsxc-root .nsxc-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 14px 10px;
  background: var(--nsxc-crema);
}
#nsxc-root .nsxc-chips:empty { display: none; }
#nsxc-root .nsxc-chips button {
  border: 1px solid var(--nsxc-dorado);
  background: #fff; color: var(--nsxc-tinta);
  border-radius: 99px;
  padding: 6px 12px;
  font: inherit; font-size: 13px;
  cursor: pointer;
}
#nsxc-root .nsxc-chips button:hover { background: var(--nsxc-dorado); }

#nsxc-root .nsxc-form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #eee;
  background: #fff;
  margin: 0;
}
#nsxc-root .nsxc-form textarea {
  flex: 1; resize: none;
  border: 1px solid #ddd; border-radius: 14px;
  padding: 10px 12px;
  font: inherit; font-size: 16px; /* evita zoom en iPhone */
  line-height: 1.35;
  max-height: 110px;
  outline: none;
  background: #fff; color: var(--nsxc-tinta);
  margin: 0; min-height: 0;
}
#nsxc-root .nsxc-form textarea:focus { border-color: var(--nsxc-verde); }
#nsxc-root .nsxc-form button {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%; border: 0;
  background: var(--nsxc-verde); color: var(--nsxc-crema);
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
}
#nsxc-root .nsxc-foot {
  font-size: 11px; color: #8a8a8a; text-align: center;
  padding: 0 12px 8px; background: #fff;
}

/* Móvil: pantalla completa */
@media (max-width: 480px) {
  #nsxc-root { bottom: 16px; }
  #nsxc-root.nsxc-pos-right { right: 16px; }
  #nsxc-root.nsxc-pos-left { left: 16px; }
  #nsxc-root .nsxc-panel {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    border-radius: 0;
  }
}

/* App PRO en celular: la app tiene barra inferior (72 px) y menú lateral. La burbuja sube sobre la barra,
   el chat ocupa toda la pantalla y todo se esconde mientras el menú lateral está abierto (html.nsxm-abierto). */
@media (max-width: 760px) {
  #nsxc-root.nsxc-perfil-app { bottom: calc(86px + env(safe-area-inset-bottom)); }
  #nsxc-root.nsxc-perfil-app .nsxc-panel {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    border-radius: 0;
  }
  html.nsxm-abierto #nsxc-root.nsxc-perfil-app { display: none !important; }
}

#nsxc-root .nsxc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#nsxc-root .nsxc-wa-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 99px;
  background: #25D366; color: #fff !important;
  font-weight: 600; text-decoration: none !important;
}
#nsxc-root .nsxc-wa-btn:hover { filter: brightness(.95); }
