.viz-root {
  color-scheme: light;
  --fondo: #f3f3f1;
  --surface-1: #fcfcfb;
  --borde: #e4e3df;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7973;
  --series-1: #2a78d6;
  --series-1-suave: #cde2fb;
  --acento: #1f5fae;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radio: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text-primary);
  background: var(--fondo);
  min-height: 100vh;
}
/* Modo TV: tema oscuro seleccionado (pasos del mismo sistema, no un invertido) */
.viz-root.tv {
  color-scheme: dark;
  --fondo: #111110;
  --surface-1: #1a1a19;
  --borde: #2c2c2a;
  --grid: #262624;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --series-1: #3987e5;
  --series-1-suave: #1d3a5f;
  --acento: #3987e5;
}
* { box-sizing: border-box; }
body { margin: 0; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
button, input, select { font: inherit; color: inherit; }
code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }

main { max-width: 1440px; margin: 0 auto; padding: 16px 20px 40px; display: grid; gap: 16px; }

/* Cabezal */
.cabezal { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca b { display: block; font-size: 18px; }
.marca small { color: var(--text-secondary); font-size: 13px; }
.marca-logo { height: 46px; width: auto; display: block; }
.marca-txt { border-left: 1px solid var(--borde); padding-left: 12px; }
.sync { margin-left: auto; font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.sync .punto { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.acciones { display: flex; gap: 8px; }

.btn { border: 1px solid var(--borde); background: var(--surface-1); border-radius: 8px; padding: 7px 14px; cursor: pointer; }
.btn:hover { border-color: var(--text-muted); }
.btn-primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn-sutil { background: transparent; }

.aviso { background: #fff6dd; border: 1px solid #f1d58a; color: #5c4400; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* Filtros: una sola fila sobre los gráficos */
.filtros { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.segmentado { display: inline-flex; background: var(--surface-1); border: 1px solid var(--borde); border-radius: 10px; padding: 3px; }
.segmentado button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--text-secondary); }
.segmentado button[aria-pressed="true"] { background: var(--acento); color: #fff; }
.rango { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.rango input { border: 1px solid var(--borde); background: var(--surface-1); border-radius: 8px; padding: 5px 8px; }
.periodo-txt { color: var(--text-muted); font-size: 13px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; }
.kpi { background: var(--surface-1); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; }
.kpi .lbl { font-size: 13px; color: var(--text-secondary); }
.kpi .val { font-size: 30px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin-left: 3px; }
.kpi .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.estado { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.estado::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.estado.bien { color: var(--good); }
.estado.mal { color: var(--critical); }
.estado.alerta { color: #a46e00; }
.tv .estado.alerta { color: var(--warning); }

/* Tarjetas */
.tarjeta { background: var(--surface-1); border: 1px solid var(--borde); border-radius: var(--radio); padding: 14px 16px; min-width: 0; }
.tarjeta-tit { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.nota { font-size: 12px; color: var(--text-muted); }
.grilla-alertas { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: stretch; }
@media (max-width: 1000px) { .grilla-alertas { grid-template-columns: 1fr; } }
.tv .grilla-alertas { grid-template-columns: 1fr; }
.grilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grilla-2 { grid-template-columns: 1fr; } }

/* Ranking */
.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th { text-align: right; font-size: 12px; font-weight: 500; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid var(--borde); white-space: nowrap; }
th:nth-child(-n+2) { text-align: left; }
td { text-align: right; padding: 9px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td:nth-child(-n+2) { text-align: left; }
tr.fuera td { color: var(--text-muted); }
.pos { width: 34px; font-weight: 700; color: var(--text-secondary); }
.pos.top { color: var(--acento); }
.nombre { font-weight: 600; }
.chip { font-size: 11px; padding: 1px 6px; border-radius: 10px; border: 1px solid var(--borde); color: var(--text-secondary); margin-left: 6px; font-weight: 500; }
.puntaje { font-weight: 700; }
.mini-barra { display: inline-block; width: 60px; height: 6px; background: var(--grid); border-radius: 3px; vertical-align: middle; margin-left: 8px; position: relative; overflow: hidden; }
.mini-barra i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 3px 3px 0; }

/* Destacados / revisar */
.item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.item:last-child { border-bottom: 0; }
.item small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; white-space: normal; }
.vacio { color: var(--text-muted); font-size: 13px; padding: 6px 0; }

/* Gráficos */
.graf { position: relative; width: 100%; }
.graf svg { display: block; width: 100%; height: auto; overflow: visible; }
.graf text { fill: var(--text-secondary); font-size: 12px; }
.graf .eje line, .graf .grid line { stroke: var(--grid); }
.graf .meta { stroke: var(--text-primary); stroke-dasharray: 4 4; stroke-width: 1.5; }
.graf .mediana { stroke: var(--text-muted); stroke-dasharray: 2 3; stroke-width: 1.5; }
.graf .barra { fill: var(--series-1); pointer-events: none; }
.graf text, .graf .meta, .graf .mediana { pointer-events: none; }
.graf .hit { fill: transparent; cursor: default; }
.graf .hit:hover + .barra, .graf g.on .barra { fill: var(--acento); }
.leyenda { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); margin-top: 6px; flex-wrap: wrap; }
.leyenda span::before { content: ""; display: inline-block; width: 18px; border-top: 1.5px dashed var(--text-primary); vertical-align: middle; margin-right: 6px; }
.leyenda span.med::before { border-top: 1.5px dotted var(--text-muted); }

.tooltip { position: fixed; pointer-events: none; background: var(--text-primary); color: var(--surface-1); font-size: 12px;
  padding: 7px 10px; border-radius: 8px; z-index: 10; line-height: 1.45; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.tooltip b { font-weight: 650; }

/* Errores */
.form-error { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.form-error input, .form-error select { border: 1px solid var(--borde); background: var(--surface-1); border-radius: 8px; padding: 6px 8px; }
.form-error input[name="detalle"] { flex: 1; min-width: 160px; }
.btn-quitar { border: 0; background: none; color: var(--text-muted); cursor: pointer; }

.pie { font-size: 13px; color: var(--text-secondary); }
.pie summary { cursor: pointer; }
.pie li { margin: 4px 0; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { background: var(--surface-1); border: 1px solid var(--borde); border-radius: 16px; padding: 28px; width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.login-card input { border: 1px solid var(--borde); border-radius: 8px; padding: 9px 10px; background: #fff; color: var(--text-primary); }
.error { color: var(--critical); font-size: 13px; min-height: 1em; margin: 0; }
.cargando { position: fixed; bottom: 16px; right: 16px; background: var(--text-primary); color: var(--surface-1); padding: 6px 12px; border-radius: 8px; font-size: 13px; }

/* ---------- Modo TV ---------- */
.tv main { max-width: none; padding: 24px 32px; gap: 20px; }
.tv .filtros, .tv .solo-oficina, .tv #btn-salir, .tv .aviso { display: none !important; }
.tv .marca b { font-size: 26px; }
.tv .marca small, .tv .sync { font-size: 17px; }
.tv .kpi .lbl { font-size: 18px; }
.tv .kpi .val { font-size: 52px; }
.tv .kpi .sub { font-size: 15px; }
.tv h2 { font-size: 22px; }
.tv .nota { font-size: 15px; }
.tv table { font-size: 22px; }
.tv th { font-size: 16px; }
.tv td { padding: 12px 10px; }
.tv .item { font-size: 20px; }
.tv .item small { font-size: 15px; }
.tv .graf text { font-size: 15px; }

[hidden] { display: none !important; }
#lista-errores th, #lista-errores td { text-align: left; }
.tv .kpi { padding: 12px 16px; }
.tv .kpi .val { font-size: 42px; }
.tv.pantalla-a .grilla-2, .tv.pantalla-a .carga,
.tv.pantalla-b .ranking, .tv.pantalla-b .grilla-alertas, .tv.pantalla-b .grilla-2,
.tv.pantalla-c .ranking, .tv.pantalla-c .grilla-alertas, .tv.pantalla-c .carga { display: none; }
.tv .graf svg { max-height: calc(100vh - 380px); }
.tv .grilla-2 .tarjeta { padding-bottom: 8px; }

.btn:disabled { opacity: .7; cursor: progress; }

/* En "Para revisar" y "Destacados", los items en dos columnas cuando hay lugar */
#revisar .lista, #destacados .lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 24px; }

/* Carga pendiente y estimación */
.carga-grilla { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.carga-izq { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: start; }
@media (max-width: 1100px) { .carga-grilla { grid-template-columns: 1fr; } }
.sub-tit { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.dato { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 14px; }
.dato b { font-size: 18px; font-variant-numeric: tabular-nums; }
.dato.total b { font-size: 24px; }
.estimacion-grande { font-size: 40px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.estimacion-grande small { font-size: 16px; font-weight: 500; color: var(--text-secondary); margin-left: 4px; }
.estimacion-fin { font-size: 15px; margin: 6px 0 12px; }
.simulador { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }
.simulador button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--borde); background: var(--surface-1); cursor: pointer; font-size: 18px; line-height: 1; }
.simulador output { min-width: 28px; text-align: center; font-weight: 650; font-size: 18px; color: var(--text-primary); }
.escenarios { margin-top: 10px; font-size: 13px; color: var(--text-secondary); }
.escenarios span { display: inline-block; margin-right: 14px; }
.escenarios b { color: var(--text-primary); }
.viejos { margin-top: 10px; font-size: 13px; }
.viejos .item { font-size: 13px; padding: 5px 0; }
.tv .estimacion-grande { font-size: 60px; }
.tv .dato { font-size: 18px; } .tv .dato b { font-size: 24px; } .tv .dato.total b { font-size: 32px; }
.tv .estimacion-fin { font-size: 20px; }
.tv .sub-tit { font-size: 16px; }
.tv .viejos .item { font-size: 17px; } .tv .viejos .item small { font-size: 14px; }

/* Productividad y uso del tiempo */
.grilla-prod { display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px; margin-top: 18px; align-items: start; }
@media (max-width: 1100px) { .grilla-prod { grid-template-columns: 1fr; } }
.fila-controles { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.fila-controles .sub-tit { margin: 0 auto 0 0; font-weight: 600; color: var(--text-primary); font-size: 14px; }
.fila-controles select, .fila-controles input { border: 1px solid var(--borde); background: var(--surface-1); border-radius: 8px; padding: 5px 8px; font-size: 13px; }
#tabla-uso td small { color: var(--text-muted); font-size: 11px; margin-left: 3px; }
.graf .linea { fill: none; stroke: var(--series-1); stroke-width: 2; }
.graf .linea-ref { fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-dasharray: 5 4; }
.graf .punto { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
.graf .punto-ref { fill: var(--text-muted); stroke: var(--surface-1); stroke-width: 2; pointer-events: none; }
.graf .tramo-pick { fill: var(--series-1); pointer-events: none; }
.graf .tramo-control { fill: #eb6834; pointer-events: none; }
.tv .graf .tramo-control { fill: #d95926; }
.graf .tramo-marca { fill: var(--text-primary); pointer-events: none; }
.graf .fondo-fila { fill: var(--grid); opacity: .45; }
.leyenda i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.leyenda span.sin::before { display: none; }

/* ---------- Tonos por módulo (fondo tenue + acento junto al título) ---------- */
.tarjeta[class*="tono-"] { background: var(--tono-fondo); border-color: var(--tono-borde); }
.tarjeta[class*="tono-"] .tarjeta-tit h2 { display: flex; align-items: center; gap: 8px; }
.tarjeta[class*="tono-"] .tarjeta-tit h2::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: var(--tono-acento); }
.tono-azul    { --tono-fondo: #f3f7fd; --tono-borde: #dde8f7; --tono-acento: #2a78d6; }
.tono-verde   { --tono-fondo: #f2f8f2; --tono-borde: #dcecdc; --tono-acento: #0ca30c; }
.tono-ambar   { --tono-fondo: #fdf8ec; --tono-borde: #f3e6c4; --tono-acento: #eda100; }
.tono-violeta { --tono-fondo: #f6f4fc; --tono-borde: #e5e0f5; --tono-acento: #7a5bd6; }
.tono-agua    { --tono-fondo: #f0f8f6; --tono-borde: #d7ece6; --tono-acento: #1baf7a; }
.tono-gris    { --tono-fondo: #f8f8f6; --tono-borde: #e6e5e1; --tono-acento: #7a7973; }
.tono-rosa    { --tono-fondo: #fcf4f5; --tono-borde: #f2dfe2; --tono-acento: #e87ba4; }
.tv .tono-azul    { --tono-fondo: #172030; --tono-borde: #22324a; --tono-acento: #3987e5; }
.tv .tono-verde   { --tono-fondo: #16231a; --tono-borde: #213826; --tono-acento: #1fb51f; }
.tv .tono-ambar   { --tono-fondo: #251f12; --tono-borde: #3a301a; --tono-acento: #c98500; }
.tv .tono-violeta { --tono-fondo: #1e1a2b; --tono-borde: #2e2842; --tono-acento: #9479e0; }
.tv .tono-agua    { --tono-fondo: #142320; --tono-borde: #1f3631; --tono-acento: #199e70; }
.tv .tono-gris    { --tono-fondo: #1c1c1b; --tono-borde: #2c2c2a; --tono-acento: #8f8e86; }
.tono-ambar .item, .tono-verde .item, .tono-violeta .dato, .tono-violeta .item { border-color: var(--tono-borde); }
#revisar .lista { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
#destacados .lista { grid-template-columns: 1fr; }
.tv #destacados .lista { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.mejora { color: var(--good); font-weight: 600; white-space: nowrap; }
.empeora { color: var(--critical); font-weight: 600; white-space: nowrap; }

/* Diálogo de exportación */
.dialogo { border: 1px solid var(--borde); border-radius: 14px; padding: 22px; width: min(520px, 92vw); background: var(--surface-1); color: var(--text-primary); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.dialogo::backdrop { background: rgba(0,0,0,.35); }
.dialogo h2 { font-size: 17px; margin-bottom: 4px; }
.opcion { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; margin-top: 10px; cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--acento); background: #f3f7fd; }
.opcion input { margin-top: 3px; }
.opcion small { display: block; color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
#pdf-operario { width: 100%; margin-top: 8px; border: 1px solid var(--borde); border-radius: 8px; padding: 7px 9px; background: var(--surface-1); }
.dlg-botones { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

#lista-diferencias th.izq-t, #lista-diferencias td.izq-t, #lista-nc th.izq-t, #lista-nc td.izq-t { text-align: left; }

/* Devoluciones (NC) */
.filtros-nc { font-size: 12px; color: var(--text-secondary); margin: -2px 0 8px; }
.filtros-nc input { vertical-align: -2px; margin-right: 4px; }
.etq { font-size: 11px; padding: 1px 7px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.etq-rojo { background: #fde7ea; color: #b4233c; }
.etq-gris { background: #eef0f3; color: #6b7280; }
.btn-mini { font-size: 11px; padding: 2px 8px; }
#lista-nc tr.gris td { color: var(--text-muted); }

/* Guía interactiva */
.guia { position: fixed; inset: 0; z-index: 1000; }
.guia-foco { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .62); outline: 3px solid #4f8cff; transition: all .3s ease; pointer-events: none; }
.guia-caja { position: fixed; background: #fff; color: #1f2937; border-radius: 14px; padding: 16px 18px 14px; box-shadow: 0 18px 50px rgba(0,0,0,.3); transition: top .3s ease, left .3s ease; }
.guia-caja h3 { margin: 2px 0 6px; font-size: 17px; }
.guia-caja p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: #374151; }
.guia-paso { font-size: 11px; font-weight: 600; color: #4f8cff; text-transform: uppercase; letter-spacing: .04em; }
.guia-puntos { display: flex; gap: 5px; margin-bottom: 12px; }
.guia-puntos span { width: 7px; height: 7px; border-radius: 50%; background: #d8dde6; }
.guia-puntos span.on { background: #4f8cff; width: 18px; border-radius: 4px; }
.guia-botones { display: flex; gap: 8px; align-items: center; }
.guia-botones span { flex: 1; }
.tv #btn-guia { display: none; }

.contacto { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--borde); font-size: 12px; color: var(--text-muted); }
.contacto a { color: inherit; }
.tv .marca-logo { height: 64px; }
.login .marca-logo { height: 56px; }

/* Entregas (Track-POD) */
.kpis-chicos { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpis-chicos .kpi { padding: 10px 12px; background: rgba(255,255,255,.6); }
.kpis-chicos .kpi .val { font-size: 22px; }
.ent-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 14px; }
.ent-cab .filtros-nc { margin: 0; }
.etq-verde { background: #e3f4e3; color: #1d7a1d; }
.etq-ambar { background: #fdf0d8; color: #9a6200; }
#ent-choferes th.izq-t, #ent-choferes td.izq-t, #ent-lista th.izq-t, #ent-lista td.izq-t { text-align: left; }

/* Alertas */
.alertas-lista { display: grid; gap: 8px; }
.alerta-item { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; border: 1px solid var(--tono-borde); background: rgba(255,255,255,.7); border-radius: 10px; padding: 9px 12px; cursor: pointer; font: inherit; color: inherit; }
.alerta-item:hover { background: #fff; }
.alerta-item .punto { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #e0a42a; }
.alerta-item.mal .punto { background: #d0344a; }
.alerta-item b { display: block; font-size: 14px; font-weight: 600; }
.alerta-item small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.alerta-item .ir { margin-left: auto; color: var(--text-muted); font-size: 12px; white-space: nowrap; }

/* OTIF y recorrido */
.servicio-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 18px; align-items: start; }
@media (max-width: 800px) { .servicio-grid { grid-template-columns: 1fr; } }
.otif-grande { border-radius: 12px; padding: 16px 18px; background: rgba(255,255,255,.75); border: 1px solid var(--tono-borde); }
.otif-grande .lbl { font-size: 13px; color: var(--text-secondary); }
.otif-grande .val { font-size: 46px; font-weight: 700; line-height: 1.1; margin: 4px 0; font-variant-numeric: tabular-nums; }
.otif-grande.bien .val { color: #1d7a1d; } .otif-grande.medio .val { color: #a86b00; } .otif-grande.mal .val { color: #c22a40; }
.otif-grande .sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
#otif-partes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 18px; }
.otif-parte .fila { display: flex; justify-content: space-between; font-size: 13px; }
.otif-parte .barra { height: 8px; background: var(--grid); border-radius: 4px; margin: 5px 0 3px; overflow: hidden; }
.otif-parte .barra i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.otif-parte small { font-size: 11px; color: var(--text-muted); }
.rec-barra { display: flex; height: 16px; border-radius: 8px; overflow: hidden; margin: 6px 0 12px; background: var(--grid); }
.rec-barra i { display: block; height: 100%; }
.rec-etapas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
@media (max-width: 900px) { .rec-etapas { grid-template-columns: 1fr; } }
.rec-etapa { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.55); }
.rec-etapa.cuello { outline: 2px solid #e0a42a; background: #fff8ea; }
.rec-etapa .col { width: 10px; height: 10px; border-radius: 3px; margin-top: 4px; flex: none; }
.rec-etapa b { font-size: 13px; } .rec-etapa small { display: block; font-size: 11px; color: var(--text-muted); }
.rec-val { margin-left: auto; text-align: right; white-space: nowrap; }
.caja-nota { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.7); border: 1px solid var(--tono-borde); font-size: 13px; }

/* Etiquetas extra */
.etq-azul { background: #e2ecfb; color: #1f5fae; }
.etq-clase-A { background: #dcefdc; color: #1d7a1d; } .etq-clase-B { background: #fdf0d8; color: #9a6200; } .etq-clase-C { background: #eef0f3; color: #6b7280; }
#fac-lista tr.gris td, #ctrl-lista tr.gris td { color: var(--text-muted); }
#fac-lista th.izq-t, #fac-lista td.izq-t, #qui-lista th.izq-t, #qui-lista td.izq-t, #cli-lista th.izq-t, #cli-lista td.izq-t,
#abc-top th.izq-t, #abc-top td.izq-t, #abc-candidatos th.izq-t, #abc-candidatos td.izq-t, #ctrl-lista th.izq-t, #ctrl-lista td.izq-t,
#otif-fallas th.izq-t, #otif-fallas td.izq-t, #metas-tabla th.izq-t, #metas-tabla td.izq-t { text-align: left; }

/* ABC */
.abc-grid { gap: 18px; }
.abc-fila { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.abc-lbl { width: 46px; text-align: right; color: var(--text-secondary); }
.abc-barra { display: flex; height: 12px; border-radius: 3px; overflow: hidden; min-width: 2px; }
.abc-barra i { display: block; height: 100%; }
.abc-barra .A, .ley.A { background: #3c9a3c; } .abc-barra .B, .ley.B { background: #e8b54a; } .abc-barra .C, .ley.C { background: #c4c9d1; }
.ley { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-left: 6px; }
.abc-n { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Planificación */
.plan-dias { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.plan-dia { background: rgba(255,255,255,.7); border: 1px solid var(--tono-borde); border-radius: 12px; padding: 10px 12px; }
.plan-nom { font-size: 13px; font-weight: 600; text-transform: capitalize; } .plan-nom small { font-weight: 400; color: var(--text-muted); }
.plan-ops { font-size: 30px; font-weight: 700; margin: 2px 0; } .plan-ops small { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-left: 4px; }

/* Metas */
.del-mes { display: flex; gap: 12px; align-items: center; background: linear-gradient(90deg, #fff6dc, rgba(255,255,255,.4)); border: 1px solid #f1dfa6; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.del-mes-ico { font-size: 26px; color: #d9a400; }
.del-mes b { display: block; font-size: 17px; } .del-mes small { display: block; font-size: 12px; color: var(--text-secondary); }
.del-mes.grande b { font-size: 20px; }
.tv .del-mes { background: linear-gradient(90deg, #3a2f12, transparent); border-color: #5a4a1c; padding: 6px 12px; margin-bottom: 8px; } .tv .del-mes b { font-size: 22px; } .tv .del-mes small { font-size: 14px; }
.sem { padding: 1px 6px; border-radius: 6px; }
.sem.bien { background: #e3f4e3; color: #1d7a1d; } .sem.medio { background: #fdf0d8; color: #9a6200; } .sem.mal { background: #fde7ea; color: #b4233c; }
.baja { color: #c22a40; font-size: 11px; }

/* Diálogos nuevos */
.seg-campos, .config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.seg-campos label, .config-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.seg-campos input, .config-grid input { font: inherit; padding: 7px 9px; border: 1px solid var(--borde); border-radius: 8px; }

/* ================= Menú lateral ================= */
.con-menu { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 20px; align-items: start; }
.contenido { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.menu-lateral { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; background: var(--surface-1); border: 1px solid var(--borde); border-radius: var(--radio); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.menu-grupo { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; border-radius: 9px; padding: 9px 10px; font: inherit; font-size: 14px; color: var(--text-primary); cursor: pointer; text-align: left; }
.menu-grupo:hover { background: rgba(0,0,0,.04); }
.menu-grupo.abierto { background: #fff; font-weight: 600; box-shadow: 0 0 0 1px var(--borde); }
.menu-punto { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.menu-nombre { flex: 1; }
.menu-cont { background: #fde7ea; color: #b4233c; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.menu-secciones { margin: 2px 0 8px 14px; padding-left: 12px; border-left: 2px solid var(--grupo-color, var(--borde)); display: flex; flex-direction: column; }
.menu-seccion { border: 0; background: transparent; text-align: left; font: inherit; font-size: 13px; color: var(--text-secondary); padding: 5px 8px; border-radius: 6px; cursor: pointer; line-height: 1.3; }
.menu-seccion:hover { color: var(--text-primary); background: rgba(0,0,0,.035); }
.menu-seccion.activa { color: var(--grupo-color, var(--acento)); font-weight: 600; }
.menu-pie { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--borde); display: flex; flex-direction: column; gap: 6px; }
.menu-boton { width: 100%; justify-content: flex-start; text-align: left; }
.btn-menu { display: none; }
#app:not(.tv) .g-oculto { display: none !important; }
.tv .con-menu { display: block; }
.tv .contenido { gap: 0; }
.tv .contenido > section { margin-bottom: 16px; }

/* Ranking resumido */
.podio { display: flex; flex-direction: column; gap: 6px; }
.podio-fila { display: grid; grid-template-columns: 28px minmax(110px, 180px) minmax(80px, 1fr) 50px; grid-template-areas: "pos nom barra pts" ". sub sub sub"; align-items: center; gap: 2px 10px; padding: 6px 8px; border-radius: 10px; background: rgba(255,255,255,.65); }
.podio-fila .pos { grid-area: pos; font-weight: 700; color: var(--text-muted); text-align: center; }
.podio-fila .pos.top { color: var(--acento); }
.podio-fila b { grid-area: nom; }
.podio-barra { grid-area: barra; height: 8px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.podio-barra i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.podio-pts { grid-area: pts; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.podio-fila small { grid-area: sub; color: var(--text-muted); font-size: 12px; }

/* Celular / pantallas angostas: el menú se abre con el botón ☰ */
@media (max-width: 960px) {
  .con-menu { grid-template-columns: 1fr; }
  .btn-menu { display: inline-flex; }
  #app:not(.tv) .menu-lateral { display: none; }
  #app.menu-abierto:not(.tv) .menu-lateral { display: flex; position: fixed; z-index: 900; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; border-radius: 0 14px 14px 0; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
}
.contenido > .kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.contenido > .kpis .kpi .val { font-size: 26px; }
.tv .contenido { display: flex; }
.tv .contenido > * { order: 3; }
.tv .contenido > #kpis { order: 0; }
.tv .contenido > #ranking { order: 1; }
.tv .contenido > #destacados-revisar { order: 2; }
.tv .contenido > .kpis .kpi .val { font-size: 44px; }
.tv .contenido > .kpis { gap: 12px; }

/* Reportes mensuales */
.dialogo-ancho { width: min(720px, 94vw); }
.rep-mes { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; font-size: 14px; }
.rep-mes select { font: inherit; padding: 6px 10px; border: 1px solid var(--borde); border-radius: 8px; }
.rep-lista { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.rep-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--surface-1); }
.rep-item > div { flex: 1; min-width: 0; }
.rep-item b { display: block; font-size: 14px; }
.rep-item small { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.aviso-rep { display: inline-block; background: #fdf0d8; color: #8a5a00; border-radius: 6px; padding: 2px 8px; margin: 4px 0; }
