/* ==============================================================================
   SISINCAL - Escuela Profesional de Enfermería, UNA Puno
   Executive Design System v3 — pulido visual: tipografía, jerarquía de tarjetas,
   estados, sidebar agrupado, login premium, tablas y accesibilidad.
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,300..900;1,300..900&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --primary-navy: #0f3b6c;
    --primary-navy-dark: #071f3d;
    --primary-navy-light: #1e5c9e;
    --secondary-emerald: #16a672;
    --secondary-emerald-dark: #0d7a53;
    --secondary-emerald-light: #4fd8a6;
    --accent-gold: #e8a53d;
    --accent-gold-dark: #b97e1f;
    --danger: #e0505f;
    --bg-surface: #f4f6fb;
    --bg-surface-low: #eaeef7;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --border-glass: rgba(15, 59, 108, 0.10);
    --text-main: #101a2c;
    --text-muted: #5b6472;
    --font-heading: 'Manrope', sans-serif;
    --font-body: 'Hanken Grotesk', sans-serif;
    --shadow-sm: 0 2px 8px 0 rgba(16, 26, 44, 0.06);
    --shadow-md: 0 8px 28px 0 rgba(15, 59, 108, 0.10);
    --shadow-lg: 0 20px 50px 0 rgba(15, 59, 108, 0.16);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --sidebar-width: 280px;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(15, 59, 108, 0.06), transparent),
        radial-gradient(900px 500px at -10% 10%, rgba(22, 166, 114, 0.06), transparent),
        var(--bg-surface);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--primary-navy-dark);
    font-weight: 800;
    letter-spacing: -0.01em;
}

p { line-height: 1.6; }
a { color: var(--primary-navy); text-decoration: none; }
a:hover { color: var(--primary-navy-light); }
code { color: var(--primary-navy-dark); background: var(--bg-surface-low); padding: 1px 6px; border-radius: 5px; font-size: 0.85em; }

/* ------------------------------------------------------------------ Cards -- */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    padding: 26px;
    transition: box-shadow .25s ease, transform .25s ease;
}

.glass-card:hover { box-shadow: var(--shadow-lg); }

/* Stat/KPI card with an icon chip */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
    content: '';
    position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--primary-navy), var(--secondary-emerald));
}
.icon-chip {
    width: 46px; height: 46px; border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.35rem; flex-shrink: 0;
}
.icon-chip.navy { background: rgba(15, 59, 108, 0.10); color: var(--primary-navy); }
.icon-chip.emerald { background: rgba(22, 166, 114, 0.12); color: var(--secondary-emerald-dark); }
.icon-chip.gold { background: rgba(232, 165, 61, 0.16); color: var(--accent-gold-dark); }
.icon-chip.danger { background: rgba(224, 80, 95, 0.12); color: var(--danger); }

/* ------------------------------------------------------------ Layout base -- */
.executive-topbar {
    background: linear-gradient(120deg, var(--primary-navy-dark) 0%, var(--primary-navy) 55%, #0b4a83 100%);
    color: #ffffff;
    min-height: 68px;
    box-shadow: 0 6px 24px rgba(3, 15, 33, 0.25);
    position: relative;
    z-index: 1050;
}

.executive-sidebar {
    background: linear-gradient(180deg, #061a34 0%, #0a2547 100%);
    color: #ffffff;
    min-height: calc(100vh - 68px);
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.executive-sidebar .nav-section-label {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.38);
    text-transform: uppercase;
    font-weight: 700;
    padding: 18px 22px 6px;
}

.executive-sidebar .nav-link {
    color: rgba(255,255,255,0.82);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin: 2px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background .18s ease, color .18s ease, transform .12s ease;
    position: relative;
}

.executive-sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; opacity: .9; }

.executive-sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.executive-sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(22,166,114,0.22), rgba(22,166,114,0.05));
    color: #ffffff;
    box-shadow: inset 3px 0 0 var(--secondary-emerald-light);
}

.executive-sidebar .nav-link.active i { color: var(--secondary-emerald-light); opacity: 1; }

.executive-sidebar .nav-link:focus-visible,
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
}

