body {
  font-family: system-ui, sans-serif;
  margin: 0;
  background: #f6f7f9;
}

:root {
  --panel-width: calc(100% - 32px); /* vuelve al ancho natural de los bloques */
}

/* ============================= */
/* ANCHO GLOBAL · TARJETAS       */
/* ============================= */

/* Todas las tarjetas principales alineadas y con mismo ancho */
.panel-header,
.top-bar,
.block,
.loader-accordion {
  width: 100%;
  max-width: var(--panel-width);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}



/* ============================= */
/* Header principal del panel    */
/* ============================= */

.panel-header {
  padding: 14px 18px;
  background: linear-gradient(90deg, #4b56a6 0%, #6f78b8 100%);
  color: #ffffff;
  text-align: center;
  border-radius: 8px;
  margin: 24px auto 0 auto; /* mismo alineado que el resto */
  box-sizing: border-box;
}

.panel-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* ============================= */
/* Barra superior de filtros     */
/* ============================= */


/* Label izquierda + select derecha en una línea */
.top-bar .selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar .selector label {
  margin: 0;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}

.top-bar .selector select {
  height: 30px;
  padding: 2px 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f4f4f4;
}

/* ============================= */
/* Selects con color por selección */
/* (las clases las pondrá app.js) */
/* ============================= */

.top-bar .selector select.is-blue {
  background: #1e5cb3; /* azul corporativo */
  color: #fff;
  border-color: #1e5cb3;
}

.top-bar .selector select.rep-no {
  background: #2e7d32; /* verde */
  color: #fff;
  border-color: #2e7d32;
}

.top-bar .selector select.rep-necesario {
  background: #f9a825; /* amarillo */
  color: #222;
  border-color: #f9a825;
}

.top-bar .selector select.rep-total {
  background: #ef6c00; /* naranja */
  color: #fff;
  border-color: #ef6c00;
}

/* Mantener buen contraste del foco */
.top-bar .selector select.is-blue:focus,
.top-bar .selector select.rep-no:focus,
.top-bar .selector select.rep-necesario:focus,
.top-bar .selector select.rep-total:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 92, 179, 0.25);
}

/* ============================= */
/* Layout general                */
/* ============================= */



main {
  padding: 0;
  max-width: none; /* evitar doble restricción de ancho */
  margin: 0;
}

/* ============================= */
/* TABLAS · ESTILO COMPACTO PRO  */
/* ============================= */

/* ============================= */
/* TABLAS · ANCHOS INTELIGENTES  */
/* ============================= */

/* Columna principal (Concepto / Proveedor / Cuenta) */
table thead th:first-child,
table tbody td:first-child {
  min-width: 280px;
}

/* Columnas mensuales (números) */
table thead th:not(:first-child):not(.col-total),
table tbody td:not(:first-child):not(.col-total) {
  width: 100px;
}

/* Columna TOTAL destacada */
td.col-total {
  width: 140px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

/* Cabecera */
thead th {
  background: #f4f5f8;
  border-bottom: 2px solid #c7ccd6;
  padding: 6px 8px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #3a3f4b;
}

thead th:first-child {
  text-align: left;
}

/* ============================= */
/* TABLAS · CABECERA STICKY      */
/* ============================= */

/* Activar sticky solo cuando la tabla esté dentro de un bloque */
.block table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

/* Asegurar fondo sólido al hacer scroll */
.block table thead th {
  background: #f4f5f8;
}

/* Separador visual al quedar fija */
.block table thead {
  box-shadow: inset 0 -1px 0 #c7ccd6;
}

/* ============================= */
/* Micro-UX · Profundidad scroll */
/* ============================= */

.block table thead {
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.04);
}

/* Celdas */
tbody td {
  border-bottom: 1px solid #e1e4ea;
  padding: 6px 8px;
  text-align: right;
  font-size: 12px;
  vertical-align: middle;
}

tbody td:first-child {
  text-align: left;
  font-weight: 600;
  color: #2f343f;
}

/* ============================= */
/* Micro-UX · Highlight de filas */
/* ============================= */

