/* RASTREO-RESUMEN-REPORTES-v1 — estilos de «Resumen» y «Reportes» del módulo Rastreo. Prefijo .rgt- (no toca .rgps-).
   Paleta: azul del módulo; semáforo verde/ámbar/rojo con texto oscuro sobre fondo claro (contraste ≥ 4.5:1); el color nunca va solo (siempre hay texto). */
.rgt {
  --rgt-azul: var(--azul, #1A3C8F); --rgt-azul-osc: var(--azul-dark, #0F2560); --rgt-azul-bg: var(--azul-bg, #EDF1F9);
  --rgt-gris: var(--gris, #64748B); --rgt-borde: var(--borde, #E2E8F0); --rgt-texto: var(--texto, #1E293B);
  --rgt-ok-bg: #DCFCE7; --rgt-ok: #166534; --rgt-aten-bg: #FEF3C7; --rgt-aten: #92400E; --rgt-rev-bg: #FEE2E2; --rgt-rev: #991B1B;
  --rgt-radio: var(--radio, 10px);
  min-height: 100%; background: var(--gris-light, #F1F5F9); color: var(--rgt-texto); font-size: 14px; line-height: 1.5;
  display: flex; flex-direction: column;
}
.rgt *, .rgt *::before, .rgt *::after { box-sizing: border-box; }
.rgt [hidden] { display: none !important; }

/* ---- cabecera y filtros ---- */
.rgt-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--rgt-borde); }
.rgt-titulo { margin: 0; font-size: 18px; font-weight: 700; color: var(--rgt-azul-osc); }
.rgt-cab-sub { display: block; font-size: 13px; color: var(--rgt-gris); margin-top: 2px; }
.rgt-filtros, .rgt-filtros-fila { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--rgt-borde); }
.rgt-filtros-fila { padding-top: 0; }
.rgt-campo { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.rgt-campo-lbl { font-size: 12px; font-weight: 600; color: var(--rgt-gris); }
.rgt-input { min-height: 40px; padding: 8px 10px; border: 1px solid var(--rgt-borde); border-radius: var(--rgt-radio); background: #fff; font: inherit; color: var(--rgt-texto); }
.rgt-input:focus-visible { outline: 2px solid var(--azul-light, #2B5CC3); outline-offset: 1px; }

.rgt-btn { min-height: 40px; padding: 8px 14px; border: 1px solid var(--rgt-borde); border-radius: var(--rgt-radio); background: #fff; color: var(--rgt-azul); font: inherit; font-weight: 600; cursor: pointer; transition: background-color .15s, border-color .15s; }
.rgt-btn:hover { background: var(--rgt-azul-bg); border-color: var(--rgt-azul); }
.rgt-btn:focus-visible, .rgt-seg-op:focus-visible, .rgt-th-btn:focus-visible, .rgt-celda-btn:focus-visible, .rgt-col:focus-visible, .rgt-kpi-click:focus-visible, .rgt-tipo:focus-visible { outline: 2px solid var(--azul-light, #2B5CC3); outline-offset: 2px; }
.rgt-btn[disabled] { opacity: .5; cursor: not-allowed; }
.rgt-btn-principal { background: var(--rgt-azul); border-color: var(--rgt-azul); color: #fff; }
.rgt-btn-principal:hover { background: var(--rgt-azul-osc); border-color: var(--rgt-azul-osc); }
.rgt-btn-suave { background: var(--rgt-azul-bg); border-color: transparent; }
.rgt-btn-chico { min-height: 36px; padding: 6px 12px; font-size: 13px; }

.rgt-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rgt-borde); border-radius: var(--rgt-radio); overflow: hidden; background: #fff; }
.rgt-seg-op { border: 0; background: #fff; min-height: 40px; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--rgt-gris); cursor: pointer; transition: background-color .15s, color .15s; }
.rgt-seg-op + .rgt-seg-op { border-left: 1px solid var(--rgt-borde); }
.rgt-seg-op:hover { background: var(--rgt-azul-bg); }
.rgt-seg-on, .rgt-seg-on:hover { background: var(--rgt-azul); color: #fff; }

.rgt-umbrales { padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--rgt-borde); }
.rgt-umbrales-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 10px 0; }
.rgt-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.rgt-nota { margin: 6px 0 0; font-size: 12.5px; color: var(--rgt-gris); }
.rgt-aviso { margin: 10px 0; padding: 10px 14px; border-radius: var(--rgt-radio); background: var(--rgt-aten-bg); color: var(--rgt-aten); font-size: 13px; }
.rgt-ok { margin: 0; padding: 12px 14px; border-radius: var(--rgt-radio); background: var(--rgt-ok-bg); color: var(--rgt-ok); font-weight: 600; }

/* ---- cuerpo ---- */
.rgt-cuerpo { padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 18px; }
.rgt-seccion { background: #fff; border: 1px solid var(--rgt-borde); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.rgt-seccion-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.rgt-seccion-tit { margin: 0; font-size: 15px; font-weight: 700; color: var(--rgt-azul-osc); }
.rgt-seccion-sub { font-size: 12.5px; color: var(--rgt-gris); margin-right: auto; }
.rgt-seccion-cab .rgt-btn { margin-left: 0; }
.rgt-seccion-cuerpo { display: flex; flex-direction: column; gap: 12px; }

/* ---- tarjetas ---- */
.rgt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.rgt-kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; text-align: left; background: #fff; border: 1px solid var(--rgt-borde); border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); font: inherit; color: inherit; }
.rgt-kpi-click { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.rgt-kpi-click:hover { border-color: var(--rgt-azul); box-shadow: 0 4px 14px rgba(26, 60, 143, .12); }
.rgt-kpi-lbl { font-size: 12.5px; font-weight: 600; color: var(--rgt-gris); }
.rgt-kpi-num { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--rgt-azul-osc); overflow-wrap: anywhere; }
.rgt-kpi-sub { font-size: 12.5px; color: var(--rgt-gris); }
.rgt-kpi-var { font-size: 12px; color: var(--rgt-gris); }
.rgt-kpi-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }

/* ---- semáforo ---- */
.rgt-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.rgt-chip-punto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.rgt-chip-bien { background: var(--rgt-ok-bg); color: var(--rgt-ok); }
.rgt-chip-atencion { background: var(--rgt-aten-bg); color: var(--rgt-aten); }
.rgt-chip-revisar { background: var(--rgt-rev-bg); color: var(--rgt-rev); }
.rgt-chip-sin_datos { background: #E2E8F0; color: #334155; }
.rgt-chip-n { font-weight: 800; }

/* ---- requiere atención ---- */
.rgt-atencion { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.rgt-aten { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--rgt-borde); border-left-width: 5px; border-radius: 12px; background: #fff; }
.rgt-aten-revisar { border-left-color: #DC2626; }
.rgt-aten-atencion { border-left-color: #F59E0B; }
.rgt-aten-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rgt-aten-nombre { font-size: 14.5px; overflow-wrap: anywhere; }
.rgt-motivos { margin: 0; padding-left: 18px; font-size: 13px; color: var(--rgt-texto); }

/* ---- tablas ---- */
.rgt-tabla-wrap { overflow-x: auto; border: 1px solid var(--rgt-borde); border-radius: 12px; }
.rgt-tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rgt-tabla th { position: sticky; top: 0; background: #F8FAFC; text-align: left; font-size: 12.5px; font-weight: 700; color: var(--rgt-gris); padding: 8px 12px; border-bottom: 1px solid var(--rgt-borde); white-space: nowrap; }
.rgt-tabla td { padding: 9px 12px; border-bottom: 1px solid #EEF2F7; vertical-align: middle; white-space: nowrap; }
.rgt-tabla tbody tr:last-child td { border-bottom: 0; }
.rgt-tabla .rgt-num { text-align: right; font-variant-numeric: tabular-nums; }
.rgt-th-btn { border: 0; background: none; padding: 0; min-height: 28px; font: inherit; font-weight: 700; color: inherit; cursor: pointer; }
.rgt-th-btn:hover { color: var(--rgt-azul); }
.rgt-celda-btn { border: 0; background: none; padding: 4px 0; min-height: 32px; font: inherit; font-weight: 600; color: var(--rgt-azul); cursor: pointer; text-align: left; }
.rgt-fila-click { cursor: pointer; transition: background-color .12s; }
.rgt-fila-click:hover { background: var(--rgt-azul-bg); }
.rgt-fila-activa { background: var(--rgt-azul-bg); box-shadow: inset 4px 0 0 var(--rgt-azul); }
.rgt-sub td { background: #F8FAFC; }

/* ---- barras por día ---- */
.rgt-barras { display: flex; align-items: stretch; gap: 4px; height: 190px; padding-top: 6px; overflow-x: auto; }
.rgt-col { flex: 1 1 0; min-width: 22px; max-width: 110px; display: flex; flex-direction: column; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; border-radius: 6px; }
.rgt-col-zona { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.rgt-col-barra { display: block; width: 100%; background: #93B4F0; border-radius: 6px 6px 0 0; transition: background-color .15s, height .25s; }
.rgt-col:hover .rgt-col-barra { background: var(--rgt-azul); }
.rgt-col-on .rgt-col-barra { background: var(--rgt-azul-osc); }
.rgt-col-val { font-size: 11px; font-weight: 700; color: var(--rgt-azul-osc); text-align: center; white-space: nowrap; min-height: 16px; }
.rgt-col-lbl { min-height: 20px; font-size: 11px; color: var(--rgt-gris); text-align: center; white-space: nowrap; }

/* ---- alertas por tipo ---- */
.rgt-tipos { display: flex; flex-wrap: wrap; gap: 8px; }
.rgt-tipo { display: inline-flex; align-items: baseline; gap: 8px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--rgt-borde); border-radius: 999px; background: #fff; font: inherit; cursor: pointer; transition: border-color .15s; }
.rgt-tipo:hover { border-color: var(--rgt-azul); }
.rgt-tipo-n { font-weight: 800; color: var(--rgt-azul-osc); }
.rgt-tipo-t { }
.rgt-tipo-sev { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--rgt-gris); }
.rgt-tipo-alta .rgt-tipo-sev { color: var(--rgt-rev); }
.rgt-tipo-media .rgt-tipo-sev { color: var(--rgt-aten); }

/* ---- estados: vacío y cargando ---- */
.rgt-estado { padding: 40px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rgt-estado-tit { font-size: 16px; font-weight: 700; color: var(--rgt-azul-osc); }
.rgt-estado-sub { color: var(--rgt-gris); max-width: 420px; }
.rgt-skel { display: grid; gap: 12px; }
.rgt-skel-bloque { height: 84px; border-radius: 14px; background: linear-gradient(90deg, #E8EDF4 25%, #F3F6FA 50%, #E8EDF4 75%); background-size: 200% 100%; animation: rgt-brillo 1.4s linear infinite; }
@keyframes rgt-brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .rgt-skel-bloque { animation: none; }
  .rgt *, .rgt *::before, .rgt *::after { transition: none !important; }
}
@media (max-width: 767px) {
  .rgt-cab, .rgt-filtros, .rgt-cuerpo, .rgt-umbrales { padding-left: 12px; padding-right: 12px; }
  .rgt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rgt-kpi-num { font-size: 20px; }
  .rgt-col { min-width: 44px; } /* objetivo táctil mínimo; las barras se desplazan en horizontal */
  .rgt-campo, .rgt-seg { width: 100%; }
  .rgt-seg-op { flex: 1; }
}

/* ---- Reportes (rastreo-informes.js) ---- */
.rgt-inf-controles .rgt-btn, .rgt-inf-controles .rgt-input, .rgt-inf-controles .rgt-seg-op { min-height: 44px; }
.rgt-inf-controles > .rgt-seg { align-self: flex-start; margin: 12px 20px 0; }
.rgt-inf-controles > .rgt-seccion { margin: 0 20px 20px; }
.rgt-inf-controles > .rgt-filtros { border-bottom: 0; }
.rgt-inf-controles > .rgt-aviso { margin: 8px 20px; }
.rgt-sub > td { padding: 10px 12px 14px 28px; }
.rgt-sub .rgt-tabla-wrap { background: #fff; }
.rgt-sub .rgt-btn { margin-top: 10px; }
@media (max-width: 767px) { .rgt-inf-controles > .rgt-seg { margin-left: 12px; margin-right: 12px; } .rgt-inf-controles > .rgt-seccion { margin-left: 12px; margin-right: 12px; } }