/* Sidebar responsive (off-canvas) */
#btnToggleSidebar { line-height: 1; transition: transform .2s ease; }
.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(3, 12, 26, 0.6);
    backdrop-filter: blur(2px);
    z-index: 1030;
}
@media (max-width: 991.98px) {
    .executive-sidebar {
        position: fixed; top: 0; left: 0; height: 100vh; min-height: 100vh;
        z-index: 1040; transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
        padding-top: 68px;
        box-shadow: var(--shadow-lg);
    }
    .executive-sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.open { display: block; }
}

/* ------------------------------------------------------------------ Nav pills / tabs -- */
.nav-pills .nav-link {
    border-radius: 999px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 9px 18px;
    color: var(--primary-navy);
    background: #fff;
    border: 1px solid var(--border-glass);
}
.nav-pills .nav-link.active { background: var(--primary-navy); border-color: var(--primary-navy); }

/* ------------------------------------------------------------------ Buttons -- */
.btn { border-radius: var(--radius-sm); font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.01em; }
.btn-primary { background: var(--primary-navy); border-color: var(--primary-navy); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-navy-light); border-color: var(--primary-navy-light); }
.btn-success { background: var(--secondary-emerald); border-color: var(--secondary-emerald); }
.btn-success:hover { background: var(--secondary-emerald-dark); border-color: var(--secondary-emerald-dark); }
.btn-outline-primary { color: var(--primary-navy); border-color: var(--primary-navy); }
.btn-outline-primary:hover { background: var(--primary-navy); }

