:root {
    --sidebar-width: 290px;
    --sidebar-collapsed-width: 94px;
    --brand-navy: #15324b;
    --brand-navy-2: #0f2538;
    --brand-navy-3: #224663;
    --brand-gold: #c89d34;
    --brand-gold-soft: rgba(200, 157, 52, .12);
    --surface: #edf1f5;
    --surface-2: #ffffff;
    --sidebar-text: #d7e2ec;
    --sidebar-text-soft: #93a8bb;
    --sidebar-hover: rgba(255,255,255,.08);
    --sidebar-active: rgba(200,157,52,.16);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-soft: #d6dde5;
    --shadow-soft: 0 20px 45px rgba(15, 23, 42, 0.08);
    --white: #ffffff;
}

html, body {
    background: var(--surface);
    min-height: 100%;
}

.auth-logo-wrapper {
    text-align: center;
    margin-bottom: 30px; /* espacio abajo */
}

.auth-logo1 {
    max-width: 380px; /* más grande */
    height: auto;
    display: inline-block;
}

.auth-logo2 {
    max-width: 100%; /* más grande */
    height: auto;
    display: inline-block;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text-main);
}

a { text-decoration: none; }

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 1040;
    background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-navy-2) 100%);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: var(--shadow-soft);
    transition: width .25s ease, transform .25s ease;
    overflow-y: auto;
}

.sidebar-inner {
    min-height: 100vh;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 1035;
}

.app-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left .25s ease;
}

body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
}

body.sidebar-collapsed .app-content {
    margin-left: 0;
}

.sidebar-brand {
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.logo-panel {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(200,157,52,.28);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
}

.sidebar-logo-lg {
    width: 100%;
    max-width: 215px;
    height: auto;
}

.brand-kicker {
    color: var(--brand-gold);
    letter-spacing: .08em;
    font-size: .74rem;
    font-weight: 700;
}

.brand-title {
    color: var(--white);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.15;
}

.brand-caption {
    color: var(--sidebar-text-soft);
    line-height: 1.45;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .55rem;           /* menos espacio entre icono y texto */
    padding: .45rem .85rem; /* menos altura */
    border-radius: 1rem;
    color: var(--sidebar-text) !important;
    font-weight: 600;
    transition: all .18s ease;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: var(--white) !important;
}

.nav-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .8rem;
    background: rgba(200,157,52,.12);
    color: var(--brand-gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.25rem;
    box-shadow: inset 0 0 0 1px rgba(200,157,52,.18);
    font-size: 1rem;
}

.header-shell {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid rgba(214,221,229,.9);
    backdrop-filter: blur(10px);
}

.page-content {
    padding-bottom: 2rem !important;
}

.sidebar-toggle-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-soft);
    border-radius: .9rem;
    background-color: #fff;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 11px;
}

.sidebar-toggle-btn span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--brand-navy);
    border-radius: 99px;
}

.topbar-heading,
.topbar-user-wrap {
    min-width: 0;
}


.institution-logo-card {
    align-items: center;
    gap: .85rem;
    padding: .55rem .8rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(255,255,255,.96) 0%, rgba(246,248,251,.96) 100%);
    border: 1px solid rgba(214,221,229,.95);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    max-width: 300px;
}

.institution-logo-frame {
    width: 58px;
    height: 58px;
    border-radius: .95rem;
    background-color: #fff;
    border: 1px solid rgba(214,221,229,.95);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .4rem;
    flex: 0 0 58px;
}

.institution-logo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.institution-logo-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.institution-logo-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .2rem;
}

