/* SRHCL — Hoja de estilos única */
:root {
    --azul: #14532d;
    --azul-oscuro: #0b3d1e;
    --acento: #16a34a;
    --fondo: #f4f6f5;
    --tarjeta: #ffffff;
    --texto: #1f2937;
    --texto-suave: #6b7280;
    --borde: #d7ded9;
    --rojo: #dc2626;
    --amarillo: #d97706;
    --verde: #16a34a;
    --rojo-fondo: #fee2e2;
    --amarillo-fondo: #fef3c7;
    --verde-fondo: #dcfce7;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }

/* Barra superior */
.barra-superior {
    display: flex; align-items: center; gap: 1.5rem;
    background: var(--azul); color: #fff;
    padding: .55rem 1.25rem; flex-wrap: wrap;
}
.barra-superior a { color: #fff; }
.marca { font-weight: 700; font-size: 1.2rem; letter-spacing: .04em; }
.barra-superior nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.barra-superior nav a { padding: .3rem .7rem; border-radius: .4rem; font-size: .92rem; }
.barra-superior nav a:hover { background: var(--azul-oscuro); text-decoration: none; }
/* OBS-022: el resaltado verde marca el módulo activo (se aplica desde layout.php). */
.barra-superior nav a.activo { background: var(--acento); font-weight: 600; }
.usuario-sesion { display: flex; align-items: center; gap: .7rem; font-size: .88rem; }
.usuario-sesion em { opacity: .75; font-style: normal; }

.contenido { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.pie { text-align: center; color: var(--texto-suave); font-size: .8rem; padding: 1.5rem 0; }

/* Botones y formularios */
.btn {
    display: inline-block; border: none; border-radius: .4rem; cursor: pointer;
    background: var(--azul); color: #fff; padding: .5rem 1rem; font-size: .92rem;
}
.btn:hover { background: var(--azul-oscuro); text-decoration: none; }
.btn-secundario { background: var(--texto-suave); }
.btn-secundario:hover { background: #4b5563; }
.btn-peligro { background: var(--rojo); }
.btn-peligro:hover { background: #991b1b; }
.btn-chico { padding: .25rem .6rem; font-size: .82rem; }
form.accion-en-linea { display: inline; }

.campo { margin-bottom: .9rem; }
.campo label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
.campo input[type=text], .campo input[type=password], .campo input[type=date],
.campo input[type=email], .campo input[type=number], .campo select, .campo textarea {
    width: 100%; max-width: 560px; padding: .5rem .6rem; border: 1px solid var(--borde);
    border-radius: .4rem; font-size: .95rem; font-family: inherit; background: #fff;
}
.campo textarea { min-height: 90px; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
    outline: 2px solid var(--acento); outline-offset: -1px;
}
.checkbox-fila { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.checkbox-fila label { display: flex; gap: .35rem; align-items: center; font-weight: 400; }

.filtros { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: .6rem; padding: 1rem; margin-bottom: 1.25rem; }
.filtros .fila { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.filtros .campo { margin-bottom: 0; min-width: 170px; }

/* Tarjetas y tablas */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.tarjeta {
    background: var(--tarjeta); border: 1px solid var(--borde); border-radius: .6rem;
    padding: 1rem 1.1rem;
}
.tarjeta .numero { font-size: 1.9rem; font-weight: 700; color: var(--azul); }
.tarjeta .etiqueta { color: var(--texto-suave); font-size: .88rem; }
.tarjeta.alerta-roja .numero { color: var(--rojo); }
.tarjeta.alerta-amarilla .numero { color: var(--amarillo); }

table.listado { width: 100%; border-collapse: collapse; background: var(--tarjeta); border: 1px solid var(--borde); }
table.listado th, table.listado td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: top; }
table.listado th { background: #eef2ef; font-size: .85rem; }
table.listado tr:hover td { background: #f8faf8; }

/* Estados de cumplimiento */
.estado {
    display: inline-block; min-width: 1rem; height: 1rem; border-radius: 50%;
    vertical-align: middle; margin-right: .35rem;
}
.estado.verde { background: var(--verde); }
.estado.amarillo { background: var(--amarillo); }
.estado.rojo { background: var(--rojo); }
.pastilla {
    display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
}
.pastilla.verde { background: var(--verde-fondo); color: #14532d; }
.pastilla.amarillo { background: var(--amarillo-fondo); color: #78350f; }
.pastilla.rojo { background: var(--rojo-fondo); color: #7f1d1d; }

/* Barras de progreso */
.barra { background: #e5e9e6; border-radius: 999px; height: 12px; overflow: hidden; min-width: 120px; }
.barra > div { height: 100%; background: var(--acento); border-radius: 999px; }
.barra.baja > div { background: var(--rojo); }
.barra.media > div { background: var(--amarillo); }
.barra-con-numero { display: flex; align-items: center; gap: .6rem; }
.barra-con-numero .valor { font-weight: 700; min-width: 2.6rem; text-align: right; }

/* Flash */
.flash { padding: .7rem 1rem; border-radius: .5rem; margin-bottom: 1rem; }
.flash-ok { background: var(--verde-fondo); color: #14532d; border: 1px solid #86efac; }
.flash-error { background: var(--rojo-fondo); color: #7f1d1d; border: 1px solid #fca5a5; }

/* Login */
.pagina-login { max-width: 400px; margin: 8vh auto; background: var(--tarjeta); border: 1px solid var(--borde); border-radius: .8rem; padding: 2rem; }
.pagina-login h1 { text-align: center; margin-bottom: .25rem; }
.pagina-login .sub { text-align: center; color: var(--texto-suave); margin-bottom: 1.5rem; font-size: .9rem; }
.pagina-login .campo input { max-width: none; }

/* Modo inspección */
body.modo-inspeccion { background: #10241a; }
body.modo-inspeccion .contenido { max-width: 1400px; }
body.modo-inspeccion .pie { color: #9fb5a8; }
.busqueda-rapida { display: flex; gap: .6rem; margin-bottom: 1rem; }
.busqueda-rapida input {
    flex: 1; padding: .8rem 1rem; font-size: 1.05rem; border-radius: .5rem;
    border: 2px solid var(--acento); background: #fff;
}
.pestanas { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pestanas button {
    padding: .55rem 1.1rem; border-radius: .5rem; border: none; cursor: pointer;
    background: #1d3a2a; color: #cde4d4; font-size: .95rem; font-weight: 600;
}
.pestanas button.activa { background: var(--acento); color: #fff; }
.panel-materia { display: none; }
.panel-materia.activo { display: block; }
.norma-bloque {
    background: var(--tarjeta); border: 1px solid var(--borde); border-radius: .6rem;
    margin-bottom: .8rem; overflow: hidden;
}
.norma-cabecera {
    display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
    padding: .6rem .9rem; background: #eef2ef; cursor: pointer;
}
.norma-cabecera .clave { font-weight: 700; }
.norma-cabecera .tema { color: var(--texto-suave); font-size: .88rem; flex: 1; }
.norma-cuerpo { display: none; }
.norma-bloque.abierta .norma-cuerpo { display: block; }
.punto-fila {
    display: flex; gap: .7rem; align-items: flex-start; padding: .55rem .9rem;
    border-top: 1px solid var(--borde);
}
.punto-fila .codigo { font-weight: 700; min-width: 3.2rem; }
.punto-fila .requisito { flex: 1; }
.punto-fila .acciones { white-space: nowrap; }
.detalle-punto { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: .6rem; padding: 1.25rem; }
.documento-tarjeta {
    border: 1px solid var(--borde); border-radius: .5rem; padding: .8rem 1rem;
    margin-bottom: .7rem; background: #fbfdfb;
}
.vista-documento { width: 100%; height: 75vh; border: 1px solid var(--borde); border-radius: .5rem; background: #fff; }
.vista-documento img { max-width: 100%; }

/* Impresión */
@media print {
    @page { margin: 1cm; }
    .no-imprimir { display: none !important; }
    body { background: #fff; }
    .contenido { max-width: none; padding: 0; }
    /* OBS-018: la imagen debe caber en una sola página al imprimir. */
    .area-imprimible img { max-width: 100%; max-height: calc(100vh - 2cm); }
}
.area-imprimible { background: #fff; }

/* Utilidades */
.derecha { text-align: right; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.sutil { color: var(--texto-suave); font-size: .85rem; }
.paginacion { display: flex; gap: .4rem; align-items: center; margin-top: 1rem; flex-wrap: wrap; }
.paginacion a, .paginacion span.actual {
    padding: .3rem .65rem; border: 1px solid var(--borde); border-radius: .35rem; background: var(--tarjeta);
}
.paginacion span.actual { background: var(--azul); color: #fff; border-color: var(--azul); }
.grupo-norma { border: 1px solid var(--borde); border-radius: .5rem; margin-bottom: .8rem; }
.grupo-norma summary { padding: .5rem .8rem; background: #eef2ef; cursor: pointer; font-weight: 600; }
.grupo-norma .cuerpo { padding: .5rem .8rem; }
