/* ============================================================================
   RESET + VARIABLES
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary:    #2563eb;
    --secondary:  #1e40af;
    --success:    #10b981;
    --danger:     #ef4444;
    --warning:    #f59e0b;
    --info:       #06b6d4;
    --gray-50:    #f9fafb;
    --gray-100:   #f3f4f6;
    --gray-200:   #e5e7eb;
    --gray-300:   #d1d5db;
    --gray-400:   #9ca3af;
    --gray-500:   #6b7280;
    --gray-600:   #4b5563;
    --gray-700:   #374151;
    --gray-800:   #1f2937;
    --gray-900:   #111827;
    --background: #f8fafc;
    --text:       #1e293b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* ============================================================================
   HEADER
   ============================================================================ */
.header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 64px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.5rem;
}

.header-nav {
    display: flex;
    gap: .5rem;
    flex: 1;
}

.nav-item {
    padding: .5rem 1rem;
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    font-size: .875rem;
    border-radius: 6px;
    transition: all .2s;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--primary);
    color: #fff;
}

.badge-nav {
    background: var(--danger);
    color: #fff;
    font-size: .688rem;
    padding: .125rem .5rem;
    border-radius: 10px;
    margin-left: .5rem;
    font-weight: 700;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    color: var(--gray-900);
}

.user-role {
    display: block;
    font-size: .75rem;
    color: var(--gray-600);
}

.btn-logout {
    background: var(--danger);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: all .2s;
}

.btn-logout:hover {
    background: #dc2626;
}

/* ============================================================================
   CONTAINER / PAGE HEADER
   ============================================================================ */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: .5rem;
}

.page-subtitle {
    color: var(--gray-600);
    font-size: .875rem;
}

/* ============================================================================
   CARDS
   ============================================================================ */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-header h4,
.card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

.card-body.p-0 {
    padding: 0;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    border-left: 4px solid;
}

.alert-success {
    background: #dcfce7;
    border-left-color: var(--success);
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    border-left-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    border-left-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #e0f2fe;
    border-left-color: var(--info);
    color: #075985;
}

/* ============================================================================
   TABLES
   ============================================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--gray-50);
    padding: .75rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    border-bottom: 2px solid var(--gray-200);
}

.table tbody td {
    padding: .875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: .875rem;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-sm td,
.table-sm th {
    padding: .5rem 1rem;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    padding: .625rem 1.25rem;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    font-size: .875rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-info {
    background: var(--info);
    color: #fff;
}

.btn-secondary {
    background: var(--gray-600);
    color: #fff;
}

.btn-sm {
    padding: .375rem .75rem;
    font-size: .813rem;
}

/* ============================================================================
   BADGES
   ============================================================================ */
.badge {
    display: inline-block;
    padding: .25rem .625rem;
    border-radius: 12px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

.badge-secondary {
    background: var(--gray-200);
    color: var(--gray-600);
}

/* ============================================================================
   STAT CARDS (Métricas)
   ============================================================================ */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 140px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.stat-card .stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: .75rem;
}

.stat-card .stat-title {
    font-size: .75rem;
    color: var(--gray-600);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .5px;
}

.stat-card .stat-icon {
    font-size: 1.5rem;
    opacity: .3;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
    margin-bottom: .25rem;
}

