* { box-sizing: border-box; }

/* ── Ventana emergente (modal) para avisos/errores ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.visible { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.modal-box h3 { margin: 0 0 10px; font-size: 16px; }
.modal-box.es-error h3 { color: #b42318; }
.modal-box.es-exito h3 { color: #166534; }
.modal-box p { font-size: 14px; color: #333; margin: 0 0 20px; white-space: pre-line; }

/* ── Campo de contraseña con botón para mostrar/ocultar ── */
.campo-password { position: relative; }
.campo-password input { width: 100%; padding-right: 38px; }
.campo-password .btn-ver-clave {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 6px;
    color: #667085;
}
.campo-password .btn-ver-clave:hover { color: #344054; }
body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Arial, sans-serif;
    background: #f2f4f7;
    color: #1f2937;
}
/* ── Layout con barra lateral ── */
:root {
    --sidebar-w: 230px;
}
body.con-sidebar { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #0057A8;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}
.sidebar-logo, .sidebar-footer { flex-shrink: 0; }
/* Las opciones del menú se desplazan con su propia barra; el pie
   (usuario, Mi Perfil, Cerrar sesión) queda siempre visible abajo. */
.sidebar-nav {
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.4) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.35); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.55); }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.15);
}
.sidebar-logo span { color: #fff; font-size: 15px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: 13px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.activo { background: rgba(255,255,255,.2); color: #fff; font-weight: 500; }
.nav-ico { font-size: 16px; }
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-usuario { display: flex; align-items: center; gap: 10px; }
.usuario-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}
.usuario-nombre { color: #fff; font-size: 13px; font-weight: 500; }
.usuario-rol { color: rgba(255,255,255,.65); font-size: 11px; }
.btn-salir {
    display: block;
    text-align: center;
    padding: 8px;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}
.btn-salir:hover { background: rgba(255,255,255,.22); color: #fff; }

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    /* Sin esto, el área principal crece al ancho de una tabla ancha y aparece
       una barra horizontal en toda la página en vez de solo en la tabla. */
    min-width: 0;
}

/* Páginas con una tabla grande (Ver POA, Certificados): la página queda fija
   al alto de la pantalla y la tabla ocupa el espacio que sobra, con sus
   propias barras de desplazamiento siempre visibles (sin barras externas). */
body.pagina-tabla { height: 100vh; overflow: hidden; }
body.pagina-tabla .main {
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: none;
}
body.pagina-tabla .main > * { flex: 0 0 auto; }
body.pagina-tabla .main > .tabla-wrap { flex: 0 1 auto; min-height: 120px; max-height: none; }
body.pagina-tabla .main > p:last-child { margin: 8px 0 0; }
/* En pantallas muy bajas se vuelve al desplazamiento normal de la página. */
@media (max-height: 560px) {
    body.pagina-tabla { height: auto; overflow: visible; }
    body.pagina-tabla .main { height: auto; overflow: visible; }
    body.pagina-tabla .main > .tabla-wrap { max-height: 70vh; }
}

/* Barras de desplazamiento de las tablas más visibles y fáciles de agarrar. */
.tabla-wrap { scrollbar-width: auto; scrollbar-color: #98a2b3 #eef0f3; }
.tabla-wrap::-webkit-scrollbar { width: 14px; height: 14px; }
.tabla-wrap::-webkit-scrollbar-track { background: #eef0f3; }
.tabla-wrap::-webkit-scrollbar-thumb { background: #98a2b3; border-radius: 7px; border: 3px solid #eef0f3; }
.tabla-wrap::-webkit-scrollbar-thumb:hover { background: #667085; }
.tabla-wrap::-webkit-scrollbar-corner { background: #eef0f3; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.page-titulo { font-size: 20px; font-weight: 600; color: #1a2233; margin: 0; }

.login-box {
    max-width: 360px;
    margin: 80px auto;
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.login-box h2 { margin-top: 0; text-align: center; color: #0057A8; }
.campo { margin-bottom: 16px; }
.campo label { display: block; margin-bottom: 4px; font-size: 13px; color: #555; }
.campo input, .campo select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 5px;
    font-size: 14px;
}
.btn {
    background: #0057A8;
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #00417d; }
.alerta {
    background: #fdecea;
    color: #b42318;
    padding: 10px 14px;
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 13px;
}

.filtros {
    background: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 18px;
    display: flex;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.resumen-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card .label { font-size: 12px; color: #667085; text-transform: uppercase; }
.card .valor { font-size: 22px; font-weight: 600; margin-top: 4px; }

.tabla-wrap {
    background: #fff;
    border-radius: 8px;
    overflow: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    max-height: 70vh;
}
table { border-collapse: collapse; width: 100%; font-size: 13px; white-space: nowrap; }
th, td { padding: 8px 10px; border-bottom: 1px solid #eef0f2; text-align: left; }
th { background: #f9fafb; position: sticky; top: 0; z-index: 1; color: #344054; }
tr:hover td { background: #f8fafc; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.pill-alto { background: #dcfce7; color: #166534; }
.pill-medio { background: #fef9c3; color: #854d0e; }
.pill-bajo { background: #fee2e2; color: #991b1b; }
.pill-azul { background: #dbeafe; color: #1e40af; }
.pill-gris { background: #eef0f3; color: #475467; }

/* ── Contador en el menú lateral (solicitudes pendientes) ── */
.nav-contador {
    margin-left: auto;
    background: #fff;
    color: #0057A8;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
}
.nav-seccion {
    font-size: 10px; font-weight: 700; color: rgba(255,255,255,.55); text-transform: uppercase;
    letter-spacing: .8px; padding: 14px 12px 4px;
}
.btn-secundario { background: #fff; color: #0057A8; border: 1px solid #0057A8; }
.btn-secundario:hover { background: #f0f6fc; }
.btn-peligro { background: #b42318; }
.btn-peligro:hover { background: #912018; }
.zona-archivo-lista { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; color: #344054; pointer-events: none; }
.zona-archivo-lista li { padding: 1px 0; }

/* ── Zonas para arrastrar y soltar archivos (assets/js/arrastrar-archivos.js) ── */
.zona-archivo {
    position: relative;
    border: 2px dashed #b9c4d0;
    border-radius: 8px;
    background: #f9fbfd;
    padding: 18px 14px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.zona-archivo:hover { border-color: #7aa7d6; }
.zona-archivo.encima { border-color: #0057A8; background: #eaf3fc; }
.zona-archivo.con-archivo { border-style: solid; border-color: #a6e3b5; background: #f2fbf4; }
.zona-archivo.con-error { border-color: #f5c2bd; background: #fdecea; }
/* El campo real cubre toda la zona (invisible): un clic en cualquier parte abre el selector. */
.zona-archivo input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.zona-archivo-texto { font-size: 13px; color: #344054; pointer-events: none; line-height: 1.5; }
.zona-archivo-ayuda { display: block; font-size: 12px; color: #667085; margin-top: 2px; }
