/* Analítica y leads. Mismo lenguaje que el resto del panel: papel cálido, títulos serif, verde sobrio como acento. */

/* Navegación de la cabecera */
.cabecera__nav { display: flex; gap: var(--e1); margin-right: auto; margin-left: var(--e5); }
.cabecera__nav a {
  padding: var(--e2) var(--e3); border-radius: var(--radio); text-decoration: none; color: var(--tinta-suave);
  font-weight: 500; font-size: var(--t-s); border-bottom: 3px solid transparent; border-radius: var(--radio) var(--radio) 0 0;
}
.cabecera__nav a:hover { color: var(--tinta); background: var(--acento-fondo); }
.cabecera__nav a[aria-current="page"] { color: var(--acento-oscuro); border-bottom-color: var(--acento); }
@media (max-width: 760px) {
  .cabecera { flex-wrap: wrap; }
  .cabecera__nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
}

/* Periodo */
.filtros-analitica { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--e3) var(--e5); margin-bottom: var(--e4); }
.periodo { display: flex; flex-wrap: wrap; gap: var(--e3) var(--e5); align-items: center; }
.atajos { display: inline-flex; border: 1px solid var(--linea-fuerte); border-radius: var(--radio); overflow: hidden; background: var(--superficie); }
.atajo {
  font: inherit; font-size: var(--t-s); font-weight: 500; padding: var(--e1) var(--e3); min-height: 2rem; cursor: pointer;
  background: transparent; color: var(--tinta-suave); border: 0; border-right: 1px solid var(--linea); transition: background var(--duracion), color var(--duracion);
}
.atajo:last-child { border-right: 0; }
.atajo:hover { background: var(--acento-fondo); color: var(--tinta); }
.atajo--activo, .atajo--activo:hover { background: var(--acento); color: #fff; }
.fechas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); font-size: var(--t-s); }
.fechas input { width: auto; }
.campo--en-linea { margin-bottom: 0; min-width: 14rem; }
.periodo-texto { color: var(--tinta-suave); font-size: var(--t-s); margin-bottom: var(--e3); }
.aviso-periodo {
  background: var(--e-pendiente-f); color: var(--e-pendiente-t); border-left: 4px solid var(--e-pendiente-b);
  padding: var(--e3) var(--e4); border-radius: var(--radio); font-size: var(--t-s); margin-bottom: var(--e4);
}
.nota { color: var(--tinta-suave); font-size: var(--t-xs); margin: var(--e2) 0 var(--e3); max-width: 70ch; }
.vacio { color: var(--tinta-suave); font-size: var(--t-s); }
.sub { display: block; color: var(--tinta-suave); font-size: var(--t-xs); font-weight: 400; }
.sub--aviso { color: var(--error-t); font-weight: 500; }
span.sub { display: inline; }
.nowrap { white-space: nowrap; }

/* Números grandes */
.cifras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0 0 var(--e6); border-top: 2px solid var(--tinta); border-bottom: 1px solid var(--linea); }
.cifras--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cifra { padding: var(--e4) var(--e4) var(--e4) 0; border-right: 1px solid var(--linea); padding-left: var(--e4); }
.cifra:first-child { padding-left: 0; }
.cifra:last-child { border-right: 0; }
.cifra dt { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.07em; color: var(--tinta-suave); margin-bottom: var(--e2); }
.cifra dd { margin: 0; }
.cifra__n { font-family: var(--fuente-titulo); font-size: var(--t-num); font-weight: 500; line-height: 1; display: block; font-variant-numeric: tabular-nums; }
.cifra__pie { margin: var(--e2) 0 0; font-size: var(--t-xs); color: var(--tinta-suave); }
@media (max-width: 900px) {
  .cifras, .cifras--3 { grid-template-columns: 1fr 1fr; }
  .cifra { border-bottom: 1px solid var(--linea); padding-left: var(--e3); }
  .cifra:nth-child(odd) { padding-left: 0; }
  .cifra:nth-child(even) { border-right: 0; }
}