tbody tr {
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

tbody tr:hover {
  background-color: #eef2fb; /* azul corporativo muy suave */
}

/* Refuerzo visual en la primera columna */
tbody tr:hover td:first-child {
  color: #1e5cb3;
}

/* No aplicar hover a filas especiales */
tr.resultado:hover,
tr.separador-reparto:hover {
  background: inherit;
}

/* Porcentajes secundarios */
td .pct {
  font-size: 11px;
  opacity: 0.7;
}

/* ============================= */
/* COLUMNA TOTAL                 */
/* ============================= */

th.col-total,
td.col-total {
  background: #eef1f7;
  font-weight: 800;
}

td.col-total {
  border-left: 2px solid #b7bdca;
}

/* ============================= */
/* SEPARADOR REPARTO             */
/* ============================= */




/* ============================= */
/* Loader manual (modo desarrollo) */
/* ============================= */

.loader {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  padding: 12px;
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

.loader label {
  font-size: 12px;
  color: #444;
}

.loader-status {
  font-size: 12px;
  margin-left: auto;
  color: #2e7d32; /* verde confirmación */
}


/* ============================= */
/* Colores por signo             */
/* ============================= */

/* Valores positivos (ingresos) */
.pos,
.positivo {
  color: #1e5cb3 !important;   /* azul corporativo */
}

/* Valores negativos (gastos) */
.neg,
.negativo {
  color: #b71c1c !important;   /* rojo corporativo */
}

/* Valores cero */
.zero {
  color: #222 !important;
}


/* ============================= */
/* Filas de RESULTADO            */
/* ============================= */

tr.resultado {
  background: transparent; /* sin fondo por defecto */
  font-weight: 800;
}

/* Fondo SOLO en columna TOTAL para filas de resultado */
tr.resultado td.col-total {
  background: #f0f0f0;
}

tr.resultado td {
  border-top: 2px solid #999;
}

tr.resultado .pct {
  font-size: 11px;
  opacity: 0.8;
}








/* ============================= */
/* Columna TOTAL                 */
/* ============================= */

th.col-total,
td.col-total {
  background: #eef0f5;
  font-weight: 800;
}

td.col-total {
  border-left: 2px solid #b0b5c0;
}

/* ============================= */
/* Badges Coste Fijo / Variable  */
/* ============================= */

.badge-coste {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  vertical-align: middle;
  letter-spacing: 0.3px;
}

.badge-coste.CF {
  background: #e0e0e0;
  color: #333;
}

.badge-coste.CV {
  background: #fff3e0;
  color: #e65100;
}

/* ============================= */
/* KPIs Totales (cajas)          */
/* ============================= */

#kpiTotales {
  margin-top: 16px;
  padding: 10px 0;
  background: transparent;
  border: none;
}

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kpi-card {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
  box-sizing: border-box;
}

.kpi-title {
  font-size: 11px;
  color: #666;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kpi-value {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  text-align: right;
}

.kpi-resultado {
  font-size: 20px;
  font-weight: 900;
}

.kpi-resultado.positivo {
  color: #1e5cb3;
}

.kpi-resultado.negativo {
  color: #b71c1c;
}

/* ============================= */
/* Gráfico · Integración visual  */
/* ============================= */

#chartWrapper {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
}

#chartContainer {
  margin-top: 12px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 6px;
}

#toggleChart {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #333;
  background: #f4f4f4;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}

#toggleChart:hover {
  background: #eaeaea;
}

#chartContainer canvas {
  max-height: 340px;
}


/* Barra clicable */
.loader-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: #f7f7f8;
  cursor: pointer;
  font-size: 12px;
}

.loader-toggle:hover {
  background: #f0f0f2;
}

.loader-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30, 92, 179, 0.18);
}

.loader-toggle .chev {
  display: inline-block;
  width: 18px;
  text-align: center;
  transition: transform 160ms ease;
  font-size: 14px;
  color: #444;
}

.loader-toggle .loader-title {
  font-weight: 700;
  color: #333;
}

/* Resumen a la derecha */
.loader-toggle .loader-summary {
  margin-left: auto;
  color: #2e7d32;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55vw;
}

