body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f5f7fa;
    color: #333;
}

/* --- PANTALLA DE LOGIN (MODAL) --- */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1b4f72;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.5s ease;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #333;
}

.login-logo {
    height: 60px;
    margin-bottom: 20px;
}

header {
    background: #1b4f72;
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.logo {
    height: 40px;
    width: auto;
}

header .title {
    font-size: 18px;
    font-weight: bold;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

header .user-info {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
}

.btn-logout {
    background: #c0392b;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.hidden {
    display: none !important;
}

/* FILTROS */
.filters {
    background: #ffffff;
    padding: 10px 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    border-bottom: 1px solid #dcdcdc;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: bold;
    color: #555;
}

select {
    padding: 4px;
    font-size: 13px;
    margin-top: 4px;
    min-width: 200px;
}

/* Estilo para el filtro de admin */
.admin-only {
    display: none;
    border-left: 1px solid #ccc;
    padding-left: 20px;
}

main {
    padding: 20px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    grid-template-rows: max-content 1fr; /* Ajusta la altura de los KPIs a su contenido */
    grid-template-areas: "kpis sidebar" "main sidebar";
    gap: 20px;
    align-items: start; /* Obliga a que TODO se quede pegado al techo */
}

.zone-a {
    grid-area: kpis;
}

.zone-b {
    grid-area: main;
}

.zone-c {
    grid-area: sidebar;
}

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.card {
    background: #ffffff;
    border-radius: 4px;
    padding: 10px;
    flex: 1 1 150px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card-title {
    font-size: 12px;
    color: #555;
}

.card-value {
    font-size: 20px;
    font-weight: bold;
    margin-top: 4px;
}

.subtext {
    font-size: 11px;
    color: #777;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

th,
td {
    padding: 6px 8px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

th {
    background: #f0f0f0;
}

.sidebar-section {
    background: #ffffff;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sidebar-section h3 {
    margin-top: 0;
    font-size: 13px;
}

.btn-primary {
    display: inline-block;
    padding: 6px 10px;
    background: #1b4f72;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    margin: 5px 0;
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    color: white;
    white-space: nowrap;
}

.badge-alta {
    background: #c0392b;
}

.badge-media {
    background: #f39c12;
}

.badge-baja {
    background: #27ae60;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
        grid-template-areas: "kpis" "main" "sidebar";
    }
}

/* --- BARRA DE CARGA INTEGRADA --- */
.loader-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    background: #ffffff;
    border-radius: 4px;
    /* Opcional: para que tenga altura si no hay nada más */
    min-height: 200px;
}

.loader-logo {
    height: 50px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.progress-track {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background-color: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: #1b4f72;
    width: 30%;
    position: absolute;
    left: -30%;
    border-radius: 10px;
    animation: loadingBar 1.5s infinite ease-in-out;
}

.loader-text {
    color: #777;
    font-size: 13px;
    margin-top: 10px;
}

@keyframes loadingBar {
    0% {
        left: -30%;
        width: 30%;
    }

    50% {
        width: 50%;
    }

    100% {
        left: 100%;
        width: 30%;
    }
}

.btn-secondary {
    background: #546e7a;
    /* Color gris azulado */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #37474f;
}

.admin-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    /* empuja a la derecha en la misma fila */
    padding: 0;
    /* sin padding extra que lo baje */
    border: 0;
    background: transparent;
}

.btn-export {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #0f172a;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
    font-weight: 600;
}

.btn-export:hover {
    transform: translateY(-1px);
}

/* --- MENÚ LATERAL (SIDENAV) --- */
.sidenav {
    height: 100%;
    width: 0;
    /* Empieza cerrado */
    position: fixed;
    z-index: 2000;
    /* Por encima de todo */
    top: 0;
    left: 0;
    background-color: #154360;
    /* Un tono un poco más oscuro que el header */
    overflow-x: hidden;
    transition: 0.4s;
    /* Efecto suave */
    padding-top: 60px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
}

.sidenav a,
.sidenav button {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 16px;
    color: #f1f1f1;
    display: block;
    transition: 0.3s;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.sidenav a:hover,
.sidenav button:hover {
    background-color: #1A5276;
    color: #fff;
}

.sidenav .closebtn {
    position: absolute;
    top: 0;
    right: 20px;
    font-size: 36px;
    margin-left: 0;

    /* IMPORTANTE: Resetear estilos que hereda de "a" */
    width: auto !important;
    /* Que no ocupe el 100% del ancho */
    padding: 0 !important;
    /* Quitar el padding gigante de los botones */
    background: transparent !important;
    /* Que nunca tenga fondo de color */
    display: block;
    text-align: right;
}

/* Evitar que cambie el fondo al pasar el mouse, solo el color de la letra */
.sidenav .closebtn:hover {
    background-color: transparent !important;
    color: #f1f1f1;
    /* Opcional: Color al pasar el mouse */
}

.sidenav button.active {
    background-color: #12364e; /* Un tono más oscuro que el fondo normal */
    border-left: 5px solid #3498db; /* Una barra de color azul claro a la izquierda */
    font-weight: bold;
    color: #ffffff;
    padding-left: 20px; /* Ajuste ligero para que no se mueva el texto */
}

/* Botón hamburguesa en el header */
.hamburger-btn {
    font-size: 24px;
    cursor: pointer;
    color: white;
    margin-right: 15px;
    background: none;
    border: none;
    padding: 0;
}

/* Fondo oscuro cuando se abre el menú */
#main-overlay {
    position: fixed;
    display: none;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    cursor: pointer;
}

/* Estilo para el botón Procurex alineado a la derecha */
.btn-procurex-inline {
    margin-left: auto; /* ESTA ES LA CLAVE: Empuja el elemento a la derecha */
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #1b4f72;
    border-radius: 4px;
    color: #1b4f72;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    transition: all 0.3s ease;
    background-color: white;
    white-space: nowrap;
    margin-bottom: 2px; /* Pequeño ajuste visual */
}

.btn-procurex-inline:hover {
    background-color: #1b4f72;
    color: #ffffff;
}