/* NUTRILAB · Panel · Lab → Encuesta de satisfacción (12-oct-2026) · assets/js/encuesta-panel.js
   Tokens de panel-v3 (--nl3-*) y panel-v4 (--nl4-*); con prefijo #nlEncPanel para ganar a Tailwind.
   Quitar su <link> en index.html lo deshace. */

#nlEncPanel { margin: 0 0 var(--nl4-gap, 28px); display: flex; flex-direction: column; gap: 16px; color: var(--nl4-text, #fff); font-family: var(--nl4-sans, Inter, sans-serif); }
#nlEncPanel h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
#nlEncPanel h3 { margin: 0 0 14px; font-size: 13px; font-weight: 600; color: var(--nl4-text, #fff); letter-spacing: 0; text-transform: none; }
#nlEncPanel h3 small { font-weight: 400; color: var(--nl4-text-3); margin-left: 6px; }
#nlEncPanel .nl-encp-h3b { margin-top: 22px; }
#nlEncPanel button { font-family: inherit; cursor: pointer; transition: background-color var(--nl3-ui, 180ms) var(--nl3-out, ease), color var(--nl3-ui, 180ms) var(--nl3-out, ease), transform var(--nl3-press, 120ms) var(--nl3-out, ease); }
#nlEncPanel button:active:not(:disabled) { transform: scale(.97); }
#nlEncPanel button:focus-visible { outline: 2px solid var(--nl4-accent, #7aa2ff); outline-offset: 2px; }

/* Cabecera + periodo */
#nlEncPanel .nl-encp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
#nlEncPanel .nl-encp-kicker { margin: 0 0 4px; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-periodo { display: inline-flex; padding: 3px; border: 1px solid var(--nl4-line); border-radius: var(--nl4-r, 12px); background: var(--nl4-s1); }
#nlEncPanel .nl-encp-periodo button { padding: 6px 12px; border: 0; border-radius: 9px; background: none; color: var(--nl4-text-2); font-size: 12px; font-weight: 500; }
#nlEncPanel .nl-encp-periodo button.on { background: var(--nl4-s2); color: var(--nl4-text); box-shadow: inset 0 0 0 1px var(--nl4-line-2); }

/* Tarjetas */
#nlEncPanel .nl-encp-card { padding: 20px; border: 1px solid var(--nl4-line); border-radius: var(--nl3-r-card, 18px); background: var(--nl4-s1); min-width: 0; }
#nlEncPanel .nl-encp-ch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
#nlEncPanel .nl-encp-ch h3 { margin: 0; }
#nlEncPanel .nl-encp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { #nlEncPanel .nl-encp-grid { grid-template-columns: 1fr; } }

/* KPIs */
#nlEncPanel .nl-encp-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { #nlEncPanel .nl-encp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#nlEncPanel .nl-encp-kpi { padding: 18px 20px; border: 1px solid var(--nl4-line); border-radius: var(--nl3-r-card, 18px); background: var(--nl4-s1); min-height: 116px; }
#nlEncPanel .nl-encp-etq { margin: 0 0 10px; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-valor { margin: 0; font-size: 30px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
#nlEncPanel .nl-encp-valor small { font-size: 14px; font-weight: 500; color: var(--nl4-text-3); margin-left: 2px; }
#nlEncPanel .nl-encp-sub { margin: 8px 0 0; font-size: 12px; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-skel { background: linear-gradient(90deg, var(--nl4-s1), var(--nl4-s2), var(--nl4-s1)); background-size: 200% 100%; animation: nlEncpSkel 1.4s linear infinite; }
@keyframes nlEncpSkel { to { background-position: -200% 0; } }

/* Estrellas parciales */
#nlEncPanel .nl-encp-stars { display: flex; gap: 3px; margin-top: 8px; }
#nlEncPanel .nl-encp-star { position: relative; width: 14px; height: 14px; background: var(--nl4-line-2); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
#nlEncPanel .nl-encp-star > span { position: absolute; inset: 0 auto 0 0; background: var(--nl3-warn, #f5b454); }