/* Panel desplegable */
.loader-panel {
  padding: 0;
}

/* Reutilizamos tu layout actual de .loader, pero sin borde inferior interno */
.loader-panel .loader {
  border-bottom: none;
}

/* Estado colapsado: oculta panel y gira chevron */
.loader-accordion.is-collapsed .loader-panel {
  display: none;
}

.loader-accordion.is-collapsed .loader-toggle .chev {
  transform: rotate(-90deg);
}
/* ============================= */
/* Acordeón · KPIs mensuales     */
/* ============================= */

.kpi-accordion {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
  margin-top: 12px;
}

/* Reutilizamos loader-toggle para el header */
.kpi-accordion .loader-toggle {
  background: #f7f7f8;
}

/* Panel desplegable KPIs */
.kpi-accordion .loader-panel {
  padding: 0;
}

/* Estado colapsado */
.kpi-accordion.is-collapsed .loader-panel {
  display: none;
}

.kpi-accordion.is-collapsed .loader-toggle .chev {
  transform: rotate(-90deg);
}

/* ============================= */
/* KPIs · Colores por signo      */
/* ============================= */

/* Positivos */
.kpi-value.pos,
.kpi-resultado.positivo {
  color: #1e5cb3; /* azul corporativo */
}

/* Negativos */
.kpi-value.neg,
.kpi-resultado.negativo {
  color: #b71c1c; /* rojo */
}

/* KPIs con valor cero */
.kpi-value.zero {
  color: #222;
}

/* ============================= */
/* BLOQUES PRINCIPALES DEL PANEL */
/* ============================= */



/* ============================= */
/* BLOQUES · MODO TARJETA        */
/* ============================= */

/* Tarjeta principal de cada bloque */
.block {
  margin-top: 32px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0;
  overflow: hidden; /* asegura que el header quede integrado */
}

/* Header integrado en la tarjeta */
.block-header {
  margin: 0;
  border-bottom: 1px solid #c8e6c9;
}

/* Rentabilidad */
#bloque-rentabilidad .block-header {
  background: #e6f4ea;        /* verde claro */
  border-left: 6px solid #2e7d32;
}

/* Proveedores */
#bloque-proveedores .block-header {
  background: #f3e8ff;        /* malva / lila claro */
  border-left: 6px solid #8e5ad7; /* lila intenso */
}

#bloque-punto-equilibrio .block-header {
  background: #ffe0b2;        /* naranja más intenso */
  border-left: 6px solid #ef6c00;
}

.block-header h2 {
  margin: 0;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #111;
  background: transparent;
}

.block-toggle-title {
  margin: 0;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #111;
  background: transparent;
}

.block-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.block-toggle:focus {
  outline: none;
  box-shadow: inset 0 0 0 3px rgba(30, 92, 179, 0.18);
}

.block-toggle .chev {
  display: inline-block;
  padding-right: 16px;
  font-size: 14px;
  color: #444;
  transition: transform 160ms ease;
}

#bloque-proveedores.is-collapsed #proveedoresPanel {
  display: none;
}

#bloque-proveedores.is-collapsed .block-toggle .chev {
  transform: rotate(-90deg);
}

/* Contenido interno del bloque */
.block-content {
  padding: 16px;
}

/* ============================= */
/* NORMALIZACIÓN TABLAS EN BLOQUES */
/* ============================= */

/* Todas las tablas dentro de bloques usan el tamaño analítico */
.block-content table th,
.block-content table td {
  font-size: 12px;
}

/* Mantener primera columna algo más legible */
.block-content table td:first-child {
  font-weight: 600;
}

/* ============================= */
/* BLOQUE · CARGA CSV (TARJETA)  */
/* ============================= */

