/* =====================================================================
   Panel de control de las landings
   ===================================================================== */

@font-face {
  font-family: 'Cuerpo';
  src: url('/assets/fuentes/cuerpo.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --cian: #00BEE5; --cian-osc: #0891B2; --azul: #1081E0; --morado: #342595;
  --tinta: #0F172A; --texto: #475569; --texto-cl: #64748B;
  --linea: #E2E8F0; --fondo: #F1F5F9; --panel: #FFFFFF;
  --verde: #10B981; --ambar: #F59E0B; --rojo: #EF4444; --wa: #25D366;
  --radio: 12px;
  --sombra: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cuerpo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.55;
  color: var(--texto); background: var(--fondo);
}

h1, h2, h3 { color: var(--tinta); margin: 0 0 .5em; line-height: 1.2; font-weight: 700; }
h1 { font-size: 25px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
a { color: var(--azul); }
p { margin: 0 0 1em; }
.gris { color: var(--texto-cl); }
.mini { font-size: 13px; }

/* --- Estructura --- */
.app { display: grid; grid-template-columns: 234px 1fr; min-height: 100vh; }

.lateral {
  background: var(--tinta); color: #94A3B8;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.lateral-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; padding: 0 8px; }
.lateral-marca img { height: 26px; width: auto; }
.lateral-sub { padding: 0 8px 20px; font-size: 12px; color: #64748B; }

.menu { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 2px; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: #CBD5E1; text-decoration: none; font-size: 14.5px; font-weight: 600;
}
.menu a:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu a.activo { background: var(--cian); color: var(--tinta); }
.menu-sep { margin: 16px 8px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #475569; }

.lateral-pie { border-top: 1px solid rgba(255,255,255,.1); padding: 14px 8px 0; font-size: 13px; }
.lateral-pie a { color: #94A3B8; }

.principal { padding: 24px 28px 60px; min-width: 0; }

.cabecera { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 20px; }
.cabecera h1 { margin: 0; }
.cabecera .der { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* --- Filtros --- */
.filtros {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 14px 16px; margin-bottom: 20px;
}
.filtro { display: grid; gap: 4px; }
.filtro label { font-size: 12px; font-weight: 700; color: var(--texto-cl); text-transform: uppercase; letter-spacing: .04em; }
.filtro select, .filtro input {
  padding: 8px 10px; font-family: inherit; font-size: 14px; color: var(--tinta);
  background: #fff; border: 1px solid var(--linea); border-radius: 8px; min-width: 130px;
}
.rangos { display: flex; gap: 6px; flex-wrap: wrap; }
.rangos a {
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: #fff; border: 1px solid var(--linea); color: var(--texto); text-decoration: none;
}
.rangos a.activo { background: var(--tinta); border-color: var(--tinta); color: #fff; }

/* --- Botones --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 0; border-radius: 9px;
  font-family: inherit; font-size: 14.5px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn-primario { background: var(--cian); color: var(--tinta); }
.btn-oscuro   { background: var(--tinta); color: #fff; }
.btn-claro    { background: #fff; color: var(--tinta); border: 1px solid var(--linea); }
.btn-rojo     { background: var(--rojo); color: #fff; }
.btn-mini     { padding: 6px 11px; font-size: 13px; }

/* --- Tarjetas de cifras --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 15px 16px; box-shadow: var(--sombra);
}
.kpi-nombre { font-size: 12.5px; font-weight: 700; color: var(--texto-cl); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.kpi-valor { font-size: 27px; font-weight: 700; color: var(--tinta); line-height: 1.1; }
.kpi-pie { font-size: 12.5px; color: var(--texto-cl); margin-top: 3px; }
.kpi-var { font-size: 12.5px; font-weight: 700; }
.sube { color: var(--verde); } .baja { color: var(--rojo); } .igual { color: var(--texto-cl); }

/* --- Bloques --- */
.bloque {
  background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--sombra);
}
.bloque-cab { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.bloque-cab h2 { margin: 0; }
.bloque-cab .der { margin-left: auto; font-size: 13px; color: var(--texto-cl); }
.rejilla-2 { display: grid; gap: 20px; }

/* --- Tablas --- */
.tabla-caja { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.datos { width: 100%; border-collapse: collapse; font-size: 14px; }
table.datos th {
  text-align: left; padding: 9px 10px; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--texto-cl); border-bottom: 2px solid var(--linea);
}
table.datos td { padding: 11px 10px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
table.datos tr:hover td { background: #F8FAFC; }
table.datos .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.datos .destacado { font-weight: 700; color: var(--tinta); }

.vacio { padding: 34px 20px; text-align: center; color: var(--texto-cl); }

/* --- Etiquetas --- */
.eti {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.eti-punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* --- Barras dentro de tabla --- */
.barra-dato { height: 6px; border-radius: 4px; background: var(--linea); overflow: hidden; min-width: 60px; }
.barra-dato i { display: block; height: 100%; border-radius: 4px; background: var(--cian); }

/* --- Nota de calidad --- */
.nota { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.nota-circulo {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff;
}

/* --- Embudo --- */
.embudo { display: grid; gap: 8px; }
.embudo-paso { display: grid; grid-template-columns: 190px 1fr auto; gap: 14px; align-items: center; }
.embudo-nombre { font-size: 14px; font-weight: 600; color: var(--tinta); }
.embudo-barra { height: 30px; background: var(--fondo); border-radius: 8px; overflow: hidden; }
.embudo-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--cian), var(--azul)); }
.embudo-cifra { font-size: 14px; white-space: nowrap; }
.embudo-cifra strong { color: var(--tinta); font-size: 16px; }

/* --- Gráfica --- */
.grafica { width: 100%; height: 230px; }
.grafica-leyenda { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 13px; }
.grafica-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.grafica-leyenda i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* --- Detalle de lead --- */
.lead-cab { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.lead-datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.dato { display: grid; gap: 2px; }
.dato dt { font-size: 12px; font-weight: 700; color: var(--texto-cl); text-transform: uppercase; letter-spacing: .04em; }
.dato dd { margin: 0; font-size: 15px; color: var(--tinta); }

.historial { list-style: none; margin: 0; padding: 0; }
.historial li { padding: 12px 0 12px 22px; border-left: 2px solid var(--linea); position: relative; }
.historial li::before {
  content: ''; position: absolute; left: -6px; top: 17px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--cian); border: 2px solid #fff;
}
.historial .cuando { font-size: 12.5px; color: var(--texto-cl); }

/* --- Formularios del panel --- */
.form-panel { display: grid; gap: 14px; max-width: 560px; }
.form-panel label { font-size: 13.5px; font-weight: 700; color: var(--tinta); display: block; margin-bottom: 4px; }
.form-panel input[type=text], .form-panel input[type=password], .form-panel input[type=number],
.form-panel input[type=date], .form-panel select, .form-panel textarea {
  width: 100%; padding: 10px 12px;
  font-family: inherit; font-size: 15px; color: var(--tinta);
  background: #fff; border: 1px solid var(--linea); border-radius: 9px;
}
.form-panel textarea { min-height: 90px; resize: vertical; }
.form-linea { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

.aviso { padding: 12px 15px; border-radius: 9px; margin-bottom: 16px; font-size: 14.5px; }
.aviso-ok   { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.aviso-mal  { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.aviso-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }

/* --- Ayuda --- */
.ayuda-def { border-left: 3px solid var(--cian); padding: 4px 0 4px 14px; margin-bottom: 18px; }
.ayuda-def h3 { margin-bottom: 3px; }
.ayuda-def p { margin: 0; font-size: 14.5px; }

/* --- Entrada --- */
.entrar {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(155deg, #0B1220 0%, #17255A 100%); padding: 20px;
}
.entrar-caja {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 30px 28px; box-shadow: 0 20px 48px rgba(15,23,42,.3);
}
.entrar-caja img { height: 32px; width: auto; margin-bottom: 18px; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .lateral { position: static; height: auto; }
  .menu { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .menu-sep { display: none; }
  .principal { padding: 18px 16px 50px; }
  .tabla-caja { margin: 0 -16px; padding: 0 16px; }
}
@media (min-width: 1100px) {
  .rejilla-2 { grid-template-columns: 1fr 1fr; }
}

@media print {
  .lateral, .filtros, .rangos { display: none; }
  .app { grid-template-columns: 1fr; }
}