/* Alertas (estado: icono + palabra + color, nunca solo color) */
#nlEncPanel .nl-encp-alertas ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#nlEncPanel .nl-encp-alerta { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--nl4-r, 12px); border: 1px solid var(--nl4-line); background: var(--nl4-bg); }
#nlEncPanel .nl-encp-alerta > .material-symbols-outlined { font-size: 20px; margin-top: 1px; }
#nlEncPanel .nl-encp-alerta.alta { border-color: rgba(248,113,113,.35); background: rgba(248,113,113,.06); }
#nlEncPanel .nl-encp-alerta.alta > .material-symbols-outlined { color: var(--nl3-bad, #f87171); }
#nlEncPanel .nl-encp-alerta.media > .material-symbols-outlined { color: var(--nl3-warn, #f5b454); }
#nlEncPanel .nl-encp-at { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
#nlEncPanel .nl-encp-nivel { display: inline-block; margin-right: 8px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
#nlEncPanel .alta .nl-encp-nivel { color: var(--nl3-bad, #f87171); }
#nlEncPanel .media .nl-encp-nivel { color: var(--nl3-warn, #f5b454); }
#nlEncPanel .nl-encp-ad { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-cuenta { min-width: 24px; padding: 2px 8px; border-radius: 999px; background: var(--nl4-s2); font-size: 12px; text-align: center; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-ok { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-ok .material-symbols-outlined { color: var(--nl3-ok, #4ade80); font-size: 20px; }
#nlEncPanel .nl-encp-tag { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--nl4-line-2); font-size: 10px; font-weight: 600; color: var(--nl4-text-2); vertical-align: 1px; }
#nlEncPanel .nl-encp-tag.ok { border-color: rgba(74,222,128,.35); color: var(--nl3-ok, #4ade80); }

/* Enlaces de acción */
#nlEncPanel .nl-encp-acc { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 0; }
#nlEncPanel .nl-encp-link { padding: 0; border: 0; background: none; color: var(--nl4-accent, #7aa2ff); font-size: 12px; font-weight: 500; }
#nlEncPanel .nl-encp-link:hover { text-decoration: underline; }
#nlEncPanel .nl-encp-link:disabled { opacity: .5; }

/* Sugerencias / IA */
#nlEncPanel .nl-encp-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 0; border-radius: 10px; background: #f2f2f2; color: #050506; font-size: 12px; font-weight: 600; white-space: nowrap; }
#nlEncPanel .nl-encp-btn .material-symbols-outlined { font-size: 16px; }
#nlEncPanel .nl-encp-btn:disabled { opacity: .45; cursor: default; }
#nlEncPanel .nl-encp-meta { margin: -6px 0 6px; font-size: 12px; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-meta b { color: var(--nl3-warn, #f5b454); font-weight: 600; }
#nlEncPanel .nl-encp-sub2 { margin: 18px 0 8px; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-resumen { margin: 14px 0 0; padding: 14px 16px; border-left: 2px solid var(--nl4-line-2); font-family: var(--nl4-serif, Georgia, serif); font-size: 16px; line-height: 1.55; color: var(--nl4-text); }
#nlEncPanel .nl-encp-mejoras, #nlEncPanel .nl-encp-fuertes { list-style: none; margin: 0; padding: 0; }
#nlEncPanel .nl-encp-mejoras li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--nl4-line); }
#nlEncPanel .nl-encp-mejoras li:first-child { border-top: 0; }
#nlEncPanel .nl-encp-prio { flex: none; width: 52px; padding: 3px 0; border-radius: 6px; text-align: center; font-size: 10.5px; font-weight: 700; background: var(--nl4-s2); color: var(--nl4-text-2); height: fit-content; }
#nlEncPanel .nl-encp-prio.alta { background: var(--nl4-text); color: #050506; }
#nlEncPanel .nl-encp-mt { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
#nlEncPanel .nl-encp-tipo { margin-left: 6px; font-size: 10px; font-weight: 500; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-md { margin: 3px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-fuertes li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 13px; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-fuertes .material-symbols-outlined { font-size: 18px; color: var(--nl3-ok, #4ade80); }