.institution-logo-copy strong {
    color: var(--brand-navy);
    font-size: .92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-brand,
.page-title,
.auth-brand-title {
    color: var(--brand-navy) !important;
}

.shell-card,
.auth-card,
.card,
.form-control,
.form-select,
.btn,
.alert,
.table-responsive {
    border-radius: 1rem;
}

.card.shell-card,
.auth-card,
.card {
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(215, 222, 231, .95) !important;
    background: var(--white);
}

.auth-card {
    overflow: hidden;
}

.auth-brand-panel {
    background: linear-gradient(180deg, var(--brand-navy) 0%, #10273c 100%);
    color: var(--white);
    border-right: 1px solid rgba(255,255,255,.06);
}

.auth-logo-wrap {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(200,157,52,.28);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
}

.auth-logo {
    width: 100%;
    max-width: 260px;
    height: auto;
}

.auth-brand-copy {
    color: #c5d2de !important;
}

.eyebrow {
    color: var(--brand-gold);
    letter-spacing: .12em;
    text-transform: uppercase;
    font-size: .76rem;
    font-weight: 700;
}

.form-control,
.form-select {
    border: 1px solid var(--border-soft);
    padding-top: .82rem;
    padding-bottom: .82rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #89a8ca;
    box-shadow: 0 0 0 .2rem rgba(41, 72, 110, .12);
}

.form-label {
    font-weight: 600;
    color: var(--brand-navy);
}

.table thead th {
    background: #f6f8fb;
    color: #4b5563;
    font-size: .88rem;
    white-space: nowrap;
    border-bottom: 1px solid #e5e7eb;
}

.table > :not(caption) > * > * {
    padding-top: .95rem;
    padding-bottom: .95rem;
}

.btn-primary {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background: #10273c !important;
    border-color: #10273c !important;
}

.btn-outline-primary {
    color: var(--brand-navy);
    border-color: #b7c7d8;
}

.btn-outline-primary:hover {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
}

.btn-outline-secondary {
    color: #4b5563;
    border-color: #ced6e0;
}

.btn-outline-secondary:hover {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #c7d0db;
}

.kpi-card .card-body { padding: 1.35rem; }
.page-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.pill-note {
    display: inline-flex;
    align-items: center;
    padding: .65rem .9rem;
    background: var(--brand-gold-soft);
    border: 1px solid rgba(200,157,52,.2);
    color: #7c5e10;
    border-radius: 999px;
    font-weight: 600;
    font-size: .9rem;
}

hr, .border-top, .border-bottom { border-color: rgba(217, 226, 236, .9) !important; }
.badge.text-bg-success { background: #e8f7ed !important; color: #12733c !important; }
.text-bg-light { background: #f5f7fb !important; }
.text-bg-warning-subtle { background: #fff6db !important; }
.text-warning-emphasis { color: #8a6400 !important; }
.bg-brand-soft { background: var(--surface); }

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: min(86vw, 320px);
    }

    .app-content {
        margin-left: 0 !important;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    body.sidebar-collapsed .app-sidebar {
        width: min(86vw, 320px);
    }

    body.sidebar-collapsed .sidebar-copy,
    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .brand-caption {
        opacity: 1;
        visibility: visible;
        width: auto;
        height: auto;
    }

    .auth-logo { max-width: 150px; }
}


.users-table td:last-child {
    min-width: 250px;
}

.user-actions .btn {
    min-width: 92px;
}

.sidebar-nav .nav-link:hover .nav-icon,
.sidebar-nav .nav-link.active .nav-icon {
    background: rgba(200,157,52,.22);
    color: #fff2c7;
}

.user-actions .btn i,
.btn i {
    line-height: 1;
}

.kpi-icon {
    color: var(--brand-gold);
    font-size: 1rem;
}

.table td .badge i {
    margin-right: .25rem;
}


/* Ajuste puntual de contraste en login */
.auth-brand-title{
    color:#ffffff !important;
}
.auth-brand-copy{
    color:rgba(255,255,255,.82) !important;
}


/* ===== Auditoría de contraste global (sin tocar estructura) ===== */

/* Encabezados y textos principales */
.text-brand,
.page-title {
    color: var(--brand-navy) !important;
}

.text-muted,
.page-subtitle,
.small.text-muted {
    color: #556577 !important;
}

/* Login */
.auth-brand-panel .auth-brand-title,
.auth-brand-panel h1,
.auth-brand-panel h2,
.auth-brand-panel h3,
.auth-brand-panel .h1,
.auth-brand-panel .h2,
.auth-brand-panel .h3 {
    color: #ffffff !important;
}
.auth-brand-panel .auth-brand-copy,
.auth-brand-panel p,
.auth-brand-panel small {
    color: rgba(255,255,255,.86) !important;
}
.auth-brand-panel .eyebrow {
    color: #f0c75e !important;
}

/* Sidebar */
.sidebar-nav .nav-link {
    color: #dfe8f1 !important;
}
.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #ffffff !important;
}
.brand-caption,
.sidebar-text-soft {
    color: #aebfd0 !important;
}
.brand-title,
.sidebar-brand .brand-title,
.sidebar-brand .brand-kicker {
    text-shadow: none;
}
.nav-icon {
    color: #f1c860 !important;
}
.sidebar-nav .nav-link:hover .nav-icon,
.sidebar-nav .nav-link.active .nav-icon {
    color: #fff7dd !important;
}

/* Topbar / encabezado */
.header-shell,
.card-header,
.table thead th {
    color: #334155 !important;
}

/* Tarjetas, KPI y etiquetas */
.card,
.card-body,
.card-title,
.card-text {
    color: var(--text-main);
}
.pill-note {
    color: #6a4d00 !important;
}
.kpi-icon {
    color: #a97810 !important;
}

/* Formularios */
.form-label {
    color: #1f3a56 !important;
}
.form-text {
    color: #5f6f82 !important;
}
.form-control,
.form-select {
    color: #1f2937 !important;
}
.form-control::placeholder {
    color: #7a8796 !important;
    opacity: 1;
}
.input-group-text {
    color: #35506c !important;
}

/* Botones */
.btn-outline-primary {
    color: #15324b !important;
    border-color: #9fb4c7 !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    color: #ffffff !important;
}
.btn-outline-secondary {
    color: #425466 !important;
    border-color: #c5d0db !important;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    color: #1f2937 !important;
}
.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:active,
.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success:active,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active {
    color: #ffffff !important;
}

/* Tablas */
.table tbody td,
.table tbody th {
    color: #243447 !important;
}
.table td .text-muted,
.table th .text-muted {
    color: #5c6b7a !important;
}

/* Badges y alerts */
.badge,
.alert {
    color: inherit;
}
.badge.text-bg-success {
    color: #0f5f30 !important;
}
.text-bg-light,
.badge.bg-light,
.badge.text-bg-light {
    color: #425466 !important;
}
.text-bg-warning-subtle,
.alert-warning {
    color: #6b4e00 !important;
}
.alert-info {
    color: #0f4c81 !important;
}
.alert-danger {
    color: #842029 !important;
}
.alert-success {
    color: #0f5f30 !important;
}


/* Dashboard admin filters and charts */
.dashboard-filter-card .form-label{
    margin-bottom: .45rem;
}
.dashboard-chart-body{
    min-height: 360px;
}
.chart-wrap{
    position: relative;
    width: 100%;
}
.chart-wrap-bar{
    height: 320px;
}
.chart-wrap-donut{
    width: min(100%, 300px);
    height: 300px;
    margin: 0 auto;
}
@media (max-width: 1199.98px){
    .chart-wrap-donut{
        width: min(100%, 260px);
        height: 260px;
    }
}


/* Módulo mapa */
.trainings-map{
    width: 100%;
    height: 640px;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(215, 222, 231, .95);
}
.map-legend{
    display: flex;
    flex-direction: column;
    gap: .75rem;
}
.map-legend-item{
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .95rem;
    color: #243447;
}
.map-legend-swatch{
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 3px rgba(21, 50, 75, .08);
}
.map-popup-title{
    font-weight: 700;
    color: #15324b;
    margin-bottom: .35rem;
}
.map-popup-meta{
    font-size: .9rem;
    color: #425466;
    line-height: 1.55;
}
.map-empty-state{
    min-height: 420px;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    color:#5f6f82;
    background:#f8fafc;
    border-radius:1rem;
}
@media (max-width: 991.98px){
    .trainings-map{
        height: 520px;
    }
}


.gm-style .map-popup-title{
    font-weight: 700;
    color: #15324b;
    margin-bottom: .35rem;
}
.gm-style .map-popup-meta{
    font-size: .9rem;
    color: #425466;
    line-height: 1.55;
}


.leaflet-container{
    width: 100%;
    height: 100%;
    border-radius: 1rem;
}


@media (max-width: 991.98px) {
    .header-shell {
        flex-wrap: wrap;
    }

    .topbar-user-wrap {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 767.98px) {
    .header-shell {
        align-items: flex-start;
    }

    .topbar-user-wrap {
        gap: .75rem;
    }
}


/* Ajuste correcto del logo institucional en topbar */
.topbar-main{
    position: relative;
    min-height: 96px;
}
.topbar-center-logo{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    min-width: 240px;
    max-width: 360px;
    height: 72px;
}
.logo-institucion-topbar{
    display: block;
    max-width: 320px;
    height: 65px;
    width: auto;
    object-fit: contain;
    object-position: center;
}
@media (max-width: 991.98px){
    .topbar-main{
        min-height: 86px;
    }
    .topbar-center-logo{
        min-width: 180px;
        max-width: 260px;
        height: 62px;
    }
    .logo-institucion-topbar{
        max-width: 240px;
        height: 52px;
    }
}

/* FIX SIDEBAR COLAPSO COMPLETO */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
}

body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}


/* FIX REAL: ocultar completamente la barra lateral */
body.sidebar-collapsed .app-sidebar{
    transform: translateX(-100%) !important;
    width: var(--sidebar-width) !important;
    box-shadow: none !important;
    border-right: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.sidebar-collapsed .app-content{
    margin-left: 0 !important;
}

body.sidebar-open .app-sidebar{
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

@media (max-width: 991.98px){
    .app-sidebar{
        transform: translateX(-100%) !important;
        visibility: hidden;
        pointer-events: none;
    }

    body.sidebar-open .app-sidebar{
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .app-content{
        margin-left: 0 !important;
    }
}

.report-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
}

.report-kpi {
    overflow: hidden;
    position: relative;
}
.report-kpi::after {
    content: '';
    position: absolute;
    inset: auto -20px -20px auto;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    opacity: .12;
    background: currentColor;
}
.report-kpi-1 { color: #14532d; background: linear-gradient(135deg, rgba(187,247,208,.75), #fff 60%); }
.report-kpi-2 { color: #1d4ed8; background: linear-gradient(135deg, rgba(191,219,254,.75), #fff 60%); }
.report-kpi-3 { color: #7c3aed; background: linear-gradient(135deg, rgba(221,214,254,.8), #fff 60%); }
.report-kpi-4 { color: #b45309; background: linear-gradient(135deg, rgba(253,230,138,.8), #fff 60%); }
.report-kpi-5 { color: #be185d; background: linear-gradient(135deg, rgba(251,207,232,.85), #fff 60%); }

.report-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.report-bar-item {
    padding: 1rem 1rem 1.05rem;
    background: linear-gradient(180deg, rgba(248,250,252,.9), rgba(255,255,255,1));
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
}
.report-bar-track {
    width: 100%;
    height: 14px;
    background: #e8edf3;
    border-radius: 999px;
    overflow: hidden;
}
.report-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-navy), var(--brand-gold));
}

.modality-pills {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}
.modality-pill {
    border: 1px solid var(--border-soft);
    border-radius: 1rem;
    padding: .95rem 1rem;
    background-color: #fff;
}
.report-insight-box {
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    background: linear-gradient(135deg, rgba(21,50,75,.08), rgba(200,157,52,.14));
    border: 1px solid rgba(21,50,75,.1);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 1rem;
    align-items: end;
    min-height: 290px;
}
.month-col {
    text-align: center;
}
.month-bar-wrap {
    height: 180px;
    display: flex;
    align-items: end;
    justify-content: center;
    padding: 0 .25rem;
}
.month-bar {
    width: 100%;
    max-width: 50px;
    border-radius: 1rem 1rem .35rem .35rem;
    background: linear-gradient(180deg, var(--brand-gold), var(--brand-navy));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}

.report-compact-table td,
.report-compact-table th {
    white-space: normal;
}

@media print {
    .app-sidebar,
    .header-shell,
    .sidebar-overlay,
    .dashboard-filter-card .btn,
    .page-hero .btn {
        display: none !important;
    }

    .app-content {
        margin-left: 0 !important;
    }

    body, html {
        background: #fff !important;
    }

    .shell-card, .card {
        box-shadow: none !important;
        border: 1px solid #d8dee6 !important;
    }
}


/* Restaurar flecha visible en todos los combobox */
.form-select {
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right .75rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2.5rem !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}
