/* =====================================================================
   CSS propio del sistema Control de hallazgos ambientales
   Bootstrap es la base: aqui solo colores de marca y ajustes que Bootstrap no resuelve.
   ===================================================================== */

body { font-family: 'Sen', sans-serif; }

/* colores de la plataforma */
.backgroundall { background-color: #F8F8F8; }
.backgroundblue { background-color: #2d3d70; }
.backgroundgold { background-color: #DC582A; }
.textcolorblue { color: #0961ae; }
.tectcolorgold { color: #DC582A; }
.textcolorpetroleo { color: #003E51; }

.btn.backgroundblue:hover, .btn.backgroundblue:focus { background-color: #24315c; color: #fff; }
.btn.backgroundgold:hover, .btn.backgroundgold:focus { background-color: #c44a20; color: #fff; }
.badge.backgroundblue, .badge.backgroundgold { color: #fff; }

/* footer siempre abajo: el contenido ocupa el espacio libre */
body.backgroundall { min-height: 100vh; display: flex; flex-direction: column; }
body.backgroundall > .wrapper { flex: 1 0 auto; padding-top: 60px; }
body.backgroundall > footer { flex-shrink: 0; }
.pie-sistema { opacity: .8; }
.menu-opciones .nav-link { cursor: pointer; }

/* titulo de las ventanas */
.titulo-ventana { font-size: calc(1.4rem + 1.2vw); }
@media (min-width: 1200px) { .titulo-ventana { font-size: 2.4rem; } }

/* iconos de acciones dentro de las tablas */
.accion { cursor: pointer; vertical-align: middle; user-select: none; }
.accion + .accion { margin-left: 8px; }

/* datatables */
table.dataTable thead th { white-space: nowrap; text-align: center; }
table.dataTable td { vertical-align: middle; }
div.dt-container .dt-search input { border: 1px solid #ced4da; border-radius: 6px; padding: 4px 8px; }
div.dt-container .dt-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
div.dt-container .dt-buttons .btn { min-width: 70px; }
#tablahallazgos .texto-largo { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* select2 dentro de modales de bootstrap */
.select2-container { width: 100% !important; }

/* filas anuladas: sombreado rojo (sobre el rayado y hover de DataTables) */
table.dataTable tbody tr.fila-anulada > td { background-color: #f8d7da !important; box-shadow: none !important; color: #842029; }
table.dataTable tbody tr.fila-anulada > td:first-child { border-left: 4px solid #dc3545; }

/* categorias de severidad (texto blanco sobre fondo con contraste >= 4.5:1) */
.badge-ncm { background-color: #b02a37; color: #fff; }
.badge-ncmenor { background-color: #DC582A; color: #fff; }
.badge-obs { background-color: #2d3d70; color: #fff; }

/* ---------------- inicio e indicadores ---------------- */
.tarjeta-dashboard { background: #fff; border: 1px solid #e3e6ee; border-radius: 10px; padding: 14px 16px; }
.etiqueta-indicador { font-size: .85rem; color: #6c757d; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.etiqueta-indicador .material-icons { font-size: 18px; color: #DC582A; }
.indicador-principal { border-left: 4px solid #DC582A; }
.valor-principal { font-size: clamp(1.7rem, 2.6vw, 2.4rem); font-weight: 700; color: #2d3d70; line-height: 1.15; }
.valor-indicador { font-size: 1.35rem; font-weight: 700; color: #2d3d70; line-height: 1.2; }
.detalle-indicador { font-size: .8rem; color: #6c757d; margin-top: 2px; }
.titulo-grafico { font-weight: 700; color: #2d3d70; }
.subtitulo-grafico { font-size: .8rem; color: #6c757d; margin-bottom: 8px; }
.contenedor-grafico { position: relative; height: 260px; }
.tabla-dashboard { font-size: .85rem; }
.fila-enlace { cursor: pointer; }
.kpi { display: block; border: 1px solid #dee2e6; border-left: 4px solid #2d3d70; border-radius: 8px; background: #fff; padding: 10px 14px; height: 100%; }
button.kpi:hover { box-shadow: 0 2px 8px rgba(45, 61, 112, .12); }
.kpi-titulo { font-size: .85rem; color: #6c757d; display: flex; align-items: center; gap: 4px; }
.kpi-titulo .material-icons { font-size: 18px; }
.kpi-valor { font-size: 1.8rem; font-weight: bold; line-height: 1.2; color: #2d3d70; }
.kpi-destacado { border-left-color: #DC582A; }
.kpi-destacado .kpi-valor { color: #DC582A; }
.btn-acceso { padding: 14px; font-size: 1.05rem; }
.btn-acceso .material-icons { vertical-align: middle; }

/* ---------------- expediente del hallazgo ---------------- */
.titulo-bloque { font-weight: 700; color: #2d3d70; font-size: .95rem; margin-bottom: .6rem; padding-bottom: .35rem; border-bottom: 2px solid #eef0f6; display: flex; align-items: center; gap: 6px; }
.titulo-bloque .material-icons { font-size: 18px; color: #DC582A; }
.datos-hallazgo dt { font-weight: 600; color: #6c757d; font-size: .88rem; }
.datos-hallazgo dd { margin-bottom: .35rem; }
.texto-descripcion { white-space: normal; }
.tabla-plazos td { font-size: .88rem; }
.causa-raiz { border-left: 3px solid #DC582A; background: #fdf6f2; border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; }
.porques { padding-left: 1.2rem; }
.actividad { border: 1px solid #e3e6ee; border-left: 4px solid #2d3d70; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.actividad-completada { border-left-color: #198754; }
.actividad-atrasada { border-left-color: #dc3545; background: #fff8f8; }
.actividad .progress { height: 16px; }
.seguimientos li { border-top: 1px dashed #dee2e6; padding: 4px 0; }
.historial .evento-historial { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f1f5; }
.icono-historial { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; background: #eef0f6; color: #2d3d70; display: inline-flex; align-items: center; justify-content: center; }
.icono-historial .material-icons { font-size: 18px; }
.evento-cierre .icono-historial { background: #d1e7dd; color: #0f5132; }
.evento-reapertura .icono-historial, .evento-anulacion .icono-historial, .evento-escalamiento .icono-historial { background: #f8d7da; color: #842029; }
.evento-notificacion .icono-historial { background: #fff; color: #6c757d; border: 1px solid #dee2e6; }

/* galeria de evidencias y miniaturas al cargar */
.galeria, .miniaturas { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.item-galeria, .miniatura { position: relative; border: 1px solid #dee2e6; border-radius: 8px; overflow: hidden; background: #fff; }
.item-galeria img, .miniatura img { display: block; width: 100%; height: 110px; object-fit: cover; }
.pie-galeria { font-size: .72rem; color: #6c757d; padding: 2px 6px; }
.borrar-galeria { position: absolute; top: 4px; right: 4px; background: #fff; border-radius: 50%; font-size: 18px; }
.icono-pdf { height: 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #b02a37; padding: 4px; }
.icono-pdf .material-icons { font-size: 42px; }
.quitar-miniatura { position: absolute; top: 4px; right: 4px; padding: 0 4px; line-height: 1; }
.gps-miniatura { position: absolute; bottom: 4px; left: 4px; font-size: 18px; color: #fff; text-shadow: 0 0 3px #000; }

/* ---------------- registro en campo (telefono) ---------------- */
.pagina-captura { padding-top: 56px; padding-bottom: env(safe-area-inset-bottom); }
.contenedor-captura { max-width: 720px; }
.estado-conexion { font-size: .75rem; }
.pestanas-captura .nav-link { color: #2d3d70; padding: 6px 4px; }
.pestanas-captura .nav-link.active { background-color: #2d3d70; color: #fff; }
.pagina-captura .form-control, .pagina-captura .form-select { font-size: 1rem; }

/* ---------------- reportes ---------------- */
.tarjeta-reporte { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #dee2e6; border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.tarjeta-reporte .texto-tarjeta { min-width: 0; line-height: 1.25; }
.tarjeta-reporte .descripcion-tarjeta { font-size: .75rem; color: #6c757d; }
.tarjeta-reporte:hover { border-color: #9aa3c2; }
.tarjeta-reporte.activa { border: 2px solid #DC582A; padding: 7px 11px; background: #fdf6f2; }
.icono-reporte { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; background: #eef0f6; color: #2d3d70; }
.tarjeta-reporte.activa .icono-reporte { background: #DC582A; color: #fff; }
@media (min-width: 992px) { .bloque-filtro + .bloque-filtro { border-left: 1px solid #eef0f6; } }
.panel-reporte .form-label { margin-bottom: .2rem; font-size: .85rem; }
.contenedor-reporte { max-height: 70vh; overflow: auto; border: 1px solid #dee2e6; border-radius: 6px; }
.tabla-reporte { font-size: .8rem; }
.tabla-reporte thead th { position: sticky; top: 0; z-index: 2; background: #2d3d70; color: #fff; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.tabla-reporte td { white-space: nowrap; vertical-align: middle; }
.tabla-reporte tbody tr:nth-child(even):not(.grupo-reporte) td { background: #f4f5f9; }
.tabla-reporte .grupo-reporte td { background: #fdf3ed !important; color: #2d3d70; font-weight: 700; border-left: 4px solid #DC582A; }
.tabla-reporte tfoot .total-reporte td { position: sticky; bottom: 0; background: #2d3d70; color: #fff; font-weight: 700; }
.tabla-reporte .fila-anulada td { color: #b02a37; text-decoration: line-through; }

/* configuracion y permisos */
.tabla-configuracion input[type="number"] { max-width: 90px; }
.tabla-permisos td, .tabla-permisos th { text-align: center; vertical-align: middle; }
.tabla-permisos td:first-child { text-align: left; }

@media (max-width: 576px) {
	.kpi-valor { font-size: 1.4rem; }
	.galeria, .miniaturas { grid-template-columns: repeat(3, 1fr); }
	.item-galeria img, .miniatura img, .icono-pdf { height: 90px; }
}