/* Barras horizontales (una serie) */
#nlEncPanel .nl-encp-barras, #nlEncPanel .nl-encp-notas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
#nlEncPanel .nl-encp-barras li, #nlEncPanel .nl-encp-notas li { display: grid; grid-template-columns: minmax(0, 42%) 1fr 56px; align-items: center; gap: 10px; font-size: 12.5px; }
#nlEncPanel .nl-encp-bt { color: var(--nl4-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nlEncPanel .nl-encp-bp { height: 8px; border-radius: 4px; background: var(--nl4-s2); overflow: hidden; }
#nlEncPanel .nl-encp-bp > span { display: block; height: 100%; border-radius: 4px; background: var(--nl4-text); transition: width var(--nl3-enter, 260ms) var(--nl3-out, ease); }
#nlEncPanel .nl-encp-bn { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
#nlEncPanel .nl-encp-bn small { font-weight: 400; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-notas li.regular .nl-encp-bp > span { background: var(--nl3-warn, #f5b454); }
#nlEncPanel .nl-encp-notas li.mal .nl-encp-bp > span { background: var(--nl3-bad, #f87171); }
#nlEncPanel li:hover .nl-encp-bt { color: var(--nl4-text); }

/* Histograma vertical */
#nlEncPanel .nl-encp-hist { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; height: 120px; align-items: end; }
#nlEncPanel .nl-encp-hist > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
#nlEncPanel .nl-encp-hb { width: 100%; max-width: 40px; border-radius: 4px 4px 0 0; background: var(--nl4-text); min-height: 0; }
#nlEncPanel .nl-encp-hn { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
#nlEncPanel .nl-encp-hl { font-size: 10.5px; color: var(--nl4-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* NPS */
#nlEncPanel .nl-encp-nps { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; }
#nlEncPanel .nl-encp-nps .detractores, #nlEncPanel .nl-encp-ley i.detractores { background: var(--nl3-bad, #f87171); }
#nlEncPanel .nl-encp-nps .pasivos, #nlEncPanel .nl-encp-ley i.pasivos { background: rgba(255,255,255,.3); }
#nlEncPanel .nl-encp-nps .promotores, #nlEncPanel .nl-encp-ley i.promotores { background: var(--nl3-ok, #4ade80); }
#nlEncPanel .nl-encp-ley { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; font-size: 12px; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-ley i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
#nlEncPanel .nl-encp-ley b { color: var(--nl4-text); margin-left: 2px; }

/* Comentarios */
#nlEncPanel .nl-encp-coms { list-style: none; margin: 0 0 8px; padding: 0; }
#nlEncPanel .nl-encp-coms li { padding: 14px 0; border-top: 1px solid var(--nl4-line); }
#nlEncPanel .nl-encp-coms li:first-child { border-top: 0; padding-top: 0; }
#nlEncPanel .nl-encp-coms li.revisada { opacity: .55; }
#nlEncPanel .nl-encp-cc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 6px; font-size: 13px; }
#nlEncPanel .nl-encp-cc > span:not(.nl-encp-tag) { font-size: 12px; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-coms p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; color: var(--nl4-text-2); overflow-wrap: anywhere; }
#nlEncPanel .nl-encp-ct { display: inline-block; min-width: 74px; margin-right: 6px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--nl4-text-3); }

#nlEncPanel .nl-encp-nada { margin: 0; font-size: 12.5px; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-vacio { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--nl4-text-2); }
#nlEncPanel .nl-encp-vacio p { margin: 0; line-height: 1.5; }
#nlEncPanel .nl-encp-vacio > .material-symbols-outlined { font-size: 28px; color: var(--nl4-text-3); }
#nlEncPanel .nl-encp-vacio b { color: var(--nl4-text); font-weight: 600; }

@media (max-width: 640px) {
  #nlEncPanel .nl-encp-card { padding: 16px; }
  #nlEncPanel .nl-encp-barras li, #nlEncPanel .nl-encp-notas li { grid-template-columns: minmax(0, 46%) 1fr 48px; }
  #nlEncPanel .nl-encp-periodo { width: 100%; }
  #nlEncPanel .nl-encp-periodo button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #nlEncPanel button, #nlEncPanel .nl-encp-bp > span { transition: none; }
  #nlEncPanel .nl-encp-skel { animation: none; }
}