.stat-card .stat-label {
    font-size: .75rem;
    color: var(--gray-600);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-card.primary {
    border-left-color: var(--primary);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.info {
    border-left-color: var(--info);
}

/* ============================================================================
   DASHBOARD METRICS (grid de 4 columnas)
   ============================================================================ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #94a3b8;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.metric-card.blue {
    border-left-color: #3b82f6;
}

.metric-card.green {
    border-left-color: #10b981;
}

.metric-card.orange {
    border-left-color: #f59e0b;
}

.metric-card.red {
    border-left-color: #ef4444;
}
.metric-card.purple {
    border-left-color: #7c3aed;
}

.metric-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: #6b7280;
}

/* ============================================================================
   GRIDS UTILITY
   ============================================================================ */
.row-2grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.charts-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ============================================================================
   ADMIN OPTIONS
   ============================================================================ */
.admin-options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.admin-option-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: #1e293b;
    transition: all 0.2s;
}

.admin-option-card:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.option-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.option-label {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */
.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-2 {
    gap: .5rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--gray-600) !important;
}

.mb-2 {
    margin-bottom: .5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-2 {
    margin-top: .5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Chart wrapper */
.chart-wrap {
    height: 320px;
    position: relative;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 992px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .row-2grid {
        grid-template-columns: 1fr;
    }

    .charts-2col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-options-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        height: 120px;
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .stat-card .stat-label {
        font-size: .7rem;
    }
}

@media (max-width: 640px) {
    .header-nav {
        display: none;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .admin-options-grid {
        grid-template-columns: 1fr;
    }
}
/* ============================================================================
   TOP BAR
   ============================================================================ */
.top-bar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    height: 64px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.top-bar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-600);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.system-name {
    font-weight: 700;
    color: var(--primary);
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    background: var(--gray-200);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.btn-logout {
    background: var(--danger);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ============================================================================
   APP CONTAINER (SIDEBAR + CONTENT)
   ============================================================================ */
.app-container {
    display: flex;
    margin-top: 64px; /* altura del top bar */
    min-height: calc(100vh - 64px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--gray-200);
    transition: width 0.3s, transform 0.3s;
    overflow-y: auto;
    position: fixed;
    top: 64px;
    bottom: 0;
    left: 0;
    z-index: 900;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-header {
    padding: 0.75rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gray-600);
    letter-spacing: 0.5px;
    background: var(--gray-50);
}

.sidebar-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    color: var(--gray-900);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.sidebar-item a:hover {
    background: var(--gray-100);
}

.sidebar-item a.active {
    background: var(--primary);
    color: white;
}

.sidebar-item a.active .badge-nav {
    background: white;
    color: var(--primary);
}

.badge-nav {
    background: var(--primary);
    color: white;
    border-radius: 10px;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 260px; /* mismo ancho que el sidebar */
    padding: 2rem;
    transition: margin-left 0.3s;
}

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .user-name, .user-role {
        display: none;
    }
}
.glosa-container {
    max-width: 100%; /* ya es el ancho completo, pero puedes ajustar */
}
/* Opcional: si quieres que el textarea tenga un ancho mayor que el estándar, puedes darle un ancho fijo */
.glosa-container textarea {
    width: 100%; /* ya lo tiene, pero si quieres más ancho, cambia a 120% o algo así, pero cuidado con el layout */
}
.required-field::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}
.user-dropdown {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.user-dropdown .dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    overflow: hidden;
}

.user-dropdown:hover .dropdown-content {
    display: block;
}

.user-dropdown .dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
}

.user-dropdown .dropdown-content a:hover {
    background-color: #f1f1f1;
}

.user-name {
    font-weight: 600;
}

.user-role {
    background: var(--gray-200);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}
/* ============================================================================
   DASHBOARD CONTAINER
   ============================================================================ */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================================================
   FORM CONTROLS
   ============================================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.375rem;
}

.form-label.required::after {
    content: " *";
    color: var(--danger);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--gray-900);
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.5;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control:disabled,
.form-control[readonly] {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    display: block;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* ============================================================================
   GRID SYSTEM (simple 12-col)
   ============================================================================ */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.row > [class^="col"] {
    flex: 1 1 0;
    min-width: 0;
}

/* Fracciones más comunes */
.col-1  { flex: 0 0 calc(8.33%  - 0.5rem); }
.col-2  { flex: 0 0 calc(16.66% - 0.5rem); }
.col-3  { flex: 0 0 calc(25%    - 0.5rem); }
.col-4  { flex: 0 0 calc(33.33% - 0.5rem); }
.col-5  { flex: 0 0 calc(41.66% - 0.5rem); }
.col-6  { flex: 0 0 calc(50%    - 0.5rem); }
.col-7  { flex: 0 0 calc(58.33% - 0.5rem); }
.col-8  { flex: 0 0 calc(66.66% - 0.5rem); }
.col-9  { flex: 0 0 calc(75%    - 0.5rem); }
.col-10 { flex: 0 0 calc(83.33% - 0.5rem); }
.col-11 { flex: 0 0 calc(91.66% - 0.5rem); }
.col-12 { flex: 0 0 100%; }

/* Bootstrap-compatible aliases */
.col-md-3  { flex: 0 0 calc(25%    - 0.5rem); }
.col-md-4  { flex: 0 0 calc(33.33% - 0.5rem); }
.col-md-6  { flex: 0 0 calc(50%    - 0.5rem); }
.col-md-8  { flex: 0 0 calc(66.66% - 0.5rem); }
.col-md-12 { flex: 0 0 100%; }
.col-lg-4  { flex: 0 0 calc(33.33% - 0.5rem); }
.col-lg-6  { flex: 0 0 calc(50%    - 0.5rem); }
.col-lg-8  { flex: 0 0 calc(66.66% - 0.5rem); }

@media (max-width: 768px) {
    .row > [class^="col"] { flex: 0 0 100%; }
}

/* ============================================================================
   LIST GROUP
   ============================================================================ */
.list-group {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.list-group-flush {
    border: none;
    border-radius: 0;
}

.list-group-item {
    padding: 0.875rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    color: var(--gray-900);
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item-action {
    display: block;
    text-decoration: none;
    transition: background 0.15s;
}

.list-group-item-action:hover {
    background: var(--gray-50);
}

/* ============================================================================
   TYPOGRAPHY UTILITIES
   ============================================================================ */
.fw-bold   { font-weight: 700; }
.fw-600    { font-weight: 600; }
.text-end  { text-align: right; }
.text-start{ text-align: left; }
.text-muted{ color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-primary { color: var(--primary); }
.small, small { font-size: 0.8rem; }
.fs-sm     { font-size: 0.8125rem; }

/* ============================================================================
   SPACING UTILITIES (extras)
   ============================================================================ */
.p-0   { padding: 0; }
.p-1   { padding: 0.25rem; }
.p-2   { padding: 0.5rem; }
.p-3   { padding: 1rem; }
.p-4   { padding: 1.5rem; }
.px-3  { padding-left: 1rem; padding-right: 1rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.ms-1  { margin-left: 0.25rem; }
.ms-2  { margin-left: 0.5rem; }
.me-1  { margin-right: 0.25rem; }
.me-2  { margin-right: 0.5rem; }
.mt-0  { margin-top: 0; }

/* ============================================================================
   FLEX UTILITIES
   ============================================================================ */
.align-items-center  { align-items: center; }
.justify-content-end { justify-content: flex-end; }
.justify-content-between { justify-content: space-between; }
.flex-wrap           { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-3 { gap: 1rem; }
.gap-4 { gap: 1.5rem; }
.d-flex              { display: flex; }
.d-block             { display: block; }
.d-none              { display: none; }
.d-inline-flex       { display: inline-flex; }
.justify-between     { justify-content: space-between; }

/* ============================================================================
   INPUT GROUP
   ============================================================================ */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 6px 0 0 6px;
    flex: 1;
}

.input-group .btn {
    border-radius: 0 6px 6px 0;
}

/* ============================================================================
   PAGE HEADER ACTIONS
   ============================================================================ */
.page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ============================================================================
   PROGRESS BAR
   ============================================================================ */
.progress {
    background: var(--gray-200);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.bg-success { background: var(--success); }
.progress-bar.bg-danger  { background: var(--danger); }
.progress-bar.bg-warning { background: var(--warning); }

/* ============================================================================
   PAGINATION
   ============================================================================ */
.pagination {
    display: flex;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    color: var(--gray-700);
    transition: all 0.15s;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination .page-item .page-link:hover {
    background: var(--gray-100);
}

/* ============================================================================
   MODAL (básico)
   ============================================================================ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    max-width: 560px;
    width: 90%;
    overflow: hidden;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 { margin: 0; font-size: 1rem; font-weight: 700; }

.modal-body   { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ============================================================================
   ESTADO BADGES (SICAF-specific)
   ============================================================================ */
.badge-abierta           { background: #dcfce7; color: #166534; }
.badge-cerrada           { background: #f1f5f9; color: #475569; }
.badge-pendiente         { background: #fef3c7; color: #92400e; }
.badge-pendiente_aprobacion { background: #dbeafe; color: #1e40af; }
.badge-aprobado          { background: #dcfce7; color: #166534; }
.badge-rechazado         { background: #fee2e2; color: #991b1b; }
.badge-rendida           { background: #e0f2fe; color: #075985; }
.badge-vencida           { background: #fee2e2; color: #991b1b; }
.badge-pagada_total      { background: #dcfce7; color: #166534; }
.badge-pagada_parcial    { background: #fef3c7; color: #92400e; }

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    .sidebar, .top-bar, .page-actions, .btn, .menu-toggle { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* ============================================================================
   TOP-BAR ENHANCEMENTS — breadcrumbs, help button, user dropdown
   ============================================================================ */

/* Right section of top bar */
.top-bar-right {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-left: auto;
}

/* Help "?" button */
.btn-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    border: 1.5px solid rgba(255,255,255,.35);
    transition: background .2s, transform .15s;
    flex-shrink: 0;
}
.btn-help:hover {
    background: rgba(255,255,255,.3);
    transform: scale(1.1);
    color: #fff;
}

/* ============================================================================
   BREADCRUMB NAV
   ============================================================================ */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    font-size: .82rem;
    flex: 1;
    padding: 0 1rem;
    overflow: hidden;
}
.breadcrumb-link {
    color: rgba(255,255,255,.75);
    text-decoration: none;
    white-space: nowrap;
    transition: color .15s;
}
.breadcrumb-link:hover { color: #fff; text-decoration: underline; }
.breadcrumb-sep {
    color: rgba(255,255,255,.45);
    font-size: .8rem;
    flex-shrink: 0;
}
.breadcrumb-current {
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
    .breadcrumb-nav { display: none; }
}

/* ============================================================================
   USER AVATAR & DROPDOWN
   ============================================================================ */
.user-dropdown {
    position: relative;
}
.user-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    padding: .35rem .6rem;
    border-radius: 8px;
    transition: background .2s;
    user-select: none;
}
.user-info:hover { background: rgba(255,255,255,.15); }

.user-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    color: #fff;
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,.4);
}
.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-name {
    font-size: .85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}
.user-role {
    font-size: .68rem;
    color: rgba(255,255,255,.7);
    letter-spacing: .04em;
}
.dropdown-arrow {
    color: rgba(255,255,255,.7);
    font-size: .75rem;
    transition: transform .2s;
}
.user-dropdown:hover .dropdown-arrow,
.user-dropdown.open .dropdown-arrow { transform: rotate(180deg); }

@media (max-width: 640px) {
    .user-meta { display: none; }
    .dropdown-arrow { display: none; }
}

/* Dropdown panel */
.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    border: 1px solid var(--gray-200);
    z-index: 9999;
    overflow: hidden;
    animation: dropIn .15s ease;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.user-dropdown:hover .dropdown-content,
.user-dropdown.open .dropdown-content { display: block; }

.dropdown-header {
    padding: .85rem 1rem;
    background: var(--gray-50, #f8fafc);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.dropdown-header strong {
    font-size: .9rem;
    color: var(--text);
}
.dropdown-header small {
    font-size: .75rem;
    color: var(--gray-600);
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1rem;
    font-size: .85rem;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}
.dropdown-content a:hover { background: var(--gray-50, #f8fafc); }

.dropdown-divider {
    height: 1px;
    background: var(--gray-200);
    margin: .2rem 0;
}
.dropdown-logout { color: #dc2626 !important; }
.dropdown-logout:hover { background: #fef2f2 !important; }

/* ============================================================================
   TOAST / FLASH MESSAGES
   ============================================================================ */
.toast-container {
    position: fixed;
    top: 4.5rem;
    right: 1.5rem;
    z-index: 99999;
    min-width: 280px;
    max-width: 420px;
    transition: opacity .4s;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.14);
    font-size: .88rem;
    background: #fff;
    border-left: 4px solid var(--gray-300);
    animation: slideIn .25s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
.toast-success  { border-left-color: #16a34a; }
.toast-danger   { border-left-color: #dc2626; }
.toast-warning  { border-left-color: #d97706; }
.toast-info     { border-left-color: #2563eb; }

.toast-icon {
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: .05rem;
}
.toast-success  .toast-icon { color: #16a34a; }
.toast-danger   .toast-icon { color: #dc2626; }
.toast-warning  .toast-icon { color: #d97706; }
.toast-info     .toast-icon { color: #2563eb; }

.toast-msg { flex: 1; color: var(--text); line-height: 1.4; }
.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--gray-500, #6b7280);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color .15s;
}
.toast-close:hover { color: var(--text); }

/* ============================================================================
   CONTENT PAGE HEADER (title row below the top-bar)
   ============================================================================ */
.content-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.content-page-title h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}
.content-page-title .page-subtitle {
    margin: .25rem 0 0;
    font-size: .875rem;
    color: var(--gray-600);
}

/* ============================================================================
   SIDEBAR FOOTER
   ============================================================================ */
.sidebar-footer {
    margin-top: auto;
    padding: .9rem 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .72rem;
    color: rgba(255,255,255,.45);
    line-height: 1.5;
    text-align: center;
    letter-spacing: .03em;
}
.sidebar-footer strong {
    display: block;
    color: rgba(255,255,255,.65);
    font-size: .78rem;
    margin-bottom: .15rem;
}

/* ============================================================================
   NOTIFICATION BELL
   ============================================================================ */
.notif-bell-wrap {
    position: relative;
}
.notif-bell {
    position: relative;
    background: rgba(255,255,255,.15);
    border: 1.5px solid rgba(255,255,255,.35);
    color: #fff;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
    padding: 0;
}
.notif-bell:hover { background: rgba(255,255,255,.3); }

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    border-radius: 999px;
    min-width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 .2rem;
    border: 1.5px solid var(--primary);
    pointer-events: none;
}

.notif-panel {
    display: none;
    position: absolute;
    top: calc(100% + .5rem);
    right: 0;
    min-width: 240px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    border: 1px solid var(--gray-200);
    z-index: 9999;
    overflow: hidden;
    animation: dropIn .15s ease;
}
.notif-panel.open { display: block; }

.notif-panel-header {
    padding: .65rem 1rem;
    font-size: .8rem;
    font-weight: 700;
    color: var(--gray-600);
    letter-spacing: .05em;
    text-transform: uppercase;
    background: var(--gray-50, #f8fafc);
    border-bottom: 1px solid var(--gray-200);
}
.notif-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    font-size: .84rem;
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
    border-bottom: 1px solid var(--gray-200);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #fef9ec; }
.notif-item-icon { font-size: 1rem; flex-shrink: 0; }
.notif-empty {
    padding: .9rem 1rem;
    font-size: .84rem;
    color: var(--gray-600);
    text-align: center;
}

/* ── Report modules nav bar ─────────────────────────────────────────────── */
.report-modules-nav {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
}
.report-module-btn {
    display: flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1rem;
    background: var(--white);
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: .88rem;
    font-weight: 500;
    transition: border-color .15s, box-shadow .15s, background .15s;
    position: relative;
}
.report-module-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37,99,235,.12);
    background: #f0f7ff;
    color: var(--primary);
    text-decoration: none;
}
.report-module-btn.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary);
}
.report-module-btn.report-module-featured {
    border-color: #7c3aed;
    background: #faf5ff;
    color: #5b21b6;
}
.report-module-btn.report-module-featured:hover {
    border-color: #5b21b6;
    background: #f3e8ff;
    box-shadow: 0 2px 8px rgba(124,58,237,.15);
}
.report-module-icon { font-size: 1.1rem; }
.report-module-tag {
    font-size: .72rem;
    background: #7c3aed;
    color: #fff;
    border-radius: 4px;
    padding: .1rem .4rem;
    margin-left: .25rem;
    font-weight: 600;
    letter-spacing: .02em;
}

/* ============================================================================
   UX POLISH v1.1 — hover, transitions, focus, print, skeleton
   ============================================================================ */

/* ── Metric cards: subtle lift on hover ───────────────────────────────────── */
.metric-card {
    transition: transform .2s ease, box-shadow .2s ease;
}
.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

/* ── Cards: smoother shadow ──────────────────────────────────────────────── */
.card {
    transition: box-shadow .2s ease;
}
.card:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,.08);
}

/* ── Sidebar links: smoother active indicator ─────────────────────────────── */
.sidebar-item a {
    transition: background .15s, color .15s, border-left-color .15s;
}
.sidebar-item a.active {
    border-left: 3px solid var(--primary);
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

/* ── Buttons: consistent focus ring ──────────────────────────────────────── */
.btn:focus-visible,
.form-control:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .4);
    outline-offset: 2px;
}

/* ── Table rows: consistent hover ────────────────────────────────────────── */
.table tbody tr {
    transition: background .12s;
}
.table tbody tr:hover {
    background: #f0f7ff;
}

/* ── Form submit button: loading state ───────────────────────────────────── */
.btn[data-loading="true"] {
    opacity: .7;
    pointer-events: none;
    cursor: not-allowed;
}

/* ── Page header: subtle bottom border ───────────────────────────────────── */
.content-page-header {
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

/* ── Badge-nav: purple variant ───────────────────────────────────────────── */
.badge-nav-purple {
    background: #7c3aed !important;
}

/* ── Alert: flex alignment ───────────────────────────────────────────────── */
.alert.d-flex.align-items-center {
    display: flex;
    align-items: center;
    gap: .75rem;
}

/* ── Print: more comprehensive ───────────────────────────────────────────── */
@media print {
    .sidebar, .top-bar, .page-actions, .btn, .menu-toggle,
    .notif-bell-wrap, .user-dropdown, .btn-help,
    .aprob-tabs, form[method="post"] { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
    .metrics-grid { display: grid !important; grid-template-columns: repeat(4,1fr) !important; }
    .metric-card { box-shadow: none !important; border: 1px solid #ccc !important; }
    body { font-size: 11pt; color: #000; }
    h2, h3, h4 { color: #000 !important; }
    a { color: #000 !important; text-decoration: none; }
    .badge, .badge-nav { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    thead { display: table-header-group; }
    tr { break-inside: avoid; }
}

/* ── Skeleton loader for deferred content ────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-wave 1.5s infinite;
    border-radius: 4px;
    display: inline-block;
}
@keyframes skeleton-wave {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Modal backdrop z-index fix ─────────────────────────────────────────── */
.modal-backdrop {
    z-index: 2000;
}

/* ── Responsive table improvement ───────────────────────────────────────── */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .top-bar-container {
        gap: .5rem;
    }
    .breadcrumb-nav {
        display: none;
    }
}
