:root {
    --azul: #1d4e89;
    --azul-claro: #eaf1fb;
    --gris: #f4f4f6;
    --texto: #26303a;
    --borde: #d7dde3;
    --nivel1: #f6c6c6;
    --nivel2: #f9dcb3;
    --nivel3: #f9f0b3;
    --nivel4: #d4eab3;
    --nivel5: #b3e6c2;
}
* { box-sizing: border-box; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--gris);
    color: var(--texto);
    margin: 0;
}
.topbar {
    background: var(--azul);
    color: #fff;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 24px;
    flex-wrap: wrap;
}
.topbar nav a { color: #fff; text-decoration: none; margin-left: 18px; }
.topbar nav a:hover { text-decoration: underline; }
.logo-inicio { display: block; margin: 30px auto 0; max-width: 220px; width: 100%; height: auto; }
.btn-nav {
    background: #fff;
    color: var(--azul) !important;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
}
.container { max-width: 1100px; margin: 24px auto; padding: 0 16px 60px; }

h1, h2 { color: var(--azul); }

table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--borde); text-align: left; }
th { background: var(--azul-claro); }
tr:hover td { background: #fafcff; }

.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }

form.filtros { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: flex-end; }
form.filtros label { display: block; font-size: .85em; margin-bottom: 4px; color: #555; }
input, select, textarea {
    padding: 8px 10px;
    border: 1px solid var(--borde);
    border-radius: 6px;
    font-size: 1em;
}
button, .btn {
    background: var(--azul);
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { opacity: .9; }
.btn-secundario { background: #fff; color: var(--azul); border: 1px solid var(--azul); }

.badge { padding: 3px 10px; border-radius: 12px; font-size: .8em; font-weight: 600; }
.badge-completada { background: #d4eab3; color: #2c5a1a; }
.badge-en_progreso { background: #f9dcb3; color: #7a4a0e; }

.criterio { margin-bottom: 26px; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.criterio-titulo { background: var(--azul-claro); padding: 10px 14px; font-weight: 600; display:flex; justify-content: space-between; }
.niveles { display: grid; grid-template-columns: repeat(5, 1fr); }
.nivel { padding: 12px; border-left: 1px solid var(--borde); font-size: .88em; display: flex; flex-direction: column; justify-content: space-between; }
.nivel:nth-child(1) { background: var(--nivel1); }
.nivel:nth-child(2) { background: var(--nivel2); }
.nivel:nth-child(3) { background: var(--nivel3); }
.nivel:nth-child(4) { background: var(--nivel4); }
.nivel:nth-child(5) { background: var(--nivel5); }
.nivel p { flex: 1; margin: 0 0 10px; }
.nivel .opciones { display: flex; gap: 6px; }
.nivel button.puntuar {
    flex: 1;
    background: #fff;
    color: var(--texto);
    border: 1px solid rgba(0,0,0,.2);
    padding: 6px 0;
    font-weight: 700;
}
.nivel button.puntuar.seleccionada {
    background: var(--azul);
    color: #fff;
    border-color: var(--azul);
}
.resumen-notas { display: flex; gap: 24px; margin: 20px 0; flex-wrap: wrap; }
.resumen-notas .caja { background: #fff; border-radius: 8px; padding: 16px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); text-align: center; }
.resumen-notas .caja .valor { font-size: 1.8em; font-weight: 700; color: var(--azul); }
.aviso { background: #fff3cd; border: 1px solid #ffe08a; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.comentario-criterio { width: 100%; margin-top: 8px; }

.modal-fondo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-fondo.visible { display: flex; }
.modal-caja {
    background: #fff;
    border-radius: 10px;
    padding: 26px 30px;
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}
.modal-cerrar {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    color: #888;
}
.modal-cerrar:hover { color: #333; }