.loader-accordion {
  margin-top: 24px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

/* Header del bloque (clicable) */
.loader-toggle {
  background: #eef1f7;              /* neutro, no compite con bloques de negocio */
  border-bottom: 1px solid #d0d4de;
  padding: 10px 16px;
  font-weight: 700;
}

/* Chevron y título bien alineados */
.loader-toggle .loader-title {
  font-size: 13px;
  letter-spacing: 0.3px;
}

/* Resumen a la derecha */
.loader-toggle .loader-summary {
  font-weight: 600;
  color: #2e7d32;
}

/* Contenido interno */
.loader-panel {
  padding: 16px;
  background: #ffffff;
}

/* Eliminar bordes internos antiguos */
.loader-panel .loader {
  border: none;
  padding: 0;
}

/* Hover sutil en header */
.loader-toggle:hover {
  background: #e4e8f2;
}

/* ============================= */
/* CARGA CSV · GRID PROFESIONAL  */
/* ============================= */

.loader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.csv-card {
  background: #fafbfe;
  border: 1px solid #e1e4ea;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}

.csv-card:hover {
  border-color: #c7ccd6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.csv-title {
  font-size: 12px;
  font-weight: 700;
  color: #333;
  letter-spacing: 0.3px;
}

.csv-card input[type="file"] {
  font-size: 11px;
}

.csv-status {
  font-size: 11px;
  font-weight: 600;
  color: #777;
}

.csv-status.success {
  color: #2e7d32; /* verde */
}

.csv-status.error {
  color: #b71c1c; /* rojo */
}

.loader-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.loader-actions #btnCargar {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #f4f4f4;
  cursor: pointer;
}

.loader-actions #btnCargar:hover {
  background: #eaeaea;
}

.loader-actions .loader-status {
  font-size: 12px;
  font-weight: 600;
}

/* ============================= */
/* TARJETA · BARRA DE FILTROS    */
/* ============================= */


.top-bar {
  margin-top: 24px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 8px;

  display: flex;
  gap: 20px;
  align-items: center;
}

/* ============================= */
/* BOTÓN EXPORTAR CSV           */
/* ============================= */

.btn-export-pe {
  background: #ef6c00;           /* naranja corporativo */
  color: #ffffff;
  border: 1px solid #e65100;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}

.btn-export-pe:hover {
  background: #e65100;
}

.btn-export-pe:disabled {
  background: #f5c7a1;
  border-color: #f5c7a1;
  cursor: not-allowed;
  opacity: 0.7;
}

/* ============================= */
/* PROVEEDORES · Ancho columna Cuenta */
/* ============================= */

/* Vista Proveedor → Cuenta */
/* La columna Cuenta es la 2ª */
#tablaProveedores thead th:nth-child(2),
#tablaProveedores tbody td:nth-child(2) {
  min-width: 260px;   /* espacio suficiente para códigos + texto */
  max-width: 360px;   /* evita que se coma toda la tabla */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mantener columnas numéricas compactas */
#tablaProveedores thead th:nth-child(3),
#tablaProveedores tbody td:nth-child(3),
#tablaProveedores thead th:nth-child(4),
#tablaProveedores tbody td:nth-child(4) {
  width: 110px;
}

#tablaProveedores tr.proveedores-total td {
  border-top: 3px solid #aeb4bf;
  border-bottom: none;
  background: transparent;
  padding-top: 10px;
}

#tablaProveedores tr.proveedores-total td:nth-child(3) {
  font-weight: 800;
}
/* ============================= */
/* PUNTO DE EQUILIBRIO · BASE    */
/* Preparado para KPIs, tablas  */
/* y simulador (sin lógica aún) */
/* ============================= */

#bloque-punto-equilibrio .block-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pe-kpi-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pe-kpi-main-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1.5fr) repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.pe-kpi-hero {
  border: 1px solid #f0c48d;
  background: linear-gradient(135deg, #fff9f2 0%, #fff0de 100%);
  box-shadow: inset 0 0 0 1px rgba(239, 108, 0, 0.08);
}