/* Porcentaje con su número absoluto, o por qué no hay porcentaje */
.prop { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.prop strong { font-variant-numeric: tabular-nums; }
.prop--grande { align-items: flex-start; }
.prop--grande strong { font-family: var(--fuente-titulo); font-size: var(--t-num); line-height: 1; font-weight: 500; }
.prop__cifras { color: var(--tinta-suave); font-size: var(--t-xs); font-weight: 400; font-variant-numeric: tabular-nums; }
.prop__aviso { color: var(--e-pendiente-t); font-size: var(--t-xs); font-weight: 500; }
.prop--nd strong { color: var(--linea-fuerte); }
.tabla td .prop, .tabla th .prop { align-items: flex-end; }
.var { font-size: var(--t-xs); color: var(--tinta-suave); font-variant-numeric: tabular-nums; }
.var--sube { color: var(--e-aprobado-t); font-weight: 500; }
.var--baja { color: var(--error-t); font-weight: 500; }

/* Bloques de contenido */
.bloque { margin: 0 0 var(--e7); }
.bloque > h2 { font-size: var(--t-l); margin-bottom: var(--e1); }
.bloque__pregunta { color: var(--tinta-suave); margin-bottom: var(--e4); max-width: 70ch; }
.bloque h3 { font-size: var(--t-m); margin: var(--e4) 0 var(--e2); }
.bloque--peligro { border: 1px solid var(--error-b); background: var(--error-f); border-radius: var(--radio-g); padding: var(--e4) var(--e5); }
.bloque--seg { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio-g); padding: var(--e4) var(--e5); box-shadow: var(--sombra); }
.acciones { display: flex; gap: var(--e3); flex-wrap: wrap; align-items: center; margin-top: var(--e3); }
.acciones--centro { justify-content: center; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e6); }
.tres-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--e5); }
.graficos-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e5); margin-bottom: var(--e3); }
@media (max-width: 900px) { .dos-col, .tres-col, .graficos-2 { grid-template-columns: 1fr; gap: var(--e4); } }

/* Gráficos */
.figura { margin: 0; min-width: 0; }
.figura figcaption { font-weight: 500; font-size: var(--t-s); margin-bottom: var(--e2); }
.grafico { width: 100%; height: auto; display: block; }
.grafico__guia { stroke: var(--linea); stroke-width: 1; }
.grafico__eje { fill: var(--tinta-suave); font-size: 11px; font-family: var(--fuente-texto); }
.grafico__barra { fill: var(--acento); }
.grafico__barra:hover { fill: var(--acento-oscuro); }
.grafico__barra--parcial { fill: var(--acento-fondo); stroke: var(--acento); stroke-width: 1.5; stroke-dasharray: 3 2; }