/* =====================================================================
   LAB SIN TARJETAS (12-oct-2026, petición de Samuel)
   El contenido flota sobre el fondo: sin relleno. Bloques de datos (cifras, gráficos, comentarios) sin caja,
   separados por una línea fina arriba. Solo Alertas y Sugerencias conservan un borde (sin relleno) porque piden acción.
   Solo actúa en el Lab (#contentArea que contiene #nlEncPanel). Quitar este bloque lo deshace.
   ===================================================================== */
#nlEncPanel .nl-encp-card { background: transparent; }
#nlEncPanel .nl-encp-alertas, #nlEncPanel .nl-encp-ia { border-color: var(--nl4-line-2); }
#nlEncPanel .nl-encp-alerta { background: transparent; }
#nlEncPanel .nl-encp-alerta.alta { background: transparent; }

/* Cifras clave: flotando, separadas por líneas verticales finas */
#nlEncPanel .nl-encp-kpis { gap: 0; padding: 6px 0; }
#nlEncPanel .nl-encp-kpi { background: transparent; border: 0; border-left: 1px solid var(--nl4-line); border-radius: 0; padding: 4px 24px; min-height: 0; }
#nlEncPanel .nl-encp-kpi:first-child { border-left: 0; padding-left: 0; }
#nlEncPanel .nl-encp-valor { font-size: 38px; letter-spacing: -.02em; }
#nlEncPanel .nl-encp-skel { min-height: 92px; border-radius: 10px; margin-right: 12px; }
@media (max-width: 1000px) {
  #nlEncPanel .nl-encp-kpi { padding: 14px 16px; border-left: 0; border-top: 1px solid var(--nl4-line); }
  #nlEncPanel .nl-encp-kpi:nth-child(even) { border-left: 1px solid var(--nl4-line); }
  #nlEncPanel .nl-encp-kpi:nth-child(-n+2) { border-top: 0; }
  #nlEncPanel .nl-encp-kpi:first-child { padding-left: 0; }
  #nlEncPanel .nl-encp-kpi:nth-child(3) { padding-left: 0; }
}

/* Gráficos y comentarios: sin caja, línea fina arriba */
#nlEncPanel .nl-encp-grid { column-gap: 48px; row-gap: 0; }
#nlEncPanel .nl-encp-grid .nl-encp-card,
#nlEncPanel .nl-encp-flota,
#nlEncPanel .nl-encp-card.nl-encp-vacio { border: 0; border-top: 1px solid var(--nl4-line); border-radius: 0; padding: 22px 0 26px; }

/* Resto del Lab (maqueta de app.js/pages.js): mismas reglas, sin relleno ni sombra */
#contentArea:has(#nlEncPanel) .bg-surface-container-low {
  background: transparent !important;
  border-width: 0 !important;
  border-top: 1px solid var(--nl4-line) !important;
  border-radius: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-shadow: none !important;
}
#contentArea:has(#nlEncPanel) .bg-surface-container-low.border-error\/20 {   /* «Alertas de seguimiento»: solo borde */
  border-width: 1px !important;
  border-color: rgba(248,113,113,.3) !important;
  border-radius: var(--nl3-r-card, 18px) !important;
  padding: 20px !important;
}
#contentArea:has(#nlEncPanel) .card-hover:hover { transform: none !important; box-shadow: none !important; background: transparent !important; }
#contentArea:has(#nlEncPanel) .bg-primary.rounded-xl {   /* «Exportación rápida»: era un bloque blanco → solo borde */
  background: transparent !important;
  color: var(--nl4-text, #fff) !important;
  border: 1px solid var(--nl4-line-2);
  box-shadow: none !important;
}
#contentArea:has(#nlEncPanel) .bg-primary.rounded-xl button { background: #f2f2f2 !important; color: #050506 !important; box-shadow: none !important; }
#contentArea:has(#nlEncPanel) .bg-primary.rounded-xl p { color: var(--nl4-text-2, rgba(255,255,255,.64)); }

/* Página «Análisis de reseñas» (13-oct-2026): botón de vuelta a Contabilidad */
.nl-encp-pagina { margin: 0 0 8px; }
.nl-encp-volver { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font-size: 12px; font-family: inherit; color: var(--nl4-text-2, rgba(255,255,255,.64)); cursor: pointer; }
.nl-encp-volver:hover { color: var(--nl4-text, #fff); }
.nl-encp-volver .material-symbols-outlined { font-size: 16px; }