.pe-kpi-hero .kpi-title,
.pe-kpi-primary .kpi-title {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pe-kpi-hero .kpi-value {
  font-size: 30px;
  font-weight: 900;
  color: #2f2a24;
}

.pe-kpi-primary {
  border-top: 3px solid #ef6c00;
  background: #fff8f1;
}

.pe-kpi-primary .kpi-value {
  color: #2f2a24;
  font-weight: 800;
}

.pe-kpi-hero-subtitle {
  margin-top: 8px;
  font-size: 12px;
  color: #6c6255;
}

.pe-progress-track {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(239, 108, 0, 0.12);
  overflow: hidden;
}

.pe-progress-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 160ms ease;
}

.pe-progress-fill.is-ok {
  background: linear-gradient(90deg, #2e7d32 0%, #66bb6a 100%);
}

.pe-progress-fill.is-risk {
  background: linear-gradient(90deg, #ef6c00 0%, #ffb74d 100%);
}

/* KPIs del Punto de Equilibrio */
#kpiPE {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

/* Tabla Punto de Equilibrio */
#tablaPE {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

#tablaPE thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f5f8;
  font-size: 12px;
  font-weight: 700;
  color: #3a3f4b;
  border-bottom: 2px solid #c7ccd6;
}


#tablaPE tbody td {
  font-size: 12px;
  padding: 6px 8px;
  border-bottom: 1px solid #e1e4ea;
}

#tablaPE tr.pe-section-label td {
  padding: 10px 12px;
  background: #f7f8fb;
  border-top: 1px solid #dde2ee;
  border-bottom: 1px solid #dde2ee;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b6270;
}

#tablaPE tr.pe-section-label-emphasis td {
  background: #fff5eb;
  color: #8a4b00;
  border-top-color: #f3c48d;
  border-bottom-color: #f3c48d;
}

/* ============================= */
/* PUNTO DE EQUILIBRIO · SEPARADORES SUAVES */
/* ============================= */

/* Separador suave antes de Margen de contribución */
#tablaPE tbody tr:nth-child(3) td {
  border-top: 2px solid #e3e6ef;
}


# ============================= */
/* PUNTO DE EQUILIBRIO · FILA SEGURIDAD SEMÁNTICA */
/* ============================= */

/* Separador elegante antes del bloque Seguridad */
#tablaPE tr.pe-separador td {
  border-top: 2px solid #c7ccd6;
  background: transparent;
  height: 6px;
  padding: 0;
}

/* Base destacado */
#tablaPE tr.pe-destacado td {
  border-top: 2px solid #c7ccd6;
  font-weight: 700;
}

/* Margen positivo */
#tablaPE tr.pe-destacado.pos td {
  background: #e8f5e9; /* verde muy suave */
}

/* Déficit */
#tablaPE tr.pe-destacado.neg td {
  background: #fdecea; /* rojo muy suave */
}

/* Mantener neutralidad del valor PE */
#tablaPE tbody tr:last-child td.pos,
#tablaPE tbody tr:last-child td.neg {
  color: #333 !important;
}

/* Simulador (futuro) */
#peSimulador {
  padding: 12px;
  background: #fafafa;
  border: 1px dashed #ccc;
  border-radius: 6px;
  font-size: 12px;
  color: #555;
}
/* ============================= */
/* KPI · Punto de Equilibrio     */
/* Jerarquía visual              */
/* ============================= */

#bloque-punto-equilibrio .kpi-cards {
  margin-top: 8px;
}

#bloque-punto-equilibrio .kpi-cards-pe {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

/* KPIs base */
#bloque-punto-equilibrio .kpi-card {
  background: #ffffff;
}

/* KPI destacado: Punto de equilibrio */
#bloque-punto-equilibrio .kpi-card-pe-destacado {
  border-top: 3px solid #e67e22;   /* naranja PE */
  background: #fff7f0;
}

/* Título del KPI PE */
#bloque-punto-equilibrio .kpi-card-pe-destacado .kpi-title {
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Valor del KPI PE */
#bloque-punto-equilibrio .kpi-card-pe-destacado .kpi-value {
  font-weight: 700;
}

/* Evitar colores “emoción” en PE */
#bloque-punto-equilibrio .kpi-card-pe-destacado .kpi-value.pos,
#bloque-punto-equilibrio .kpi-card-pe-destacado .kpi-value.neg {
  color: #333;
}