/* ------------------------------------------------------------------ Badges -- */
.badge-status {
    padding: 5px 13px; border-radius: 999px; font-size: 0.78rem; font-weight: 800;
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
    letter-spacing: 0.01em;
}
.badge-lp { background-color: #dcf5ea; color: #0d7a53; border-color: #b8ecd3; }
.badge-l  { background-color: #dbeafe; color: #1e5c9e; border-color: #bfdbfe; }
.badge-nl { background-color: #fde2e4; color: #b3283a; border-color: #f8c1c6; }

.badge-evidencia-aprobado    { background-color: #dcf5ea; color: #0d7a53; }
.badge-evidencia-en_revision { background-color: #fdf1d6; color: #9a6a05; }
.badge-evidencia-observado   { background-color: #fde2e4; color: #b3283a; }
.badge-evidencia-pendiente   { background-color: #eaeef4; color: #55606f; }

/* ------------------------------------------------------------------ Progreso -- */
.progress-sineace { height: 12px; border-radius: 999px; background-color: #e6eaf2; overflow: hidden; }
.progress-sineace .progress-bar {
    background: linear-gradient(90deg, var(--primary-navy) 0%, var(--secondary-emerald) 100%);
    border-radius: 999px;
    transition: width .5s cubic-bezier(.2,.8,.2,1);
}

/* ------------------------------------------------------------------ Tablas -- */
.table { --bs-table-bg: transparent; }
.table thead.table-dark th, thead.table-dark th {
    background: var(--primary-navy-dark) !important;
    color: #fff; font-family: var(--font-heading);
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
    border: none; vertical-align: middle;
}
.table-hover > tbody > tr:hover > * { background-color: rgba(15, 59, 108, 0.035); }
.table > :not(caption) > * > * { padding: 0.65rem 0.75rem; }

/* Contador de palabras */
.word-counter-badge { font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.word-counter-badge.ok { background: #dcf5ea; color: #0d7a53; }
.word-counter-badge.danger { background: #fde2e4; color: #b3283a; }

/* -------------------------------------------------------- Stepper de acreditación -- */
.acred-stepper { display: flex; flex-wrap: wrap; gap: 0; counter-reset: step; }
.acred-stepper .step { flex: 1 1 200px; text-align: center; padding: 18px 10px; position: relative; }
.acred-stepper .step .circle {
    width: 46px; height: 46px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px; font-weight: 800; font-family: var(--font-heading);
    background: #e9ecf3; color: #8a93a3; border: 2px solid #dde2ec;
    transition: all .25s ease;
}
.acred-stepper .step.done .circle { background: var(--secondary-emerald); color: #fff; border-color: var(--secondary-emerald-dark); }
.acred-stepper .step.active .circle { background: var(--primary-navy); color: #fff; border-color: var(--primary-navy-dark); box-shadow: 0 0 0 7px rgba(15,59,108,0.14); }
.acred-stepper .step .line { position: absolute; top: 41px; right: -50%; width: 100%; height: 3px; background: #dde2ec; z-index: -1; }
.acred-stepper .step.done .line { background: var(--secondary-emerald); }
.acred-stepper .step:last-child .line { display: none; }

/* --- Checklist de documentos por evidencia (módulo SINEACE Coneau) ------------ */
.doc-list { display: flex; flex-direction: column; gap: 8px; }

.doc-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--border-glass);
    border-left: 4px solid #c7cedb;
    border-radius: var(--radius-sm);
    transition: box-shadow .15s ease, border-color .15s ease;
}
.doc-row:hover { box-shadow: var(--shadow-sm); }

.doc-row.doc-estado-pendiente  { border-left-color: #adb5bd; }
.doc-row.doc-estado-subido     { border-left-color: var(--accent-gold); }
.doc-row.doc-estado-observado  { border-left-color: var(--danger); }
.doc-row.doc-estado-aprobado   { border-left-color: var(--secondary-emerald); }

.doc-icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; margin-top: 2px;
}
.doc-icon-pdf   { background: #fde2e4; color: #b3283a; }
.doc-icon-word  { background: #dbeafe; color: #1e5c9e; }
.doc-icon-excel { background: #dcf5ea; color: #0d7a53; }
.doc-icon-ppt   { background: #fdf1d6; color: #9a6a05; }
.doc-icon-img   { background: #ecdcfb; color: #7c3aed; }
.doc-icon-otro  { background: #eaeef4; color: #55606f; }
.doc-icon-vacio { background: #f4f6fb; color: #adb5bd; border: 1px dashed #c7cedb; }

.doc-main { flex: 1 1 auto; min-width: 0; }
.doc-name { font-weight: 600; font-size: 0.88rem; color: var(--text-main); margin-bottom: 4px; }
.doc-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.doc-controls .form-select, .doc-controls .form-control { font-size: 0.82rem; }
.doc-select-vigente.doc-vigente-si { border-color: var(--secondary-emerald); color: var(--secondary-emerald-dark); font-weight: 600; }
.doc-select-vigente.doc-vigente-no { border-color: var(--danger); color: var(--danger); font-weight: 600; }
.doc-select-vigente.doc-vigente-pendiente { color: var(--text-muted); }

.doc-actions { display: flex; gap: 4px; flex-shrink: 0; padding-top: 2px; }

@media (max-width: 575.98px) {
    .doc-row { flex-wrap: wrap; }
    .doc-controls .form-select, .doc-controls .form-control, .doc-controls input[type="file"] { max-width: 100% !important; flex: 1 1 100%; }
}

/* ------------------------------------------------- Navegación y secciones numeradas (reportes) -- */
.rev-subnav { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,0.92); backdrop-filter: blur(6px); border-radius: 10px; box-shadow: 0 2px 10px rgba(15,59,108,0.08); }
.rev-subnav a { padding: 0.5rem 0.9rem; font-size: 0.82rem; font-weight: 700; color: #55606f; border-radius: 8px; white-space: nowrap; }
.rev-subnav a:hover { background: rgba(15,59,108,0.08); color: var(--primary-navy); }
.rev-section-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.rev-section-num {
    width: 28px; height: 28px; border-radius: 50%; background: var(--primary-navy); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; flex-shrink: 0;
}
@media print { .rev-subnav { display: none; } }

/* Bloque de evidencia con borde de color según su estado derivado (checklist y reportes) */
.rev-ev-block { border-left: 4px solid #c9d0da; border-radius: 0 10px 10px 0; padding: 0.6rem 0.9rem; margin-bottom: 0.6rem; background: rgba(255,255,255,0.6); transition: box-shadow .15s ease; }
.rev-ev-block.rev-ev-aprobado { border-left-color: var(--secondary-emerald); }
.rev-ev-block.rev-ev-en_revision { border-left-color: var(--accent-gold); }
.rev-ev-block.rev-ev-observado { border-left-color: var(--danger); }
.rev-ev-block.rev-ev-pendiente { border-left-color: #adb5bd; }

/* --------------------------------------------- Barra de herramientas (búsqueda / filtros) -- */
.ev-toolbar { background: var(--bg-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border-glass); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }

/* Chips compactos de conteo (matriz de evidencias) */
.chip-conteo { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.chip-conteo.chip-aprobado    { background: #dcf5ea; color: #0d7a53; }
.chip-conteo.chip-en_revision { background: #fdf1d6; color: #9a6a05; }
.chip-conteo.chip-observado   { background: #fde2e4; color: #b3283a; }
.chip-conteo.chip-pendiente   { background: #eaeef4; color: #55606f; }

/* Flecha de expandir/colapsar en cabeceras de acordeón custom */
.acc-chevron { transition: transform .25s ease; color: var(--text-muted); }
[aria-expanded="true"] .acc-chevron { transform: rotate(180deg); }

/* ------------------------------------------------------------------ Estados vacíos / carga -- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; color: var(--border-glass); display: block; margin-bottom: 14px; }

.skeleton {
    background: linear-gradient(90deg, #eceff5 25%, #f6f7fb 37%, #eceff5 63%);
    background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 8px;
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------------ Utilidades -- */
.hover-border { transition: box-shadow .2s ease, transform .2s ease; }
.hover-border:hover { box-shadow: 0 0 0 3px var(--secondary-emerald) inset; transform: translateY(-2px); }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* -------------------------------------------------------- Banner del Dashboard -- */
.dash-hero {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background:
        linear-gradient(120deg, rgba(7,31,61,0.91) 0%, rgba(15,59,108,0.84) 60%, rgba(13,122,83,0.78) 130%),
        url('../img/una-puno-ingreso-thumb.jpg');
    background-size: cover;
    background-position: center 65%;
    padding: 26px 30px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.dash-hero-content { display: flex; align-items: center; gap: 16px; min-width: 0; }
.dash-hero-logo { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 12px; padding: 5px; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.dash-hero h2 { color: #fff; }
@media (max-width: 575.98px) { .dash-hero { padding: 20px; } .dash-hero-logo { width: 44px; height: 44px; } }

/* ------------------------------------------------------------------ Login -- */
.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--bg-surface);
}
@media (max-width: 900px) { .login-shell { grid-template-columns: 1fr; } .login-hero { display: none; } }

.login-hero {
    background:
        linear-gradient(150deg, rgba(7,31,61,0.93) 0%, rgba(15,59,108,0.90) 55%, rgba(13,122,83,0.86) 130%),
        url('../img/una-puno-ingreso-hero.jpg');
    background-size: cover;
    background-position: center;
    color: #fff;
    display: flex; flex-direction: column; justify-content: center;
    padding: 64px;
    position: relative;
    overflow: hidden;
}
.login-hero::after {
    content: '';
    position: absolute; width: 480px; height: 480px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.10), transparent 70%);
    top: -160px; right: -160px;
}
.login-hero .brand-badge {
    width: 64px; height: 64px; border-radius: 16px;
    background: #fff; display: flex; align-items: center; justify-content: center;
    padding: 6px; margin-bottom: 24px; box-shadow: var(--shadow-md); position: relative; z-index: 1;
}
.login-hero .brand-badge img { width: 100%; height: 100%; object-fit: contain; }
.login-hero h1 { color: #fff; font-size: 2.1rem; max-width: 480px; }
.login-hero p.lead { color: rgba(255,255,255,0.75); max-width: 460px; font-size: 1rem; }
.login-hero .hero-stat { border-top: 1px solid rgba(255,255,255,0.18); padding-top: 20px; margin-top: 32px; display: flex; gap: 32px; flex-wrap: wrap; }
.login-hero .hero-stat b { display: block; font-family: var(--font-heading); font-size: 1.5rem; }
.login-hero .hero-stat span { color: rgba(255,255,255,0.65); font-size: 0.82rem; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card {
    width: 100%; max-width: 420px;
    background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 40px 36px; border: 1px solid var(--border-glass);
}
.login-card .form-control { border-radius: var(--radius-sm); padding: 10px 14px; border-color: #dde2ec; }
.login-card .form-control:focus { border-color: var(--primary-navy-light); box-shadow: 0 0 0 3px rgba(15,59,108,0.12); }
.login-card .input-group-text { border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg-surface-low); border-color: #dde2ec; }

/* ------------------------------------------------------------- Impresión (Anexo 2) -- */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
    .glass-card { box-shadow: none !important; border: 1px solid #ccc !important; backdrop-filter: none !important; break-inside: avoid; page-break-inside: avoid; }
}
body.print-mode { background: #fff; }
body.print-mode main { max-width: 100%; padding: 24px; }