/* Embudo */
.embudo { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--e4); max-width: 46rem; }
.embudo__cabecera { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--e1); }
.embudo__nombre { font-weight: 500; }
.embudo__n { font-family: var(--fuente-titulo); font-size: var(--t-l); font-variant-numeric: tabular-nums; }
.embudo__pista { background: #E1E8F2; border-radius: var(--radio); height: 1.1rem; overflow: hidden; }
.embudo__barra { background: var(--acento); height: 100%; border-radius: var(--radio); transition: width 300ms var(--curva); }
.embudo li:nth-child(2) .embudo__barra { background: #2964AC; }
.embudo li:nth-child(3) .embudo__barra { background: #6C94C8; }
.embudo li:nth-child(4) .embudo__barra { background: var(--e-aprobado-b); }
.embudo__paso { margin: var(--e1) 0 0; font-size: var(--t-xs); color: var(--tinta-suave); display: flex; gap: var(--e2); align-items: baseline; }
.embudo__paso .prop { flex-direction: row; align-items: baseline; gap: var(--e2); }

/* Barras horizontales */
.barras-h { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--e2); }
.barras-h li { display: grid; grid-template-columns: minmax(7rem, 14rem) 1fr minmax(4rem, auto); align-items: center; gap: var(--e3); font-size: var(--t-s); }
.barras-h__pista { background: #E1E8F2; border-radius: 999px; height: 0.7rem; overflow: hidden; }
.barras-h__barra { display: block; height: 100%; background: var(--acento); border-radius: 999px; }
.barras-h__valor { text-align: right; font-variant-numeric: tabular-nums; }
.barras-h__valor small { color: var(--tinta-suave); }
@media (max-width: 640px) { .barras-h li { grid-template-columns: 1fr auto; } .barras-h__pista { grid-column: 1 / -1; order: 3; } }

.lista-prop { list-style: none; margin: 0 0 var(--e4); padding: 0; max-width: 40rem; }
.lista-prop li { display: flex; justify-content: space-between; align-items: center; gap: var(--e4); padding: var(--e2) 0; border-bottom: 1px solid var(--linea); font-size: var(--t-s); }

/* Tablas */
.tabla-scroll { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--radio-g); background: var(--superficie); margin-bottom: var(--e3); }
.tabla-scroll:focus-visible { outline-offset: 0; }
.tabla { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.tabla th, .tabla td { padding: var(--e2) var(--e3); text-align: left; vertical-align: top; border-bottom: 1px solid var(--linea); }
.tabla thead th { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--tinta-suave); background: var(--superficie-2); white-space: nowrap; position: sticky; top: 0; }
.tabla tbody tr:last-child > * { border-bottom: 0; }
.tabla tbody tr:hover { background: var(--superficie-2); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla tbody th { font-weight: 500; }
.tabla--leads { min-width: 1180px; }
.tabla--leads td, .tabla--leads th { vertical-align: top; }
.fila-baja { background: #EEF3FA; }
.datos-tabla { margin: var(--e3) 0; }
.datos-tabla summary { cursor: pointer; font-size: var(--t-s); font-weight: 500; color: var(--acento-oscuro); padding: var(--e1) 0; }
.datos-tabla .tabla-scroll { margin-top: var(--e2); max-height: 22rem; overflow-y: auto; }

/* Comparador */
.comparar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--e5); }
.comparar-col { min-width: 0; }
.comparar-col h3 { margin-top: 0; }
.veredicto { background: var(--acento-fondo); border-left: 4px solid var(--acento); padding: var(--e3) var(--e4); border-radius: var(--radio); margin-bottom: var(--e5); }
.veredicto--nd { background: var(--e-pendiente-f); border-left-color: var(--e-pendiente-b); color: var(--e-pendiente-t); }

/* Leads */
.filtros-leads { display: flex; flex-wrap: wrap; gap: var(--e2) var(--e4); align-items: flex-end; margin-bottom: var(--e4); padding: var(--e4); background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio-g); }
.campo--filtro { margin-bottom: 0; min-width: 9rem; flex: 0 1 11rem; }
.campo--busca { flex: 1 1 16rem; }
.quitar-filtros { display: flex; align-items: flex-end; }
.paginacion { display: flex; justify-content: center; align-items: center; gap: var(--e4); margin: var(--e4) 0; font-size: var(--t-s); }
.estado-pantalla--aviso { background: var(--e-pendiente-f); color: var(--e-pendiente-t); border-radius: var(--radio-g); }
.estado-pantalla--aviso h2 { color: var(--e-pendiente-t); }
.estado-pantalla--aviso .nota { margin-left: auto; margin-right: auto; }

/* Chips de seguimiento: punto + texto, nunca solo color */
.chip-seg { display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--t-xs); font-weight: 500; padding: 0.18em 0.7em 0.18em 0.5em; border-radius: 999px; white-space: nowrap; }
.chip-seg::before { content: ""; width: 0.72em; height: 0.72em; border-radius: 50%; border: 2px solid currentColor; box-sizing: border-box; flex: none; }
.chip-seg--pendiente { color: var(--e-pendiente-t); background: var(--e-pendiente-f); }
.chip-seg--contactado { color: var(--e-recibido-t); background: var(--e-recibido-f); }
.chip-seg--contactado::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
.chip-seg--interesado { color: var(--e-revision-t); background: var(--e-revision-f); }
.chip-seg--interesado::before { background: radial-gradient(circle, currentColor 38%, transparent 42%); }
.chip-seg--cita_concertada { color: var(--e-aprobado-t); background: var(--e-aprobado-f); }
.chip-seg--cita_concertada::before { background: currentColor; }
.chip-seg--descartado { color: var(--tinta-suave); background: #E1E8F2; }
.chip-seg--descartado::before { border-style: dashed; }

/* Ficha del lead */
.ficha-lead { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--e6); align-items: start; }
@media (max-width: 900px) { .ficha-lead { grid-template-columns: 1fr; } }
.datos-lead { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: var(--e3) var(--e5); margin: 0 0 var(--e3); }
.datos-lead dt { font-size: var(--t-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--tinta-suave); }
.datos-lead dd { margin: 0; overflow-wrap: anywhere; }
.titulo-landing { display: flex; align-items: center; gap: var(--e3); flex-wrap: wrap; margin-bottom: var(--e4); }
.form-seguimiento .boton { margin-top: var(--e2); }

@media (prefers-reduced-motion: reduce) { .embudo__barra { transition: none; } }

.bloque, .bloque > *, .comparar-col, .dos-col > *, .tres-col > * { min-width: 0; }
.lista-prop li > span:first-child { overflow-wrap: anywhere; }