@media (max-width: 1100px) {
  .pe-kpi-main-grid {
    grid-template-columns: 1fr;
  }

  #bloque-punto-equilibrio .kpi-cards-pe {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #bloque-punto-equilibrio .kpi-cards-pe {
    grid-template-columns: 1fr;
  }
}
/* ============================= */
/* PUNTO DE EQUILIBRIO · TABLA   */
/* Afinado visual                */
/* ============================= */

/* Columna concepto más legible */
#tablaPE thead th:first-child,
#tablaPE tbody td:first-child {
  min-width: 320px;
  text-align: left;
  font-weight: 600;
}

/* Columna importe compacta y clara */
#tablaPE thead th:last-child,
#tablaPE tbody td:last-child {
  width: 160px;
  text-align: right;
}

/* Respiración vertical sutil */
#tablaPE tbody tr td {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Separación visual suave entre filas clave */
#tablaPE tbody tr:nth-child(3) td {
  padding-top: 12px;
}

/* Fila final (Punto de Equilibrio) con más aire */
#tablaPE tbody tr:last-child td {
  padding-top: 12px;
  padding-bottom: 12px;
}
/* ============================= */
/* PUNTO DE EQUILIBRIO · MICRO‑UX */
/* ============================== */

/* Hover suave solo en tabla PE */
#tablaPE tbody tr {
  transition: background-color 120ms ease, box-shadow 120ms ease;
}

#tablaPE tbody tr:hover {
  background: #f4f6fb; /* gris azulado muy suave */
}

/* Refuerzo visual del concepto al hover */
#tablaPE tbody tr:hover td:first-child {
  color: #1e5cb3;
}

/* No aplicar hover agresivo en la fila final (PE) */
#tablaPE tbody tr:last-child:hover {
  background: #fff3e0;
  box-shadow: none;
}

/* Línea guía al mover el ratón (lectura horizontal) */
#tablaPE tbody tr:hover td {
  box-shadow: inset 0 -1px 0 #dde2ee;
}

/* Cursor neutro (no parece botón) */
#tablaPE tbody tr {
  cursor: default;
}
/* ============================= */
/* PUNTO DE EQUILIBRIO · MENSAJES */
/* Interpretación mensual         */
/* ============================= */

.pe-mensajes {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f7f8fb;
  border: 1px solid #dde2ee;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
}

.pe-mensajes strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 11px;
  color: #333;
}

.pe-mensajes ul {
  margin: 0;
  padding-left: 18px;
}

.pe-mensajes li {
  margin: 4px 0;
  line-height: 1.4;
}

/* Estados semánticos */
.pe-msg-ok {
  color: #2e7d32;   /* verde */
}

.pe-msg-warn {
  color: #ef6c00;   /* naranja */
}

.pe-msg-neg {
  color: #b71c1c;   /* rojo */
}

/* ============================= */
/* PUNTO DE EQUILIBRIO · MENSAJE EJECUTIVO */
/* ============================= */

.pe-interpretacion-texto {
  font-size: 13px;
  font-weight: 500;
}

.pe-interpretacion-texto.pos {
  color: #1e5cb3;   /* azul corporativo */
}

.pe-interpretacion-texto.neg {
  color: #b71c1c;   /* rojo corporativo */
}

.pe-help-card {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #dde2ee;
  background: #f8fafc;
}

.pe-help-eyebrow {
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7382;
}

.pe-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pe-help-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e3e7ef;
}

.pe-help-title {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #2d3440;
}

.pe-help-text {
  font-size: 12px;
  line-height: 1.45;
  color: #556070;
}

.pe-interpretacion-card {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #dde2ee;
  background: #f8fafc;
}

.pe-interpretacion-card.pos {
  background: #eef6ff;
  border-color: #c6ddff;
}

.pe-interpretacion-card.neg {
  background: #fff1f0;
  border-color: #f0c4c1;
}

.pe-interpretacion-eyebrow {
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7382;
}

.pe-interpretacion-state {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #2d3440;
}

@media (max-width: 760px) {
  .pe-help-grid {
    grid-template-columns: 1fr;
  }
}
